changeset 7186:438cb613151c jdk9-b35

Merge
author lana
date Thu, 09 Oct 2014 12:17:17 -0700
parents 413cdfd8d0fe 8e576352f831
children fe314365bfc5 380b62522960
files test/gc/8000311/Test8000311.java test/gc/TestG1ZeroPGCTJcmdThreadPrint.java test/serviceability/dcmd/CodeCacheTest.java test/serviceability/dcmd/CodelistTest.java test/serviceability/dcmd/CompilerQueueTest.java test/serviceability/dcmd/MethodIdentifierParser.java
diffstat 113 files changed, 2928 insertions(+), 1452 deletions(-) [+]
line wrap: on
line diff
--- a/agent/src/os/win32/windbg/sawindbg.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/agent/src/os/win32/windbg/sawindbg.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -318,12 +318,18 @@
 
   path = (jstring) env->GetStaticObjectField(clazz, imagePath_ID);
   CHECK_EXCEPTION_(false);
+  if (path == NULL) {
+     THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: not able to get imagePath field ID!", false);
+  }
   buf = env->GetStringUTFChars(path, &isCopy);
   CHECK_EXCEPTION_(false);
   AutoJavaString imagePath(env, path, buf);
 
   path = (jstring) env->GetStaticObjectField(clazz, symbolPath_ID);
   CHECK_EXCEPTION_(false);
+  if (path == NULL) {
+     THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: not able to get symbolPath field ID!", false);
+  }
   buf = env->GetStringUTFChars(path, &isCopy);
   CHECK_EXCEPTION_(false);
   AutoJavaString symbolPath(env, path, buf);
--- a/src/cpu/ppc/vm/c2_globals_ppc.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/cpu/ppc/vm/c2_globals_ppc.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -81,7 +81,7 @@
 define_pd_global(intx, ReservedCodeCacheSize,        256*M);
 define_pd_global(intx, NonProfiledCodeHeapSize,      125*M);
 define_pd_global(intx, ProfiledCodeHeapSize,         126*M);
-define_pd_global(intx, NonMethodCodeHeapSize,        5*M  );
+define_pd_global(intx, NonNMethodCodeHeapSize,       5*M  );
 define_pd_global(intx, CodeCacheExpansionSize,       64*K);
 
 // Ergonomics related flags
--- a/src/cpu/sparc/vm/c1_globals_sparc.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/cpu/sparc/vm/c1_globals_sparc.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -49,7 +49,7 @@
 define_pd_global(intx, ReservedCodeCacheSize,        32*M );
 define_pd_global(intx, NonProfiledCodeHeapSize,      13*M );
 define_pd_global(intx, ProfiledCodeHeapSize,         14*M );
-define_pd_global(intx, NonMethodCodeHeapSize,        5*M  );
+define_pd_global(intx, NonNMethodCodeHeapSize,       5*M  );
 define_pd_global(intx, CodeCacheExpansionSize,       32*K );
 define_pd_global(uintx, CodeCacheMinBlockLength,     1);
 define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
--- a/src/cpu/sparc/vm/c2_globals_sparc.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/cpu/sparc/vm/c2_globals_sparc.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -76,7 +76,7 @@
 define_pd_global(intx, ReservedCodeCacheSize,        48*M);
 define_pd_global(intx, NonProfiledCodeHeapSize,      21*M);
 define_pd_global(intx, ProfiledCodeHeapSize,         22*M);
-define_pd_global(intx, NonMethodCodeHeapSize,        5*M );
+define_pd_global(intx, NonNMethodCodeHeapSize,       5*M );
 define_pd_global(intx, CodeCacheExpansionSize,       64*K);
 
 // Ergonomics related flags
@@ -87,7 +87,7 @@
 define_pd_global(intx, ReservedCodeCacheSize,        32*M);
 define_pd_global(intx, NonProfiledCodeHeapSize,      13*M);
 define_pd_global(intx, ProfiledCodeHeapSize,         14*M);
-define_pd_global(intx, NonMethodCodeHeapSize,        5*M );
+define_pd_global(intx, NonNMethodCodeHeapSize,       5*M );
 define_pd_global(intx, CodeCacheExpansionSize,       32*K);
 // Ergonomics related flags
 define_pd_global(uint64_t,MaxRAM,                    4ULL*G);
--- a/src/cpu/x86/vm/c1_globals_x86.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/cpu/x86/vm/c1_globals_x86.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -49,7 +49,7 @@
 define_pd_global(intx, ReservedCodeCacheSize,        32*M );
 define_pd_global(intx, NonProfiledCodeHeapSize,      13*M );
 define_pd_global(intx, ProfiledCodeHeapSize,         14*M );
-define_pd_global(intx, NonMethodCodeHeapSize,        5*M  );
+define_pd_global(intx, NonNMethodCodeHeapSize,       5*M  );
 define_pd_global(bool, ProfileInterpreter,           false);
 define_pd_global(intx, CodeCacheExpansionSize,       32*K );
 define_pd_global(uintx, CodeCacheMinBlockLength,     1);
--- a/src/cpu/x86/vm/c2_globals_x86.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/cpu/x86/vm/c2_globals_x86.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -86,7 +86,7 @@
 define_pd_global(intx, ReservedCodeCacheSize,        48*M);
 define_pd_global(intx, NonProfiledCodeHeapSize,      21*M);
 define_pd_global(intx, ProfiledCodeHeapSize,         22*M);
-define_pd_global(intx, NonMethodCodeHeapSize,        5*M );
+define_pd_global(intx, NonNMethodCodeHeapSize,       5*M );
 define_pd_global(uintx, CodeCacheMinBlockLength,     4);
 define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
 
--- a/src/cpu/zero/vm/shark_globals_zero.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/cpu/zero/vm/shark_globals_zero.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -55,7 +55,7 @@
 define_pd_global(intx,     ReservedCodeCacheSize,        32*M );
 define_pd_global(intx,     NonProfiledCodeHeapSize,      13*M );
 define_pd_global(intx,     ProfiledCodeHeapSize,         14*M );
-define_pd_global(intx,     NonMethodCodeHeapSize,        5*M  );
+define_pd_global(intx,     NonNMethodCodeHeapSize,       5*M  );
 define_pd_global(bool,     ProfileInterpreter,           false);
 define_pd_global(intx,     CodeCacheExpansionSize,       32*K );
 define_pd_global(uintx,    CodeCacheMinBlockLength,      1    );
--- a/src/share/vm/adlc/archDesc.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/adlc/archDesc.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -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
@@ -969,23 +969,22 @@
 void ArchDesc::initBaseOpTypes() {
   // Create OperandForm and assign type for each opcode.
   for (int i = 1; i < _last_machine_leaf; ++i) {
-    char        *ident   = (char *)NodeClassNames[i];
+    char *ident = (char *)NodeClassNames[i];
     constructOperand(ident, true);
   }
   // Create InstructForm and assign type for each ideal instruction.
-  for ( int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
-    char         *ident    = (char *)NodeClassNames[j];
-    if(!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
-       !strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
-       !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
-       !strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
-       !strcmp(ident, "Bool") ) {
+  for (int j = _last_machine_leaf+1; j < _last_opcode; ++j) {
+    char *ident = (char *)NodeClassNames[j];
+    if (!strcmp(ident, "ConI") || !strcmp(ident, "ConP") ||
+        !strcmp(ident, "ConN") || !strcmp(ident, "ConNKlass") ||
+        !strcmp(ident, "ConF") || !strcmp(ident, "ConD") ||
+        !strcmp(ident, "ConL") || !strcmp(ident, "Con" ) ||
+        !strcmp(ident, "Bool")) {
       constructOperand(ident, true);
-    }
-    else {
-      InstructForm *insForm  = new InstructForm(ident, true);
-      // insForm->_opcode       = nextUserOpType(ident);
-      _globalNames.Insert(ident,insForm);
+    } else {
+      InstructForm *insForm = new InstructForm(ident, true);
+      // insForm->_opcode = nextUserOpType(ident);
+      _globalNames.Insert(ident, insForm);
       addForm(insForm);
     }
   }
@@ -1038,6 +1037,9 @@
     ident = "TEMP";
     eForm = new Effect(ident);
     _globalNames.Insert(ident, eForm);
+    ident = "TEMP_DEF";
+    eForm = new Effect(ident);
+    _globalNames.Insert(ident, eForm);
     ident = "CALL";
     eForm = new Effect(ident);
     _globalNames.Insert(ident, eForm);
@@ -1050,8 +1052,8 @@
     const char *idealName = NodeClassNames[idealIndex];
     _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
   }
-  for ( idealIndex = _last_machine_leaf+1;
-        idealIndex < _last_opcode; ++idealIndex) {
+  for (idealIndex = _last_machine_leaf+1;
+       idealIndex < _last_opcode; ++idealIndex) {
     const char *idealName = NodeClassNames[idealIndex];
     _idealIndex.Insert((void*) idealName, (void*) (intptr_t) idealIndex);
   }
--- a/src/share/vm/adlc/formssel.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/adlc/formssel.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -1816,15 +1816,16 @@
 
 //------------------------------Effect-----------------------------------------
 static int effect_lookup(const char *name) {
-  if(!strcmp(name, "USE")) return Component::USE;
-  if(!strcmp(name, "DEF")) return Component::DEF;
-  if(!strcmp(name, "USE_DEF")) return Component::USE_DEF;
-  if(!strcmp(name, "KILL")) return Component::KILL;
-  if(!strcmp(name, "USE_KILL")) return Component::USE_KILL;
-  if(!strcmp(name, "TEMP")) return Component::TEMP;
-  if(!strcmp(name, "INVALID")) return Component::INVALID;
-  if(!strcmp(name, "CALL")) return Component::CALL;
-  assert( false,"Invalid effect name specified\n");
+  if (!strcmp(name, "USE")) return Component::USE;
+  if (!strcmp(name, "DEF")) return Component::DEF;
+  if (!strcmp(name, "USE_DEF")) return Component::USE_DEF;
+  if (!strcmp(name, "KILL")) return Component::KILL;
+  if (!strcmp(name, "USE_KILL")) return Component::USE_KILL;
+  if (!strcmp(name, "TEMP")) return Component::TEMP;
+  if (!strcmp(name, "TEMP_DEF")) return Component::TEMP_DEF;
+  if (!strcmp(name, "INVALID")) return Component::INVALID;
+  if (!strcmp(name, "CALL")) return Component::CALL;
+  assert(false,"Invalid effect name specified\n");
   return Component::INVALID;
 }
 
@@ -1836,6 +1837,7 @@
     case Component::USE_KILL: return "USE_KILL"; break;
     case Component::KILL:     return "KILL";     break;
     case Component::TEMP:     return "TEMP";     break;
+    case Component::TEMP_DEF: return "TEMP_DEF"; break;
     case Component::DEF:      return "DEF";      break;
     case Component::CALL:     return "CALL";     break;
     default: assert(false, "unknown effect");
--- a/src/share/vm/adlc/formssel.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/adlc/formssel.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -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
@@ -910,13 +910,16 @@
 public:
   // Implementation depends upon working bit intersection and union.
   enum use_def_enum {
-    INVALID = 0x0,
-    USE     = 0x1,
-    DEF     = 0x2, USE_DEF   = 0x3,
-    KILL    = 0x4, USE_KILL  = 0x5,
+    INVALID   = 0x0,
+    USE       = 0x1,
+    DEF       = 0x2,
+    USE_DEF   = USE | DEF,
+    KILL      = 0x4,
+    USE_KILL  = USE | KILL,
     SYNTHETIC = 0x8,
-    TEMP = USE | SYNTHETIC,
-    CALL = 0x10
+    TEMP      = USE | SYNTHETIC,
+    TEMP_DEF  = TEMP | DEF,
+    CALL      = 0x10
   };
 };
 
--- a/src/share/vm/adlc/output_c.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/adlc/output_c.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -1715,13 +1715,14 @@
     bool declared_def  = false;
     bool declared_kill = false;
 
-    while( (comp = node->_components.iter()) != NULL ) {
+    while ((comp = node->_components.iter()) != NULL) {
       // Lookup register class associated with operand type
-      Form        *form = (Form*)_globalNames[comp->_type];
-      assert( form, "component type must be a defined form");
-      OperandForm *op   = form->is_operand();
-
-      if (comp->is(Component::TEMP)) {
+      Form *form = (Form*)_globalNames[comp->_type];
+      assert(form, "component type must be a defined form");
+      OperandForm *op = form->is_operand();
+
+      if (comp->is(Component::TEMP) ||
+          comp->is(Component::TEMP_DEF)) {
         fprintf(fp, "  // TEMP %s\n", comp->_name);
         if (!declared_def) {
           // Define the variable "def" to hold new MachProjNodes
@@ -1750,7 +1751,7 @@
           declared_kill = true;
         }
 
-        assert( op, "Support additional KILLS for base operands");
+        assert(op, "Support additional KILLS for base operands");
         const char *regmask    = reg_mask(*op);
         const char *ideal_type = op->ideal_type(_globalNames, _register);
 
--- a/src/share/vm/c1/c1_Compilation.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/c1/c1_Compilation.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -38,17 +38,18 @@
 
 typedef enum {
   _t_compile,
-  _t_setup,
-  _t_buildIR,
-  _t_optimize_blocks,
-  _t_optimize_null_checks,
-  _t_rangeCheckElimination,
-  _t_emit_lir,
-  _t_linearScan,
-  _t_lirGeneration,
-  _t_lir_schedule,
-  _t_codeemit,
-  _t_codeinstall,
+    _t_setup,
+    _t_buildIR,
+      _t_hir_parse,
+      _t_gvn,
+      _t_optimize_blocks,
+      _t_optimize_null_checks,
+      _t_rangeCheckElimination,
+    _t_emit_lir,
+      _t_linearScan,
+      _t_lirGeneration,
+    _t_codeemit,
+    _t_codeinstall,
   max_phase_timers
 } TimerName;
 
@@ -56,13 +57,14 @@
   "compile",
   "setup",
   "buildIR",
+  "parse_hir",
+  "gvn",
   "optimize_blocks",
   "optimize_null_checks",
   "rangeCheckElimination",
   "emit_lir",
   "linearScan",
   "lirGeneration",
-  "lir_schedule",
   "codeemit",
   "codeinstall"
 };
@@ -144,7 +146,10 @@
     log->stamp();
     log->end_head();
   }
-  _hir = new IR(this, method(), osr_bci());
+  {
+    PhaseTraceTime timeit(_t_hir_parse);
+    _hir = new IR(this, method(), osr_bci());
+  }
   if (log)  log->done("parse");
   if (!_hir->is_valid()) {
     bailout("invalid parsing");
@@ -189,6 +194,7 @@
 
   if (UseGlobalValueNumbering) {
     // No resource mark here! LoopInvariantCodeMotion can allocate ValueStack objects.
+    PhaseTraceTime timeit(_t_gvn);
     int instructions = Instruction::number_of_instructions();
     GlobalValueNumbering gvn(_hir);
     assert(instructions == Instruction::number_of_instructions(),
@@ -419,8 +425,12 @@
 
 
 void Compilation::compile_method() {
-  // setup compilation
-  initialize();
+  {
+    PhaseTraceTime timeit(_t_setup);
+
+    // setup compilation
+    initialize();
+  }
 
   if (!method()->can_be_compiled()) {
     // Prevent race condition 6328518.
@@ -615,24 +625,54 @@
 }
 
 void Compilation::print_timers() {
-  // tty->print_cr("    Native methods         : %6.3f s, Average : %2.3f", CompileBroker::_t_native_compilation.seconds(), CompileBroker::_t_native_compilation.seconds() / CompileBroker::_total_native_compile_count);
-  float total = timers[_t_setup].seconds() + timers[_t_buildIR].seconds() + timers[_t_emit_lir].seconds() + timers[_t_lir_schedule].seconds() + timers[_t_codeemit].seconds() + timers[_t_codeinstall].seconds();
+  tty->print_cr("    C1 Compile Time:      %7.3f s",      timers[_t_compile].seconds());
+  tty->print_cr("       Setup time:          %7.3f s",    timers[_t_setup].seconds());
 
+  {
+    tty->print_cr("       Build HIR:           %7.3f s",    timers[_t_buildIR].seconds());
+    tty->print_cr("         Parse:               %7.3f s", timers[_t_hir_parse].seconds());
+    tty->print_cr("         Optimize blocks:     %7.3f s", timers[_t_optimize_blocks].seconds());
+    tty->print_cr("         GVN:                 %7.3f s", timers[_t_gvn].seconds());
+    tty->print_cr("         Null checks elim:    %7.3f s", timers[_t_optimize_null_checks].seconds());
+    tty->print_cr("         Range checks elim:   %7.3f s", timers[_t_rangeCheckElimination].seconds());
 
-  tty->print_cr("    Detailed C1 Timings");
-  tty->print_cr("       Setup time:        %6.3f s (%4.1f%%)",    timers[_t_setup].seconds(),           (timers[_t_setup].seconds() / total) * 100.0);
-  tty->print_cr("       Build IR:          %6.3f s (%4.1f%%)",    timers[_t_buildIR].seconds(),         (timers[_t_buildIR].seconds() / total) * 100.0);
-  float t_optimizeIR = timers[_t_optimize_blocks].seconds() + timers[_t_optimize_null_checks].seconds();
-  tty->print_cr("         Optimize:           %6.3f s (%4.1f%%)", t_optimizeIR,                         (t_optimizeIR / total) * 100.0);
-  tty->print_cr("         RCE:                %6.3f s (%4.1f%%)", timers[_t_rangeCheckElimination].seconds(),      (timers[_t_rangeCheckElimination].seconds() / total) * 100.0);
-  tty->print_cr("       Emit LIR:          %6.3f s (%4.1f%%)",    timers[_t_emit_lir].seconds(),        (timers[_t_emit_lir].seconds() / total) * 100.0);
-  tty->print_cr("         LIR Gen:          %6.3f s (%4.1f%%)",   timers[_t_lirGeneration].seconds(), (timers[_t_lirGeneration].seconds() / total) * 100.0);
-  tty->print_cr("         Linear Scan:      %6.3f s (%4.1f%%)",   timers[_t_linearScan].seconds(),    (timers[_t_linearScan].seconds() / total) * 100.0);
-  NOT_PRODUCT(LinearScan::print_timers(timers[_t_linearScan].seconds()));
-  tty->print_cr("       LIR Schedule:      %6.3f s (%4.1f%%)",    timers[_t_lir_schedule].seconds(),  (timers[_t_lir_schedule].seconds() / total) * 100.0);
-  tty->print_cr("       Code Emission:     %6.3f s (%4.1f%%)",    timers[_t_codeemit].seconds(),        (timers[_t_codeemit].seconds() / total) * 100.0);
-  tty->print_cr("       Code Installation: %6.3f s (%4.1f%%)",    timers[_t_codeinstall].seconds(),     (timers[_t_codeinstall].seconds() / total) * 100.0);
-  tty->print_cr("       Instruction Nodes: %6d nodes",    totalInstructionNodes);
+    double other = timers[_t_buildIR].seconds() -
+      (timers[_t_hir_parse].seconds() +
+       timers[_t_optimize_blocks].seconds() +
+       timers[_t_gvn].seconds() +
+       timers[_t_optimize_null_checks].seconds() +
+       timers[_t_rangeCheckElimination].seconds());
+    if (other > 0) {
+      tty->print_cr("         Other:               %7.3f s", other);
+    }
+  }
+
+  {
+    tty->print_cr("       Emit LIR:            %7.3f s",    timers[_t_emit_lir].seconds());
+    tty->print_cr("         LIR Gen:             %7.3f s",   timers[_t_lirGeneration].seconds());
+    tty->print_cr("         Linear Scan:         %7.3f s",   timers[_t_linearScan].seconds());
+    NOT_PRODUCT(LinearScan::print_timers(timers[_t_linearScan].seconds()));
+
+    double other = timers[_t_emit_lir].seconds() -
+      (timers[_t_lirGeneration].seconds() +
+       timers[_t_linearScan].seconds());
+    if (other > 0) {
+      tty->print_cr("         Other:               %7.3f s", other);
+    }
+  }
+
+  tty->print_cr("       Code Emission:       %7.3f s",    timers[_t_codeemit].seconds());
+  tty->print_cr("       Code Installation:   %7.3f s",    timers[_t_codeinstall].seconds());
+
+  double other = timers[_t_compile].seconds() -
+      (timers[_t_setup].seconds() +
+       timers[_t_buildIR].seconds() +
+       timers[_t_emit_lir].seconds() +
+       timers[_t_codeemit].seconds() +
+       timers[_t_codeinstall].seconds());
+  if (other > 0) {
+    tty->print_cr("       Other:               %7.3f s", other);
+  }
 
   NOT_PRODUCT(LinearScan::print_statistics());
 }
--- a/src/share/vm/ci/ciEnv.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/ci/ciEnv.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -580,7 +580,12 @@
     oop obj = cpool->resolved_references()->obj_at(cache_index);
     if (obj != NULL) {
       ciObject* ciobj = get_object(obj);
-      return ciConstant(T_OBJECT, ciobj);
+      if (ciobj->is_array()) {
+        return ciConstant(T_ARRAY, ciobj);
+      } else {
+        assert(ciobj->is_instance(), "should be an instance");
+        return ciConstant(T_OBJECT, ciobj);
+      }
     }
     index = cpool->object_to_cp_index(cache_index);
   }
@@ -607,8 +612,12 @@
       }
     }
     ciObject* constant = get_object(string);
-    assert (constant->is_instance(), "must be an instance, or not? ");
-    return ciConstant(T_OBJECT, constant);
+    if (constant->is_array()) {
+      return ciConstant(T_ARRAY, constant);
+    } else {
+      assert (constant->is_instance(), "must be an instance, or not? ");
+      return ciConstant(T_OBJECT, constant);
+    }
   } else if (tag.is_klass() || tag.is_unresolved_klass()) {
     // 4881222: allow ldc to take a class type
     ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor);
--- a/src/share/vm/ci/ciTypeFlow.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/ci/ciTypeFlow.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -730,7 +730,7 @@
     if (obj->is_null_object()) {
       push_null();
     } else {
-      assert(obj->is_instance(), "must be java_mirror of klass");
+      assert(obj->is_instance() || obj->is_array(), "must be java_mirror of klass");
       push_object(obj->klass());
     }
   } else {
--- a/src/share/vm/classfile/javaClasses.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/classfile/javaClasses.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -636,6 +636,7 @@
     }
 
     // set the classLoader field in the java_lang_Class instance
+    assert(class_loader() == k->class_loader(), "should be same");
     set_class_loader(mirror(), class_loader());
 
     // Setup indirection from klass->mirror last
--- a/src/share/vm/classfile/symbolTable.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/classfile/symbolTable.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -496,77 +496,65 @@
 void SymbolTable::print_histogram() {
   MutexLocker ml(SymbolTable_lock);
   const int results_length = 100;
-  int results[results_length];
+  int counts[results_length];
+  int sizes[results_length];
   int i,j;
 
   // initialize results to zero
   for (j = 0; j < results_length; j++) {
-    results[j] = 0;
+    counts[j] = 0;
+    sizes[j] = 0;
   }
 
-  int total = 0;
-  int max_symbols = 0;
-  int out_of_range = 0;
-  int memory_total = 0;
-  int count = 0;
+  int total_size = 0;
+  int total_count = 0;
+  int total_length = 0;
+  int max_length = 0;
+  int out_of_range_count = 0;
+  int out_of_range_size = 0;
   for (i = 0; i < the_table()->table_size(); i++) {
     HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
     for ( ; p != NULL; p = p->next()) {
-      memory_total += p->literal()->size();
-      count++;
-      int counter = p->literal()->utf8_length();
-      total += counter;
-      if (counter < results_length) {
-        results[counter]++;
+      int size = p->literal()->size();
+      int len = p->literal()->utf8_length();
+      if (len < results_length) {
+        counts[len]++;
+        sizes[len] += size;
       } else {
-        out_of_range++;
+        out_of_range_count++;
+        out_of_range_size += size;
       }
-      max_symbols = MAX2(max_symbols, counter);
+      total_count++;
+      total_size += size;
+      total_length += len;
+      max_length = MAX2(max_length, len);
     }
   }
-  tty->print_cr("Symbol Table:");
-  tty->print_cr("Total number of symbols  %5d", count);
-  tty->print_cr("Total size in memory     %5dK",
-          (memory_total*HeapWordSize)/1024);
-  tty->print_cr("Total counted            %5d", _symbols_counted);
-  tty->print_cr("Total removed            %5d", _symbols_removed);
+  tty->print_cr("Symbol Table Histogram:");
+  tty->print_cr("  Total number of symbols  %7d", total_count);
+  tty->print_cr("  Total size in memory     %7dK",
+          (total_size*HeapWordSize)/1024);
+  tty->print_cr("  Total counted            %7d", _symbols_counted);
+  tty->print_cr("  Total removed            %7d", _symbols_removed);
   if (_symbols_counted > 0) {
-    tty->print_cr("Percent removed          %3.2f",
+    tty->print_cr("  Percent removed          %3.2f",
           ((float)_symbols_removed/(float)_symbols_counted)* 100);
   }
-  tty->print_cr("Reference counts         %5d", Symbol::_total_count);
-  tty->print_cr("Symbol arena size        %5d used %5d",
-                 arena()->size_in_bytes(), arena()->used());
-  tty->print_cr("Histogram of symbol length:");
-  tty->print_cr("%8s %5d", "Total  ", total);
-  tty->print_cr("%8s %5d", "Maximum", max_symbols);
-  tty->print_cr("%8s %3.2f", "Average",
-          ((float) total / (float) the_table()->table_size()));
-  tty->print_cr("%s", "Histogram:");
-  tty->print_cr(" %s %29s", "Length", "Number chains that length");
+  tty->print_cr("  Reference counts         %7d", Symbol::_total_count);
+  tty->print_cr("  Symbol arena used        %7dK", arena()->used()/1024);
+  tty->print_cr("  Symbol arena size        %7dK", arena()->size_in_bytes()/1024);
+  tty->print_cr("  Total symbol length      %7d", total_length);
+  tty->print_cr("  Maximum symbol length    %7d", max_length);
+  tty->print_cr("  Average symbol length    %7.2f", ((float) total_length / (float) total_count));
+  tty->print_cr("  Symbol length histogram:");
+  tty->print_cr("    %6s %10s %10s", "Length", "#Symbols", "Size");
   for (i = 0; i < results_length; i++) {
-    if (results[i] > 0) {
-      tty->print_cr("%6d %10d", i, results[i]);
+    if (counts[i] > 0) {
+      tty->print_cr("    %6d %10d %10dK", i, counts[i], (sizes[i]*HeapWordSize)/1024);
     }
   }
-  if (Verbose) {
-    int line_length = 70;
-    tty->print_cr("%s %30s", " Length", "Number chains that length");
-    for (i = 0; i < results_length; i++) {
-      if (results[i] > 0) {
-        tty->print("%4d", i);
-        for (j = 0; (j < results[i]) && (j < line_length);  j++) {
-          tty->print("%1s", "*");
-        }
-        if (j == line_length) {
-          tty->print("%1s", "+");
-        }
-        tty->cr();
-      }
-    }
-  }
-  tty->print_cr(" %s %d: %d\n", "Number chains longer than",
-                    results_length, out_of_range);
+  tty->print_cr("  >=%6d %10d %10dK\n", results_length,
+          out_of_range_count, (out_of_range_size*HeapWordSize)/1024);
 }
 
 void SymbolTable::print() {
--- a/src/share/vm/classfile/systemDictionary.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/classfile/systemDictionary.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -2273,12 +2273,14 @@
     spe = NULL;
     // Must create lots of stuff here, but outside of the SystemDictionary lock.
     m = Method::make_method_handle_intrinsic(iid, signature, CHECK_(empty));
-    CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_highest_tier,
-                                  methodHandle(), CompileThreshold, "MH", CHECK_(empty));
-    // Check if we need to have compiled code but we don't.
-    if (!Arguments::is_interpreter_only() && !m->has_compiled_code()) {
-      THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
-                 "out of space in CodeCache for method handle intrinsic", empty);
+    if (!Arguments::is_interpreter_only()) {
+      // Generate a compiled form of the MH intrinsic.
+      AdapterHandlerLibrary::create_native_wrapper(m);
+      // Check if have the compiled code.
+      if (!m->has_compiled_code()) {
+        THROW_MSG_(vmSymbols::java_lang_VirtualMachineError(),
+                   "out of space in CodeCache for method handle intrinsic", empty);
+      }
     }
     // Now grab the lock.  We might have to throw away the new method,
     // if a racing thread has managed to install one at the same time.
--- a/src/share/vm/classfile/verifier.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/classfile/verifier.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -406,13 +406,20 @@
   }
 
   // Keep a list of temporary symbols created during verification because
-  // their reference counts need to be decrememented when the verifier object
+  // their reference counts need to be decremented when the verifier object
   // goes out of scope.  Since these symbols escape the scope in which they're
   // created, we can't use a TempNewSymbol.
-  Symbol* create_temporary_symbol(
-      const Symbol* s, int begin, int end, TRAPS);
+  Symbol* create_temporary_symbol(const Symbol* s, int begin, int end, TRAPS);
   Symbol* create_temporary_symbol(const char *s, int length, TRAPS);
 
+  Symbol* create_temporary_symbol(Symbol* s) {
+    // This version just updates the reference count and saves the symbol to be
+    // dereferenced later.
+    s->increment_refcount();
+    _symbols->push(s);
+    return s;
+  }
+
   TypeOrigin ref_ctx(const char* str, TRAPS);
 
 };
@@ -425,10 +432,8 @@
     case T_ARRAY:
       {
         Symbol* name = sig_type->as_symbol(CHECK_0);
-        // Create another symbol to save as signature stream unreferences
-        // this symbol.
-        Symbol* name_copy =
-          create_temporary_symbol(name, 0, name->utf8_length(), CHECK_0);
+        // Create another symbol to save as signature stream unreferences this symbol.
+        Symbol* name_copy = create_temporary_symbol(name);
         assert(name_copy == name, "symbols don't match");
         *inference_type =
           VerificationType::reference_type(name_copy);
--- a/src/share/vm/code/codeBlob.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/codeBlob.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -230,7 +230,7 @@
 }
 
 void* BufferBlob::operator new(size_t s, unsigned size, bool is_critical) throw() {
-  return CodeCache::allocate(size, CodeBlobType::NonMethod, is_critical);
+  return CodeCache::allocate(size, CodeBlobType::NonNMethod, is_critical);
 }
 
 void BufferBlob::free(BufferBlob *blob) {
@@ -336,14 +336,14 @@
 
 
 void* RuntimeStub::operator new(size_t s, unsigned size) throw() {
-  void* p = CodeCache::allocate(size, CodeBlobType::NonMethod, true);
+  void* p = CodeCache::allocate(size, CodeBlobType::NonNMethod, true);
   if (!p) fatal("Initial size of CodeCache is too small");
   return p;
 }
 
 // operator new shared by all singletons:
 void* SingletonBlob::operator new(size_t s, unsigned size) throw() {
-  void* p = CodeCache::allocate(size, CodeBlobType::NonMethod, true);
+  void* p = CodeCache::allocate(size, CodeBlobType::NonNMethod, true);
   if (!p) fatal("Initial size of CodeCache is too small");
   return p;
 }
--- a/src/share/vm/code/codeBlob.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/codeBlob.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -36,7 +36,7 @@
   enum {
     MethodNonProfiled   = 0,    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
     MethodProfiled      = 1,    // Execution level 2 and 3 (profiled) nmethods
-    NonMethod           = 2,    // Non-methods like Buffers, Adapters and Runtime Stubs
+    NonNMethod          = 2,    // Non-nmethods like Buffers, Adapters and Runtime Stubs
     All                 = 3,    // All types (No code cache segmentation)
     NumTypes            = 4     // Number of CodeBlobTypes
   };
--- a/src/share/vm/code/codeCache.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/codeCache.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -158,23 +158,23 @@
 #endif
 
   // Calculate default CodeHeap sizes if not set by user
-  if (!FLAG_IS_CMDLINE(NonMethodCodeHeapSize) && !FLAG_IS_CMDLINE(ProfiledCodeHeapSize)
+  if (!FLAG_IS_CMDLINE(NonNMethodCodeHeapSize) && !FLAG_IS_CMDLINE(ProfiledCodeHeapSize)
       && !FLAG_IS_CMDLINE(NonProfiledCodeHeapSize)) {
-    // Increase default NonMethodCodeHeapSize to account for compiler buffers
-    FLAG_SET_ERGO(uintx, NonMethodCodeHeapSize, NonMethodCodeHeapSize + code_buffers_size);
+    // Increase default NonNMethodCodeHeapSize to account for compiler buffers
+    FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, NonNMethodCodeHeapSize + code_buffers_size);
 
-    // Check if we have enough space for the non-method code heap
-    if (ReservedCodeCacheSize > NonMethodCodeHeapSize) {
-      // Use the default value for NonMethodCodeHeapSize and one half of the
+    // Check if we have enough space for the non-nmethod code heap
+    if (ReservedCodeCacheSize > NonNMethodCodeHeapSize) {
+      // Use the default value for NonNMethodCodeHeapSize and one half of the
       // remaining size for non-profiled methods and one half for profiled methods
-      size_t remaining_size = ReservedCodeCacheSize - NonMethodCodeHeapSize;
+      size_t remaining_size = ReservedCodeCacheSize - NonNMethodCodeHeapSize;
       size_t profiled_size = remaining_size / 2;
       size_t non_profiled_size = remaining_size - profiled_size;
       FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, profiled_size);
       FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, non_profiled_size);
     } else {
-      // Use all space for the non-method heap and set other heaps to minimal size
-      FLAG_SET_ERGO(uintx, NonMethodCodeHeapSize, ReservedCodeCacheSize - os::vm_page_size() * 2);
+      // Use all space for the non-nmethod heap and set other heaps to minimal size
+      FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, ReservedCodeCacheSize - os::vm_page_size() * 2);
       FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, os::vm_page_size());
       FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, os::vm_page_size());
     }
@@ -185,21 +185,21 @@
     FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize + ProfiledCodeHeapSize);
     FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, 0);
   }
-  // We do not need the non-profiled CodeHeap, use all space for the non-method CodeHeap
+  // We do not need the non-profiled CodeHeap, use all space for the non-nmethod CodeHeap
   if(!heap_available(CodeBlobType::MethodNonProfiled)) {
-    FLAG_SET_ERGO(uintx, NonMethodCodeHeapSize, NonMethodCodeHeapSize + NonProfiledCodeHeapSize);
+    FLAG_SET_ERGO(uintx, NonNMethodCodeHeapSize, NonNMethodCodeHeapSize + NonProfiledCodeHeapSize);
     FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, 0);
   }
 
   // Make sure we have enough space for VM internal code
   uint min_code_cache_size = (CodeCacheMinimumUseSpace DEBUG_ONLY(* 3)) + CodeCacheMinimumFreeSpace;
-  if (NonMethodCodeHeapSize < (min_code_cache_size + code_buffers_size)) {
-    vm_exit_during_initialization("Not enough space in non-method code heap to run VM.");
+  if (NonNMethodCodeHeapSize < (min_code_cache_size + code_buffers_size)) {
+    vm_exit_during_initialization("Not enough space in non-nmethod code heap to run VM.");
   }
-  guarantee(NonProfiledCodeHeapSize + ProfiledCodeHeapSize + NonMethodCodeHeapSize <= ReservedCodeCacheSize, "Size check");
+  guarantee(NonProfiledCodeHeapSize + ProfiledCodeHeapSize + NonNMethodCodeHeapSize <= ReservedCodeCacheSize, "Size check");
 
   // Align reserved sizes of CodeHeaps
-  size_t non_method_size    = ReservedCodeSpace::allocation_align_size_up(NonMethodCodeHeapSize);
+  size_t non_method_size    = ReservedCodeSpace::allocation_align_size_up(NonNMethodCodeHeapSize);
   size_t profiled_size      = ReservedCodeSpace::allocation_align_size_up(ProfiledCodeHeapSize);
   size_t non_profiled_size  = ReservedCodeSpace::allocation_align_size_up(NonProfiledCodeHeapSize);
 
@@ -213,7 +213,7 @@
   // ---------- high -----------
   //    Non-profiled nmethods
   //      Profiled nmethods
-  //         Non-methods
+  //         Non-nmethods
   // ---------- low ------------
   ReservedCodeSpace rs = reserve_heap_memory(non_profiled_size + profiled_size + non_method_size);
   ReservedSpace non_method_space    = rs.first_part(non_method_size);
@@ -221,12 +221,12 @@
   ReservedSpace profiled_space      = rest.first_part(profiled_size);
   ReservedSpace non_profiled_space  = rest.last_part(profiled_size);
 
-  // Non-methods (stubs, adapters, ...)
-  add_heap(non_method_space, "non-methods", init_non_method_size, CodeBlobType::NonMethod);
+  // Non-nmethods (stubs, adapters, ...)
+  add_heap(non_method_space, "CodeHeap 'non-nmethods'", init_non_method_size, CodeBlobType::NonNMethod);
   // Tier 2 and tier 3 (profiled) methods
-  add_heap(profiled_space, "profiled nmethods", init_profiled_size, CodeBlobType::MethodProfiled);
+  add_heap(profiled_space, "CodeHeap 'profiled nmethods'", init_profiled_size, CodeBlobType::MethodProfiled);
   // Tier 1 and tier 4 (non-profiled) methods and native methods
-  add_heap(non_profiled_space, "non-profiled nmethods", init_non_profiled_size, CodeBlobType::MethodNonProfiled);
+  add_heap(non_profiled_space, "CodeHeap 'non-profiled nmethods'", init_non_profiled_size, CodeBlobType::MethodNonProfiled);
 }
 
 ReservedCodeSpace CodeCache::reserve_heap_memory(size_t size) {
@@ -257,13 +257,13 @@
   } else if ((Arguments::mode() == Arguments::_int) ||
              (TieredStopAtLevel == CompLevel_none)) {
     // Interpreter only: we don't need any method code heaps
-    return (code_blob_type == CodeBlobType::NonMethod);
+    return (code_blob_type == CodeBlobType::NonNMethod);
   } else if (TieredCompilation && (TieredStopAtLevel > CompLevel_simple)) {
     // Tiered compilation: use all code heaps
     return (code_blob_type < CodeBlobType::All);
   } else {
-    // No TieredCompilation: we only need the non-method and non-profiled code heap
-    return (code_blob_type == CodeBlobType::NonMethod) ||
+    // No TieredCompilation: we only need the non-nmethod and non-profiled code heap
+    return (code_blob_type == CodeBlobType::NonNMethod) ||
            (code_blob_type == CodeBlobType::MethodNonProfiled);
   }
 }
@@ -347,16 +347,16 @@
   CodeBlob* cb = NULL;
 
   // Get CodeHeap for the given CodeBlobType
-  CodeHeap* heap = get_code_heap(SegmentedCodeCache ? code_blob_type : CodeBlobType::All);
-  assert (heap != NULL, "heap is null");
+  CodeHeap* heap = get_code_heap(code_blob_type);
+  assert(heap != NULL, "heap is null");
 
   while (true) {
     cb = (CodeBlob*)heap->allocate(size, is_critical);
     if (cb != NULL) break;
     if (!heap->expand_by(CodeCacheExpansionSize)) {
       // Expansion failed
-      if (SegmentedCodeCache && (code_blob_type == CodeBlobType::NonMethod)) {
-        // Fallback solution: Store non-method code in the non-profiled code heap
+      if (SegmentedCodeCache && (code_blob_type == CodeBlobType::NonNMethod)) {
+        // Fallback solution: Store non-nmethod code in the non-profiled code heap
         return allocate(size, CodeBlobType::MethodNonProfiled, is_critical);
       }
       return NULL;
@@ -364,9 +364,9 @@
     if (PrintCodeCacheExtension) {
       ResourceMark rm;
       if (SegmentedCodeCache) {
-        tty->print("Code heap '%s'", heap->name());
+        tty->print("%s", heap->name());
       } else {
-        tty->print("Code cache");
+        tty->print("CodeCache");
       }
       tty->print_cr(" extended to [" INTPTR_FORMAT ", " INTPTR_FORMAT "] (" SSIZE_FORMAT " bytes)",
                     (intptr_t)heap->low_boundary(), (intptr_t)heap->high(),
@@ -734,6 +734,11 @@
   return cap;
 }
 
+size_t CodeCache::unallocated_capacity(int code_blob_type) {
+  CodeHeap* heap = get_code_heap(code_blob_type);
+  return (heap != NULL) ? heap->unallocated_capacity() : 0;
+}
+
 size_t CodeCache::unallocated_capacity() {
   size_t unallocated_cap = 0;
   FOR_ALL_HEAPS(heap) {
@@ -820,7 +825,7 @@
   } else {
     // Use a single code heap
     ReservedCodeSpace rs = reserve_heap_memory(ReservedCodeCacheSize);
-    add_heap(rs, "Code heap", InitialCodeCacheSize, CodeBlobType::All);
+    add_heap(rs, "CodeCache", InitialCodeCacheSize, CodeBlobType::All);
   }
 
   // Initialize ICache flush mechanism
@@ -1000,13 +1005,14 @@
 // A CodeHeap is full. Print out warning and report event.
 void CodeCache::report_codemem_full(int code_blob_type, bool print) {
   // Get nmethod heap for the given CodeBlobType and build CodeCacheFull event
-  CodeHeap* heap = get_code_heap(SegmentedCodeCache ? code_blob_type : CodeBlobType::All);
+  CodeHeap* heap = get_code_heap(code_blob_type);
+  assert(heap != NULL, "heap is null");
 
   if (!heap->was_full() || print) {
     // Not yet reported for this heap, report
     heap->report_full();
     if (SegmentedCodeCache) {
-      warning("CodeHeap for %s is full. Compiler has been disabled.", CodeCache::get_code_heap_name(code_blob_type));
+      warning("%s is full. Compiler has been disabled.", CodeCache::get_code_heap_name(code_blob_type));
       warning("Try increasing the code heap size using -XX:%s=",
           (code_blob_type == CodeBlobType::MethodNonProfiled) ? "NonProfiledCodeHeapSize" : "ProfiledCodeHeapSize");
     } else {
@@ -1090,7 +1096,7 @@
   int i = 0;
   FOR_ALL_HEAPS(heap) {
     if (SegmentedCodeCache && Verbose) {
-      tty->print_cr("-- Code heap '%s' --", (*heap)->name());
+      tty->print_cr("-- %s --", (*heap)->name());
     }
     FOR_ALL_BLOBS(cb, *heap) {
       total++;
@@ -1239,7 +1245,7 @@
     CodeHeap* heap = (*heap_iterator);
     size_t total = (heap->high_boundary() - heap->low_boundary());
     if (SegmentedCodeCache) {
-      st->print("CodeHeap '%s':", heap->name());
+      st->print("%s:", heap->name());
     } else {
       st->print("CodeCache:");
     }
--- a/src/share/vm/code/codeCache.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/codeCache.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -41,14 +41,14 @@
 // The CodeCache consists of one or more CodeHeaps, each of which contains
 // CodeBlobs of a specific CodeBlobType. Currently heaps for the following
 // types are available:
-//  - Non-methods: Non-methods like Buffers, Adapters and Runtime Stubs
+//  - Non-nmethods: Non-nmethods like Buffers, Adapters and Runtime Stubs
 //  - Profiled nmethods: nmethods that are profiled, i.e., those
 //    executed at level 2 or 3
 //  - Non-Profiled nmethods: nmethods that are not profiled, i.e., those
 //    executed at level 1 or 4 and native methods
 //  - All: Used for code of all types if code cache segmentation is disabled.
 //
-// In the rare case of the non-method code heap getting full, non-method code
+// In the rare case of the non-nmethod code heap getting full, non-nmethod code
 // will be stored in the non-profiled code heap as a fallback solution.
 //
 // Depending on the availability of compilers and TieredCompilation there
@@ -100,7 +100,7 @@
   static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type);
   static CodeHeap* get_code_heap(CodeBlob* cb);               // Returns the CodeHeap for the given CodeBlob
   static CodeHeap* get_code_heap(int code_blob_type);         // Returns the CodeHeap for the given CodeBlobType
-  static bool heap_available(int code_blob_type);             // Returns true if a CodeHeap for the given CodeBlobType is available
+  static bool heap_available(int code_blob_type);             // Returns true if an own CodeHeap for the given CodeBlobType is available
   static ReservedCodeSpace reserve_heap_memory(size_t size);  // Reserves one continuous chunk of memory for the CodeHeaps
 
   // Iteration
@@ -175,11 +175,9 @@
   static address high_bound()                         { return _high_bound; }
 
   // Profiling
-  static size_t capacity(int code_blob_type)             { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->capacity() : 0; }
   static size_t capacity();
-  static size_t unallocated_capacity(int code_blob_type) { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->unallocated_capacity() : 0; }
+  static size_t unallocated_capacity(int code_blob_type);
   static size_t unallocated_capacity();
-  static size_t max_capacity(int code_blob_type)         { return heap_available(code_blob_type) ? get_code_heap(code_blob_type)->max_capacity() : 0; }
   static size_t max_capacity();
 
   static bool   is_full(int* code_blob_type);
--- a/src/share/vm/code/compiledIC.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/compiledIC.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -155,6 +155,14 @@
   return _ic_call->destination();
 }
 
+// Clears the IC stub if the compiled IC is in transition state
+void CompiledIC::clear_ic_stub() {
+  if (is_in_transition_state()) {
+    ICStub* stub = ICStub_from_destination_address(stub_address());
+    stub->clear();
+  }
+}
+
 
 //-----------------------------------------------------------------------------
 // High-level access to an inline cache. Guaranteed to be MT-safe.
@@ -333,10 +341,7 @@
 
   if (safe_transition) {
     // Kill any leftover stub we might have too
-    if (is_in_transition_state()) {
-      ICStub* old_stub = ICStub_from_destination_address(stub_address());
-      old_stub->clear();
-    }
+    clear_ic_stub();
     if (is_optimized()) {
     set_ic_destination(entry);
   } else {
--- a/src/share/vm/code/compiledIC.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/compiledIC.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -216,6 +216,7 @@
   //
   void set_to_clean();  // Can only be called during a safepoint operation
   void set_to_monomorphic(CompiledICInfo& info);
+  void clear_ic_stub();
 
   // Returns true if successful and false otherwise. The call can fail if memory
   // allocation in the code cache fails.
--- a/src/share/vm/code/dependencies.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/dependencies.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -567,12 +567,16 @@
       what = "object ";
     }
     tty->print("  %s = %s", what, (put_star? "*": ""));
-    if (arg.is_klass())
+    if (arg.is_klass()) {
       tty->print("%s", ((Klass*)arg.metadata_value())->external_name());
-    else if (arg.is_method())
+    } else if (arg.is_method()) {
       ((Method*)arg.metadata_value())->print_value();
-    else
+    } else if (arg.is_oop()) {
+      arg.oop_value()->print_value_on(tty);
+    } else {
       ShouldNotReachHere(); // Provide impl for this type.
+    }
+
     tty->cr();
   }
   if (witness != NULL) {
@@ -609,7 +613,11 @@
   int nargs = argument_count();
   GrowableArray<DepArgument>* args = new GrowableArray<DepArgument>(nargs);
   for (int j = 0; j < nargs; j++) {
-    args->push(argument(j));
+    if (type() == call_site_target_value) {
+      args->push(argument_oop(j));
+    } else {
+      args->push(argument(j));
+    }
   }
   int argslen = args->length();
   Dependencies::print_dependency(type(), args, witness);
--- a/src/share/vm/code/nmethod.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/nmethod.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -1130,6 +1130,18 @@
   }
 }
 
+// Clear ICStubs of all compiled ICs
+void nmethod::clear_ic_stubs() {
+  assert_locked_or_safepoint(CompiledIC_lock);
+  RelocIterator iter(this);
+  while(iter.next()) {
+    if (iter.type() == relocInfo::virtual_call_type) {
+      CompiledIC* ic = CompiledIC_at(&iter);
+      ic->clear_ic_stub();
+    }
+  }
+}
+
 
 void nmethod::cleanup_inline_caches() {
 
--- a/src/share/vm/code/nmethod.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/nmethod.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -577,6 +577,7 @@
 
   // Inline cache support
   void clear_inline_caches();
+  void clear_ic_stubs();
   void cleanup_inline_caches();
   bool inlinecache_check_contains(address addr) const {
     return (addr >= code_begin() && addr < verified_entry_point());
--- a/src/share/vm/code/vtableStubs.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/code/vtableStubs.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -63,7 +63,7 @@
    // If changing the name, update the other file accordingly.
     BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
     if (blob == NULL) {
-      CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
+      CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
       return NULL;
     }
     _chunk = blob->content_begin();
--- a/src/share/vm/compiler/compileBroker.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/compiler/compileBroker.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -137,6 +137,8 @@
 elapsedTimer CompileBroker::_t_total_compilation;
 elapsedTimer CompileBroker::_t_osr_compilation;
 elapsedTimer CompileBroker::_t_standard_compilation;
+elapsedTimer CompileBroker::_t_invalidated_compilation;
+elapsedTimer CompileBroker::_t_bailedout_compilation;
 
 int CompileBroker::_total_bailout_count          = 0;
 int CompileBroker::_total_invalidated_count      = 0;
@@ -2236,6 +2238,11 @@
   // _perf variables are production performance counters which are
   // updated regardless of the setting of the CITime and CITimeEach flags
   //
+
+  // account all time, including bailouts and failures in this counter;
+  // C1 and C2 counters are counting both successful and unsuccessful compiles
+  _t_total_compilation.add(time);
+
   if (!success) {
     _total_bailout_count++;
     if (UsePerfData) {
@@ -2243,6 +2250,7 @@
       _perf_last_failed_type->set_value(counters->compile_type());
       _perf_total_bailout_count->inc();
     }
+    _t_bailedout_compilation.add(time);
   } else if (code == NULL) {
     if (UsePerfData) {
       _perf_last_invalidated_method->set_value(counters->current_method());
@@ -2250,14 +2258,13 @@
       _perf_total_invalidated_count->inc();
     }
     _total_invalidated_count++;
+    _t_invalidated_compilation.add(time);
   } else {
     // Compilation succeeded
 
     // update compilation ticks - used by the implementation of
     // java.lang.management.CompilationMBean
     _perf_total_compilation->inc(time.ticks());
-
-    _t_total_compilation.add(time);
     _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time;
 
     if (CITime) {
@@ -2325,37 +2332,47 @@
 
 void CompileBroker::print_times() {
   tty->cr();
-  tty->print_cr("Accumulated compiler times (for compiled methods only)");
-  tty->print_cr("------------------------------------------------");
+  tty->print_cr("Accumulated compiler times");
+  tty->print_cr("----------------------------------------------------------");
                //0000000000111111111122222222223333333333444444444455555555556666666666
                //0123456789012345678901234567890123456789012345678901234567890123456789
-  tty->print_cr("  Total compilation time   : %6.3f s", CompileBroker::_t_total_compilation.seconds());
-  tty->print_cr("    Standard compilation   : %6.3f s, Average : %2.3f",
+  tty->print_cr("  Total compilation time   : %7.3f s", CompileBroker::_t_total_compilation.seconds());
+  tty->print_cr("    Standard compilation   : %7.3f s, Average : %2.3f s",
                 CompileBroker::_t_standard_compilation.seconds(),
                 CompileBroker::_t_standard_compilation.seconds() / CompileBroker::_total_standard_compile_count);
-  tty->print_cr("    On stack replacement   : %6.3f s, Average : %2.3f", CompileBroker::_t_osr_compilation.seconds(), CompileBroker::_t_osr_compilation.seconds() / CompileBroker::_total_osr_compile_count);
+  tty->print_cr("    Bailed out compilation : %7.3f s, Average : %2.3f s",
+                CompileBroker::_t_bailedout_compilation.seconds(),
+                CompileBroker::_t_bailedout_compilation.seconds() / CompileBroker::_total_bailout_count);
+  tty->print_cr("    On stack replacement   : %7.3f s, Average : %2.3f s",
+                CompileBroker::_t_osr_compilation.seconds(),
+                CompileBroker::_t_osr_compilation.seconds() / CompileBroker::_total_osr_compile_count);
+  tty->print_cr("    Invalidated            : %7.3f s, Average : %2.3f s",
+                CompileBroker::_t_invalidated_compilation.seconds(),
+                CompileBroker::_t_invalidated_compilation.seconds() / CompileBroker::_total_invalidated_count);
 
   AbstractCompiler *comp = compiler(CompLevel_simple);
   if (comp != NULL) {
+    tty->cr();
     comp->print_timers();
   }
   comp = compiler(CompLevel_full_optimization);
   if (comp != NULL) {
+    tty->cr();
     comp->print_timers();
   }
   tty->cr();
-  tty->print_cr("  Total compiled methods   : %6d methods", CompileBroker::_total_compile_count);
-  tty->print_cr("    Standard compilation   : %6d methods", CompileBroker::_total_standard_compile_count);
-  tty->print_cr("    On stack replacement   : %6d methods", CompileBroker::_total_osr_compile_count);
+  tty->print_cr("  Total compiled methods    : %8d methods", CompileBroker::_total_compile_count);
+  tty->print_cr("    Standard compilation    : %8d methods", CompileBroker::_total_standard_compile_count);
+  tty->print_cr("    On stack replacement    : %8d methods", CompileBroker::_total_osr_compile_count);
   int tcb = CompileBroker::_sum_osr_bytes_compiled + CompileBroker::_sum_standard_bytes_compiled;
-  tty->print_cr("  Total compiled bytecodes : %6d bytes", tcb);
-  tty->print_cr("    Standard compilation   : %6d bytes", CompileBroker::_sum_standard_bytes_compiled);
-  tty->print_cr("    On stack replacement   : %6d bytes", CompileBroker::_sum_osr_bytes_compiled);
+  tty->print_cr("  Total compiled bytecodes  : %8d bytes", tcb);
+  tty->print_cr("    Standard compilation    : %8d bytes", CompileBroker::_sum_standard_bytes_compiled);
+  tty->print_cr("    On stack replacement    : %8d bytes", CompileBroker::_sum_osr_bytes_compiled);
   int bps = (int)(tcb / CompileBroker::_t_total_compilation.seconds());
-  tty->print_cr("  Average compilation speed: %6d bytes/s", bps);
+  tty->print_cr("  Average compilation speed : %8d bytes/s", bps);
   tty->cr();
-  tty->print_cr("  nmethod code size        : %6d bytes", CompileBroker::_sum_nmethod_code_size);
-  tty->print_cr("  nmethod total size       : %6d bytes", CompileBroker::_sum_nmethod_size);
+  tty->print_cr("  nmethod code size         : %8d bytes", CompileBroker::_sum_nmethod_code_size);
+  tty->print_cr("  nmethod total size        : %8d bytes", CompileBroker::_sum_nmethod_size);
 }
 
 // Debugging output for failure
--- a/src/share/vm/compiler/compileBroker.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/compiler/compileBroker.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -322,6 +322,8 @@
   static elapsedTimer _t_total_compilation;
   static elapsedTimer _t_osr_compilation;
   static elapsedTimer _t_standard_compilation;
+  static elapsedTimer _t_invalidated_compilation;
+  static elapsedTimer _t_bailedout_compilation;
 
   static int _total_compile_count;
   static int _total_bailout_count;
--- a/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -128,9 +128,7 @@
 }
 
 uint ConcurrentG1Refine::thread_num() {
-  uint n_threads = (G1ConcRefinementThreads > 0) ? G1ConcRefinementThreads
-                                                : ParallelGCThreads;
-  return MAX2<uint>(n_threads, 1);
+  return G1ConcRefinementThreads;
 }
 
 void ConcurrentG1Refine::print_worker_threads_on(outputStream* st) const {
--- a/src/share/vm/gc_implementation/g1/g1_globals.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -262,12 +262,12 @@
           "Percentage (0-100) of the heap size to use as default "          \
           " maximum young gen size.")                                       \
                                                                             \
-  experimental(uintx, G1MixedGCLiveThresholdPercent, 65,                    \
+  experimental(uintx, G1MixedGCLiveThresholdPercent, 85,                    \
           "Threshold for regions to be considered for inclusion in the "    \
           "collection set of mixed GCs. "                                   \
           "Regions with live bytes exceeding this will not be collected.")  \
                                                                             \
-  product(uintx, G1HeapWastePercent, 10,                                    \
+  product(uintx, G1HeapWastePercent, 5,                                     \
           "Amount of space, expressed as a percentage of the heap size, "   \
           "that G1 is willing not to collect to avoid expensive GCs.")      \
                                                                             \
--- a/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -1077,7 +1077,7 @@
 address SignatureHandlerLibrary::set_handler_blob() {
   BufferBlob* handler_blob = BufferBlob::create("native signature handlers", blob_size);
   if (handler_blob == NULL) {
-    CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
+    CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
     return NULL;
   }
   address handler = handler_blob->code_begin();
--- a/src/share/vm/memory/collectorPolicy.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/memory/collectorPolicy.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -817,7 +817,11 @@
   assert(!Heap_lock->owned_by_self(), "Should not be holding the Heap_lock");
 
   do {
-    MetaWord* result = NULL;
+    MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype);
+    if (result != NULL) {
+      return result;
+    }
+
     if (GC_locker::is_active_and_needs_gc()) {
       // If the GC_locker is active, just expand and allocate.
       // If that does not succeed, wait if this thread is not
--- a/src/share/vm/memory/heap.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/memory/heap.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -171,7 +171,8 @@
   size_t unallocated_capacity() const            { return max_capacity() - allocated_capacity(); }
 
   // Returns true if the CodeHeap contains CodeBlobs of the given type
-  bool accepts(int code_blob_type) const         { return (_code_blob_type == code_blob_type); }
+  bool accepts(int code_blob_type) const         { return (_code_blob_type == CodeBlobType::All) ||
+                                                          (_code_blob_type == code_blob_type); }
   int code_blob_type() const                     { return _code_blob_type; }
 
   // Debugging / Profiling
--- a/src/share/vm/memory/metaspace.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/memory/metaspace.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -1415,10 +1415,31 @@
   return value;
 }
 
-size_t MetaspaceGC::inc_capacity_until_GC(size_t v) {
+bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC) {
   assert_is_size_aligned(v, Metaspace::commit_alignment());
 
-  return (size_t)Atomic::add_ptr(v, &_capacity_until_GC);
+  size_t capacity_until_GC = (size_t) _capacity_until_GC;
+  size_t new_value = capacity_until_GC + v;
+
+  if (new_value < capacity_until_GC) {
+    // The addition wrapped around, set new_value to aligned max value.
+    new_value = align_size_down(max_uintx, Metaspace::commit_alignment());
+  }
+
+  intptr_t expected = (intptr_t) capacity_until_GC;
+  intptr_t actual = Atomic::cmpxchg_ptr((intptr_t) new_value, &_capacity_until_GC, expected);
+
+  if (expected != actual) {
+    return false;
+  }
+
+  if (new_cap_until_GC != NULL) {
+    *new_cap_until_GC = new_value;
+  }
+  if (old_cap_until_GC != NULL) {
+    *old_cap_until_GC = capacity_until_GC;
+  }
+  return true;
 }
 
 size_t MetaspaceGC::dec_capacity_until_GC(size_t v) {
@@ -1518,7 +1539,10 @@
     expand_bytes = align_size_up(expand_bytes, Metaspace::commit_alignment());
     // Don't expand unless it's significant
     if (expand_bytes >= MinMetaspaceExpansion) {
-      size_t new_capacity_until_GC = MetaspaceGC::inc_capacity_until_GC(expand_bytes);
+      size_t new_capacity_until_GC = 0;
+      bool succeeded = MetaspaceGC::inc_capacity_until_GC(expand_bytes, &new_capacity_until_GC);
+      assert(succeeded, "Should always succesfully increment HWM when at safepoint");
+
       Metaspace::tracer()->report_gc_threshold(capacity_until_GC,
                                                new_capacity_until_GC,
                                                MetaspaceGCThresholdUpdater::ComputeNewSize);
@@ -3321,19 +3345,29 @@
   size_t delta_bytes = MetaspaceGC::delta_capacity_until_GC(word_size * BytesPerWord);
   assert(delta_bytes > 0, "Must be");
 
-  size_t after_inc = MetaspaceGC::inc_capacity_until_GC(delta_bytes);
-
-  // capacity_until_GC might be updated concurrently, must calculate previous value.
-  size_t before_inc = after_inc - delta_bytes;
-
-  tracer()->report_gc_threshold(before_inc, after_inc,
-                                MetaspaceGCThresholdUpdater::ExpandAndAllocate);
-  if (PrintGCDetails && Verbose) {
-    gclog_or_tty->print_cr("Increase capacity to GC from " SIZE_FORMAT
-        " to " SIZE_FORMAT, before_inc, after_inc);
+  size_t before = 0;
+  size_t after = 0;
+  MetaWord* res;
+  bool incremented;
+
+  // Each thread increments the HWM at most once. Even if the thread fails to increment
+  // the HWM, an allocation is still attempted. This is because another thread must then
+  // have incremented the HWM and therefore the allocation might still succeed.
+  do {
+    incremented = MetaspaceGC::inc_capacity_until_GC(delta_bytes, &after, &before);
+    res = allocate(word_size, mdtype);
+  } while (!incremented && res == NULL);
+
+  if (incremented) {
+    tracer()->report_gc_threshold(before, after,
+                                  MetaspaceGCThresholdUpdater::ExpandAndAllocate);
+    if (PrintGCDetails && Verbose) {
+      gclog_or_tty->print_cr("Increase capacity to GC from " SIZE_FORMAT
+          " to " SIZE_FORMAT, before, after);
+    }
   }
 
-  return allocate(word_size, mdtype);
+  return res;
 }
 
 // Space allocated in the Metaspace.  This may
--- a/src/share/vm/memory/metaspace.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/memory/metaspace.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -87,6 +87,7 @@
   friend class VM_CollectForMetadataAllocation;
   friend class MetaspaceGC;
   friend class MetaspaceAux;
+  friend class CollectorPolicy;
 
  public:
   enum MetadataType {
@@ -144,6 +145,8 @@
   //   allocate(ClassLoaderData*, size_t, bool, MetadataType, TRAPS)
   MetaWord* allocate(size_t word_size, MetadataType mdtype);
 
+  MetaWord* expand_and_allocate(size_t size, MetadataType mdtype);
+
   // Virtual Space lists for both classes and other metadata
   static VirtualSpaceList* _space_list;
   static VirtualSpaceList* _class_space_list;
@@ -234,9 +237,6 @@
                             bool read_only, MetaspaceObj::Type type, TRAPS);
   void deallocate(MetaWord* ptr, size_t byte_size, bool is_class);
 
-  MetaWord* expand_and_allocate(size_t size,
-                                MetadataType mdtype);
-
   static bool contains(const void* ptr);
 
   void dump(outputStream* const out) const;
@@ -407,7 +407,9 @@
   static void post_initialize();
 
   static size_t capacity_until_GC();
-  static size_t inc_capacity_until_GC(size_t v);
+  static bool inc_capacity_until_GC(size_t v,
+                                    size_t* new_cap_until_GC = NULL,
+                                    size_t* old_cap_until_GC = NULL);
   static size_t dec_capacity_until_GC(size_t v);
 
   static bool should_concurrent_collect() { return _should_concurrent_collect; }
--- a/src/share/vm/oops/arrayKlass.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/oops/arrayKlass.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -92,7 +92,7 @@
   ResourceMark rm(THREAD);
   k->initialize_supers(super_klass(), CHECK);
   k->vtable()->initialize_vtable(false, CHECK);
-  java_lang_Class::create_mirror(k, Handle(NULL), Handle(NULL), CHECK);
+  java_lang_Class::create_mirror(k, Handle(THREAD, k->class_loader()), Handle(NULL), CHECK);
 }
 
 GrowableArray<Klass*>* ArrayKlass::compute_secondary_supers(int num_extra_slots) {
--- a/src/share/vm/opto/buildOopMap.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/buildOopMap.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -555,7 +555,7 @@
 
 // Collect GC mask info - where are all the OOPs?
 void Compile::BuildOopMaps() {
-  NOT_PRODUCT( TracePhase t3("bldOopMaps", &_t_buildOopMaps, TimeCompiler); )
+  TracePhase tp("bldOopMaps", &timers[_t_buildOopMaps]);
   // Can't resource-mark because I need to leave all those OopMaps around,
   // or else I need to resource-mark some arena other than the default.
   // ResourceMark rm;              // Reclaim all OopFlows when done
--- a/src/share/vm/opto/c2_globals.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/c2_globals.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -590,9 +590,6 @@
   product(intx, TypeProfileMajorReceiverPercent, 90,                        \
           "% of major receiver type to all profiled receivers")             \
                                                                             \
-  notproduct(bool, TimeCompiler2, false,                                    \
-          "detailed time the compiler (requires +TimeCompiler)")            \
-                                                                            \
   diagnostic(bool, PrintIntrinsics, false,                                  \
           "prints attempted and successful inlining of intrinsics")         \
                                                                             \
--- a/src/share/vm/opto/c2compiler.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/c2compiler.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -147,7 +147,7 @@
 
 
 void C2Compiler::print_timers() {
-  // do nothing
+  Compile::print_timers();
 }
 
 int C2Compiler::initial_code_buffer_size() {
--- a/src/share/vm/opto/callGenerator.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/callGenerator.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -879,7 +879,7 @@
                                             call_does_dispatch, vtable_index);  // out-parameters
           // We lack profiling at this call but type speculation may
           // provide us with a type
-          speculative_receiver_type = receiver_type->speculative_type();
+          speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL;
         }
         CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true);
         assert(cg == NULL || !cg->is_late_inline() || cg->is_mh_late_inline(), "no late inline here");
--- a/src/share/vm/opto/chaitin.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/chaitin.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -209,7 +209,7 @@
   , _trace_spilling(TraceSpilling || C->method_has_option("TraceSpilling"))
 #endif
 {
-  NOT_PRODUCT( Compile::TracePhase t3("ctorChaitin", &_t_ctorChaitin, TimeCompiler); )
+  Compile::TracePhase tp("ctorChaitin", &timers[_t_ctorChaitin]);
 
   _high_frequency_lrg = MIN2(double(OPTO_LRG_HIGH_FREQ), _cfg.get_outer_loop_frequency());
 
@@ -295,6 +295,8 @@
 
 // Renumber the live ranges to compact them.  Makes the IFG smaller.
 void PhaseChaitin::compact() {
+  Compile::TracePhase tp("chaitinCompact", &timers[_t_chaitinCompact]);
+
   // Current the _uf_map contains a series of short chains which are headed
   // by a self-cycle.  All the chains run from big numbers to little numbers.
   // The Find() call chases the chains & shortens them for the next Find call.
@@ -369,7 +371,7 @@
 #endif
 
   {
-    NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
+    Compile::TracePhase tp("computeLive", &timers[_t_computeLive]);
     _live = NULL;                 // Mark live as being not available
     rm.reset_to_mark();           // Reclaim working storage
     IndexSet::reset_memory(C, &live_arena);
@@ -386,7 +388,7 @@
   // at all the GC points, and "stretches" the live range of any base pointer
   // to the GC point.
   if (stretch_base_pointer_live_ranges(&live_arena)) {
-    NOT_PRODUCT(Compile::TracePhase t3("computeLive (sbplr)", &_t_computeLive, TimeCompiler);)
+    Compile::TracePhase tp("computeLive (sbplr)", &timers[_t_computeLive]);
     // Since some live range stretched, I need to recompute live
     _live = NULL;
     rm.reset_to_mark();         // Reclaim working storage
@@ -399,17 +401,19 @@
   // Create the interference graph using virtual copies
   build_ifg_virtual();  // Include stack slots this time
 
+  // The IFG is/was triangular.  I am 'squaring it up' so Union can run
+  // faster.  Union requires a 'for all' operation which is slow on the
+  // triangular adjacency matrix (quick reminder: the IFG is 'sparse' -
+  // meaning I can visit all the Nodes neighbors less than a Node in time
+  // O(# of neighbors), but I have to visit all the Nodes greater than a
+  // given Node and search them for an instance, i.e., time O(#MaxLRG)).
+  _ifg->SquareUp();
+
   // Aggressive (but pessimistic) copy coalescing.
   // This pass works on virtual copies.  Any virtual copies which are not
   // coalesced get manifested as actual copies
   {
-    // The IFG is/was triangular.  I am 'squaring it up' so Union can run
-    // faster.  Union requires a 'for all' operation which is slow on the
-    // triangular adjacency matrix (quick reminder: the IFG is 'sparse' -
-    // meaning I can visit all the Nodes neighbors less than a Node in time
-    // O(# of neighbors), but I have to visit all the Nodes greater than a
-    // given Node and search them for an instance, i.e., time O(#MaxLRG)).
-    _ifg->SquareUp();
+    Compile::TracePhase tp("chaitinCoalesce1", &timers[_t_chaitinCoalesce1]);
 
     PhaseAggressiveCoalesce coalesce(*this);
     coalesce.coalesce_driver();
@@ -424,7 +428,7 @@
   // After aggressive coalesce, attempt a first cut at coloring.
   // To color, we need the IFG and for that we need LIVE.
   {
-    NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
+    Compile::TracePhase tp("computeLive", &timers[_t_computeLive]);
     _live = NULL;
     rm.reset_to_mark();           // Reclaim working storage
     IndexSet::reset_memory(C, &live_arena);
@@ -462,7 +466,7 @@
     compact();                  // Compact LRGs; return new lower max lrg
 
     {
-      NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
+      Compile::TracePhase tp("computeLive", &timers[_t_computeLive]);
       _live = NULL;
       rm.reset_to_mark();         // Reclaim working storage
       IndexSet::reset_memory(C, &live_arena);
@@ -476,6 +480,7 @@
     _ifg->Compute_Effective_Degree();
     // Only do conservative coalescing if requested
     if (OptoCoalesce) {
+      Compile::TracePhase tp("chaitinCoalesce2", &timers[_t_chaitinCoalesce2]);
       // Conservative (and pessimistic) copy coalescing of those spills
       PhaseConservativeCoalesce coalesce(*this);
       // If max live ranges greater than cutoff, don't color the stack.
@@ -531,7 +536,7 @@
 
     // Nuke the live-ness and interference graph and LiveRanGe info
     {
-      NOT_PRODUCT( Compile::TracePhase t3("computeLive", &_t_computeLive, TimeCompiler); )
+      Compile::TracePhase tp("computeLive", &timers[_t_computeLive]);
       _live = NULL;
       rm.reset_to_mark();         // Reclaim working storage
       IndexSet::reset_memory(C, &live_arena);
@@ -549,6 +554,7 @@
 
     // Only do conservative coalescing if requested
     if (OptoCoalesce) {
+      Compile::TracePhase tp("chaitinCoalesce3", &timers[_t_chaitinCoalesce3]);
       // Conservative (and pessimistic) copy coalescing
       PhaseConservativeCoalesce coalesce(*this);
       // Check for few live ranges determines how aggressive coalesce is.
@@ -1054,6 +1060,7 @@
 
 // Compute cost/area ratio, in case we spill.  Build the lo-degree list.
 void PhaseChaitin::cache_lrg_info( ) {
+  Compile::TracePhase tp("chaitinCacheLRG", &timers[_t_chaitinCacheLRG]);
 
   for (uint i = 1; i < _lrg_map.max_lrg_id(); i++) {
     LRG &lrg = lrgs(i);
@@ -1137,6 +1144,7 @@
 
 // Simplify the IFG by removing LRGs of low degree.
 void PhaseChaitin::Simplify( ) {
+  Compile::TracePhase tp("chaitinSimplify", &timers[_t_chaitinSimplify]);
 
   while( 1 ) {                  // Repeat till simplified it all
     // May want to explore simplifying lo_degree before _lo_stk_degree.
@@ -1384,6 +1392,8 @@
 // everything going back is guaranteed a color.  Select that color.  If some
 // hi-degree LRG cannot get a color then we record that we must spill.
 uint PhaseChaitin::Select( ) {
+  Compile::TracePhase tp("chaitinSelect", &timers[_t_chaitinSelect]);
+
   uint spill_reg = LRG::SPILL_REG;
   _max_reg = OptoReg::Name(0);  // Past max register used
   while( _simplified ) {
@@ -1577,7 +1587,7 @@
   // This function does only cisc spill work.
   if( !UseCISCSpill ) return;
 
-  NOT_PRODUCT( Compile::TracePhase t3("fixupSpills", &_t_fixupSpills, TimeCompiler); )
+  Compile::TracePhase tp("fixupSpills", &timers[_t_fixupSpills]);
 
   // Grab the Frame Pointer
   Node *fp = _cfg.get_root_block()->head()->in(1)->in(TypeFunc::FramePtr);
--- a/src/share/vm/opto/compile.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/compile.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -535,7 +535,7 @@
     if (scratch_buffer_blob() == NULL) {
       // Let CompilerBroker disable further compilations.
       record_failure("Not enough space for scratch buffer in CodeCache");
-      CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
+      CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
       return;
     }
   }
@@ -667,16 +667,18 @@
   C = this;
 
   CompileWrapper cw(this);
-#ifndef PRODUCT
-  if (TimeCompiler2) {
+
+  if (CITimeVerbose) {
     tty->print(" ");
     target->holder()->name()->print();
     tty->print(".");
     target->print_short_name();
     tty->print("  ");
   }
-  TraceTime t1("Total compilation time", &_t_totalCompilation, TimeCompiler, TimeCompiler2);
-  TraceTime t2(NULL, &_t_methodCompilation, TimeCompiler, false);
+  TraceTime t1("Total compilation time", &_t_totalCompilation, CITime, CITimeVerbose);
+  TraceTime t2(NULL, &_t_methodCompilation, CITime, false);
+
+#ifndef PRODUCT
   bool print_opto_assembly = PrintOptoAssembly || _method->has_option("PrintOptoAssembly");
   if (!print_opto_assembly) {
     bool print_assembly = (PrintAssembly || _method->should_print_assembly());
@@ -726,7 +728,7 @@
 
   print_inlining_init();
   { // Scope for timing the parser
-    TracePhase t3("parse", &_t_parser, true);
+    TracePhase tp("parse", &timers[_t_parser]);
 
     // Put top into the hash table ASAP.
     initial_gvn()->transform_no_reclaim(top());
@@ -888,8 +890,8 @@
       record_method_not_compilable("+OptoNoExecute");  // Flag as failed
       return;
     }
-    TracePhase t2("install_code", &_t_registerMethod, TimeCompiler);
 #endif
+    TracePhase tp("install_code", &timers[_t_registerMethod]);
 
     if (is_osr_compilation()) {
       _code_offsets.set_value(CodeOffsets::Verified_Entry, 0);
@@ -977,9 +979,10 @@
     _interpreter_frame_size(0) {
   C = this;
 
+  TraceTime t1(NULL, &_t_totalCompilation, CITime, false);
+  TraceTime t2(NULL, &_t_stubCompilation, CITime, false);
+
 #ifndef PRODUCT
-  TraceTime t1(NULL, &_t_totalCompilation, TimeCompiler, false);
-  TraceTime t2(NULL, &_t_stubCompilation, TimeCompiler, false);
   set_print_assembly(PrintFrameConverterAssembly);
   set_parsed_irreducible_loop(false);
 #endif
@@ -1949,30 +1952,38 @@
   for_igvn()->clear();
   gvn->replace_with(&igvn);
 
-  int i = 0;
-
-  for (; i <_late_inlines.length() && !inlining_progress(); i++) {
-    CallGenerator* cg = _late_inlines.at(i);
-    _late_inlines_pos = i+1;
-    cg->do_late_inline();
-    if (failing())  return;
+  {
+    TracePhase tp("incrementalInline_inline", &timers[_t_incrInline_inline]);
+    int i = 0;
+    for (; i <_late_inlines.length() && !inlining_progress(); i++) {
+      CallGenerator* cg = _late_inlines.at(i);
+      _late_inlines_pos = i+1;
+      cg->do_late_inline();
+      if (failing())  return;
+    }
+    int j = 0;
+    for (; i < _late_inlines.length(); i++, j++) {
+      _late_inlines.at_put(j, _late_inlines.at(i));
+    }
+    _late_inlines.trunc_to(j);
   }
-  int j = 0;
-  for (; i < _late_inlines.length(); i++, j++) {
-    _late_inlines.at_put(j, _late_inlines.at(i));
-  }
-  _late_inlines.trunc_to(j);
 
   {
+    TracePhase tp("incrementalInline_pru", &timers[_t_incrInline_pru]);
     ResourceMark rm;
     PhaseRemoveUseless pru(gvn, for_igvn());
   }
 
-  igvn = PhaseIterGVN(gvn);
+  {
+    TracePhase tp("incrementalInline_igvn", &timers[_t_incrInline_igvn]);
+    igvn = PhaseIterGVN(gvn);
+  }
 }
 
 // Perform incremental inlining until bound on number of live nodes is reached
 void Compile::inline_incrementally(PhaseIterGVN& igvn) {
+  TracePhase tp("incrementalInline", &timers[_t_incrInline]);
+
   PhaseGVN* gvn = initial_gvn();
 
   set_inlining_incrementally(true);
@@ -1983,6 +1994,7 @@
 
     if (live_nodes() > (uint)LiveNodeCountInliningCutoff) {
       if (low_live_nodes < (uint)LiveNodeCountInliningCutoff * 8 / 10) {
+        TracePhase tp("incrementalInline_ideal", &timers[_t_incrInline_ideal]);
         // PhaseIdealLoop is expensive so we only try it once we are
         // out of live nodes and we only try it again if the previous
         // helped got the number of nodes down significantly
@@ -2001,7 +2013,10 @@
 
     if (failing())  return;
 
-    igvn.optimize();
+    {
+      TracePhase tp("incrementalInline_igvn", &timers[_t_incrInline_igvn]);
+      igvn.optimize();
+    }
 
     if (failing())  return;
   }
@@ -2018,13 +2033,16 @@
     if (failing())  return;
 
     {
+      TracePhase tp("incrementalInline_pru", &timers[_t_incrInline_pru]);
       ResourceMark rm;
       PhaseRemoveUseless pru(initial_gvn(), for_igvn());
     }
 
-    igvn = PhaseIterGVN(gvn);
-
-    igvn.optimize();
+    {
+      TracePhase tp("incrementalInline_igvn", &timers[_t_incrInline_igvn]);
+      igvn = PhaseIterGVN(gvn);
+      igvn.optimize();
+    }
   }
 
   set_inlining_incrementally(false);
@@ -2034,7 +2052,7 @@
 //------------------------------Optimize---------------------------------------
 // Given a graph, optimize it.
 void Compile::Optimize() {
-  TracePhase t1("optimizer", &_t_optimizer, true);
+  TracePhase tp("optimizer", &timers[_t_optimizer]);
 
 #ifndef PRODUCT
   if (env()->break_at_compile()) {
@@ -2060,7 +2078,7 @@
   _modified_nodes = new (comp_arena()) Unique_Node_List(comp_arena());
 #endif
   {
-    NOT_PRODUCT( TracePhase t2("iterGVN", &_t_iterGVN, TimeCompiler); )
+    TracePhase tp("iterGVN", &timers[_t_iterGVN]);
     igvn.optimize();
   }
 
@@ -2068,17 +2086,13 @@
 
   if (failing())  return;
 
-  {
-    NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
-    inline_incrementally(igvn);
-  }
+  inline_incrementally(igvn);
 
   print_method(PHASE_INCREMENTAL_INLINE, 2);
 
   if (failing())  return;
 
   if (eliminate_boxing()) {
-    NOT_PRODUCT( TracePhase t2("incrementalInline", &_t_incrInline, TimeCompiler); )
     // Inline valueOf() methods now.
     inline_boxing_calls(igvn);
 
@@ -2105,7 +2119,7 @@
   if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) {
     if (has_loops()) {
       // Cleanup graph (remove dead nodes).
-      TracePhase t2("idealLoop", &_t_idealLoop, true);
+      TracePhase tp("idealLoop", &timers[_t_idealLoop]);
       PhaseIdealLoop ideal_loop( igvn, false, true );
       if (major_progress()) print_method(PHASE_PHASEIDEAL_BEFORE_EA, 2);
       if (failing())  return;
@@ -2121,7 +2135,7 @@
     if (failing())  return;
 
     if (congraph() != NULL && macro_count() > 0) {
-      NOT_PRODUCT( TracePhase t2("macroEliminate", &_t_macroEliminate, TimeCompiler); )
+      TracePhase tp("macroEliminate", &timers[_t_macroEliminate]);
       PhaseMacroExpand mexp(igvn);
       mexp.eliminate_macro_nodes();
       igvn.set_delay_transform(false);
@@ -2140,7 +2154,7 @@
   loop_opts_cnt = num_loop_opts();
   if((loop_opts_cnt > 0) && (has_loops() || has_split_ifs())) {
     {
-      TracePhase t2("idealLoop", &_t_idealLoop, true);
+      TracePhase tp("idealLoop", &timers[_t_idealLoop]);
       PhaseIdealLoop ideal_loop( igvn, true );
       loop_opts_cnt--;
       if (major_progress()) print_method(PHASE_PHASEIDEALLOOP1, 2);
@@ -2148,7 +2162,7 @@
     }
     // Loop opts pass if partial peeling occurred in previous pass
     if(PartialPeelLoop && major_progress() && (loop_opts_cnt > 0)) {
-      TracePhase t3("idealLoop", &_t_idealLoop, true);
+      TracePhase tp("idealLoop", &timers[_t_idealLoop]);
       PhaseIdealLoop ideal_loop( igvn, false );
       loop_opts_cnt--;
       if (major_progress()) print_method(PHASE_PHASEIDEALLOOP2, 2);
@@ -2156,14 +2170,14 @@
     }
     // Loop opts pass for loop-unrolling before CCP
     if(major_progress() && (loop_opts_cnt > 0)) {
-      TracePhase t4("idealLoop", &_t_idealLoop, true);
+      TracePhase tp("idealLoop", &timers[_t_idealLoop]);
       PhaseIdealLoop ideal_loop( igvn, false );
       loop_opts_cnt--;
       if (major_progress()) print_method(PHASE_PHASEIDEALLOOP3, 2);
     }
     if (!failing()) {
       // Verify that last round of loop opts produced a valid graph
-      NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); )
+      TracePhase tp("idealLoopVerify", &timers[_t_idealLoopVerify]);
       PhaseIdealLoop::verify(igvn);
     }
   }
@@ -2173,7 +2187,7 @@
   PhaseCCP ccp( &igvn );
   assert( true, "Break here to ccp.dump_nodes_and_types(_root,999,1)");
   {
-    TracePhase t2("ccp", &_t_ccp, true);
+    TracePhase tp("ccp", &timers[_t_ccp]);
     ccp.do_transform();
   }
   print_method(PHASE_CPP1, 2);
@@ -2182,7 +2196,7 @@
 
   // Iterative Global Value Numbering, including ideal transforms
   {
-    NOT_PRODUCT( TracePhase t2("iterGVN2", &_t_iterGVN2, TimeCompiler); )
+    TracePhase tp("iterGVN2", &timers[_t_iterGVN2]);
     igvn = ccp;
     igvn.optimize();
   }
@@ -2196,7 +2210,7 @@
   if(loop_opts_cnt > 0) {
     debug_only( int cnt = 0; );
     while(major_progress() && (loop_opts_cnt > 0)) {
-      TracePhase t2("idealLoop", &_t_idealLoop, true);
+      TracePhase tp("idealLoop", &timers[_t_idealLoop]);
       assert( cnt++ < 40, "infinite cycle in loop optimization" );
       PhaseIdealLoop ideal_loop( igvn, true);
       loop_opts_cnt--;
@@ -2208,12 +2222,12 @@
   {
     // Verify that all previous optimizations produced a valid graph
     // at least to this point, even if no loop optimizations were done.
-    NOT_PRODUCT( TracePhase t2("idealLoopVerify", &_t_idealLoopVerify, TimeCompiler); )
+    TracePhase tp("idealLoopVerify", &timers[_t_idealLoopVerify]);
     PhaseIdealLoop::verify(igvn);
   }
 
   {
-    NOT_PRODUCT( TracePhase t2("macroExpand", &_t_macroExpand, TimeCompiler); )
+    TracePhase tp("macroExpand", &timers[_t_macroExpand]);
     PhaseMacroExpand  mex(igvn);
     if (mex.expand_macro_nodes()) {
       assert(failing(), "must bail out w/ explicit message");
@@ -2227,7 +2241,7 @@
   process_print_inlining();
   // A method with only infinite loops has no edges entering loops from root
   {
-    NOT_PRODUCT( TracePhase t2("graphReshape", &_t_graphReshaping, TimeCompiler); )
+    TracePhase tp("graphReshape", &timers[_t_graphReshaping]);
     if (final_graph_reshaping()) {
       assert(failing(), "must bail out w/ explicit message");
       return;
@@ -2258,7 +2272,7 @@
   Matcher matcher;
   _matcher = &matcher;
   {
-    TracePhase t2("matcher", &_t_matcher, true);
+    TracePhase tp("matcher", &timers[_t_matcher]);
     matcher.match();
   }
   // In debug mode can dump m._nodes.dump() for mapping of ideal to machine
@@ -2275,7 +2289,7 @@
   PhaseCFG cfg(node_arena(), root(), matcher);
   _cfg = &cfg;
   {
-    NOT_PRODUCT( TracePhase t2("scheduler", &_t_scheduler, TimeCompiler); )
+    TracePhase tp("scheduler", &timers[_t_scheduler]);
     bool success = cfg.do_global_code_motion();
     if (!success) {
       return;
@@ -2289,7 +2303,7 @@
   PhaseChaitin regalloc(unique(), cfg, matcher);
   _regalloc = &regalloc;
   {
-    TracePhase t2("regalloc", &_t_registerAllocation, true);
+    TracePhase tp("regalloc", &timers[_t_registerAllocation]);
     // Perform register allocation.  After Chaitin, use-def chains are
     // no longer accurate (at spill code) and so must be ignored.
     // Node->LRG->reg mappings are still accurate.
@@ -2306,7 +2320,7 @@
   // are not adding any new instructions.  If any basic block is empty, we
   // can now safely remove it.
   {
-    NOT_PRODUCT( TracePhase t2("blockOrdering", &_t_blockOrdering, TimeCompiler); )
+    TracePhase tp("blockOrdering", &timers[_t_blockOrdering]);
     cfg.remove_empty_blocks();
     if (do_freq_based_layout()) {
       PhaseBlockLayout layout(cfg);
@@ -2318,22 +2332,20 @@
 
   // Apply peephole optimizations
   if( OptoPeephole ) {
-    NOT_PRODUCT( TracePhase t2("peephole", &_t_peephole, TimeCompiler); )
+    TracePhase tp("peephole", &timers[_t_peephole]);
     PhasePeephole peep( _regalloc, cfg);
     peep.do_transform();
   }
 
   // Do late expand if CPU requires this.
   if (Matcher::require_postalloc_expand) {
-    NOT_PRODUCT(TracePhase t2c("postalloc_expand", &_t_postalloc_expand, true));
+    TracePhase tp("postalloc_expand", &timers[_t_postalloc_expand]);
     cfg.postalloc_expand(_regalloc);
   }
 
   // Convert Nodes to instruction bits in a buffer
   {
-    // %%%% workspace merge brought two timers together for one job
-    TracePhase t2a("output", &_t_output, true);
-    NOT_PRODUCT( TraceTime t2b(NULL, &_t_codeGeneration, TimeCompiler, false); )
+    TraceTime tp("output", &timers[_t_output], CITime);
     Output();
   }
 
@@ -3538,11 +3550,11 @@
   _root = NULL;  // flush the graph, too
 }
 
-Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator, bool dolog)
-  : TraceTime(NULL, accumulator, false NOT_PRODUCT( || TimeCompiler ), false),
-    _phase_name(name), _dolog(dolog)
+Compile::TracePhase::TracePhase(const char* name, elapsedTimer* accumulator)
+  : TraceTime(name, accumulator, CITime, CITimeVerbose),
+    _phase_name(name), _dolog(CITimeVerbose)
 {
-  if (dolog) {
+  if (_dolog) {
     C = Compile::current();
     _log = C->log();
   } else {
--- a/src/share/vm/opto/compile.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/compile.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -97,10 +97,10 @@
     AliasIdxRaw = 3   // hard-wired index for TypeRawPtr::BOTTOM
   };
 
-  // Variant of TraceTime(NULL, &_t_accumulator, TimeCompiler);
-  // Integrated with logging.  If logging is turned on, and dolog is true,
+  // Variant of TraceTime(NULL, &_t_accumulator, CITime);
+  // Integrated with logging.  If logging is turned on, and CITimeVerbose is true,
   // then brackets are put into the log, with time stamps and node counts.
-  // (The time collection itself is always conditionalized on TimeCompiler.)
+  // (The time collection itself is always conditionalized on CITime.)
   class TracePhase : public TraceTime {
    private:
     Compile*    C;
@@ -108,7 +108,7 @@
     const char* _phase_name;
     bool _dolog;
    public:
-    TracePhase(const char* name, elapsedTimer* accumulator, bool dolog);
+    TracePhase(const char* name, elapsedTimer* accumulator);
     ~TracePhase();
   };
 
--- a/src/share/vm/opto/escape.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/escape.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -82,7 +82,7 @@
 }
 
 void ConnectionGraph::do_analysis(Compile *C, PhaseIterGVN *igvn) {
-  Compile::TracePhase t2("escapeAnalysis", &Phase::_t_escapeAnalysis, true);
+  Compile::TracePhase tp("escapeAnalysis", &Phase::timers[Phase::_t_escapeAnalysis]);
   ResourceMark rm;
 
   // Add ConP#NULL and ConN#NULL nodes before ConnectionGraph construction
@@ -117,7 +117,7 @@
   GrowableArray<FieldNode*>      oop_fields_worklist;
   DEBUG_ONLY( GrowableArray<Node*> addp_worklist; )
 
-  { Compile::TracePhase t3("connectionGraph", &Phase::_t_connectionGraph, true);
+  { Compile::TracePhase tp("connectionGraph", &Phase::timers[Phase::_t_connectionGraph]);
 
   // 1. Populate Connection Graph (CG) with PointsTo nodes.
   ideal_nodes.map(C->live_nodes(), NULL);  // preallocate space
@@ -2839,6 +2839,13 @@
           continue;
         }
       }
+
+      const TypeOopPtr *t = igvn->type(n)->isa_oopptr();
+      if (t == NULL)
+        continue;  // not a TypeOopPtr
+      if (!t->klass_is_exact())
+        continue; // not an unique type
+
       if (alloc->is_Allocate()) {
         // Set the scalar_replaceable flag for allocation
         // so it could be eliminated.
@@ -2857,10 +2864,7 @@
       //   - not determined to be ineligible by escape analysis
       set_map(alloc, n);
       set_map(n, alloc);
-      const TypeOopPtr *t = igvn->type(n)->isa_oopptr();
-      if (t == NULL)
-        continue;  // not a TypeOopPtr
-      const TypeOopPtr* tinst = t->cast_to_exactness(true)->is_oopptr()->cast_to_instance_id(ni);
+      const TypeOopPtr* tinst = t->cast_to_instance_id(ni);
       igvn->hash_delete(n);
       igvn->set_type(n,  tinst);
       n->raise_bottom_type(tinst);
--- a/src/share/vm/opto/ifg.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/ifg.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -306,6 +306,7 @@
 // at this point can end up in bad places).  Copies I re-insert later I have
 // more opportunity to insert them in low-frequency locations.
 void PhaseChaitin::build_ifg_virtual( ) {
+  Compile::TracePhase tp("buildIFG_virt", &timers[_t_buildIFGvirtual]);
 
   // For all blocks (in any order) do...
   for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
@@ -739,7 +740,7 @@
  *   low to high register pressure transition within the block (if any).
  */
 uint PhaseChaitin::build_ifg_physical( ResourceArea *a ) {
-  NOT_PRODUCT(Compile::TracePhase t3("buildIFG", &_t_buildIFGphysical, TimeCompiler);)
+  Compile::TracePhase tp("buildIFG", &timers[_t_buildIFGphysical]);
 
   uint must_spill = 0;
   for (uint i = 0; i < _cfg.number_of_blocks(); i++) {
--- a/src/share/vm/opto/output.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/output.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -1166,7 +1166,7 @@
   // Have we run out of code space?
   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
     C->record_failure("CodeCache is full");
-    CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
+    CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
     return NULL;
   }
   // Configure the code buffer.
@@ -1491,7 +1491,7 @@
       cb->insts()->maybe_expand_to_ensure_remaining(MAX_inst_size);
       if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
         C->record_failure("CodeCache is full");
-        CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
+        CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
         return;
       }
 
@@ -1648,7 +1648,7 @@
   // One last check for failed CodeBuffer::expand:
   if ((cb->blob() == NULL) || (!CompileBroker::should_compile_new_jobs())) {
     C->record_failure("CodeCache is full");
-    CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
+    CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
     return;
   }
 
@@ -1887,7 +1887,7 @@
   if (max_vector_size() > 8)
     return;
 
-  NOT_PRODUCT( TracePhase t2("isched", &_t_instrSched, TimeCompiler); )
+  TracePhase tp("isched", &timers[_t_instrSched]);
 
   // Create a data structure for all the scheduling information
   Scheduling scheduling(Thread::current()->resource_area(), *this);
--- a/src/share/vm/opto/parse1.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/parse1.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -528,7 +528,7 @@
   methods_parsed++;
 #ifndef PRODUCT
   // add method size here to guarantee that inlined methods are added too
-  if (TimeCompiler)
+  if (CITime)
     _total_bytes_compiled += method()->code_size();
 
   show_parse_info();
--- a/src/share/vm/opto/phase.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/phase.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -30,56 +30,14 @@
 #include "opto/node.hpp"
 #include "opto/phase.hpp"
 
-#ifndef PRODUCT
 int Phase::_total_bytes_compiled = 0;
 
 elapsedTimer Phase::_t_totalCompilation;
 elapsedTimer Phase::_t_methodCompilation;
 elapsedTimer Phase::_t_stubCompilation;
-#endif
 
-// The next timers used for LogCompilation
-elapsedTimer Phase::_t_parser;
-elapsedTimer Phase::_t_optimizer;
-elapsedTimer   Phase::_t_escapeAnalysis;
-elapsedTimer     Phase::_t_connectionGraph;
-elapsedTimer   Phase::_t_idealLoop;
-elapsedTimer   Phase::_t_ccp;
-elapsedTimer Phase::_t_matcher;
-elapsedTimer Phase::_t_registerAllocation;
-elapsedTimer Phase::_t_output;
-
-#ifndef PRODUCT
-elapsedTimer Phase::_t_graphReshaping;
-elapsedTimer Phase::_t_scheduler;
-elapsedTimer Phase::_t_blockOrdering;
-elapsedTimer Phase::_t_macroEliminate;
-elapsedTimer Phase::_t_macroExpand;
-elapsedTimer Phase::_t_peephole;
-elapsedTimer Phase::_t_postalloc_expand;
-elapsedTimer Phase::_t_codeGeneration;
-elapsedTimer Phase::_t_registerMethod;
-elapsedTimer Phase::_t_temporaryTimer1;
-elapsedTimer Phase::_t_temporaryTimer2;
-elapsedTimer Phase::_t_idealLoopVerify;
-
-// Subtimers for _t_optimizer
-elapsedTimer   Phase::_t_iterGVN;
-elapsedTimer   Phase::_t_iterGVN2;
-elapsedTimer   Phase::_t_incrInline;
-
-// Subtimers for _t_registerAllocation
-elapsedTimer   Phase::_t_ctorChaitin;
-elapsedTimer   Phase::_t_buildIFGphysical;
-elapsedTimer   Phase::_t_computeLive;
-elapsedTimer   Phase::_t_regAllocSplit;
-elapsedTimer   Phase::_t_postAllocCopyRemoval;
-elapsedTimer   Phase::_t_fixupSpills;
-
-// Subtimers for _t_output
-elapsedTimer   Phase::_t_instrSched;
-elapsedTimer   Phase::_t_buildOopMaps;
-#endif
+// The counters to use for LogCompilation
+elapsedTimer Phase::timers[max_phase_timers];
 
 //------------------------------Phase------------------------------------------
 Phase::Phase( PhaseNumber pnum ) : _pnum(pnum), C( pnum == Compiler ? NULL : Compile::current()) {
@@ -89,93 +47,132 @@
   CompileBroker::maybe_block();
 }
 
-#ifndef PRODUCT
-static const double minimum_reported_time             = 0.0001; // seconds
-static const double expected_method_compile_coverage  = 0.97;   // %
-static const double minimum_meaningful_method_compile = 2.00;   // seconds
+void Phase::print_timers() {
+  tty->print_cr ("    C2 Compile Time:      %7.3f s", Phase::_t_totalCompilation.seconds());
+  tty->print_cr ("       Parse:               %7.3f s", timers[_t_parser].seconds());
 
-void Phase::print_timers() {
-  tty->print_cr ("Accumulated compiler times:");
-  tty->print_cr ("---------------------------");
-  tty->print_cr ("  Total compilation: %3.3f sec.", Phase::_t_totalCompilation.seconds());
-  tty->print    ("    method compilation   : %3.3f sec", Phase::_t_methodCompilation.seconds());
-  tty->print    ("/%d bytes",_total_bytes_compiled);
-  tty->print_cr (" (%3.0f bytes per sec) ", Phase::_total_bytes_compiled / Phase::_t_methodCompilation.seconds());
-  tty->print_cr ("    stub compilation     : %3.3f sec.", Phase::_t_stubCompilation.seconds());
-  tty->print_cr ("  Phases:");
-  tty->print_cr ("    parse          : %3.3f sec", Phase::_t_parser.seconds());
-  tty->print_cr ("    optimizer      : %3.3f sec", Phase::_t_optimizer.seconds());
-  if( Verbose || WizardMode ) {
+  {
+    tty->print_cr ("       Optimize:            %7.3f s", timers[_t_optimizer].seconds());
     if (DoEscapeAnalysis) {
       // EA is part of Optimizer.
-      tty->print_cr ("      escape analysis: %3.3f sec", Phase::_t_escapeAnalysis.seconds());
-      tty->print_cr ("        connection graph: %3.3f sec", Phase::_t_connectionGraph.seconds());
-      tty->print_cr ("      macroEliminate : %3.3f sec", Phase::_t_macroEliminate.seconds());
+      tty->print_cr ("         Escape Analysis:     %7.3f s", timers[_t_escapeAnalysis].seconds());
+      tty->print_cr ("           Conn Graph:          %7.3f s", timers[_t_connectionGraph].seconds());
+      tty->print_cr ("           Macro Eliminate:     %7.3f s", timers[_t_macroEliminate].seconds());
     }
-    tty->print_cr ("      iterGVN        : %3.3f sec", Phase::_t_iterGVN.seconds());
-    tty->print_cr ("      incrInline     : %3.3f sec", Phase::_t_incrInline.seconds());
-    tty->print_cr ("      idealLoop      : %3.3f sec", Phase::_t_idealLoop.seconds());
-    tty->print_cr ("      idealLoopVerify: %3.3f sec", Phase::_t_idealLoopVerify.seconds());
-    tty->print_cr ("      ccp            : %3.3f sec", Phase::_t_ccp.seconds());
-    tty->print_cr ("      iterGVN2       : %3.3f sec", Phase::_t_iterGVN2.seconds());
-    tty->print_cr ("      macroExpand    : %3.3f sec", Phase::_t_macroExpand.seconds());
-    tty->print_cr ("      graphReshape   : %3.3f sec", Phase::_t_graphReshaping.seconds());
-    double optimizer_subtotal = Phase::_t_iterGVN.seconds() + Phase::_t_iterGVN2.seconds() +
-      Phase::_t_escapeAnalysis.seconds() + Phase::_t_macroEliminate.seconds() +
-      Phase::_t_idealLoop.seconds() + Phase::_t_ccp.seconds() +
-      Phase::_t_macroExpand.seconds() + Phase::_t_graphReshaping.seconds();
-    double percent_of_optimizer = ((optimizer_subtotal == 0.0) ? 0.0 : (optimizer_subtotal / Phase::_t_optimizer.seconds() * 100.0));
-    tty->print_cr ("      subtotal       : %3.3f sec,  %3.2f %%", optimizer_subtotal, percent_of_optimizer);
+    tty->print_cr ("         GVN 1:               %7.3f s", timers[_t_iterGVN].seconds());
+
+    {
+       tty->print_cr ("         Incremental Inline:  %7.3f s", timers[_t_incrInline].seconds());
+       tty->print_cr ("           IdealLoop:           %7.3f s", timers[_t_incrInline_ideal].seconds());
+       tty->print_cr ("           IGVN:                %7.3f s", timers[_t_incrInline_igvn].seconds());
+       tty->print_cr ("           Inline:              %7.3f s", timers[_t_incrInline_inline].seconds());
+       tty->print_cr ("           Prune Useless:       %7.3f s", timers[_t_incrInline_pru].seconds());
+
+       double other = timers[_t_incrInline].seconds() -
+        (timers[_t_incrInline_ideal].seconds() +
+         timers[_t_incrInline_igvn].seconds() +
+         timers[_t_incrInline_inline].seconds() +
+         timers[_t_incrInline_pru].seconds());
+       if (other > 0) {
+         tty->print_cr("           Other:               %7.3f s", other);
+       }
+    }
+    tty->print_cr ("         IdealLoop:           %7.3f s", timers[_t_idealLoop].seconds());
+    tty->print_cr ("         IdealLoop Verify:    %7.3f s", timers[_t_idealLoopVerify].seconds());
+    tty->print_cr ("         Cond Const Prop:     %7.3f s", timers[_t_ccp].seconds());
+    tty->print_cr ("         GVN 2:               %7.3f s", timers[_t_iterGVN2].seconds());
+    tty->print_cr ("         Macro Expand:        %7.3f s", timers[_t_macroExpand].seconds());
+    tty->print_cr ("         Graph Reshape:       %7.3f s", timers[_t_graphReshaping].seconds());
+
+    double other = timers[_t_optimizer].seconds() -
+      (timers[_t_escapeAnalysis].seconds() +
+       timers[_t_iterGVN].seconds() +
+       timers[_t_incrInline].seconds() +
+       timers[_t_idealLoop].seconds() +
+       timers[_t_idealLoopVerify].seconds() +
+       timers[_t_ccp].seconds() +
+       timers[_t_iterGVN2].seconds() +
+       timers[_t_macroExpand].seconds() +
+       timers[_t_graphReshaping].seconds());
+    if (other > 0) {
+      tty->print_cr("         Other:               %7.3f s", other);
+    }
   }
-  tty->print_cr ("    matcher        : %3.3f sec", Phase::_t_matcher.seconds());
-  tty->print_cr ("    scheduler      : %3.3f sec", Phase::_t_scheduler.seconds());
-  tty->print_cr ("    regalloc       : %3.3f sec", Phase::_t_registerAllocation.seconds());
-  if( Verbose || WizardMode ) {
-    tty->print_cr ("      ctorChaitin    : %3.3f sec", Phase::_t_ctorChaitin.seconds());
-    tty->print_cr ("      buildIFG       : %3.3f sec", Phase::_t_buildIFGphysical.seconds());
-    tty->print_cr ("      computeLive    : %3.3f sec", Phase::_t_computeLive.seconds());
-    tty->print_cr ("      regAllocSplit  : %3.3f sec", Phase::_t_regAllocSplit.seconds());
-    tty->print_cr ("      postAllocCopyRemoval: %3.3f sec", Phase::_t_postAllocCopyRemoval.seconds());
-    tty->print_cr ("      fixupSpills    : %3.3f sec", Phase::_t_fixupSpills.seconds());
-    double regalloc_subtotal = Phase::_t_ctorChaitin.seconds() +
-      Phase::_t_buildIFGphysical.seconds() + Phase::_t_computeLive.seconds() +
-      Phase::_t_regAllocSplit.seconds()    + Phase::_t_fixupSpills.seconds() +
-      Phase::_t_postAllocCopyRemoval.seconds();
-    double percent_of_regalloc = ((regalloc_subtotal == 0.0) ? 0.0 : (regalloc_subtotal / Phase::_t_registerAllocation.seconds() * 100.0));
-    tty->print_cr ("      subtotal       : %3.3f sec,  %3.2f %%", regalloc_subtotal, percent_of_regalloc);
+
+  tty->print_cr ("       Matcher:             %7.3f s", timers[_t_matcher].seconds());
+  tty->print_cr ("       Scheduler:           %7.3f s", timers[_t_scheduler].seconds());
+
+  {
+    tty->print_cr ("       Regalloc:            %7.3f s", timers[_t_registerAllocation].seconds());
+    tty->print_cr ("         Ctor Chaitin:        %7.3f s", timers[_t_ctorChaitin].seconds());
+    tty->print_cr ("         Build IFG (virt):    %7.3f s", timers[_t_buildIFGvirtual].seconds());
+    tty->print_cr ("         Build IFG (phys):    %7.3f s", timers[_t_buildIFGphysical].seconds());
+    tty->print_cr ("         Compute Liveness:    %7.3f s", timers[_t_computeLive].seconds());
+    tty->print_cr ("         Regalloc Split:      %7.3f s", timers[_t_regAllocSplit].seconds());
+    tty->print_cr ("         Postalloc Copy Rem:  %7.3f s", timers[_t_postAllocCopyRemoval].seconds());
+    tty->print_cr ("         Fixup Spills:        %7.3f s", timers[_t_fixupSpills].seconds());
+    tty->print_cr ("         Compact:             %7.3f s", timers[_t_chaitinCompact].seconds());
+    tty->print_cr ("         Coalesce 1:          %7.3f s", timers[_t_chaitinCoalesce1].seconds());
+    tty->print_cr ("         Coalesce 2:          %7.3f s", timers[_t_chaitinCoalesce2].seconds());
+    tty->print_cr ("         Coalesce 3:          %7.3f s", timers[_t_chaitinCoalesce3].seconds());
+    tty->print_cr ("         Cache LRG:           %7.3f s", timers[_t_chaitinCacheLRG].seconds());
+    tty->print_cr ("         Simplify:            %7.3f s", timers[_t_chaitinSimplify].seconds());
+    tty->print_cr ("         Select:              %7.3f s", timers[_t_chaitinSelect].seconds());
+
+    double other = timers[_t_registerAllocation].seconds() -
+      (timers[_t_ctorChaitin].seconds() +
+       timers[_t_buildIFGvirtual].seconds() +
+       timers[_t_buildIFGphysical].seconds() +
+       timers[_t_computeLive].seconds() +
+       timers[_t_regAllocSplit].seconds() +
+       timers[_t_postAllocCopyRemoval].seconds() +
+       timers[_t_fixupSpills].seconds() +
+       timers[_t_chaitinCompact].seconds() +
+       timers[_t_chaitinCoalesce1].seconds() +
+       timers[_t_chaitinCoalesce2].seconds() +
+       timers[_t_chaitinCoalesce3].seconds() +
+       timers[_t_chaitinCacheLRG].seconds() +
+       timers[_t_chaitinSimplify].seconds() +
+       timers[_t_chaitinSelect].seconds());
+
+    if (other > 0) {
+      tty->print_cr("         Other:               %7.3f s", other);
+    }
   }
-  tty->print_cr ("    blockOrdering  : %3.3f sec", Phase::_t_blockOrdering.seconds());
-  tty->print_cr ("    peephole       : %3.3f sec", Phase::_t_peephole.seconds());
+  tty->print_cr ("       Block Ordering:      %7.3f s", timers[_t_blockOrdering].seconds());
+  tty->print_cr ("       Peephole:            %7.3f s", timers[_t_peephole].seconds());
   if (Matcher::require_postalloc_expand) {
-    tty->print_cr ("    postalloc_expand: %3.3f sec", Phase::_t_postalloc_expand.seconds());
+    tty->print_cr ("       Postalloc Expand:    %7.3f s", timers[_t_postalloc_expand].seconds());
   }
-  tty->print_cr ("    codeGen        : %3.3f sec", Phase::_t_codeGeneration.seconds());
-  tty->print_cr ("    install_code   : %3.3f sec", Phase::_t_registerMethod.seconds());
-  tty->print_cr ("    -------------- : ----------");
-  double phase_subtotal = Phase::_t_parser.seconds() +
-    Phase::_t_optimizer.seconds() + Phase::_t_graphReshaping.seconds() +
-    Phase::_t_matcher.seconds() + Phase::_t_scheduler.seconds() +
-    Phase::_t_registerAllocation.seconds() + Phase::_t_blockOrdering.seconds() +
-    Phase::_t_codeGeneration.seconds() + Phase::_t_registerMethod.seconds();
-  double percent_of_method_compile = ((phase_subtotal == 0.0) ? 0.0 : phase_subtotal / Phase::_t_methodCompilation.seconds()) * 100.0;
-  // counters inside Compile::CodeGen include time for adapters and stubs
-  // so phase-total can be greater than 100%
-  tty->print_cr ("    total          : %3.3f sec,  %3.2f %%", phase_subtotal, percent_of_method_compile);
+  tty->print_cr ("       Code Emission:         %7.3f s", timers[_t_output].seconds());
+  tty->print_cr ("         Insn Scheduling:     %7.3f s", timers[_t_instrSched].seconds());
+  tty->print_cr ("         Build OOP maps:      %7.3f s", timers[_t_buildOopMaps].seconds());
+  tty->print_cr ("       Code Installation:   %7.3f s", timers[_t_registerMethod].seconds());
 
-  assert( percent_of_method_compile > expected_method_compile_coverage ||
-          phase_subtotal < minimum_meaningful_method_compile,
-          "Must account for method compilation");
+  if( timers[_t_temporaryTimer1].seconds() > 0 ) {
+    tty->cr();
+    tty->print_cr ("       Temp Timer 1:        %7.3f s", timers[_t_temporaryTimer1].seconds());
+  }
+  if( timers[_t_temporaryTimer2].seconds() > 0 ) {
+    tty->cr();
+    tty->print_cr ("       Temp Timer 2:        %7.3f s", timers[_t_temporaryTimer2].seconds());
+  }
 
-  if( Phase::_t_temporaryTimer1.seconds() > minimum_reported_time ) {
-    tty->cr();
-    tty->print_cr ("    temporaryTimer1: %3.3f sec", Phase::_t_temporaryTimer1.seconds());
-  }
-  if( Phase::_t_temporaryTimer2.seconds() > minimum_reported_time ) {
-    tty->cr();
-    tty->print_cr ("    temporaryTimer2: %3.3f sec", Phase::_t_temporaryTimer2.seconds());
-  }
-  tty->print_cr ("    output         : %3.3f sec", Phase::_t_output.seconds());
-  tty->print_cr ("      isched         : %3.3f sec", Phase::_t_instrSched.seconds());
-  tty->print_cr ("      bldOopMaps     : %3.3f sec", Phase::_t_buildOopMaps.seconds());
+   double other = Phase::_t_totalCompilation.seconds() -
+      (timers[_t_parser].seconds() +
+       timers[_t_optimizer].seconds() +
+       timers[_t_matcher].seconds() +
+       timers[_t_scheduler].seconds() +
+       timers[_t_registerAllocation].seconds() +
+       timers[_t_blockOrdering].seconds() +
+       timers[_t_peephole].seconds() +
+       timers[_t_postalloc_expand].seconds() +
+       timers[_t_output].seconds() +
+       timers[_t_registerMethod].seconds() +
+       timers[_t_temporaryTimer1].seconds() +
+       timers[_t_temporaryTimer2].seconds());
+    if (other > 0) {
+      tty->print_cr("       Other:               %7.3f s", other);
+    }
+
 }
-#endif
--- a/src/share/vm/opto/phase.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/phase.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -60,63 +60,65 @@
     Peephole,                   // Apply peephole optimizations
     last_phase
   };
+
+  enum PhaseTraceId {
+    _t_parser,
+    _t_optimizer,
+      _t_escapeAnalysis,
+        _t_connectionGraph,
+        _t_macroEliminate,
+      _t_iterGVN,
+      _t_incrInline,
+        _t_incrInline_ideal,
+        _t_incrInline_igvn,
+        _t_incrInline_pru,
+        _t_incrInline_inline,
+      _t_idealLoop,
+      _t_idealLoopVerify,
+      _t_ccp,
+      _t_iterGVN2,
+      _t_macroExpand,
+      _t_graphReshaping,
+    _t_matcher,
+    _t_scheduler,
+    _t_registerAllocation,
+      _t_ctorChaitin,
+      _t_buildIFGvirtual,
+      _t_buildIFGphysical,
+      _t_computeLive,
+      _t_regAllocSplit,
+      _t_postAllocCopyRemoval,
+      _t_fixupSpills,
+      _t_chaitinCompact,
+      _t_chaitinCoalesce1,
+      _t_chaitinCoalesce2,
+      _t_chaitinCoalesce3,
+      _t_chaitinCacheLRG,
+      _t_chaitinSimplify,
+      _t_chaitinSelect,
+    _t_blockOrdering,
+    _t_peephole,
+    _t_postalloc_expand,
+    _t_output,
+       _t_instrSched,
+       _t_buildOopMaps,
+    _t_registerMethod,
+    _t_temporaryTimer1,
+    _t_temporaryTimer2,
+    max_phase_timers
+   };
+
+  static elapsedTimer timers[max_phase_timers];
+
 protected:
   enum PhaseNumber _pnum;       // Phase number (for stat gathering)
 
-#ifndef PRODUCT
   static int _total_bytes_compiled;
 
   // accumulated timers
   static elapsedTimer _t_totalCompilation;
   static elapsedTimer _t_methodCompilation;
   static elapsedTimer _t_stubCompilation;
-#endif
-
-// The next timers used for LogCompilation
-  static elapsedTimer _t_parser;
-  static elapsedTimer _t_optimizer;
-public:
-  // ConnectionGraph can't be Phase since it is used after EA done.
-  static elapsedTimer   _t_escapeAnalysis;
-  static elapsedTimer     _t_connectionGraph;
-protected:
-  static elapsedTimer   _t_idealLoop;
-  static elapsedTimer   _t_ccp;
-  static elapsedTimer _t_matcher;
-  static elapsedTimer _t_registerAllocation;
-  static elapsedTimer _t_output;
-
-#ifndef PRODUCT
-  static elapsedTimer _t_graphReshaping;
-  static elapsedTimer _t_scheduler;
-  static elapsedTimer _t_blockOrdering;
-  static elapsedTimer _t_macroEliminate;
-  static elapsedTimer _t_macroExpand;
-  static elapsedTimer _t_peephole;
-  static elapsedTimer _t_postalloc_expand;
-  static elapsedTimer _t_codeGeneration;
-  static elapsedTimer _t_registerMethod;
-  static elapsedTimer _t_temporaryTimer1;
-  static elapsedTimer _t_temporaryTimer2;
-  static elapsedTimer _t_idealLoopVerify;
-
-// Subtimers for _t_optimizer
-  static elapsedTimer   _t_iterGVN;
-  static elapsedTimer   _t_iterGVN2;
-  static elapsedTimer   _t_incrInline;
-
-// Subtimers for _t_registerAllocation
-  static elapsedTimer   _t_ctorChaitin;
-  static elapsedTimer   _t_buildIFGphysical;
-  static elapsedTimer   _t_computeLive;
-  static elapsedTimer   _t_regAllocSplit;
-  static elapsedTimer   _t_postAllocCopyRemoval;
-  static elapsedTimer   _t_fixupSpills;
-
-// Subtimers for _t_output
-  static elapsedTimer   _t_instrSched;
-  static elapsedTimer   _t_buildOopMaps;
-#endif
 
   // Generate a subtyping check.  Takes as input the subtype and supertype.
   // Returns 2 values: sets the default control() to the true path and
@@ -131,9 +133,7 @@
   Compile * C;
   Phase( PhaseNumber pnum );
 
-#ifndef PRODUCT
   static void print_timers();
-#endif
 };
 
 #endif // SHARE_VM_OPTO_PHASE_HPP
--- a/src/share/vm/opto/postaloc.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/postaloc.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -403,7 +403,7 @@
 // When we see a use from a reg-reg Copy, we will attempt to use the copy's
 // source directly and make the copy go dead.
 void PhaseChaitin::post_allocate_copy_removal() {
-  NOT_PRODUCT( Compile::TracePhase t3("postAllocCopyRemoval", &_t_postAllocCopyRemoval, TimeCompiler); )
+  Compile::TracePhase tp("postAllocCopyRemoval", &timers[_t_postAllocCopyRemoval]);
   ResourceMark rm;
 
   // Need a mapping from basic block Node_Lists.  We need a Node_List to
--- a/src/share/vm/opto/reg_split.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/opto/reg_split.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -468,7 +468,7 @@
 //       Else, hoist LRG back up to register only (ie - split is also DEF)
 // We will compute a new maxlrg as we go
 uint PhaseChaitin::Split(uint maxlrg, ResourceArea* split_arena) {
-  NOT_PRODUCT( Compile::TracePhase t3("regAllocSplit", &_t_regAllocSplit, TimeCompiler); )
+  Compile::TracePhase tp("regAllocSplit", &timers[_t_regAllocSplit]);
 
   // Free thread local resources used by this method on exit.
   ResourceMark rm(split_arena);
--- a/src/share/vm/prims/whitebox.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/prims/whitebox.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -820,6 +820,33 @@
   MetadataFactory::free_array(cld, (Array<u1>*)(uintptr_t)addr);
 WB_END
 
+WB_ENTRY(jlong, WB_IncMetaspaceCapacityUntilGC(JNIEnv* env, jobject wb, jlong inc))
+  if (inc < 0) {
+    THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+        err_msg("WB_IncMetaspaceCapacityUntilGC: inc is negative: " JLONG_FORMAT, inc));
+  }
+
+  jlong max_size_t = (jlong) ((size_t) -1);
+  if (inc > max_size_t) {
+    THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
+        err_msg("WB_IncMetaspaceCapacityUntilGC: inc does not fit in size_t: " JLONG_FORMAT, inc));
+  }
+
+  size_t new_cap_until_GC = 0;
+  size_t aligned_inc = align_size_down((size_t) inc, Metaspace::commit_alignment());
+  bool success = MetaspaceGC::inc_capacity_until_GC(aligned_inc, &new_cap_until_GC);
+  if (!success) {
+    THROW_MSG_0(vmSymbols::java_lang_IllegalStateException(),
+                "WB_IncMetaspaceCapacityUntilGC: could not increase capacity until GC "
+                "due to contention with another thread");
+  }
+  return (jlong) new_cap_until_GC;
+WB_END
+
+WB_ENTRY(jlong, WB_MetaspaceCapacityUntilGC(JNIEnv* env, jobject wb))
+  return (jlong) MetaspaceGC::capacity_until_GC();
+WB_END
+
 //Some convenience methods to deal with objects from java
 int WhiteBox::offset_for_field(const char* field_name, oop object,
     Symbol* signature_symbol) {
@@ -991,6 +1018,8 @@
      CC"(Ljava/lang/ClassLoader;J)J",                 (void*)&WB_AllocateMetaspace },
   {CC"freeMetaspace",
      CC"(Ljava/lang/ClassLoader;JJ)V",                (void*)&WB_FreeMetaspace },
+  {CC"incMetaspaceCapacityUntilGC", CC"(J)J",         (void*)&WB_IncMetaspaceCapacityUntilGC },
+  {CC"metaspaceCapacityUntilGC", CC"()J",             (void*)&WB_MetaspaceCapacityUntilGC },
   {CC"getCPUFeatures",     CC"()Ljava/lang/String;",  (void*)&WB_GetCPUFeatures     },
   {CC"getNMethod",         CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
                                                       (void*)&WB_GetNMethod         },
--- a/src/share/vm/runtime/arguments.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/runtime/arguments.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -1152,20 +1152,22 @@
   if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) {
     FLAG_SET_ERGO(bool, SegmentedCodeCache, true);
 
-    // Multiply sizes by 5 but fix NonMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
-    if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
-      FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
-    }
-    if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
-      FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonMethodCodeHeapSize * 2);
-    }
-    // Check consistency of code heap sizes
-    if ((NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
-      jio_fprintf(defaultStream::error_stream(),
-                  "Invalid code heap sizes: NonMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
-                  NonMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
-                  (NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
-      vm_exit(1);
+    if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
+      // Multiply sizes by 5 but fix NonNMethodCodeHeapSize (distribute among non-profiled and profiled code heap)
+      if (FLAG_IS_DEFAULT(ProfiledCodeHeapSize)) {
+        FLAG_SET_ERGO(uintx, ProfiledCodeHeapSize, ProfiledCodeHeapSize * 5 + NonNMethodCodeHeapSize * 2);
+      }
+      if (FLAG_IS_DEFAULT(NonProfiledCodeHeapSize)) {
+        FLAG_SET_ERGO(uintx, NonProfiledCodeHeapSize, NonProfiledCodeHeapSize * 5 + NonNMethodCodeHeapSize * 2);
+      }
+      // Check consistency of code heap sizes
+      if ((NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
+        jio_fprintf(defaultStream::error_stream(),
+                    "Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
+                    NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
+                    (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
+        vm_exit(1);
+      }
     }
   }
   if (!UseInterpreter) { // -Xcomp
@@ -1690,13 +1692,18 @@
 #ifdef COMPILER1
   FastTLABRefill = false;
 #endif
-  FLAG_SET_DEFAULT(ParallelGCThreads,
-                     Abstract_VM_Version::parallel_worker_threads());
+  FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
   if (ParallelGCThreads == 0) {
-    FLAG_SET_DEFAULT(ParallelGCThreads,
-                     Abstract_VM_Version::parallel_worker_threads());
+    assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0.");
+    vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
   }
 
+#if INCLUDE_ALL_GCS
+  if (G1ConcRefinementThreads == 0) {
+    FLAG_SET_DEFAULT(G1ConcRefinementThreads, ParallelGCThreads);
+  }
+#endif
+
   // MarkStackSize will be set (if it hasn't been set by the user)
   // when concurrent marking is initialized.
   // Its value will be based upon the number of parallel marking threads.
@@ -2502,17 +2509,17 @@
                 "Invalid ReservedCodeCacheSize=%dM. Must be at most %uM.\n", ReservedCodeCacheSize/M,
                 (2*G)/M);
     status = false;
-  } else if (NonMethodCodeHeapSize < min_code_cache_size){
+  } else if (NonNMethodCodeHeapSize < min_code_cache_size){
     jio_fprintf(defaultStream::error_stream(),
-                "Invalid NonMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonMethodCodeHeapSize/K,
+                "Invalid NonNMethodCodeHeapSize=%dK. Must be at least %uK.\n", NonNMethodCodeHeapSize/K,
                 min_code_cache_size/K);
     status = false;
-  } else if ((!FLAG_IS_DEFAULT(NonMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
-             && (NonMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
+  } else if ((!FLAG_IS_DEFAULT(NonNMethodCodeHeapSize) || !FLAG_IS_DEFAULT(ProfiledCodeHeapSize) || !FLAG_IS_DEFAULT(NonProfiledCodeHeapSize))
+             && (NonNMethodCodeHeapSize + NonProfiledCodeHeapSize + ProfiledCodeHeapSize) != ReservedCodeCacheSize) {
     jio_fprintf(defaultStream::error_stream(),
-                "Invalid code heap sizes: NonMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
-                NonMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
-                (NonMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
+                "Invalid code heap sizes: NonNMethodCodeHeapSize(%dK) + ProfiledCodeHeapSize(%dK) + NonProfiledCodeHeapSize(%dK) = %dK. Must be equal to ReservedCodeCacheSize = %uK.\n",
+                NonNMethodCodeHeapSize/K, ProfiledCodeHeapSize/K, NonProfiledCodeHeapSize/K,
+                (NonNMethodCodeHeapSize + ProfiledCodeHeapSize + NonProfiledCodeHeapSize)/K, ReservedCodeCacheSize/K);
     status = false;
   }
 
@@ -2938,17 +2945,17 @@
         return JNI_EINVAL;
       }
       FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
-      // -XX:NonMethodCodeHeapSize=
-    } else if (match_option(option, "-XX:NonMethodCodeHeapSize=", &tail)) {
-      julong long_NonMethodCodeHeapSize = 0;
-
-      ArgsRange errcode = parse_memory_size(tail, &long_NonMethodCodeHeapSize, 1);
+      // -XX:NonNMethodCodeHeapSize=
+    } else if (match_option(option, "-XX:NonNMethodCodeHeapSize=", &tail)) {
+      julong long_NonNMethodCodeHeapSize = 0;
+
+      ArgsRange errcode = parse_memory_size(tail, &long_NonNMethodCodeHeapSize, 1);
       if (errcode != arg_in_range) {
         jio_fprintf(defaultStream::error_stream(),
-                    "Invalid maximum non-method code heap size: %s.\n", option->optionString);
+                    "Invalid maximum non-nmethod code heap size: %s.\n", option->optionString);
         return JNI_EINVAL;
       }
-      FLAG_SET_CMDLINE(uintx, NonMethodCodeHeapSize, (uintx)long_NonMethodCodeHeapSize);
+      FLAG_SET_CMDLINE(uintx, NonNMethodCodeHeapSize, (uintx)long_NonNMethodCodeHeapSize);
       // -XX:ProfiledCodeHeapSize=
     } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
       julong long_ProfiledCodeHeapSize = 0;
--- a/src/share/vm/runtime/globals.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/runtime/globals.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -188,7 +188,7 @@
 define_pd_global(intx, ReservedCodeCacheSize,        32*M);
 define_pd_global(intx, NonProfiledCodeHeapSize,      0);
 define_pd_global(intx, ProfiledCodeHeapSize,         0);
-define_pd_global(intx, NonMethodCodeHeapSize,        32*M);
+define_pd_global(intx, NonNMethodCodeHeapSize,        32*M);
 
 define_pd_global(intx, CodeCacheExpansionSize,       32*K);
 define_pd_global(intx, CodeCacheMinBlockLength,      1);
@@ -2487,6 +2487,9 @@
   product(bool, CITime, false,                                              \
           "collect timing information for compilation")                     \
                                                                             \
+  develop(bool, CITimeVerbose, false,                                       \
+          "be more verbose in compilation timings")                         \
+                                                                            \
   develop(bool, CITimeEach, false,                                          \
           "display timing information after each successful compilation")   \
                                                                             \
@@ -2574,9 +2577,6 @@
   product(bool, UseTypeProfile, true,                                       \
           "Check interpreter profile for historically monomorphic calls")   \
                                                                             \
-  notproduct(bool, TimeCompiler, false,                                     \
-          "Time the compiler")                                              \
-                                                                            \
   diagnostic(bool, PrintInlining, false,                                    \
           "Print inlining optimizations")                                   \
                                                                             \
@@ -3370,8 +3370,8 @@
   product_pd(uintx, ProfiledCodeHeapSize,                                   \
           "Size of code heap with profiled methods (in bytes)")             \
                                                                             \
-  product_pd(uintx, NonMethodCodeHeapSize,                                  \
-          "Size of code heap with non-methods (in bytes)")                  \
+  product_pd(uintx, NonNMethodCodeHeapSize,                                 \
+          "Size of code heap with non-nmethods (in bytes)")                 \
                                                                             \
   product(uintx, CodeCacheMinimumFreeSpace, 500*K,                          \
           "When less than X space left, we stop compiling")                 \
--- a/src/share/vm/runtime/java.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/runtime/java.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -272,9 +272,6 @@
 
   print_method_profiling_data();
 
-  if (TimeCompiler) {
-    COMPILER2_PRESENT(Compile::print_timers();)
-  }
   if (TimeCompilationPolicy) {
     CompilationPolicy::policy()->print_time();
   }
--- a/src/share/vm/runtime/sharedRuntime.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -2422,7 +2422,7 @@
       // Ought to log this but compile log is only per compile thread
       // and we're some non descript Java thread.
       MutexUnlocker mu(AdapterHandlerLibrary_lock);
-      CompileBroker::handle_full_code_cache(CodeBlobType::NonMethod);
+      CompileBroker::handle_full_code_cache(CodeBlobType::NonNMethod);
       return NULL; // Out of CodeCache space
     }
     entry->relocate(new_adapter->content_begin());
--- a/src/share/vm/runtime/sweeper.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/runtime/sweeper.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -543,6 +543,10 @@
       if (PrintMethodFlushing && Verbose) {
         tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), nm);
       }
+      // Clear ICStubs to prevent back patching stubs of zombie or unloaded
+      // nmethods during the next safepoint (see ICStub::finalize).
+      MutexLocker cl(CompiledIC_lock);
+      nm->clear_ic_stubs();
       // Code cache state change is tracked in make_zombie()
       nm->make_zombie();
       _zombified_count++;
--- a/src/share/vm/services/mallocTracker.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/services/mallocTracker.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -140,11 +140,6 @@
     return NULL;
   }
 
-  // Check malloc size, size has to <= MAX_MALLOC_SIZE. This is only possible on 32-bit
-  // systems, when malloc size >= 1GB, but is is safe to assume it won't happen.
-  if (size > MAX_MALLOC_SIZE) {
-    fatal("Should not use malloc for big memory block, use virtual memory instead");
-  }
   // Uses placement global new operator to initialize malloc header
   switch(level) {
     case NMT_off:
@@ -154,10 +149,12 @@
       break;
     }
     case NMT_summary: {
+      assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
       header = ::new (malloc_base) MallocHeader(size, flags);
       break;
     }
     case NMT_detail: {
+      assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
       header = ::new (malloc_base) MallocHeader(size, flags, stack);
       break;
     }
--- a/src/share/vm/utilities/bitMap.cpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/utilities/bitMap.cpp	Thu Oct 09 12:17:17 2014 -0700
@@ -342,9 +342,9 @@
   bm_word_t* other_map = other.map();
   idx_t size = size_in_words();
   for (idx_t index = 0; index < size; index++) {
-    idx_t temp = map(index) | other_map[index];
-    changed = changed || (temp != map(index));
-    map()[index] = temp;
+    idx_t temp = dest_map[index] | other_map[index];
+    changed = changed || (temp != dest_map[index]);
+    dest_map[index] = temp;
   }
   return changed;
 }
@@ -407,10 +407,10 @@
   bm_word_t* word = map();
   idx_t rest = size();
   for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
-    if (*word != (bm_word_t) AllBits) return false;
+    if (*word != ~(bm_word_t)0) return false;
     word++;
   }
-  return rest == 0 || (*word | ~right_n_bits((int)rest)) == (bm_word_t) AllBits;
+  return rest == 0 || (*word | ~right_n_bits((int)rest)) == ~(bm_word_t)0;
 }
 
 
@@ -418,10 +418,10 @@
   bm_word_t* word = map();
   idx_t rest = size();
   for (; rest >= (idx_t) BitsPerWord; rest -= BitsPerWord) {
-    if (*word != (bm_word_t) NoBits) return false;
+    if (*word != 0) return false;
     word++;
   }
-  return rest == 0 || (*word & right_n_bits((int)rest)) == (bm_word_t) NoBits;
+  return rest == 0 || (*word & right_n_bits((int)rest)) == 0;
 }
 
 void BitMap::clear_large() {
@@ -441,7 +441,7 @@
        offset < rightOffset && index < endIndex;
        offset = (++index) << LogBitsPerWord) {
     idx_t rest = map(index) >> (offset & (BitsPerWord - 1));
-    for (; offset < rightOffset && rest != (bm_word_t)NoBits; offset++) {
+    for (; offset < rightOffset && rest != 0; offset++) {
       if (rest & 1) {
         if (!blk->do_bit(offset)) return false;
         //  resample at each closure application
@@ -468,7 +468,7 @@
                                        (intptr_t)  NULL_WORD);
     if (res != NULL_WORD) {
       guarantee( _pop_count_table == (void*) res, "invariant" );
-      FREE_C_HEAP_ARRAY(bm_word_t, table, mtInternal);
+      FREE_C_HEAP_ARRAY(idx_t, table, mtInternal);
     }
   }
 }
--- a/src/share/vm/utilities/bitMap.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/utilities/bitMap.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -80,7 +80,7 @@
 
   // Set a word to a specified value or to all ones; clear a word.
   void set_word  (idx_t word, bm_word_t val) { _map[word] = val; }
-  void set_word  (idx_t word)            { set_word(word, ~(uintptr_t)0); }
+  void set_word  (idx_t word)            { set_word(word, ~(bm_word_t)0); }
   void clear_word(idx_t word)            { _map[word] = 0; }
 
   // Utilities for ranges of bits.  Ranges are half-open [beg, end).
--- a/src/share/vm/utilities/bitMap.inline.hpp	Thu Oct 09 11:24:04 2014 -0700
+++ b/src/share/vm/utilities/bitMap.inline.hpp	Thu Oct 09 12:17:17 2014 -0700
@@ -130,7 +130,7 @@
 
 inline void BitMap::set_range_of_words(idx_t beg, idx_t end) {
   bm_word_t* map = _map;
-  for (idx_t i = beg; i < end; ++i) map[i] = ~(uintptr_t)0;
+  for (idx_t i = beg; i < end; ++i) map[i] = ~(bm_word_t)0;
 }
 
 
@@ -172,8 +172,8 @@
 
   // check bits including and to the _left_ of offset's position
   idx_t pos = bit_in_word(res_offset);
-  idx_t res = map(index) >> pos;
-  if (res != (uintptr_t)NoBits) {
+  bm_word_t res = map(index) >> pos;
+  if (res != 0) {
     // find the position of the 1-bit
     for (; !(res & 1); res_offset++) {
       res = res >> 1;
@@ -207,7 +207,7 @@
   // skip over all word length 0-bit runs
   for (index++; index < r_index; index++) {
     res = map(index);
-    if (res != (uintptr_t)NoBits) {
+    if (res != 0) {
       // found a 1, return the offset
       for (res_offset = bit_index(index); !(res & 1); res_offset++) {
         res = res >> 1;
@@ -235,9 +235,9 @@
 
   // check bits including and to the _left_ of offset's position
   idx_t pos = res_offset & (BitsPerWord - 1);
-  idx_t res = (map(index) >> pos) | left_n_bits((int)pos);
+  bm_word_t res = (map(index) >> pos) | left_n_bits((int)pos);
 
-  if (res != (uintptr_t)AllBits) {
+  if (res != ~(bm_word_t)0) {
     // find the position of the 0-bit
     for (; res & 1; res_offset++) {
       res = res >> 1;
@@ -248,7 +248,7 @@
   // skip over all word length 1-bit runs
   for (index++; index < r_index; index++) {
     res = map(index);
-    if (res != (uintptr_t)AllBits) {
+    if (res != ~(bm_word_t)0) {
       // found a 0, return the offset
       for (res_offset = index << LogBitsPerWord; res & 1;
            res_offset++) {
@@ -277,8 +277,8 @@
   idx_t res_offset = l_offset;
 
   // check bits including and to the _left_ of offset's position
-  idx_t res = map(index) >> bit_in_word(res_offset);
-  if (res != (uintptr_t)NoBits) {
+  bm_word_t res = map(index) >> bit_in_word(res_offset);
+  if (res != 0) {
     // find the position of the 1-bit
     for (; !(res & 1); res_offset++) {
       res = res >> 1;
@@ -290,7 +290,7 @@
   // skip over all word length 0-bit runs
   for (index++; index < r_index; index++) {
     res = map(index);
-    if (res != (uintptr_t)NoBits) {
+    if (res != 0) {
       // found a 1, return the offset
       for (res_offset = bit_index(index); !(res & 1); res_offset++) {
         res = res >> 1;
@@ -321,11 +321,11 @@
 }
 
 inline void BitMap::set_large_range_of_words(idx_t beg, idx_t end) {
-  memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(uintptr_t));
+  memset(_map + beg, ~(unsigned char)0, (end - beg) * sizeof(bm_word_t));
 }
 
 inline void BitMap::clear_large_range_of_words(idx_t beg, idx_t end) {
-  memset(_map + beg, 0, (end - beg) * sizeof(uintptr_t));
+  memset(_map + beg, 0, (end - beg) * sizeof(bm_word_t));
 }
 
 inline BitMap::idx_t BitMap::word_index_round_up(idx_t bit) const {
--- a/test/Makefile	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/Makefile	Thu Oct 09 12:17:17 2014 -0700
@@ -259,8 +259,8 @@
   EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
 endif
 
-# Default JTREG to run (win32 script works for everybody)
-JTREG = $(JT_HOME)/win32/bin/jtreg
+# Default JTREG to run
+JTREG = $(JT_HOME)/bin/jtreg
 
 # Only run automatic tests
 JTREG_BASIC_OPTIONS += -a
@@ -321,6 +321,17 @@
 
 ################################################################
 
+# minimaltest (make sure various basic java minimal options work)
+
+hotspot_minimaltest minimaltest: prep $(PRODUCT_HOME)
+	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
+	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
+	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
+
+PHONY_LIST += hotspot_minimaltest minimaltest
+
+################################################################
+
 # servertest (make sure various basic java server options work)
 
 hotspot_servertest servertest: prep $(PRODUCT_HOME)
--- a/test/TEST.groups	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/TEST.groups	Thu Oct 09 12:17:17 2014 -0700
@@ -61,7 +61,6 @@
 # can be resolved in some cases by using tools from the compile-jdk.
 #
 needs_jdk = \
-  gc/TestG1ZeroPGCTJcmdThreadPrint.java \
   gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java \
   gc/metaspace/TestMetaspacePerfCounters.java \
   gc/metaspace/TestPerfCountersAndMemoryPools.java \
@@ -134,6 +133,13 @@
   gc/metaspace/TestMetaspaceMemoryPool.java \
   gc/arguments/TestDynMinHeapFreeRatio.java \
   gc/arguments/TestDynMaxHeapFreeRatio.java \
+  gc/g1/TestShrinkAuxiliaryData00.java \
+  gc/g1/TestShrinkAuxiliaryData05.java \
+  gc/g1/TestShrinkAuxiliaryData10.java \
+  gc/g1/TestShrinkAuxiliaryData15.java \
+  gc/g1/TestShrinkAuxiliaryData20.java \
+  gc/g1/TestShrinkAuxiliaryData25.java \
+  gc/g1/TestShrinkAuxiliaryData30.java \
   runtime/InternalApi/ThreadCpuTimesDeadlock.java \
   serviceability/threads/TestFalseDeadLock.java \
 
@@ -198,7 +204,6 @@
 compact1_minimal = \
   serviceability/ \
   compiler/ \
-  testlibrary/ \
   testlibrary_tests/ \
   sanity/ \
   runtime/ \
@@ -214,14 +219,13 @@
 #
 needs_g1gc = \
   compiler/regalloc/C1ObjectSpillInLogicOp.java \
-  gc/8000311/Test8000311.java \
-  gc/TestG1ZeroPGCTJcmdThreadPrint.java \
   gc/TestSystemGC.java \
   gc/arguments/TestAlignmentToUseLargePages.java \
   gc/arguments/TestG1HeapRegionSize.java \
   gc/arguments/TestG1HeapSizeFlags.java \
   gc/arguments/TestMaxHeapSizeTools.java \
   gc/arguments/TestMaxNewSize.java \
+  gc/arguments/TestParallelGCThreads.java \
   gc/arguments/TestUseCompressedOopsErgo.java \
   gc/class_unloading/TestG1ClassUnloadingHWM.java \
   gc/g1/ \
@@ -249,6 +253,7 @@
   gc/arguments/TestAlignmentToUseLargePages.java \
   gc/arguments/TestMaxNewSize.java \
   gc/arguments/TestMinInitialErgonomics.java \
+  gc/arguments/TestParallelGCThreads.java \
   gc/arguments/TestUseCompressedOopsErgo.java \
   gc/metaspace/TestMetaspacePerfCounters.java \
   gc/parallelScavenge/ \
@@ -263,6 +268,7 @@
   gc/arguments/TestAlignmentToUseLargePages.java \
   gc/arguments/TestCMSHeapSizeFlags.java \
   gc/arguments/TestMaxNewSize.java \
+  gc/arguments/TestParallelGCThreads.java \
   gc/arguments/TestUseCompressedOopsErgo.java \
   gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java \
   gc/concurrentMarkSweep/ \
@@ -490,6 +496,7 @@
   compiler/uncommontrap/TestStackBangMonitorOwned.java \
   compiler/uncommontrap/TestStackBangRbp.java \
   compiler/unsafe/GetUnsafeObjectG1PreBarrier.java
+  
 
 hotspot_compiler_closed = \
   closed/compiler/4292742/Test.java \
@@ -584,7 +591,8 @@
   sanity/ExecuteInternalVMTests.java
 
 hotspot_serviceability = \
-  sanity/ExecuteInternalVMTests.java
+  sanity/ExecuteInternalVMTests.java \
+  serviceability/dcmd/compiler
 
 hotspot_all = \
   :hotspot_compiler_1 \
--- a/test/compiler/IntegerArithmetic/TestIntegerComparison.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/IntegerArithmetic/TestIntegerComparison.java	Thu Oct 09 12:17:17 2014 -0700
@@ -25,7 +25,7 @@
  * @test TestIntegerComparison
  * @bug 8043284 8042786
  * @summary "Tests optimizations of signed and unsigned integer comparison."
- * @run main/othervm -server -Xcomp -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:CompileOnly=TestIntegerComparison::testSigned,TestIntegerComparison::testUnsigned TestIntegerComparison
+ * @run main/othervm -Xcomp -XX:CompileOnly=TestIntegerComparison::testSigned,TestIntegerComparison::testUnsigned TestIntegerComparison
  */
 public class TestIntegerComparison {
   /**
--- a/test/compiler/codecache/CheckSegmentedCodeCache.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/codecache/CheckSegmentedCodeCache.java	Thu Oct 09 12:17:17 2014 -0700
@@ -32,7 +32,7 @@
  */
 public class CheckSegmentedCodeCache {
   // Code heap names
-  private static final String NON_METHOD = "CodeHeap 'non-methods'";
+  private static final String NON_METHOD = "CodeHeap 'non-nmethods'";
   private static final String PROFILED = "CodeHeap 'profiled nmethods'";
   private static final String NON_PROFILED = "CodeHeap 'non-profiled nmethods'";
 
@@ -40,7 +40,7 @@
     OutputAnalyzer out = new OutputAnalyzer(pb.start());
     if (enabled) {
       try {
-        // Non-method code heap should be always available with the segmented code cache
+        // Non-nmethod code heap should be always available with the segmented code cache
         out.shouldContain(NON_METHOD);
       } catch (RuntimeException e) {
         // TieredCompilation is disabled in a client VM
@@ -111,14 +111,14 @@
                                                "-XX:+PrintCodeCache", "-version");
     verifyCodeHeapNotExists(pb, PROFILED);
 
-    // Fails with too small non-method code heap size
-    pb = ProcessTools.createJavaProcessBuilder("-XX:NonMethodCodeHeapSize=100K");
-    failsWith(pb, "Invalid NonMethodCodeHeapSize");
+    // Fails with too small non-nmethod code heap size
+    pb = ProcessTools.createJavaProcessBuilder("-XX:NonNMethodCodeHeapSize=100K");
+    failsWith(pb, "Invalid NonNMethodCodeHeapSize");
 
     // Fails if code heap sizes do not add up
     pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
                                                "-XX:ReservedCodeCacheSize=10M",
-                                               "-XX:NonMethodCodeHeapSize=5M",
+                                               "-XX:NonNMethodCodeHeapSize=5M",
                                                "-XX:ProfiledCodeHeapSize=5M",
                                                "-XX:NonProfiledCodeHeapSize=5M");
     failsWith(pb, "Invalid code heap sizes");
@@ -127,6 +127,6 @@
     pb = ProcessTools.createJavaProcessBuilder("-XX:+SegmentedCodeCache",
                                                "-XX:ReservedCodeCacheSize=1700K",
                                                "-XX:InitialCodeCacheSize=100K");
-    failsWith(pb, "Not enough space in non-method code heap to run VM");
+    failsWith(pb, "Not enough space in non-nmethod code heap to run VM");
   }
 }
--- a/test/compiler/codegen/LoadWithMask.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/codegen/LoadWithMask.java	Thu Oct 09 12:17:17 2014 -0700
@@ -25,7 +25,7 @@
  * @test
  * @bug 8032207
  * @summary Invalid node sizing for loadUS2L_immI16 and loadI2L_immI
- * @run main/othervm -server -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask
+ * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,LoadWithMask.foo LoadWithMask
  *
  */
 public class LoadWithMask {
--- a/test/compiler/codegen/LoadWithMask2.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/codegen/LoadWithMask2.java	Thu Oct 09 12:17:17 2014 -0700
@@ -25,7 +25,7 @@
  * @test
  * @bug 8031743
  * @summary loadI2L_immI broken for negative memory values
- * @run main/othervm -server -Xbatch -XX:-TieredCompilation -XX:CompileCommand=compileonly,*.foo* LoadWithMask2
+ * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,*.foo* LoadWithMask2
  *
  */
 public class LoadWithMask2 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jsr292/NullConstantReceiver.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8059556
+ * @run main/othervm -Xbatch NullConstantReceiver
+ */
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+
+public class NullConstantReceiver {
+    static final MethodHandle target;
+    static {
+        try {
+            target = MethodHandles.lookup().findVirtual(NullConstantReceiver.class, "test", MethodType.methodType(void.class));
+        } catch (ReflectiveOperationException e) {
+            throw new Error(e);
+        }
+    }
+
+    public void test() {}
+
+    static void run() throws Throwable {
+        target.invokeExact((NullConstantReceiver) null);
+    }
+
+    public static void main(String[] args) throws Throwable {
+        for (int i = 0; i<15000; i++) {
+            try {
+                run();
+            } catch (NullPointerException e) {
+                // expected
+                continue;
+            }
+            throw new AssertionError("NPE wasn't thrown");
+        }
+        System.out.println("TEST PASSED");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/jsr292/VMAnonymousClasses.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test
+ * @bug 8058828
+ * @run main/bootclasspath -Xbatch VMAnonymousClasses
+ */
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import sun.misc.Unsafe;
+
+import java.lang.invoke.ConstantCallSite;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.MutableCallSite;
+import java.lang.invoke.VolatileCallSite;
+
+public class VMAnonymousClasses {
+    static final String TEST_METHOD_NAME = "constant";
+
+    static final Unsafe UNSAFE = Unsafe.getUnsafe();
+
+    static int getConstantPoolSize(byte[] classFile) {
+        // The first few bytes:
+        // u4 magic;
+        // u2 minor_version;
+        // u2 major_version;
+        // u2 constant_pool_count;
+        return ((classFile[8] & 0xFF) << 8) | (classFile[9] & 0xFF);
+    }
+
+    static void test(Object value) throws ReflectiveOperationException {
+        System.out.printf("Test: %s", value != null ? value.getClass() : "null");
+
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
+        cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, "Test", null, "java/lang/Object", null);
+
+        MethodVisitor mv = cw.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC, TEST_METHOD_NAME, "()Ljava/lang/Object;", null, null);
+
+        String placeholder = "CONSTANT";
+        int index = cw.newConst(placeholder);
+        mv.visitLdcInsn(placeholder);
+        mv.visitInsn(Opcodes.ARETURN);
+
+        mv.visitMaxs(0, 0);
+        mv.visitEnd();
+
+        byte[] classFile = cw.toByteArray();
+
+        Object[] cpPatches = new Object[getConstantPoolSize(classFile)];
+        cpPatches[index] = value;
+
+        Class<?> test = UNSAFE.defineAnonymousClass(VMAnonymousClasses.class, classFile, cpPatches);
+
+        Object expectedResult = (value != null) ? value : placeholder;
+        for (int i = 0; i<15000; i++) {
+            Object result = test.getMethod(TEST_METHOD_NAME).invoke(null);
+            if (result != expectedResult) {
+                throw new AssertionError(String.format("Wrong value returned: %s != %s", value, result));
+            }
+        }
+        System.out.println(" PASSED");
+    }
+
+    public static void main(String[] args) throws ReflectiveOperationException  {
+        // Objects
+        test(new Object());
+        test("TEST");
+        test(new VMAnonymousClasses());
+        test(null);
+
+        // Class
+        test(String.class);
+
+        // Arrays
+        test(new boolean[0]);
+        test(new byte[0]);
+        test(new char[0]);
+        test(new short[0]);
+        test(new int[0]);
+        test(new long[0]);
+        test(new float[0]);
+        test(new double[0]);
+        test(new Object[0]);
+
+        // Multi-dimensional arrays
+        test(new byte[0][0]);
+        test(new Object[0][0]);
+
+        // MethodHandle-related
+        MethodType   mt = MethodType.methodType(void.class, String[].class);
+        MethodHandle mh = MethodHandles.lookup().findStatic(VMAnonymousClasses.class, "main", mt);
+        test(mt);
+        test(mh);
+        test(new ConstantCallSite(mh));
+        test(new MutableCallSite(MethodType.methodType(void.class)));
+        test(new VolatileCallSite(MethodType.methodType(void.class)));
+
+        System.out.println("TEST PASSED");
+    }
+}
--- a/test/compiler/stable/TestStableBoolean.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableBoolean.java	Thu Oct 09 12:17:17 2014 -0700
@@ -53,44 +53,32 @@
  *           java/lang/invoke/TestStableBoolean$DefaultStaticValue
  *           java/lang/invoke/TestStableBoolean$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableBoolean
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableBoolean
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableBoolean
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableBoolean
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableBoolean
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableBoolean
  */
 package java.lang.invoke;
 
--- a/test/compiler/stable/TestStableByte.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableByte.java	Thu Oct 09 12:17:17 2014 -0700
@@ -53,44 +53,32 @@
  *           java/lang/invoke/TestStableByte$DefaultStaticValue
  *           java/lang/invoke/TestStableByte$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableByte
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableByte
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableByte
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableByte
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableByte
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableByte
  */
 package java.lang.invoke;
 
--- a/test/compiler/stable/TestStableChar.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableChar.java	Thu Oct 09 12:17:17 2014 -0700
@@ -53,44 +53,32 @@
  *           java/lang/invoke/TestStableChar$DefaultStaticValue
  *           java/lang/invoke/TestStableChar$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableChar
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableChar
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableChar
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableChar
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableChar
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableChar
  */
 package java.lang.invoke;
 
--- a/test/compiler/stable/TestStableDouble.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableDouble.java	Thu Oct 09 12:17:17 2014 -0700
@@ -53,44 +53,32 @@
  *           java/lang/invoke/TestStableDouble$DefaultStaticValue
  *           java/lang/invoke/TestStableDouble$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableDouble
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableDouble
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableDouble
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableDouble
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableDouble
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableDouble
  */
 package java.lang.invoke;
 
--- a/test/compiler/stable/TestStableFloat.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableFloat.java	Thu Oct 09 12:17:17 2014 -0700
@@ -53,44 +53,32 @@
  *           java/lang/invoke/TestStableFloat$DefaultStaticValue
  *           java/lang/invoke/TestStableFloat$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableFloat
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableFloat
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableFloat
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableFloat
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableFloat
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableFloat
  */
 package java.lang.invoke;
 
--- a/test/compiler/stable/TestStableInt.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableInt.java	Thu Oct 09 12:17:17 2014 -0700
@@ -53,44 +53,32 @@
  *           java/lang/invoke/TestStableInt$DefaultStaticValue
  *           java/lang/invoke/TestStableInt$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableInt
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableInt
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableInt
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableInt
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableInt
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableInt
  */
 package java.lang.invoke;
 
--- a/test/compiler/stable/TestStableLong.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableLong.java	Thu Oct 09 12:17:17 2014 -0700
@@ -53,44 +53,32 @@
  *           java/lang/invoke/TestStableLong$DefaultStaticValue
  *           java/lang/invoke/TestStableLong$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableLong
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableLong
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableLong
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableLong
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableLong
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableLong
  */
 package java.lang.invoke;
 
--- a/test/compiler/stable/TestStableObject.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableObject.java	Thu Oct 09 12:17:17 2014 -0700
@@ -54,44 +54,32 @@
  *           java/lang/invoke/TestStableObject$DefaultStaticValue
  *           java/lang/invoke/TestStableObject$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableObject
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableObject
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableObject
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableObject
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableObject
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableObject
  */
 package java.lang.invoke;
 
--- a/test/compiler/stable/TestStableShort.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/stable/TestStableShort.java	Thu Oct 09 12:17:17 2014 -0700
@@ -53,44 +53,32 @@
  *           java/lang/invoke/TestStableShort$DefaultStaticValue
  *           java/lang/invoke/TestStableShort$ObjectArrayLowerDim2
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableShort
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:-TieredCompilation
+ *                   -XX:-TieredCompilation
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableShort
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:+FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableShort
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
+ * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -server -XX:+TieredCompilation -XX:TieredStopAtLevel=1
+ *                   -XX:+TieredCompilation -XX:TieredStopAtLevel=1
  *                   -XX:-FoldStableValues
  *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
  *                   java.lang.invoke.TestStableShort
  *
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:+FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableShort
- * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions
- *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
- *                   -client -XX:-TieredCompilation
- *                   -XX:-FoldStableValues
- *                   -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
- *                   java.lang.invoke.TestStableShort
  */
 package java.lang.invoke;
 
--- a/test/compiler/uncommontrap/UncommonTrapStackBang.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/compiler/uncommontrap/UncommonTrapStackBang.java	Thu Oct 09 12:17:17 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -27,9 +27,7 @@
  * @bug 8026775
  * @summary Uncommon trap blob did not bang all the stack shadow pages
  *
- * @run main/othervm -server -XX:+IgnoreUnrecognizedVMOptions -XX:+TieredCompilation UncommonTrapStackBang
- * @run main/othervm -server -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation UncommonTrapStackBang
- *
+ * @run main/othervm UncommonTrapStackBang
  *
  * Note: This test does not reproduce the problem with absolute
  * certainty. Empirically the bug reproduces on Windows some 80+% of
--- a/test/gc/8000311/Test8000311.java	Thu Oct 09 11:24:04 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * 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 Test8000311
- * @key gc
- * @bug 8000311
- * @summary G1: ParallelGCThreads==0 broken
- * @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+ResizePLAB -XX:+ExplicitGCInvokesConcurrent Test8000311
- * @author filipp.zhinkin@oracle.com
- */
-
-import java.util.*;
-
-public class Test8000311 {
-  public static void main(String args[]) {
-    for(int i = 0; i<100; i++) {
-      byte[] garbage = new byte[1000];
-      System.gc();
-    }
-  }
-}
--- a/test/gc/TestG1ZeroPGCTJcmdThreadPrint.java	Thu Oct 09 11:24:04 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * 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 TestG1ZeroPGCTJcmdThreadPrint
- * @key gc
- * @bug 8005875
- * @summary Use jcmd to generate a thread dump of a Java program being run with PGCT=0 to verify 8005875
- * @library /testlibrary
- * @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+IgnoreUnrecognizedVMOptions TestG1ZeroPGCTJcmdThreadPrint
- */
-
-import com.oracle.java.testlibrary.*;
-
-public class TestG1ZeroPGCTJcmdThreadPrint {
-  public static void main(String args[]) throws Exception {
-
-    // Grab the pid from the current java process
-    String pid = Integer.toString(ProcessTools.getProcessId());
-
-    // Create a ProcessBuilder
-    ProcessBuilder pb = new ProcessBuilder();
-
-    // Run jcmd <pid> Thread.print
-    pb.command(JDKToolFinder.getJDKTool("jcmd"), pid, "Thread.print");
-
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-    // There shouldn't be a work gang for concurrent marking.
-    output.shouldNotContain("G1 Parallel Marking Threads");
-
-    // Make sure we didn't crash
-    output.shouldHaveExitValue(0);
-  }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/arguments/TestG1ConcRefinementThreads.java	Thu Oct 09 12:17:17 2014 -0700
@@ -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.
+*/
+
+/*
+ * @test TestG1ConcRefinementThreads
+ * @key gc
+ * @bug 8047976
+ * @summary Tests argument processing for G1ConcRefinementThreads
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+import java.util.*;
+import java.util.regex.*;
+
+public class TestG1ConcRefinementThreads {
+
+  static final int AUTO_SELECT_THREADS_COUNT = 0;
+  static final int PASSED_THREADS_COUNT = 11;
+
+  public static void main(String args[]) throws Exception {
+    // default case
+    runG1ConcRefinementThreadsTest(
+        new String[]{}, // automatically selected
+        AUTO_SELECT_THREADS_COUNT /* use default setting */);
+
+    // zero setting case
+    runG1ConcRefinementThreadsTest(
+        new String[]{"-XX:G1ConcRefinementThreads=0"}, // automatically selected
+        AUTO_SELECT_THREADS_COUNT /* set to zero */);
+
+    // non-zero sestting case
+    runG1ConcRefinementThreadsTest(
+        new String[]{"-XX:G1ConcRefinementThreads="+Integer.toString(PASSED_THREADS_COUNT)},
+        PASSED_THREADS_COUNT);
+  }
+
+  private static void runG1ConcRefinementThreadsTest(String[] passedOpts,
+          int expectedValue) throws Exception {
+    List<String> vmOpts = new ArrayList<>();
+    if (passedOpts.length > 0) {
+      Collections.addAll(vmOpts, passedOpts);
+    }
+    Collections.addAll(vmOpts, "-XX:+UseG1GC", "-XX:+PrintFlagsFinal", "-version");
+
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+
+    output.shouldHaveExitValue(0);
+    String stdout = output.getStdout();
+    checkG1ConcRefinementThreadsConsistency(stdout, expectedValue);
+  }
+
+  private static void checkG1ConcRefinementThreadsConsistency(String output, int expectedValue) {
+    int actualValue = getIntValue("G1ConcRefinementThreads", output);
+
+    if (expectedValue == 0) {
+      // If expectedValue is automatically selected, set it same as ParallelGCThreads.
+      expectedValue = getIntValue("ParallelGCThreads", output);
+    }
+
+    if (expectedValue != actualValue) {
+      throw new RuntimeException(
+            "Actual G1ConcRefinementThreads(" + Integer.toString(actualValue)
+            + ") is not equal to expected value(" + Integer.toString(expectedValue) + ")");
+    }
+  }
+
+  public static int getIntValue(String flag, String where) {
+    Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
+    if (!m.find()) {
+      throw new RuntimeException("Could not find value for flag " + flag + " in output string");
+    }
+    String match = m.group();
+    return Integer.parseInt(match.substring(match.lastIndexOf(" ") + 1, match.length()));
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/arguments/TestParallelGCThreads.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,64 @@
+/*
+* 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.
+*/
+
+/*
+ * @test TestParallelGCThreads
+ * @key gc
+ * @bug 8059527
+ * @summary Tests argument processing for ParallelGCThreads
+ * @library /testlibrary
+ * @run driver TestParallelGCThreads
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class TestParallelGCThreads {
+
+  public static void main(String args[]) throws Exception {
+
+    // For each parallel collector (G1, Parallel, ParNew/CMS)
+    for (String gc : new String[] {"G1", "Parallel", "ConcMarkSweep"}) {
+
+      // Make sure the VM does not allow ParallelGCThreads set to 0
+      String[] flags = new String[] {"-XX:+Use" + gc + "GC", "-XX:ParallelGCThreads=0", "-XX:+PrintFlagsFinal", "-version"};
+      ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
+      OutputAnalyzer output = new OutputAnalyzer(pb.start());
+      output.shouldHaveExitValue(1);
+
+      // Do some basic testing to ensure the flag updates the count
+      for (long i = 1; i <= 3; i++) {
+        flags = new String[] {"-XX:+Use" + gc + "GC", "-XX:ParallelGCThreads=" + i, "-XX:+PrintFlagsFinal", "-version"};
+        long count = getParallelGCThreadCount(flags);
+        Asserts.assertEQ(count, i, "Specifying ParallelGCThreads=" + i + " for " + gc + "GC does not set the thread count properly!");
+      }
+    }
+  }
+
+  public static long getParallelGCThreadCount(String flags[]) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flags);
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldHaveExitValue(0);
+    String stdout = output.getStdout();
+    return FlagsValue.getFlagLongValue("ParallelGCThreads", stdout);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestShrinkAuxiliaryData.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,286 @@
+/*
+ * 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.
+ */
+
+import static com.oracle.java.testlibrary.Asserts.assertLessThanOrEqual;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.Platform;
+import com.oracle.java.testlibrary.ProcessTools;
+import com.oracle.java.testlibrary.Utils;
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryUsage;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import sun.misc.Unsafe;
+
+public class TestShrinkAuxiliaryData {
+
+    private final static String[] initialOpts = new String[]{
+        "-XX:MinHeapFreeRatio=10",
+        "-XX:MaxHeapFreeRatio=11",
+        "-XX:+UseG1GC",
+        "-XX:G1HeapRegionSize=1m",
+        "-XX:+PrintGCDetails"
+    };
+
+    private final int RSetCacheSize;
+
+    protected TestShrinkAuxiliaryData(int RSetCacheSize) {
+        this.RSetCacheSize = RSetCacheSize;
+    }
+
+    protected void test() throws Exception {
+        ArrayList<String> vmOpts = new ArrayList();
+        Collections.addAll(vmOpts, initialOpts);
+
+        int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize()));
+        if (maxCacheSize < RSetCacheSize) {
+            System.out.format("Skiping test for %d cache size due max cache size %d",
+                    RSetCacheSize, maxCacheSize
+            );
+            return;
+        }
+
+        printTestInfo(maxCacheSize);
+
+        vmOpts.add("-XX:G1ConcRSLogCacheSize=" + RSetCacheSize);
+
+        vmOpts.addAll(Arrays.asList(Utils.getFilteredTestJavaOpts(
+                ShrinkAuxiliaryDataTest.prohibitedVmOptions)));
+
+        // for 32 bits ObjectAlignmentInBytes is not a option
+        if (Platform.is32bit()) {
+            ArrayList<String> vmOptsWithoutAlign = new ArrayList(vmOpts);
+            vmOptsWithoutAlign.add(ShrinkAuxiliaryDataTest.class.getName());
+            performTest(vmOptsWithoutAlign);
+            return;
+        }
+
+        for (int alignment = 3; alignment <= 8; alignment++) {
+            ArrayList<String> vmOptsWithAlign = new ArrayList(vmOpts);
+            vmOptsWithAlign.add("-XX:ObjectAlignmentInBytes="
+                    + (int) Math.pow(2, alignment));
+            vmOptsWithAlign.add(ShrinkAuxiliaryDataTest.class.getName());
+
+            performTest(vmOptsWithAlign);
+        }
+    }
+
+    private void performTest(List<String> opts) throws Exception {
+        ProcessBuilder pb
+                       = ProcessTools.createJavaProcessBuilder(
+                opts.toArray(new String[opts.size()])
+        );
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
+    }
+
+    private void printTestInfo(int maxCacheSize) {
+
+        DecimalFormat grouped = new DecimalFormat("000,000");
+        DecimalFormatSymbols formatSymbols = grouped.getDecimalFormatSymbols();
+        formatSymbols.setGroupingSeparator(' ');
+        grouped.setDecimalFormatSymbols(formatSymbols);
+
+        System.out.format("Test will use %s bytes of memory of %s available%n"
+                + "Available memory is %s with %d bytes pointer size - can save %s pointers%n"
+                + "Max cache size: 2^%d = %s elements%n",
+                grouped.format(ShrinkAuxiliaryDataTest.getMemoryUsedByTest()),
+                grouped.format(Runtime.getRuntime().freeMemory()),
+                grouped.format(Runtime.getRuntime().freeMemory()
+                        - ShrinkAuxiliaryDataTest.getMemoryUsedByTest()),
+                Unsafe.ADDRESS_SIZE,
+                grouped.format((Runtime.getRuntime().freeMemory()
+                        - ShrinkAuxiliaryDataTest.getMemoryUsedByTest())
+                        / Unsafe.ADDRESS_SIZE),
+                maxCacheSize,
+                grouped.format((int) Math.pow(2, maxCacheSize))
+        );
+    }
+
+    /**
+     * Detects maximum possible size of G1ConcRSLogCacheSize available for
+     * current process based on maximum available process memory size
+     *
+     * @return power of two
+     */
+    private static int getMaxCacheSize() {
+        long availableMemory = Runtime.getRuntime().freeMemory()
+                - ShrinkAuxiliaryDataTest.getMemoryUsedByTest() - 1l;
+        if (availableMemory <= 0) {
+            return 0;
+        }
+        long availablePointersCount = availableMemory / Unsafe.ADDRESS_SIZE;
+        return (63 - (int) Long.numberOfLeadingZeros(availablePointersCount));
+    }
+
+    static class ShrinkAuxiliaryDataTest {
+
+        public static void main(String[] args) throws IOException {
+            int iterateCount = DEFAULT_ITERATION_COUNT;
+
+            if (args.length > 0) {
+                try {
+                    iterateCount = Integer.parseInt(args[0]);
+                } catch (NumberFormatException e) {
+                    //num_iterate remains default
+                }
+            }
+
+            new ShrinkAuxiliaryDataTest().test(iterateCount);
+        }
+
+        class GarbageObject {
+
+            private final List<byte[]> payload = new ArrayList();
+            private final List<GarbageObject> ref = new LinkedList();
+
+            public GarbageObject(int size) {
+                payload.add(new byte[size]);
+            }
+
+            public void addRef(GarbageObject g) {
+                ref.add(g);
+            }
+
+            public void mutate() {
+                if (!payload.isEmpty() && payload.get(0).length > 0) {
+                    payload.get(0)[0] = (byte) (Math.random() * Byte.MAX_VALUE);
+                }
+            }
+        }
+
+        private final List<GarbageObject> garbage = new ArrayList();
+
+        public void test(int num_iterate) throws IOException {
+
+            allocate();
+            link();
+            mutate();
+            deallocate();
+
+            MemoryUsage muBeforeHeap
+                        = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+            MemoryUsage muBeforeNonHeap
+                        = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
+
+            for (int i = 0; i < num_iterate; i++) {
+                allocate();
+                link();
+                mutate();
+                deallocate();
+            }
+
+            System.gc();
+            MemoryUsage muAfterHeap
+                        = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+            MemoryUsage muAfterNonHeap
+                        = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
+
+            assertLessThanOrEqual(muAfterHeap.getCommitted(), muBeforeHeap.getCommitted(),
+                    String.format("heap decommit failed - after > before: %d > %d",
+                            muAfterHeap.getCommitted(), muBeforeHeap.getCommitted()
+                    )
+            );
+
+            if (muAfterHeap.getCommitted() < muBeforeHeap.getCommitted()) {
+                assertLessThanOrEqual(muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted(),
+                        String.format("non-heap decommit failed - after > before: %d > %d",
+                                muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted()
+                        )
+                );
+            }
+        }
+
+        private void allocate() {
+            for (int r = 0; r < REGIONS_TO_ALLOCATE; r++) {
+                for (int i = 0; i < NUM_OBJECTS_PER_REGION; i++) {
+                    GarbageObject g = new GarbageObject(REGION_SIZE
+                            / NUM_OBJECTS_PER_REGION);
+                    garbage.add(g);
+                }
+            }
+        }
+
+        /**
+         * Iterate through all allocated objects, and link to objects in another
+         * regions
+         */
+        private void link() {
+            for (int ig = 0; ig < garbage.size(); ig++) {
+                int regionNumber = ig / NUM_OBJECTS_PER_REGION;
+
+                for (int i = 0; i < NUM_LINKS; i++) {
+                    int regionToLink;
+                    do {
+                        regionToLink = (int) (Math.random()
+                                * REGIONS_TO_ALLOCATE);
+                    } while (regionToLink == regionNumber);
+
+                    // get random garbage object from random region
+                    garbage.get(ig).addRef(garbage.get(regionToLink
+                            * NUM_OBJECTS_PER_REGION + (int) (Math.random()
+                            * NUM_OBJECTS_PER_REGION)));
+                }
+            }
+        }
+
+        private void mutate() {
+            for (int ig = 0; ig < garbage.size(); ig++) {
+                garbage.get(ig).mutate();
+            }
+        }
+
+        private void deallocate() {
+            garbage.clear();
+            System.gc();
+        }
+
+        static long getMemoryUsedByTest() {
+            return REGIONS_TO_ALLOCATE * REGION_SIZE;
+        }
+
+        private static final int REGION_SIZE = 1024 * 1024;
+        private static final int DEFAULT_ITERATION_COUNT = 1;   // iterate main scenario
+        private static final int REGIONS_TO_ALLOCATE = 5;
+        private static final int NUM_OBJECTS_PER_REGION = 10;
+        private static final int NUM_LINKS = 20; // how many links create for each object
+
+        private static final String[] prohibitedVmOptions = {
+            // remove this when @requires option will be on duty
+            "-XX:\\+UseParallelGC",
+            "-XX:\\+UseSerialGC",
+            "-XX:\\+UseConcMarkSweepGC",
+            "-XX:\\+UseParallelOldGC",
+            "-XX:\\+UseParNewGC",
+            "-Xconcgc",
+            "-Xincgc"
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestShrinkAuxiliaryData00.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test TestShrinkAuxiliaryData00
+ * @bug 8038423
+ * @summary Checks that decommitment occurs for JVM with different
+ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData00
+ * @run driver/timeout=720 TestShrinkAuxiliaryData00
+ */
+public class TestShrinkAuxiliaryData00 {
+
+    public static void main(String[] args) throws Exception {
+        new TestShrinkAuxiliaryData(0).test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestShrinkAuxiliaryData05.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test TestShrinkAuxiliaryData05
+ * @bug 8038423
+ * @summary Checks that decommitment occurs for JVM with different
+ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
+ * @run driver/timeout=720 TestShrinkAuxiliaryData05
+ */
+public class TestShrinkAuxiliaryData05 {
+
+    public static void main(String[] args) throws Exception {
+        new TestShrinkAuxiliaryData(5).test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestShrinkAuxiliaryData10.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test TestShrinkAuxiliaryData10
+ * @bug 8038423
+ * @summary Checks that decommitment occurs for JVM with different
+ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10
+ * @run driver/timeout=720 TestShrinkAuxiliaryData10
+ */
+public class TestShrinkAuxiliaryData10 {
+
+    public static void main(String[] args) throws Exception {
+        new TestShrinkAuxiliaryData(10).test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestShrinkAuxiliaryData15.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test TestShrinkAuxiliaryData15
+ * @bug 8038423
+ * @summary Checks that decommitment occurs for JVM with different
+ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15
+ * @run driver/timeout=720 TestShrinkAuxiliaryData15
+ */
+public class TestShrinkAuxiliaryData15 {
+
+    public static void main(String[] args) throws Exception {
+        new TestShrinkAuxiliaryData(15).test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestShrinkAuxiliaryData20.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test TestShrinkAuxiliaryData20
+ * @bug 8038423
+ * @summary Checks that decommitment occurs for JVM with different
+ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20
+ * @run driver/timeout=720 TestShrinkAuxiliaryData20
+ */
+public class TestShrinkAuxiliaryData20 {
+
+    public static void main(String[] args) throws Exception {
+        new TestShrinkAuxiliaryData(20).test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestShrinkAuxiliaryData25.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test TestShrinkAuxiliaryData25
+ * @bug 8038423
+ * @summary Checks that decommitment occurs for JVM with different
+ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25
+ * @run driver/timeout=720 TestShrinkAuxiliaryData25
+ */
+public class TestShrinkAuxiliaryData25 {
+
+    public static void main(String[] args) throws Exception {
+        new TestShrinkAuxiliaryData(25).test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/g1/TestShrinkAuxiliaryData30.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ */
+
+/**
+ * @test TestShrinkAuxiliaryData30
+ * @bug 8038423
+ * @summary Checks that decommitment occurs for JVM with different
+ * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30
+ * @run driver/timeout=720 TestShrinkAuxiliaryData30
+ */
+public class TestShrinkAuxiliaryData30 {
+
+    public static void main(String[] args) throws Exception {
+        new TestShrinkAuxiliaryData(30).test();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/gc/metaspace/TestCapacityUntilGCWrapAround.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @key gc
+ * @bug 8049831
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestCapacityUntilGCWrapAround
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestCapacityUntilGCWrapAround
+ */
+
+import sun.hotspot.WhiteBox;
+
+import com.oracle.java.testlibrary.Asserts;
+import com.oracle.java.testlibrary.Platform;
+
+public class TestCapacityUntilGCWrapAround {
+    private static long MB = 1024 * 1024;
+    private static long GB = 1024 * MB;
+    private static long MAX_UINT = 4 * GB - 1; // On 32-bit platforms
+
+    public static void main(String[] args) {
+        if (Platform.is32bit()) {
+            WhiteBox wb = WhiteBox.getWhiteBox();
+
+            long before = wb.metaspaceCapacityUntilGC();
+            // Now force possible overflow of capacity_until_GC.
+            long after = wb.incMetaspaceCapacityUntilGC(MAX_UINT);
+
+            Asserts.assertGTE(after, before,
+                              "Increasing with MAX_UINT should not cause wrap around: " + after + " < " + before);
+            Asserts.assertLTE(after, MAX_UINT,
+                              "Increasing with MAX_UINT should not cause value larger than MAX_UINT:" + after);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/LoadClass/ShowClassLoader.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @key regression
+ * @bug 8058927
+ * @summary Make sure array class has the right class loader
+ * @run main ShowClassLoader
+ */
+
+public class ShowClassLoader {
+
+    public static void main(String[] args) {
+        Object[] oa = new Object[0];
+        ShowClassLoader[] sa = new ShowClassLoader[0];
+
+        System.out.println("Classloader for Object[] is " + oa.getClass().getClassLoader());
+        System.out.println("Classloader for SCL[] is " + sa.getClass().getClassLoader() );
+
+        if (sa.getClass().getClassLoader() == null) {
+            throw new RuntimeException("Wrong class loader");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/NMT/UnsafeMallocLimit2.java	Thu Oct 09 12:17:17 2014 -0700
@@ -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.
+ */
+
+/*
+ * @test
+ * @bug 8058818
+ * @library /testlibrary
+ * @build UnsafeMallocLimit2
+ * @run main/othervm -Xmx32m -XX:NativeMemoryTracking=off UnsafeMallocLimit2
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.misc.Unsafe;
+
+public class UnsafeMallocLimit2 {
+
+    public static void main(String args[]) throws Exception {
+        if (Platform.is32bit()) {
+            Unsafe unsafe = Utils.getUnsafe();
+            try {
+                // Allocate greater than MALLOC_MAX and likely won't fail to allocate,
+                // so it hits the NMT code that asserted.
+                // Test that this doesn't cause an assertion with NMT off.
+                // The option above overrides if all the tests are run with NMT on.
+                unsafe.allocateMemory(0x40000000);
+                System.out.println("Allocation succeeded");
+            } catch (OutOfMemoryError e) {
+                System.out.println("Allocation failed");
+            }
+        } else {
+            System.out.println("Test only valid on 32-bit platforms");
+        }
+    }
+}
--- a/test/serviceability/dcmd/CodeCacheTest.java	Thu Oct 09 11:24:04 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * @test CodeCacheTest
- * @bug 8054889
- * @build DcmdUtil CodeCacheTest
- * @run main/othervm -XX:+SegmentedCodeCache CodeCacheTest
- * @run main/othervm -XX:-SegmentedCodeCache CodeCacheTest
- * @summary Test of diagnostic command Compiler.codecache
- */
-
-import java.io.BufferedReader;
-import java.io.StringReader;
-import java.lang.reflect.Method;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class CodeCacheTest {
-
-    /**
-     * This test calls Jcmd (diagnostic command tool) Compiler.codecache and then parses the output,
-     * making sure that all numbers look ok
-     *
-     *
-     * Expected output without code cache segmentation:
-     *
-     * CodeCache: size=245760Kb used=4680Kb max_used=4680Kb free=241079Kb
-     * bounds [0x00007f5bd9000000, 0x00007f5bd94a0000, 0x00007f5be8000000]
-     * total_blobs=575 nmethods=69 adapters=423
-     * compilation: enabled
-     *
-     * Expected output with code cache segmentation (number of segments may change):
-     *
-     * CodeHeap 'non-methods': size=5696Kb used=2236Kb max_used=2238Kb free=3459Kb
-     *  bounds [0x00007fa0f0ffe000, 0x00007fa0f126e000, 0x00007fa0f158e000]
-     * CodeHeap 'profiled nmethods': size=120036Kb used=8Kb max_used=8Kb free=120027Kb
-     *  bounds [0x00007fa0f158e000, 0x00007fa0f17fe000, 0x00007fa0f8ac7000]
-     * CodeHeap 'non-profiled nmethods': size=120036Kb used=2Kb max_used=2Kb free=120034Kb
-     *  bounds [0x00007fa0f8ac7000, 0x00007fa0f8d37000, 0x00007fa100000000]
-     * total_blobs=486 nmethods=8 adapters=399
-     * compilation: enabled
-     */
-
-    static Pattern line1 = Pattern.compile("(CodeCache|CodeHeap.*): size=(\\p{Digit}*)Kb used=(\\p{Digit}*)Kb max_used=(\\p{Digit}*)Kb free=(\\p{Digit}*)Kb");
-    static Pattern line2 = Pattern.compile(" bounds \\[0x(\\p{XDigit}*), 0x(\\p{XDigit}*), 0x(\\p{XDigit}*)\\]");
-    static Pattern line3 = Pattern.compile(" total_blobs=(\\p{Digit}*) nmethods=(\\p{Digit}*) adapters=(\\p{Digit}*)");
-    static Pattern line4 = Pattern.compile(" compilation: (.*)");
-
-    private static boolean getFlagBool(String flag, String where) {
-      Matcher m = Pattern.compile(flag + "\\s+:?= (true|false)").matcher(where);
-      if (!m.find()) {
-        throw new RuntimeException("Could not find value for flag " + flag + " in output string");
-      }
-      return m.group(1).equals("true");
-    }
-
-    private static int getFlagInt(String flag, String where) {
-      Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
-      if (!m.find()) {
-        throw new RuntimeException("Could not find value for flag " + flag + " in output string");
-      }
-      String match = m.group();
-      return Integer.parseInt(match.substring(match.lastIndexOf(" ") + 1, match.length()));
-    }
-
-    public static void main(String arg[]) throws Exception {
-        // Get number of code cache segments
-        int segmentsCount = 0;
-        String flags = DcmdUtil.executeDcmd("VM.flags", "-all");
-        if (!getFlagBool("SegmentedCodeCache", flags) || !getFlagBool("UseCompiler", flags)) {
-          // No segmentation
-          segmentsCount = 1;
-        } else if (getFlagBool("TieredCompilation", flags) && getFlagInt("TieredStopAtLevel", flags) > 1) {
-          // Tiered compilation: use all segments
-          segmentsCount = 3;
-        } else {
-          // No TieredCompilation: only non-method and non-profiled segment
-          segmentsCount = 2;
-        }
-
-        // Get output from dcmd (diagnostic command)
-        String result = DcmdUtil.executeDcmd("Compiler.codecache");
-        BufferedReader r = new BufferedReader(new StringReader(result));
-
-        // Validate code cache segments
-        String line;
-        Matcher m;
-        for (int s = 0; s < segmentsCount; ++s) {
-          // Validate first line
-          line = r.readLine();
-          m = line1.matcher(line);
-          if (m.matches()) {
-              for (int i = 2; i <= 5; i++) {
-                  int val = Integer.parseInt(m.group(i));
-                  if (val < 0) {
-                      throw new Exception("Failed parsing dcmd codecache output");
-                  }
-              }
-          } else {
-              throw new Exception("Regexp 1 failed");
-          }
-
-          // Validate second line
-          line = r.readLine();
-          m = line2.matcher(line);
-          if (m.matches()) {
-              String start = m.group(1);
-              String mark  = m.group(2);
-              String top   = m.group(3);
-
-              // Lexical compare of hex numbers to check that they look sane.
-              if (start.compareTo(mark) > 1) {
-                  throw new Exception("Failed parsing dcmd codecache output");
-              }
-              if (mark.compareTo(top) > 1) {
-                  throw new Exception("Failed parsing dcmd codecache output");
-              }
-          } else {
-              throw new Exception("Regexp 2 failed line: " + line);
-          }
-        }
-
-        // Validate third line
-        line = r.readLine();
-        m = line3.matcher(line);
-        if (m.matches()) {
-            int blobs = Integer.parseInt(m.group(1));
-            if (blobs <= 0) {
-                throw new Exception("Failed parsing dcmd codecache output");
-            }
-            int nmethods = Integer.parseInt(m.group(2));
-            if (nmethods < 0) {
-                throw new Exception("Failed parsing dcmd codecache output");
-            }
-            int adapters = Integer.parseInt(m.group(3));
-            if (adapters <= 0) {
-                throw new Exception("Failed parsing dcmd codecache output");
-            }
-            if (blobs < (nmethods + adapters)) {
-                throw new Exception("Failed parsing dcmd codecache output");
-            }
-        } else {
-            throw new Exception("Regexp 3 failed");
-        }
-
-        // Validate fourth line
-        line = r.readLine();
-        m = line4.matcher(line);
-        if (!m.matches()) {
-            throw new Exception("Regexp 4 failed");
-        }
-    }
-}
--- a/test/serviceability/dcmd/CodelistTest.java	Thu Oct 09 11:24:04 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * @test CodelistTest
- * @bug 8054889
- * @build DcmdUtil MethodIdentifierParser CodelistTest
- * @run main CodelistTest
- * @summary Test of diagnostic command Compiler.codelist
- */
-
-import java.io.BufferedReader;
-import java.io.StringReader;
-import java.lang.reflect.Method;
-
-public class CodelistTest {
-
-    /**
-     * This test calls Jcmd (diagnostic command tool) Compiler.codelist and then parses the output,
-     * making sure that the first methods in the list is valid by reflection.
-     *
-     * Output example:
-     *
-     * 6 0 java.lang.System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V [0x00007f7b49200910, 0x00007f7b49200aa0 - 0x00007f7b49200d30]
-     * 2 3 java.lang.String.indexOf(II)I [0x00007f7b49200d90, 0x00007f7b49200f60 - 0x00007f7b49201490]
-     * 7 3 java.lang.Math.min(II)I [0x00007f7b4922f010, 0x00007f7b4922f180 - 0x00007f7b4922f338]
-     * 8 3 java.lang.String.equals(Ljava/lang/Object;)Z [0x00007f7b4922fb10, 0x00007f7b4922fd40 - 0x00007f7b49230698]
-     * 9 3 java.lang.AbstractStringBuilder.ensureCapacityInternal(I)V [0x00007f7b49232010, 0x00007f7b492321a0 - 0x00007f7b49232510]
-     * 10 1 java.lang.Object.<init>()V [0x00007f7b49233e90, 0x00007f7b49233fe0 - 0x00007f7b49234118]
-     *
-     */
-
-    public static void main(String arg[]) throws Exception {
-        int ok   = 0;
-        int fail = 0;
-
-        // Get output from dcmd (diagnostic command)
-        String result = DcmdUtil.executeDcmd("Compiler.codelist");
-        BufferedReader r = new BufferedReader(new StringReader(result));
-
-        // Grab a method name from the output
-        String line;
-        int count = 0;
-
-        while((line = r.readLine()) != null) {
-            count++;
-
-            String[] parts = line.split(" ");
-            // int compileID = Integer.parseInt(parts[0]);
-            // int compileLevel = Integer.parseInt(parts[1]);
-            String methodPrintedInLogFormat = parts[2];
-
-            // skip inits and clinits - they can not be reflected
-            if (methodPrintedInLogFormat.contains("<init>")) {
-                continue;
-            }
-            if (methodPrintedInLogFormat.contains("<clinit>")) {
-                continue;
-            }
-
-            MethodIdentifierParser mf = new MethodIdentifierParser(methodPrintedInLogFormat);
-            Method m;
-            try {
-                m = mf.getMethod();
-            } catch (NoSuchMethodException e) {
-                m = null;
-            }
-            if (m == null) {
-                throw new Exception("Test failed");
-            }
-            if (count > 10) {
-                // Testing 10 entries is enough. Lets not waste time.
-                break;
-            }
-        }
-    }
-}
--- a/test/serviceability/dcmd/CompilerQueueTest.java	Thu Oct 09 11:24:04 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/*
- * 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.
- */
-
-/*
- * @test CompilerQueueTest
- * @bug 8054889
- * @build DcmdUtil CompilerQueueTest
- * @run main CompilerQueueTest
- * @summary Test of diagnostic command Compiler.queue
- */
-
-import java.io.BufferedReader;
-import java.io.StringReader;
-
-public class CompilerQueueTest {
-
-    /**
-     * This test calls Jcmd (diagnostic command tool) Compiler.queue and
-     * then parses the output, making sure that the output look ok.
-     *
-     *
-     * Output example:
-     *
-     * Contents of C1 compile queue
-     * ----------------------------
-     * 73       3       java.lang.AbstractStringBuilder::append (50 bytes)
-     * 74       1       java.util.TreeMap::size (5 bytes)
-     * 75       3       java.lang.StringBuilder::append (8 bytes)
-     * 83       3       java.util.TreeMap$ValueIterator::next (8 bytes)
-     * 84       1       javax.management.MBeanFeatureInfo::getName (5 bytes)
-     * ----------------------------
-     * Contents of C2 compile queue
-     * ----------------------------
-     * Empty
-     * ----------------------------
-     *
-     **/
-
-    public static void main(String arg[]) throws Exception {
-
-        // Get output from dcmd (diagnostic command)
-        String result = DcmdUtil.executeDcmd("Compiler.queue");
-        BufferedReader r = new BufferedReader(new StringReader(result));
-
-        String line;
-        match(r.readLine(), "Contents of C1 compile queue");
-        match(r.readLine(), "----------------------------");
-        String str = r.readLine();
-        if (!str.equals("Empty")) {
-            while (str.charAt(0) != '-') {
-                validateMethodLine(str);
-                str = r.readLine();
-            }
-        } else {
-            str = r.readLine();
-        }
-
-        match(str,          "----------------------------");
-        match(r.readLine(), "Contents of C2 compile queue");
-        match(r.readLine(), "----------------------------");
-        str = r.readLine();
-        if (!str.equals("Empty")) {
-            while (str.charAt(0) != '-') {
-                validateMethodLine(str);
-                str = r.readLine();
-            }
-        } else {
-            str = r.readLine();
-        }
-        match(str, "----------------------------");
-    }
-
-    private static void validateMethodLine(String str)  throws Exception {
-        String name = str.substring(19);
-        int sep = name.indexOf("::");
-        try {
-            Class.forName(name.substring(0, sep));
-        } catch (ClassNotFoundException e) {
-            throw new Exception("Failed parsing dcmd queue");
-        }
-    }
-
-    public static void match(String line, String str) throws Exception {
-        if (!line.equals(str)) {
-            throw new Exception("String equals: " + line + ", " + str);
-        }
-    }
-}
--- a/test/serviceability/dcmd/MethodIdentifierParser.java	Thu Oct 09 11:24:04 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-/*
- * 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.
- */
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-
-public class MethodIdentifierParser {
-
-    private String logString;
-    private String className;
-    private String methodName;
-    private String methodDescriptor;
-
-    /**
-     * This is a utility class for parsing the log entries for a method. It supplies
-     * a few select methods for reflecting the class and method from that information.
-     *
-     * Example log entries:
-     * "java.util.TreeMap.successor(Ljava/util/TreeMap$Entry;)Ljava/util/TreeMap$Entry;"
-     */
-
-    public MethodIdentifierParser(String logString) {
-        this.logString = logString;
-
-        int i      = logString.lastIndexOf("."); // find start of method name
-        className  = logString.substring(0, i);  // classname is everything before
-        int i2     = logString.indexOf("(");     // Signature starts with an '('
-        methodName = logString.substring(i+1, i2);
-        methodDescriptor  = logString.substring(i2, logString.length());
-
-        // Add sanity check for extracted fields
-    }
-
-    public Method getMethod() throws NoSuchMethodException, SecurityException, ClassNotFoundException, Exception {
-        try {
-            return Class.forName(className).getDeclaredMethod(methodName, getParamenterDescriptorArray());
-        } catch (UnexpectedTokenException e) {
-            throw new Exception("Parse failed");
-        }
-    }
-
-    public Class<?>[] getParamenterDescriptorArray() throws ClassNotFoundException, UnexpectedTokenException {
-        ParameterDecriptorIterator s = new ParameterDecriptorIterator(methodDescriptor);
-        Class<?> paramType;
-        ArrayList<Class<?>> list = new ArrayList<Class<?>>();
-        while ((paramType = s.nextParamType()) != null) {
-            list.add(paramType);
-        }
-        if (list.size() > 0) {
-            return list.toArray(new Class<?>[list.size()]);
-        } else {
-            return null;
-        }
-    }
-
-    class ParameterDecriptorIterator {
-
-        // This class uses charAt() indexing for startMark and i
-        // That is when i points to the last char it can be retrieved with
-        // charAt(i). Including the last char for a subString requires
-        // substring(startMark, i+1);
-
-        private String methodDescriptor;
-        private int startMark;
-
-        public ParameterDecriptorIterator(String signature) {
-            this.methodDescriptor = signature;
-            this.startMark = 0;
-            if (signature.charAt(0) == '(') {
-                this.startMark = 1;
-            }
-        }
-
-        public Class<?> nextParamType() throws UnexpectedTokenException {
-            int i = startMark;
-            while (methodDescriptor.length() > i) {
-                switch (methodDescriptor.charAt(i)) {
-                case 'C':
-                case 'B':
-                case 'I':
-                case 'J':
-                case 'Z':
-                case 'F':
-                case 'D':
-                case 'S':
-                    // Primitive class case, but we may have gotten here with [ as first token
-                    break;
-                case 'L':
-                    // Internal class name suffixed by ';'
-                    while (methodDescriptor.charAt(i) != ';') {
-                        i++;
-                    }
-                    break;
-                case '[':
-                    i++;         // arrays -> do another pass
-                    continue;
-                case ')':
-                    return null; // end found
-                case 'V':
-                case ';':
-                default:
-                    throw new UnexpectedTokenException(methodDescriptor, i);
-                }
-                break;
-            }
-            if (i == startMark) {
-                // Single char -> primitive class case
-                startMark++; // Update for next iteration
-                switch (methodDescriptor.charAt(i)) {
-                case 'C':
-                    return char.class;
-                case 'B':
-                    return byte.class;
-                case 'I':
-                    return int.class;
-                case 'J':
-                    return long.class;
-                case 'F':
-                    return float.class;
-                case 'D':
-                    return double.class;
-                case 'S':
-                    return short.class;
-                case 'Z':
-                    return boolean.class;
-                default:
-                    throw new UnexpectedTokenException(methodDescriptor, i);
-                }
-            } else {
-                // Multi char case
-                String nextParam;
-                if (methodDescriptor.charAt(startMark) == 'L') {
-                    // When reflecting a class the leading 'L' and trailing';' must be removed.
-                    // (When reflecting an array of classes, they must remain...)
-                    nextParam = methodDescriptor.substring(startMark+1, i);
-                } else {
-                    // Any kind of array - simple case, use whole descriptor when reflecting.
-                    nextParam = methodDescriptor.substring(startMark, i+1);
-                }
-                startMark = ++i; // Update for next iteration
-                try {
-                    // The parameter descriptor uses JVM internal class identifier with '/' as
-                    // package separator, but Class.forName expects '.'.
-                    nextParam = nextParam.replace('/', '.');
-                    return Class.forName(nextParam);
-                } catch (ClassNotFoundException e) {
-                    System.out.println("Class not Found: " + nextParam);
-                    return null;
-                }
-            }
-        }
-    }
-
-    class UnexpectedTokenException extends Exception {
-        String descriptor;
-        int i;
-        public UnexpectedTokenException(String descriptor, int i) {
-            this.descriptor = descriptor;
-            this.i = i;
-        }
-
-        @Override
-        public String toString() {
-            return "Unexpected token at: " + i + " in signature: " + descriptor;
-        }
-
-        private static final long serialVersionUID = 1L;
-    }
-
-    public void debugPrint() {
-        System.out.println("mlf in:               " + logString);
-        System.out.println("mlf class:            " + className);
-        System.out.println("mlf method:           " + methodName);
-        System.out.println("mlf methodDescriptor: " + methodDescriptor);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/serviceability/dcmd/compiler/CodeCacheTest.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test CodeCacheTest
+ * @bug 8054889
+ * @library ..
+ * @build DcmdUtil CodeCacheTest
+ * @run main/othervm -XX:+SegmentedCodeCache CodeCacheTest
+ * @run main/othervm -XX:-SegmentedCodeCache CodeCacheTest
+ * @run main/othervm -Xint -XX:+SegmentedCodeCache CodeCacheTest
+ * @summary Test of diagnostic command Compiler.codecache
+ */
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+import java.lang.reflect.Method;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class CodeCacheTest {
+
+    /**
+     * This test calls Jcmd (diagnostic command tool) Compiler.codecache and then parses the output,
+     * making sure that all numbers look ok
+     *
+     *
+     * Expected output without code cache segmentation:
+     *
+     * CodeCache: size=245760Kb used=4680Kb max_used=4680Kb free=241079Kb
+     * bounds [0x00007f5bd9000000, 0x00007f5bd94a0000, 0x00007f5be8000000]
+     * total_blobs=575 nmethods=69 adapters=423
+     * compilation: enabled
+     *
+     * Expected output with code cache segmentation (number of segments may change):
+     *
+     * CodeHeap 'non-nmethods': size=5696Kb used=2236Kb max_used=2238Kb free=3459Kb
+     *  bounds [0x00007fa0f0ffe000, 0x00007fa0f126e000, 0x00007fa0f158e000]
+     * CodeHeap 'profiled nmethods': size=120036Kb used=8Kb max_used=8Kb free=120027Kb
+     *  bounds [0x00007fa0f158e000, 0x00007fa0f17fe000, 0x00007fa0f8ac7000]
+     * CodeHeap 'non-profiled nmethods': size=120036Kb used=2Kb max_used=2Kb free=120034Kb
+     *  bounds [0x00007fa0f8ac7000, 0x00007fa0f8d37000, 0x00007fa100000000]
+     * total_blobs=486 nmethods=8 adapters=399
+     * compilation: enabled
+     */
+
+    static Pattern line1 = Pattern.compile("(CodeCache|CodeHeap.*): size=(\\p{Digit}*)Kb used=(\\p{Digit}*)Kb max_used=(\\p{Digit}*)Kb free=(\\p{Digit}*)Kb");
+    static Pattern line2 = Pattern.compile(" bounds \\[0x(\\p{XDigit}*), 0x(\\p{XDigit}*), 0x(\\p{XDigit}*)\\]");
+    static Pattern line3 = Pattern.compile(" total_blobs=(\\p{Digit}*) nmethods=(\\p{Digit}*) adapters=(\\p{Digit}*)");
+    static Pattern line4 = Pattern.compile(" compilation: (.*)");
+
+    private static boolean getFlagBool(String flag, String where) {
+      Matcher m = Pattern.compile(flag + "\\s+:?= (true|false)").matcher(where);
+      if (!m.find()) {
+        throw new RuntimeException("Could not find value for flag " + flag + " in output string");
+      }
+      return m.group(1).equals("true");
+    }
+
+    private static int getFlagInt(String flag, String where) {
+      Matcher m = Pattern.compile(flag + "\\s+:?=\\s+\\d+").matcher(where);
+      if (!m.find()) {
+        throw new RuntimeException("Could not find value for flag " + flag + " in output string");
+      }
+      String match = m.group();
+      return Integer.parseInt(match.substring(match.lastIndexOf(" ") + 1, match.length()));
+    }
+
+    public static void main(String arg[]) throws Exception {
+        // Get number of code cache segments
+        int segmentsCount = 0;
+        String flags = DcmdUtil.executeDcmd("VM.flags", "-all");
+        if (!getFlagBool("SegmentedCodeCache", flags) || !getFlagBool("UseCompiler", flags)) {
+          // No segmentation
+          segmentsCount = 1;
+        } else if (getFlagBool("TieredCompilation", flags) && getFlagInt("TieredStopAtLevel", flags) > 1) {
+          // Tiered compilation: use all segments
+          segmentsCount = 3;
+        } else {
+          // No TieredCompilation: only non-nmethod and non-profiled segment
+          segmentsCount = 2;
+        }
+
+        // Get output from dcmd (diagnostic command)
+        String result = DcmdUtil.executeDcmd("Compiler.codecache");
+        BufferedReader r = new BufferedReader(new StringReader(result));
+
+        // Validate code cache segments
+        String line;
+        Matcher m;
+        for (int s = 0; s < segmentsCount; ++s) {
+          // Validate first line
+          line = r.readLine();
+          m = line1.matcher(line);
+          if (m.matches()) {
+              for (int i = 2; i <= 5; i++) {
+                  int val = Integer.parseInt(m.group(i));
+                  if (val < 0) {
+                      throw new Exception("Failed parsing dcmd codecache output");
+                  }
+              }
+          } else {
+              throw new Exception("Regexp 1 failed");
+          }
+
+          // Validate second line
+          line = r.readLine();
+          m = line2.matcher(line);
+          if (m.matches()) {
+              String start = m.group(1);
+              String mark  = m.group(2);
+              String top   = m.group(3);
+
+              // Lexical compare of hex numbers to check that they look sane.
+              if (start.compareTo(mark) > 1) {
+                  throw new Exception("Failed parsing dcmd codecache output");
+              }
+              if (mark.compareTo(top) > 1) {
+                  throw new Exception("Failed parsing dcmd codecache output");
+              }
+          } else {
+              throw new Exception("Regexp 2 failed line: " + line);
+          }
+        }
+
+        // Validate third line
+        line = r.readLine();
+        m = line3.matcher(line);
+        if (m.matches()) {
+            int blobs = Integer.parseInt(m.group(1));
+            if (blobs <= 0) {
+                throw new Exception("Failed parsing dcmd codecache output");
+            }
+            int nmethods = Integer.parseInt(m.group(2));
+            if (nmethods < 0) {
+                throw new Exception("Failed parsing dcmd codecache output");
+            }
+            int adapters = Integer.parseInt(m.group(3));
+            if (adapters <= 0) {
+                throw new Exception("Failed parsing dcmd codecache output");
+            }
+            if (blobs < (nmethods + adapters)) {
+                throw new Exception("Failed parsing dcmd codecache output");
+            }
+        } else {
+            throw new Exception("Regexp 3 failed");
+        }
+
+        // Validate fourth line
+        line = r.readLine();
+        m = line4.matcher(line);
+        if (!m.matches()) {
+            throw new Exception("Regexp 4 failed");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/serviceability/dcmd/compiler/CodelistTest.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test CodelistTest
+ * @bug 8054889
+ * @library ..
+ * @build DcmdUtil MethodIdentifierParser CodelistTest
+ * @run main CodelistTest
+ * @summary Test of diagnostic command Compiler.codelist
+ */
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+import java.lang.reflect.Method;
+
+public class CodelistTest {
+
+    /**
+     * This test calls Jcmd (diagnostic command tool) Compiler.codelist and then parses the output,
+     * making sure that the first methods in the list is valid by reflection.
+     *
+     * Output example:
+     *
+     * 6 0 java.lang.System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V [0x00007f7b49200910, 0x00007f7b49200aa0 - 0x00007f7b49200d30]
+     * 2 3 java.lang.String.indexOf(II)I [0x00007f7b49200d90, 0x00007f7b49200f60 - 0x00007f7b49201490]
+     * 7 3 java.lang.Math.min(II)I [0x00007f7b4922f010, 0x00007f7b4922f180 - 0x00007f7b4922f338]
+     * 8 3 java.lang.String.equals(Ljava/lang/Object;)Z [0x00007f7b4922fb10, 0x00007f7b4922fd40 - 0x00007f7b49230698]
+     * 9 3 java.lang.AbstractStringBuilder.ensureCapacityInternal(I)V [0x00007f7b49232010, 0x00007f7b492321a0 - 0x00007f7b49232510]
+     * 10 1 java.lang.Object.<init>()V [0x00007f7b49233e90, 0x00007f7b49233fe0 - 0x00007f7b49234118]
+     *
+     */
+
+    public static void main(String arg[]) throws Exception {
+        int ok   = 0;
+        int fail = 0;
+
+        // Get output from dcmd (diagnostic command)
+        String result = DcmdUtil.executeDcmd("Compiler.codelist");
+        BufferedReader r = new BufferedReader(new StringReader(result));
+
+        // Grab a method name from the output
+        String line;
+        int count = 0;
+
+        while((line = r.readLine()) != null) {
+            count++;
+
+            String[] parts = line.split(" ");
+            // int compileID = Integer.parseInt(parts[0]);
+            // int compileLevel = Integer.parseInt(parts[1]);
+            String methodPrintedInLogFormat = parts[2];
+
+            // skip inits, clinits and methodHandles - they can not be reflected
+            if (methodPrintedInLogFormat.contains("<init>")) {
+                continue;
+            }
+            if (methodPrintedInLogFormat.contains("<clinit>")) {
+                continue;
+            }
+            if (methodPrintedInLogFormat.contains("MethodHandle")) {
+                continue;
+            }
+
+            MethodIdentifierParser mf = new MethodIdentifierParser(methodPrintedInLogFormat);
+            Method m;
+            try {
+                m = mf.getMethod();
+            } catch (NoSuchMethodException e) {
+                m = null;
+            }
+            if (m == null) {
+                throw new Exception("Test failed on: " + methodPrintedInLogFormat);
+            }
+            if (count > 10) {
+                // Testing 10 entries is enough. Lets not waste time.
+                break;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/serviceability/dcmd/compiler/CompilerQueueTest.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test CompilerQueueTest
+ * @bug 8054889
+ * @library ..
+ * @build DcmdUtil CompilerQueueTest
+ * @run main CompilerQueueTest
+ * @run main/othervm -Xint CompilerQueueTest
+ * @summary Test of diagnostic command Compiler.queue
+ */
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+
+public class CompilerQueueTest {
+
+    /**
+     * This test calls Jcmd (diagnostic command tool) Compiler.queue and
+     * then parses the output, making sure that the output look ok.
+     *
+     *
+     * Output example:
+     *
+     * Contents of C1 compile queue
+     * ----------------------------
+     * 73       3       java.lang.AbstractStringBuilder::append (50 bytes)
+     * 74       1       java.util.TreeMap::size (5 bytes)
+     * 75       3       java.lang.StringBuilder::append (8 bytes)
+     * 83       3       java.util.TreeMap$ValueIterator::next (8 bytes)
+     * 84       1       javax.management.MBeanFeatureInfo::getName (5 bytes)
+     * ----------------------------
+     * Contents of C2 compile queue
+     * ----------------------------
+     * Empty
+     * ----------------------------
+     *
+     **/
+
+    public static void main(String arg[]) throws Exception {
+
+        // Get output from dcmd (diagnostic command)
+        String result = DcmdUtil.executeDcmd("Compiler.queue");
+        BufferedReader r = new BufferedReader(new StringReader(result));
+
+        String str = r.readLine();
+
+        while (str != null) {
+            if (str.startsWith("Contents of C")) {
+                match(r.readLine(), "----------------------------");
+                str = r.readLine();
+                if (!str.equals("Empty")) {
+                    while (str.charAt(0) != '-') {
+                        validateMethodLine(str);
+                        str = r.readLine();
+                    }
+                } else {
+                    str = r.readLine();
+                }
+                match(str,"----------------------------");
+                str = r.readLine();
+            } else {
+                throw new Exception("Failed parsing dcmd queue, line: " + str);
+            }
+        }
+    }
+
+    private static void validateMethodLine(String str)  throws Exception {
+        String name = str.substring(19);
+        int sep = name.indexOf("::");
+        if (sep == -1) {
+            throw new Exception("Failed dcmd queue, didn't find separator :: in: " + name);
+        }
+        try {
+            Class.forName(name.substring(0, sep));
+        } catch (ClassNotFoundException e) {
+            throw new Exception("Failed dcmd queue, Class for name: " + str);
+        }
+    }
+
+    public static void match(String line, String str) throws Exception {
+        if (!line.equals(str)) {
+            throw new Exception("String equals: " + line + ", " + str);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/serviceability/dcmd/compiler/MethodIdentifierParser.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,196 @@
+/*
+ * 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.
+ */
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+public class MethodIdentifierParser {
+
+    private String logString;
+    private String className;
+    private String methodName;
+    private String methodDescriptor;
+
+    /**
+     * This is a utility class for parsing the log entries for a method. It supplies
+     * a few select methods for reflecting the class and method from that information.
+     *
+     * Example log entries:
+     * "java.util.TreeMap.successor(Ljava/util/TreeMap$Entry;)Ljava/util/TreeMap$Entry;"
+     */
+
+    public MethodIdentifierParser(String logString) {
+        this.logString = logString;
+
+        int i      = logString.lastIndexOf("."); // find start of method name
+        className  = logString.substring(0, i);  // classname is everything before
+        int i2     = logString.indexOf("(");     // Signature starts with an '('
+        methodName = logString.substring(i+1, i2);
+        methodDescriptor  = logString.substring(i2, logString.length());
+
+        // Add sanity check for extracted fields
+    }
+
+    public Method getMethod() throws NoSuchMethodException, SecurityException, ClassNotFoundException, Exception {
+        try {
+            return Class.forName(className).getDeclaredMethod(methodName, getParamenterDescriptorArray());
+        } catch (UnexpectedTokenException e) {
+            throw new Exception("Parse failed");
+        }
+    }
+
+    public Class<?>[] getParamenterDescriptorArray() throws ClassNotFoundException, UnexpectedTokenException {
+        ParameterDecriptorIterator s = new ParameterDecriptorIterator(methodDescriptor);
+        Class<?> paramType;
+        ArrayList<Class<?>> list = new ArrayList<Class<?>>();
+        while ((paramType = s.nextParamType()) != null) {
+            list.add(paramType);
+        }
+        if (list.size() > 0) {
+            return list.toArray(new Class<?>[list.size()]);
+        } else {
+            return null;
+        }
+    }
+
+    class ParameterDecriptorIterator {
+
+        // This class uses charAt() indexing for startMark and i
+        // That is when i points to the last char it can be retrieved with
+        // charAt(i). Including the last char for a subString requires
+        // substring(startMark, i+1);
+
+        private String methodDescriptor;
+        private int startMark;
+
+        public ParameterDecriptorIterator(String signature) {
+            this.methodDescriptor = signature;
+            this.startMark = 0;
+            if (signature.charAt(0) == '(') {
+                this.startMark = 1;
+            }
+        }
+
+        public Class<?> nextParamType() throws UnexpectedTokenException {
+            int i = startMark;
+            while (methodDescriptor.length() > i) {
+                switch (methodDescriptor.charAt(i)) {
+                case 'C':
+                case 'B':
+                case 'I':
+                case 'J':
+                case 'Z':
+                case 'F':
+                case 'D':
+                case 'S':
+                    // Primitive class case, but we may have gotten here with [ as first token
+                    break;
+                case 'L':
+                    // Internal class name suffixed by ';'
+                    while (methodDescriptor.charAt(i) != ';') {
+                        i++;
+                    }
+                    break;
+                case '[':
+                    i++;         // arrays -> do another pass
+                    continue;
+                case ')':
+                    return null; // end found
+                case 'V':
+                case ';':
+                default:
+                    throw new UnexpectedTokenException(methodDescriptor, i);
+                }
+                break;
+            }
+            if (i == startMark) {
+                // Single char -> primitive class case
+                startMark++; // Update for next iteration
+                switch (methodDescriptor.charAt(i)) {
+                case 'C':
+                    return char.class;
+                case 'B':
+                    return byte.class;
+                case 'I':
+                    return int.class;
+                case 'J':
+                    return long.class;
+                case 'F':
+                    return float.class;
+                case 'D':
+                    return double.class;
+                case 'S':
+                    return short.class;
+                case 'Z':
+                    return boolean.class;
+                default:
+                    throw new UnexpectedTokenException(methodDescriptor, i);
+                }
+            } else {
+                // Multi char case
+                String nextParam;
+                if (methodDescriptor.charAt(startMark) == 'L') {
+                    // When reflecting a class the leading 'L' and trailing';' must be removed.
+                    // (When reflecting an array of classes, they must remain...)
+                    nextParam = methodDescriptor.substring(startMark+1, i);
+                } else {
+                    // Any kind of array - simple case, use whole descriptor when reflecting.
+                    nextParam = methodDescriptor.substring(startMark, i+1);
+                }
+                startMark = ++i; // Update for next iteration
+                try {
+                    // The parameter descriptor uses JVM internal class identifier with '/' as
+                    // package separator, but Class.forName expects '.'.
+                    nextParam = nextParam.replace('/', '.');
+                    return Class.forName(nextParam);
+                } catch (ClassNotFoundException e) {
+                    System.out.println("Class not Found: " + nextParam);
+                    return null;
+                }
+            }
+        }
+    }
+
+    class UnexpectedTokenException extends Exception {
+        String descriptor;
+        int i;
+        public UnexpectedTokenException(String descriptor, int i) {
+            this.descriptor = descriptor;
+            this.i = i;
+        }
+
+        @Override
+        public String toString() {
+            return "Unexpected token at: " + i + " in signature: " + descriptor;
+        }
+
+        private static final long serialVersionUID = 1L;
+    }
+
+    public void debugPrint() {
+        System.out.println("mlf in:               " + logString);
+        System.out.println("mlf class:            " + className);
+        System.out.println("mlf method:           " + methodName);
+        System.out.println("mlf methodDescriptor: " + methodDescriptor);
+    }
+}
--- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Thu Oct 09 11:24:04 2014 -0700
+++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Thu Oct 09 12:17:17 2014 -0700
@@ -152,6 +152,8 @@
   public native void readReservedMemory();
   public native long allocateMetaspace(ClassLoader classLoader, long size);
   public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
+  public native long incMetaspaceCapacityUntilGC(long increment);
+  public native long metaspaceCapacityUntilGC();
 
   // force Young GC
   public native void youngGC();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary_tests/ctw/Bar.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,5 @@
+public class Bar {
+  private static void staticMethod() { }
+  public void method() { }
+  protected Bar() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary_tests/ctw/ClassesDirTest.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8012447
+ * @library /testlibrary /testlibrary/whitebox /testlibrary/ctw/src
+ * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main ClassesDirTest prepare
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Dsun.hotspot.tools.ctw.logfile=ctw.log sun.hotspot.tools.ctw.CompileTheWorld classes
+ * @run main ClassesDirTest check ctw.log
+ * @summary testing of CompileTheWorld :: classes in directory
+ * @author igor.ignatyev@oracle.com
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+public class ClassesDirTest extends CtwTest {
+    private static final String[] SHOULD_CONTAIN
+            = {"# dir: classes", "Done (2 classes, 6 methods, "};
+
+    private ClassesDirTest() {
+        super(SHOULD_CONTAIN);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ClassesDirTest().run(args);
+    }
+
+    protected void prepare() throws Exception {
+        String path = "classes";
+        Files.createDirectory(Paths.get(path));
+        Files.move(Paths.get("Foo.class"), Paths.get(path, "Foo.class"),
+                StandardCopyOption.REPLACE_EXISTING);
+        Files.move(Paths.get("Bar.class"), Paths.get(path, "Bar.class"),
+                StandardCopyOption.REPLACE_EXISTING);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary_tests/ctw/ClassesListTest.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8012447
+ * @library /testlibrary /testlibrary/whitebox /testlibrary/ctw/src
+ * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main ClassesListTest prepare
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Dsun.hotspot.tools.ctw.logfile=ctw.log sun.hotspot.tools.ctw.CompileTheWorld classes.lst
+ * @run main ClassesListTest check ctw.log
+ * @summary testing of CompileTheWorld :: list of classes in file
+ * @author igor.ignatyev@oracle.com
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+public class ClassesListTest extends CtwTest {
+    private static final String[] SHOULD_CONTAIN
+            = {"# list: classes.lst", "Done (4 classes, "};
+
+    private ClassesListTest() {
+        super(SHOULD_CONTAIN);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new ClassesListTest().run(args);
+    }
+
+    protected void prepare() throws Exception {
+        String path = "classes.lst";
+        Files.copy(Paths.get(System.getProperty("test.src"), path),
+                Paths.get(path), StandardCopyOption.REPLACE_EXISTING);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary_tests/ctw/CtwTest.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+import java.util.List;
+import java.util.Collections;
+import java.util.ArrayList;
+
+import java.io.File;
+import java.io.Writer;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.BufferedReader;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.nio.charset.Charset;
+
+import com.oracle.java.testlibrary.JDKToolFinder;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+public abstract class CtwTest {
+    protected final String[] shouldContain;
+    protected CtwTest(String[] shouldContain) {
+        this.shouldContain = shouldContain;
+    }
+
+    public void run(String[] args) throws Exception {
+        if (args.length == 0) {
+            throw new Error("args is empty");
+        }
+        switch (args[0]) {
+            case "prepare":
+                prepare();
+                break;
+            case "check":
+                check(args);
+                break;
+            default:
+                throw new Error("unregonized action -- " + args[0]);
+        }
+    }
+
+    protected void prepare() throws Exception { }
+
+    protected void check(String[] args) throws Exception  {
+        if (args.length < 2) {
+            throw new Error("logfile isn't specified");
+        }
+        String logfile = args[1];
+        try (BufferedReader r = Files.newBufferedReader(Paths.get(logfile),
+                Charset.defaultCharset())) {
+            OutputAnalyzer output = readOutput(r);
+           for (String test : shouldContain) {
+                output.shouldContain(test);
+            }
+        }
+    }
+
+    private static OutputAnalyzer readOutput(BufferedReader reader)
+            throws IOException {
+        StringBuilder builder = new StringBuilder();
+        String eol = String.format("%n");
+        String line;
+
+        while ((line = reader.readLine()) != null) {
+            builder.append(line);
+            builder.append(eol);
+        }
+        return new OutputAnalyzer(builder.toString(), "");
+    }
+
+    protected void dump(OutputAnalyzer output, String name) {
+        try (Writer w = new FileWriter(name + ".out")) {
+            String s = output.getStdout();
+            w.write(s, s.length(), 0);
+        } catch (IOException io) {
+            io.printStackTrace();
+        }
+        try (Writer w = new FileWriter(name + ".err")) {
+            String s = output.getStderr();
+            w.write(s, s.length(), 0);
+        } catch (IOException io) {
+            io.printStackTrace();
+        }
+    }
+
+    protected ProcessBuilder createJarProcessBuilder(String... command)
+            throws Exception {
+        String javapath = JDKToolFinder.getJDKTool("jar");
+
+        ArrayList<String> args = new ArrayList<>();
+        args.add(javapath);
+        Collections.addAll(args, command);
+
+        return new ProcessBuilder(args.toArray(new String[args.size()]));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary_tests/ctw/Foo.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,5 @@
+public class Foo {
+  private static void staticMethod() { }
+  public void method() { }
+  protected Foo() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary_tests/ctw/JarDirTest.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8012447
+ * @library /testlibrary /testlibrary/whitebox /testlibrary/ctw/src
+ * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main JarDirTest prepare
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Dsun.hotspot.tools.ctw.logfile=ctw.log sun.hotspot.tools.ctw.CompileTheWorld jars/*
+ * @run main JarDirTest check ctw.log
+ * @summary testing of CompileTheWorld :: jars in directory
+ * @author igor.ignatyev@oracle.com
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+public class JarDirTest extends CtwTest {
+    private static final String[] SHOULD_CONTAIN
+            = {"# jar_in_dir: jars",
+                    "# jar: jars" + File.separator +"foo.jar",
+                    "# jar: jars" + File.separator +"bar.jar",
+                    "Done (4 classes, 12 methods, "};
+
+    private JarDirTest() {
+        super(SHOULD_CONTAIN);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new JarDirTest().run(args);
+    }
+
+    protected void prepare() throws Exception {
+        String path = "jars";
+        Files.createDirectory(Paths.get(path));
+
+        ProcessBuilder pb = createJarProcessBuilder("cf", "jars/foo.jar",
+                "Foo.class", "Bar.class");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        dump(output, "ctw-foo.jar");
+        output.shouldHaveExitValue(0);
+
+        pb = createJarProcessBuilder("cf", "jars/bar.jar", "Foo.class",
+                "Bar.class");
+        output = new OutputAnalyzer(pb.start());
+        dump(output, "ctw-bar.jar");
+        output.shouldHaveExitValue(0);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary_tests/ctw/JarsTest.java	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/*
+ * @test
+ * @bug 8012447
+ * @library /testlibrary /testlibrary/whitebox /testlibrary/ctw/src
+ * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main JarsTest prepare
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Dsun.hotspot.tools.ctw.logfile=ctw.log sun.hotspot.tools.ctw.CompileTheWorld foo.jar bar.jar
+ * @run main JarsTest check ctw.log
+ * @summary testing of CompileTheWorld :: jars
+ * @author igor.ignatyev@oracle.com
+ */
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+public class JarsTest extends CtwTest {
+    private static final String[] SHOULD_CONTAIN
+            = {"# jar: foo.jar", "# jar: bar.jar",
+                    "Done (4 classes, 12 methods, "};
+
+    private JarsTest() {
+        super(SHOULD_CONTAIN);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new JarsTest().run(args);
+    }
+
+    protected void prepare() throws Exception {
+        ProcessBuilder pb = createJarProcessBuilder("cf", "foo.jar",
+                "Foo.class", "Bar.class");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        dump(output, "ctw-foo.jar");
+        output.shouldHaveExitValue(0);
+
+        pb = createJarProcessBuilder("cf", "bar.jar", "Foo.class", "Bar.class");
+        output = new OutputAnalyzer(pb.start());
+        dump(output, "ctw-bar.jar");
+        output.shouldHaveExitValue(0);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary_tests/ctw/classes.lst	Thu Oct 09 12:17:17 2014 -0700
@@ -0,0 +1,4 @@
+java.lang.String
+java.lang.Object
+Foo
+Bar