changeset 6501:53e890956cb6

Merge
author erikj
date Tue, 03 Jun 2014 14:55:50 +0200
parents 4f58850627c5 b14e7c0b7d3e
children 55bd9acf24de
files agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java src/share/vm/classfile/classLoader.cpp src/share/vm/classfile/dictionary.cpp src/share/vm/classfile/javaClasses.cpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/libadt/port.cpp src/share/vm/libadt/port.hpp src/share/vm/prims/jvm.cpp src/share/vm/runtime/globals.hpp src/share/vm/runtime/os.cpp src/share/vm/runtime/reflection.cpp test/runtime/7110720/Test7110720.sh test/runtime/SharedArchiveFile/CdsWriteError.java test/testlibrary/com/oracle/java/testlibrary/DynamicVMOptionChecker.java test/testlibrary/com/oracle/java/testlibrary/TestDynamicVMOption.java
diffstat 538 files changed, 9065 insertions(+), 5211 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue May 20 15:59:50 2014 +0200
+++ b/.hgtags	Tue Jun 03 14:55:50 2014 +0200
@@ -416,3 +416,5 @@
 783309c3a1a629a452673399dcfa83ef7eca94d8 jdk9-b11
 1c383bb39e2849ca62cb763f4e182a29b421d60a jdk9-b12
 456ad9c99133803d4e1433124c85a6fd141b9ac9 jdk9-b13
+bd333491bb6c012d7b606939406d0fa9a5ac7ffd jdk9-b14
+170f6d733d7aec062f743a6b8c1cce940a7a984a jdk9-b15
--- a/agent/src/os/linux/libproc.h	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/os/linux/libproc.h	Tue Jun 03 14:55:50 2014 +0200
@@ -34,19 +34,7 @@
 #include "libproc_md.h"
 #endif
 
-#if defined(sparc) || defined(sparcv9)
-/*
-  If _LP64 is defined ptrace.h should be taken from /usr/include/asm-sparc64
-  otherwise it should be from /usr/include/asm-sparc
-  These two files define pt_regs structure differently
-*/
-#ifdef _LP64
-#include "asm-sparc64/ptrace.h"
-#else
-#include "asm-sparc/ptrace.h"
-#endif
-
-#endif //sparc or sparcv9
+#include <linux/ptrace.h>
 
 /************************************************************************************
 
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java	Tue Jun 03 14:55:50 2014 +0200
@@ -64,7 +64,11 @@
   }
 
   public Compile compilerData() {
-    return new Compile(compilerDataField.getValue(this.getAddress()));
+    Address addr = compilerDataField.getValue(this.getAddress());
+    if (addr == null) {
+      return null;
+    }
+    return new Compile(addr);
   }
 
   public ciObjectFactory factory() {
@@ -94,10 +98,7 @@
     Method method = task.method();
     int entryBci = task.osrBci();
     int compLevel = task.compLevel();
-    Klass holder = method.getMethodHolder();
-    out.print("compile " + holder.getName().asString() + " " +
-              OopUtilities.escapeString(method.getName().asString()) + " " +
-              method.getSignature().asString() + " " +
+    out.print("compile " + method.nameAsAscii() + " " +
               entryBci + " " + compLevel);
     Compile compiler = compilerData();
     if (compiler != null) {
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciKlass.java	Tue Jun 03 14:55:50 2014 +0200
@@ -55,4 +55,9 @@
   public ciKlass(Address addr) {
     super(addr);
   }
+
+  public void printValueOn(PrintStream tty) {
+    Klass k = (Klass)getMetadata();
+    k.printValueOn(tty);
+  }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java	Tue Jun 03 14:55:50 2014 +0200
@@ -90,17 +90,23 @@
   }
 
   public void dumpReplayData(PrintStream out) {
-      Method method = (Method)getMetadata();
-      NMethod nm = method.getNativeMethod();
-      Klass holder = method.getMethodHolder();
-      out.println("ciMethod " +
-                  holder.getName().asString() + " " +
-                  OopUtilities.escapeString(method.getName().asString()) + " " +
-                  method.getSignature().asString() + " " +
-                  method.getInvocationCount() + " " +
-                  method.getBackedgeCount() + " " +
-                  interpreterInvocationCount() + " " +
-                  interpreterThrowoutCount() + " " +
-                  instructionsSize());
+    Method method = (Method)getMetadata();
+    NMethod nm = method.getNativeMethod();
+    out.println("ciMethod " +
+                nameAsAscii() + " " +
+                method.getInvocationCount() + " " +
+                method.getBackedgeCount() + " " +
+                interpreterInvocationCount() + " " +
+                interpreterThrowoutCount() + " " +
+                instructionsSize());
+  }
+
+  public void printValueOn(PrintStream tty) {
+    tty.print("ciMethod " + method().getName().asString() + method().getSignature().asString() + "@" + getAddress());
+  }
+
+  public String nameAsAscii() {
+    Method method = (Method)getMetadata();
+    return method.nameAsAscii();
   }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethodData.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethodData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -31,7 +31,7 @@
 import sun.jvm.hotspot.oops.*;
 import sun.jvm.hotspot.types.*;
 
-public class ciMethodData extends ciMetadata {
+public class ciMethodData extends ciMetadata implements MethodDataInterface<ciKlass,ciMethod> {
   static {
     VM.registerVMInitializedObserver(new Observer() {
         public void update(Observable o, Object data) {
@@ -54,7 +54,9 @@
     extraDataSizeField = new CIntField(type.getCIntegerField("_extra_data_size"), 0);
     dataSizeField = new CIntField(type.getCIntegerField("_data_size"), 0);
     stateField = new CIntField(type.getCIntegerField("_state"), 0);
-    sizeofMethodDataOopDesc = (int)db.lookupType("MethodData").getSize();;
+    Type typeMethodData = db.lookupType("MethodData");
+    sizeofMethodDataOopDesc = (int)typeMethodData.getSize();
+    parametersTypeDataDi = new CIntField(typeMethodData.getCIntegerField("_parameters_type_data_di"), 0);
   }
 
   private static AddressField origField;
@@ -69,11 +71,28 @@
   private static CIntField dataSizeField;
   private static CIntField stateField;
   private static int sizeofMethodDataOopDesc;
+  private static CIntField parametersTypeDataDi;
 
   public ciMethodData(Address addr) {
     super(addr);
   }
 
+  public ciKlass getKlassAtAddress(Address addr) {
+    return (ciKlass)ciObjectFactory.getMetadata(addr);
+  }
+
+  public ciMethod getMethodAtAddress(Address addr) {
+    return (ciMethod)ciObjectFactory.getMetadata(addr);
+  }
+
+  public void printKlassValueOn(ciKlass klass, PrintStream st) {
+    klass.printValueOn(st);
+  }
+
+  public void printMethodValueOn(ciMethod method, PrintStream st) {
+    method.printValueOn(st);
+  }
+
   private byte[] fetchDataAt(Address base, long size) {
     byte[] result = new byte[(int)size];
     for (int i = 0; i < size; i++) {
@@ -110,6 +129,10 @@
     return (int)dataSizeField.getValue(getAddress());
   }
 
+  int extraDataSize() {
+    return (int)extraDataSizeField.getValue(getAddress());
+  }
+
   int state() {
     return (int)stateField.getValue(getAddress());
   }
@@ -122,6 +145,16 @@
     return dataIndex >= dataSize();
   }
 
+  ParametersTypeData<ciKlass,ciMethod> parametersTypeData() {
+    Address base = getAddress().addOffsetTo(origField.getOffset());
+    int di = (int)parametersTypeDataDi.getValue(base);
+    if (di == -1) {
+      return null;
+    }
+    DataLayout dataLayout = new DataLayout(dataField.getValue(getAddress()), di);
+    return new ParametersTypeData<ciKlass,ciMethod>(this, dataLayout);
+  }
+
   ProfileData dataAt(int dataIndex) {
     if (outOfBounds(dataIndex)) {
       return null;
@@ -139,15 +172,21 @@
     case DataLayout.jumpDataTag:
       return new JumpData(dataLayout);
     case DataLayout.receiverTypeDataTag:
-      return new ciReceiverTypeData(dataLayout);
+      return new ReceiverTypeData<ciKlass,ciMethod>(this, dataLayout);
     case DataLayout.virtualCallDataTag:
-      return new ciVirtualCallData(dataLayout);
+      return new VirtualCallData<ciKlass,ciMethod>(this, dataLayout);
     case DataLayout.retDataTag:
       return new RetData(dataLayout);
     case DataLayout.branchDataTag:
       return new BranchData(dataLayout);
     case DataLayout.multiBranchDataTag:
       return new MultiBranchData(dataLayout);
+    case DataLayout.callTypeDataTag:
+      return new CallTypeData<ciKlass,ciMethod>(this, dataLayout);
+    case DataLayout.virtualCallTypeDataTag:
+      return new VirtualCallTypeData<ciKlass,ciMethod>(this, dataLayout);
+    case DataLayout.parametersTypeDataTag:
+      return new ParametersTypeData<ciKlass,ciMethod>(this, dataLayout);
     }
   }
 
@@ -164,7 +203,23 @@
   }
   boolean isValid(ProfileData current) { return current != null; }
 
+  DataLayout limitDataPosition() {
+    return new DataLayout(dataField.getValue(getAddress()), dataSize());
+  }
+  DataLayout extraDataBase() {
+    return limitDataPosition();
+  }
+  DataLayout extraDataLimit() {
+    return new DataLayout(dataField.getValue(getAddress()), dataSize() + extraDataSize());
+  }
+  DataLayout nextExtra(DataLayout dataLayout) {
+    return new DataLayout(dataField.getValue(getAddress()), dataLayout.dp() + DataLayout.computeSizeInBytes(MethodData.extraNbCells(dataLayout)));
+  }
+
   public void printDataOn(PrintStream st) {
+    if (parametersTypeData() != null) {
+      parametersTypeData().printDataOn(st);
+    }
     ProfileData data = firstData();
     for ( ; isValid(data); data = nextData(data)) {
       st.print(dpToDi(data.dp()));
@@ -172,16 +227,96 @@
       // st->fillTo(6);
       data.printDataOn(st);
     }
+    st.println("--- Extra data:");
+    DataLayout dp    = extraDataBase();
+    DataLayout end   = extraDataLimit();
+    for (;; dp = nextExtra(dp)) {
+      switch(dp.tag()) {
+      case DataLayout.noTag:
+        continue;
+      case DataLayout.bitDataTag:
+        data = new BitData(dp);
+        break;
+      case DataLayout.speculativeTrapDataTag:
+        data = new SpeculativeTrapData<ciKlass,ciMethod>(this, dp);
+        break;
+      case DataLayout.argInfoDataTag:
+        data = new ArgInfoData(dp);
+        dp = end; // ArgInfoData is at the end of extra data section.
+        break;
+      default:
+        throw new InternalError("unexpected tag " +  dp.tag());
+      }
+      st.print(dpToDi(data.dp()));
+      st.print(" ");
+      data.printDataOn(st);
+      if (dp == end) return;
+    }
+  }
+
+  int dumpReplayDataTypeHelper(PrintStream out, int round, int count, int index, ProfileData pdata, ciKlass k) {
+    if (k != null) {
+      if (round == 0) count++;
+      else out.print(" " + ((pdata.dp() + pdata.cellOffset(index)) / MethodData.cellSize) + " " + k.name());
+    }
+    return count;
+  }
+
+  int dumpReplayDataReceiverTypeHelper(PrintStream out, int round, int count, ReceiverTypeData<ciKlass,ciMethod> vdata) {
+    for (int i = 0; i < vdata.rowLimit(); i++) {
+      ciKlass k = vdata.receiver(i);
+      count = dumpReplayDataTypeHelper(out, round, count, vdata.receiverCellIndex(i), vdata, k);
+    }
+    return count;
+  }
+
+  int dumpReplayDataCallTypeHelper(PrintStream out, int round, int count, CallTypeDataInterface<ciKlass> callTypeData) {
+    if (callTypeData.hasArguments()) {
+      for (int i = 0; i < callTypeData.numberOfArguments(); i++) {
+        count = dumpReplayDataTypeHelper(out, round, count, callTypeData.argumentTypeIndex(i), (ProfileData)callTypeData, callTypeData.argumentType(i));
+      }
+    }
+    if (callTypeData.hasReturn()) {
+      count = dumpReplayDataTypeHelper(out, round, count, callTypeData.returnTypeIndex(), (ProfileData)callTypeData, callTypeData.returnType());
+    }
+    return count;
+  }
+
+  int dumpReplayDataExtraDataHelper(PrintStream out, int round, int count) {
+    DataLayout dp    = extraDataBase();
+    DataLayout end   = extraDataLimit();
+
+    for (;dp != end; dp = nextExtra(dp)) {
+      switch(dp.tag()) {
+      case DataLayout.noTag:
+      case DataLayout.argInfoDataTag:
+        return count;
+      case DataLayout.bitDataTag:
+        break;
+      case DataLayout.speculativeTrapDataTag: {
+        SpeculativeTrapData<ciKlass,ciMethod> data = new SpeculativeTrapData<ciKlass,ciMethod>(this, dp);
+        ciMethod m = data.method();
+        if (m != null) {
+          if (round == 0) {
+            count++;
+          } else {
+            out.print(" " +  (dpToDi(data.dp() + data.cellOffset(SpeculativeTrapData.methodIndex())) / MethodData.cellSize) + " " +  m.nameAsAscii());
+          }
+        }
+        break;
+      }
+      default:
+        throw new InternalError("bad tag "  + dp.tag());
+      }
+    }
+    return count;
   }
 
   public void dumpReplayData(PrintStream out) {
     MethodData mdo = (MethodData)getMetadata();
     Method method = mdo.getMethod();
-    Klass holder = method.getMethodHolder();
     out.print("ciMethodData " +
-              holder.getName().asString() + " " +
-              OopUtilities.escapeString(method.getName().asString()) + " " +
-              method.getSignature().asString() + " " +
+              method.nameAsAscii() + " " +
               state() + " " + currentMileage());
     byte[] orig = orig();
     out.print(" orig " + orig.length);
@@ -195,30 +330,28 @@
       out.print(" 0x" + Long.toHexString(data[i]));
     }
     int count = 0;
+    ParametersTypeData<ciKlass,ciMethod> parameters = parametersTypeData();
     for (int round = 0; round < 2; round++) {
       if (round == 1) out.print(" oops " + count);
       ProfileData pdata = firstData();
       for ( ; isValid(pdata); pdata = nextData(pdata)) {
-        if (pdata instanceof ciReceiverTypeData) {
-          ciReceiverTypeData vdata = (ciReceiverTypeData)pdata;
-          for (int i = 0; i < vdata.rowLimit(); i++) {
-            ciKlass k = vdata.receiverAt(i);
-            if (k != null) {
-              if (round == 0) count++;
-              else out.print(" " + ((vdata.dp() + vdata.cellOffset(vdata.receiverCellIndex(i))) / MethodData.cellSize) + " " + k.name());
-            }
-          }
-        } else if (pdata instanceof ciVirtualCallData) {
-          ciVirtualCallData vdata = (ciVirtualCallData)pdata;
-          for (int i = 0; i < vdata.rowLimit(); i++) {
-            ciKlass k = vdata.receiverAt(i);
-            if (k != null) {
-              if (round == 0) count++;
-              else out.print(" " + ((vdata.dp() + vdata.cellOffset(vdata.receiverCellIndex(i))) / MethodData.cellSize + " " + k.name()));
-            }
-          }
+        if (pdata instanceof ReceiverTypeData) {
+          count = dumpReplayDataReceiverTypeHelper(out, round, count, (ReceiverTypeData<ciKlass,ciMethod>)pdata);
+        }
+        if (pdata instanceof CallTypeDataInterface) {
+          count = dumpReplayDataCallTypeHelper(out, round, count, (CallTypeDataInterface<ciKlass>)pdata);
         }
       }
+      if (parameters != null) {
+        for (int i = 0; i < parameters.numberOfParameters(); i++) {
+          count = dumpReplayDataTypeHelper(out, round, count, ParametersTypeData.typeIndex(i), parameters, parameters.type(i));
+        }
+      }
+    }
+    count = 0;
+    for (int round = 0; round < 2; round++) {
+      if (round == 1) out.print(" methods " + count);
+      count = dumpReplayDataExtraDataHelper(out, round, count);
     }
     out.println();
   }
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciReceiverTypeData.java	Tue May 20 15:59:50 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.ci;
-
-import java.io.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.types.*;
-
-public class ciReceiverTypeData extends ReceiverTypeData {
-  public ciReceiverTypeData(DataLayout data) {
-    super(data);
-  }
-
-  public Klass receiver(int row) {
-      throw new InternalError("should not call");
-  }
-
-  public ciKlass receiverAt(int row) {
-    //assert((uint)row < rowLimit(), "oob");
-    ciMetadata recv = ciObjectFactory.getMetadata(addressAt(receiverCellIndex(row)));
-    if (recv != null && !(recv instanceof ciKlass)) {
-      System.err.println(recv);
-    }
-    //assert(recv == NULL || recv->isKlass(), "wrong type");
-    return (ciKlass)recv;
-  }
-
-}
--- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciVirtualCallData.java	Tue May 20 15:59:50 2014 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.ci;
-
-import java.io.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.types.*;
-
-public class ciVirtualCallData extends VirtualCallData {
-  public ciVirtualCallData(DataLayout data) {
-    super(data);
-  }
-
-  public Klass receiver(int row) {
-      throw new InternalError("should not call");
-  }
-
-  public ciKlass receiverAt(int row) {
-    //assert((uint)row < rowLimit(), "oob");
-    ciMetadata recv = ciObjectFactory.getMetadata(addressAt(receiverCellIndex(row)));
-    if (recv != null && !(recv instanceof ciKlass)) {
-      System.err.println(recv);
-    }
-    //assert(recv == NULL || recv->isKlass(), "wrong type");
-    return (ciKlass)recv;
-  }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ArgInfoData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class ArgInfoData extends ArrayData {
+
+  public ArgInfoData(DataLayout layout) {
+    super(layout);
+  }
+
+  int numberOfArgs() {
+    return arrayLen();
+  }
+
+  int argModified(int arg) {
+    return arrayUintAt(arg);
+  }
+
+  public void printDataOn(PrintStream st) {
+    printShared(st, "ArgInfoData");
+    int nargs = numberOfArgs();
+    for (int i = 0; i < nargs; i++) {
+      st.print("  0x" + Integer.toHexString(argModified(i)));
+    }
+    st.println();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// CallTypeData
+//
+// A CallTypeData is used to access profiling information about a non
+// virtual call for which we collect type information about arguments
+// and return value.
+public class CallTypeData<K,M> extends CounterData implements CallTypeDataInterface<K> {
+  final TypeStackSlotEntries<K,M> args;
+  final ReturnTypeEntry<K,M> ret;
+
+  int cellCountGlobalOffset() {
+    return CounterData.staticCellCount() + TypeEntriesAtCall.cellCountLocalOffset();
+  }
+
+  int cellCountNoHeader() {
+    return uintAt(cellCountGlobalOffset());
+  }
+
+  public CallTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(layout);
+    args = new TypeStackSlotEntries<K,M>(methodData, this, CounterData.staticCellCount()+TypeEntriesAtCall.headerCellCount(), numberOfArguments());
+    ret = new ReturnTypeEntry<K,M>(methodData, this, cellCount() - ReturnTypeEntry.staticCellCount());
+  }
+
+  static int staticCellCount() {
+    return -1;
+  }
+
+  public int cellCount() {
+    return CounterData.staticCellCount() +
+      TypeEntriesAtCall.headerCellCount() +
+      intAt(cellCountGlobalOffset());
+  }
+
+  public int numberOfArguments() {
+    return cellCountNoHeader() / TypeStackSlotEntries.perArgCount();
+  }
+
+  public boolean hasArguments() {
+    return cellCountNoHeader() >= TypeStackSlotEntries.perArgCount();
+  }
+
+  public K argumentType(int i) {
+    return args.type(i);
+  }
+
+  public boolean hasReturn() {
+    return (cellCountNoHeader() % TypeStackSlotEntries.perArgCount()) != 0;
+  }
+
+  public K returnType() {
+    return ret.type();
+  }
+
+  public int argumentTypeIndex(int i) {
+    return args.typeIndex(i);
+  }
+
+  public int returnTypeIndex() {
+    return ret.typeIndex();
+  }
+
+  public void printDataOn(PrintStream st) {
+    super.printDataOn(st);
+    if (hasArguments()) {
+      tab(st);
+      st.print("argument types");
+      args.printDataOn(st);
+    }
+    if (hasReturn()) {
+      tab(st);
+      st.print("return type");
+      ret.printDataOn(st);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/CallTypeDataInterface.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+public interface CallTypeDataInterface<K> {
+  int numberOfArguments();
+  boolean hasArguments();
+  K argumentType(int i);
+  boolean hasReturn();
+  K returnType();
+  int argumentTypeIndex(int i);
+  int returnTypeIndex();
+}
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/DataLayout.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/DataLayout.java	Tue Jun 03 14:55:50 2014 +0200
@@ -41,6 +41,11 @@
   public static final int retDataTag = 6;
   public static final int branchDataTag = 7;
   public static final int multiBranchDataTag = 8;
+  public static final int argInfoDataTag = 9;
+  public static final int callTypeDataTag = 10;
+  public static final int virtualCallTypeDataTag = 11;
+  public static final int parametersTypeDataTag = 12;
+  public static final int speculativeTrapDataTag = 13;
 
   // The _struct._flags word is formatted as [trapState:4 | flags:4].
   // The trap state breaks down further as [recompile:1 | reason:3].
@@ -61,8 +66,6 @@
 
   private int offset;
 
-  private boolean handlized;
-
   public DataLayout(MethodData d, int o) {
     data = d.getAddress();
     offset = o;
@@ -71,7 +74,6 @@
   public DataLayout(Address d, int o) {
     data = d;
     offset = o;
-    handlized = true;
   }
 
   public int dp() { return offset; }
@@ -90,12 +92,7 @@
   }
 
   public Address addressAt(int index) {
-    OopHandle handle;
-    if (handlized) {
-      return data.getAddressAt(offset + cellOffset(index));
-    } else {
-      return data.getOopHandleAt(offset + cellOffset(index));
-    }
+    return data.getAddressAt(offset + cellOffset(index));
   }
 
   // Every data layout begins with a header.  This header
@@ -128,7 +125,7 @@
     return 1;
   }
 
-  static int computeSizeInBytes(int cellCount) {
+  static public int computeSizeInBytes(int cellCount) {
     return headerSizeInBytes() + cellCount * MethodData.cellSize;
   }
 
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Method.java	Tue Jun 03 14:55:50 2014 +0200
@@ -354,9 +354,7 @@
       }
       Klass holder = getMethodHolder();
       out.println("ciMethod " +
-                  holder.getName().asString() + " " +
-                  OopUtilities.escapeString(getName().asString()) + " " +
-                  getSignature().asString() + " " +
+                  nameAsAscii() + " " +
                   getInvocationCount() + " " +
                   getBackedgeCount() + " " +
                   interpreterInvocationCount() + " " +
@@ -371,4 +369,10 @@
   public int interpreterInvocationCount() {
     return getMethodCounters().interpreterInvocationCount();
   }
+
+  public String nameAsAscii() {
+    return getMethodHolder().getName().asString() + " " +
+      OopUtilities.escapeString(getName().asString()) + " " +
+      getSignature().asString();
+  }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -33,7 +33,7 @@
 
 // A MethodData provides interpreter profiling information
 
-public class MethodData extends Metadata {
+public class MethodData extends Metadata implements MethodDataInterface<Klass,Method> {
   static int TypeProfileWidth = 2;
   static int BciProfileWidth = 2;
   static int CompileThreshold;
@@ -152,6 +152,8 @@
     dataSize     = new CIntField(type.getCIntegerField("_data_size"), 0);
     data         = type.getAddressField("_data[0]");
 
+    parametersTypeDataDi = new CIntField(type.getCIntegerField("_parameters_type_data_di"), 0);
+
     sizeofMethodDataOopDesc = (int)type.getSize();;
 
     Reason_many            = db.lookupIntConstant("Deoptimization::Reason_many").intValue();
@@ -191,6 +193,22 @@
     super(addr);
   }
 
+  public Klass getKlassAtAddress(Address addr) {
+    return (Klass)Metadata.instantiateWrapperFor(addr);
+  }
+
+  public Method getMethodAtAddress(Address addr) {
+    return (Method)Metadata.instantiateWrapperFor(addr);
+  }
+
+  public void printKlassValueOn(Klass klass, PrintStream st) {
+    klass.printValueOn(st);
+  }
+
+  public void printMethodValueOn(Method method, PrintStream st) {
+    method.printValueOn(st);
+  }
+
   public boolean isMethodData()        { return true; }
 
   private static long baseOffset;
@@ -198,7 +216,7 @@
   private static MetadataField  method;
   private static CIntField dataSize;
   private static AddressField data;
-
+  private static CIntField parametersTypeDataDi;
   public static int sizeofMethodDataOopDesc;
   public static int cellSize;
 
@@ -225,6 +243,27 @@
     }
   }
 
+  int sizeInBytes() {
+    if (size == null) {
+      return 0;
+    } else {
+      return (int)size.getValue(getAddress());
+    }
+  }
+
+  int size() {
+    return (int)Oop.alignObjectSize(VM.getVM().alignUp(sizeInBytes(), VM.getVM().getBytesPerWord())/VM.getVM().getBytesPerWord());
+  }
+
+  ParametersTypeData<Klass,Method> parametersTypeData() {
+    int di = (int)parametersTypeDataDi.getValue(getAddress());
+    if (di == -1) {
+      return null;
+    }
+    DataLayout dataLayout = new DataLayout(this, di + (int)data.getOffset());
+    return new ParametersTypeData<Klass,Method>(this, dataLayout);
+  }
+
   boolean outOfBounds(int dataIndex) {
     return dataIndex >= dataSize();
   }
@@ -246,15 +285,21 @@
     case DataLayout.jumpDataTag:
       return new JumpData(dataLayout);
     case DataLayout.receiverTypeDataTag:
-      return new ReceiverTypeData(dataLayout);
+      return new ReceiverTypeData<Klass,Method>(this, dataLayout);
     case DataLayout.virtualCallDataTag:
-      return new VirtualCallData(dataLayout);
+      return new VirtualCallData<Klass,Method>(this, dataLayout);
     case DataLayout.retDataTag:
       return new RetData(dataLayout);
     case DataLayout.branchDataTag:
       return new BranchData(dataLayout);
     case DataLayout.multiBranchDataTag:
       return new MultiBranchData(dataLayout);
+    case DataLayout.callTypeDataTag:
+      return new CallTypeData<Klass,Method>(this, dataLayout);
+    case DataLayout.virtualCallTypeDataTag:
+      return new VirtualCallTypeData<Klass,Method>(this, dataLayout);
+    case DataLayout.parametersTypeDataTag:
+      return new ParametersTypeData<Klass,Method>(this, dataLayout);
     }
   }
 
@@ -272,7 +317,42 @@
   }
   boolean isValid(ProfileData current) { return current != null; }
 
+  DataLayout limitDataPosition() {
+    return new DataLayout(this, dataSize() + (int)data.getOffset());
+  }
+
+  DataLayout extraDataBase() {
+    return limitDataPosition();
+  }
+
+  DataLayout extraDataLimit() {
+    return new DataLayout(this, sizeInBytes());
+  }
+
+  static public int extraNbCells(DataLayout dataLayout) {
+    int nbCells = 0;
+    switch(dataLayout.tag()) {
+    case DataLayout.bitDataTag:
+    case DataLayout.noTag:
+      nbCells = BitData.staticCellCount();
+      break;
+    case DataLayout.speculativeTrapDataTag:
+      nbCells = SpeculativeTrapData.staticCellCount();
+      break;
+    default:
+      throw new InternalError("unexpected tag " +  dataLayout.tag());
+    }
+    return nbCells;
+  }
+
+  DataLayout nextExtra(DataLayout dataLayout) {
+    return new DataLayout(this, dataLayout.dp() + DataLayout.computeSizeInBytes(extraNbCells(dataLayout)));
+  }
+
   public void printDataOn(PrintStream st) {
+    if (parametersTypeData() != null) {
+      parametersTypeData().printDataOn(st);
+    }
     ProfileData data = firstData();
     for ( ; isValid(data); data = nextData(data)) {
       st.print(dpToDi(data.dp()));
@@ -280,6 +360,31 @@
       // st->fillTo(6);
       data.printDataOn(st);
     }
+    st.println("--- Extra data:");
+    DataLayout dp    = extraDataBase();
+    DataLayout end   = extraDataLimit();
+    for (;; dp = nextExtra(dp)) {
+      switch(dp.tag()) {
+      case DataLayout.noTag:
+        continue;
+      case DataLayout.bitDataTag:
+        data = new BitData(dp);
+        break;
+      case DataLayout.speculativeTrapDataTag:
+        data = new SpeculativeTrapData<Klass,Method>(this, dp);
+        break;
+      case DataLayout.argInfoDataTag:
+        data = new ArgInfoData(dp);
+        dp = end; // ArgInfoData is at the end of extra data section.
+        break;
+      default:
+        throw new InternalError("unexpected tag " +  dp.tag());
+      }
+      st.print(dpToDi(data.dp()));
+      st.print(" ");
+      data.printDataOn(st);
+      if (dp == end) return;
+    }
   }
 
   private byte[] fetchDataAt(Address base, long offset, long size) {
@@ -332,14 +437,71 @@
     return 20000;
   }
 
+  int dumpReplayDataTypeHelper(PrintStream out, int round, int count, int index, ProfileData pdata, Klass k) {
+    if (k != null) {
+      if (round == 0) count++;
+      else out.print(" " +
+                     (dpToDi(pdata.dp() +
+                             pdata.cellOffset(index)) / cellSize) + " " +
+                     k.getName().asString());
+    }
+    return count;
+  }
+
+  int dumpReplayDataReceiverTypeHelper(PrintStream out, int round, int count, ReceiverTypeData<Klass,Method> vdata) {
+    for (int i = 0; i < vdata.rowLimit(); i++) {
+      Klass k = vdata.receiver(i);
+      count = dumpReplayDataTypeHelper(out, round, count, vdata.receiverCellIndex(i), vdata, k);
+    }
+    return count;
+  }
+
+  int dumpReplayDataCallTypeHelper(PrintStream out, int round, int count, CallTypeDataInterface<Klass> callTypeData) {
+    if (callTypeData.hasArguments()) {
+      for (int i = 0; i < callTypeData.numberOfArguments(); i++) {
+        count = dumpReplayDataTypeHelper(out, round, count, callTypeData.argumentTypeIndex(i), (ProfileData)callTypeData, callTypeData.argumentType(i));
+      }
+    }
+    if (callTypeData.hasReturn()) {
+      count = dumpReplayDataTypeHelper(out, round, count, callTypeData.returnTypeIndex(), (ProfileData)callTypeData, callTypeData.returnType());
+    }
+    return count;
+  }
+
+  int dumpReplayDataExtraDataHelper(PrintStream out, int round, int count) {
+    DataLayout dp    = extraDataBase();
+    DataLayout end   = extraDataLimit();
+
+    for (;dp != end; dp = nextExtra(dp)) {
+      switch(dp.tag()) {
+      case DataLayout.noTag:
+      case DataLayout.argInfoDataTag:
+        return count;
+      case DataLayout.bitDataTag:
+        break;
+      case DataLayout.speculativeTrapDataTag: {
+        SpeculativeTrapData<Klass,Method> data = new SpeculativeTrapData<Klass,Method>(this, dp);
+        Method m = data.method();
+        if (m != null) {
+          if (round == 0) {
+            count++;
+          } else {
+            out.print(" " +  (dpToDi(data.dp() + data.cellOffset(SpeculativeTrapData.methodIndex())) / cellSize) + " " +  m.nameAsAscii());
+          }
+        }
+        break;
+      }
+      default:
+        throw new InternalError("bad tag "  + dp.tag());
+      }
+    }
+    return count;
+  }
+
   public void dumpReplayData(PrintStream out) {
     Method method = getMethod();
-    Klass holder = method.getMethodHolder();
-    out.print("ciMethodData " +
-              holder.getName().asString() + " " +
-              OopUtilities.escapeString(method.getName().asString()) + " " +
-              method.getSignature().asString() + " " +
-              "2" + " " +
+    out.print("ciMethodData " + method.nameAsAscii()
+              + " " + "2" + " " +
               currentMileage());
     byte[] orig = orig();
     out.print(" orig " + orig.length);
@@ -353,36 +515,28 @@
       out.print(" 0x" + Long.toHexString(data[i]));
     }
     int count = 0;
+    ParametersTypeData<Klass,Method> parameters = parametersTypeData();
     for (int round = 0; round < 2; round++) {
       if (round == 1) out.print(" oops " + count);
       ProfileData pdata = firstData();
       for ( ; isValid(pdata); pdata = nextData(pdata)) {
         if (pdata instanceof ReceiverTypeData) {
-          ReceiverTypeData vdata = (ReceiverTypeData)pdata;
-          for (int i = 0; i < vdata.rowLimit(); i++) {
-            Klass k = vdata.receiver(i);
-            if (k != null) {
-              if (round == 0) count++;
-              else out.print(" " +
-                             (dpToDi(vdata.dp() +
-                              vdata.cellOffset(vdata.receiverCellIndex(i))) / cellSize) + " " +
-                             k.getName().asString());
-            }
-          }
-        } else if (pdata instanceof VirtualCallData) {
-          VirtualCallData vdata = (VirtualCallData)pdata;
-          for (int i = 0; i < vdata.rowLimit(); i++) {
-            Klass k = vdata.receiver(i);
-            if (k != null) {
-              if (round == 0) count++;
-              else out.print(" " +
-                             (dpToDi(vdata.dp() +
-                              vdata.cellOffset(vdata.receiverCellIndex(i))) / cellSize) + " " +
-                             k.getName().asString());
-            }
-          }
+          count = dumpReplayDataReceiverTypeHelper(out, round, count, (ReceiverTypeData<Klass,Method>)pdata);
+        }
+        if (pdata instanceof CallTypeDataInterface) {
+          count = dumpReplayDataCallTypeHelper(out, round, count, (CallTypeDataInterface<Klass>)pdata);
         }
       }
+      if (parameters != null) {
+        for (int i = 0; i < parameters.numberOfParameters(); i++) {
+          count = dumpReplayDataTypeHelper(out, round, count, ParametersTypeData.typeIndex(i), parameters, parameters.type(i));
+        }
+      }
+    }
+    count = 0;
+    for (int round = 0; round < 2; round++) {
+      if (round == 1) out.print(" methods " + count);
+      count = dumpReplayDataExtraDataHelper(out, round, count);
     }
     out.println();
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/MethodDataInterface.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+public interface MethodDataInterface<K, M> {
+  K getKlassAtAddress(Address addr);
+  M getMethodAtAddress(Address addr);
+  void printKlassValueOn(K klass, PrintStream st);
+  void printMethodValueOn(M klass, PrintStream st);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ParametersTypeData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// ParametersTypeData
+//
+// A ParametersTypeData is used to access profiling information about
+// types of parameters to a method
+public class ParametersTypeData<K,M> extends ArrayData {
+  final TypeStackSlotEntries<K,M> parameters;
+
+  static int stackSlotLocalOffset(int i) {
+    return arrayStartOffSet + TypeStackSlotEntries.stackSlotLocalOffset(i);
+  }
+
+  static int typeLocalOffset(int i) {
+    return arrayStartOffSet + TypeStackSlotEntries.typeLocalOffset(i);
+  }
+
+  public ParametersTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(layout);
+    parameters = new TypeStackSlotEntries<K,M>(methodData, this, 1, numberOfParameters());
+  }
+
+  public int numberOfParameters() {
+    return arrayLen() / TypeStackSlotEntries.perArgCount();
+  }
+
+  int stackSlot(int i) {
+    return parameters.stackSlot(i);
+  }
+
+  public K type(int i) {
+    return parameters.type(i);
+  }
+
+  static public int typeIndex(int i) {
+    return typeLocalOffset(i);
+  }
+
+  public void printDataOn(PrintStream st) {
+    st.print("parameter types");
+    parameters.printDataOn(st);
+  }
+}
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ReceiverTypeData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -37,13 +37,15 @@
 // dynamic type check.  It consists of a counter which counts the total times
 // that the check is reached, and a series of (Klass, count) pairs
 // which are used to store a type profile for the receiver of the check.
-public class ReceiverTypeData extends CounterData {
+public class ReceiverTypeData<K,M> extends CounterData {
   static final int   receiver0Offset = counterCellCount;
   static final int     count0Offset = receiver0Offset + 1;
   static final int     receiverTypeRowCellCount = (count0Offset + 1) - receiver0Offset;
+  final MethodDataInterface<K,M> methodData;
 
-  public ReceiverTypeData(DataLayout layout) {
+  public ReceiverTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
     super(layout);
+    this.methodData = methodData;
     //assert(layout.tag() == DataLayout.receiverTypeDataTag ||
     //       layout.tag() == DataLayout.virtualCallDataTag, "wrong type");
   }
@@ -73,14 +75,14 @@
   // gc; it does not assert the receiver is a klass.  During compaction of the
   // perm gen, the klass may already have moved, so the isKlass() predicate
   // would fail.  The 'normal' version should be used whenever possible.
-  Klass receiverUnchecked(int row) {
+  K receiverUnchecked(int row) {
     //assert(row < rowLimit(), "oob");
     Address recv = addressAt(receiverCellIndex(row));
-    return (Klass)Metadata.instantiateWrapperFor(recv);
+    return methodData.getKlassAtAddress(recv);
   }
 
-  public Klass receiver(int row) {
-    Klass recv = receiverUnchecked(row);
+  public K receiver(int row) {
+    K recv = receiverUnchecked(row);
     //assert(recv == NULL || ((oop)recv).isKlass(), "wrong type");
     return recv;
   }
@@ -111,7 +113,7 @@
     for (row = 0; row < rowLimit(); row++) {
       if (receiver(row) != null) {
         tab(st);
-        receiver(row).printValueOn(st);
+        methodData.printKlassValueOn(receiver(row), st);
         st.println("(" + receiverCount(row) + ")");
       }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ReturnTypeEntry.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// Type entry used for return from a call. A single cell to record the
+// type.
+public class ReturnTypeEntry<K,M> extends TypeEntries<K,M> {
+  static final int cellCount = 1;
+
+  ReturnTypeEntry(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff) {
+    super(methodData, pd, baseOff);
+  }
+
+  K type() {
+    return validKlass(baseOff);
+  }
+
+  static int staticCellCount() {
+    return cellCount;
+  }
+
+  int typeIndex() {
+    return baseOff;
+  }
+
+  void printDataOn(PrintStream st) {
+    pd.tab(st);
+    printKlass(st, baseOff);
+    st.println();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/SpeculativeTrapData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// SpeculativeTrapData
+//
+// A SpeculativeTrapData is used to record traps due to type
+// speculation. It records the root of the compilation.
+public class SpeculativeTrapData<K, M> extends ProfileData {
+  static final int speculativeTrapMethod = 0;
+  static final int speculativeTrapCellCount = 1;
+  final MethodDataInterface<K, M> methodData;
+
+  public SpeculativeTrapData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(layout);
+    this.methodData = methodData;
+  }
+
+  static int staticCellCount() {
+    return speculativeTrapCellCount;
+  }
+
+  public int cellCount() {
+    return staticCellCount();
+  }
+
+  public M method() {
+    return methodData.getMethodAtAddress(addressAt(speculativeTrapMethod));
+  }
+
+  static public int methodIndex() {
+    return speculativeTrapMethod;
+  }
+
+  public void printDataOn(PrintStream st) {
+    printShared(st, "SpeculativeTrapData");
+    tab(st);
+    methodData.printMethodValueOn(method(), st);
+    st.println();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntries.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// Entries in a ProfileData object to record types: it can either be
+// none (no profile), unknown (conflicting profile data) or a klass if
+// a single one is seen. Whether a null reference was seen is also
+// recorded. No counter is associated with the type and a single type
+// is tracked (unlike VirtualCallData).
+public abstract class TypeEntries<K,M> {
+  static final int nullSeen = 1;
+  static final int typeMask = ~nullSeen;
+  static final int typeUnknown = 2;
+  static final int statusBits = nullSeen | typeUnknown;
+  static final int typeKlassMask = ~statusBits;
+
+  final ProfileData pd;
+  final int baseOff;
+  final MethodDataInterface<K,M> methodData;
+
+  boolean wasNullSeen(int index) {
+    int v = pd.intptrAt(index);
+    return (v & nullSeen) != 0;
+  }
+
+  boolean isTypeUnknown(int index) {
+    int v = pd.intptrAt(index);
+    return (v & typeUnknown) != 0;
+  }
+
+  boolean isTypeNone(int index) {
+    int v = pd.intptrAt(index);
+    return (v & typeMask) == 0;
+  }
+
+  K validKlass(int index) {
+    if (!isTypeNone(index) &&
+        !isTypeUnknown(index)) {
+      return methodData.getKlassAtAddress(pd.addressAt(index).andWithMask(typeKlassMask));
+    } else {
+      return null;
+    }
+  }
+
+  void printKlass(PrintStream st, int index) {
+    if (isTypeNone(index)) {
+      st.print("none");
+    } else if (isTypeUnknown(index)) {
+      st.print("unknown");
+    } else {
+      methodData.printKlassValueOn(validKlass(index), st);
+    }
+    if (wasNullSeen(index)) {
+      st.print(" (null seen)");
+    }
+  }
+
+  TypeEntries(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff) {
+    this.pd = pd;
+    this.baseOff = baseOff;
+    this.methodData = methodData;
+  }
+
+  long intptrAt(int index) {
+    return pd.intptrAt(index);
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/TypeEntriesAtCall.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// Entries to collect type information at a call: contains arguments
+// (TypeStackSlotEntries), a return type (ReturnTypeEntry) and a
+// number of cells.
+public abstract class TypeEntriesAtCall {
+
+  static int stackSlotLocalOffset(int i) {
+    return headerCellCount() + TypeStackSlotEntries.stackSlotLocalOffset(i);
+  }
+
+  static int argumentTypeLocalOffset(int i) {
+    return headerCellCount() + TypeStackSlotEntries.typeLocalOffset(i);
+  }
+
+  static int headerCellCount() {
+    return 1;
+  }
+
+  static int cellCountLocalOffset() {
+    return 0;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/TypeStackSlotEntries.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// Type entries used for arguments passed at a call and parameters on
+// method entry. 2 cells per entry: one for the type encoded as in
+// TypeEntries and one initialized with the stack slot where the
+// profiled object is to be found so that the interpreter can locate
+// it quickly.
+public class TypeStackSlotEntries<K,M> extends TypeEntries<K,M> {
+  static final int stackSlotEntry = 0;
+  static final int typeEntry = 1;
+  static final int perArgCellCount = 2;
+
+  int stackSlotOffset(int i) {
+    return baseOff + stackSlotLocalOffset(i);
+  }
+
+  final int numberOfEntries;
+
+  int typeOffsetInCells(int i) {
+    return baseOff + typeLocalOffset(i);
+  }
+
+  TypeStackSlotEntries(MethodDataInterface<K,M> methodData, ProfileData pd, int baseOff, int nbEntries) {
+    super(methodData, pd, baseOff);
+    numberOfEntries = nbEntries;
+  }
+
+  static int stackSlotLocalOffset(int i) {
+    return i * perArgCellCount + stackSlotEntry;
+  }
+
+  static int typeLocalOffset(int i) {
+    return i * perArgCellCount + typeEntry;
+  }
+
+  int stackSlot(int i) {
+    return pd.uintAt(stackSlotOffset(i));
+  }
+
+  K type(int i) {
+    return validKlass(typeOffsetInCells(i));
+  }
+
+  static int perArgCount() {
+    return perArgCellCount;
+  }
+
+  int typeIndex(int i) {
+    return typeOffsetInCells(i);
+  }
+
+  void printDataOn(PrintStream st) {
+    for (int i = 0; i < numberOfEntries; i++) {
+      pd.tab(st);
+      st.print(i + ": stack(" + stackSlot(i)+ ") ");
+      printKlass(st, typeOffsetInCells(i));
+      st.println();
+    }
+  }
+}
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Tue May 20 15:59:50 2014 +0200
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -35,9 +35,9 @@
 //
 // A VirtualCallData is used to access profiling information about a
 // call.  For now, it has nothing more than a ReceiverTypeData.
-public class VirtualCallData extends ReceiverTypeData {
-  public VirtualCallData(DataLayout layout) {
-    super(layout);
+public class VirtualCallData<K,M> extends ReceiverTypeData<K,M> {
+  public VirtualCallData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(methodData, layout);
     //assert(layout.tag() == DataLayout.virtualCallDataTag, "wrong type");
   }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/VirtualCallTypeData.java	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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.oops;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+// VirtualCallTypeData
+//
+// A VirtualCallTypeData is used to access profiling information about
+// a virtual call for which we collect type information about
+// arguments and return value.
+public class VirtualCallTypeData<K,M> extends VirtualCallData implements CallTypeDataInterface<K> {
+  final TypeStackSlotEntries<K,M> args;
+  final ReturnTypeEntry<K,M> ret;
+
+  int cellCountGlobalOffset() {
+    return VirtualCallData.staticCellCount() + TypeEntriesAtCall.cellCountLocalOffset();
+  }
+
+  int cellCountNoHeader() {
+    return uintAt(cellCountGlobalOffset());
+  }
+
+  public VirtualCallTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) {
+    super(methodData, layout);
+    args = new TypeStackSlotEntries<K,M>(methodData, this, VirtualCallData.staticCellCount()+TypeEntriesAtCall.headerCellCount(), numberOfArguments());
+    ret = new ReturnTypeEntry<K,M>(methodData, this, cellCount() - ReturnTypeEntry.staticCellCount());
+  }
+
+  static int staticCellCount() {
+    return -1;
+  }
+
+  public int cellCount() {
+    return VirtualCallData.staticCellCount() +
+      TypeEntriesAtCall.headerCellCount() +
+      intAt(cellCountGlobalOffset());
+  }
+
+  public int numberOfArguments() {
+    return cellCountNoHeader() / TypeStackSlotEntries.perArgCount();
+  }
+
+  public boolean hasArguments() {
+    return cellCountNoHeader() >= TypeStackSlotEntries.perArgCount();
+  }
+
+  public K argumentType(int i) {
+    return args.type(i);
+  }
+
+  public boolean hasReturn() {
+    return (cellCountNoHeader() % TypeStackSlotEntries.perArgCount()) != 0;
+  }
+
+  public K returnType() {
+    return ret.type();
+  }
+
+  public int argumentTypeIndex(int i) {
+    return args.typeIndex(i);
+  }
+
+  public int returnTypeIndex() {
+    return ret.typeIndex();
+  }
+
+  public void printDataOn(PrintStream st) {
+    super.printDataOn(st);
+    if (hasArguments()) {
+      tab(st);
+      st.print("argument types");
+      args.printDataOn(st);
+    }
+    if (hasReturn()) {
+      tab(st);
+      st.print("return type");
+      ret.printDataOn(st);
+    }
+  }
+};
--- a/make/aix/makefiles/vm.make	Tue May 20 15:59:50 2014 +0200
+++ b/make/aix/makefiles/vm.make	Tue Jun 03 14:55:50 2014 +0200
@@ -136,8 +136,6 @@
 JVM      = jvm
 LIBJVM   = lib$(JVM).so
 
-CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
-
 LIBJVM_DEBUGINFO   = lib$(JVM).debuginfo
 LIBJVM_DIZ         = lib$(JVM).diz
 
--- a/make/bsd/makefiles/vm.make	Tue May 20 15:59:50 2014 +0200
+++ b/make/bsd/makefiles/vm.make	Tue Jun 03 14:55:50 2014 +0200
@@ -146,9 +146,6 @@
 ifeq ($(OS_VENDOR), Darwin)
   LIBJVM   = lib$(JVM).dylib
   CFLAGS  += -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE
-  ifeq (${VERSION}, $(filter ${VERSION}, debug fastdebug))
-    CFLAGS += -DALLOW_OPERATOR_NEW_USAGE
-  endif
 
   LIBJVM_DEBUGINFO   = lib$(JVM).dylib.dSYM
   LIBJVM_DIZ         = lib$(JVM).diz
--- a/make/excludeSrc.make	Tue May 20 15:59:50 2014 +0200
+++ b/make/excludeSrc.make	Tue Jun 03 14:55:50 2014 +0200
@@ -77,30 +77,40 @@
       CXXFLAGS += -DINCLUDE_ALL_GCS=0
       CFLAGS += -DINCLUDE_ALL_GCS=0
 
-      Src_Files_EXCLUDE += \
-	cmsAdaptiveSizePolicy.cpp cmsCollectorPolicy.cpp \
-	cmsGCAdaptivePolicyCounters.cpp cmsLockVerifier.cpp compactibleFreeListSpace.cpp \
-	concurrentMarkSweepGeneration.cpp concurrentMarkSweepThread.cpp \
-	freeChunk.cpp adaptiveFreeList.cpp promotionInfo.cpp vmCMSOperations.cpp \
-	collectionSetChooser.cpp concurrentG1Refine.cpp concurrentG1RefineThread.cpp \
-	concurrentMark.cpp concurrentMarkThread.cpp dirtyCardQueue.cpp g1AllocRegion.cpp \
-	g1BlockOffsetTable.cpp g1CardCounts.cpp g1CollectedHeap.cpp g1CollectorPolicy.cpp \
-	g1ErgoVerbose.cpp g1GCPhaseTimes.cpp g1HRPrinter.cpp g1HotCardCache.cpp g1Log.cpp \
-	g1MMUTracker.cpp g1MarkSweep.cpp g1MemoryPool.cpp g1MonitoringSupport.cpp g1OopClosures.cpp \
-	g1RemSet.cpp g1RemSetSummary.cpp g1SATBCardTableModRefBS.cpp g1StringDedup.cpp g1StringDedupStat.cpp \
-	g1StringDedupTable.cpp g1StringDedupThread.cpp g1StringDedupQueue.cpp g1_globals.cpp heapRegion.cpp \
-	g1BiasedArray.cpp heapRegionRemSet.cpp heapRegionSeq.cpp heapRegionSet.cpp heapRegionSets.cpp \
-	ptrQueue.cpp satbQueue.cpp sparsePRT.cpp survRateGroup.cpp vm_operations_g1.cpp g1CodeCacheRemSet.cpp \
-	adjoiningGenerations.cpp adjoiningVirtualSpaces.cpp asPSOldGen.cpp asPSYoungGen.cpp \
-	cardTableExtension.cpp gcTaskManager.cpp gcTaskThread.cpp objectStartArray.cpp \
-	parallelScavengeHeap.cpp parMarkBitMap.cpp pcTasks.cpp psAdaptiveSizePolicy.cpp \
-	psCompactionManager.cpp psGCAdaptivePolicyCounters.cpp psGenerationCounters.cpp \
-	psMarkSweep.cpp psMarkSweepDecorator.cpp psMemoryPool.cpp psOldGen.cpp \
-	psParallelCompact.cpp psPromotionLAB.cpp psPromotionManager.cpp psScavenge.cpp \
-	psTasks.cpp psVirtualspace.cpp psYoungGen.cpp vmPSOperations.cpp asParNewGeneration.cpp \
-	parCardTableModRefBS.cpp parGCAllocBuffer.cpp parNewGeneration.cpp mutableSpace.cpp \
-	gSpaceCounters.cpp allocationStats.cpp spaceCounters.cpp gcAdaptivePolicyCounters.cpp \
-	mutableNUMASpace.cpp immutableSpace.cpp yieldingWorkGroup.cpp hSpaceCounters.cpp
+      gc_impl := $(GAMMADIR)/src/share/vm/gc_implementation
+      gc_exclude :=							\
+	$(notdir $(wildcard $(gc_impl)/concurrentMarkSweep/*.cpp))	\
+	$(notdir $(wildcard $(gc_impl)/g1/*.cpp))			\
+	$(notdir $(wildcard $(gc_impl)/parallelScavenge/*.cpp))		\
+	$(notdir $(wildcard $(gc_impl)/parNew/*.cpp))
+      Src_Files_EXCLUDE += $(gc_exclude)
+
+      # Exclude everything in $(gc_impl)/shared except the files listed
+      # in $(gc_shared_keep).
+      gc_shared_all := $(notdir $(wildcard $(gc_impl)/shared/*.cpp))
+      gc_shared_keep :=							\
+	adaptiveSizePolicy.cpp						\
+	ageTable.cpp							\
+	collectorCounters.cpp						\
+	cSpaceCounters.cpp						\
+	gcPolicyCounters.cpp						\
+	gcStats.cpp							\
+	gcTimer.cpp							\
+	gcTrace.cpp							\
+	gcTraceSend.cpp							\
+	gcTraceTime.cpp							\
+	gcUtil.cpp							\
+	generationCounters.cpp						\
+	markSweep.cpp							\
+	objectCountEventSender.cpp					\
+	spaceDecorator.cpp						\
+	vmGCOperations.cpp
+      Src_Files_EXCLUDE += $(filter-out $(gc_shared_keep),$(gc_shared_all))
+
+      # src/share/vm/services
+      Src_Files_EXCLUDE +=						\
+	g1MemoryPool.cpp						\
+	psMemoryPool.cpp
 endif
 
 ifeq ($(INCLUDE_NMT), false)
--- a/make/windows/projectfiles/common/Makefile	Tue May 20 15:59:50 2014 +0200
+++ b/make/windows/projectfiles/common/Makefile	Tue Jun 03 14:55:50 2014 +0200
@@ -93,7 +93,7 @@
 !if "$(HOTSPOT_RELEASE_VERSION)" != ""
 HOTSPOT_RELEASE_VERSION="\\\"$(HOTSPOT_RELEASE_VERSION)\\\""
 !else
-HOTSPOT_RELEASE_VERSION="\\\"$(JRE_RELEASE_VERSION)\\\""
+HOTSPOT_RELEASE_VERSION=$(JRE_RELEASE_VERSION)
 !endif
 # Define HOTSPOT_VM_DISTRO if HOTSPOT_VM_DISTRO is set,
 # and if it is not see if we have the src/closed directory
@@ -105,9 +105,18 @@
 !else
 HOTSPOT_VM_DISTRO="\\\"OpenJDK\\\""
 !endif
+!if "$(JDK_BUILD_NUMBER)" != ""
+JDK_BUILD_NUMBER="\\\"$(JDK_BUILD_NUMBER)\\\""
+!else
+JDK_BUILD_NUMBER="\\\"00\\\""
+!endif
 !endif
 
-ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO)
+JDK_MAJOR_VERSION="\\\"$(JDK_MAJOR_VER)\\\""
+JDK_MINOR_VERSION="\\\"$(JDK_MINOR_VER)\\\""
+JDK_MICRO_VERSION="\\\"$(JDK_MICRO_VER)\\\""
+
+ReleaseOptions = -define HOTSPOT_RELEASE_VERSION=$(HOTSPOT_RELEASE_VERSION) -define JRE_RELEASE_VERSION=$(JRE_RELEASE_VERSION) -define HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) -define JDK_MAJOR_VERSION=$(JDK_MAJOR_VERSION) -define JDK_MINOR_VERSION=$(JDK_MINOR_VERSION) -define JDK_MICRO_VERSION=$(JDK_MICRO_VERSION) -define JDK_BUILD_NUMBER=$(JDK_BUILD_NUMBER)
 ProjectCreatorIDEOptions = $(ProjectCreatorIDEOptions) $(ReleaseOptions)
 
 $(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
--- a/src/cpu/ppc/vm/c2_globals_ppc.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/c2_globals_ppc.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -41,7 +41,6 @@
 define_pd_global(bool, ProfileInterpreter,           true);
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            140000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         3);
--- a/src/cpu/ppc/vm/cppInterpreter_ppc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/cppInterpreter_ppc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
@@ -403,7 +404,7 @@
   BLOCK_COMMENT("compute_interpreter_state {");
 
   // access_flags = method->access_flags();
-  // TODO: PPC port: assert(4 == methodOopDesc::sz_access_flags(), "unexpected field size");
+  // TODO: PPC port: assert(4 == sizeof(AccessFlags), "unexpected field size");
   __ lwa(access_flags, method_(access_flags));
 
   // parameter_count = method->constMethod->size_of_parameters();
@@ -419,10 +420,8 @@
   // TODO: PPC port: assert(2 == ConstMethod::sz_max_stack(), "unexpected field size");
   __ lhz(max_stack, in_bytes(ConstMethod::max_stack_offset()), max_stack);
 
-  if (EnableInvokeDynamic) {
-    // Take into account 'extra_stack_entries' needed by method handles (see method.hpp).
+  // Take into account 'extra_stack_entries' needed by method handles (see method.hpp).
     __ addi(max_stack, max_stack, Method::extra_stack_entries());
-  }
 
   // mem_stack_limit = thread->stack_limit();
   __ ld(mem_stack_limit, thread_(stack_overflow_limit));
@@ -1055,7 +1054,7 @@
   assert(access_flags->is_nonvolatile(),
          "access_flags must be in a non-volatile register");
   // Type check.
-  // TODO: PPC port: assert(4 == methodOopDesc::sz_access_flags(), "unexpected field size");
+  // TODO: PPC port: assert(4 == sizeof(AccessFlags), "unexpected field size");
   __ lwz(access_flags, method_(access_flags));
 
   // We don't want to reload R19_method and access_flags after calls
@@ -1838,7 +1837,7 @@
   // Interpreter state fields.
   const Register msg               = R24_tmp4;
 
-  // MethodOop fields.
+  // Method fields.
   const Register parameter_count   = R25_tmp5;
   const Register result_index      = R26_tmp6;
 
@@ -2023,7 +2022,7 @@
   __ add(R17_tos, R17_tos, parameter_count);
 
   // Result stub address array index
-  // TODO: PPC port: assert(4 == methodOopDesc::sz_result_index(), "unexpected field size");
+  // TODO: PPC port: assert(4 == sizeof(AccessFlags), "unexpected field size");
   __ lwa(result_index, method_(result_index));
 
   __ li(msg, BytecodeInterpreter::method_resume);
@@ -2709,7 +2708,7 @@
   __ ld(R3_ARG1, state_(_result._osr._osr_buf));
   __ mtctr(R12_scratch2);
 
-  // Load method oop, gc may move it during execution of osr'd method.
+  // Load method, gc may move it during execution of osr'd method.
   __ ld(R22_tmp2, state_(_method));
   // Load message 'call_method'.
   __ li(R23_tmp3, BytecodeInterpreter::call_method);
--- a/src/cpu/ppc/vm/frame_ppc.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/frame_ppc.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,6 +26,8 @@
 #ifndef CPU_PPC_VM_FRAME_PPC_INLINE_HPP
 #define CPU_PPC_VM_FRAME_PPC_INLINE_HPP
 
+#include "code/codeCache.hpp"
+
 // Inline functions for ppc64 frames:
 
 // Find codeblob and set deopt_state.
--- a/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/interp_masm_ppc_64.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -380,7 +380,6 @@
   if (index_size == sizeof(u2)) {
     get_2_byte_integer_at_bcp(bcp_offset, Rdst, Unsigned);
   } else if (index_size == sizeof(u4)) {
-    assert(EnableInvokeDynamic, "giant index used only for JSR 292");
     get_4_byte_integer_at_bcp(bcp_offset, Rdst, Signed);
     assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
     nand(Rdst, Rdst, Rdst); // convert to plain index
--- a/src/cpu/ppc/vm/interp_masm_ppc_64.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/interp_masm_ppc_64.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,7 +26,7 @@
 #ifndef CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
 #define CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
 
-#include "assembler_ppc.inline.hpp"
+#include "asm/macroAssembler.hpp"
 #include "interpreter/invocationCounter.hpp"
 
 // This file specializes the assembler with interpreter-specific macros.
--- a/src/cpu/ppc/vm/interpreterRT_ppc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/interpreterRT_ppc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -24,6 +24,7 @@
  */
 
 #include "precompiled.hpp"
+#include "asm/assembler.inline.hpp"
 #include "interpreter/interpreter.hpp"
 #include "interpreter/interpreterRuntime.hpp"
 #include "memory/allocation.inline.hpp"
--- a/src/cpu/ppc/vm/interpreter_ppc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/interpreter_ppc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -139,32 +139,16 @@
   // Signature is in R3_RET. Signature is callee saved.
   __ mr(signature, R3_RET);
 
-  // Reload method, it may have moved.
-#ifdef CC_INTERP
-  __ ld(R19_method, state_(_method));
-#else
-  __ ld(R19_method, 0, target_sp);
-  __ ld(R19_method, _ijava_state_neg(method), R19_method);
-#endif
-
   // Get the result handler.
   __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_result_handler), R16_thread, R19_method);
 
-  // Reload method, it may have moved.
-#ifdef CC_INTERP
-  __ ld(R19_method, state_(_method));
-#else
-  __ ld(R19_method, 0, target_sp);
-  __ ld(R19_method, _ijava_state_neg(method), R19_method);
-#endif
-
   {
     Label L;
     // test if static
     // _access_flags._flags must be at offset 0.
     // TODO PPC port: requires change in shared code.
     //assert(in_bytes(AccessFlags::flags_offset()) == 0,
-    //       "MethodOopDesc._access_flags == MethodOopDesc._access_flags._flags");
+    //       "MethodDesc._access_flags == MethodDesc._access_flags._flags");
     // _access_flags must be a 32 bit value.
     assert(sizeof(AccessFlags) == 4, "wrong size");
     __ lwa(R11_scratch1/*access_flags*/, method_(access_flags));
--- a/src/cpu/ppc/vm/jniFastGetField_ppc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/jniFastGetField_ppc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -32,7 +32,7 @@
 
 
 address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
-  // we don't have fast jni accessors.
+  // We don't have fast jni accessors.
   return (address) -1;
 }
 
@@ -57,12 +57,12 @@
 }
 
 address JNI_FastGetField::generate_fast_get_long_field() {
-  // we don't have fast jni accessors.
+  // We don't have fast jni accessors.
   return (address) -1;
 }
 
 address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
-  // e don't have fast jni accessors.
+  // We don't have fast jni accessors.
   return (address) -1;
 }
 
--- a/src/cpu/ppc/vm/ppc.ad	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/ppc.ad	Tue Jun 03 14:55:50 2014 +0200
@@ -898,7 +898,7 @@
   // To keep related declarations/definitions/uses close together,
   // we switch between source %{ }% and source_hpp %{ }% freely as needed.
 
-  // Returns true if Node n is followed by a MemBar node that 
+  // Returns true if Node n is followed by a MemBar node that
   // will do an acquire. If so, this node must not do the acquire
   // operation.
   bool followed_by_acquire(const Node *n);
@@ -908,7 +908,7 @@
 
 // Optimize load-acquire.
 //
-// Check if acquire is unnecessary due to following operation that does 
+// Check if acquire is unnecessary due to following operation that does
 // acquire anyways.
 // Walk the pattern:
 //
@@ -919,12 +919,12 @@
 //  Proj(ctrl)  Proj(mem)
 //       |         |
 //   MemBarRelease/Volatile
-// 
+//
 bool followed_by_acquire(const Node *load) {
   assert(load->is_Load(), "So far implemented only for loads.");
 
   // Find MemBarAcquire.
-  const Node *mba = NULL;         
+  const Node *mba = NULL;
   for (DUIterator_Fast imax, i = load->fast_outs(imax); i < imax; i++) {
     const Node *out = load->fast_out(i);
     if (out->Opcode() == Op_MemBarAcquire) {
@@ -937,7 +937,7 @@
 
   // Find following MemBar node.
   //
-  // The following node must be reachable by control AND memory 
+  // The following node must be reachable by control AND memory
   // edge to assure no other operations are in between the two nodes.
   //
   // So first get the Proj node, mem_proj, to use it to iterate forward.
@@ -1135,6 +1135,7 @@
 
  public:
 
+  // Emit call stub, compiled java to interpreter.
   static void emit_trampoline_stub(MacroAssembler &_masm, int destination_toc_offset, int insts_call_instruction_offset);
 
   // Size of call trampoline stub.
@@ -2755,7 +2756,7 @@
       // inputs for new nodes
       m1->add_req(NULL, n_toc);
       m2->add_req(NULL, m1);
-      
+
       // operands for new nodes
       m1->_opnds[0] = new (C) iRegPdstOper(); // dst
       m1->_opnds[1] = op_src;                 // src
@@ -2763,29 +2764,29 @@
       m2->_opnds[0] = new (C) iRegPdstOper(); // dst
       m2->_opnds[1] = op_src;                 // src
       m2->_opnds[2] = new (C) iRegLdstOper(); // base
-      
+
       // Initialize ins_attrib TOC fields.
       m1->_const_toc_offset = -1;
       m2->_const_toc_offset_hi_node = m1;
-      
+
       // Register allocation for new nodes.
       ra_->set_pair(m1->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
       ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
-      
+
       nodes->push(m1);
       nodes->push(m2);
       assert(m2->bottom_type()->isa_ptr(), "must be ptr");
     } else {
       loadConPNode *m2 = new (C) loadConPNode();
-      
+
       // inputs for new nodes
       m2->add_req(NULL, n_toc);
-      
+
       // operands for new nodes
       m2->_opnds[0] = new (C) iRegPdstOper(); // dst
       m2->_opnds[1] = op_src;                 // src
       m2->_opnds[2] = new (C) iRegPdstOper(); // toc
-      
+
       // Register allocation for new nodes.
       ra_->set_pair(m2->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
 
@@ -2977,17 +2978,17 @@
       n_sub_base->_opnds[1] = op_crx;
       n_sub_base->_opnds[2] = op_src;
       n_sub_base->_bottom_type = _bottom_type;
-   
+
       n_shift->add_req(n_region, n_sub_base);
       n_shift->_opnds[0] = op_dst;
       n_shift->_opnds[1] = op_dst;
       n_shift->_bottom_type = _bottom_type;
-   
+
       ra_->set_pair(n_shift->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
       ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
       ra_->set_pair(n_sub_base->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
       ra_->set_pair(n_move->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
-   
+
       nodes->push(n_move);
       nodes->push(n_compare);
       nodes->push(n_sub_base);
@@ -3064,20 +3065,20 @@
     } else {
       // before Power 7
       cond_add_baseNode *n_add_base = new (C) cond_add_baseNode();
-     
+
       n_add_base->add_req(n_region, n_compare, n_shift);
       n_add_base->_opnds[0] = op_dst;
       n_add_base->_opnds[1] = op_crx;
       n_add_base->_opnds[2] = op_dst;
       n_add_base->_bottom_type = _bottom_type;
-     
+
       assert(ra_->is_oop(this) == true, "A decodeN node must produce an oop!");
       ra_->set_oop(n_add_base, true);
-     
+
       ra_->set_pair(n_shift->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
       ra_->set_pair(n_compare->_idx, ra_->get_reg_second(n_crx), ra_->get_reg_first(n_crx));
       ra_->set_pair(n_add_base->_idx, ra_->get_reg_second(this), ra_->get_reg_first(this));
-     
+
       nodes->push(n_compare);
       nodes->push(n_shift);
       nodes->push(n_add_base);
@@ -3634,11 +3635,11 @@
     // Req...
     for (uint i = 0; i < req(); ++i) {
       // The expanded node does not need toc any more.
-      // Add the inline cache constant here instead.  This expresses the 
+      // Add the inline cache constant here instead. This expresses the
       // register of the inline cache must be live at the call.
       // Else we would have to adapt JVMState by -1.
       if (i == mach_constant_base_node_input()) {
-        call->add_req(loadConLNodes_IC._last);        
+        call->add_req(loadConLNodes_IC._last);
       } else {
         call->add_req(in(i));
       }
@@ -3666,6 +3667,8 @@
   %}
 
   // Compound version of call dynamic
+  // Toc is only passed so that it can be used in ins_encode statement.
+  // In the code we have to use $constanttablebase.
   enc_class enc_java_dynamic_call(method meth, iRegLdst toc) %{
     // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     MacroAssembler _masm(&cbuf);
@@ -3673,14 +3676,17 @@
 
     Register Rtoc = (ra_) ? $constanttablebase : R2_TOC;
 #if 0
+    int vtable_index = this->_vtable_index;
     if (_vtable_index < 0) {
       // Must be invalid_vtable_index, not nonvirtual_vtable_index.
       assert(_vtable_index == Method::invalid_vtable_index, "correct sentinel value");
       Register ic_reg = as_Register(Matcher::inline_cache_reg_encode());
-      AddressLiteral meta = __ allocate_metadata_address((Metadata *)Universe::non_oop_word());
-
+
+      // Virtual call relocation will point to ic load.
       address virtual_call_meta_addr = __ pc();
-      __ load_const_from_method_toc(ic_reg, meta, Rtoc);
+      // Load a clear inline cache.
+      AddressLiteral empty_ic((address) Universe::non_oop_word());
+      __ load_const_from_method_toc(ic_reg, empty_ic, Rtoc);
       // CALL to fixup routine.  Fixup routine uses ScopeDesc info
       // to determine who we intended to call.
       __ relocate(virtual_call_Relocation::spec(virtual_call_meta_addr));
@@ -3713,7 +3719,6 @@
              "Fix constant in ret_addr_offset()");
     }
 #endif
-    guarantee(0, "Fix handling of toc edge: messes up derived/base pairs.");
     Unimplemented();  // ret_addr_offset not yet fixed. Depends on compressed oops (load klass!).
   %}
 
@@ -5439,7 +5444,7 @@
   ins_pipe(pipe_class_memory);
 %}
 
-// Match loading integer and casting it to unsigned int in 
+// Match loading integer and casting it to unsigned int in
 // long register.
 // LoadI + ConvI2L + AndL 0xffffffff.
 instruct loadUI2L(iRegLdst dst, memory mem, immL_32bits mask) %{
@@ -6081,7 +6086,7 @@
   ins_pipe(pipe_class_default);
 %}
 
-// This needs a match rule so that build_oop_map knows this is 
+// This needs a match rule so that build_oop_map knows this is
 // not a narrow oop.
 instruct loadConNKlass_lo(iRegNdst dst, immNKlass_NM src1, iRegNsrc src2) %{
   match(Set dst src1);
@@ -6705,7 +6710,7 @@
   size(4);
   ins_encode %{
     // This is a Power7 instruction for which no machine description exists.
-    // TODO: PPC port $archOpcode(ppc64Opcode_compound); 
+    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     __ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
   %}
   ins_pipe(pipe_class_default);
@@ -6850,7 +6855,7 @@
   size(4);
   ins_encode %{
     // This is a Power7 instruction for which no machine description exists.
-    // TODO: PPC port $archOpcode(ppc64Opcode_compound); 
+    // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     __ isel_0($dst$$Register, $crx$$CondRegister, Assembler::equal, $src1$$Register);
   %}
   ins_pipe(pipe_class_default);
@@ -7067,7 +7072,7 @@
     n1->_bottom_type = _bottom_type;
 
     decodeNKlass_shiftNode *n2 = new (C) decodeNKlass_shiftNode();
-    n2->add_req(n_region, n2);
+    n2->add_req(n_region, n1);
     n2->_opnds[0] = op_dst;
     n2->_opnds[1] = op_dst;
     n2->_bottom_type = _bottom_type;
@@ -7202,7 +7207,7 @@
 //  inline_unsafe_load_store).
 //
 // Add this node again if we found a good solution for inline_unsafe_load_store().
-// Don't forget to look at the implementation of post_store_load_barrier again, 
+// Don't forget to look at the implementation of post_store_load_barrier again,
 // we did other fixes in that method.
 //instruct unnecessary_membar_volatile() %{
 //  match(MemBarVolatile);
@@ -7240,7 +7245,7 @@
     // exists. Anyways, the scheduler should be off on Power7.
     // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     int cc        = $cmp$$cmpcode;
-    __ isel($dst$$Register, $crx$$CondRegister, 
+    __ isel($dst$$Register, $crx$$CondRegister,
             (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
   %}
   ins_pipe(pipe_class_default);
@@ -7286,7 +7291,7 @@
     // exists. Anyways, the scheduler should be off on Power7.
     // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     int cc        = $cmp$$cmpcode;
-    __ isel($dst$$Register, $crx$$CondRegister, 
+    __ isel($dst$$Register, $crx$$CondRegister,
             (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
   %}
   ins_pipe(pipe_class_default);
@@ -7332,7 +7337,7 @@
     // exists. Anyways, the scheduler should be off on Power7.
     // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     int cc        = $cmp$$cmpcode;
-    __ isel($dst$$Register, $crx$$CondRegister, 
+    __ isel($dst$$Register, $crx$$CondRegister,
             (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
   %}
   ins_pipe(pipe_class_default);
@@ -7379,7 +7384,7 @@
     // exists. Anyways, the scheduler should be off on Power7.
     // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     int cc        = $cmp$$cmpcode;
-    __ isel($dst$$Register, $crx$$CondRegister, 
+    __ isel($dst$$Register, $crx$$CondRegister,
             (Assembler::Condition)(cc & 3), /*invert*/((~cc) & 8), $src$$Register);
   %}
   ins_pipe(pipe_class_default);
@@ -7525,8 +7530,8 @@
   ins_encode %{
     // TODO: PPC port $archOpcode(ppc64Opcode_compound);
     // CmpxchgX sets CCR0 to cmpX(src1, src2) and Rres to 'true'/'false'.
-    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register, 
-                MacroAssembler::MemBarFenceAfter, MacroAssembler::cmpxchgx_hint_atomic_update(), 
+    __ cmpxchgw(CCR0, R0, $src1$$Register, $src2$$Register, $mem_ptr$$Register,
+                MacroAssembler::MemBarFenceAfter, MacroAssembler::cmpxchgx_hint_atomic_update(),
                 $res$$Register, true);
   %}
   ins_pipe(pipe_class_default);
@@ -7932,7 +7937,23 @@
 
 // Turn the sign-bit of a long into a 64-bit mask, 0x0...0 for
 // positive longs and 0xF...F for negative ones.
-instruct signmask64I_regI(iRegIdst dst, iRegIsrc src) %{
+instruct signmask64I_regL(iRegIdst dst, iRegLsrc src) %{
+  // no match-rule, false predicate
+  effect(DEF dst, USE src);
+  predicate(false);
+
+  format %{ "SRADI   $dst, $src, #63" %}
+  size(4);
+  ins_encode %{
+    // TODO: PPC port $archOpcode(ppc64Opcode_sradi);
+    __ sradi($dst$$Register, $src$$Register, 0x3f);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Turn the sign-bit of a long into a 64-bit mask, 0x0...0 for
+// positive longs and 0xF...F for negative ones.
+instruct signmask64L_regL(iRegLdst dst, iRegLsrc src) %{
   // no match-rule, false predicate
   effect(DEF dst, USE src);
   predicate(false);
@@ -8896,7 +8917,7 @@
   size(4);
   ins_encode %{
     // TODO: PPC port $archOpcode(ppc64Opcode_rlwinm);
-    __ rlwinm($dst$$Register, $src1$$Register, 0, 
+    __ rlwinm($dst$$Register, $src1$$Register, 0,
               (31-log2_long((jlong) $src2$$constant)) & 0x1f, (31-log2_long((jlong) $src2$$constant)) & 0x1f);
   %}
   ins_pipe(pipe_class_default);
@@ -9622,14 +9643,14 @@
   ins_cost(DEFAULT_COST*4);
 
   expand %{
-    iRegIdst src1s;
-    iRegIdst src2s;
-    iRegIdst diff;
-    sxtI_reg(src1s, src1); // ensure proper sign extention
-    sxtI_reg(src2s, src2); // ensure proper sign extention
-    subI_reg_reg(diff, src1s, src2s);
+    iRegLdst src1s;
+    iRegLdst src2s;
+    iRegLdst diff;
+    convI2L_reg(src1s, src1); // Ensure proper sign extension.
+    convI2L_reg(src2s, src2); // Ensure proper sign extension.
+    subL_reg_reg(diff, src1s, src2s);
     // Need to consider >=33 bit result, therefore we need signmaskL.
-    signmask64I_regI(dst, diff);
+    signmask64I_regL(dst, diff);
   %}
 %}
 
@@ -10866,7 +10887,7 @@
   format %{ "PartialSubtypeCheck $result = ($subklass instanceOf $superklass) tmp: $tmp_klass, $tmp_arrayptr" %}
   ins_encode %{
     // TODO: PPC port $archOpcode(ppc64Opcode_compound);
-    __ check_klass_subtype_slow_path($subklass$$Register, $superklass$$Register, $tmp_arrayptr$$Register, 
+    __ check_klass_subtype_slow_path($subklass$$Register, $superklass$$Register, $tmp_arrayptr$$Register,
                                      $tmp_klass$$Register, NULL, $result$$Register);
   %}
   ins_pipe(pipe_class_default);
@@ -11181,18 +11202,18 @@
   ins_cost(DEFAULT_COST*6);
 
   expand %{
-    iRegIdst src1s;
-    iRegIdst src2s;
-    iRegIdst diff;
-    iRegIdst sm;
-    iRegIdst doz; // difference or zero
-    sxtI_reg(src1s, src1); // Ensure proper sign extention.
-    sxtI_reg(src2s, src2); // Ensure proper sign extention.
-    subI_reg_reg(diff, src2s, src1s);
+    iRegLdst src1s;
+    iRegLdst src2s;
+    iRegLdst diff;
+    iRegLdst sm;
+    iRegLdst doz; // difference or zero
+    convI2L_reg(src1s, src1); // Ensure proper sign extension.
+    convI2L_reg(src2s, src2); // Ensure proper sign extension.
+    subL_reg_reg(diff, src2s, src1s);
     // Need to consider >=33 bit result, therefore we need signmaskL.
-    signmask64I_regI(sm, diff);
-    andI_reg_reg(doz, diff, sm); // <=0
-    addI_reg_reg(dst, doz, src1s);
+    signmask64L_regL(sm, diff);
+    andL_reg_reg(doz, diff, sm); // <=0
+    addI_regL_regL(dst, doz, src1s);
   %}
 %}
 
@@ -11201,19 +11222,18 @@
   ins_cost(DEFAULT_COST*6);
 
   expand %{
-    immI_minus1 m1 %{ -1 %}
-    iRegIdst src1s;
-    iRegIdst src2s;
-    iRegIdst diff;
-    iRegIdst sm;
-    iRegIdst doz; // difference or zero
-    sxtI_reg(src1s, src1); // Ensure proper sign extention.
-    sxtI_reg(src2s, src2); // Ensure proper sign extention.
-    subI_reg_reg(diff, src2s, src1s);
+    iRegLdst src1s;
+    iRegLdst src2s;
+    iRegLdst diff;
+    iRegLdst sm;
+    iRegLdst doz; // difference or zero
+    convI2L_reg(src1s, src1); // Ensure proper sign extension.
+    convI2L_reg(src2s, src2); // Ensure proper sign extension.
+    subL_reg_reg(diff, src2s, src1s);
     // Need to consider >=33 bit result, therefore we need signmaskL.
-    signmask64I_regI(sm, diff);
-    andcI_reg_reg(doz, sm, m1, diff); // >=0
-    addI_reg_reg(dst, doz, src1s);
+    signmask64L_regL(sm, diff);
+    andcL_reg_reg(doz, diff, sm); // >=0
+    addI_regL_regL(dst, doz, src1s);
   %}
 %}
 
--- a/src/cpu/ppc/vm/templateInterpreter_ppc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/templateInterpreter_ppc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -81,24 +81,18 @@
 #if 0
 // Call special ClassCastException constructor taking object to cast
 // and target class as arguments.
-address TemplateInterpreterGenerator::generate_ClassCastException_verbose_handler(const char* name) {
+address TemplateInterpreterGenerator::generate_ClassCastException_verbose_handler() {
   address entry = __ pc();
 
-  // Target class oop is in register R6_ARG4 by convention!
-
   // Expression stack must be empty before entering the VM if an
   // exception happened.
   __ empty_expression_stack();
-  // Setup parameters.
+
   // Thread will be loaded to R3_ARG1.
-  __ load_const_optimized(R4_ARG2, (address) name);
-  __ mr(R5_ARG3, R17_tos);
-  // R6_ARG4 contains specified class.
-  __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ClassCastException_verbose));
-#ifdef ASSERT
+  // Target class oop is in register R5_ARG3 by convention!
+  __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_ClassCastException_verbose, R17_tos, R5_ARG3));
   // Above call must not return here since exception pending.
-  __ should_not_reach_here();
-#endif
+  DEBUG_ONLY(__ should_not_reach_here();)
   return entry;
 }
 #endif
@@ -1538,14 +1532,32 @@
     __ stw(R0, in_bytes(JavaThread::popframe_condition_offset()), R16_thread);
 
     // Get out of the current method and re-execute the call that called us.
-    __ merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ return_pc, R11_scratch1, R12_scratch2);
+    __ merge_frames(/*top_frame_sp*/ R21_sender_SP, /*return_pc*/ noreg, R11_scratch1, R12_scratch2);
     __ restore_interpreter_state(R11_scratch1);
     __ ld(R12_scratch2, _ijava_state_neg(top_frame_sp), R11_scratch1);
     __ resize_frame_absolute(R12_scratch2, R11_scratch1, R0);
-    __ mtlr(return_pc);
     if (ProfileInterpreter) {
       __ set_method_data_pointer_for_bcp();
     }
+#if INCLUDE_JVMTI
+    Label L_done;
+
+    __ lbz(R11_scratch1, 0, R14_bcp);
+    __ cmpwi(CCR0, R11_scratch1, Bytecodes::_invokestatic);
+    __ bne(CCR0, L_done);
+
+    // The member name argument must be restored if _invokestatic is re-executed after a PopFrame call.
+    // Detect such a case in the InterpreterRuntime function and return the member name argument, or NULL.
+    __ ld(R4_ARG2, 0, R18_locals);
+    __ call_VM(R11_scratch1, CAST_FROM_FN_PTR(address, InterpreterRuntime::member_name_arg_or_null),
+               R4_ARG2, R19_method, R14_bcp);
+
+    __ cmpdi(CCR0, R11_scratch1, 0);
+    __ beq(CCR0, L_done);
+
+    __ std(R11_scratch1, wordSize, R15_esp);
+    __ bind(L_done);
+#endif // INCLUDE_JVMTI
     __ dispatch_next(vtos);
   }
   // end of JVMTI PopFrame support
--- a/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -64,7 +64,7 @@
   assert_different_registers(Rtmp1, Rtmp2, Rtmp3, Rval, Rbase);
 
   switch (barrier) {
-#ifndef SERIALGC
+#if INCLUDE_ALL_GCS
     case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       {
@@ -104,7 +104,7 @@
         __ bind(Ldone);
       }
       break;
-#endif // SERIALGC
+#endif // INCLUDE_ALL_GCS
     case BarrierSet::CardTableModRef:
     case BarrierSet::CardTableExtension:
       {
@@ -259,17 +259,17 @@
   switch (value) {
     default: ShouldNotReachHere();
     case 0: {
-      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&zero, R0);
+      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&zero, R0, true);
       __ lfs(F15_ftos, simm16_offset, R11_scratch1);
       break;
     }
     case 1: {
-      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&one, R0);
+      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&one, R0, true);
       __ lfs(F15_ftos, simm16_offset, R11_scratch1);
       break;
     }
     case 2: {
-      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&two, R0);
+      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&two, R0, true);
       __ lfs(F15_ftos, simm16_offset, R11_scratch1);
       break;
     }
@@ -282,12 +282,12 @@
   static double one  = 1.0;
   switch (value) {
     case 0: {
-      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&zero, R0);
+      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&zero, R0, true);
       __ lfd(F15_ftos, simm16_offset, R11_scratch1);
       break;
     }
     case 1: {
-      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&one, R0);
+      int simm16_offset = __ load_const_optimized(R11_scratch1, (address*)&one, R0, true);
       __ lfd(F15_ftos, simm16_offset, R11_scratch1);
       break;
     }
@@ -3453,16 +3453,6 @@
                  Rscratch1 = R11_scratch1,
                  Rscratch2 = R12_scratch2;
 
-  if (!EnableInvokeDynamic) {
-    // We should not encounter this bytecode if !EnableInvokeDynamic.
-    // The verifier will stop it. However, if we get past the verifier,
-    // this will stop the thread in a reasonable way, without crashing the JVM.
-    __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeError));
-    // The call_VM checks for exception, so we should never return here.
-    __ should_not_reach_here();
-    return;
-  }
-
   prepare_invoke(byte_no, Rmethod, Rret_addr, Rscratch1, noreg, Rflags, Rscratch2);
 
   // Profile this call.
@@ -3486,12 +3476,6 @@
                  Rscratch1 = R11_scratch1,
                  Rscratch2 = R12_scratch2;
 
-  if (!EnableInvokeDynamic) {
-    // Rewriter does not generate this bytecode.
-    __ should_not_reach_here();
-    return;
-  }
-
   prepare_invoke(byte_no, Rmethod, Rret_addr, Rscratch1, Rrecv, Rflags, Rscratch2);
   __ verify_method_ptr(Rmethod);
   __ null_check_throw(Rrecv, -1, Rscratch2);
@@ -3728,9 +3712,9 @@
   transition(atos, atos);
 
   Label Ldone, Lis_null, Lquicked, Lresolved;
-  Register Roffset         = R5_ARG3,
+  Register Roffset         = R6_ARG4,
            RobjKlass       = R4_ARG2,
-           RspecifiedKlass = R6_ARG4, // Generate_ClassCastException_verbose_handler will expect this register.
+           RspecifiedKlass = R5_ARG3, // Generate_ClassCastException_verbose_handler will read value from this register.
            Rcpool          = R11_scratch1,
            Rtags           = R12_scratch2;
 
--- a/src/cpu/ppc/vm/vm_version_ppc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/ppc/vm/vm_version_ppc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -149,7 +149,7 @@
 }
 
 void VM_Version::print_features() {
-  tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), get_cache_line_size());
+  tty->print_cr("Version: %s cache_line_size = %d", cpu_features(), (int) get_cache_line_size());
 }
 
 #ifdef COMPILER2
--- a/src/cpu/sparc/vm/assembler_sparc.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/assembler_sparc.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -123,8 +123,13 @@
     fpop2_op3    = 0x35,
     impdep1_op3  = 0x36,
     aes3_op3     = 0x36,
+    alignaddr_op3  = 0x36,
+    faligndata_op3 = 0x36,
     flog3_op3    = 0x36,
+    edge_op3     = 0x36,
+    fsrc_op3     = 0x36,
     impdep2_op3  = 0x37,
+    stpartialf_op3 = 0x37,
     jmpl_op3     = 0x38,
     rett_op3     = 0x39,
     trap_op3     = 0x3a,
@@ -175,17 +180,23 @@
 
   enum opfs {
     // selected opfs
+    edge8n_opf         = 0x01,
+
     fmovs_opf          = 0x01,
     fmovd_opf          = 0x02,
 
     fnegs_opf          = 0x05,
     fnegd_opf          = 0x06,
 
+    alignaddr_opf      = 0x18,
+
     fadds_opf          = 0x41,
     faddd_opf          = 0x42,
     fsubs_opf          = 0x45,
     fsubd_opf          = 0x46,
 
+    faligndata_opf     = 0x48,
+
     fmuls_opf          = 0x49,
     fmuld_opf          = 0x4a,
     fdivs_opf          = 0x4d,
@@ -348,6 +359,8 @@
     ASI_PRIMARY            = 0x80,
     ASI_PRIMARY_NOFAULT    = 0x82,
     ASI_PRIMARY_LITTLE     = 0x88,
+    // 8x8-bit partial store
+    ASI_PST8_PRIMARY       = 0xC0,
     // Block initializing store
     ASI_ST_BLKINIT_PRIMARY = 0xE2,
     // Most-Recently-Used (MRU) BIS variant
@@ -585,6 +598,9 @@
   // instruction only in VIS1
   static void vis1_only() { assert( VM_Version::has_vis1(), "This instruction only works on SPARC with VIS1"); }
 
+  // instruction only in VIS2
+  static void vis2_only() { assert( VM_Version::has_vis2(), "This instruction only works on SPARC with VIS2"); }
+
   // instruction only in VIS3
   static void vis3_only() { assert( VM_Version::has_vis3(), "This instruction only works on SPARC with VIS3"); }
 
@@ -1164,6 +1180,20 @@
   inline void wrfprs( Register d) { v9_only(); emit_int32( op(arith_op) | rs1(d) | op3(wrreg_op3) | u_field(6, 29, 25)); }
 
 
+  //  VIS1 instructions
+
+  void alignaddr( Register s1, Register s2, Register d ) { vis1_only(); emit_int32( op(arith_op) | rd(d) | op3(alignaddr_op3) | rs1(s1) | opf(alignaddr_opf) | rs2(s2)); }
+
+  void faligndata( FloatRegister s1, FloatRegister s2, FloatRegister d ) { vis1_only(); emit_int32( op(arith_op) | fd(d, FloatRegisterImpl::D) | op3(faligndata_op3) | fs1(s1, FloatRegisterImpl::D) | opf(faligndata_opf) | fs2(s2, FloatRegisterImpl::D)); }
+
+  void fsrc2( FloatRegisterImpl::Width w, FloatRegister s2, FloatRegister d ) { vis1_only(); emit_int32( op(arith_op) | fd(d, w) | op3(fsrc_op3) | opf(0x7A - w) | fs2(s2, w)); }
+
+  void stpartialf( Register s1, Register s2, FloatRegister d, int ia = -1 ) { vis1_only(); emit_int32( op(ldst_op) | fd(d, FloatRegisterImpl::D) | op3(stpartialf_op3) | rs1(s1) | imm_asi(ia) | rs2(s2)); }
+
+  //  VIS2 instructions
+
+  void edge8n( Register s1, Register s2, Register d ) { vis2_only(); emit_int32( op(arith_op) | rd(d) | op3(edge_op3) | rs1(s1) | opf(edge8n_opf) | rs2(s2)); }
+
   // VIS3 instructions
 
   void movstosw( FloatRegister s, Register d ) { vis3_only();  emit_int32( op(arith_op) | rd(d) | op3(mftoi_op3) | opf(mstosw_opf) | fs2(s, FloatRegisterImpl::S)); }
--- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -414,6 +414,7 @@
 
 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
   __ bind(_entry);
+  __ set(_trap_request, G4);
   __ call(Runtime1::entry_for(Runtime1::deoptimize_id), relocInfo::runtime_call_type);
   __ delayed()->nop();
   ce->add_call_info_here(_info);
--- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -781,7 +781,7 @@
       {
         __ set_info("deoptimize", dont_gc_arguments);
         OopMap* oop_map = save_live_registers(sasm);
-        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize));
+        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), G4);
         oop_maps = new OopMapSet();
         oop_maps->add_gc_map(call_offset, oop_map);
         restore_live_registers(sasm);
--- a/src/cpu/sparc/vm/c1_globals_sparc.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/c1_globals_sparc.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -40,7 +40,6 @@
 define_pd_global(bool, UseOnStackReplacement,        true );
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             1000 ); // Design center runs on 1.3.1
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     1400 );
 define_pd_global(bool, UseTLAB,                      true );
--- a/src/cpu/sparc/vm/c2_globals_sparc.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/c2_globals_sparc.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -44,7 +44,6 @@
 #endif // CC_INTERP
 define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            140000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         4);
--- a/src/cpu/sparc/vm/frame_sparc.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/frame_sparc.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -259,8 +259,8 @@
 
   // next two fns read and write Lmonitors value,
  private:
-  BasicObjectLock* interpreter_frame_monitors()           const  { return *interpreter_frame_monitors_addr(); }
-  void interpreter_frame_set_monitors(BasicObjectLock* monitors) {        *interpreter_frame_monitors_addr() = monitors; }
+  BasicObjectLock* interpreter_frame_monitors() const;
+  void interpreter_frame_set_monitors(BasicObjectLock* monitors);
 #else
  public:
   inline interpreterState get_interpreterState() const {
--- a/src/cpu/sparc/vm/frame_sparc.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/frame_sparc.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -226,6 +226,13 @@
   return (Method**)sp_addr_at( Lmethod->sp_offset_in_saved_window());
 }
 
+inline BasicObjectLock* frame::interpreter_frame_monitors() const {
+  return *interpreter_frame_monitors_addr();
+}
+
+inline void frame::interpreter_frame_set_monitors(BasicObjectLock* monitors) {
+  *interpreter_frame_monitors_addr() = monitors;
+}
 
 // Constant pool cache
 
--- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -727,7 +727,6 @@
   if (index_size == sizeof(u2)) {
     get_2_byte_integer_at_bcp(bcp_offset, temp, index, Unsigned);
   } else if (index_size == sizeof(u4)) {
-    assert(EnableInvokeDynamic, "giant index used only for JSR 292");
     get_4_byte_integer_at_bcp(bcp_offset, temp, index);
     assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
     xor3(index, -1, index);  // convert to plain index
--- a/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
  private:
 
 #ifdef PRODUCT
-#define inc_counter_np(a,b,c) (0)
+#define inc_counter_np(a,b,c)
 #else
 #define inc_counter_np(counter, t1, t2) \
   BLOCK_COMMENT("inc_counter " #counter); \
@@ -1055,7 +1055,7 @@
                                               Label& L_loop, bool use_prefetch, bool use_bis);
 
   void disjoint_copy_core(Register from, Register to, Register count, int log2_elem_size,
-                          int iter_size, CopyLoopFunc copy_loop_func) {
+                          int iter_size, StubGenerator::CopyLoopFunc copy_loop_func) {
     Label L_copy;
 
     assert(log2_elem_size <= 3, "the following code should be changed");
@@ -1206,7 +1206,7 @@
     __ inc(from, 8);
     __ sllx(O3, left_shift,  O3);
 
-    disjoint_copy_core(from, to, count, log2_elem_size, 16, copy_16_bytes_shift_loop);
+    disjoint_copy_core(from, to, count, log2_elem_size, 16, &StubGenerator::copy_16_bytes_shift_loop);
 
     __ inccc(count, count_dec>>1 ); // + 8 bytes
     __ brx(Assembler::negative, true, Assembler::pn, L_copy_last_bytes);
@@ -2085,7 +2085,7 @@
       __ dec(count, 4);   // The cmp at the beginning guaranty count >= 4
       __ sllx(O3, 32,  O3);
 
-      disjoint_copy_core(from, to, count, 2, 16, copy_16_bytes_loop);
+      disjoint_copy_core(from, to, count, 2, 16, &StubGenerator::copy_16_bytes_loop);
 
       __ br(Assembler::always, false, Assembler::pt, L_copy_4_bytes);
       __ delayed()->inc(count, 4); // restore 'count'
@@ -2366,7 +2366,7 @@
     // count >= 0 (original count - 8)
     __ mov(from, from64);
 
-    disjoint_copy_core(from64, to64, count, 3, 64, copy_64_bytes_loop);
+    disjoint_copy_core(from64, to64, count, 3, 64, &StubGenerator::copy_64_bytes_loop);
 
       // Restore O4(offset0), O5(offset8)
       __ sub(from64, from, offset0);
@@ -3305,9 +3305,12 @@
   }
 
   address generate_aescrypt_encryptBlock() {
+    // required since we read expanded key 'int' array starting first element without alignment considerations
+    assert((arrayOopDesc::base_offset_in_bytes(T_INT) & 7) == 0,
+           "the following code assumes that first element of an int array is aligned to 8 bytes");
     __ align(CodeEntryAlignment);
-    StubCodeMark mark(this, "StubRoutines", "aesencryptBlock");
-    Label L_doLast128bit, L_storeOutput;
+    StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
+    Label L_load_misaligned_input, L_load_expanded_key, L_doLast128bit, L_storeOutput, L_store_misaligned_output;
     address start = __ pc();
     Register from = O0; // source byte array
     Register to = O1;   // destination byte array
@@ -3317,15 +3320,33 @@
     // read expanded key length
     __ ldsw(Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)), keylen, 0);
 
-    // load input into F54-F56; F30-F31 used as temp
-    __ ldf(FloatRegisterImpl::S, from, 0, F30);
-    __ ldf(FloatRegisterImpl::S, from, 4, F31);
-    __ fmov(FloatRegisterImpl::D, F30, F54);
-    __ ldf(FloatRegisterImpl::S, from, 8, F30);
-    __ ldf(FloatRegisterImpl::S, from, 12, F31);
-    __ fmov(FloatRegisterImpl::D, F30, F56);
-
-    // load expanded key
+    // Method to address arbitrary alignment for load instructions:
+    // Check last 3 bits of 'from' address to see if it is aligned to 8-byte boundary
+    // If zero/aligned then continue with double FP load instructions
+    // If not zero/mis-aligned then alignaddr will set GSR.align with number of bytes to skip during faligndata
+    // alignaddr will also convert arbitrary aligned 'from' address to nearest 8-byte aligned address
+    // load 3 * 8-byte components (to read 16 bytes input) in 3 different FP regs starting at this aligned address
+    // faligndata will then extract (based on GSR.align value) the appropriate 8 bytes from the 2 source regs
+
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input);
+    __ delayed()->alignaddr(from, G0, from);
+
+    // aligned case: load input into F54-F56
+    __ ldf(FloatRegisterImpl::D, from, 0, F54);
+    __ ldf(FloatRegisterImpl::D, from, 8, F56);
+    __ ba_short(L_load_expanded_key);
+
+    __ BIND(L_load_misaligned_input);
+    __ ldf(FloatRegisterImpl::D, from, 0, F54);
+    __ ldf(FloatRegisterImpl::D, from, 8, F56);
+    __ ldf(FloatRegisterImpl::D, from, 16, F58);
+    __ faligndata(F54, F56, F54);
+    __ faligndata(F56, F58, F56);
+
+    __ BIND(L_load_expanded_key);
+    // Since we load expanded key buffers starting first element, 8-byte alignment is guaranteed
     for ( int i = 0;  i <= 38; i += 2 ) {
       __ ldf(FloatRegisterImpl::D, key, i*4, as_FloatRegister(i));
     }
@@ -3365,8 +3386,7 @@
     __ ldf(FloatRegisterImpl::D, key, 232, F50);
     __ aes_eround01(F52, F54, F56, F58); //round 13
     __ aes_eround23(F46, F54, F56, F60);
-    __ br(Assembler::always, false, Assembler::pt, L_storeOutput);
-    __ delayed()->nop();
+    __ ba_short(L_storeOutput);
 
     __ BIND(L_doLast128bit);
     __ ldf(FloatRegisterImpl::D, key, 160, F48);
@@ -3377,23 +3397,62 @@
     __ aes_eround01_l(F48, F58, F60, F54); //last round
     __ aes_eround23_l(F50, F58, F60, F56);
 
-    // store output into the destination array, F0-F1 used as temp
-    __ fmov(FloatRegisterImpl::D, F54, F0);
-    __ stf(FloatRegisterImpl::S, F0, to, 0);
-    __ stf(FloatRegisterImpl::S, F1, to, 4);
-    __ fmov(FloatRegisterImpl::D, F56, F0);
-    __ stf(FloatRegisterImpl::S, F0, to, 8);
+    // Method to address arbitrary alignment for store instructions:
+    // Check last 3 bits of 'dest' address to see if it is aligned to 8-byte boundary
+    // If zero/aligned then continue with double FP store instructions
+    // If not zero/mis-aligned then edge8n will generate edge mask in result reg (O3 in below case)
+    // Example: If dest address is 0x07 and nearest 8-byte aligned address is 0x00 then edge mask will be 00000001
+    // Compute (8-n) where n is # of bytes skipped by partial store(stpartialf) inst from edge mask, n=7 in this case
+    // We get the value of n from the andcc that checks 'dest' alignment. n is available in O5 in below case.
+    // Set GSR.align to (8-n) using alignaddr
+    // Circular byte shift store values by n places so that the original bytes are at correct position for stpartialf
+    // Set the arbitrarily aligned 'dest' address to nearest 8-byte aligned address
+    // Store (partial) the original first (8-n) bytes starting at the original 'dest' address
+    // Negate the edge mask so that the subsequent stpartialf can store the original (8-n-1)th through 8th bytes at appropriate address
+    // We need to execute this process for both the 8-byte result values
+
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, O5);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output);
+    __ delayed()->edge8n(to, G0, O3);
+
+    // aligned case: store output into the destination array
+    __ stf(FloatRegisterImpl::D, F54, to, 0);
     __ retl();
-    __ delayed()->stf(FloatRegisterImpl::S, F1, to, 12);
+    __ delayed()->stf(FloatRegisterImpl::D, F56, to, 8);
+
+    __ BIND(L_store_misaligned_output);
+    __ add(to, 8, O4);
+    __ mov(8, O2);
+    __ sub(O2, O5, O2);
+    __ alignaddr(O2, G0, O2);
+    __ faligndata(F54, F54, F54);
+    __ faligndata(F56, F56, F56);
+    __ and3(to, -8, to);
+    __ and3(O4, -8, O4);
+    __ stpartialf(to, O3, F54, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(O4, O3, F56, Assembler::ASI_PST8_PRIMARY);
+    __ add(to, 8, to);
+    __ add(O4, 8, O4);
+    __ orn(G0, O3, O3);
+    __ stpartialf(to, O3, F54, Assembler::ASI_PST8_PRIMARY);
+    __ retl();
+    __ delayed()->stpartialf(O4, O3, F56, Assembler::ASI_PST8_PRIMARY);
 
     return start;
   }
 
   address generate_aescrypt_decryptBlock() {
+    assert((arrayOopDesc::base_offset_in_bytes(T_INT) & 7) == 0,
+           "the following code assumes that first element of an int array is aligned to 8 bytes");
+    // required since we read original key 'byte' array as well in the decryption stubs
+    assert((arrayOopDesc::base_offset_in_bytes(T_BYTE) & 7) == 0,
+           "the following code assumes that first element of a byte array is aligned to 8 bytes");
     __ align(CodeEntryAlignment);
-    StubCodeMark mark(this, "StubRoutines", "aesdecryptBlock");
+    StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
     address start = __ pc();
-    Label L_expand192bit, L_expand256bit, L_common_transform;
+    Label L_load_misaligned_input, L_load_original_key, L_expand192bit, L_expand256bit, L_reload_misaligned_input;
+    Label L_256bit_transform, L_common_transform, L_store_misaligned_output;
     Register from = O0; // source byte array
     Register to = O1;   // destination byte array
     Register key = O2;  // expanded key array
@@ -3403,15 +3462,29 @@
     // read expanded key array length
     __ ldsw(Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)), keylen, 0);
 
-    // load input into F52-F54; F30,F31 used as temp
-    __ ldf(FloatRegisterImpl::S, from, 0, F30);
-    __ ldf(FloatRegisterImpl::S, from, 4, F31);
-    __ fmov(FloatRegisterImpl::D, F30, F52);
-    __ ldf(FloatRegisterImpl::S, from, 8, F30);
-    __ ldf(FloatRegisterImpl::S, from, 12, F31);
-    __ fmov(FloatRegisterImpl::D, F30, F54);
-
+    // save 'from' since we may need to recheck alignment in case of 256-bit decryption
+    __ mov(from, G1);
+
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input);
+    __ delayed()->alignaddr(from, G0, from);
+
+    // aligned case: load input into F52-F54
+    __ ldf(FloatRegisterImpl::D, from, 0, F52);
+    __ ldf(FloatRegisterImpl::D, from, 8, F54);
+    __ ba_short(L_load_original_key);
+
+    __ BIND(L_load_misaligned_input);
+    __ ldf(FloatRegisterImpl::D, from, 0, F52);
+    __ ldf(FloatRegisterImpl::D, from, 8, F54);
+    __ ldf(FloatRegisterImpl::D, from, 16, F56);
+    __ faligndata(F52, F54, F52);
+    __ faligndata(F54, F56, F54);
+
+    __ BIND(L_load_original_key);
     // load original key from SunJCE expanded decryption key
+    // Since we load original key buffer starting first element, 8-byte alignment is guaranteed
     for ( int i = 0;  i <= 3; i++ ) {
       __ ldf(FloatRegisterImpl::S, original_key, i*4, as_FloatRegister(i));
     }
@@ -3432,8 +3505,7 @@
     // perform 128-bit key specific inverse cipher transformation
     __ fxor(FloatRegisterImpl::D, F42, F54, F54);
     __ fxor(FloatRegisterImpl::D, F40, F52, F52);
-    __ br(Assembler::always, false, Assembler::pt, L_common_transform);
-    __ delayed()->nop();
+    __ ba_short(L_common_transform);
 
     __ BIND(L_expand192bit);
 
@@ -3457,8 +3529,7 @@
     __ aes_dround01(F44, F52, F54, F56);
     __ aes_dround23(F42, F56, F58, F54);
     __ aes_dround01(F40, F56, F58, F52);
-    __ br(Assembler::always, false, Assembler::pt, L_common_transform);
-    __ delayed()->nop();
+    __ ba_short(L_common_transform);
 
     __ BIND(L_expand256bit);
 
@@ -3478,14 +3549,31 @@
     __ aes_kexpand2(F50, F56, F58);
 
     for ( int i = 0;  i <= 6; i += 2 ) {
-      __ fmov(FloatRegisterImpl::D, as_FloatRegister(58-i), as_FloatRegister(i));
+      __ fsrc2(FloatRegisterImpl::D, as_FloatRegister(58-i), as_FloatRegister(i));
     }
 
-    // load input into F52-F54
+    // reload original 'from' address
+    __ mov(G1, from);
+
+    // re-check 8-byte alignment
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_reload_misaligned_input);
+    __ delayed()->alignaddr(from, G0, from);
+
+    // aligned case: load input into F52-F54
     __ ldf(FloatRegisterImpl::D, from, 0, F52);
     __ ldf(FloatRegisterImpl::D, from, 8, F54);
+    __ ba_short(L_256bit_transform);
+
+    __ BIND(L_reload_misaligned_input);
+    __ ldf(FloatRegisterImpl::D, from, 0, F52);
+    __ ldf(FloatRegisterImpl::D, from, 8, F54);
+    __ ldf(FloatRegisterImpl::D, from, 16, F56);
+    __ faligndata(F52, F54, F52);
+    __ faligndata(F54, F56, F54);
 
     // perform 256-bit key specific inverse cipher transformation
+    __ BIND(L_256bit_transform);
     __ fxor(FloatRegisterImpl::D, F0, F54, F54);
     __ fxor(FloatRegisterImpl::D, F2, F52, F52);
     __ aes_dround23(F4, F52, F54, F58);
@@ -3515,43 +3603,71 @@
       }
     }
 
-    // store output to destination array, F0-F1 used as temp
-    __ fmov(FloatRegisterImpl::D, F52, F0);
-    __ stf(FloatRegisterImpl::S, F0, to, 0);
-    __ stf(FloatRegisterImpl::S, F1, to, 4);
-    __ fmov(FloatRegisterImpl::D, F54, F0);
-    __ stf(FloatRegisterImpl::S, F0, to, 8);
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, O5);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output);
+    __ delayed()->edge8n(to, G0, O3);
+
+    // aligned case: store output into the destination array
+    __ stf(FloatRegisterImpl::D, F52, to, 0);
     __ retl();
-    __ delayed()->stf(FloatRegisterImpl::S, F1, to, 12);
+    __ delayed()->stf(FloatRegisterImpl::D, F54, to, 8);
+
+    __ BIND(L_store_misaligned_output);
+    __ add(to, 8, O4);
+    __ mov(8, O2);
+    __ sub(O2, O5, O2);
+    __ alignaddr(O2, G0, O2);
+    __ faligndata(F52, F52, F52);
+    __ faligndata(F54, F54, F54);
+    __ and3(to, -8, to);
+    __ and3(O4, -8, O4);
+    __ stpartialf(to, O3, F52, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(O4, O3, F54, Assembler::ASI_PST8_PRIMARY);
+    __ add(to, 8, to);
+    __ add(O4, 8, O4);
+    __ orn(G0, O3, O3);
+    __ stpartialf(to, O3, F52, Assembler::ASI_PST8_PRIMARY);
+    __ retl();
+    __ delayed()->stpartialf(O4, O3, F54, Assembler::ASI_PST8_PRIMARY);
 
     return start;
   }
 
   address generate_cipherBlockChaining_encryptAESCrypt() {
+    assert((arrayOopDesc::base_offset_in_bytes(T_INT) & 7) == 0,
+           "the following code assumes that first element of an int array is aligned to 8 bytes");
+    assert((arrayOopDesc::base_offset_in_bytes(T_BYTE) & 7) == 0,
+           "the following code assumes that first element of a byte array is aligned to 8 bytes");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_encryptAESCrypt");
-    Label L_cbcenc128, L_cbcenc192, L_cbcenc256;
+    Label L_cbcenc128, L_load_misaligned_input_128bit, L_128bit_transform, L_store_misaligned_output_128bit;
+    Label L_check_loop_end_128bit, L_cbcenc192, L_load_misaligned_input_192bit, L_192bit_transform;
+    Label L_store_misaligned_output_192bit, L_check_loop_end_192bit, L_cbcenc256, L_load_misaligned_input_256bit;
+    Label L_256bit_transform, L_store_misaligned_output_256bit, L_check_loop_end_256bit;
     address start = __ pc();
-    Register from = O0; // source byte array
-    Register to = O1;   // destination byte array
-    Register key = O2;  // expanded key array
-    Register rvec = O3; // init vector
-    const Register len_reg = O4; // cipher length
-    const Register keylen = O5;  // reg for storing expanded key array length
-
+    Register from = I0; // source byte array
+    Register to = I1;   // destination byte array
+    Register key = I2;  // expanded key array
+    Register rvec = I3; // init vector
+    const Register len_reg = I4; // cipher length
+    const Register keylen = I5;  // reg for storing expanded key array length
+
+    __ save_frame(0);
     // save cipher len to return in the end
-    __ mov(len_reg, L1);
+    __ mov(len_reg, L0);
 
     // read expanded key length
     __ ldsw(Address(key, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT)), keylen, 0);
 
-    // load init vector
+    // load initial vector, 8-byte alignment is guranteed
     __ ldf(FloatRegisterImpl::D, rvec, 0, F60);
     __ ldf(FloatRegisterImpl::D, rvec, 8, F62);
+    // load key, 8-byte alignment is guranteed
     __ ldx(key,0,G1);
-    __ ldx(key,8,G2);
-
-    // start loading expanded key
+    __ ldx(key,8,G5);
+
+    // start loading expanded key, 8-byte alignment is guranteed
     for ( int i = 0, j = 16;  i <= 38; i += 2, j += 8 ) {
       __ ldf(FloatRegisterImpl::D, key, j, as_FloatRegister(i));
     }
@@ -3571,15 +3687,35 @@
     }
 
     // 256-bit original key size
-    __ br(Assembler::always, false, Assembler::pt, L_cbcenc256);
-    __ delayed()->nop();
+    __ ba_short(L_cbcenc256);
 
     __ align(OptoLoopAlignment);
     __ BIND(L_cbcenc128);
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input_128bit);
+    __ delayed()->mov(from, L1); // save original 'from' address before alignaddr
+
+    // aligned case: load input into G3 and G4
     __ ldx(from,0,G3);
     __ ldx(from,8,G4);
+    __ ba_short(L_128bit_transform);
+
+    __ BIND(L_load_misaligned_input_128bit);
+    // can clobber F48, F50 and F52 as they are not used in 128 and 192-bit key encryption
+    __ alignaddr(from, G0, from);
+    __ ldf(FloatRegisterImpl::D, from, 0, F48);
+    __ ldf(FloatRegisterImpl::D, from, 8, F50);
+    __ ldf(FloatRegisterImpl::D, from, 16, F52);
+    __ faligndata(F48, F50, F48);
+    __ faligndata(F50, F52, F50);
+    __ movdtox(F48, G3);
+    __ movdtox(F50, G4);
+    __ mov(L1, from);
+
+    __ BIND(L_128bit_transform);
     __ xor3(G1,G3,G3);
-    __ xor3(G2,G4,G4);
+    __ xor3(G5,G4,G4);
     __ movxtod(G3,F56);
     __ movxtod(G4,F58);
     __ fxor(FloatRegisterImpl::D, F60, F56, F60);
@@ -3598,24 +3734,81 @@
       }
     }
 
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, L1);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_128bit);
+    __ delayed()->edge8n(to, G0, L2);
+
+    // aligned case: store output into the destination array
     __ stf(FloatRegisterImpl::D, F60, to, 0);
     __ stf(FloatRegisterImpl::D, F62, to, 8);
+    __ ba_short(L_check_loop_end_128bit);
+
+    __ BIND(L_store_misaligned_output_128bit);
+    __ add(to, 8, L3);
+    __ mov(8, L4);
+    __ sub(L4, L1, L4);
+    __ alignaddr(L4, G0, L4);
+    // save cipher text before circular right shift
+    // as it needs to be stored as iv for next block (see code before next retl)
+    __ movdtox(F60, L6);
+    __ movdtox(F62, L7);
+    __ faligndata(F60, F60, F60);
+    __ faligndata(F62, F62, F62);
+    __ mov(to, L5);
+    __ and3(to, -8, to);
+    __ and3(L3, -8, L3);
+    __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+    __ add(to, 8, to);
+    __ add(L3, 8, L3);
+    __ orn(G0, L2, L2);
+    __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+    __ mov(L5, to);
+    __ movxtod(L6, F60);
+    __ movxtod(L7, F62);
+
+    __ BIND(L_check_loop_end_128bit);
     __ add(from, 16, from);
     __ add(to, 16, to);
     __ subcc(len_reg, 16, len_reg);
     __ br(Assembler::notEqual, false, Assembler::pt, L_cbcenc128);
     __ delayed()->nop();
+    // re-init intial vector for next block, 8-byte alignment is guaranteed
     __ stf(FloatRegisterImpl::D, F60, rvec, 0);
     __ stf(FloatRegisterImpl::D, F62, rvec, 8);
-    __ retl();
-    __ delayed()->mov(L1, O0);
+    __ mov(L0, I0);
+    __ ret();
+    __ delayed()->restore();
 
     __ align(OptoLoopAlignment);
     __ BIND(L_cbcenc192);
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input_192bit);
+    __ delayed()->mov(from, L1); // save original 'from' address before alignaddr
+
+    // aligned case: load input into G3 and G4
     __ ldx(from,0,G3);
     __ ldx(from,8,G4);
+    __ ba_short(L_192bit_transform);
+
+    __ BIND(L_load_misaligned_input_192bit);
+    // can clobber F48, F50 and F52 as they are not used in 128 and 192-bit key encryption
+    __ alignaddr(from, G0, from);
+    __ ldf(FloatRegisterImpl::D, from, 0, F48);
+    __ ldf(FloatRegisterImpl::D, from, 8, F50);
+    __ ldf(FloatRegisterImpl::D, from, 16, F52);
+    __ faligndata(F48, F50, F48);
+    __ faligndata(F50, F52, F50);
+    __ movdtox(F48, G3);
+    __ movdtox(F50, G4);
+    __ mov(L1, from);
+
+    __ BIND(L_192bit_transform);
     __ xor3(G1,G3,G3);
-    __ xor3(G2,G4,G4);
+    __ xor3(G5,G4,G4);
     __ movxtod(G3,F56);
     __ movxtod(G4,F58);
     __ fxor(FloatRegisterImpl::D, F60, F56, F60);
@@ -3634,24 +3827,81 @@
       }
     }
 
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, L1);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_192bit);
+    __ delayed()->edge8n(to, G0, L2);
+
+    // aligned case: store output into the destination array
     __ stf(FloatRegisterImpl::D, F60, to, 0);
     __ stf(FloatRegisterImpl::D, F62, to, 8);
+    __ ba_short(L_check_loop_end_192bit);
+
+    __ BIND(L_store_misaligned_output_192bit);
+    __ add(to, 8, L3);
+    __ mov(8, L4);
+    __ sub(L4, L1, L4);
+    __ alignaddr(L4, G0, L4);
+    __ movdtox(F60, L6);
+    __ movdtox(F62, L7);
+    __ faligndata(F60, F60, F60);
+    __ faligndata(F62, F62, F62);
+    __ mov(to, L5);
+    __ and3(to, -8, to);
+    __ and3(L3, -8, L3);
+    __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+    __ add(to, 8, to);
+    __ add(L3, 8, L3);
+    __ orn(G0, L2, L2);
+    __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+    __ mov(L5, to);
+    __ movxtod(L6, F60);
+    __ movxtod(L7, F62);
+
+    __ BIND(L_check_loop_end_192bit);
     __ add(from, 16, from);
     __ subcc(len_reg, 16, len_reg);
     __ add(to, 16, to);
     __ br(Assembler::notEqual, false, Assembler::pt, L_cbcenc192);
     __ delayed()->nop();
+    // re-init intial vector for next block, 8-byte alignment is guaranteed
     __ stf(FloatRegisterImpl::D, F60, rvec, 0);
     __ stf(FloatRegisterImpl::D, F62, rvec, 8);
-    __ retl();
-    __ delayed()->mov(L1, O0);
+    __ mov(L0, I0);
+    __ ret();
+    __ delayed()->restore();
 
     __ align(OptoLoopAlignment);
     __ BIND(L_cbcenc256);
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input_256bit);
+    __ delayed()->mov(from, L1); // save original 'from' address before alignaddr
+
+    // aligned case: load input into G3 and G4
     __ ldx(from,0,G3);
     __ ldx(from,8,G4);
+    __ ba_short(L_256bit_transform);
+
+    __ BIND(L_load_misaligned_input_256bit);
+    // cannot clobber F48, F50 and F52. F56, F58 can be used though
+    __ alignaddr(from, G0, from);
+    __ movdtox(F60, L2); // save F60 before overwriting
+    __ ldf(FloatRegisterImpl::D, from, 0, F56);
+    __ ldf(FloatRegisterImpl::D, from, 8, F58);
+    __ ldf(FloatRegisterImpl::D, from, 16, F60);
+    __ faligndata(F56, F58, F56);
+    __ faligndata(F58, F60, F58);
+    __ movdtox(F56, G3);
+    __ movdtox(F58, G4);
+    __ mov(L1, from);
+    __ movxtod(L2, F60);
+
+    __ BIND(L_256bit_transform);
     __ xor3(G1,G3,G3);
-    __ xor3(G2,G4,G4);
+    __ xor3(G5,G4,G4);
     __ movxtod(G3,F56);
     __ movxtod(G4,F58);
     __ fxor(FloatRegisterImpl::D, F60, F56, F60);
@@ -3670,26 +3920,69 @@
       }
     }
 
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, L1);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_256bit);
+    __ delayed()->edge8n(to, G0, L2);
+
+    // aligned case: store output into the destination array
     __ stf(FloatRegisterImpl::D, F60, to, 0);
     __ stf(FloatRegisterImpl::D, F62, to, 8);
+    __ ba_short(L_check_loop_end_256bit);
+
+    __ BIND(L_store_misaligned_output_256bit);
+    __ add(to, 8, L3);
+    __ mov(8, L4);
+    __ sub(L4, L1, L4);
+    __ alignaddr(L4, G0, L4);
+    __ movdtox(F60, L6);
+    __ movdtox(F62, L7);
+    __ faligndata(F60, F60, F60);
+    __ faligndata(F62, F62, F62);
+    __ mov(to, L5);
+    __ and3(to, -8, to);
+    __ and3(L3, -8, L3);
+    __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+    __ add(to, 8, to);
+    __ add(L3, 8, L3);
+    __ orn(G0, L2, L2);
+    __ stpartialf(to, L2, F60, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(L3, L2, F62, Assembler::ASI_PST8_PRIMARY);
+    __ mov(L5, to);
+    __ movxtod(L6, F60);
+    __ movxtod(L7, F62);
+
+    __ BIND(L_check_loop_end_256bit);
     __ add(from, 16, from);
     __ subcc(len_reg, 16, len_reg);
     __ add(to, 16, to);
     __ br(Assembler::notEqual, false, Assembler::pt, L_cbcenc256);
     __ delayed()->nop();
+    // re-init intial vector for next block, 8-byte alignment is guaranteed
     __ stf(FloatRegisterImpl::D, F60, rvec, 0);
     __ stf(FloatRegisterImpl::D, F62, rvec, 8);
-    __ retl();
-    __ delayed()->mov(L1, O0);
+    __ mov(L0, I0);
+    __ ret();
+    __ delayed()->restore();
 
     return start;
   }
 
   address generate_cipherBlockChaining_decryptAESCrypt_Parallel() {
+    assert((arrayOopDesc::base_offset_in_bytes(T_INT) & 7) == 0,
+           "the following code assumes that first element of an int array is aligned to 8 bytes");
+    assert((arrayOopDesc::base_offset_in_bytes(T_BYTE) & 7) == 0,
+           "the following code assumes that first element of a byte array is aligned to 8 bytes");
     __ align(CodeEntryAlignment);
     StubCodeMark mark(this, "StubRoutines", "cipherBlockChaining_decryptAESCrypt");
     Label L_cbcdec_end, L_expand192bit, L_expand256bit, L_dec_first_block_start;
     Label L_dec_first_block128, L_dec_first_block192, L_dec_next2_blocks128, L_dec_next2_blocks192, L_dec_next2_blocks256;
+    Label L_load_misaligned_input_first_block, L_transform_first_block, L_load_misaligned_next2_blocks128, L_transform_next2_blocks128;
+    Label L_load_misaligned_next2_blocks192, L_transform_next2_blocks192, L_load_misaligned_next2_blocks256, L_transform_next2_blocks256;
+    Label L_store_misaligned_output_first_block, L_check_decrypt_end, L_store_misaligned_output_next2_blocks128;
+    Label L_check_decrypt_loop_end128, L_store_misaligned_output_next2_blocks192, L_check_decrypt_loop_end192;
+    Label L_store_misaligned_output_next2_blocks256, L_check_decrypt_loop_end256;
     address start = __ pc();
     Register from = I0; // source byte array
     Register to = I1;   // destination byte array
@@ -3699,16 +3992,17 @@
     const Register original_key = I5;  // original key array only required during decryption
     const Register keylen = L6;  // reg for storing expanded key array length
 
-    // save cipher len before save_frame, to return in the end
-    __ mov(O4, L0);
     __ save_frame(0); //args are read from I* registers since we save the frame in the beginning
+    // save cipher len to return in the end
+    __ mov(len_reg, L7);
 
     // load original key from SunJCE expanded decryption key
+    // Since we load original key buffer starting first element, 8-byte alignment is guaranteed
     for ( int i = 0;  i <= 3; i++ ) {
       __ ldf(FloatRegisterImpl::S, original_key, i*4, as_FloatRegister(i));
     }
 
-    // load initial vector
+    // load initial vector, 8-byte alignment is guaranteed
     __ ldx(rvec,0,L0);
     __ ldx(rvec,8,L1);
 
@@ -3733,11 +4027,10 @@
     __ movdtox(F42,L3);
 
     __ and3(len_reg, 16, L4);
-    __ br_null(L4, false, Assembler::pt, L_dec_next2_blocks128);
-    __ delayed()->nop();
-
-    __ br(Assembler::always, false, Assembler::pt, L_dec_first_block_start);
-    __ delayed()->nop();
+    __ br_null_short(L4, Assembler::pt, L_dec_next2_blocks128);
+    __ nop();
+
+    __ ba_short(L_dec_first_block_start);
 
     __ BIND(L_expand192bit);
     // load rest of the 192-bit key
@@ -3758,11 +4051,10 @@
     __ movdtox(F50,L3);
 
     __ and3(len_reg, 16, L4);
-    __ br_null(L4, false, Assembler::pt, L_dec_next2_blocks192);
-    __ delayed()->nop();
-
-    __ br(Assembler::always, false, Assembler::pt, L_dec_first_block_start);
-    __ delayed()->nop();
+    __ br_null_short(L4, Assembler::pt, L_dec_next2_blocks192);
+    __ nop();
+
+    __ ba_short(L_dec_first_block_start);
 
     __ BIND(L_expand256bit);
     // load rest of the 256-bit key
@@ -3785,12 +4077,32 @@
     __ movdtox(F58,L3);
 
     __ and3(len_reg, 16, L4);
-    __ br_null(L4, false, Assembler::pt, L_dec_next2_blocks256);
-    __ delayed()->nop();
+    __ br_null_short(L4, Assembler::pt, L_dec_next2_blocks256);
 
     __ BIND(L_dec_first_block_start);
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_input_first_block);
+    __ delayed()->mov(from, G1); // save original 'from' address before alignaddr
+
+    // aligned case: load input into L4 and L5
     __ ldx(from,0,L4);
     __ ldx(from,8,L5);
+    __ ba_short(L_transform_first_block);
+
+    __ BIND(L_load_misaligned_input_first_block);
+    __ alignaddr(from, G0, from);
+    // F58, F60, F62 can be clobbered
+    __ ldf(FloatRegisterImpl::D, from, 0, F58);
+    __ ldf(FloatRegisterImpl::D, from, 8, F60);
+    __ ldf(FloatRegisterImpl::D, from, 16, F62);
+    __ faligndata(F58, F60, F58);
+    __ faligndata(F60, F62, F60);
+    __ movdtox(F58, L4);
+    __ movdtox(F60, L5);
+    __ mov(G1, from);
+
+    __ BIND(L_transform_first_block);
     __ xor3(L2,L4,G1);
     __ movxtod(G1,F60);
     __ xor3(L3,L5,G1);
@@ -3833,9 +4145,36 @@
     __ fxor(FloatRegisterImpl::D, F56, F60, F60);
     __ fxor(FloatRegisterImpl::D, F58, F62, F62);
 
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, G1);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_first_block);
+    __ delayed()->edge8n(to, G0, G2);
+
+    // aligned case: store output into the destination array
     __ stf(FloatRegisterImpl::D, F60, to, 0);
     __ stf(FloatRegisterImpl::D, F62, to, 8);
-
+    __ ba_short(L_check_decrypt_end);
+
+    __ BIND(L_store_misaligned_output_first_block);
+    __ add(to, 8, G3);
+    __ mov(8, G4);
+    __ sub(G4, G1, G4);
+    __ alignaddr(G4, G0, G4);
+    __ faligndata(F60, F60, F60);
+    __ faligndata(F62, F62, F62);
+    __ mov(to, G1);
+    __ and3(to, -8, to);
+    __ and3(G3, -8, G3);
+    __ stpartialf(to, G2, F60, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(G3, G2, F62, Assembler::ASI_PST8_PRIMARY);
+    __ add(to, 8, to);
+    __ add(G3, 8, G3);
+    __ orn(G0, G2, G2);
+    __ stpartialf(to, G2, F60, Assembler::ASI_PST8_PRIMARY);
+    __ stpartialf(G3, G2, F62, Assembler::ASI_PST8_PRIMARY);
+    __ mov(G1, to);
+
+    __ BIND(L_check_decrypt_end);
     __ add(from, 16, from);
     __ add(to, 16, to);
     __ subcc(len_reg, 16, len_reg);
@@ -3852,17 +4191,44 @@
     __ BIND(L_dec_next2_blocks128);
     __ nop();
 
-    // F40:F42 used for first 16-bytes
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_next2_blocks128);
+    __ delayed()->mov(from, G1); // save original 'from' address before alignaddr
+
+    // aligned case: load input into G4, G5, L4 and L5
     __ ldx(from,0,G4);
     __ ldx(from,8,G5);
+    __ ldx(from,16,L4);
+    __ ldx(from,24,L5);
+    __ ba_short(L_transform_next2_blocks128);
+
+    __ BIND(L_load_misaligned_next2_blocks128);
+    __ alignaddr(from, G0, from);
+    // F40, F42, F58, F60, F62 can be clobbered
+    __ ldf(FloatRegisterImpl::D, from, 0, F40);
+    __ ldf(FloatRegisterImpl::D, from, 8, F42);
+    __ ldf(FloatRegisterImpl::D, from, 16, F60);
+    __ ldf(FloatRegisterImpl::D, from, 24, F62);
+    __ ldf(FloatRegisterImpl::D, from, 32, F58);
+    __ faligndata(F40, F42, F40);
+    __ faligndata(F42, F60, F42);
+    __ faligndata(F60, F62, F60);
+    __ faligndata(F62, F58, F62);
+    __ movdtox(F40, G4);
+    __ movdtox(F42, G5);
+    __ movdtox(F60, L4);
+    __ movdtox(F62, L5);
+    __ mov(G1, from);
+
+    __ BIND(L_transform_next2_blocks128);
+    // F40:F42 used for first 16-bytes
     __ xor3(L2,G4,G1);
     __ movxtod(G1,F40);
     __ xor3(L3,G5,G1);
     __ movxtod(G1,F42);
 
     // F60:F62 used for next 16-bytes
-    __ ldx(from,16,L4);
-    __ ldx(from,24,L5);
     __ xor3(L2,L4,G1);
     __ movxtod(G1,F60);
     __ xor3(L3,L5,G1);
@@ -3891,9 +4257,6 @@
     __ fxor(FloatRegisterImpl::D, F46, F40, F40);
     __ fxor(FloatRegisterImpl::D, F44, F42, F42);
 
-    __ stf(FloatRegisterImpl::D, F40, to, 0);
-    __ stf(FloatRegisterImpl::D, F42, to, 8);
-
     __ movxtod(G4,F56);
     __ movxtod(G5,F58);
     __ mov(L4,L0);
@@ -3901,32 +4264,93 @@
     __ fxor(FloatRegisterImpl::D, F56, F60, F60);
     __ fxor(FloatRegisterImpl::D, F58, F62, F62);
 
+    // For mis-aligned store of 32 bytes of result we can do:
+    // Circular right-shift all 4 FP registers so that 'head' and 'tail'
+    // parts that need to be stored starting at mis-aligned address are in a FP reg
+    // the other 3 FP regs can thus be stored using regular store
+    // we then use the edge + partial-store mechanism to store the 'head' and 'tail' parts
+
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, G1);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_next2_blocks128);
+    __ delayed()->edge8n(to, G0, G2);
+
+    // aligned case: store output into the destination array
+    __ stf(FloatRegisterImpl::D, F40, to, 0);
+    __ stf(FloatRegisterImpl::D, F42, to, 8);
     __ stf(FloatRegisterImpl::D, F60, to, 16);
     __ stf(FloatRegisterImpl::D, F62, to, 24);
-
+    __ ba_short(L_check_decrypt_loop_end128);
+
+    __ BIND(L_store_misaligned_output_next2_blocks128);
+    __ mov(8, G4);
+    __ sub(G4, G1, G4);
+    __ alignaddr(G4, G0, G4);
+    __ faligndata(F40, F42, F56); // F56 can be clobbered
+    __ faligndata(F42, F60, F42);
+    __ faligndata(F60, F62, F60);
+    __ faligndata(F62, F40, F40);
+    __ mov(to, G1);
+    __ and3(to, -8, to);
+    __ stpartialf(to, G2, F40, Assembler::ASI_PST8_PRIMARY);
+    __ stf(FloatRegisterImpl::D, F56, to, 8);
+    __ stf(FloatRegisterImpl::D, F42, to, 16);
+    __ stf(FloatRegisterImpl::D, F60, to, 24);
+    __ add(to, 32, to);
+    __ orn(G0, G2, G2);
+    __ stpartialf(to, G2, F40, Assembler::ASI_PST8_PRIMARY);
+    __ mov(G1, to);
+
+    __ BIND(L_check_decrypt_loop_end128);
     __ add(from, 32, from);
     __ add(to, 32, to);
     __ subcc(len_reg, 32, len_reg);
     __ br(Assembler::notEqual, false, Assembler::pt, L_dec_next2_blocks128);
     __ delayed()->nop();
-    __ br(Assembler::always, false, Assembler::pt, L_cbcdec_end);
-    __ delayed()->nop();
+    __ ba_short(L_cbcdec_end);
 
     __ align(OptoLoopAlignment);
     __ BIND(L_dec_next2_blocks192);
     __ nop();
 
-    // F48:F50 used for first 16-bytes
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_next2_blocks192);
+    __ delayed()->mov(from, G1); // save original 'from' address before alignaddr
+
+    // aligned case: load input into G4, G5, L4 and L5
     __ ldx(from,0,G4);
     __ ldx(from,8,G5);
+    __ ldx(from,16,L4);
+    __ ldx(from,24,L5);
+    __ ba_short(L_transform_next2_blocks192);
+
+    __ BIND(L_load_misaligned_next2_blocks192);
+    __ alignaddr(from, G0, from);
+    // F48, F50, F52, F60, F62 can be clobbered
+    __ ldf(FloatRegisterImpl::D, from, 0, F48);
+    __ ldf(FloatRegisterImpl::D, from, 8, F50);
+    __ ldf(FloatRegisterImpl::D, from, 16, F60);
+    __ ldf(FloatRegisterImpl::D, from, 24, F62);
+    __ ldf(FloatRegisterImpl::D, from, 32, F52);
+    __ faligndata(F48, F50, F48);
+    __ faligndata(F50, F60, F50);
+    __ faligndata(F60, F62, F60);
+    __ faligndata(F62, F52, F62);
+    __ movdtox(F48, G4);
+    __ movdtox(F50, G5);
+    __ movdtox(F60, L4);
+    __ movdtox(F62, L5);
+    __ mov(G1, from);
+
+    __ BIND(L_transform_next2_blocks192);
+    // F48:F50 used for first 16-bytes
     __ xor3(L2,G4,G1);
     __ movxtod(G1,F48);
     __ xor3(L3,G5,G1);
     __ movxtod(G1,F50);
 
     // F60:F62 used for next 16-bytes
-    __ ldx(from,16,L4);
-    __ ldx(from,24,L5);
     __ xor3(L2,L4,G1);
     __ movxtod(G1,F60);
     __ xor3(L3,L5,G1);
@@ -3955,9 +4379,6 @@
     __ fxor(FloatRegisterImpl::D, F54, F48, F48);
     __ fxor(FloatRegisterImpl::D, F52, F50, F50);
 
-    __ stf(FloatRegisterImpl::D, F48, to, 0);
-    __ stf(FloatRegisterImpl::D, F50, to, 8);
-
     __ movxtod(G4,F56);
     __ movxtod(G5,F58);
     __ mov(L4,L0);
@@ -3965,32 +4386,87 @@
     __ fxor(FloatRegisterImpl::D, F56, F60, F60);
     __ fxor(FloatRegisterImpl::D, F58, F62, F62);
 
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, G1);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_next2_blocks192);
+    __ delayed()->edge8n(to, G0, G2);
+
+    // aligned case: store output into the destination array
+    __ stf(FloatRegisterImpl::D, F48, to, 0);
+    __ stf(FloatRegisterImpl::D, F50, to, 8);
     __ stf(FloatRegisterImpl::D, F60, to, 16);
     __ stf(FloatRegisterImpl::D, F62, to, 24);
-
+    __ ba_short(L_check_decrypt_loop_end192);
+
+    __ BIND(L_store_misaligned_output_next2_blocks192);
+    __ mov(8, G4);
+    __ sub(G4, G1, G4);
+    __ alignaddr(G4, G0, G4);
+    __ faligndata(F48, F50, F56); // F56 can be clobbered
+    __ faligndata(F50, F60, F50);
+    __ faligndata(F60, F62, F60);
+    __ faligndata(F62, F48, F48);
+    __ mov(to, G1);
+    __ and3(to, -8, to);
+    __ stpartialf(to, G2, F48, Assembler::ASI_PST8_PRIMARY);
+    __ stf(FloatRegisterImpl::D, F56, to, 8);
+    __ stf(FloatRegisterImpl::D, F50, to, 16);
+    __ stf(FloatRegisterImpl::D, F60, to, 24);
+    __ add(to, 32, to);
+    __ orn(G0, G2, G2);
+    __ stpartialf(to, G2, F48, Assembler::ASI_PST8_PRIMARY);
+    __ mov(G1, to);
+
+    __ BIND(L_check_decrypt_loop_end192);
     __ add(from, 32, from);
     __ add(to, 32, to);
     __ subcc(len_reg, 32, len_reg);
     __ br(Assembler::notEqual, false, Assembler::pt, L_dec_next2_blocks192);
     __ delayed()->nop();
-    __ br(Assembler::always, false, Assembler::pt, L_cbcdec_end);
-    __ delayed()->nop();
+    __ ba_short(L_cbcdec_end);
 
     __ align(OptoLoopAlignment);
     __ BIND(L_dec_next2_blocks256);
     __ nop();
 
-    // F0:F2 used for first 16-bytes
+    // check for 8-byte alignment since source byte array may have an arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(from, 7, G0);
+    __ br(Assembler::notZero, true, Assembler::pn, L_load_misaligned_next2_blocks256);
+    __ delayed()->mov(from, G1); // save original 'from' address before alignaddr
+
+    // aligned case: load input into G4, G5, L4 and L5
     __ ldx(from,0,G4);
     __ ldx(from,8,G5);
+    __ ldx(from,16,L4);
+    __ ldx(from,24,L5);
+    __ ba_short(L_transform_next2_blocks256);
+
+    __ BIND(L_load_misaligned_next2_blocks256);
+    __ alignaddr(from, G0, from);
+    // F0, F2, F4, F60, F62 can be clobbered
+    __ ldf(FloatRegisterImpl::D, from, 0, F0);
+    __ ldf(FloatRegisterImpl::D, from, 8, F2);
+    __ ldf(FloatRegisterImpl::D, from, 16, F60);
+    __ ldf(FloatRegisterImpl::D, from, 24, F62);
+    __ ldf(FloatRegisterImpl::D, from, 32, F4);
+    __ faligndata(F0, F2, F0);
+    __ faligndata(F2, F60, F2);
+    __ faligndata(F60, F62, F60);
+    __ faligndata(F62, F4, F62);
+    __ movdtox(F0, G4);
+    __ movdtox(F2, G5);
+    __ movdtox(F60, L4);
+    __ movdtox(F62, L5);
+    __ mov(G1, from);
+
+    __ BIND(L_transform_next2_blocks256);
+    // F0:F2 used for first 16-bytes
     __ xor3(L2,G4,G1);
     __ movxtod(G1,F0);
     __ xor3(L3,G5,G1);
     __ movxtod(G1,F2);
 
     // F60:F62 used for next 16-bytes
-    __ ldx(from,16,L4);
-    __ ldx(from,24,L5);
     __ xor3(L2,L4,G1);
     __ movxtod(G1,F60);
     __ xor3(L3,L5,G1);
@@ -4043,9 +4519,6 @@
     __ fxor(FloatRegisterImpl::D, F6, F0, F0);
     __ fxor(FloatRegisterImpl::D, F4, F2, F2);
 
-    __ stf(FloatRegisterImpl::D, F0, to, 0);
-    __ stf(FloatRegisterImpl::D, F2, to, 8);
-
     __ movxtod(G4,F56);
     __ movxtod(G5,F58);
     __ mov(L4,L0);
@@ -4053,9 +4526,38 @@
     __ fxor(FloatRegisterImpl::D, F56, F60, F60);
     __ fxor(FloatRegisterImpl::D, F58, F62, F62);
 
+    // check for 8-byte alignment since dest byte array may have arbitrary alignment if offset mod 8 is non-zero
+    __ andcc(to, 7, G1);
+    __ br(Assembler::notZero, true, Assembler::pn, L_store_misaligned_output_next2_blocks256);
+    __ delayed()->edge8n(to, G0, G2);
+
+    // aligned case: store output into the destination array
+    __ stf(FloatRegisterImpl::D, F0, to, 0);
+    __ stf(FloatRegisterImpl::D, F2, to, 8);
     __ stf(FloatRegisterImpl::D, F60, to, 16);
     __ stf(FloatRegisterImpl::D, F62, to, 24);
-
+    __ ba_short(L_check_decrypt_loop_end256);
+
+    __ BIND(L_store_misaligned_output_next2_blocks256);
+    __ mov(8, G4);
+    __ sub(G4, G1, G4);
+    __ alignaddr(G4, G0, G4);
+    __ faligndata(F0, F2, F56); // F56 can be clobbered
+    __ faligndata(F2, F60, F2);
+    __ faligndata(F60, F62, F60);
+    __ faligndata(F62, F0, F0);
+    __ mov(to, G1);
+    __ and3(to, -8, to);
+    __ stpartialf(to, G2, F0, Assembler::ASI_PST8_PRIMARY);
+    __ stf(FloatRegisterImpl::D, F56, to, 8);
+    __ stf(FloatRegisterImpl::D, F2, to, 16);
+    __ stf(FloatRegisterImpl::D, F60, to, 24);
+    __ add(to, 32, to);
+    __ orn(G0, G2, G2);
+    __ stpartialf(to, G2, F0, Assembler::ASI_PST8_PRIMARY);
+    __ mov(G1, to);
+
+    __ BIND(L_check_decrypt_loop_end256);
     __ add(from, 32, from);
     __ add(to, 32, to);
     __ subcc(len_reg, 32, len_reg);
@@ -4063,12 +4565,12 @@
     __ delayed()->nop();
 
     __ BIND(L_cbcdec_end);
+    // re-init intial vector for next block, 8-byte alignment is guaranteed
     __ stx(L0, rvec, 0);
     __ stx(L1, rvec, 8);
-    __ restore();
-    __ mov(L0, O0);
-    __ retl();
-    __ delayed()->nop();
+    __ mov(L7, I0);
+    __ ret();
+    __ delayed()->restore();
 
     return start;
   }
--- a/src/cpu/sparc/vm/stubRoutines_sparc.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/stubRoutines_sparc.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -41,7 +41,7 @@
 enum /* platform_dependent_constants */ {
   // %%%%%%%% May be able to shrink this a lot
   code_size1 = 20000,           // simply increase if too small (assembler will crash if too small)
-  code_size2 = 20000            // simply increase if too small (assembler will crash if too small)
+  code_size2 = 22000            // simply increase if too small (assembler will crash if too small)
 };
 
 class Sparc {
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1888,7 +1888,7 @@
   }
 
 #if INCLUDE_JVMTI
-  if (EnableInvokeDynamic) {
+  {
     Label L_done;
 
     __ ldub(Address(Lbcp, 0), G1_scratch);  // Load current bytecode
--- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -3209,12 +3209,6 @@
   transition(vtos, vtos);
   assert(byte_no == f1_byte, "use this argument");
 
-  if (!EnableInvokeDynamic) {
-    // rewriter does not generate this bytecode
-    __ should_not_reach_here();
-    return;
-  }
-
   const Register Rret       = Lscratch;
   const Register G4_mtype   = G4_scratch;
   const Register O0_recv    = O0;
@@ -3240,17 +3234,6 @@
   transition(vtos, vtos);
   assert(byte_no == f1_byte, "use this argument");
 
-  if (!EnableInvokeDynamic) {
-    // We should not encounter this bytecode if !EnableInvokeDynamic.
-    // The verifier will stop it.  However, if we get past the verifier,
-    // this will stop the thread in a reasonable way, without crashing the JVM.
-    __ call_VM(noreg, CAST_FROM_FN_PTR(address,
-                     InterpreterRuntime::throw_IncompatibleClassChangeError));
-    // the call_VM checks for exception, so we should never return here.
-    __ should_not_reach_here();
-    return;
-  }
-
   const Register Rret        = Lscratch;
   const Register G4_callsite = G4_scratch;
   const Register Rscratch    = G3_scratch;
--- a/src/cpu/sparc/vm/vm_version_sparc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/sparc/vm/vm_version_sparc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -266,9 +266,9 @@
   if (!has_vis1()) // Drop to 0 if no VIS1 support
     UseVIS = 0;
 
-  // T2 and above should have support for AES instructions
+  // SPARC T4 and above should have support for AES instructions
   if (has_aes()) {
-    if (UseVIS > 0) { // AES intrinsics use FXOR instruction which is VIS1
+    if (UseVIS > 2) { // AES intrinsics use MOVxTOd/MOVdTOx which are VIS3
       if (FLAG_IS_DEFAULT(UseAES)) {
         FLAG_SET_DEFAULT(UseAES, true);
       }
@@ -282,7 +282,7 @@
       }
     } else {
         if (UseAES || UseAESIntrinsics) {
-          warning("SPARC AES intrinsics require VIS1 instruction support. Intrinsics will be disabled.");
+          warning("SPARC AES intrinsics require VIS3 instruction support. Intrinsics will be disabled.");
           if (UseAES) {
             FLAG_SET_DEFAULT(UseAES, false);
           }
@@ -318,22 +318,22 @@
           tty->print("BIS");
       }
       if (AllocatePrefetchLines > 1) {
-        tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
       } else {
-        tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
       }
     }
     if (PrefetchCopyIntervalInBytes > 0) {
-      tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes);
+      tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
     }
     if (PrefetchScanIntervalInBytes > 0) {
-      tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes);
+      tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
     }
     if (PrefetchFieldsAhead > 0) {
-      tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
+      tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
     }
     if (ContendedPaddingWidth > 0) {
-      tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth);
+      tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
     }
   }
 #endif // PRODUCT
--- a/src/cpu/x86/vm/assembler_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/assembler_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -522,11 +522,11 @@
     // these asserts are somewhat nonsensical
 #ifndef _LP64
     assert(which == imm_operand || which == disp32_operand,
-           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip));
+           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)));
 #else
     assert((which == call32_operand || which == imm_operand) && is_64bit ||
            which == narrow_oop_operand && !is_64bit,
-           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, ip));
+           err_msg("which %d is_64_bit %d ip " INTPTR_FORMAT, which, is_64bit, p2i(ip)));
 #endif // _LP64
     return ip;
 
@@ -1766,7 +1766,7 @@
 
 // Move Unaligned 256bit Vector
 void Assembler::vmovdqu(XMMRegister dst, XMMRegister src) {
-  assert(UseAVX, "");
+  assert(UseAVX > 0, "");
   bool vector256 = true;
   int encode = vex_prefix_and_encode(dst, xnoreg, src, VEX_SIMD_F3, vector256);
   emit_int8(0x6F);
@@ -1774,7 +1774,7 @@
 }
 
 void Assembler::vmovdqu(XMMRegister dst, Address src) {
-  assert(UseAVX, "");
+  assert(UseAVX > 0, "");
   InstructionMark im(this);
   bool vector256 = true;
   vex_prefix(dst, xnoreg, src, VEX_SIMD_F3, vector256);
@@ -1783,7 +1783,7 @@
 }
 
 void Assembler::vmovdqu(Address dst, XMMRegister src) {
-  assert(UseAVX, "");
+  assert(UseAVX > 0, "");
   InstructionMark im(this);
   bool vector256 = true;
   // swap src<->dst for encoding
--- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -430,6 +430,7 @@
 
 void DeoptimizeStub::emit_code(LIR_Assembler* ce) {
   __ bind(_entry);
+  ce->store_parameter(_trap_request, 0);
   __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::deoptimize_id)));
   ce->add_call_info_here(_info);
   DEBUG_ONLY(__ should_not_reach_here());
--- a/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@
 
 #ifndef PRODUCT
         if (TraceFPURegisterUsage) {
-          tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->print_cr("");
+          tty->print("FPU regs for block %d, LIR instr %d): ", b->block_id(), id); regs.print_on(tty); tty->cr();
         }
 #endif
       }
--- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1468,9 +1468,10 @@
     case deoptimize_id:
       {
         StubFrame f(sasm, "deoptimize", dont_gc_arguments);
-        const int num_rt_args = 1;  // thread
+        const int num_rt_args = 2;  // thread, trap_request
         OopMap* oop_map = save_live_registers(sasm, num_rt_args);
-        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize));
+        f.load_argument(0, rax);
+        int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, deoptimize), rax);
         oop_maps = new OopMapSet();
         oop_maps->add_gc_map(call_offset, oop_map);
         restore_live_registers(sasm);
--- a/src/cpu/x86/vm/c1_globals_x86.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/c1_globals_x86.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -41,7 +41,6 @@
 define_pd_global(bool, UseOnStackReplacement,        true );
 define_pd_global(bool, TieredCompilation,            false);
 define_pd_global(intx, CompileThreshold,             1500 );
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     933  );
 define_pd_global(intx, FreqInlineSize,               325  );
--- a/src/cpu/x86/vm/c2_globals_x86.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/c2_globals_x86.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -45,7 +45,6 @@
 #endif // CC_INTERP
 define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
-define_pd_global(intx, BackEdgeThreshold,            100000);
 
 define_pd_global(intx, OnStackReplacePercentage,     140);
 define_pd_global(intx, ConditionalMoveLimit,         3);
--- a/src/cpu/x86/vm/compiledIC_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/compiledIC_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -122,7 +122,7 @@
   if (TraceICs) {
     ResourceMark rm;
     tty->print_cr("CompiledStaticCall@" INTPTR_FORMAT ": set_to_interpreted %s",
-                  instruction_address(),
+                  p2i(instruction_address()),
                   callee->name_and_sig_as_C_string());
   }
 
--- a/src/cpu/x86/vm/frame_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/frame_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,7 @@
 }
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 // Profiling/safepoint support
 
--- a/src/cpu/x86/vm/interp_masm_x86_32.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -207,7 +207,6 @@
   if (index_size == sizeof(u2)) {
     load_unsigned_short(reg, Address(rsi, bcp_offset));
   } else if (index_size == sizeof(u4)) {
-    assert(EnableInvokeDynamic, "giant index used only for JSR 292");
     movl(reg, Address(rsi, bcp_offset));
     // Check if the secondary index definition is still ~x, otherwise
     // we have to change the following assembler code to calculate the
--- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -205,7 +205,6 @@
   if (index_size == sizeof(u2)) {
     load_unsigned_short(index, Address(r13, bcp_offset));
   } else if (index_size == sizeof(u4)) {
-    assert(EnableInvokeDynamic, "giant index used only for JSR 292");
     movl(index, Address(r13, bcp_offset));
     // Check if the secondary index definition is still ~x, otherwise
     // we have to change the following assembler code to calculate the
--- a/src/cpu/x86/vm/interpreter_x86_64.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/interpreter_x86_64.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@
 
 #define __ _masm->
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 #ifdef _WIN64
 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
--- a/src/cpu/x86/vm/jni_x86.h	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/jni_x86.h	Tue Jun 03 14:55:50 2014 +0200
@@ -26,8 +26,14 @@
 #ifndef _JAVASOFT_JNI_MD_H_
 #define _JAVASOFT_JNI_MD_H_
 
-#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)
+#if defined(_WIN32)
+  #define JNIEXPORT __declspec(dllexport)
+  #define JNIIMPORT __declspec(dllimport)
+  #define JNICALL __stdcall
 
+  typedef int jint;
+  typedef __int64 jlong;
+#else
 
 // Note: please do not change these without also changing jni_md.h in the JDK
 // repository
@@ -50,13 +56,6 @@
   typedef long long jlong;
 #endif
 
-#else
-  #define JNIEXPORT __declspec(dllexport)
-  #define JNIIMPORT __declspec(dllimport)
-  #define JNICALL __stdcall
-
-  typedef int jint;
-  typedef __int64 jlong;
 #endif
 
 typedef signed char jbyte;
--- a/src/cpu/x86/vm/macroAssembler_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/macroAssembler_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,7 @@
 
 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 #ifdef ASSERT
 bool AbstractAssembler::pd_check_instruction_mark() { return true; }
@@ -3152,10 +3153,12 @@
   // if fast computation is not possible, result is NaN. Requires
   // fallback from user of this macro.
   // increase precision for intermediate steps of the computation
+  BLOCK_COMMENT("fast_pow {");
   increase_precision();
   fyl2x();                 // Stack: (Y*log2(X)) ...
   pow_exp_core_encoding(); // Stack: exp(X) ...
   restore_precision();
+  BLOCK_COMMENT("} fast_pow");
 }
 
 void MacroAssembler::fast_exp() {
--- a/src/cpu/x86/vm/methodHandles_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/methodHandles_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 #include "memory/allocation.inline.hpp"
 #include "prims/methodHandles.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define __ _masm->
 
 #ifdef PRODUCT
--- a/src/cpu/x86/vm/nativeInst_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/nativeInst_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 void NativeInstruction::wrote(int offset) {
   ICache::invalidate_word(addr_at(offset));
 }
--- a/src/cpu/x86/vm/templateInterpreter_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/templateInterpreter_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -76,12 +76,7 @@
     Interpreter::stackElementWords;
 
 #ifdef ASSERT
-  if (!EnableInvokeDynamic) {
-    // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
-    // Probably, since deoptimization doesn't work yet.
-    assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
-  }
-  assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)");
+  assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable");
 #endif
 
   interpreter_frame->interpreter_frame_set_method(method);
--- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1831,7 +1831,7 @@
   __ movl(Address(thread, JavaThread::popframe_condition_offset()), JavaThread::popframe_inactive);
 
 #if INCLUDE_JVMTI
-  if (EnableInvokeDynamic) {
+  {
     Label L_done;
     const Register local0 = rdi;
 
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1848,7 +1848,7 @@
           JavaThread::popframe_inactive);
 
 #if INCLUDE_JVMTI
-  if (EnableInvokeDynamic) {
+  {
     Label L_done;
     const Register local0 = r14;
 
--- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -3128,12 +3128,6 @@
   const Register rcx_recv   = rcx;
   const Register rdx_flags  = rdx;
 
-  if (!EnableInvokeDynamic) {
-    // rewriter does not generate this bytecode
-    __ should_not_reach_here();
-    return;
-  }
-
   prepare_invoke(byte_no, rbx_method, rax_mtype, rcx_recv);
   __ verify_method_ptr(rbx_method);
   __ verify_oop(rcx_recv);
@@ -3156,17 +3150,6 @@
   transition(vtos, vtos);
   assert(byte_no == f1_byte, "use this argument");
 
-  if (!EnableInvokeDynamic) {
-    // We should not encounter this bytecode if !EnableInvokeDynamic.
-    // The verifier will stop it.  However, if we get past the verifier,
-    // this will stop the thread in a reasonable way, without crashing the JVM.
-    __ call_VM(noreg, CAST_FROM_FN_PTR(address,
-                     InterpreterRuntime::throw_IncompatibleClassChangeError));
-    // the call_VM checks for exception, so we should never return here.
-    __ should_not_reach_here();
-    return;
-  }
-
   const Register rbx_method   = rbx;
   const Register rax_callsite = rax;
 
--- a/src/cpu/x86/vm/templateTable_x86_64.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/templateTable_x86_64.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -3179,12 +3179,6 @@
   const Register rcx_recv   = rcx;
   const Register rdx_flags  = rdx;
 
-  if (!EnableInvokeDynamic) {
-    // rewriter does not generate this bytecode
-    __ should_not_reach_here();
-    return;
-  }
-
   prepare_invoke(byte_no, rbx_method, rax_mtype, rcx_recv);
   __ verify_method_ptr(rbx_method);
   __ verify_oop(rcx_recv);
@@ -3207,17 +3201,6 @@
   transition(vtos, vtos);
   assert(byte_no == f1_byte, "use this argument");
 
-  if (!EnableInvokeDynamic) {
-    // We should not encounter this bytecode if !EnableInvokeDynamic.
-    // The verifier will stop it.  However, if we get past the verifier,
-    // this will stop the thread in a reasonable way, without crashing the JVM.
-    __ call_VM(noreg, CAST_FROM_FN_PTR(address,
-                     InterpreterRuntime::throw_IncompatibleClassChangeError));
-    // the call_VM checks for exception, so we should never return here.
-    __ should_not_reach_here();
-    return;
-  }
-
   const Register rbx_method   = rbx;
   const Register rax_callsite = rax;
 
--- a/src/cpu/x86/vm/vm_version_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/vm_version_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -263,6 +263,10 @@
     // and check upper YMM bits after it.
     //
     VM_Version::set_avx_cpuFeatures(); // Enable temporary to pass asserts
+    intx saved_useavx = UseAVX;
+    intx saved_usesse = UseSSE;
+    UseAVX = 1;
+    UseSSE = 2;
 
     // load value into all 32 bytes of ymm7 register
     __ movl(rcx, VM_Version::ymm_test_value());
@@ -292,6 +296,8 @@
 #endif
 
     VM_Version::clean_cpuFeatures();
+    UseAVX = saved_useavx;
+    UseSSE = saved_usesse;
 
     //
     // cpuid(0x7) Structured Extended Features
@@ -919,16 +925,16 @@
   if (PrintMiscellaneous && Verbose) {
     tty->print_cr("Logical CPUs per core: %u",
                   logical_processors_per_package());
-    tty->print("UseSSE=%d",UseSSE);
+    tty->print("UseSSE=%d", (int) UseSSE);
     if (UseAVX > 0) {
-      tty->print("  UseAVX=%d",UseAVX);
+      tty->print("  UseAVX=%d", (int) UseAVX);
     }
     if (UseAES) {
       tty->print("  UseAES=1");
     }
 #ifdef COMPILER2
     if (MaxVectorSize > 0) {
-      tty->print("  MaxVectorSize=%d", MaxVectorSize);
+      tty->print("  MaxVectorSize=%d", (int) MaxVectorSize);
     }
 #endif
     tty->cr();
@@ -951,23 +957,23 @@
         }
       }
       if (AllocatePrefetchLines > 1) {
-        tty->print_cr(" at distance %d, %d lines of %d bytes", AllocatePrefetchDistance, AllocatePrefetchLines, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, %d lines of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchLines, (int) AllocatePrefetchStepSize);
       } else {
-        tty->print_cr(" at distance %d, one line of %d bytes", AllocatePrefetchDistance, AllocatePrefetchStepSize);
+        tty->print_cr(" at distance %d, one line of %d bytes", (int) AllocatePrefetchDistance, (int) AllocatePrefetchStepSize);
       }
     }
 
     if (PrefetchCopyIntervalInBytes > 0) {
-      tty->print_cr("PrefetchCopyIntervalInBytes %d", PrefetchCopyIntervalInBytes);
+      tty->print_cr("PrefetchCopyIntervalInBytes %d", (int) PrefetchCopyIntervalInBytes);
     }
     if (PrefetchScanIntervalInBytes > 0) {
-      tty->print_cr("PrefetchScanIntervalInBytes %d", PrefetchScanIntervalInBytes);
+      tty->print_cr("PrefetchScanIntervalInBytes %d", (int) PrefetchScanIntervalInBytes);
     }
     if (PrefetchFieldsAhead > 0) {
-      tty->print_cr("PrefetchFieldsAhead %d", PrefetchFieldsAhead);
+      tty->print_cr("PrefetchFieldsAhead %d", (int) PrefetchFieldsAhead);
     }
     if (ContendedPaddingWidth > 0) {
-      tty->print_cr("ContendedPaddingWidth %d", ContendedPaddingWidth);
+      tty->print_cr("ContendedPaddingWidth %d", (int) ContendedPaddingWidth);
     }
   }
 #endif // !PRODUCT
--- a/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/vtableStubs_x86_32.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,7 +118,7 @@
 
   if (PrintMiscellaneous && (WizardMode || Verbose)) {
     tty->print_cr("vtable #%d at "PTR_FORMAT"[%d] left over: %d",
-                  vtable_index, s->entry_point(),
+                  vtable_index, p2i(s->entry_point()),
                   (int)(s->code_end() - s->entry_point()),
                   (int)(s->code_end() - __ pc()));
   }
@@ -199,7 +199,7 @@
 
   if (PrintMiscellaneous && (WizardMode || Verbose)) {
     tty->print_cr("itable #%d at "PTR_FORMAT"[%d] left over: %d",
-                  itable_index, s->entry_point(),
+                  itable_index, p2i(s->entry_point()),
                   (int)(s->code_end() - s->entry_point()),
                   (int)(s->code_end() - __ pc()));
   }
--- a/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/x86/vm/vtableStubs_x86_64.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 #include "opto/runtime.hpp"
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // machine-dependent part of VtableStubs: create VtableStub of correct size and
 // initialize its code
 
--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -40,6 +40,7 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/synchronizer.hpp"
--- a/src/cpu/zero/vm/shark_globals_zero.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/cpu/zero/vm/shark_globals_zero.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -43,7 +43,6 @@
 define_pd_global(intx,     Tier3CompileThreshold,        2500);
 define_pd_global(intx,     Tier4CompileThreshold,        4500);
 
-define_pd_global(intx,     BackEdgeThreshold,            100000);
 define_pd_global(intx,     Tier2BackEdgeThreshold,       100000);
 define_pd_global(intx,     Tier3BackEdgeThreshold,       100000);
 define_pd_global(intx,     Tier4BackEdgeThreshold,       100000);
--- a/src/os/aix/vm/os_aix.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/aix/vm/os_aix.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -55,6 +55,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/sharedRuntime.hpp"
@@ -1870,7 +1871,7 @@
 // properties.
 
 // ShmBkBlock: base class for all blocks in the shared memory bookkeeping
-class ShmBkBlock {
+class ShmBkBlock : public CHeapObj<mtInternal> {
 
   ShmBkBlock* _next;
 
--- a/src/os/aix/vm/os_aix.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/aix/vm/os_aix.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,12 +26,9 @@
 #ifndef OS_AIX_VM_OS_AIX_INLINE_HPP
 #define OS_AIX_VM_OS_AIX_INLINE_HPP
 
-#include "runtime/atomic.hpp"
+#include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
-#ifdef TARGET_OS_ARCH_aix_ppc
-# include "atomic_aix_ppc.inline.hpp"
-# include "orderAccess_aix_ppc.inline.hpp"
-#endif
 
 // System includes
 
--- a/src/os/aix/vm/porting_aix.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/aix/vm/porting_aix.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "asm/assembler.hpp"
+#include "memory/allocation.hpp"
 #include "loadlib_aix.hpp"
 #include "porting_aix.hpp"
 #include "utilities/debug.hpp"
@@ -67,7 +68,7 @@
 // a primitive string map. Should this turn out to be a performance
 // problem, a better hashmap has to be used.
 class fixed_strings {
-  struct node {
+  struct node : public CHeapObj<mtInternal> {
     char* v;
     node* next;
   };
--- a/src/os/aix/vm/thread_aix.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/aix/vm/thread_aix.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,15 +26,9 @@
 #ifndef OS_AIX_VM_THREAD_AIX_INLINE_HPP
 #define OS_AIX_VM_THREAD_AIX_INLINE_HPP
 
-#include "runtime/atomic.hpp"
-#include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
 
-#include "atomic_aix_ppc.inline.hpp"
-#include "orderAccess_aix_ppc.inline.hpp"
-#include "prefetch_aix_ppc.inline.hpp"
-
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
 inline void ThreadLocalStorage::pd_invalidate_all() {} // nothing to do
--- a/src/os/bsd/vm/decoder_machO.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/bsd/vm/decoder_machO.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
   struct symtab_command * symt = (struct symtab_command *)
     mach_find_command((struct mach_header_64 *)mach_base, LC_SYMTAB);
   if (symt == NULL) {
-    DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", mach_base));
+    DEBUG_ONLY(tty->print_cr("no symtab in mach file at 0x%lx", p2i(mach_base)));
     return false;
   }
   uint32_t off = symt->symoff;          /* symbol table offset (within this mach file) */
--- a/src/os/bsd/vm/os_bsd.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/bsd/vm/os_bsd.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -48,6 +48,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/sharedRuntime.hpp"
@@ -123,6 +124,9 @@
 #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
 
 #define LARGEPAGES_BIT (1 << 6)
+
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 ////////////////////////////////////////////////////////////////////////////////
 // global variables
 julong os::Bsd::_physical_memory = 0;
@@ -2393,7 +2397,6 @@
                         (!FLAG_IS_DEFAULT(UseLargePages) ||
                          !FLAG_IS_DEFAULT(LargePageSizeInBytes)
                         );
-  char msg[128];
 
   // Create a large shared memory region to attach to based on size.
   // Currently, size is the total size of the heap
@@ -2414,8 +2417,7 @@
      //            coalesce into large pages. Try to reserve large pages when
      //            the system is still "fresh".
      if (warn_on_failure) {
-       jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
-       warning(msg);
+       warning("Failed to reserve shared memory (errno = %d).", errno);
      }
      return NULL;
   }
@@ -2432,8 +2434,7 @@
 
   if ((intptr_t)addr == -1) {
      if (warn_on_failure) {
-       jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
-       warning(msg);
+       warning("Failed to attach shared memory (errno = %d).", err);
      }
      return NULL;
   }
@@ -3809,6 +3810,7 @@
   return true;
 }
 
+ATTRIBUTE_PRINTF(3, 0)
 int local_vsnprintf(char* buf, size_t count, const char* format, va_list args) {
   return ::vsnprintf(buf, count, format, args);
 }
--- a/src/os/bsd/vm/os_bsd.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/bsd/vm/os_bsd.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,15 +26,9 @@
 #define OS_BSD_VM_OS_BSD_INLINE_HPP
 
 #include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "orderAccess_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "orderAccess_bsd_zero.inline.hpp"
-#endif
-
 // System includes
 
 #include <unistd.h>
--- a/src/os/bsd/vm/perfMemory_bsd.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/bsd/vm/perfMemory_bsd.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -925,7 +925,7 @@
 
   if (PerfTraceMemOps) {
     tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
+               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
   }
 }
 
--- a/src/os/bsd/vm/thread_bsd.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/bsd/vm/thread_bsd.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -29,20 +29,8 @@
 #error "This file should only be included from thread.inline.hpp"
 #endif
 
-#include "runtime/atomic.hpp"
-#include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#ifdef TARGET_OS_ARCH_bsd_x86
-# include "atomic_bsd_x86.inline.hpp"
-# include "orderAccess_bsd_x86.inline.hpp"
-# include "prefetch_bsd_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_bsd_zero
-# include "atomic_bsd_zero.inline.hpp"
-# include "orderAccess_bsd_zero.inline.hpp"
-# include "prefetch_bsd_zero.inline.hpp"
-#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/src/os/linux/vm/os_linux.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/linux/vm/os_linux.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -49,6 +49,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/sharedRuntime.hpp"
@@ -101,6 +102,8 @@
 # include <inttypes.h>
 # include <sys/ioctl.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // if RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling
 // getrusage() is prepared to handle the associated failure.
 #ifndef RUSAGE_THREAD
@@ -2137,7 +2140,7 @@
   // Print warning if unsafe chroot environment detected
   if (unsafe_chroot_detected) {
     st->print("WARNING!! ");
-    st->print_cr(unstable_chroot_error);
+    st->print_cr("%s", unstable_chroot_error);
   }
 
   os::Linux::print_libversion_info(st);
@@ -2198,8 +2201,8 @@
 void os::Linux::print_libversion_info(outputStream* st) {
   // libc, pthread
   st->print("libc:");
-  st->print(os::Linux::glibc_version()); st->print(" ");
-  st->print(os::Linux::libpthread_version()); st->print(" ");
+  st->print("%s ", os::Linux::glibc_version());
+  st->print("%s ", os::Linux::libpthread_version());
   if (os::Linux::is_LinuxThreads()) {
      st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed");
   }
@@ -3416,7 +3419,7 @@
      //            the system is still "fresh".
      if (warn_on_failure) {
        jio_snprintf(msg, sizeof(msg), "Failed to reserve shared memory (errno = %d).", errno);
-       warning(msg);
+       warning("%s", msg);
      }
      return NULL;
   }
@@ -3434,7 +3437,7 @@
   if ((intptr_t)addr == -1) {
      if (warn_on_failure) {
        jio_snprintf(msg, sizeof(msg), "Failed to attach shared memory (errno = %d).", err);
-       warning(msg);
+       warning("%s", msg);
      }
      return NULL;
   }
@@ -3454,7 +3457,7 @@
     char msg[128];
     jio_snprintf(msg, sizeof(msg), "Failed to reserve large pages memory req_addr: "
         PTR_FORMAT " bytes: " SIZE_FORMAT " (errno = %d).", req_addr, bytes, error);
-    warning(msg);
+    warning("%s", msg);
   }
 }
 
@@ -5271,7 +5274,6 @@
 //
 
 static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) {
-  static bool proc_task_unchecked = true;
   pid_t  tid = thread->osthread()->thread_id();
   char *s;
   char stat[2048];
@@ -5284,24 +5286,7 @@
   long ldummy;
   FILE *fp;
 
-  snprintf(proc_name, 64, "/proc/%d/stat", tid);
-
-  // The /proc/<tid>/stat aggregates per-process usage on
-  // new Linux kernels 2.6+ where NPTL is supported.
-  // The /proc/self/task/<tid>/stat still has the per-thread usage.
-  // See bug 6328462.
-  // There possibly can be cases where there is no directory
-  // /proc/self/task, so we check its availability.
-  if (proc_task_unchecked && os::Linux::is_NPTL()) {
-    // This is executed only once
-    proc_task_unchecked = false;
-    fp = fopen("/proc/self/task", "r");
-    if (fp != NULL) {
-      snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid);
-      fclose(fp);
-    }
-  }
-
+  snprintf(proc_name, 64, "/proc/self/task/%d/stat", tid);
   fp = fopen(proc_name, "r");
   if ( fp == NULL ) return -1;
   statlen = fread(stat, 1, 2047, fp);
--- a/src/os/linux/vm/os_linux.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/linux/vm/os_linux.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,24 +26,9 @@
 #define OS_LINUX_VM_OS_LINUX_INLINE_HPP
 
 #include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "orderAccess_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "orderAccess_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "orderAccess_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "orderAccess_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "orderAccess_linux_ppc.inline.hpp"
-#endif
-
 // System includes
 
 #include <unistd.h>
--- a/src/os/linux/vm/perfMemory_linux.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/linux/vm/perfMemory_linux.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -931,7 +931,7 @@
 
   if (PerfTraceMemOps) {
     tty->print("mapped " SIZE_FORMAT " bytes for vmid %d at "
-               INTPTR_FORMAT "\n", size, vmid, (void*)mapAddress);
+               INTPTR_FORMAT "\n", size, vmid, p2i((void*)mapAddress));
   }
 }
 
--- a/src/os/linux/vm/thread_linux.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/linux/vm/thread_linux.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -29,35 +29,8 @@
 #error "This file should only be included from thread.inline.hpp"
 #endif
 
-#include "runtime/atomic.hpp"
-#include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#ifdef TARGET_OS_ARCH_linux_x86
-# include "atomic_linux_x86.inline.hpp"
-# include "orderAccess_linux_x86.inline.hpp"
-# include "prefetch_linux_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_sparc
-# include "atomic_linux_sparc.inline.hpp"
-# include "orderAccess_linux_sparc.inline.hpp"
-# include "prefetch_linux_sparc.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_zero
-# include "atomic_linux_zero.inline.hpp"
-# include "orderAccess_linux_zero.inline.hpp"
-# include "prefetch_linux_zero.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_arm
-# include "atomic_linux_arm.inline.hpp"
-# include "orderAccess_linux_arm.inline.hpp"
-# include "prefetch_linux_arm.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_linux_ppc
-# include "atomic_linux_ppc.inline.hpp"
-# include "orderAccess_linux_ppc.inline.hpp"
-# include "prefetch_linux_ppc.inline.hpp"
-#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/src/os/posix/vm/os_posix.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/posix/vm/os_posix.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -36,6 +36,8 @@
 #include <pthread.h>
 #include <signal.h>
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 // Todo: provide a os::get_max_process_id() or similar. Number of processes
 // may have been configured, can be read more accurately from proc fs etc.
 #ifndef MAX_PID
@@ -192,10 +194,10 @@
   st->print("uname:");
   struct utsname name;
   uname(&name);
-  st->print(name.sysname); st->print(" ");
-  st->print(name.release); st->print(" ");
-  st->print(name.version); st->print(" ");
-  st->print(name.machine);
+  st->print("%s ", name.sysname);
+  st->print("%s ", name.release);
+  st->print("%s ", name.version);
+  st->print("%s", name.machine);
   st->cr();
 }
 
@@ -682,7 +684,7 @@
 void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set) {
   char buf[NUM_IMPORTANT_SIGS + 1];
   os::Posix::describe_signal_set_short(set, buf, sizeof(buf));
-  st->print(buf);
+  st->print("%s", buf);
 }
 
 // Writes one-line description of a combination of sigaction.sa_flags into a user
@@ -742,7 +744,7 @@
 void os::Posix::print_sa_flags(outputStream* st, int flags) {
   char buffer[0x100];
   os::Posix::describe_sa_flags(flags, buffer, sizeof(buffer));
-  st->print(buffer);
+  st->print("%s", buffer);
 }
 
 // Helper function for os::Posix::print_siginfo_...():
--- a/src/os/solaris/vm/os_solaris.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/solaris/vm/os_solaris.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -48,6 +48,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/src/os/solaris/vm/os_solaris.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/solaris/vm/os_solaris.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,15 +26,9 @@
 #define OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP
 
 #include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "orderAccess_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "orderAccess_solaris_sparc.inline.hpp"
-#endif
-
 // System includes
 #include <sys/param.h>
 #include <dlfcn.h>
--- a/src/os/solaris/vm/thread_solaris.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/solaris/vm/thread_solaris.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -29,20 +29,9 @@
 #error "This file should only be included from thread.inline.hpp"
 #endif
 
-#include "runtime/atomic.hpp"
-#include "runtime/prefetch.hpp"
+#include "runtime/atomic.inline.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#ifdef TARGET_OS_ARCH_solaris_x86
-# include "atomic_solaris_x86.inline.hpp"
-# include "orderAccess_solaris_x86.inline.hpp"
-# include "prefetch_solaris_x86.inline.hpp"
-#endif
-#ifdef TARGET_OS_ARCH_solaris_sparc
-# include "atomic_solaris_sparc.inline.hpp"
-# include "orderAccess_solaris_sparc.inline.hpp"
-# include "prefetch_solaris_sparc.inline.hpp"
-#endif
 
 // Thread::current is "hot" it's called > 128K times in the 1st 500 msecs of
 // startup.
--- a/src/os/windows/vm/os_windows.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/windows/vm/os_windows.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -51,6 +51,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/sharedRuntime.hpp"
@@ -5004,7 +5005,11 @@
     // wrong; at these points, eax contains the address of the offending block (I think).
     // To get to the exlicit error message(s) below, just continue twice.
     HANDLE heap = GetProcessHeap();
-    { HeapLock(heap);
+
+    // If we fail to lock the heap, then gflags.exe has been used
+    // or some other special heap flag has been set that prevents
+    // locking. We don't try to walk a heap we can't lock.
+    if (HeapLock(heap) != 0) {
       PROCESS_HEAP_ENTRY phe;
       phe.lpData = NULL;
       while (HeapWalk(heap, &phe) != 0) {
--- a/src/os/windows/vm/os_windows.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/windows/vm/os_windows.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,12 +26,9 @@
 #define OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP
 
 #include "runtime/atomic.inline.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "runtime/os.hpp"
 
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "orderAccess_windows_x86.inline.hpp"
-#endif
-
 inline const char* os::file_separator()                { return "\\"; }
 inline const char* os::line_separator()                { return "\r\n"; }
 inline const char* os::path_separator()                { return ";"; }
--- a/src/os/windows/vm/thread_windows.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os/windows/vm/thread_windows.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -29,15 +29,8 @@
 #error "This file should only be included from thread.inline.hpp"
 #endif
 
-#include "runtime/atomic.hpp"
-#include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#ifdef TARGET_OS_ARCH_windows_x86
-# include "atomic_windows_x86.inline.hpp"
-# include "orderAccess_windows_x86.inline.hpp"
-# include "prefetch_windows_x86.inline.hpp"
-#endif
 
 // Contains inlined functions for class Thread and ThreadLocalStorage
 
--- a/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,7 +26,6 @@
 #ifndef OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP
 #define OS_CPU_AIX_OJDKPPC_VM_ATOMIC_AIX_PPC_INLINE_HPP
 
-#include "orderAccess_aix_ppc.inline.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "vm_version_ppc.hpp"
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -276,6 +276,8 @@
 # endif
 #endif
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 address os::current_stack_pointer() {
 #if defined(__clang__) || defined(__llvm__)
   register void *esp;
--- a/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -26,7 +26,6 @@
 #ifndef OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP
 #define OS_CPU_LINUX_PPC_VM_ATOMIC_LINUX_PPC_INLINE_HPP
 
-#include "orderAccess_linux_ppc.inline.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/os.hpp"
 #include "vm_version_ppc.hpp"
@@ -53,41 +52,41 @@
 
 inline jlong Atomic::load(volatile jlong* src) { return *src; }
 
-/*
-  machine barrier instructions:
-
-  - sync            two-way memory barrier, aka fence
-  - lwsync          orders  Store|Store,
-                             Load|Store,
-                             Load|Load,
-                    but not Store|Load
-  - eieio           orders memory accesses for device memory (only)
-  - isync           invalidates speculatively executed instructions
-                    From the POWER ISA 2.06 documentation:
-                     "[...] an isync instruction prevents the execution of
-                    instructions following the isync until instructions
-                    preceding the isync have completed, [...]"
-                    From IBM's AIX assembler reference:
-                     "The isync [...] instructions causes the processor to
-                    refetch any instructions that might have been fetched
-                    prior to the isync instruction. The instruction isync
-                    causes the processor to wait for all previous instructions
-                    to complete. Then any instructions already fetched are
-                    discarded and instruction processing continues in the
-                    environment established by the previous instructions."
-
-  semantic barrier instructions:
-  (as defined in orderAccess.hpp)
-
-  - release         orders Store|Store,       (maps to lwsync)
-                            Load|Store
-  - acquire         orders  Load|Store,       (maps to lwsync)
-                            Load|Load
-  - fence           orders Store|Store,       (maps to sync)
-                            Load|Store,
-                            Load|Load,
-                           Store|Load
-*/
+//
+// machine barrier instructions:
+//
+// - sync            two-way memory barrier, aka fence
+// - lwsync          orders  Store|Store,
+//                            Load|Store,
+//                            Load|Load,
+//                   but not Store|Load
+// - eieio           orders memory accesses for device memory (only)
+// - isync           invalidates speculatively executed instructions
+//                   From the POWER ISA 2.06 documentation:
+//                    "[...] an isync instruction prevents the execution of
+//                   instructions following the isync until instructions
+//                   preceding the isync have completed, [...]"
+//                   From IBM's AIX assembler reference:
+//                    "The isync [...] instructions causes the processor to
+//                   refetch any instructions that might have been fetched
+//                   prior to the isync instruction. The instruction isync
+//                   causes the processor to wait for all previous instructions
+//                   to complete. Then any instructions already fetched are
+//                   discarded and instruction processing continues in the
+//                   environment established by the previous instructions."
+//
+// semantic barrier instructions:
+// (as defined in orderAccess.hpp)
+//
+// - release         orders Store|Store,       (maps to lwsync)
+//                           Load|Store
+// - acquire         orders  Load|Store,       (maps to lwsync)
+//                           Load|Load
+// - fence           orders Store|Store,       (maps to sync)
+//                           Load|Store,
+//                           Load|Load,
+//                          Store|Load
+//
 
 #define strasm_sync                       "\n  sync    \n"
 #define strasm_lwsync                     "\n  lwsync  \n"
--- a/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -78,12 +78,12 @@
   __asm__ volatile(
     "1: \n\t"
     " ldx    [%2], %%o2\n\t"
-    " add    %0, %%o2, %%o3\n\t"
+    " add    %1, %%o2, %%o3\n\t"
     " casx   [%2], %%o2, %%o3\n\t"
     " cmp    %%o2, %%o3\n\t"
     " bne    %%xcc, 1b\n\t"
     "  nop\n\t"
-    " add    %0, %%o2, %0\n\t"
+    " add    %1, %%o2, %0\n\t"
     : "=r" (rv)
     : "r" (add_value), "r" (dest)
     : "memory", "o2", "o3");
--- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -302,29 +302,30 @@
   if (context == NULL) return;
 
   ucontext_t *uc = (ucontext_t*)context;
+  sigcontext* sc = (sigcontext*)context;
   intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
 
   st->print_cr("Register to memory mapping:");
   st->cr();
 
   // this is only for the "general purpose" registers
-  st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON__G1]);
-  st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON__G2]);
-  st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON__G3]);
-  st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON__G4]);
-  st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON__G5]);
-  st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON__G6]);
-  st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON__G7]);
+  st->print("G1="); print_location(st, SIG_REGS(sc).u_regs[CON_G1]);
+  st->print("G2="); print_location(st, SIG_REGS(sc).u_regs[CON_G2]);
+  st->print("G3="); print_location(st, SIG_REGS(sc).u_regs[CON_G3]);
+  st->print("G4="); print_location(st, SIG_REGS(sc).u_regs[CON_G4]);
+  st->print("G5="); print_location(st, SIG_REGS(sc).u_regs[CON_G5]);
+  st->print("G6="); print_location(st, SIG_REGS(sc).u_regs[CON_G6]);
+  st->print("G7="); print_location(st, SIG_REGS(sc).u_regs[CON_G7]);
   st->cr();
 
-  st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON__O0]);
-  st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON__O1]);
-  st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON__O2]);
-  st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON__O3]);
-  st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON__O4]);
-  st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON__O5]);
-  st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON__O6]);
-  st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON__O7]);
+  st->print("O0="); print_location(st, SIG_REGS(sc).u_regs[CON_O0]);
+  st->print("O1="); print_location(st, SIG_REGS(sc).u_regs[CON_O1]);
+  st->print("O2="); print_location(st, SIG_REGS(sc).u_regs[CON_O2]);
+  st->print("O3="); print_location(st, SIG_REGS(sc).u_regs[CON_O3]);
+  st->print("O4="); print_location(st, SIG_REGS(sc).u_regs[CON_O4]);
+  st->print("O5="); print_location(st, SIG_REGS(sc).u_regs[CON_O5]);
+  st->print("O6="); print_location(st, SIG_REGS(sc).u_regs[CON_O6]);
+  st->print("O7="); print_location(st, SIG_REGS(sc).u_regs[CON_O7]);
   st->cr();
 
   st->print("L0="); print_location(st, sp[L0->sp_offset_in_saved_window()]);
@@ -516,7 +517,7 @@
   if (nativeInstruction_at(*pc)->is_ic_miss_trap()) {
 #ifdef ASSERT
 #ifdef TIERED
-    CodeBlob* cb = CodeCache::find_blob_unsafe(pc);
+    CodeBlob* cb = CodeCache::find_blob_unsafe(*pc);
     assert(cb->is_compiled_by_c2(), "Wrong compiler");
 #endif // TIERED
 #endif // ASSERT
--- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -89,6 +89,8 @@
 #define SPELL_REG_FP "ebp"
 #endif // AMD64
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 address os::current_stack_pointer() {
 #ifdef SPARC_WORKS
   register void *esp;
--- a/src/share/vm/adlc/adlc.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/adlc/adlc.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -30,12 +30,13 @@
 //
 
 // standard library constants
-#include "stdio.h"
-#include "stdlib.h"
 #include <iostream>
-#include "string.h"
-#include "ctype.h"
-#include "stdarg.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
 #include <sys/types.h>
 
 /* Make sure that we have the intptr_t and uintptr_t definitions */
--- a/src/share/vm/adlc/adlparse.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/adlc/adlparse.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -64,8 +64,6 @@
 class PeepConstraint;
 class PeepReplace;
 
-// class ostream; // ostream is a typedef in some systems
-
 extern char *toUpper(const char *str);
 
 //---------------------------ADLParser-----------------------------------------
--- a/src/share/vm/adlc/filebuff.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/adlc/filebuff.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,6 @@
 // FILEBUFF.CPP - Routines for handling a parser file buffer
 #include "adlc.hpp"
 
-using namespace std;
-
 //------------------------------FileBuff---------------------------------------
 // Create a new parsing buffer
 FileBuff::FileBuff( BufferedFile *fptr, ArchDesc& archDesc) : _fp(fptr), _AD(archDesc) {
@@ -89,200 +87,6 @@
   return retval;
 }
 
-//------------------------------FileBuffRegion---------------------------------
-// Create a new region in a FileBuff.
-FileBuffRegion::FileBuffRegion( FileBuff* bufr, int soln, int ln,
-                                int off, int len)
-: _bfr(bufr), _sol(soln), _line(ln), _offset(off), _length(len) {
-  _next = NULL;                 // No chained regions
-}
-
-//------------------------------~FileBuffRegion--------------------------------
-// Delete the entire linked list of buffer regions.
-FileBuffRegion::~FileBuffRegion() {
-  if( _next ) delete _next;
-}
-
-//------------------------------copy-------------------------------------------
-// Deep copy a FileBuffRegion
-FileBuffRegion *FileBuffRegion::copy() {
-  if( !this ) return NULL;      // The empty buffer region
-  FileBuffRegion *br = new FileBuffRegion(_bfr,_sol,_line,_offset,_length);
-  if( _next ) br->_next = _next->copy();
-  return br;
-}
-
-//------------------------------merge------------------------------------------
-// Merge another buffer region into this buffer region.  Make overlapping areas
-// become a single region.  Remove (delete) the input FileBuffRegion.
-// Since the buffer regions are sorted by file offset, this is a varient of a
-// "sorted-merge" running in linear time.
-FileBuffRegion *FileBuffRegion::merge( FileBuffRegion *br ) {
-  if( !br ) return this;        // Merging nothing
-  if( !this ) return br;        // Merging into nothing
-
-  assert( _bfr == br->_bfr, "" );     // Check for pointer-equivalent buffers
-
-  if( _offset < br->_offset ) { // "this" starts before "br"
-    if( _offset+_length < br->_offset ) { // "this" ends before "br"
-      if( _next ) _next->merge( br );    // Merge with remainder of list
-      else _next = br;                 // No more in this list; just append.
-    } else {                           // Regions overlap.
-      int l = br->_offset + br->_length - _offset;
-      if( l > _length ) _length = l;     // Pick larger region
-      FileBuffRegion *nr = br->_next;     // Get rest of region
-      br->_next = NULL;         // Remove indication of rest of region
-      delete br;                // Delete this region (it's been subsumed).
-      if( nr ) merge( nr );     // Merge with rest of region
-    }                           // End of if regions overlap or not.
-  } else {                      // "this" starts after "br"
-    if( br->_offset+br->_length < _offset ) {    // "br" ends before "this"
-      FileBuffRegion *nr = new FileBuffRegion(_bfr,_sol,_line,_offset,_length);
-      nr->_next = _next;                // Structure copy "this" guy to "nr"
-      *this = *br;              // Structure copy "br" over "this".
-      br->_next = NULL;         // Remove indication of rest of region
-      delete br;                // Delete this region (it's been copied)
-      merge( nr );              // Finish merging
-    } else {                    // Regions overlap.
-      int l = _offset + _length - br->_offset;
-      if( l > _length ) _length = l;    // Pick larger region
-      _offset = br->_offset;            // Start with earlier region
-      _sol = br->_sol;                  // Also use earlier line start
-      _line = br->_line;                        // Also use earlier line
-      FileBuffRegion *nr = br->_next;   // Get rest of region
-      br->_next = NULL;         // Remove indication of rest of region
-      delete br;                // Delete this region (it's been subsumed).
-      if( nr ) merge( nr );     // Merge with rest of region
-    }                           // End of if regions overlap or not.
-  }
-  return this;
-}
-
-//------------------------------expandtab--------------------------------------
-static int expandtab( ostream &os, int off, char c, char fill1, char fill2 ) {
-  if( c == '\t' ) {             // Tab?
-    do os << fill1;             // Expand the tab; Output space
-    while( (++off) & 7 );       // Expand to tab stop
-  } else {                      // Normal character
-    os << fill2;                // Display normal character
-    off++;                      // Increment "cursor" offset
-  }
-  return off;
-}
-
-//------------------------------printline--------------------------------------
-// Print and highlite a region of a line.  Return the amount of highliting left
-// to do (i.e. highlite length minus length of line).
-static int printline( ostream& os, const char *fname, int line,
-                        const char *_sol, int skip, int len ) {
-
-  // Display the entire tab-expanded line
-  os << fname << ":" << line << ": ";
-  const char *t = strchr(_sol,'\n')+1; // End of line
-  int off = 0;                  // Cursor offset for tab expansion
-  const char *s = _sol;         // Nice string pointer
-  while( t-s ) {                // Display whole line
-    char c = *s++;              // Get next character to display
-    off = expandtab(os,off,c,' ',c);
-  }
-
-  // Display the tab-expanded skippings before underlining.
-  os << fname << ":" << line << ": ";
-  off = 0;                      // Cursor offset for tab expansion
-  s = _sol;                     // Restart string pointer
-
-  // Start underlining.
-  if( skip != -1 ) {            // The no-start-indicating flag
-    const char *u = _sol+skip;  // Amount to skip
-    while( u-s )                // Display skipped part
-      off = expandtab(os,off,*s++,' ',' ');
-    os << '^';                  // Start region
-    off++;                      // Moved cursor
-    len--;                      // 1 less char to do
-    if( *s++ == '\t' )          // Starting character is a tab?
-      off = expandtab(os,off,'\t','-','^');
-  }
-
-  // Long region doesn't end on this line
-  int llen = (int)(t-s);        // Length of line, minus what's already done
-  if( len > llen ) {            // Doing entire rest of line?
-    while( t-s )                // Display rest of line
-      off = expandtab(os,off,*s++,'-','-');
-    os << '\n';                 // EOL
-    return len-llen;            // Return what's not yet done.
-  }
-
-  // Region does end on this line.  This code fails subtly if the region ends
-  // in a tab character.
-  int i;
-  for( i=1; i<len; i++ )        // Underline just what's needed
-    off = expandtab(os,off,*s++,'-','-');
-  if( i == len ) os << '^';     // Mark end of region
-  os << '\n';                   // End of marked line
-  return 0;                     // All done
-}
-
-//------------------------------print------------------------------------------
-//std::ostream& operator<< ( std::ostream& os, FileBuffRegion &br ) {
-ostream& operator<< ( ostream& os, FileBuffRegion &br ) {
-  if( &br == NULL ) return os;  // The empty buffer region
-  FileBuffRegion *brp = &br;    // Pointer to region
-  while( brp ) {                // While have chained regions
-    brp->print(os);             // Print region
-    brp = brp->_next;           // Chain to next
-  }
-  return os;                    // Return final stream
-}
-
-//------------------------------print------------------------------------------
-// Print the FileBuffRegion to a stream. FileBuffRegions are printed with the
-// filename and line number to the left, and complete text lines to the right.
-// Selected portions (portions of a line actually in the FileBuffRegion are
-// underlined.  Ellipses are used for long multi-line regions.
-//void FileBuffRegion::print( std::ostream& os ) {
-void FileBuffRegion::print( ostream& os ) {
-  if( !this ) return;           // Nothing to print
-  char *s = _bfr->get_line();
-  int skip = (int)(_offset - _sol);     // Amount to skip to start of data
-  int len = printline( os, _bfr->_fp->_name, _line, s, skip, _length );
-
-  if( !len ) return;                    // All done; exit
-
-  // Here we require at least 2 lines
-  int off1 = _length - len + skip;      // Length of line 1
-  int off2 = off1 + _sol;               // Offset to start of line 2
-  char *s2 = _bfr->get_line();           // Start of line 2
-  char *s3 = strchr( s2, '\n' )+1;      // Start of line 3 (unread)
-  if( len <= (s3-s2) ) {                // It all fits on the next line
-    printline( os, _bfr->_fp->_name, _line+1, s2, -1, len ); // Print&underline
-    return;
-  }
-
-  // Here we require at least 3 lines
-  int off3 = off2 + (int)(s3-s2);       // Offset to start of line 3
-  s3 = _bfr->get_line();                // Start of line 3 (read)
-  const char *s4 = strchr( s3, '\n' )+1;// Start of line 4 (unread)
-  if( len < (s4-s3) ) {                 // It all fits on the next 2 lines
-    s2 = _bfr->get_line();
-    len = printline( os, _bfr->_fp->_name, _line+1, s2, -1, len ); // Line 2
-    s3 = _bfr->get_line();
-    printline( os, _bfr->_fp->_name, _line+2, s3, -1, len );     // Line 3
-    return;
-  }
-
-  // Here we require at least 4 lines.
-  // Print only the 1st and last line, with ellipses in middle.
-  os << "...\n";                // The ellipses
-  int cline = _line+1;          // Skipped 2 lines
-  do {                          // Do until find last line
-    len -= (int)(s3-s2);        // Remove length of line
-    cline++;                    // Next line
-    s2 = _bfr->get_line();      // Get next line from end of this line
-    s3 = strchr( s2, '\n' ) + 1;// Get end of next line
-  } while( len > (s3-s2) );     // Repeat until last line
-  printline( os, _bfr->_fp->_name, cline, s2, -1, len ); // Print & underline
-}
-
 //------------------------------file_error-------------------------------------
 void FileBuff::file_error(int flag, int linenum, const char *fmt, ...)
 {
--- a/src/share/vm/adlc/filebuff.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/adlc/filebuff.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,6 @@
 #define SHARE_VM_ADLC_FILEBUFF_HPP
 
 // FILEBUFF.HPP - Definitions for parser file buffering routines
-#include <iostream>
-
-using namespace std;
 
 // STRUCTURE FOR HANDLING INPUT AND OUTPUT FILES
 
@@ -46,7 +43,6 @@
 // This class defines a nicely behaved buffer of text.  Entire file of text
 // is read into buffer at creation, with sentinels at start and end.
 class FileBuff {
-  friend class FileBuffRegion;
  private:
   long  _bufferSize;            // Size of text holding buffer.
   long  _offset;                // Expected filepointer offset.
@@ -82,29 +78,4 @@
   // when the pointer is valid (i.e. just obtained from getline()).
   long getoff(const char* s) { return _bufoff + (long)(s - _buf); }
 };
-
-//------------------------------FileBuffRegion---------------------------------
-// A buffer region is really a region of some file, specified as a linked list
-// of offsets and lengths.  These regions can be merged; overlapping regions
-// will coalesce.
-class FileBuffRegion {
- public:                        // Workaround dev-studio friend/private bug
-  FileBuffRegion *_next;        // Linked list of regions sorted by offset.
- private:
-  FileBuff       *_bfr;         // The Buffer of the file
-  int _offset, _length;         // The file area
-  int             _sol;         // Start of line where the file area starts
-  int             _line;        // First line of region
-
- public:
-  FileBuffRegion(FileBuff*, int sol, int line, int offset, int len);
-  ~FileBuffRegion();
-
-  FileBuffRegion *copy();                   // Deep copy
-  FileBuffRegion *merge(FileBuffRegion*); // Merge 2 regions; delete input
-
-  void print(ostream&);
-  friend ostream& operator<< (ostream&, FileBuffRegion&);
-};
-
 #endif // SHARE_VM_ADLC_FILEBUFF_HPP
--- a/src/share/vm/adlc/formssel.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/adlc/formssel.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1322,7 +1322,7 @@
     OperandForm* oper = form->is_operand();
     if (oper != NULL && oper->is_bound_register()) {
       const RegDef* first = oper->get_RegClass()->find_first_elem();
-      fprintf(fp, "    st->print(\"%s\");\n", first->_regname);
+      fprintf(fp, "    st->print_raw(\"%s\");\n", first->_regname);
     } else {
       globalAD->syntax_err(_linenum, "In %s can't find format for %s %s", _ident, opc->_ident, rep_var);
     }
@@ -2530,7 +2530,7 @@
   case Form::idealP: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
   case Form::idealNKlass:
   case Form::idealN: fprintf(fp,"  if (_c%d) _c%d->dump_on(st);\n", const_index, const_index); break;
-  case Form::idealL: fprintf(fp,"  st->print(\"#%%lld\", _c%d);\n", const_index); break;
+  case Form::idealL: fprintf(fp,"  st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", const_index); break;
   case Form::idealF: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   case Form::idealD: fprintf(fp,"  st->print(\"#%%f\", _c%d);\n", const_index); break;
   default:
--- a/src/share/vm/adlc/output_h.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/adlc/output_h.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -211,7 +211,7 @@
     const char *type = oper->ideal_type(globals);
     if (!strcmp(type, "ConI")) {
       if (i > 0) fprintf(fp,", ");
-      fprintf(fp,"  int32          _c%d;\n", i);
+      fprintf(fp,"  int32_t        _c%d;\n", i);
     }
     else if (!strcmp(type, "ConP")) {
       if (i > 0) fprintf(fp,", ");
@@ -307,7 +307,7 @@
     assert(num_consts == 1, "Bad component list detected.\n");
     switch( constant_type ) {
     case Form::idealI : {
-      fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32 c%d", i);
+      fprintf(fp,is_ideal_bool ? "BoolTest::mask c%d" : "int32_t c%d", i);
       break;
     }
     case Form::idealN :      { fprintf(fp,"const TypeNarrowOop *c%d", i); break; }
@@ -326,7 +326,7 @@
     while((comp = lst.iter()) != NULL) {
       if (!strcmp(comp->base_type(globals), "ConI")) {
         if (i > 0) fprintf(fp,", ");
-        fprintf(fp,"int32 c%d", i);
+        fprintf(fp,"int32_t c%d", i);
         i++;
       }
       else if (!strcmp(comp->base_type(globals), "ConP")) {
@@ -386,14 +386,14 @@
 static void defineCCodeDump(OperandForm* oper, FILE *fp, int i) {
   assert(oper != NULL, "what");
   CondInterface* cond = oper->_interface->is_CondInterface();
-  fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print(\"%s\");\n",i,cond->_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print(\"%s\");\n",i,cond->_not_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print(\"%s\");\n",i,cond->_less_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print(\"%s\");\n",i,cond->_greater_equal_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print(\"%s\");\n",i,cond->_less_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print(\"%s\");\n",i,cond->_greater_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print(\"%s\");\n",i,cond->_overflow_format);
-  fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print(\"%s\");\n",i,cond->_no_overflow_format);
+  fprintf(fp, "       if( _c%d == BoolTest::eq ) st->print_raw(\"%s\");\n",i,cond->_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::ne ) st->print_raw(\"%s\");\n",i,cond->_not_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::le ) st->print_raw(\"%s\");\n",i,cond->_less_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::ge ) st->print_raw(\"%s\");\n",i,cond->_greater_equal_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::lt ) st->print_raw(\"%s\");\n",i,cond->_less_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::gt ) st->print_raw(\"%s\");\n",i,cond->_greater_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::overflow ) st->print_raw(\"%s\");\n",i,cond->_overflow_format);
+  fprintf(fp, "  else if( _c%d == BoolTest::no_overflow ) st->print_raw(\"%s\");\n",i,cond->_no_overflow_format);
 }
 
 // Output code that dumps constant values, increment "i" if type is constant
@@ -416,8 +416,8 @@
     ++i;
   }
   else if (!strcmp(ideal_type, "ConL")) {
-    fprintf(fp,"    st->print(\"#\" INT64_FORMAT, _c%d);\n", i);
-    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%d);\n", i);
+    fprintf(fp,"    st->print(\"#\" INT64_FORMAT, (int64_t)_c%d);\n", i);
+    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%d);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "ConF")) {
@@ -429,7 +429,7 @@
   else if (!strcmp(ideal_type, "ConD")) {
     fprintf(fp,"    st->print(\"#%%f\", _c%d);\n", i);
     fprintf(fp,"    jlong _c%dl = JavaValue(_c%d).get_jlong();\n", i, i);
-    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, _c%dl);\n", i);
+    fprintf(fp,"    st->print(\"/\" PTR64_FORMAT, (uint64_t)_c%dl);\n", i);
     ++i;
   }
   else if (!strcmp(ideal_type, "Bool")) {
@@ -471,7 +471,7 @@
         if ( string != NameList::_signal ) {
           // Normal string
           // Pass through to st->print
-          fprintf(fp,"  st->print(\"%s\");\n", string);
+          fprintf(fp,"  st->print_raw(\"%s\");\n", string);
         } else {
           // Replacement variable
           const char *rep_var = oper._format->_rep_vars.iter();
@@ -542,7 +542,7 @@
         if ( string != NameList::_signal ) {
           // Normal string
           // Pass through to st->print
-          fprintf(fp,"  st->print(\"%s\");\n", string);
+          fprintf(fp,"  st->print_raw(\"%s\");\n", string);
         } else {
           // Replacement variable
           const char *rep_var = oper._format->_rep_vars.iter();
@@ -669,7 +669,7 @@
       } else if( string == NameList::_signal2 ) // Raw program text
         fputs(inst._format->_strings.iter(), fp);
       else
-        fprintf(fp,"st->print(\"%s\");\n", string);
+        fprintf(fp,"st->print_raw(\"%s\");\n", string);
     } // Done with all format strings
   } // Done generating the user-defined portion of the format
 
@@ -696,13 +696,13 @@
     default:
       assert(0,"ShouldNotReachHere");
     }
-    fprintf(fp,  "  st->print_cr(\"\");\n" );
+    fprintf(fp,  "  st->cr();\n" );
     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
     fprintf(fp,  "  st->print(\"        # \");\n" );
     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
   }
   else if(inst.is_ideal_safepoint()) {
-    fprintf(fp,  "  st->print(\"\");\n" );
+    fprintf(fp,  "  st->print_raw(\"\");\n" );
     fprintf(fp,  "  if (_jvms) _jvms->format(ra, this, st); else st->print_cr(\"        No JVM State Info\");\n" );
     fprintf(fp,  "  st->print(\"        # \");\n" );
     fprintf(fp,  "  if( _jvms && _oop_map ) _oop_map->print_on(st);\n");
--- a/src/share/vm/asm/assembler.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/asm/assembler.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -119,7 +119,7 @@
   L.patch_instructions((MacroAssembler*)this);
 }
 
-void AbstractAssembler::generate_stack_overflow_check( int frame_size_in_bytes) {
+void AbstractAssembler::generate_stack_overflow_check(int frame_size_in_bytes) {
   if (UseStackBanging) {
     // Each code entry causes one stack bang n pages down the stack where n
     // is configurable by StackShadowPages.  The setting depends on the maximum
@@ -134,7 +134,7 @@
     // is greater than a page.
 
     const int page_size = os::vm_page_size();
-    int bang_end = StackShadowPages*page_size;
+    int bang_end = StackShadowPages * page_size;
 
     // This is how far the previous frame's stack banging extended.
     const int bang_end_safe = bang_end;
--- a/src/share/vm/asm/codeBuffer.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/asm/codeBuffer.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -988,7 +988,7 @@
   for (csize_t step; ptr < end(); ptr += step) {
     step = end() - ptr;
     if (step > jintSize * 4)  step = jintSize * 4;
-    tty->print(PTR_FORMAT ": ", ptr);
+    tty->print(INTPTR_FORMAT ": ", p2i(ptr));
     while (step > 0) {
       tty->print(" " PTR32_FORMAT, *(jint*)ptr);
       ptr += jintSize;
@@ -1098,7 +1098,7 @@
     while (c && c->offset() == offset) {
       stream->bol();
       stream->print("  ;; ");
-      stream->print_cr(c->string());
+      stream->print_cr("%s", c->string());
       c = c->next_comment();
     }
   }
@@ -1154,10 +1154,10 @@
 void CodeSection::print(const char* name) {
   csize_t locs_size = locs_end() - locs_start();
   tty->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)%s",
-                name, start(), end(), limit(), size(), capacity(),
+                name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity(),
                 is_frozen()? " [frozen]": "");
   tty->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d",
-                name, locs_start(), locs_end(), locs_limit(), locs_size, locs_capacity(), locs_point_off());
+                name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off());
   if (PrintRelocations) {
     RelocIterator iter(this);
     iter.print();
--- a/src/share/vm/asm/codeBuffer.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/asm/codeBuffer.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -173,7 +173,7 @@
   bool allocates(address pc) const  { return pc >= _start && pc <  _limit; }
   bool allocates2(address pc) const { return pc >= _start && pc <= _limit; }
 
-  void    set_end(address pc)       { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " PTR_FORMAT " <= " PTR_FORMAT " <= " PTR_FORMAT, _start, pc, _limit)); _end = pc; }
+  void    set_end(address pc)       { assert(allocates2(pc), err_msg("not in CodeBuffer memory: " INTPTR_FORMAT " <= " INTPTR_FORMAT " <= " INTPTR_FORMAT, p2i(_start), p2i(pc), p2i(_limit))); _end = pc; }
   void    set_mark(address pc)      { assert(contains2(pc), "not in codeBuffer");
                                       _mark = pc; }
   void    set_mark_off(int offset)  { assert(contains2(offset+_start),"not in codeBuffer");
--- a/src/share/vm/asm/register.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/asm/register.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,8 +118,8 @@
 ) {
   assert(
     a != b,
-    err_msg_res("registers must be different: a=%d, b=%d",
-                a, b)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT "",
+                p2i(a), p2i(b))
   );
 }
 
@@ -132,8 +132,9 @@
   assert(
     a != b && a != c
            && b != c,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d",
-                a, b, c)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c))
   );
 }
 
@@ -148,8 +149,9 @@
     a != b && a != c && a != d
            && b != c && b != d
                      && c != d,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d",
-                a, b, c, d)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d))
   );
 }
 
@@ -166,8 +168,9 @@
            && b != c && b != d && b != e
                      && c != d && c != e
                                && d != e,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d",
-                a, b, c, d, e)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e))
   );
 }
 
@@ -186,8 +189,10 @@
                      && c != d && c != e && c != f
                                && d != e && d != f
                                          && e != f,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d",
-                a, b, c, d, e, f)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f))
   );
 }
 
@@ -208,8 +213,10 @@
                                && d != e && d != f && d != g
                                          && e != f && e != g
                                                    && f != g,
-    err_msg_res("registers must be different: a=%d, b=%d, c=%d, d=%d, e=%d, f=%d, g=%d",
-                a, b, c, d, e, f, g)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g))
   );
 }
 
@@ -232,8 +239,10 @@
                                          && e != f && e != g && e != h
                                                    && f != g && f != h
                                                              && g != h,
-    err_msg_res("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)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h))
   );
 }
 
@@ -258,8 +267,11 @@
                                                    && f != g && f != h && f != i
                                                              && g != h && g != i
                                                                        && h != i,
-    err_msg_res("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)
+    err_msg_res("registers must be different: a=" INTPTR_FORMAT ", b=" INTPTR_FORMAT
+                ", c=" INTPTR_FORMAT ", d=" INTPTR_FORMAT ", e=" INTPTR_FORMAT
+                ", f=" INTPTR_FORMAT ", g=" INTPTR_FORMAT ", h=" INTPTR_FORMAT
+                ", i=" INTPTR_FORMAT "",
+                p2i(a), p2i(b), p2i(c), p2i(d), p2i(e), p2i(f), p2i(g), p2i(h), p2i(i))
   );
 }
 
--- a/src/share/vm/c1/c1_CFGPrinter.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_CFGPrinter.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
 
   void inc_indent();
   void dec_indent();
-  void print(const char* format, ...);
+  void print(const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
   void print_begin(const char* tag);
   void print_end(const char* tag);
 
@@ -161,7 +161,7 @@
 
   print("name \"%s\"", method_name(_compilation->method(), true));
   print("method \"%s\"", method_name(_compilation->method()));
-  print("date "INT64_FORMAT, os::javaTimeMillis());
+  print("date "INT64_FORMAT, (int64_t) os::javaTimeMillis());
 
   print_end("compilation");
 }
--- a/src/share/vm/c1/c1_CodeStubs.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_CodeStubs.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -450,9 +450,11 @@
 class DeoptimizeStub : public CodeStub {
 private:
   CodeEmitInfo* _info;
+  jint _trap_request;
 
 public:
-  DeoptimizeStub(CodeEmitInfo* info) : _info(new CodeEmitInfo(info)) {}
+  DeoptimizeStub(CodeEmitInfo* info, Deoptimization::DeoptReason reason, Deoptimization::DeoptAction action) :
+    _info(new CodeEmitInfo(info)), _trap_request(Deoptimization::make_trap_request(reason, action)) {}
 
   virtual void emit_code(LIR_Assembler* e);
   virtual CodeEmitInfo* info() const           { return _info; }
--- a/src/share/vm/c1/c1_Compilation.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_Compilation.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -251,6 +251,10 @@
     return env()->comp_level() == CompLevel_full_profile &&
       C1UpdateMethodData && MethodData::profile_return();
   }
+  bool age_code() const {
+    return _method->profile_aging();
+  }
+
   // will compilation make optimistic assumptions that might lead to
   // deoptimization and that the runtime will account for?
   bool is_optimistic() const                             {
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1701,6 +1701,15 @@
   return NULL;
 }
 
+void GraphBuilder::check_args_for_profiling(Values* obj_args, int expected) {
+#ifdef ASSERT
+  bool ignored_will_link;
+  ciSignature* declared_signature = NULL;
+  ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
+  assert(expected == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?");
+#endif
+}
+
 // Collect arguments that we want to profile in a list
 Values* GraphBuilder::collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver) {
   int start = 0;
@@ -1709,13 +1718,14 @@
     return NULL;
   }
   int s = obj_args->size();
-  for (int i = start, j = 0; j < s; i++) {
+  // if called through method handle invoke, some arguments may have been popped
+  for (int i = start, j = 0; j < s && i < args->length(); i++) {
     if (args->at(i)->type()->is_object_kind()) {
       obj_args->push(args->at(i));
       j++;
     }
   }
-  assert(s == obj_args->length(), "missed on arg?");
+  check_args_for_profiling(obj_args, s);
   return obj_args;
 }
 
@@ -3847,14 +3857,7 @@
             j++;
           }
         }
-#ifdef ASSERT
-        {
-          bool ignored_will_link;
-          ciSignature* declared_signature = NULL;
-          ciMethod* real_target = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
-          assert(s == obj_args->length() || real_target->is_method_handle_intrinsic(), "missed on arg?");
-        }
-#endif
+        check_args_for_profiling(obj_args, s);
       }
       profile_call(callee, recv, holder_known ? callee->holder() : NULL, obj_args, true);
     }
--- a/src/share/vm/c1/c1_GraphBuilder.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_GraphBuilder.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -392,6 +392,7 @@
 
   Values* args_list_for_profiling(ciMethod* target, int& start, bool may_have_receiver);
   Values* collect_args_for_profiling(Values* args, ciMethod* target, bool may_have_receiver);
+  void check_args_for_profiling(Values* obj_args, int expected);
 
  public:
   NOT_PRODUCT(void print_stats();)
--- a/src/share/vm/c1/c1_IR.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_IR.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -263,8 +263,7 @@
 // Implementation of IR
 
 IR::IR(Compilation* compilation, ciMethod* method, int osr_bci) :
-    _locals_size(in_WordSize(-1))
-  , _num_loops(0) {
+  _num_loops(0) {
   // setup IR fields
   _compilation = compilation;
   _top_scope   = new IRScope(compilation, NULL, -1, method, osr_bci, true);
--- a/src/share/vm/c1/c1_IR.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_IR.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -293,7 +293,6 @@
  private:
   Compilation*     _compilation;                 // the current compilation
   IRScope*         _top_scope;                   // the root of the scope hierarchy
-  WordSize         _locals_size;                 // the space required for all locals
   int              _num_loops;                   // Total number of loops
   BlockList*       _code;                        // the blocks in code generation order w/ use counts
 
@@ -310,8 +309,6 @@
   BlockBegin*      start() const                 { return top_scope()->start(); }
   BlockBegin*      std_entry() const             { return start()->end()->as_Base()->std_entry(); }
   BlockBegin*      osr_entry() const             { return start()->end()->as_Base()->osr_entry(); }
-  WordSize         locals_size() const           { return _locals_size; }
-  int              locals_size_in_words() const  { return in_words(_locals_size); }
   BlockList*       code() const                  { return _code; }
   int              num_loops() const             { return _num_loops; }
   int              max_stack() const             { return top_scope()->max_stack(); } // expensive
--- a/src/share/vm/c1/c1_InstructionPrinter.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_InstructionPrinter.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -134,23 +134,23 @@
     if (value->is_null_object()) {
       output()->print("null");
     } else if (!value->is_loaded()) {
-      output()->print("<unloaded object " PTR_FORMAT ">", value);
+      output()->print("<unloaded object " INTPTR_FORMAT ">", p2i(value));
     } else {
-      output()->print("<object " PTR_FORMAT " klass=", value->constant_encoding());
+      output()->print("<object " INTPTR_FORMAT " klass=", p2i(value->constant_encoding()));
       print_klass(value->klass());
       output()->print(">");
     }
   } else if (type->as_InstanceConstant() != NULL) {
     ciInstance* value = type->as_InstanceConstant()->value();
     if (value->is_loaded()) {
-      output()->print("<instance " PTR_FORMAT " klass=", value->constant_encoding());
+      output()->print("<instance " INTPTR_FORMAT " klass=", p2i(value->constant_encoding()));
       print_klass(value->klass());
       output()->print(">");
     } else {
-      output()->print("<unloaded instance " PTR_FORMAT ">", value);
+      output()->print("<unloaded instance " INTPTR_FORMAT ">", p2i(value));
     }
   } else if (type->as_ArrayConstant() != NULL) {
-    output()->print("<array " PTR_FORMAT ">", type->as_ArrayConstant()->value()->constant_encoding());
+    output()->print("<array " INTPTR_FORMAT ">", p2i(type->as_ArrayConstant()->value()->constant_encoding()));
   } else if (type->as_ClassConstant() != NULL) {
     ciInstanceKlass* klass = type->as_ClassConstant()->value();
     if (!klass->is_loaded()) {
@@ -268,7 +268,7 @@
 
 
 void InstructionPrinter::print_unsafe_op(UnsafeOp* op, const char* name) {
-  output()->print(name);
+  output()->print("%s", name);
   output()->print(".(");
 }
 
@@ -479,7 +479,7 @@
   if (x->declared_type()->is_klass())
     print_klass(x->declared_type()->as_klass());
   else
-    output()->print(type2name(x->declared_type()->basic_type()));
+    output()->print("%s", type2name(x->declared_type()->basic_type()));
 }
 
 
--- a/src/share/vm/c1/c1_LIR.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_LIR.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1563,15 +1563,15 @@
   } else if (is_virtual()) {
     out->print("R%d", vreg_number());
   } else if (is_single_cpu()) {
-    out->print(as_register()->name());
+    out->print("%s", as_register()->name());
   } else if (is_double_cpu()) {
-    out->print(as_register_hi()->name());
-    out->print(as_register_lo()->name());
+    out->print("%s", as_register_hi()->name());
+    out->print("%s", as_register_lo()->name());
 #if defined(X86)
   } else if (is_single_xmm()) {
-    out->print(as_xmm_float_reg()->name());
+    out->print("%s", as_xmm_float_reg()->name());
   } else if (is_double_xmm()) {
-    out->print(as_xmm_double_reg()->name());
+    out->print("%s", as_xmm_double_reg()->name());
   } else if (is_single_fpu()) {
     out->print("fpu%d", fpu_regnr());
   } else if (is_double_fpu()) {
@@ -1583,9 +1583,9 @@
     out->print("d%d", fpu_regnrLo() >> 1);
 #else
   } else if (is_single_fpu()) {
-    out->print(as_float_reg()->name());
+    out->print("%s", as_float_reg()->name());
   } else if (is_double_fpu()) {
-    out->print(as_double_reg()->name());
+    out->print("%s", as_double_reg()->name());
 #endif
 
   } else if (is_illegal()) {
@@ -1611,9 +1611,9 @@
     case T_LONG:   out->print("lng:" JLONG_FORMAT, as_jlong()); break;
     case T_FLOAT:  out->print("flt:%f",   as_jfloat());         break;
     case T_DOUBLE: out->print("dbl:%f",   as_jdouble());        break;
-    case T_OBJECT: out->print("obj:0x%x", as_jobject());        break;
-    case T_METADATA: out->print("metadata:0x%x", as_metadata());break;
-    default:       out->print("%3d:0x%x",type(), as_jdouble()); break;
+    case T_OBJECT: out->print("obj:" INTPTR_FORMAT, p2i(as_jobject()));        break;
+    case T_METADATA: out->print("metadata:" INTPTR_FORMAT, p2i(as_metadata()));break;
+    default:       out->print("%3d:0x" UINT64_FORMAT_X, type(), (uint64_t)as_jlong()); break;
   }
 }
 
@@ -1629,7 +1629,7 @@
     case times_8: out->print(" * 8"); break;
     }
   }
-  out->print(" Disp: %d", _disp);
+  out->print(" Disp: " INTX_FORMAT, _disp);
 }
 
 // debug output of block header without InstructionPrinter
@@ -1703,7 +1703,7 @@
   } else {
     out->print("     ");
   }
-  out->print(name()); out->print(" ");
+  out->print("%s ", name());
   print_instr(out);
   if (info() != NULL) out->print(" [bci:%d]", info()->stack()->bci());
 #ifdef ASSERT
@@ -1833,7 +1833,7 @@
 // LIR_OpJavaCall
 void LIR_OpJavaCall::print_instr(outputStream* out) const {
   out->print("call: ");
-  out->print("[addr: 0x%x]", address());
+  out->print("[addr: " INTPTR_FORMAT "]", p2i(address()));
   if (receiver()->is_valid()) {
     out->print(" [recv: ");   receiver()->print(out);   out->print("]");
   }
@@ -1844,7 +1844,7 @@
 
 // LIR_OpLabel
 void LIR_OpLabel::print_instr(outputStream* out) const {
-  out->print("[label:0x%x]", _label);
+  out->print("[label:" INTPTR_FORMAT "]", p2i(_label));
 }
 
 // LIR_OpArrayCopy
@@ -1911,7 +1911,7 @@
 // LIR_Op1
 void LIR_OpRTCall::print_instr(outputStream* out) const {
   intx a = (intx)addr();
-  out->print(Runtime1::name_for_address(addr()));
+  out->print("%s", Runtime1::name_for_address(addr()));
   out->print(" ");
   tmp()->print(out);
 }
@@ -1934,10 +1934,10 @@
   } else if (stub() != NULL) {
     out->print("[");
     stub()->print_name(out);
-    out->print(": 0x%x]", stub());
+    out->print(": " INTPTR_FORMAT "]", p2i(stub()));
     if (stub()->info() != NULL) out->print(" [bci:%d]", stub()->info()->stack()->bci());
   } else {
-    out->print("[label:0x%x] ", label());
+    out->print("[label:" INTPTR_FORMAT "] ", p2i(label()));
   }
   if (ublock() != NULL) {
     out->print("unordered: [B%d] ", ublock()->block_id());
@@ -2004,7 +2004,7 @@
   tmp4()->print(out);                       out->print(" ");
   out->print("[hdr:%d]", header_size()); out->print(" ");
   out->print("[obj:%d]", object_size()); out->print(" ");
-  out->print("[lbl:0x%x]", stub()->entry());
+  out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 void LIR_OpRoundFP::print_instr(outputStream* out) const {
@@ -2037,7 +2037,7 @@
   tmp3()->print(out);                    out->print(" ");
   tmp4()->print(out);                    out->print(" ");
   out->print("[type:0x%x]", type());     out->print(" ");
-  out->print("[label:0x%x]", stub()->entry());
+  out->print("[label:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 
@@ -2074,7 +2074,7 @@
   if (_scratch->is_valid()) {
     _scratch->print(out);  out->print(" ");
   }
-  out->print("[lbl:0x%x]", stub()->entry());
+  out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
 }
 
 #ifdef ASSERT
@@ -2082,7 +2082,7 @@
   print_condition(out, condition()); out->print(" ");
   in_opr1()->print(out);             out->print(" ");
   in_opr2()->print(out);             out->print(", \"");
-  out->print(msg());                 out->print("\"");
+  out->print("%s", msg());          out->print("\"");
 }
 #endif
 
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -2636,8 +2636,10 @@
       // LIR_Assembler::emit_profile_type() from emitting useless code
       profiled_k = ciTypeEntries::with_status(result, profiled_k);
     }
-    if (exact_signature_k != NULL && exact_klass != exact_signature_k) {
-      assert(exact_klass == NULL, "obj and signature disagree?");
+    // exact_klass and exact_signature_k can be both non NULL but
+    // different if exact_klass is loaded after the ciObject for
+    // exact_signature_k is created.
+    if (exact_klass == NULL && exact_signature_k != NULL && exact_klass != exact_signature_k) {
       // sometimes the type of the signature is better than the best type
       // the compiler has
       exact_klass = exact_signature_k;
@@ -2648,8 +2650,7 @@
       if (improved_klass == NULL) {
         improved_klass = comp->cha_exact_type(callee_signature_k);
       }
-      if (improved_klass != NULL && exact_klass != improved_klass) {
-        assert(exact_klass == NULL, "obj and signature disagree?");
+      if (exact_klass == NULL && improved_klass != NULL && exact_klass != improved_klass) {
         exact_klass = exact_signature_k;
       }
     }
@@ -2781,7 +2782,10 @@
       __ lock_object(syncTempOpr(), obj, lock, new_register(T_OBJECT), slow_path, NULL);
     }
   }
-
+  if (compilation()->age_code()) {
+    CodeEmitInfo* info = new CodeEmitInfo(scope()->start()->state()->copy(ValueStack::StateBefore, 0), NULL, false);
+    decrement_age(info);
+  }
   // increment invocation counters if needed
   if (!method()->is_accessor()) { // Accessors do not have MDOs, so no counting.
     profile_parameters(x);
@@ -3327,6 +3331,27 @@
   increment_event_counter_impl(info, info->scope()->method(), (1 << freq_log) - 1, bci, backedge, true);
 }
 
+void LIRGenerator::decrement_age(CodeEmitInfo* info) {
+  ciMethod* method = info->scope()->method();
+  MethodCounters* mc_adr = method->ensure_method_counters();
+  if (mc_adr != NULL) {
+    LIR_Opr mc = new_pointer_register();
+    __ move(LIR_OprFact::intptrConst(mc_adr), mc);
+    int offset = in_bytes(MethodCounters::nmethod_age_offset());
+    LIR_Address* counter = new LIR_Address(mc, offset, T_INT);
+    LIR_Opr result = new_register(T_INT);
+    __ load(counter, result);
+    __ sub(result, LIR_OprFact::intConst(1), result);
+    __ store(result, counter);
+    // DeoptimizeStub will reexecute from the current state in code info.
+    CodeStub* deopt = new DeoptimizeStub(info, Deoptimization::Reason_tenured,
+                                         Deoptimization::Action_make_not_entrant);
+    __ cmp(lir_cond_lessEqual, result, LIR_OprFact::intConst(0));
+    __ branch(lir_cond_lessEqual, T_INT, deopt);
+  }
+}
+
+
 void LIRGenerator::increment_event_counter_impl(CodeEmitInfo* info,
                                                 ciMethod *method, int frequency,
                                                 int bci, bool backedge, bool notify) {
--- a/src/share/vm/c1/c1_LIRGenerator.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_LIRGenerator.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -372,7 +372,7 @@
       increment_event_counter(info, bci, true);
     }
   }
-
+  void decrement_age(CodeEmitInfo* info);
   CodeEmitInfo* state_for(Instruction* x, ValueStack* state, bool ignore_xhandler = false);
   CodeEmitInfo* state_for(Instruction* x);
 
--- a/src/share/vm/c1/c1_RangeCheckElimination.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_RangeCheckElimination.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,10 +62,10 @@
   _optimistic = ir->compilation()->is_optimistic();
 
   TRACE_RANGE_CHECK_ELIMINATION(
-    tty->print_cr("");
+    tty->cr();
     tty->print_cr("Range check elimination");
     ir->method()->print_name(tty);
-    tty->print_cr("");
+    tty->cr();
   );
 
   TRACE_RANGE_CHECK_ELIMINATION(
@@ -1024,7 +1024,7 @@
                                                          tty->print("i%d", phi->id());
                                                          tty->print(": ");
                                                          bound->print();
-                                                         tty->print_cr("");
+                                                         tty->cr();
                            );
                          }
                      });
@@ -1039,7 +1039,7 @@
                                             tty->print("i%d", instr->id());
                                             tty->print(": ");
                                             bound->print();
-                                            tty->print_cr("");
+                                            tty->cr();
               );
           }
         }
@@ -1400,7 +1400,7 @@
 
 // print
 void RangeCheckEliminator::Bound::print() {
-  tty->print("");
+  tty->print("%s", "");
   if (this->_lower_instr || this->_lower != min_jint) {
     if (this->_lower_instr) {
       tty->print("i%d", this->_lower_instr->id());
--- a/src/share/vm/c1/c1_Runtime1.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_Runtime1.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -532,8 +532,8 @@
     if (TraceExceptions) {
       ttyLocker ttyl;
       ResourceMark rm;
-      tty->print_cr("Exception <%s> (0x%x) thrown in compiled method <%s> at PC " PTR_FORMAT " for thread 0x%x",
-                    exception->print_value_string(), (address)exception(), nm->method()->print_value_string(), pc, thread);
+      tty->print_cr("Exception <%s> (" INTPTR_FORMAT ") thrown in compiled method <%s> at PC " INTPTR_FORMAT " for thread " INTPTR_FORMAT "",
+                    exception->print_value_string(), p2i((address)exception()), nm->method()->print_value_string(), p2i(pc), p2i(thread));
     }
     // for AbortVMOnException flag
     NOT_PRODUCT(Exceptions::debug_check_abort(exception));
@@ -563,7 +563,7 @@
     ttyLocker ttyl;
     ResourceMark rm;
     tty->print_cr("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT " for exception thrown at PC " PTR_FORMAT,
-                  thread, continuation, pc);
+                  p2i(thread), p2i(continuation), p2i(pc));
   }
 
   return continuation;
@@ -685,19 +685,32 @@
 JRT_END
 
 // Cf. OptoRuntime::deoptimize_caller_frame
-JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread))
+JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread, jint trap_request))
   // Called from within the owner thread, so no need for safepoint
   RegisterMap reg_map(thread, false);
   frame stub_frame = thread->last_frame();
-  assert(stub_frame.is_runtime_frame(), "sanity check");
+  assert(stub_frame.is_runtime_frame(), "Sanity check");
   frame caller_frame = stub_frame.sender(&reg_map);
+  nmethod* nm = caller_frame.cb()->as_nmethod_or_null();
+  assert(nm != NULL, "Sanity check");
+  methodHandle method(thread, nm->method());
+  assert(nm == CodeCache::find_nmethod(caller_frame.pc()), "Should be the same");
+  Deoptimization::DeoptAction action = Deoptimization::trap_request_action(trap_request);
+  Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(trap_request);
 
-  // We are coming from a compiled method; check this is true.
-  assert(CodeCache::find_nmethod(caller_frame.pc()) != NULL, "sanity");
+  if (action == Deoptimization::Action_make_not_entrant) {
+    if (nm->make_not_entrant()) {
+      if (reason == Deoptimization::Reason_tenured) {
+        MethodData* trap_mdo = Deoptimization::get_method_data(thread, method, true /*create_if_missing*/);
+        if (trap_mdo != NULL) {
+          trap_mdo->inc_tenure_traps();
+        }
+      }
+    }
+  }
 
   // Deoptimize the caller frame.
   Deoptimization::deoptimize_frame(thread, caller_frame.id());
-
   // Return to the now deoptimized frame.
 JRT_END
 
@@ -988,8 +1001,8 @@
         address copy_buff = stub_location - *byte_skip - *byte_count;
         address being_initialized_entry = stub_location - *being_initialized_entry_offset;
         if (TracePatching) {
-          tty->print_cr(" Patching %s at bci %d at address 0x%x  (%s)", Bytecodes::name(code), bci,
-                        instr_pc, (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
+          tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT "  (%s)", Bytecodes::name(code), bci,
+                        p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass");
           nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc());
           assert(caller_code != NULL, "nmethod not found");
 
@@ -1448,7 +1461,7 @@
     methodHandle inlinee = methodHandle(vfst.method());
     inlinee->print_short_name(&ss1);
     m->print_short_name(&ss2);
-    tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc %x", ss1.as_string(), vfst.bci(), ss2.as_string(), caller_frame.pc());
+    tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc()));
   }
 
 
--- a/src/share/vm/c1/c1_Runtime1.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_Runtime1.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -156,7 +156,7 @@
   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock);
   static void monitorexit (JavaThread* thread, BasicObjectLock* lock);
 
-  static void deoptimize(JavaThread* thread);
+  static void deoptimize(JavaThread* thread, jint trap_request);
 
   static int access_field_patching(JavaThread* thread);
   static int move_klass_patching(JavaThread* thread);
--- a/src/share/vm/c1/c1_ValueType.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/c1/c1_ValueType.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,7 @@
   ValueType* join(ValueType* y) const;
 
   // debugging
-  void print(outputStream* s = tty)              { s->print(name()); }
+  void print(outputStream* s = tty)              { s->print("%s", name()); }
 };
 
 
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -158,6 +158,9 @@
 
 void BCEscapeAnalyzer::set_method_escape(ArgumentMap vars) {
   clear_bits(vars, _arg_local);
+  if (vars.contains_allocated()) {
+    _allocated_escapes = true;
+  }
 }
 
 void BCEscapeAnalyzer::set_global_escape(ArgumentMap vars, bool merge) {
@@ -1287,10 +1290,10 @@
         tty->print_cr("class of method is not initialized.");
       else if (_level > MaxBCEAEstimateLevel)
         tty->print_cr("level (%d) exceeds MaxBCEAEstimateLevel (%d).",
-                      _level, MaxBCEAEstimateLevel);
+                      _level, (int) MaxBCEAEstimateLevel);
       else if (method()->code_size() > MaxBCEAEstimateSize)
-        tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize.",
-                      method()->code_size(), MaxBCEAEstimateSize);
+        tty->print_cr("code size (%d) exceeds MaxBCEAEstimateSize (%d).",
+                      method()->code_size(), (int) MaxBCEAEstimateSize);
       else
         ShouldNotReachHere();
     }
--- a/src/share/vm/ci/ciConstant.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciConstant.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
     tty->print("%d", _value._int);
     break;
   case T_LONG:
-    tty->print(INT64_FORMAT, _value._long);
+    tty->print(INT64_FORMAT, (int64_t)(_value._long));
     break;
   case T_FLOAT:
     tty->print("%f", _value._float);
--- a/src/share/vm/ci/ciEnv.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciEnv.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@
 #include "runtime/init.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/sharedRuntime.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/macros.hpp"
 #ifdef COMPILER1
@@ -1249,8 +1250,7 @@
       if (replay_data_file != NULL) {
         fileStream replay_data_stream(replay_data_file, /*need_close=*/true);
         dump_replay_data(&replay_data_stream);
-        tty->print("# Compiler replay data is saved as: ");
-        tty->print_cr(buffer);
+        tty->print_cr("# Compiler replay data is saved as: %s", buffer);
       } else {
         tty->print_cr("# Can't open file to dump replay data.");
       }
@@ -1273,7 +1273,7 @@
         )
         replay_data_stream.flush();
         tty->print("# Compiler inline data is saved as: ");
-        tty->print_cr(buffer);
+        tty->print_cr("%s", buffer);
       } else {
         tty->print_cr("# Can't open file to dump inline data.");
       }
--- a/src/share/vm/ci/ciInstanceKlass.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciInstanceKlass.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -292,7 +292,7 @@
 // Implementation of the print method.
 void ciInstanceKlass::print_impl(outputStream* st) {
   ciKlass::print_impl(st);
-  GUARDED_VM_ENTRY(st->print(" loader=0x%x", (address)loader());)
+  GUARDED_VM_ENTRY(st->print(" loader=" INTPTR_FORMAT, p2i((address)loader()));)
   if (is_loaded()) {
     st->print(" loaded=true initialized=%s finalized=%s subklass=%s size=%d flags=",
               bool_to_str(is_initialized()),
@@ -618,7 +618,7 @@
         case T_SHORT:   _out->print_cr("%d", mirror->short_field(fd->offset()));  break;
         case T_CHAR:    _out->print_cr("%d", mirror->char_field(fd->offset()));   break;
         case T_INT:     _out->print_cr("%d", mirror->int_field(fd->offset()));    break;
-        case T_LONG:    _out->print_cr(INT64_FORMAT, mirror->long_field(fd->offset()));   break;
+        case T_LONG:    _out->print_cr(INT64_FORMAT, (int64_t)(mirror->long_field(fd->offset())));   break;
         case T_FLOAT: {
           float f = mirror->float_field(fd->offset());
           _out->print_cr("%d", *(int*)&f);
@@ -626,7 +626,7 @@
         }
         case T_DOUBLE: {
           double d = mirror->double_field(fd->offset());
-          _out->print_cr(INT64_FORMAT, *(jlong*)&d);
+          _out->print_cr(INT64_FORMAT, *(int64_t*)&d);
           break;
         }
         case T_ARRAY: {
@@ -656,7 +656,7 @@
               _out->print_cr("\"");
             } else {
               const char* klass_name  = value->klass()->name()->as_quoted_ascii();
-              _out->print_cr(klass_name);
+              _out->print_cr("%s", klass_name);
             }
           } else {
             ShouldNotReachHere();
--- a/src/share/vm/ci/ciMetadata.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciMetadata.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 void ciMetadata::print(outputStream* st) {
   st->print("<%s", type_string());
   GUARDED_VM_ENTRY(print_impl(st);)
-  st->print(" ident=%d address=0x%x>", ident(), (address)this);
+  st->print(" ident=%d address=" INTPTR_FORMAT ">", ident(), p2i((address)this));
 }
 
 
--- a/src/share/vm/ci/ciMethod.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciMethod.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -129,6 +129,7 @@
   constantPoolHandle cpool = h_m()->constants();
   _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
   _method_data = NULL;
+  _nmethod_age = h_m()->nmethod_age();
   // Take a snapshot of these values, so they will be commensurate with the MDO.
   if (ProfileInterpreter || TieredCompilation) {
     int invcnt = h_m()->interpreter_invocation_count();
@@ -1276,6 +1277,14 @@
 }
 
 // ------------------------------------------------------------------
+// ciMethod::profile_aging
+//
+// Should the method be compiled with an age counter?
+bool ciMethod::profile_aging() const {
+  return UseCodeAging && (!MethodCounters::is_nmethod_hot(nmethod_age()) &&
+                          !MethodCounters::is_nmethod_age_unset(nmethod_age()));
+}
+// ------------------------------------------------------------------
 // ciMethod::print_codes
 //
 // Print the bytecodes for this method.
--- a/src/share/vm/ci/ciMethod.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciMethod.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -68,6 +68,7 @@
   int _max_locals;
   vmIntrinsics::ID _intrinsic_id;
   int _handler_count;
+  int _nmethod_age;
   int _interpreter_invocation_count;
   int _interpreter_throwout_count;
   int _instructions_size;
@@ -168,6 +169,10 @@
   int interpreter_invocation_count() const       { check_is_loaded(); return _interpreter_invocation_count; }
   int interpreter_throwout_count() const         { check_is_loaded(); return _interpreter_throwout_count; }
   int size_of_parameters() const                 { check_is_loaded(); return _size_of_parameters; }
+  int nmethod_age() const                        { check_is_loaded(); return _nmethod_age; }
+
+  // Should the method be compiled with an age counter?
+  bool profile_aging() const;
 
   // Code size for inlining decisions.
   int code_size_for_inlining();
--- a/src/share/vm/ci/ciMethodData.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciMethodData.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -177,7 +177,7 @@
 
 
 void ciTypeStackSlotEntries::translate_type_data_from(const TypeStackSlotEntries* entries) {
-  for (int i = 0; i < _number_of_entries; i++) {
+  for (int i = 0; i < number_of_entries(); i++) {
     intptr_t k = entries->type(i);
     TypeStackSlotEntries::set_type(i, translate_klass(k));
   }
@@ -242,7 +242,6 @@
 }
 
 ciProfileData* ciMethodData::bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots) {
-  // bci_to_extra_data(bci) ...
   DataLayout* dp  = data_layout_at(data_size());
   DataLayout* end = data_layout_at(data_size() + extra_data_size());
   two_free_slots = false;
@@ -506,6 +505,63 @@
   ciMetadata::print_impl(st);
 }
 
+void ciMethodData::dump_replay_data_type_helper(outputStream* out, int round, int& count, ProfileData* pdata, ByteSize offset, ciKlass* k) {
+  if (k != NULL) {
+    if (round == 0) {
+      count++;
+    } else {
+      out->print(" %d %s", (int)(dp_to_di(pdata->dp() + in_bytes(offset)) / sizeof(intptr_t)), k->name()->as_quoted_ascii());
+    }
+  }
+}
+
+template<class T> void ciMethodData::dump_replay_data_receiver_type_helper(outputStream* out, int round, int& count, T* vdata) {
+  for (uint i = 0; i < vdata->row_limit(); i++) {
+    dump_replay_data_type_helper(out, round, count, vdata, vdata->receiver_offset(i), vdata->receiver(i));
+  }
+}
+
+template<class T> void ciMethodData::dump_replay_data_call_type_helper(outputStream* out, int round, int& count, T* call_type_data) {
+  if (call_type_data->has_arguments()) {
+    for (int i = 0; i < call_type_data->number_of_arguments(); i++) {
+      dump_replay_data_type_helper(out, round, count, call_type_data, call_type_data->argument_type_offset(i), call_type_data->valid_argument_type(i));
+    }
+  }
+  if (call_type_data->has_return()) {
+    dump_replay_data_type_helper(out, round, count, call_type_data, call_type_data->return_type_offset(), call_type_data->valid_return_type());
+  }
+}
+
+void ciMethodData::dump_replay_data_extra_data_helper(outputStream* out, int round, int& count) {
+  DataLayout* dp  = data_layout_at(data_size());
+  DataLayout* end = data_layout_at(data_size() + extra_data_size());
+
+  for (;dp < end; dp = MethodData::next_extra(dp)) {
+    switch(dp->tag()) {
+    case DataLayout::no_tag:
+    case DataLayout::arg_info_data_tag:
+      return;
+    case DataLayout::bit_data_tag:
+      break;
+    case DataLayout::speculative_trap_data_tag: {
+      ciSpeculativeTrapData* data = new ciSpeculativeTrapData(dp);
+      ciMethod* m = data->method();
+      if (m != NULL) {
+        if (round == 0) {
+          count++;
+        } else {
+          out->print(" %d ", (int)(dp_to_di(((address)dp) + in_bytes(ciSpeculativeTrapData::method_offset())) / sizeof(intptr_t)));
+          m->dump_name_as_ascii(out);
+        }
+      }
+      break;
+    }
+    default:
+      fatal(err_msg("bad tag = %d", dp->tag()));
+    }
+  }
+}
+
 void ciMethodData::dump_replay_data(outputStream* out) {
   ResourceMark rm;
   MethodData* mdo = get_MethodData();
@@ -527,7 +583,7 @@
   }
 
   // dump the MDO data as raw data
-  int elements = data_size() / sizeof(intptr_t);
+  int elements = (data_size() + extra_data_size()) / sizeof(intptr_t);
   out->print(" data %d", elements);
   for (int i = 0; i < elements; i++) {
     // We could use INTPTR_FORMAT here but that's a zero justified
@@ -544,37 +600,35 @@
   // and emit pairs of offset and klass name so that they can be
   // reconstructed at runtime.  The first round counts the number of
   // oop references and the second actually emits them.
-  int count = 0;
-  for (int round = 0; round < 2; round++) {
+  ciParametersTypeData* parameters = parameters_type_data();
+  for (int count = 0, round = 0; round < 2; round++) {
     if (round == 1) out->print(" oops %d", count);
     ProfileData* pdata = first_data();
     for ( ; is_valid(pdata); pdata = next_data(pdata)) {
-      if (pdata->is_ReceiverTypeData()) {
+      if (pdata->is_VirtualCallData()) {
+        ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
+        dump_replay_data_receiver_type_helper<ciVirtualCallData>(out, round, count, vdata);
+        if (pdata->is_VirtualCallTypeData()) {
+          ciVirtualCallTypeData* call_type_data = (ciVirtualCallTypeData*)pdata;
+          dump_replay_data_call_type_helper<ciVirtualCallTypeData>(out, round, count, call_type_data);
+        }
+      } else if (pdata->is_ReceiverTypeData()) {
         ciReceiverTypeData* vdata = (ciReceiverTypeData*)pdata;
-        for (uint i = 0; i < vdata->row_limit(); i++) {
-          ciKlass* k = vdata->receiver(i);
-          if (k != NULL) {
-            if (round == 0) {
-              count++;
-            } else {
-              out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
-            }
-          }
-        }
-      } else if (pdata->is_VirtualCallData()) {
-        ciVirtualCallData* vdata = (ciVirtualCallData*)pdata;
-        for (uint i = 0; i < vdata->row_limit(); i++) {
-          ciKlass* k = vdata->receiver(i);
-          if (k != NULL) {
-            if (round == 0) {
-              count++;
-            } else {
-              out->print(" %d %s", dp_to_di(vdata->dp() + in_bytes(vdata->receiver_offset(i))) / sizeof(intptr_t), k->name()->as_quoted_ascii());
-            }
-          }
-        }
+        dump_replay_data_receiver_type_helper<ciReceiverTypeData>(out, round, count, vdata);
+      } else if (pdata->is_CallTypeData()) {
+          ciCallTypeData* call_type_data = (ciCallTypeData*)pdata;
+          dump_replay_data_call_type_helper<ciCallTypeData>(out, round, count, call_type_data);
       }
     }
+    if (parameters != NULL) {
+      for (int i = 0; i < parameters->number_of_parameters(); i++) {
+        dump_replay_data_type_helper(out, round, count, parameters, ParametersTypeData::type_offset(i), parameters->valid_parameter_type(i));
+      }
+    }
+  }
+  for (int count = 0, round = 0; round < 2; round++) {
+    if (round == 1) out->print(" methods %d", count);
+    dump_replay_data_extra_data_helper(out, round, count);
   }
   out->cr();
 }
@@ -586,6 +640,10 @@
 
 void ciMethodData::print_data_on(outputStream* st) {
   ResourceMark rm;
+  ciParametersTypeData* parameters = parameters_type_data();
+  if (parameters != NULL) {
+    parameters->print_data_on(st);
+  }
   ciProfileData* data;
   for (data = first_data(); is_valid(data); data = next_data(data)) {
     st->print("%d", dp_to_di(data->dp()));
@@ -607,6 +665,9 @@
       data = new ciArgInfoData(dp);
       dp = end; // ArgInfoData is at the end of extra data section.
       break;
+    case DataLayout::speculative_trap_data_tag:
+      data = new ciSpeculativeTrapData(dp);
+      break;
     default:
       fatal(err_msg("unexpected tag %d", dp->tag()));
     }
@@ -631,7 +692,7 @@
 }
 
 void ciTypeStackSlotEntries::print_data_on(outputStream* st) const {
-  for (int i = 0; i < _number_of_entries; i++) {
+  for (int i = 0; i < number_of_entries(); i++) {
     _pd->tab(st);
     st->print("%d: stack (%u) ", i, stack_slot(i));
     print_ciklass(st, type(i));
@@ -650,12 +711,12 @@
   print_shared(st, "ciCallTypeData", extra);
   if (has_arguments()) {
     tab(st, true);
-    st->print("argument types");
+    st->print_cr("argument types");
     args()->print_data_on(st);
   }
   if (has_return()) {
     tab(st, true);
-    st->print("return type");
+    st->print_cr("return type");
     ret()->print_data_on(st);
   }
 }
--- a/src/share/vm/ci/ciMethodData.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciMethodData.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -45,7 +45,7 @@
 class ciCallTypeData;
 class ciVirtualCallTypeData;
 class ciParametersTypeData;
-class ciSpeculativeTrapData;;
+class ciSpeculativeTrapData;
 
 typedef ProfileData ciProfileData;
 
@@ -175,7 +175,7 @@
   }
 
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -202,7 +202,7 @@
   }
   void translate_receiver_data_from(const ProfileData* data);
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
   void print_receiver_data_on(outputStream* st) const;
 #endif
 };
@@ -227,7 +227,7 @@
     rtd_super()->translate_receiver_data_from(data);
   }
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -289,7 +289,7 @@
   }
 
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -338,7 +338,7 @@
   }
 
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -349,15 +349,15 @@
   virtual void translate_from(const ProfileData* data);
 
   ciMethod* method() const {
-    return (ciMethod*)intptr_at(method_offset);
+    return (ciMethod*)intptr_at(speculative_trap_method);
   }
 
   void set_method(ciMethod* m) {
-    set_intptr_at(method_offset, (intptr_t)m);
+    set_intptr_at(speculative_trap_method, (intptr_t)m);
   }
 
 #ifndef PRODUCT
-  void print_data_on(outputStream* st, const char* extra) const;
+  void print_data_on(outputStream* st, const char* extra = NULL) const;
 #endif
 };
 
@@ -406,8 +406,8 @@
   // Coherent snapshot of original header.
   MethodData _orig;
 
-  // Dedicated area dedicated to parameters. Null if no parameter
-  // profiling for this method.
+  // Area dedicated to parameters. NULL if no parameter profiling for
+  // this method.
   DataLayout* _parameters;
 
   ciMethodData(MethodData* md);
@@ -467,6 +467,11 @@
   void load_extra_data();
   ciProfileData* bci_to_extra_data(int bci, ciMethod* m, bool& two_free_slots);
 
+  void dump_replay_data_type_helper(outputStream* out, int round, int& count, ProfileData* pdata, ByteSize offset, ciKlass* k);
+  template<class T> void dump_replay_data_call_type_helper(outputStream* out, int round, int& count, T* call_type_data);
+  template<class T> void dump_replay_data_receiver_type_helper(outputStream* out, int round, int& count, T* call_type_data);
+  void dump_replay_data_extra_data_helper(outputStream* out, int round, int& count);
+
 public:
   bool is_method_data() const { return true; }
 
--- a/src/share/vm/ci/ciObject.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciObject.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -181,9 +181,8 @@
     if (klass() == env->String_klass() || klass() == env->Class_klass()) {
       return true;
     }
-  if (EnableInvokeDynamic &&
-      (klass()->is_subclass_of(env->MethodHandle_klass()) ||
-       klass()->is_subclass_of(env->CallSite_klass()))) {
+  if (klass()->is_subclass_of(env->MethodHandle_klass()) ||
+      klass()->is_subclass_of(env->CallSite_klass())) {
     assert(ScavengeRootsInCode >= 1, "must be");
     // We want to treat these aggressively.
     return true;
@@ -214,9 +213,9 @@
 void ciObject::print(outputStream* st) {
   st->print("<%s", type_string());
   GUARDED_VM_ENTRY(print_impl(st);)
-  st->print(" ident=%d %s address=0x%x>", ident(),
+  st->print(" ident=%d %s address=" INTPTR_FORMAT ">", ident(),
         is_scavengable() ? "SCAVENGABLE" : "",
-        (address)this);
+        p2i((address)this));
 }
 
 // ------------------------------------------------------------------
--- a/src/share/vm/ci/ciReplay.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciReplay.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -48,11 +48,14 @@
 
   intptr_t* _data;
   char*     _orig_data;
-  jobject*  _oops_handles;
-  int*      _oops_offsets;
+  Klass**   _classes;
+  Method**  _methods;
+  int*      _classes_offsets;
+  int*      _methods_offsets;
   int       _data_length;
   int       _orig_data_length;
-  int       _oops_length;
+  int       _classes_length;
+  int       _methods_length;
 } ciMethodDataRecord;
 
 typedef struct _ciMethodRecord {
@@ -376,11 +379,15 @@
     int c = getc(_stream);
     while(c != EOF) {
       c = get_line(c);
-      process_command(CHECK);
+      process_command(THREAD);
       if (had_error()) {
         tty->print_cr("Error while parsing line %d: %s\n", line_no, _error_message);
-        tty->print_cr("%s", _buffer);
-        return;
+        if (ReplayIgnoreInitErrors) {
+          CLEAR_PENDING_EXCEPTION;
+          _error_message = NULL;
+        } else {
+          return;
+        }
       }
       line_no++;
     }
@@ -561,14 +568,18 @@
     rec->_instructions_size = parse_int("instructions_size");
   }
 
-  // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length>
+  // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length> # ... methods <length>
   void process_ciMethodData(TRAPS) {
     Method* method = parse_method(CHECK);
     if (had_error()) return;
-    /* jsut copied from Method, to build interpret data*/
+    /* just copied from Method, to build interpret data*/
     if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
       return;
     }
+    // To be properly initialized, some profiling in the MDO needs the
+    // method to be rewritten (number of arguments at a call for
+    // instance)
+    method->method_holder()->link_class(CHECK);
     // methodOopDesc::build_interpreter_method_data(method, CHECK);
     {
       // Grab a lock here to prevent multiple
@@ -594,21 +605,34 @@
     if (rec->_data == NULL) {
       return;
     }
-    if (!parse_tag_and_count("oops", rec->_oops_length)) {
+    if (!parse_tag_and_count("oops", rec->_classes_length)) {
       return;
     }
-    rec->_oops_handles = NEW_RESOURCE_ARRAY(jobject, rec->_oops_length);
-    rec->_oops_offsets = NEW_RESOURCE_ARRAY(int, rec->_oops_length);
-    for (int i = 0; i < rec->_oops_length; i++) {
+    rec->_classes = NEW_RESOURCE_ARRAY(Klass*, rec->_classes_length);
+    rec->_classes_offsets = NEW_RESOURCE_ARRAY(int, rec->_classes_length);
+    for (int i = 0; i < rec->_classes_length; i++) {
       int offset = parse_int("offset");
       if (had_error()) {
         return;
       }
       Klass* k = parse_klass(CHECK);
-      rec->_oops_offsets[i] = offset;
-      KlassHandle *kh = NEW_C_HEAP_OBJ(KlassHandle, mtCompiler);
-      ::new ((void*)kh) KlassHandle(THREAD, k);
-      rec->_oops_handles[i] = (jobject)kh;
+      rec->_classes_offsets[i] = offset;
+      rec->_classes[i] = k;
+    }
+
+    if (!parse_tag_and_count("methods", rec->_methods_length)) {
+      return;
+    }
+    rec->_methods = NEW_RESOURCE_ARRAY(Method*, rec->_methods_length);
+    rec->_methods_offsets = NEW_RESOURCE_ARRAY(int, rec->_methods_length);
+    for (int i = 0; i < rec->_methods_length; i++) {
+      int offset = parse_int("offset");
+      if (had_error()) {
+        return;
+      }
+      Method* m = parse_method(CHECK);
+      rec->_methods_offsets[i] = offset;
+      rec->_methods[i] = m;
     }
   }
 
@@ -1097,14 +1121,22 @@
     m->_state = rec->_state;
     m->_current_mileage = rec->_current_mileage;
     if (rec->_data_length != 0) {
-      assert(m->_data_size == rec->_data_length * (int)sizeof(rec->_data[0]), "must agree");
+      assert(m->_data_size + m->_extra_data_size == rec->_data_length * (int)sizeof(rec->_data[0]) ||
+             m->_data_size == rec->_data_length * (int)sizeof(rec->_data[0]), "must agree");
 
       // Write the correct ciObjects back into the profile data
       ciEnv* env = ciEnv::current();
-      for (int i = 0; i < rec->_oops_length; i++) {
-        KlassHandle *h = (KlassHandle *)rec->_oops_handles[i];
-        *(ciMetadata**)(rec->_data + rec->_oops_offsets[i]) =
-          env->get_metadata((*h)());
+      for (int i = 0; i < rec->_classes_length; i++) {
+        Klass *k = rec->_classes[i];
+        // In case this class pointer is is tagged, preserve the tag
+        // bits
+        rec->_data[rec->_classes_offsets[i]] =
+          ciTypeEntries::with_status(env->get_metadata(k)->as_klass(), rec->_data[rec->_classes_offsets[i]]);
+      }
+      for (int i = 0; i < rec->_methods_length; i++) {
+        Method *m = rec->_methods[i];
+        *(ciMetadata**)(rec->_data + rec->_methods_offsets[i]) =
+          env->get_metadata(m);
       }
       // Copy the updated profile data into place as intptr_ts
 #ifdef _LP64
--- a/src/share/vm/ci/ciSignature.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciSignature.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -148,5 +148,5 @@
   print_signature();
  tty->print(" accessing_klass=");
   _accessing_klass->print();
-  tty->print(" address=0x%x>", (address)this);
+  tty->print(" address=" INTPTR_FORMAT ">", p2i((address)this));
 }
--- a/src/share/vm/ci/ciType.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/ci/ciType.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
 // Print the name of this type
 void ciType::print_name_on(outputStream* st) {
   ResourceMark rm;
-  st->print(name());
+  st->print("%s", name());
 }
 
 
--- a/src/share/vm/classfile/classFileError.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/classFileError.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,9 @@
 
 // Keep these in a separate file to prevent inlining
 
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
+
 void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) {
     ResourceMark rm(THREAD);
     Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),
@@ -53,6 +56,8 @@
                        msg, index, name, _class_name->as_C_string());
 }
 
+PRAGMA_DIAG_POP
+
 void StackMapStream::stackmap_format_error(const char* msg, TRAPS) {
   ResourceMark rm(THREAD);
   Exceptions::fthrow(
--- a/src/share/vm/classfile/classFileParser.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/classFileParser.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -164,11 +164,6 @@
             "Class file version does not support constant tag %u in class file %s",
             tag, CHECK);
         }
-        if (!EnableInvokeDynamic) {
-          classfile_parse_error(
-            "This JVM does not support constant tag %u in class file %s",
-            tag, CHECK);
-        }
         if (tag == JVM_CONSTANT_MethodHandle) {
           cfs->guarantee_more(4, CHECK);  // ref_kind, method_index, tag/access_flags
           u1 ref_kind = cfs->get_u1_fast();
@@ -189,11 +184,6 @@
               "Class file version does not support constant tag %u in class file %s",
               tag, CHECK);
           }
-          if (!EnableInvokeDynamic) {
-            classfile_parse_error(
-              "This JVM does not support constant tag %u in class file %s",
-              tag, CHECK);
-          }
           cfs->guarantee_more(5, CHECK);  // bsm_index, nt, tag/access_flags
           u2 bootstrap_specifier_index = cfs->get_u2_fast();
           u2 name_and_type_index = cfs->get_u2_fast();
@@ -263,7 +253,7 @@
             verify_legal_utf8((unsigned char*)utf8_buffer, utf8_length, CHECK);
           }
 
-          if (EnableInvokeDynamic && has_cp_patch_at(index)) {
+          if (has_cp_patch_at(index)) {
             Handle patch = clear_cp_patch_at(index);
             guarantee_property(java_lang_String::is_instance(patch()),
                                "Illegal utf8 patch at %d in class file %s",
@@ -419,8 +409,7 @@
         {
           int ref_index = cp->method_handle_index_at(index);
           check_property(
-            valid_cp_range(ref_index, length) &&
-                EnableInvokeDynamic,
+            valid_cp_range(ref_index, length),
               "Invalid constant pool index %u in class file %s",
               ref_index, CHECK_(nullHandle));
           constantTag tag = cp->tag_at(ref_index);
@@ -466,7 +455,7 @@
       case JVM_CONSTANT_MethodType :
         {
           int ref_index = cp->method_type_index_at(index);
-          check_property(valid_symbol_at(ref_index) && EnableInvokeDynamic,
+          check_property(valid_symbol_at(ref_index),
                  "Invalid constant pool index %u in class file %s",
                  ref_index, CHECK_(nullHandle));
         }
@@ -492,7 +481,6 @@
 
   if (_cp_patches != NULL) {
     // need to treat this_class specially...
-    assert(EnableInvokeDynamic, "");
     int this_class_index;
     {
       cfs->guarantee_more(8, CHECK_(nullHandle));  // flags, this_class, super_class, infs_len
@@ -640,7 +628,6 @@
 
 
 void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) {
-  assert(EnableInvokeDynamic, "");
   BasicType patch_type = T_VOID;
 
   switch (cp->tag_at(index).value()) {
@@ -888,6 +875,7 @@
   int runtime_visible_type_annotations_length = 0;
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
+  bool runtime_invisible_annotations_exists = false;
   bool runtime_invisible_type_annotations_exists = false;
   while (attributes_count--) {
     cfs->guarantee_more(6, CHECK);  // attribute_name_index, attribute_length
@@ -933,6 +921,10 @@
         }
         generic_signature_index = cfs->get_u2(CHECK);
       } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes for field in class file %s", CHECK);
+        }
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -941,11 +933,18 @@
                           parsed_annotations,
                           CHECK);
         cfs->skip_u1(runtime_visible_annotations_length, CHECK);
-      } else if (PreserveAllAnnotations && attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK);
+      } else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes for field in class file %s", CHECK);
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(attribute_length, CHECK);
       } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) {
         if (runtime_visible_type_annotations != NULL) {
           classfile_parse_error(
@@ -2079,7 +2078,9 @@
   int runtime_visible_type_annotations_length = 0;
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
+  bool runtime_invisible_annotations_exists = false;
   bool runtime_invisible_type_annotations_exists = false;
+  bool runtime_invisible_parameter_annotations_exists = false;
   u1* annotation_default = NULL;
   int annotation_default_length = 0;
 
@@ -2308,6 +2309,10 @@
         cfs->guarantee_more(2, CHECK_(nullHandle));  // generic_signature_index
         generic_signature_index = cfs->get_u2_fast();
       } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
         runtime_visible_annotations_length = method_attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -2315,22 +2320,45 @@
             runtime_visible_annotations_length, &parsed_annotations,
             CHECK_(nullHandle));
         cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle));
-      } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = method_attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK_(nullHandle));
+      } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = method_attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
       } else if (method_attribute_name == vmSymbols::tag_runtime_visible_parameter_annotations()) {
+        if (runtime_visible_parameter_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
         runtime_visible_parameter_annotations_length = method_attribute_length;
         runtime_visible_parameter_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_parameter_annotations != NULL, "null visible parameter annotations");
         cfs->skip_u1(runtime_visible_parameter_annotations_length, CHECK_(nullHandle));
-      } else if (PreserveAllAnnotations && method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) {
-        runtime_invisible_parameter_annotations_length = method_attribute_length;
-        runtime_invisible_parameter_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations");
-        cfs->skip_u1(runtime_invisible_parameter_annotations_length, CHECK_(nullHandle));
+      } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) {
+        if (runtime_invisible_parameter_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle));
+        }
+        runtime_invisible_parameter_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_parameter_annotations_length = method_attribute_length;
+          runtime_invisible_parameter_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations");
+        }
+        cfs->skip_u1(method_attribute_length, CHECK_(nullHandle));
       } else if (method_attribute_name == vmSymbols::tag_annotation_default()) {
+        if (annotation_default != NULL) {
+          classfile_parse_error(
+            "Multiple AnnotationDefault attributes for method in class file %s",
+            CHECK_(nullHandle));
+        }
         annotation_default_length = method_attribute_length;
         annotation_default = cfs->get_u1_buffer();
         assert(annotation_default != NULL, "null annotation default");
@@ -2777,7 +2805,7 @@
                      "Short length on BootstrapMethods in class file %s",
                      CHECK);
 
-  guarantee_property(attribute_byte_length > sizeof(u2),
+  guarantee_property(attribute_byte_length >= sizeof(u2),
                      "Invalid BootstrapMethods attribute length %u in class file %s",
                      attribute_byte_length,
                      CHECK);
@@ -2859,6 +2887,8 @@
   u1* runtime_invisible_type_annotations = NULL;
   int runtime_invisible_type_annotations_length = 0;
   bool runtime_invisible_type_annotations_exists = false;
+  bool runtime_invisible_annotations_exists = false;
+  bool parsed_source_debug_ext_annotations_exist = false;
   u1* inner_classes_attribute_start = NULL;
   u4  inner_classes_attribute_length = 0;
   u2  enclosing_method_class_index = 0;
@@ -2886,6 +2916,11 @@
       parse_classfile_sourcefile_attribute(CHECK);
     } else if (tag == vmSymbols::tag_source_debug_extension()) {
       // Check for SourceDebugExtension tag
+      if (parsed_source_debug_ext_annotations_exist) {
+          classfile_parse_error(
+            "Multiple SourceDebugExtension attributes in class file %s", CHECK);
+      }
+      parsed_source_debug_ext_annotations_exist = true;
       parse_classfile_source_debug_extension_attribute((int)attribute_length, CHECK);
     } else if (tag == vmSymbols::tag_inner_classes()) {
       // Check for InnerClasses tag
@@ -2922,6 +2957,10 @@
         }
         parse_classfile_signature_attribute(CHECK);
       } else if (tag == vmSymbols::tag_runtime_visible_annotations()) {
+        if (runtime_visible_annotations != NULL) {
+          classfile_parse_error(
+            "Multiple RuntimeVisibleAnnotations attributes in class file %s", CHECK);
+        }
         runtime_visible_annotations_length = attribute_length;
         runtime_visible_annotations = cfs->get_u1_buffer();
         assert(runtime_visible_annotations != NULL, "null visible annotations");
@@ -2930,11 +2969,18 @@
                           parsed_annotations,
                           CHECK);
         cfs->skip_u1(runtime_visible_annotations_length, CHECK);
-      } else if (PreserveAllAnnotations && tag == vmSymbols::tag_runtime_invisible_annotations()) {
-        runtime_invisible_annotations_length = attribute_length;
-        runtime_invisible_annotations = cfs->get_u1_buffer();
-        assert(runtime_invisible_annotations != NULL, "null invisible annotations");
-        cfs->skip_u1(runtime_invisible_annotations_length, CHECK);
+      } else if (tag == vmSymbols::tag_runtime_invisible_annotations()) {
+        if (runtime_invisible_annotations_exists) {
+          classfile_parse_error(
+            "Multiple RuntimeInvisibleAnnotations attributes in class file %s", CHECK);
+        }
+        runtime_invisible_annotations_exists = true;
+        if (PreserveAllAnnotations) {
+          runtime_invisible_annotations_length = attribute_length;
+          runtime_invisible_annotations = cfs->get_u1_buffer();
+          assert(runtime_invisible_annotations != NULL, "null invisible annotations");
+        }
+        cfs->skip_u1(attribute_length, CHECK);
       } else if (tag == vmSymbols::tag_enclosing_method()) {
         if (parsed_enclosingmethod_attribute) {
           classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK);
--- a/src/share/vm/classfile/classFileParser.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/classFileParser.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -312,7 +312,9 @@
     if (!b) { classfile_parse_error(msg, CHECK); }
   }
 
-  inline void assert_property(bool b, const char* msg, TRAPS) {
+PRAGMA_DIAG_PUSH
+PRAGMA_FORMAT_NONLITERAL_IGNORED
+inline void assert_property(bool b, const char* msg, TRAPS) {
 #ifdef ASSERT
     if (!b) {
       ResourceMark rm(THREAD);
@@ -329,6 +331,7 @@
     }
 #endif
   }
+PRAGMA_DIAG_POP
 
   inline void check_property(bool property, const char* msg, int index, TRAPS) {
     if (_need_verify) {
@@ -377,11 +380,9 @@
   char* skip_over_field_signature(char* signature, bool void_ok, unsigned int length, TRAPS);
 
   bool is_anonymous() {
-    assert(EnableInvokeDynamic || _host_klass.is_null(), "");
     return _host_klass.not_null();
   }
   bool has_cp_patch_at(int index) {
-    assert(EnableInvokeDynamic, "");
     assert(index >= 0, "oob");
     return (_cp_patches != NULL
             && index < _cp_patches->length()
@@ -404,10 +405,7 @@
   // constant pool construction, but in later versions they can.
   // %%% Let's phase out the old is_klass_reference.
   bool valid_klass_reference_at(int index) {
-    return _cp->is_within_bounds(index) &&
-         (EnableInvokeDynamic
-            ? _cp->tag_at(index).is_klass_or_reference()
-            : _cp->tag_at(index).is_klass_reference());
+    return _cp->is_within_bounds(index) && _cp->tag_at(index).is_klass_or_reference();
   }
 
   // Checks that the cpool index is in range and is a utf8
--- a/src/share/vm/classfile/classLoader.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/classLoader.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -345,7 +345,7 @@
   tty->print("[Meta index for %s=", entry->name());
   for (int i = 0; i < meta_packages.length(); i++) {
     if (i > 0) tty->print(" ");
-    tty->print(meta_packages.at(i));
+    tty->print("%s", meta_packages.at(i));
   }
   tty->print_cr("]");
 }
@@ -1325,7 +1325,7 @@
     e = e->next();
   }
   jlong end = os::javaTimeMillis();
-  tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, %d ms)",
+  tty->print_cr("CompileTheWorld : Done (%d classes, %d methods, " JLONG_FORMAT " ms)",
                 _compile_the_world_class_counter, _compile_the_world_method_counter, (end - start));
   {
     // Print statistics as if before normal exit:
--- a/src/share/vm/classfile/classLoaderData.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/classLoaderData.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -281,10 +281,10 @@
     ResourceMark rm;
     tty->print_cr("[TraceClassLoaderData] Adding k: " PTR_FORMAT " %s to CLD: "
                   PTR_FORMAT " loader: " PTR_FORMAT " %s",
-                  k,
+                  p2i(k),
                   k->external_name(),
-                  k->class_loader_data(),
-                  (void *)k->class_loader(),
+                  p2i(k->class_loader_data()),
+                  p2i((void *)k->class_loader()),
                   loader_name());
   }
 }
@@ -319,11 +319,11 @@
 
   if (TraceClassLoaderData) {
     ResourceMark rm;
-    tty->print("[ClassLoaderData: unload loader data "PTR_FORMAT, this);
-    tty->print(" for instance "PTR_FORMAT" of %s", (void *)class_loader(),
+    tty->print("[ClassLoaderData: unload loader data " INTPTR_FORMAT, p2i(this));
+    tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)class_loader()),
                loader_name());
     if (is_anonymous()) {
-      tty->print(" for anonymous class  "PTR_FORMAT " ", _klasses);
+      tty->print(" for anonymous class  " INTPTR_FORMAT " ", p2i(_klasses));
     }
     tty->print_cr("]");
   }
@@ -485,14 +485,14 @@
 void ClassLoaderData::dump(outputStream * const out) {
   ResourceMark rm;
   out->print("ClassLoaderData CLD: "PTR_FORMAT", loader: "PTR_FORMAT", loader_klass: "PTR_FORMAT" %s {",
-      this, (void *)class_loader(),
-      class_loader() != NULL ? class_loader()->klass() : NULL, loader_name());
+      p2i(this), p2i((void *)class_loader()),
+      p2i(class_loader() != NULL ? class_loader()->klass() : NULL), loader_name());
   if (claimed()) out->print(" claimed ");
   if (is_unloading()) out->print(" unloading ");
-  out->print(" handles " INTPTR_FORMAT, handles());
+  out->print(" handles " INTPTR_FORMAT, p2i(handles()));
   out->cr();
   if (metaspace_or_null() != NULL) {
-    out->print_cr("metaspace: " PTR_FORMAT, metaspace_or_null());
+    out->print_cr("metaspace: " INTPTR_FORMAT, p2i(metaspace_or_null()));
     metaspace_or_null()->dump(out);
   } else {
     out->print_cr("metaspace: NULL");
@@ -549,6 +549,8 @@
 ClassLoaderData* ClassLoaderDataGraph::_unloading = NULL;
 ClassLoaderData* ClassLoaderDataGraph::_saved_head = NULL;
 
+bool ClassLoaderDataGraph::_should_purge = false;
+
 // Add a new class loader data node to the list.  Assign the newly created
 // ClassLoaderData into the java/lang/ClassLoader object as a hidden field
 ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_anonymous, TRAPS) {
@@ -586,8 +588,8 @@
       if (TraceClassLoaderData) {
         ResourceMark rm;
         tty->print("[ClassLoaderData: ");
-        tty->print("create class loader data "PTR_FORMAT, cld);
-        tty->print(" for instance "PTR_FORMAT" of %s", (void *)cld->class_loader(),
+        tty->print("create class loader data " INTPTR_FORMAT, p2i(cld));
+        tty->print(" for instance " INTPTR_FORMAT " of %s", p2i((void *)cld->class_loader()),
                    cld->loader_name());
         tty->print_cr("]");
       }
@@ -675,32 +677,6 @@
   return array;
 }
 
-// For profiling and hsfind() only.  Otherwise, this is unsafe (and slow).  This
-// is done lock free to avoid lock inversion problems.  It is safe because
-// new ClassLoaderData are added to the end of the CLDG, and only removed at
-// safepoint.  The _unloading list can be deallocated concurrently with CMS so
-// this doesn't look in metaspace for classes that have been unloaded.
-bool ClassLoaderDataGraph::contains(const void* x) {
-  if (DumpSharedSpaces) {
-    // There are only two metaspaces to worry about.
-    ClassLoaderData* ncld = ClassLoaderData::the_null_class_loader_data();
-    return (ncld->ro_metaspace()->contains(x) || ncld->rw_metaspace()->contains(x));
-  }
-
-  if (UseSharedSpaces && MetaspaceShared::is_in_shared_space(x)) {
-    return true;
-  }
-
-  for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
-    if (cld->metaspace_or_null() != NULL && cld->metaspace_or_null()->contains(x)) {
-      return true;
-    }
-  }
-
-  // Do not check unloading list because deallocation can be concurrent.
-  return false;
-}
-
 #ifndef PRODUCT
 bool ClassLoaderDataGraph::contains_loader_data(ClassLoaderData* loader_data) {
   for (ClassLoaderData* data = _head; data != NULL; data = data->next()) {
@@ -759,6 +735,7 @@
 }
 
 void ClassLoaderDataGraph::purge() {
+  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint!");
   ClassLoaderData* list = _unloading;
   _unloading = NULL;
   ClassLoaderData* next = list;
@@ -847,7 +824,7 @@
   if (class_loader() == NULL) {
     out->print("NULL class_loader");
   } else {
-    out->print("class loader "PTR_FORMAT, this);
+    out->print("class loader " INTPTR_FORMAT, p2i(this));
     class_loader()->print_value_on(out);
   }
 }
--- a/src/share/vm/classfile/classLoaderData.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/classLoaderData.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -66,6 +66,7 @@
   static ClassLoaderData* _unloading;
   // CMS support.
   static ClassLoaderData* _saved_head;
+  static bool _should_purge;
 
   static ClassLoaderData* add(Handle class_loader, bool anonymous, TRAPS);
   static void post_class_unload_events(void);
@@ -87,12 +88,20 @@
   static void remember_new_clds(bool remember) { _saved_head = (remember ? _head : NULL); }
   static GrowableArray<ClassLoaderData*>* new_clds();
 
+  static void set_should_purge(bool b) { _should_purge = b; }
+  static void purge_if_needed() {
+    // Only purge the CLDG for CMS if concurrent sweep is complete.
+    if (_should_purge) {
+      purge();
+      // reset for next time.
+      set_should_purge(false);
+    }
+  }
+
   static void dump_on(outputStream * const out) PRODUCT_RETURN;
   static void dump() { dump_on(tty); }
   static void verify();
 
-  // expensive test for pointer in metaspace for debugging
-  static bool contains(const void* x);
 #ifndef PRODUCT
   static bool contains_loader_data(ClassLoaderData* loader_data);
 #endif
--- a/src/share/vm/classfile/defaultMethods.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/defaultMethods.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -436,7 +436,7 @@
       _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError();
       if (TraceDefaultMethods) {
         _exception_message->print_value_on(tty);
-        tty->print_cr("");
+        tty->cr();
       }
     }
   }
@@ -463,7 +463,7 @@
       if (_members.at(i).second == DISQUALIFIED) {
         str->print(" (disqualified)");
       }
-      str->print_cr("");
+      str->cr();
     }
 
     if (_selected_target != NULL) {
@@ -480,7 +480,7 @@
     if (!method_holder->is_interface()) {
       tty->print(" : in superclass");
     }
-    str->print_cr("");
+    str->cr();
   }
 
   void print_exception(outputStream* str, int indent) {
@@ -688,7 +688,7 @@
     for (int i = 0; i < slots->length(); ++i) {
       tty->indent();
       slots->at(i)->print_on(tty);
-      tty->print_cr("");
+      tty->cr();
     }
   }
 #endif // ndef PRODUCT
@@ -828,7 +828,7 @@
       streamIndentor si(tty, 2);
       tty->indent().print("Looking for default methods for slot ");
       slot->print_on(tty);
-      tty->print_cr("");
+      tty->cr();
     }
 #endif // ndef PRODUCT
 
@@ -946,7 +946,7 @@
       if (TraceDefaultMethods) {
         tty->print("for slot: ");
         slot->print_on(tty);
-        tty->print_cr("");
+        tty->cr();
         if (method->has_target()) {
           method->print_selected(tty, 1);
         } else if (method->throws_exception()) {
--- a/src/share/vm/classfile/dictionary.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/dictionary.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -28,8 +28,10 @@
 #include "memory/iterator.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiRedefineClassesTrace.hpp"
+#include "runtime/orderAccess.inline.hpp"
 #include "utilities/hashtable.inline.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
 DictionaryEntry*  Dictionary::_current_class_entry = NULL;
 int               Dictionary::_current_class_index =    0;
--- a/src/share/vm/classfile/dictionary.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/dictionary.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -379,7 +379,7 @@
     }
     if (method_type() != NULL) {
       if (printed)  st->print(" and ");
-      st->print(INTPTR_FORMAT, (void *)method_type());
+      st->print(INTPTR_FORMAT, p2i((void *)method_type()));
       printed = true;
     }
     st->print_cr(printed ? "" : "(empty)");
--- a/src/share/vm/classfile/javaClasses.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/javaClasses.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/altHashing.hpp"
 #include "classfile/javaClasses.hpp"
-#include "classfile/symbolTable.hpp"
+#include "classfile/stringTable.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "code/debugInfo.hpp"
 #include "code/pcDesc.hpp"
@@ -52,6 +52,8 @@
 #include "runtime/vframe.hpp"
 #include "utilities/preserveException.hpp"
 
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
 #define INJECTED_FIELD_COMPUTE_OFFSET(klass, name, signature, may_be_java)    \
   klass::_##name##_offset = JavaClasses::compute_injected_offset(JavaClasses::klass##_##name##_enum);
 
@@ -1491,7 +1493,7 @@
   while (h_throwable.not_null()) {
     objArrayHandle result (THREAD, objArrayOop(backtrace(h_throwable())));
     if (result.is_null()) {
-      st->print_cr(no_stack_trace_message());
+      st->print_cr("%s", no_stack_trace_message());
       return;
     }
 
@@ -2647,7 +2649,7 @@
 
 void java_lang_invoke_DirectMethodHandle::compute_offsets() {
   Klass* klass_oop = SystemDictionary::DirectMethodHandle_klass();
-  if (klass_oop != NULL && EnableInvokeDynamic) {
+  if (klass_oop != NULL) {
     compute_offset(_member_offset, klass_oop, vmSymbols::member_name(), vmSymbols::java_lang_invoke_MemberName_signature());
   }
 }
@@ -2669,18 +2671,15 @@
 
 void java_lang_invoke_MethodHandle::compute_offsets() {
   Klass* klass_oop = SystemDictionary::MethodHandle_klass();
-  if (klass_oop != NULL && EnableInvokeDynamic) {
+  if (klass_oop != NULL) {
     compute_offset(_type_offset, klass_oop, vmSymbols::type_name(), vmSymbols::java_lang_invoke_MethodType_signature());
-    compute_optional_offset(_form_offset, klass_oop, vmSymbols::form_name(), vmSymbols::java_lang_invoke_LambdaForm_signature());
-    if (_form_offset == 0) {
-      EnableInvokeDynamic = false;
-    }
+    compute_offset(_form_offset, klass_oop, vmSymbols::form_name(), vmSymbols::java_lang_invoke_LambdaForm_signature());
   }
 }
 
 void java_lang_invoke_MemberName::compute_offsets() {
   Klass* klass_oop = SystemDictionary::MemberName_klass();
-  if (klass_oop != NULL && EnableInvokeDynamic) {
+  if (klass_oop != NULL) {
     compute_offset(_clazz_offset,     klass_oop, vmSymbols::clazz_name(),     vmSymbols::class_signature());
     compute_offset(_name_offset,      klass_oop, vmSymbols::name_name(),      vmSymbols::string_signature());
     compute_offset(_type_offset,      klass_oop, vmSymbols::type_name(),      vmSymbols::object_signature());
@@ -2691,7 +2690,7 @@
 
 void java_lang_invoke_LambdaForm::compute_offsets() {
   Klass* klass_oop = SystemDictionary::LambdaForm_klass();
-  if (klass_oop != NULL && EnableInvokeDynamic) {
+  if (klass_oop != NULL) {
     compute_offset(_vmentry_offset, klass_oop, vmSymbols::vmentry_name(), vmSymbols::java_lang_invoke_MemberName_signature());
   }
 }
@@ -2906,7 +2905,6 @@
 int java_lang_invoke_CallSite::_target_offset;
 
 void java_lang_invoke_CallSite::compute_offsets() {
-  if (!EnableInvokeDynamic)  return;
   Klass* k = SystemDictionary::CallSite_klass();
   if (k != NULL) {
     compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_lang_invoke_MethodHandle_signature());
@@ -3317,14 +3315,12 @@
   java_lang_ClassLoader::compute_offsets();
   java_lang_Thread::compute_offsets();
   java_lang_ThreadGroup::compute_offsets();
-  if (EnableInvokeDynamic) {
-    java_lang_invoke_MethodHandle::compute_offsets();
-    java_lang_invoke_DirectMethodHandle::compute_offsets();
-    java_lang_invoke_MemberName::compute_offsets();
-    java_lang_invoke_LambdaForm::compute_offsets();
-    java_lang_invoke_MethodType::compute_offsets();
-    java_lang_invoke_CallSite::compute_offsets();
-  }
+  java_lang_invoke_MethodHandle::compute_offsets();
+  java_lang_invoke_DirectMethodHandle::compute_offsets();
+  java_lang_invoke_MemberName::compute_offsets();
+  java_lang_invoke_LambdaForm::compute_offsets();
+  java_lang_invoke_MethodType::compute_offsets();
+  java_lang_invoke_CallSite::compute_offsets();
   java_security_AccessControlContext::compute_offsets();
   // Initialize reflection classes. The layouts of these classes
   // changed with the new reflection implementation in JDK 1.4, and
--- a/src/share/vm/classfile/resolutionErrors.cpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/resolutionErrors.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,12 +32,13 @@
 
 // add new entry to the table
 void ResolutionErrorTable::add_entry(int index, unsigned int hash,
-                                     constantPoolHandle pool, int cp_index, Symbol* error)
+                                     constantPoolHandle pool, int cp_index,
+                                     Symbol* error, Symbol* message)
 {
   assert_locked_or_safepoint(SystemDictionary_lock);
   assert(!pool.is_null() && error != NULL, "adding NULL obj");
 
-  ResolutionErrorEntry* entry = new_entry(hash, pool(), cp_index, error);
+  ResolutionErrorEntry* entry = new_entry(hash, pool(), cp_index, error, message);
   add_entry(index, entry);
 }
 
@@ -58,19 +59,26 @@
 }
 
 void ResolutionErrorEntry::set_error(Symbol* e) {
-  assert(e == NULL || _error == NULL, "cannot reset error");
+  assert(e != NULL, "must set a value");
   _error = e;
-  if (_error != NULL) _error->increment_refcount();
+  _error->increment_refcount();
+}
+
+void ResolutionErrorEntry::set_message(Symbol* c) {
+  assert(c != NULL, "must set a value");
+  _message = c;
+  _message->increment_refcount();
 }
 
 // create new error entry
 ResolutionErrorEntry* ResolutionErrorTable::new_entry(int hash, ConstantPool* pool,
-                                                      int cp_index, Symbol* error)
+                                                      int cp_index, Symbol* error,
+                                                      Symbol* message)
 {
   ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable<ConstantPool*, mtClass>::new_entry(hash, pool);
   entry->set_cp_index(cp_index);
-  NOT_PRODUCT(entry->set_error(NULL);)
   entry->set_error(error);
+  entry->set_message(message);
 
   return entry;
 }
@@ -79,6 +87,7 @@
   // decrement error refcount
   assert(entry->error() != NULL, "error should be set");
   entry->error()->decrement_refcount();
+  entry->message()->decrement_refcount();
   Hashtable<ConstantPool*, mtClass>::free_entry(entry);
 }
 
--- a/src/share/vm/classfile/resolutionErrors.hpp	Tue May 20 15:59:50 2014 +0200
+++ b/src/share/vm/classfile/resolutionErrors.hpp	Tue Jun 03 14:55:50 2014 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,8 @@
 public:
   ResolutionErrorTable(int table_size);
 
-  ResolutionErrorEntry* new_entry(int hash, ConstantPool* pool, int cp_index, Symbol* error);
+  ResolutionErrorEntry* new_entry(int hash, ConstantPool* pool, int cp_index,
+                                  Symbol* error, Symbol* message);
   void free_entry(ResolutionErrorEntry *entry);
 
   ResolutionErrorEntry* bucket(int i) {
@@ -55,7 +56,7 @@
   }
 
   void add_entry(int index, unsigned int hash,
-                 constantPoolHandle pool, int which, Symbol* error);
+                 constantPoolHandle pool, int which, Symbol* error, Symbol* message);
 
 
   // find error given the constant pool and constant pool index
@@ -79,10 +80,10 @@
  private:
   int               _cp_index;
   Symbol*           _error;
+  Symbol*           _message;
 
  public:
-  ConstantPool*      pool() const               { return (ConstantPool*)literal(); }
-  ConstantPool**   pool_addr()                { return (ConstantPool**)literal_addr(); }
+  ConstantPool*      pool() const               { return literal(); }
 
   int                cp_index() const           { return _cp_index; }
   void               set_cp_index(int cp_index) { _cp_index = cp_index; }
@@ -90,6 +91,9 @@
   Symbol*            error() const              { return _error; }
   void               set_error(Symbol* e);
 
+  Symbol*            message() const            { return _message; }
+  void               set_message(Symbol* c);
+
   ResolutionErrorEntry* next() const {
     return (ResolutionErrorEntry*)HashtableEntry<ConstantPool*, mtClass>::next();
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/classfile/stringTable.cpp	Tue Jun 03 14:55:50 2014 +0200
@@ -0,0 +1,533 @@
+/*
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "classfile/altHashing.hpp"
+#include "classfile/javaClasses.hpp"
+#include "classfile/stringTable.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "gc_interface/collectedHeap.inline.hpp"
+#include "memory/allocation.inline.hpp"
+#include "memory/filemap.hpp"
+#include "memory/gcLocker.inline.hpp"
+#include "oops/oop.inline.hpp"
+#include "oops/oop.inline2.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "utilities/hashtable.inline.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/g1StringDedup.hpp"
+#endif
+
+PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
+
+// the number of buckets a thread claims
+const int ClaimChunkSize = 32;
+
+#ifdef ASSERT
+class StableMemoryChecker : public StackObj {
+  enum { _bufsize = wordSize*4 };
+
+  address _region;
+  jint    _size;
+  u1      _save_buf[_bufsize];
+
+  int sample(u1* save_buf) {
+    if (_size <= _bufsize) {
+      memcpy(save_buf, _region, _size);
+      return _size;
+    } else {
+      // copy head and tail
+      memcpy(&save_buf[0],          _region,                      _bufsize/2);
+      memcpy(&save_buf[_bufsize/2], _region + _size - _bufsize/2, _bufsize/2);
+      return (_bufsize/2)*2;
+    }
+  }
+
+ public:
+  StableMemoryChecker(const void* region, jint size) {
+    _region = (address) region;
+    _size   = size;
+    sample(_save_buf);
+  }
+
+  bool verify() {
+    u1 check_buf[sizeof(_save_buf)];
+    int check_size = sample(check_buf);
+    return (0 == memcmp(_save_buf, check_buf, check_size));
+  }
+
+  void set_region(const void* region) { _region = (address) region; }
+};
+#endif
+
+
+// --------------------------------------------------------------------------
+StringTable* StringTable::_the_table = NULL;
+
+bool StringTable::_needs_rehashing = false;
+
+volatile int StringTable::_parallel_claimed_idx = 0;
+
+// Pick hashing algorithm
+unsigned int StringTable::hash_string(const jchar* s, int len) {
+  return use_alternate_hashcode() ? AltHashing::murmur3_32(seed(), s, len) :
+                                    java_lang_String::hash_code(s, len);
+}
+
+oop StringTable::lookup(int index, jchar* name,
+                        int len, unsigned int hash) {
+  int count = 0;
+  for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
+    count++;
+    if (l->hash() == hash) {
+      if (java_lang_String::equals(l->literal(), name, len)) {
+        return l->literal();
+      }
+    }
+  }
+  // If the bucket size is too deep check if this hash code is insufficient.
+  if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
+    _needs_rehashing = check_rehash_table(count);
+  }
+  return NULL;
+}
+
+
+oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
+                           int len, unsigned int hashValue_arg, TRAPS) {
+
+  assert(java_lang_String::equals(string(), name, len),
+         "string must be properly initialized");
+  // Cannot hit a safepoint in this function because the "this" pointer can move.
+  No_Safepoint_Verifier nsv;
+
+  // Check if the symbol table has been rehashed, if so, need to recalculate
+  // the hash value and index before second lookup.
+  unsigned int hashValue;
+  int index;
+  if (use_alternate_hashcode()) {
+    hashValue = hash_string(name, len);
+    index = hash_to_index(hashValue);
+  } else {
+    hashValue = hashValue_arg;
+    index = index_arg;
+  }
+
+  // Since look-up was done lock-free, we need to check if another
+  // thread beat us in the race to insert the symbol.
+
+  oop test = lookup(index, name, len, hashValue); // calls lookup(u1*, int)
+  if (test != NULL) {
+    // Entry already added
+    return test;
+  }
+
+  HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
+  add_entry(index, entry);
+  return string();
+}
+
+
+oop StringTable::lookup(Symbol* symbol) {
+  ResourceMark rm;
+  int length;
+  jchar* chars = symbol->as_unicode(length);
+  return lookup(chars, length);
+}
+
+
+oop StringTable::lookup(jchar* name, int len) {
+  unsigned int hash = hash_string(name, len);
+  int index = the_table()->hash_to_index(hash);
+  return the_table()->lookup(index, name, len, hash);
+}
+
+
+oop StringTable::intern(Handle string_or_null, jchar* name,
+                        int len, TRAPS) {
+  unsigned int hashValue = hash_string(name, len);
+  int index = the_table()->hash_to_index(hashValue);
+  oop found_string = the_table()->lookup(index, name, len, hashValue);
+
+  // Found
+  if (found_string != NULL) return found_string;
+
+  debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
+  assert(!Universe::heap()->is_in_reserved(name),
+         "proposed name of symbol must be stable");
+
+  Handle string;
+  // try to reuse the string if possible
+  if (!string_or_null.is_null()) {
+    string = string_or_null;
+  } else {
+    string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
+  }
+
+#if INCLUDE_ALL_GCS
+  if (G1StringDedup::is_enabled()) {
+    // Deduplicate the string before it is interned. Note that we should never
+    // deduplicate a string after it has been interned. Doing so will counteract
+    // compiler optimizations done on e.g. interned string literals.
+    G1StringDedup::deduplicate(string());
+  }
+#endif
+
+  // Grab the StringTable_lock before getting the_table() because it could
+  // change at safepoint.
+  MutexLocker ml(StringTable_lock, THREAD);
+
+  // Otherwise, add to symbol to table
+  return the_table()->basic_add(index, string, name, len,
+                                hashValue, CHECK_NULL);
+}
+
+oop StringTable::intern(Symbol* symbol, TRAPS) {
+  if (symbol == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length;
+  jchar* chars = symbol->as_unicode(length);
+  Handle string;
+  oop result = intern(string, chars, length, CHECK_NULL);
+  return result;
+}
+
+
+oop StringTable::intern(oop string, TRAPS)
+{
+  if (string == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length;
+  Handle h_string (THREAD, string);
+  jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL);
+  oop result = intern(h_string, chars, length, CHECK_NULL);
+  return result;
+}
+
+
+oop StringTable::intern(const char* utf8_string, TRAPS) {
+  if (utf8_string == NULL) return NULL;
+  ResourceMark rm(THREAD);
+  int length = UTF8::unicode_length(utf8_string);
+  jchar* chars = NEW_RESOURCE_ARRAY(jchar, length);
+  UTF8::convert_to_unicode(utf8_string, chars, length);
+  Handle string;
+  oop result = intern(string, chars, length, CHECK_NULL);
+  return result;
+}