changeset 5733:fc1632f5021a

Merge
author iveresov
date Mon, 28 Oct 2013 17:32:02 -0700
parents f94a9f0746d8 (diff) 8c16f426dbb2 (current diff)
children a57a165b8296
files
diffstat 51 files changed, 578 insertions(+), 169 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Oct 28 15:16:17 2013 -0700
+++ b/.hgtags	Mon Oct 28 17:32:02 2013 -0700
@@ -387,3 +387,5 @@
 4a845c7a463844cead9e1e1641d6bcfb8a77f1c7 hs25-b54
 0ed9a90f45e1b392c671005f9ee22ce1acf02984 jdk8-b112
 23b8db5ea31d3079f1326afde4cd5c67b1dac49c hs25-b55
+4589b398ab03aba6a5da8c06ff53603488d1b8f4 jdk8-b113
+82a9cdbf683e374a76f2009352de53e16bed5a91 hs25-b56
--- a/agent/src/os/linux/ps_core.c	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/os/linux/ps_core.c	Mon Oct 28 17:32:02 2013 -0700
@@ -719,7 +719,7 @@
   ELF_PHDR* phbuf;
   ELF_PHDR* lib_php = NULL;
 
-  int page_size=sysconf(_SC_PAGE_SIZE);
+  int page_size = sysconf(_SC_PAGE_SIZE);
 
   if ((phbuf = read_program_header_table(lib_fd, lib_ehdr)) == NULL) {
     return false;
@@ -736,26 +736,29 @@
 
       if (existing_map == NULL){
         if (add_map_info(ph, lib_fd, lib_php->p_offset,
-                          target_vaddr, lib_php->p_filesz) == NULL) {
+                          target_vaddr, lib_php->p_memsz) == NULL) {
           goto err;
         }
       } else {
+        // Coredump stores value of p_memsz elf field
+        // rounded up to page boundary.
+
         if ((existing_map->memsz != page_size) &&
             (existing_map->fd != lib_fd) &&
-            (existing_map->memsz != lib_php->p_filesz)){
+            (ROUNDUP(existing_map->memsz, page_size) != ROUNDUP(lib_php->p_memsz, page_size))) {
 
-          print_debug("address conflict @ 0x%lx (size = %ld, flags = %d\n)",
-                        target_vaddr, lib_php->p_filesz, lib_php->p_flags);
+          print_debug("address conflict @ 0x%lx (existing map size = %ld, size = %ld, flags = %d)\n",
+                        target_vaddr, existing_map->memsz, lib_php->p_memsz, lib_php->p_flags);
           goto err;
         }
 
         /* replace PT_LOAD segment with library segment */
         print_debug("overwrote with new address mapping (memsz %ld -> %ld)\n",
-                     existing_map->memsz, lib_php->p_filesz);
+                     existing_map->memsz, ROUNDUP(lib_php->p_memsz, page_size));
 
         existing_map->fd = lib_fd;
         existing_map->offset = lib_php->p_offset;
-        existing_map->memsz = lib_php->p_filesz;
+        existing_map->memsz = ROUNDUP(lib_php->p_memsz, page_size);
       }
     }
 
--- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstMethod.java	Mon Oct 28 17:32:02 2013 -0700
@@ -51,6 +51,7 @@
   private static int HAS_GENERIC_SIGNATURE;
   private static int HAS_METHOD_ANNOTATIONS;
   private static int HAS_PARAMETER_ANNOTATIONS;
+  private static int HAS_METHOD_PARAMETERS;
   private static int HAS_DEFAULT_ANNOTATIONS;
   private static int HAS_TYPE_ANNOTATIONS;
 
@@ -70,6 +71,7 @@
     HAS_GENERIC_SIGNATURE     = db.lookupIntConstant("ConstMethod::_has_generic_signature").intValue();
     HAS_METHOD_ANNOTATIONS    = db.lookupIntConstant("ConstMethod::_has_method_annotations").intValue();
     HAS_PARAMETER_ANNOTATIONS = db.lookupIntConstant("ConstMethod::_has_parameter_annotations").intValue();
+    HAS_METHOD_PARAMETERS = db.lookupIntConstant("ConstMethod::_has_method_parameters").intValue();
     HAS_DEFAULT_ANNOTATIONS   = db.lookupIntConstant("ConstMethod::_has_default_annotations").intValue();
     HAS_TYPE_ANNOTATIONS      = db.lookupIntConstant("ConstMethod::_has_type_annotations").intValue();
 
@@ -85,6 +87,9 @@
     // start of byte code
     bytecodeOffset = type.getSize();
 
+    type                       = db.lookupType("MethodParametersElement");
+    methodParametersElementSize = type.getSize();
+
     type                       = db.lookupType("CheckedExceptionElement");
     checkedExceptionElementSize = type.getSize();
 
@@ -113,7 +118,7 @@
 
   // start of bytecode
   private static long bytecodeOffset;
-
+  private static long methodParametersElementSize;
   private static long checkedExceptionElementSize;
   private static long localVariableTableElementSize;
   private static long exceptionTableElementSize;
@@ -387,6 +392,10 @@
     return ret;
   }
 
+  private boolean hasMethodParameters() {
+    return (getFlags() & HAS_METHOD_PARAMETERS) != 0;
+  }
+
   private boolean hasGenericSignature() {
     return (getFlags() & HAS_GENERIC_SIGNATURE) != 0;
   }
@@ -442,11 +451,41 @@
     return offsetOfLastU2Element();
   }
 
-  private long offsetOfCheckedExceptionsLength() {
+  private long offsetOfMethodParametersLength() {
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(hasMethodParameters(), "should only be called if table is present");
+    }
     return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
                                    offsetOfLastU2Element();
   }
 
+  private int getMethodParametersLength() {
+      if (hasMethodParameters())
+          return (int) getAddress().getCIntegerAt(offsetOfMethodParametersLength(), 2, true);
+      else
+          return 0;
+  }
+
+  // Offset of start of checked exceptions
+  private long offsetOfMethodParameters() {
+    long offset = offsetOfMethodParametersLength();
+    long length = getMethodParametersLength();
+    if (Assert.ASSERTS_ENABLED) {
+      Assert.that(length > 0, "should only be called if method parameter information is present");
+    }
+    offset -= length * methodParametersElementSize;
+    return offset;
+  }
+
+  private long offsetOfCheckedExceptionsLength() {
+    if (hasMethodParameters())
+      return offsetOfMethodParameters() - sizeofShort;
+    else {
+      return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
+                                     offsetOfLastU2Element();
+    }
+  }
+
   private int getCheckedExceptionsLength() {
     if (hasCheckedExceptions()) {
       return (int) getAddress().getCIntegerAt(offsetOfCheckedExceptionsLength(), 2, true);
@@ -496,6 +535,8 @@
       return offsetOfExceptionTable() - sizeofShort;
     } else if (hasCheckedExceptions()) {
       return offsetOfCheckedExceptions() - sizeofShort;
+    } else if (hasMethodParameters()) {
+      return offsetOfMethodParameters() - sizeofShort;
     } else {
       return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
                                      offsetOfLastU2Element();
@@ -526,6 +567,8 @@
     }
     if (hasCheckedExceptions()) {
       return offsetOfCheckedExceptions() - sizeofShort;
+    } else if (hasMethodParameters()) {
+      return offsetOfMethodParameters() - sizeofShort;
     } else {
       return hasGenericSignature() ? offsetOfLastU2Element() - sizeofShort :
                                      offsetOfLastU2Element();
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java	Mon Oct 28 17:32:02 2013 -0700
@@ -51,8 +51,7 @@
 
    public static void main(String[] args) {
       ClassLoaderStats cls = new ClassLoaderStats();
-      cls.start(args);
-      cls.stop();
+      cls.execute(args);
    }
 
    private static class ClassData {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java	Mon Oct 28 17:32:02 2013 -0700
@@ -54,8 +54,7 @@
 
     public static void main(String[] args) {
         FinalizerInfo finfo = new FinalizerInfo();
-        finfo.start(args);
-        finfo.stop();
+        finfo.execute(args);
     }
 
     public void run() {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java	Mon Oct 28 17:32:02 2013 -0700
@@ -54,7 +54,6 @@
 
    public static void main(String[] args) {
       FlagDumper fd = new FlagDumper();
-      fd.start(args);
-      fd.stop();
+      fd.execute(args);
    }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java	Mon Oct 28 17:32:02 2013 -0700
@@ -80,8 +80,7 @@
         }
 
         HeapDumper dumper = new HeapDumper(file);
-        dumper.start(args);
-        dumper.stop();
+        dumper.execute(args);
     }
 
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java	Mon Oct 28 17:32:02 2013 -0700
@@ -46,8 +46,7 @@
 
    public static void main(String[] args) {
       HeapSummary hs = new HeapSummary();
-      hs.start(args);
-      hs.stop();
+      hs.execute(args);
    }
 
    public void run() {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java	Mon Oct 28 17:32:02 2013 -0700
@@ -134,8 +134,7 @@
         }
 
         JInfo jinfo = new JInfo(mode);
-        jinfo.start(args);
-        jinfo.stop();
+        jinfo.execute(args);
     }
 
     private void printVMFlags() {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JMap.java	Mon Oct 28 17:32:02 2013 -0700
@@ -136,7 +136,9 @@
                         mode = MODE_HEAP_GRAPH_GXL;
                     } else {
                         System.err.println("unknown heap format:" + format);
-                        return;
+
+                        // Exit with error status
+                        System.exit(1);
                     }
                 } else {
                     copyArgs = false;
@@ -153,8 +155,7 @@
         }
 
         JMap jmap = new JMap(mode);
-        jmap.start(args);
-        jmap.stop();
+        jmap.execute(args);
     }
 
     public boolean writeHeapHprofBin(String fileName) {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java	Mon Oct 28 17:32:02 2013 -0700
@@ -64,7 +64,6 @@
 
     public static void main(String[] args) {
         JSnap js = new JSnap();
-        js.start(args);
-        js.stop();
+        js.execute(args);
     }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java	Mon Oct 28 17:32:02 2013 -0700
@@ -89,8 +89,7 @@
         }
 
         JStack jstack = new JStack(mixedMode, concurrentLocks);
-        jstack.start(args);
-        jstack.stop();
+        jstack.execute(args);
     }
 
     private boolean mixedMode;
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java	Mon Oct 28 17:32:02 2013 -0700
@@ -61,7 +61,6 @@
 
    public static void main(String[] args) {
       ObjectHistogram oh = new ObjectHistogram();
-      oh.start(args);
-      oh.stop();
+      oh.execute(args);
    }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java	Mon Oct 28 17:32:02 2013 -0700
@@ -69,7 +69,6 @@
 
    public static void main(String[] args) throws Exception {
       PMap t = new PMap();
-      t.start(args);
-      t.stop();
+      t.execute(args);
    }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/PStack.java	Mon Oct 28 17:32:02 2013 -0700
@@ -182,8 +182,7 @@
 
    public static void main(String[] args) throws Exception {
       PStack t = new PStack();
-      t.start(args);
-      t.stop();
+      t.execute(args);
    }
 
    // -- Internals only below this point
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java	Mon Oct 28 17:32:02 2013 -0700
@@ -137,8 +137,7 @@
 
    public static void main(String[] args) {
       StackTrace st = new StackTrace();
-      st.start(args);
-      st.stop();
+      st.execute(args);
    }
 
    private boolean verbose;
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java	Mon Oct 28 17:32:02 2013 -0700
@@ -58,7 +58,6 @@
 
    public static void main(String[] args) {
       SysPropsDumper pd = new SysPropsDumper();
-      pd.start(args);
-      pd.stop();
+      pd.execute(args);
    }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java	Mon Oct 28 17:32:02 2013 -0700
@@ -26,6 +26,7 @@
 
 import java.io.PrintStream;
 import java.util.Hashtable;
+
 import sun.jvm.hotspot.*;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.debugger.*;
@@ -105,26 +106,44 @@
 
       public static void main(String[] args) {
          <derived class> obj = new <derived class>;
-         obj.start(args);
+         obj.execute(args);
       }
 
    */
 
-   protected void stop() {
+   protected void execute(String[] args) {
+       int returnStatus = 1;
+
+       try {
+           returnStatus = start(args);
+       } finally {
+           stop();
+       }
+
+       // Exit with 0 or 1
+       System.exit(returnStatus);
+   }
+
+   public void stop() {
       if (agent != null) {
          agent.detach();
       }
    }
 
-   protected void start(String[] args) {
+   private int start(String[] args) {
+
       if ((args.length < 1) || (args.length > 2)) {
          usage();
-         return;
+         return 1;
       }
 
       // Attempt to handle -h or -help or some invalid flag
-      if (args[0].startsWith("-")) {
+      if (args[0].startsWith("-h")) {
           usage();
+          return 0;
+      } else if (args[0].startsWith("-")) {
+          usage();
+          return 1;
       }
 
       PrintStream err = System.err;
@@ -154,6 +173,7 @@
 
         default:
            usage();
+           return 1;
       }
 
       agent = new HotSpotAgent();
@@ -191,15 +211,16 @@
              break;
         }
         if (e.getMessage() != null) {
-          err.print(e.getMessage());
+          err.println(e.getMessage());
           e.printStackTrace();
         }
         err.println();
-        return;
+        return 1;
       }
 
       err.println("Debugger attached successfully.");
       startInternal();
+      return 0;
    }
 
    // When using an existing JVMDebugger.
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ClassDump.java	Mon Oct 28 17:32:02 2013 -0700
@@ -177,7 +177,6 @@
     public static void main(String[] args) {
 
         ClassDump cd = new ClassDump();
-        cd.start(args);
-        cd.stop();
+        cd.execute(args);
     }
 }
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java	Mon Oct 28 17:32:02 2013 -0700
@@ -42,8 +42,7 @@
 
     public static void main(String[] args) {
         JSDB jsdb = new JSDB();
-        jsdb.start(args);
-        jsdb.stop();
+        jsdb.execute(args);
     }
 
     public void run() {
--- a/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java	Mon Oct 28 17:32:02 2013 -0700
@@ -40,8 +40,7 @@
 public class SOQL extends Tool {
    public static void main(String[] args) {
       SOQL soql = new SOQL();
-      soql.start(args);
-      soql.stop();
+      soql.execute(args);
    }
 
    public SOQL() {
--- a/make/hotspot_version	Mon Oct 28 15:16:17 2013 -0700
+++ b/make/hotspot_version	Mon Oct 28 17:32:02 2013 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=56
+HS_BUILD_NUMBER=57
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/make/windows/makefiles/compile.make	Mon Oct 28 15:16:17 2013 -0700
+++ b/make/windows/makefiles/compile.make	Mon Oct 28 17:32:02 2013 -0700
@@ -181,6 +181,7 @@
 PRODUCT_OPT_OPTION   = /O2 /Oy-
 FASTDEBUG_OPT_OPTION = /O2 /Oy-
 DEBUG_OPT_OPTION     = /Od
+SAFESEH_FLAG = /SAFESEH
 !endif
 
 !if "$(COMPILER_NAME)" == "VS2005"
@@ -199,6 +200,7 @@
 !if "x$(MT)" == "x"
 MT=mt.exe
 !endif
+SAFESEH_FLAG = /SAFESEH
 !endif
 
 !if "$(COMPILER_NAME)" == "VS2008"
@@ -213,6 +215,7 @@
 !if "x$(MT)" == "x"
 MT=mt.exe
 !endif
+SAFESEH_FLAG = /SAFESEH
 !endif
 
 !if "$(COMPILER_NAME)" == "VS2010"
@@ -244,9 +247,11 @@
 !if "x$(MT)" == "x"
 MT=mt.exe
 !endif
+SAFESEH_FLAG = /SAFESEH
+!endif
+
 !if "$(BUILDARCH)" == "i486"
-LD_FLAGS = /SAFESEH $(LD_FLAGS)
-!endif
+LD_FLAGS = $(SAFESEH_FLAG) $(LD_FLAGS)
 !endif
 
 CXX_FLAGS = $(CXX_FLAGS) $(MP_FLAG)
--- a/make/windows/makefiles/sa.make	Mon Oct 28 15:16:17 2013 -0700
+++ b/make/windows/makefiles/sa.make	Mon Oct 28 17:32:02 2013 -0700
@@ -110,6 +110,9 @@
 !if "$(ENABLE_FULL_DEBUG_SYMBOLS)" == "1"
 SA_LFLAGS = $(SA_LFLAGS) -map -debug
 !endif
+!if "$(BUILDARCH)" == "i486"
+SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS)
+!endif
 
 SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)
 
--- a/make/windows/makefiles/trace.make	Mon Oct 28 15:16:17 2013 -0700
+++ b/make/windows/makefiles/trace.make	Mon Oct 28 17:32:02 2013 -0700
@@ -40,8 +40,7 @@
     traceEventIds.hpp     \
     traceTypes.hpp
 
-
-!if "$(OPENJDK)" != "true"
+!if EXISTS($(TraceAltSrcDir))
 TraceGeneratedNames = $(TraceGeneratedNames) \
     traceRequestables.hpp \
     traceEventControl.hpp \
@@ -56,7 +55,7 @@
 	$(TraceOutDir)/traceEventIds.hpp     \
 	$(TraceOutDir)/traceTypes.hpp
 
-!if "$(OPENJDK)" != "true"
+!if EXISTS($(TraceAltSrcDir))
 TraceGeneratedFiles = $(TraceGeneratedFiles) \
 	$(TraceOutDir)/traceRequestables.hpp \
     $(TraceOutDir)/traceEventControl.hpp \
@@ -68,7 +67,7 @@
 XML_DEPS = $(TraceSrcDir)/trace.xml $(TraceSrcDir)/tracetypes.xml \
     $(TraceSrcDir)/trace.dtd $(TraceSrcDir)/xinclude.mod
 
-!if "$(OPENJDK)" != "true"
+!if EXISTS($(TraceAltSrcDir))
 XML_DEPS = $(XML_DEPS) $(TraceAltSrcDir)/traceevents.xml
 !endif
 
@@ -87,7 +86,7 @@
 	@echo Generating $@
 	@$(XSLT) -IN $(TraceSrcDir)/trace.xml -XSL $(TraceSrcDir)/traceTypes.xsl -OUT $(TraceOutDir)/traceTypes.hpp
 
-!if "$(OPENJDK)" == "true"
+!if !EXISTS($(TraceAltSrcDir))
 
 $(TraceOutDir)/traceEventClasses.hpp: $(TraceSrcDir)/trace.xml $(TraceSrcDir)/traceEventClasses.xsl $(XML_DEPS)
 	@echo Generating OpenJDK $@
--- a/src/share/vm/ci/ciEnv.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/ci/ciEnv.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -483,8 +483,7 @@
     {
       // We have to lock the cpool to keep the oop from being resolved
       // while we are accessing it.
-      oop cplock = cpool->lock();
-      ObjectLocker ol(cplock, THREAD, cplock != NULL);
+        MonitorLockerEx ml(cpool->lock());
       constantTag tag = cpool->tag_at(index);
       if (tag.is_klass()) {
         // The klass has been inserted into the constant pool
--- a/src/share/vm/classfile/classFileParser.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/classfile/classFileParser.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -2197,8 +2197,8 @@
           }
           if (lvt_cnt == max_lvt_cnt) {
             max_lvt_cnt <<= 1;
-            REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt);
-            REALLOC_RESOURCE_ARRAY(u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt);
+            localvariable_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_table_length, lvt_cnt, max_lvt_cnt);
+            localvariable_table_start  = REALLOC_RESOURCE_ARRAY(u2*, localvariable_table_start, lvt_cnt, max_lvt_cnt);
           }
           localvariable_table_start[lvt_cnt] =
             parse_localvariable_table(code_length,
@@ -2226,8 +2226,8 @@
           // Parse local variable type table
           if (lvtt_cnt == max_lvtt_cnt) {
             max_lvtt_cnt <<= 1;
-            REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt);
-            REALLOC_RESOURCE_ARRAY(u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt);
+            localvariable_type_table_length = REALLOC_RESOURCE_ARRAY(u2, localvariable_type_table_length, lvtt_cnt, max_lvtt_cnt);
+            localvariable_type_table_start  = REALLOC_RESOURCE_ARRAY(u2*, localvariable_type_table_start, lvtt_cnt, max_lvtt_cnt);
           }
           localvariable_type_table_start[lvtt_cnt] =
             parse_localvariable_table(code_length,
@@ -4483,9 +4483,8 @@
   for (int index = 0; index < num_methods; index++) {
     Method* m = methods->at(index);
 
-    // skip private, static and <init> methods
-    if ((!m->is_private()) &&
-        (!m->is_static()) &&
+    // skip static and <init> methods
+    if ((!m->is_static()) &&
         (m->name() != vmSymbols::object_initializer_name())) {
 
       Symbol* name = m->name();
--- a/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/gc_implementation/g1/g1AllocRegion.hpp	Mon Oct 28 17:32:02 2013 -0700
@@ -55,7 +55,7 @@
   // then _alloc_region is NULL and this object should not be used to
   // satisfy allocation requests (it was done this way to force the
   // correct use of init() and release()).
-  HeapRegion* _alloc_region;
+  HeapRegion* volatile _alloc_region;
 
   // It keeps track of the distinct number of regions that are used
   // for allocation in the active interval of this object, i.e.,
@@ -132,8 +132,9 @@
   static void setup(G1CollectedHeap* g1h, HeapRegion* dummy_region);
 
   HeapRegion* get() const {
+    HeapRegion * hr = _alloc_region;
     // Make sure that the dummy region does not escape this class.
-    return (_alloc_region == _dummy_region) ? NULL : _alloc_region;
+    return (hr == _dummy_region) ? NULL : hr;
   }
 
   uint count() { return _count; }
--- a/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/gc_implementation/g1/g1RemSetSummary.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -187,19 +187,23 @@
   size_t code_root_elems() const { return _code_root_elems; }
 
   void print_rs_mem_info_on(outputStream * out, size_t total) {
-    out->print_cr("    %8dK (%5.1f%%) by %zd %s regions", round_to_K(rs_mem_size()), rs_mem_size_percent_of(total), amount(), _name);
+    out->print_cr("    "SIZE_FORMAT_W(8)"K (%5.1f%%) by "SIZE_FORMAT" %s regions",
+        round_to_K(rs_mem_size()), rs_mem_size_percent_of(total), amount(), _name);
   }
 
   void print_cards_occupied_info_on(outputStream * out, size_t total) {
-    out->print_cr("     %8d (%5.1f%%) entries by %zd %s regions", cards_occupied(), cards_occupied_percent_of(total), amount(), _name);
+    out->print_cr("     "SIZE_FORMAT_W(8)" (%5.1f%%) entries by "SIZE_FORMAT" %s regions",
+        cards_occupied(), cards_occupied_percent_of(total), amount(), _name);
   }
 
   void print_code_root_mem_info_on(outputStream * out, size_t total) {
-    out->print_cr("    %8dK (%5.1f%%) by %zd %s regions", round_to_K(code_root_mem_size()), code_root_mem_size_percent_of(total), amount(), _name);
+    out->print_cr("    "SIZE_FORMAT_W(8)"K (%5.1f%%) by "SIZE_FORMAT" %s regions",
+        round_to_K(code_root_mem_size()), code_root_mem_size_percent_of(total), amount(), _name);
   }
 
   void print_code_root_elems_info_on(outputStream * out, size_t total) {
-    out->print_cr("     %8d (%5.1f%%) elements by %zd %s regions", code_root_elems(), code_root_elems_percent_of(total), amount(), _name);
+    out->print_cr("     "SIZE_FORMAT_W(8)" (%5.1f%%) elements by "SIZE_FORMAT" %s regions",
+        code_root_elems(), code_root_elems_percent_of(total), amount(), _name);
   }
 };
 
@@ -327,14 +331,14 @@
   out->print_cr("\n Recent concurrent refinement statistics");
   out->print_cr("  Processed "SIZE_FORMAT" cards",
                 num_concurrent_refined_cards());
-  out->print_cr("  Of %d completed buffers:", num_processed_buf_total());
-  out->print_cr("     %8d (%5.1f%%) by concurrent RS threads.",
+  out->print_cr("  Of "SIZE_FORMAT" completed buffers:", num_processed_buf_total());
+  out->print_cr("     "SIZE_FORMAT_W(8)" (%5.1f%%) by concurrent RS threads.",
                 num_processed_buf_total(),
                 percent_of(num_processed_buf_rs_threads(), num_processed_buf_total()));
-  out->print_cr("     %8d (%5.1f%%) by mutator threads.",
+  out->print_cr("     "SIZE_FORMAT_W(8)" (%5.1f%%) by mutator threads.",
                 num_processed_buf_mutator(),
                 percent_of(num_processed_buf_mutator(), num_processed_buf_total()));
-  out->print_cr("  Did %d coarsenings.", num_coarsenings());
+  out->print_cr("  Did "SIZE_FORMAT" coarsenings.", num_coarsenings());
   out->print_cr("  Concurrent RS threads times (s)");
   out->print("     ");
   for (uint i = 0; i < _num_vtimes; i++) {
--- a/src/share/vm/interpreter/linkResolver.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/interpreter/linkResolver.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -1,6 +1,5 @@
 /*
  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -265,7 +264,7 @@
 void LinkResolver::lookup_instance_method_in_klasses(methodHandle& result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) {
   Method* result_oop = klass->uncached_lookup_method(name, signature);
   result = methodHandle(THREAD, result_oop);
-  while (!result.is_null() && result->is_static()) {
+  while (!result.is_null() && result->is_static() && result->method_holder()->super() != NULL) {
     klass = KlassHandle(THREAD, result->method_holder()->super());
     result = methodHandle(THREAD, klass->uncached_lookup_method(name, signature));
   }
@@ -419,18 +418,28 @@
 
   AccessFlags flags = sel_method->access_flags();
 
-  // Special case:  arrays always override "clone". JVMS 2.15.
+  // Special case #1:  arrays always override "clone". JVMS 2.15.
   // If the resolved klass is an array class, and the declaring class
   // is java.lang.Object and the method is "clone", set the flags
   // to public.
+  // Special case #2:  If the resolved klass is an interface, and
+  // the declaring class is java.lang.Object, and the method is
+  // "clone" or "finalize", set the flags to public. If the
+  // resolved interface does not contain "clone" or "finalize"
+  // methods, the method/interface method resolution looks to
+  // the interface's super class, java.lang.Object.  With JDK 8
+  // interface accessability check requirement, special casing
+  // this scenario is necessary to avoid an IAE.
   //
-  // We'll check for the method name first, as that's most likely
-  // to be false (so we'll short-circuit out of these tests).
-  if (sel_method->name() == vmSymbols::clone_name() &&
-      sel_klass() == SystemDictionary::Object_klass() &&
-      resolved_klass->oop_is_array()) {
+  // We'll check for each method name first and then java.lang.Object
+  // to best short-circuit out of these tests.
+  if (((sel_method->name() == vmSymbols::clone_name() &&
+        (resolved_klass->oop_is_array() || resolved_klass->is_interface())) ||
+       (sel_method->name() == vmSymbols::finalize_method_name() &&
+        resolved_klass->is_interface())) &&
+      sel_klass() == SystemDictionary::Object_klass()) {
     // We need to change "protected" to "public".
-    assert(flags.is_protected(), "clone not protected?");
+    assert(flags.is_protected(), "clone or finalize not protected?");
     jint new_flags = flags.as_int();
     new_flags = new_flags & (~JVM_ACC_PROTECTED);
     new_flags = new_flags | JVM_ACC_PUBLIC;
--- a/src/share/vm/memory/metaspace.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/memory/metaspace.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -75,8 +75,7 @@
   ClassSmallChunk = 256,
   SmallChunk = 512,
   ClassMediumChunk = 4 * K,
-  MediumChunk = 8 * K,
-  HumongousChunkGranularity = 8
+  MediumChunk = 8 * K
 };
 
 static ChunkIndex next_chunk_index(ChunkIndex i) {
@@ -92,6 +91,7 @@
 
 // Manages the global free lists of chunks.
 class ChunkManager : public CHeapObj<mtInternal> {
+  friend class TestVirtualSpaceNodeTest;
 
   // Free list of chunks of different sizes.
   //   SpecializedChunk
@@ -257,6 +257,8 @@
   // VirtualSpace
   Metachunk* first_chunk() { return (Metachunk*) bottom(); }
 
+  // Committed but unused space in the virtual space
+  size_t free_words_in_vs() const;
  public:
 
   VirtualSpaceNode(size_t byte_size);
@@ -301,7 +303,6 @@
   // used and capacity in this single entry in the list
   size_t used_words_in_vs() const;
   size_t capacity_words_in_vs() const;
-  size_t free_words_in_vs() const;
 
   bool initialize();
 
@@ -319,6 +320,13 @@
   // in the node from any freelist.
   void purge(ChunkManager* chunk_manager);
 
+  // If an allocation doesn't fit in the current node a new node is created.
+  // Allocate chunks out of the remaining committed space in this node
+  // to avoid wasting that memory.
+  // This always adds up because all the chunk sizes are multiples of
+  // the smallest chunk size.
+  void retire(ChunkManager* chunk_manager);
+
 #ifdef ASSERT
   // Debug support
   void mangle();
@@ -461,6 +469,10 @@
   // and is typically followed by the allocation of a chunk.
   bool create_new_virtual_space(size_t vs_word_size);
 
+  // Chunk up the unused committed space in the current
+  // virtual space and add the chunks to the free list.
+  void retire_current_virtual_space();
+
  public:
   VirtualSpaceList(size_t word_size);
   VirtualSpaceList(ReservedSpace rs);
@@ -624,10 +636,12 @@
   bool is_class() { return _mdtype == Metaspace::ClassType; }
 
   // Accessors
-  size_t specialized_chunk_size() { return SpecializedChunk; }
-  size_t small_chunk_size() { return (size_t) is_class() ? ClassSmallChunk : SmallChunk; }
-  size_t medium_chunk_size() { return (size_t) is_class() ? ClassMediumChunk : MediumChunk; }
-  size_t medium_chunk_bunch() { return medium_chunk_size() * MediumChunkMultiple; }
+  size_t specialized_chunk_size() { return (size_t) is_class() ? ClassSpecializedChunk : SpecializedChunk; }
+  size_t small_chunk_size()       { return (size_t) is_class() ? ClassSmallChunk : SmallChunk; }
+  size_t medium_chunk_size()      { return (size_t) is_class() ? ClassMediumChunk : MediumChunk; }
+  size_t medium_chunk_bunch()     { return medium_chunk_size() * MediumChunkMultiple; }
+
+  size_t smallest_chunk_size()  { return specialized_chunk_size(); }
 
   size_t allocated_blocks_words() const { return _allocated_blocks_words; }
   size_t allocated_blocks_bytes() const { return _allocated_blocks_words * BytesPerWord; }
@@ -1056,6 +1070,35 @@
 #endif
 }
 
+void VirtualSpaceList::retire_current_virtual_space() {
+  assert_lock_strong(SpaceManager::expand_lock());
+
+  VirtualSpaceNode* vsn = current_virtual_space();
+
+  ChunkManager* cm = is_class() ? Metaspace::chunk_manager_class() :
+                                  Metaspace::chunk_manager_metadata();
+
+  vsn->retire(cm);
+}
+
+void VirtualSpaceNode::retire(ChunkManager* chunk_manager) {
+  for (int i = (int)MediumIndex; i >= (int)ZeroIndex; --i) {
+    ChunkIndex index = (ChunkIndex)i;
+    size_t chunk_size = chunk_manager->free_chunks(index)->size();
+
+    while (free_words_in_vs() >= chunk_size) {
+      DEBUG_ONLY(verify_container_count();)
+      Metachunk* chunk = get_chunk_vs(chunk_size);
+      assert(chunk != NULL, "allocation should have been successful");
+
+      chunk_manager->return_chunks(index, chunk);
+      chunk_manager->inc_free_chunks_total(chunk_size);
+      DEBUG_ONLY(verify_container_count();)
+    }
+  }
+  assert(free_words_in_vs() == 0, "should be empty now");
+}
+
 VirtualSpaceList::VirtualSpaceList(size_t word_size) :
                                    _is_class(false),
                                    _virtual_space_list(NULL),
@@ -1181,6 +1224,7 @@
   if (vs_expanded) {
     return true;
   }
+  retire_current_virtual_space();
 
   // Get another virtual space.
   size_t grow_vs_words = MAX2((size_t)VirtualSpaceSize, preferred_words);
@@ -1902,12 +1946,12 @@
     chunk_word_size = medium_chunk_size();
   }
 
-  // Might still need a humongous chunk.  Enforce an
-  // eight word granularity to facilitate reuse (some
-  // wastage but better chance of reuse).
+  // Might still need a humongous chunk.  Enforce
+  // humongous allocations sizes to be aligned up to
+  // the smallest chunk size.
   size_t if_humongous_sized_chunk =
     align_size_up(word_size + Metachunk::overhead(),
-                  HumongousChunkGranularity);
+                  smallest_chunk_size());
   chunk_word_size =
     MAX2((size_t) chunk_word_size, if_humongous_sized_chunk);
 
@@ -2151,10 +2195,10 @@
     }
     assert(humongous_chunks->word_size() == (size_t)
            align_size_up(humongous_chunks->word_size(),
-                             HumongousChunkGranularity),
+                             smallest_chunk_size()),
            err_msg("Humongous chunk size is wrong: word size " SIZE_FORMAT
                    " granularity %d",
-                   humongous_chunks->word_size(), HumongousChunkGranularity));
+                   humongous_chunks->word_size(), smallest_chunk_size()));
     Metachunk* next_humongous_chunks = humongous_chunks->next();
     humongous_chunks->container()->dec_container_count();
     chunk_manager()->humongous_dictionary()->return_chunk(humongous_chunks);
@@ -3301,9 +3345,7 @@
   }
 
   if (result == NULL) {
-    report_metadata_oome(loader_data, word_size, mdtype, THREAD);
-    // Will not reach here.
-    return NULL;
+    report_metadata_oome(loader_data, word_size, mdtype, CHECK_NULL);
   }
 
   // Zero initialize.
@@ -3494,4 +3536,94 @@
   TestMetaspaceAuxTest::test();
 }
 
+class TestVirtualSpaceNodeTest {
+  static void chunk_up(size_t words_left, size_t& num_medium_chunks,
+                                          size_t& num_small_chunks,
+                                          size_t& num_specialized_chunks) {
+    num_medium_chunks = words_left / MediumChunk;
+    words_left = words_left % MediumChunk;
+
+    num_small_chunks = words_left / SmallChunk;
+    words_left = words_left % SmallChunk;
+    // how many specialized chunks can we get?
+    num_specialized_chunks = words_left / SpecializedChunk;
+    assert(words_left % SpecializedChunk == 0, "should be nothing left");
+  }
+
+ public:
+  static void test() {
+    MutexLockerEx ml(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
+    const size_t vsn_test_size_words = MediumChunk  * 4;
+    const size_t vsn_test_size_bytes = vsn_test_size_words * BytesPerWord;
+
+    // The chunk sizes must be multiples of eachother, or this will fail
+    STATIC_ASSERT(MediumChunk % SmallChunk == 0);
+    STATIC_ASSERT(SmallChunk % SpecializedChunk == 0);
+
+    { // No committed memory in VSN
+      ChunkManager cm(SpecializedChunk, SmallChunk, MediumChunk);
+      VirtualSpaceNode vsn(vsn_test_size_bytes);
+      vsn.initialize();
+      vsn.retire(&cm);
+      assert(cm.sum_free_chunks_count() == 0, "did not commit any memory in the VSN");
+    }
+
+    { // All of VSN is committed, half is used by chunks
+      ChunkManager cm(SpecializedChunk, SmallChunk, MediumChunk);
+      VirtualSpaceNode vsn(vsn_test_size_bytes);
+      vsn.initialize();
+      vsn.expand_by(vsn_test_size_words, vsn_test_size_words);
+      vsn.get_chunk_vs(MediumChunk);
+      vsn.get_chunk_vs(MediumChunk);
+      vsn.retire(&cm);
+      assert(cm.sum_free_chunks_count() == 2, "should have been memory left for 2 medium chunks");
+      assert(cm.sum_free_chunks() == 2*MediumChunk, "sizes should add up");
+    }
+
+    { // 4 pages of VSN is committed, some is used by chunks
+      ChunkManager cm(SpecializedChunk, SmallChunk, MediumChunk);
+      VirtualSpaceNode vsn(vsn_test_size_bytes);
+      const size_t page_chunks = 4 * (size_t)os::vm_page_size() / BytesPerWord;
+      assert(page_chunks < MediumChunk, "Test expects medium chunks to be at least 4*page_size");
+      vsn.initialize();
+      vsn.expand_by(page_chunks, page_chunks);
+      vsn.get_chunk_vs(SmallChunk);
+      vsn.get_chunk_vs(SpecializedChunk);
+      vsn.retire(&cm);
+
+      // committed - used = words left to retire
+      const size_t words_left = page_chunks - SmallChunk - SpecializedChunk;
+
+      size_t num_medium_chunks, num_small_chunks, num_spec_chunks;
+      chunk_up(words_left, num_medium_chunks, num_small_chunks, num_spec_chunks);
+
+      assert(num_medium_chunks == 0, "should not get any medium chunks");
+      assert(cm.sum_free_chunks_count() == (num_small_chunks + num_spec_chunks), "should be space for 3 chunks");
+      assert(cm.sum_free_chunks() == words_left, "sizes should add up");
+    }
+
+    { // Half of VSN is committed, a humongous chunk is used
+      ChunkManager cm(SpecializedChunk, SmallChunk, MediumChunk);
+      VirtualSpaceNode vsn(vsn_test_size_bytes);
+      vsn.initialize();
+      vsn.expand_by(MediumChunk * 2, MediumChunk * 2);
+      vsn.get_chunk_vs(MediumChunk + SpecializedChunk); // Humongous chunks will be aligned up to MediumChunk + SpecializedChunk
+      vsn.retire(&cm);
+
+      const size_t words_left = MediumChunk * 2 - (MediumChunk + SpecializedChunk);
+      size_t num_medium_chunks, num_small_chunks, num_spec_chunks;
+      chunk_up(words_left, num_medium_chunks, num_small_chunks, num_spec_chunks);
+
+      assert(num_medium_chunks == 0, "should not get any medium chunks");
+      assert(cm.sum_free_chunks_count() == (num_small_chunks + num_spec_chunks), "should be space for 3 chunks");
+      assert(cm.sum_free_chunks() == words_left, "sizes should add up");
+    }
+
+  }
+};
+
+void TestVirtualSpaceNode_test() {
+  TestVirtualSpaceNodeTest::test();
+}
+
 #endif
--- a/src/share/vm/oops/constantPool.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/oops/constantPool.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -40,7 +40,6 @@
 #include "runtime/init.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/signature.hpp"
-#include "runtime/synchronizer.hpp"
 #include "runtime/vframe.hpp"
 
 ConstantPool* ConstantPool::allocate(ClassLoaderData* loader_data, int length, TRAPS) {
@@ -70,6 +69,7 @@
 
   // only set to non-zero if constant pool is merged by RedefineClasses
   set_version(0);
+  set_lock(new Monitor(Monitor::nonleaf + 2, "A constant pool lock"));
 
   // initialize tag array
   int length = tags->length();
@@ -95,6 +95,9 @@
 void ConstantPool::release_C_heap_structures() {
   // walk constant pool and decrement symbol reference counts
   unreference_symbols();
+
+  delete _lock;
+  set_lock(NULL);
 }
 
 objArrayOop ConstantPool::resolved_references() const {
@@ -151,6 +154,9 @@
       ClassLoaderData* loader_data = pool_holder()->class_loader_data();
       set_resolved_references(loader_data->add_handle(refs_handle));
     }
+
+    // Also need to recreate the mutex.  Make sure this matches the constructor
+    set_lock(new Monitor(Monitor::nonleaf + 2, "A constant pool lock"));
   }
 }
 
@@ -161,23 +167,7 @@
   set_resolved_reference_length(
     resolved_references() != NULL ? resolved_references()->length() : 0);
   set_resolved_references(NULL);
-}
-
-oop ConstantPool::lock() {
-  if (_pool_holder) {
-    // We re-use the _pool_holder's init_lock to reduce footprint.
-    // Notes on deadlocks:
-    // [1] This lock is a Java oop, so it can be recursively locked by
-    //     the same thread without self-deadlocks.
-    // [2] Deadlock will happen if there is circular dependency between
-    //     the <clinit> of two Java classes. However, in this case,
-    //     the deadlock would have happened long before we reach
-    //     ConstantPool::lock(), so reusing init_lock does not
-    //     increase the possibility of deadlock.
-    return _pool_holder->init_lock();
-  } else {
-    return NULL;
-  }
+  set_lock(NULL);
 }
 
 int ConstantPool::cp_to_object_index(int cp_index) {
@@ -211,9 +201,7 @@
 
   Symbol* name = NULL;
   Handle       loader;
-  {
-    oop cplock = this_oop->lock();
-    ObjectLocker ol(cplock , THREAD, cplock != NULL);
+  {  MonitorLockerEx ml(this_oop->lock());
 
     if (this_oop->tag_at(which).is_unresolved_klass()) {
       if (this_oop->tag_at(which).is_unresolved_klass_in_error()) {
@@ -260,8 +248,7 @@
 
       bool throw_orig_error = false;
       {
-        oop cplock = this_oop->lock();
-        ObjectLocker ol(cplock, THREAD, cplock != NULL);
+        MonitorLockerEx ml(this_oop->lock());
 
         // some other thread has beaten us and has resolved the class.
         if (this_oop->tag_at(which).is_klass()) {
@@ -329,8 +316,7 @@
       }
       return k();
     } else {
-      oop cplock = this_oop->lock();
-      ObjectLocker ol(cplock, THREAD, cplock != NULL);
+      MonitorLockerEx ml(this_oop->lock());
       // Only updated constant pool - if it is resolved.
       do_resolve = this_oop->tag_at(which).is_unresolved_klass();
       if (do_resolve) {
@@ -600,8 +586,7 @@
                                      int tag, TRAPS) {
   ResourceMark rm;
   Symbol* error = PENDING_EXCEPTION->klass()->name();
-  oop cplock = this_oop->lock();
-  ObjectLocker ol(cplock, THREAD, cplock != NULL);  // lock cpool to change tag.
+  MonitorLockerEx ml(this_oop->lock());  // lock cpool to change tag.
 
   int error_tag = (tag == JVM_CONSTANT_MethodHandle) ?
            JVM_CONSTANT_MethodHandleInError : JVM_CONSTANT_MethodTypeInError;
@@ -762,8 +747,7 @@
   if (cache_index >= 0) {
     // Cache the oop here also.
     Handle result_handle(THREAD, result_oop);
-    oop cplock = this_oop->lock();
-    ObjectLocker ol(cplock, THREAD, cplock != NULL);  // don't know if we really need this
+    MonitorLockerEx ml(this_oop->lock());  // don't know if we really need this
     oop result = this_oop->resolved_references()->obj_at(cache_index);
     // Benign race condition:  resolved_references may already be filled in while we were trying to lock.
     // The important thing here is that all threads pick up the same result.
--- a/src/share/vm/oops/constantPool.hpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/oops/constantPool.hpp	Mon Oct 28 17:32:02 2013 -0700
@@ -111,6 +111,7 @@
     int                _version;
   } _saved;
 
+  Monitor*             _lock;
 
   void set_tags(Array<u1>* tags)               { _tags = tags; }
   void tag_at_put(int which, jbyte t)          { tags()->at_put(which, t); }
@@ -843,17 +844,8 @@
 
   void set_resolved_reference_length(int length) { _saved._resolved_reference_length = length; }
   int  resolved_reference_length() const  { return _saved._resolved_reference_length; }
-
-  // lock() may return null -- constant pool updates may happen before this lock is
-  // initialized, because the _pool_holder has not been fully initialized and
-  // has not been registered into the system dictionary. In this case, no other
-  // thread can be modifying this constantpool, so no synchronization is
-  // necessary.
-  //
-  // Use cplock() like this:
-  //    oop cplock = cp->lock();
-  //    ObjectLocker ol(cplock , THREAD, cplock != NULL);
-  oop lock();
+  void set_lock(Monitor* lock)            { _lock = lock; }
+  Monitor* lock()                         { return _lock; }
 
   // Decrease ref counts of symbols that are in the constant pool
   // when the holder class is unloaded
--- a/src/share/vm/oops/cpCache.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/oops/cpCache.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -284,8 +284,7 @@
   // the lock, so that when the losing writer returns, he can use the linked
   // cache entry.
 
-  oop cplock = cpool->lock();
-  ObjectLocker ol(cplock, Thread::current(), cplock != NULL);
+  MonitorLockerEx ml(cpool->lock());
   if (!is_f1_null()) {
     return;
   }
--- a/src/share/vm/oops/instanceKlass.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/oops/instanceKlass.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -498,13 +498,27 @@
 
 oop InstanceKlass::init_lock() const {
   // return the init lock from the mirror
-  return java_lang_Class::init_lock(java_mirror());
+  oop lock = java_lang_Class::init_lock(java_mirror());
+  assert((oop)lock != NULL || !is_not_initialized(), // initialized or in_error state
+         "only fully initialized state can have a null lock");
+  return lock;
+}
+
+// Set the initialization lock to null so the object can be GC'ed.  Any racing
+// threads to get this lock will see a null lock and will not lock.
+// That's okay because they all check for initialized state after getting
+// the lock and return.
+void InstanceKlass::fence_and_clear_init_lock() {
+  // make sure previous stores are all done, notably the init_state.
+  OrderAccess::storestore();
+  java_lang_Class::set_init_lock(java_mirror(), NULL);
+  assert(!is_not_initialized(), "class must be initialized now");
 }
 
 void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
   EXCEPTION_MARK;
   oop init_lock = this_oop->init_lock();
-  ObjectLocker ol(init_lock, THREAD);
+  ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
 
   // abort if someone beat us to the initialization
   if (!this_oop->is_not_initialized()) return;  // note: not equivalent to is_initialized()
@@ -523,6 +537,7 @@
   } else {
     // linking successfull, mark class as initialized
     this_oop->set_init_state (fully_initialized);
+    this_oop->fence_and_clear_init_lock();
     // trace
     if (TraceClassInitialization) {
       ResourceMark rm(THREAD);
@@ -649,7 +664,7 @@
   // verification & rewriting
   {
     oop init_lock = this_oop->init_lock();
-    ObjectLocker ol(init_lock, THREAD);
+    ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
     // rewritten will have been set if loader constraint error found
     // on an earlier link attempt
     // don't verify or rewrite if already rewritten
@@ -772,7 +787,7 @@
   // Step 1
   {
     oop init_lock = this_oop->init_lock();
-    ObjectLocker ol(init_lock, THREAD);
+    ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
 
     Thread *self = THREAD; // it's passed the current thread
 
@@ -920,8 +935,9 @@
 
 void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
   oop init_lock = this_oop->init_lock();
-  ObjectLocker ol(init_lock, THREAD);
+  ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
   this_oop->set_init_state(state);
+  this_oop->fence_and_clear_init_lock();
   ol.notify_all(CHECK);
 }
 
--- a/src/share/vm/oops/instanceKlass.hpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/oops/instanceKlass.hpp	Mon Oct 28 17:32:02 2013 -0700
@@ -1023,6 +1023,7 @@
   // It has to be an object not a Mutex because it's held through java calls.
   oop init_lock() const;
 private:
+  void fence_and_clear_init_lock();
 
   // Static methods that are used to implement member methods where an exposed this pointer
   // is needed due to possible GCs
--- a/src/share/vm/prims/jni.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/prims/jni.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -5060,6 +5060,7 @@
 void TestVirtualSpace_test();
 void TestMetaspaceAux_test();
 void TestMetachunk_test();
+void TestVirtualSpaceNode_test();
 #if INCLUDE_ALL_GCS
 void TestG1BiasedArray_test();
 #endif
@@ -5072,6 +5073,7 @@
     run_unit_test(TestVirtualSpace_test());
     run_unit_test(TestMetaspaceAux_test());
     run_unit_test(TestMetachunk_test());
+    run_unit_test(TestVirtualSpaceNode_test());
     run_unit_test(GlobalDefinitions::test_globals());
     run_unit_test(GCTimerAllTest::all());
     run_unit_test(arrayOopDesc::test_max_array_length());
--- a/src/share/vm/prims/jvmtiEnv.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/prims/jvmtiEnv.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -259,8 +259,7 @@
       // bytes to the InstanceKlass here because they have not been
       // validated and we're not at a safepoint.
       constantPoolHandle  constants(current_thread, ikh->constants());
-      oop cplock = constants->lock();
-      ObjectLocker ol(cplock, current_thread, cplock != NULL);    // lock constant pool while we query it
+      MonitorLockerEx ml(constants->lock());    // lock constant pool while we query it
 
       JvmtiClassFileReconstituter reconstituter(ikh);
       if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
@@ -2418,8 +2417,7 @@
 
   instanceKlassHandle ikh(thread, k_oop);
   constantPoolHandle  constants(thread, ikh->constants());
-  oop cplock = constants->lock();
-  ObjectLocker ol(cplock, thread, cplock != NULL);    // lock constant pool while we query it
+  MonitorLockerEx ml(constants->lock());    // lock constant pool while we query it
 
   JvmtiConstantPoolReconstituter reconstituter(ikh);
   if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
--- a/src/share/vm/prims/jvmtiImpl.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/prims/jvmtiImpl.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -225,18 +225,20 @@
   _method = NULL;
   _bci    = 0;
   _class_loader = NULL;
-#ifdef CHECK_UNHANDLED_OOPS
-  // This one is always allocated with new, but check it just in case.
-  Thread *thread = Thread::current();
-  if (thread->is_in_stack((address)&_method)) {
-    thread->allow_unhandled_oop((oop*)&_method);
-  }
-#endif // CHECK_UNHANDLED_OOPS
 }
 
 JvmtiBreakpoint::JvmtiBreakpoint(Method* m_method, jlocation location) {
   _method        = m_method;
   _class_loader  = _method->method_holder()->class_loader_data()->class_loader();
+#ifdef CHECK_UNHANDLED_OOPS
+  // _class_loader can't be wrapped in a Handle, because JvmtiBreakpoint:s are
+  // eventually allocated on the heap.
+  //
+  // The code handling JvmtiBreakpoint:s allocated on the stack can't be
+  // interrupted by a GC until _class_loader is reachable by the GC via the
+  // oops_do method.
+  Thread::current()->allow_unhandled_oop(&_class_loader);
+#endif // CHECK_UNHANDLED_OOPS
   assert(_method != NULL, "_method != NULL");
   _bci           = (int) location;
   assert(_bci >= 0, "_bci >= 0");
--- a/src/share/vm/runtime/vmStructs.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/runtime/vmStructs.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -1464,6 +1464,7 @@
   declare_toplevel_type(CheckedExceptionElement)                          \
   declare_toplevel_type(LocalVariableTableElement)                        \
   declare_toplevel_type(ExceptionTableElement)                            \
+  declare_toplevel_type(MethodParametersElement)                          \
                                                                           \
   declare_toplevel_type(ClassLoaderData)                                  \
   declare_toplevel_type(ClassLoaderDataGraph)                             \
@@ -2342,6 +2343,7 @@
   declare_constant(ConstMethod::_has_localvariable_table)                 \
   declare_constant(ConstMethod::_has_exception_table)                     \
   declare_constant(ConstMethod::_has_generic_signature)                   \
+  declare_constant(ConstMethod::_has_method_parameters)                   \
   declare_constant(ConstMethod::_has_method_annotations)                  \
   declare_constant(ConstMethod::_has_parameter_annotations)               \
   declare_constant(ConstMethod::_has_default_annotations)                 \
--- a/src/share/vm/services/diagnosticCommand.cpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/services/diagnosticCommand.cpp	Mon Oct 28 17:32:02 2013 -0700
@@ -48,7 +48,7 @@
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<SystemGCDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<RunFinalizationDCmd>(full_export, true, false));
 #if INCLUDE_SERVICES // Heap dumping/inspection supported
-  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(full_export, true, false));
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<HeapDumpDCmd>(DCmd_Source_Internal | DCmd_Source_AttachAPI, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassHistogramDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassStatsDCmd>(full_export, true, false));
 #endif // INCLUDE_SERVICES
@@ -505,7 +505,11 @@
 
    _jdp_pause
   ("jdp.pause",
-   "set com.sun.management.jdp.pause", "INT", false)
+   "set com.sun.management.jdp.pause", "INT", false),
+
+   _jdp_name
+  ("jdp.name",
+   "set com.sun.management.jdp.name", "STRING", false)
 
   {
     _dcmdparser.add_dcmd_option(&_config_file);
@@ -527,6 +531,7 @@
     _dcmdparser.add_dcmd_option(&_jdp_source_addr);
     _dcmdparser.add_dcmd_option(&_jdp_ttl);
     _dcmdparser.add_dcmd_option(&_jdp_pause);
+    _dcmdparser.add_dcmd_option(&_jdp_name);
 }
 
 
@@ -596,6 +601,7 @@
     PUT_OPTION(_jdp_source_addr);
     PUT_OPTION(_jdp_ttl);
     PUT_OPTION(_jdp_pause);
+    PUT_OPTION(_jdp_name);
 
 #undef PUT_OPTION
 
--- a/src/share/vm/services/diagnosticCommand.hpp	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/services/diagnosticCommand.hpp	Mon Oct 28 17:32:02 2013 -0700
@@ -302,6 +302,7 @@
   DCmdArgument<char *> _jdp_source_addr;
   DCmdArgument<jlong>  _jdp_ttl;
   DCmdArgument<jlong>  _jdp_pause;
+  DCmdArgument<char *> _jdp_name;
 
 public:
   JMXStartRemoteDCmd(outputStream *output, bool heap_allocated);
--- a/src/share/vm/trace/traceEventClasses.xsl	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/trace/traceEventClasses.xsl	Mon Oct 28 17:32:02 2013 -0700
@@ -23,8 +23,8 @@
 -->
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="xsl_util.xsl"/>
 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
-<xsl:import href="xsl_util.xsl"/>
 
 <xsl:template match="/">
   <xsl:call-template name="file-header"/>
--- a/src/share/vm/trace/traceEventIds.xsl	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/trace/traceEventIds.xsl	Mon Oct 28 17:32:02 2013 -0700
@@ -23,8 +23,8 @@
 -->
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="xsl_util.xsl"/>
 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
-<xsl:import href="xsl_util.xsl"/>
 
 <xsl:template match="/">
   <xsl:call-template name="file-header"/>
--- a/src/share/vm/trace/traceTypes.xsl	Mon Oct 28 15:16:17 2013 -0700
+++ b/src/share/vm/trace/traceTypes.xsl	Mon Oct 28 17:32:02 2013 -0700
@@ -23,8 +23,8 @@
 -->
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="xsl_util.xsl"/>
 <xsl:output method="text" indent="no" omit-xml-declaration="yes"/>
-<xsl:import href="xsl_util.xsl"/>
 
 <xsl:template match="/">
   <xsl:call-template name="file-header"/>
--- a/test/TEST.groups	Mon Oct 28 15:16:17 2013 -0700
+++ b/test/TEST.groups	Mon Oct 28 17:32:02 2013 -0700
@@ -64,6 +64,7 @@
   gc/TestG1ZeroPGCTJcmdThreadPrint.java \
   gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java \
   gc/metaspace/TestMetaspacePerfCounters.java \
+  gc/metaspace/TestPerfCountersAndMemoryPools.java \
   runtime/6819213/TestBootNativeLibraryPath.java \
   runtime/6925573/SortMethodsTest.java \
   runtime/7107135/Test7107135.sh \
@@ -101,7 +102,9 @@
 needs_jre = \
   compiler/6852078/Test6852078.java \
   compiler/7047069/Test7047069.java \
-  runtime/6294277/SourceDebugExtension.java
+  runtime/6294277/SourceDebugExtension.java \
+  runtime/ClassFile/JsrRewriting.java \
+  runtime/ClassFile/OomWhileParsingRepeatedJsr.java
 
 # Compact 3 adds further tests to compact2
 #
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/TestSystemGC.java	Mon Oct 28 17:32:02 2013 -0700
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+/*
+ * @test TestSystemGC
+ * @key gc
+ * @summary Runs System.gc() with different flags.
+ * @run main/othervm TestSystemGC
+ * @run main/othervm -XX:+UseSerialGC TestSystemGC
+ * @run main/othervm -XX:+UseParNewGC TestSystemGC
+ * @run main/othervm -XX:+UseParallelGC TestSystemGC
+ * @run main/othervm -XX:+UseParallelGC -XX:-UseParallelOldGC TestSystemGC
+ * @run main/othervm -XX:+UseConcMarkSweepGC TestSystemGC
+ * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
+ * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParNewGC TestSystemGC
+ * @run main/othervm -XX:+UseG1GC TestSystemGC
+ * @run main/othervm -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
+ * @run main/othervm -XX:+UseLargePages TestSystemGC
+ * @run main/othervm -XX:+UseLargePages -XX:+UseLargePagesInMetaspace TestSystemGC
+ */
+
+public class TestSystemGC {
+  public static void main(String args[]) throws Exception {
+    System.gc();
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/8024804/RegisterNatives.java	Mon Oct 28 17:32:02 2013 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8024804
+ * @summary registerNatives() interface resolution should receive IAE
+ * @run main RegisterNatives
+ */
+public class RegisterNatives {
+  interface I { void registerNatives(); }
+  interface J extends I {}
+  static class B implements J { public void registerNatives() { System.out.println("B"); } }
+  public static void main(String... args) {
+    System.out.println("Regression test for JDK-8024804, crash when InterfaceMethodref resolves to Object.registerNatives\n");
+    J val = new B();
+    try {
+      val.registerNatives();
+    } catch (IllegalAccessError e) {
+      System.out.println("TEST PASSES - according to current JVM spec, IAE expected\n");
+      return;
+    }
+    System.out.println("TEST FAILS - no IAE resulted\n");
+    System.exit(1);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/8026394/InterfaceObjectTest.java	Mon Oct 28 17:32:02 2013 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8026394
+ * @summary clone() and finalize() interface resolution should not receive IAE
+ * @run main InterfaceObjectTest
+ */
+interface IClone extends Cloneable {
+    void finalize() throws Throwable;
+    Object clone();
+}
+
+interface ICloneExtend extends IClone { }
+
+public class InterfaceObjectTest implements ICloneExtend {
+
+    public Object clone() {
+        System.out.println("In InterfaceObjectTest's clone() method\n");
+        return null;
+    }
+
+    public void finalize() throws Throwable {
+        try {
+            System.out.println("In InterfaceObjectTest's finalize() method\n");
+        } catch (Throwable t) {
+            throw new AssertionError(t);
+        }
+    }
+
+    public static void tryIt(ICloneExtend o1) {
+        try {
+            Object o2 = o1.clone();
+            o1.finalize();
+        } catch (Throwable t) {
+            if (t instanceof IllegalAccessError) {
+                System.out.println("TEST FAILS - IAE resulted\n");
+                System.exit(1);
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        InterfaceObjectTest o1 = new InterfaceObjectTest();
+        tryIt(o1);
+        System.out.println("TEST PASSES - no IAE resulted\n");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/CommandLine/PrintGCApplicationConcurrentTime.java	Mon Oct 28 17:32:02 2013 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /*
+ * @test
+ * @bug 8026041
+ * @run main/othervm -XX:+PrintGCApplicationConcurrentTime -Xcomp PrintGCApplicationConcurrentTime
+ */
+
+public class PrintGCApplicationConcurrentTime {
+
+  public static void main(String args[]) throws Exception {
+  }
+}
--- a/test/testlibrary/com/oracle/java/testlibrary/JDKToolLauncher.java	Mon Oct 28 15:16:17 2013 -0700
+++ b/test/testlibrary/com/oracle/java/testlibrary/JDKToolLauncher.java	Mon Oct 28 17:32:02 2013 -0700
@@ -100,7 +100,7 @@
      * @return The JDKToolLauncher instance
      */
     public JDKToolLauncher addVMArg(String arg) {
-        vmArgs.add("-J" + arg);
+        vmArgs.add(arg);
         return this;
     }
 
@@ -124,7 +124,10 @@
     public String[] getCommand() {
         List<String> command = new ArrayList<String>();
         command.add(executable);
-        command.addAll(vmArgs);
+        // Add -J in front of all vmArgs
+        for (String arg : vmArgs) {
+            command.add("-J" + arg);
+        }
         command.addAll(toolArgs);
         return command.toArray(new String[command.size()]);
     }