Merge
authoramurillo
Thu, 23 Jun 2016 17:07:27 -0700
changeset 39296 9c69af52bb76
parent 39184 3aa52182b3ad (current diff)
parent 39295 e0a56038a15e (diff)
child 39297 71c7742b80e9
child 39412 1d5ad28744ca
Merge
hotspot/test/compiler/c2/6857159/Test6857159.sh
hotspot/test/compiler/c2/6894807/Test6894807.sh
hotspot/test/compiler/c2/7070134/Test7070134.sh
hotspot/test/runtime/Unsafe/GetKlassPointerGetJavaMirror.java
--- a/hotspot/make/lib/JvmOverrideFiles.gmk	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/make/lib/JvmOverrideFiles.gmk	Thu Jun 23 17:07:27 2016 -0700
@@ -153,6 +153,13 @@
   # mode, so don't optimize sharedRuntimeTrig.cpp at all.
   BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
 
+  ifneq ($(DEBUG_LEVEL),slowdebug)
+    # Compiling jvmtiEnterTrace.cpp with full optimization needs more than 30min
+    # (mostly because of '-qhot=level=1' and the more than 1300 'log_trace' calls
+    # which cause a lot of template expansion).
+    BUILD_LIBJVM_jvmtiEnterTrace.cpp_OPTIMIZATION := LOW
+  endif
+
   # Disable ELF decoder on AIX (AIX uses XCOFF).
   JVM_EXCLUDE_PATTERNS += elf
 
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad	Thu Jun 23 17:07:27 2016 -0700
@@ -12179,21 +12179,21 @@
   %}
 %}
 
-instruct rolI_rReg_Var_C_32(iRegLNoSp dst, iRegL src, iRegI shift, immI_32 c_32, rFlagsReg cr)
+instruct rolI_rReg_Var_C_32(iRegINoSp dst, iRegI src, iRegI shift, immI_32 c_32, rFlagsReg cr)
 %{
   match(Set dst (OrI (LShiftI src shift) (URShiftI src (SubI c_32 shift))));
 
   expand %{
-    rolL_rReg(dst, src, shift, cr);
-  %}
-%}
-
-instruct rolI_rReg_Var_C0(iRegLNoSp dst, iRegL src, iRegI shift, immI0 c0, rFlagsReg cr)
+    rolI_rReg(dst, src, shift, cr);
+  %}
+%}
+
+instruct rolI_rReg_Var_C0(iRegINoSp dst, iRegI src, iRegI shift, immI0 c0, rFlagsReg cr)
 %{
   match(Set dst (OrI (LShiftI src shift) (URShiftI src (SubI c0 shift))));
 
   expand %{
-    rolL_rReg(dst, src, shift, cr);
+    rolI_rReg(dst, src, shift, cr);
   %}
 %}
 
--- a/hotspot/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -944,8 +944,7 @@
         Register t = r5;
         __ load_klass(t, r0);
         __ ldrw(t, Address(t, Klass::access_flags_offset()));
-        __ tst(t, JVM_ACC_HAS_FINALIZER);
-        __ br(Assembler::NE, register_finalizer);
+        __ tbnz(t, exact_log2(JVM_ACC_HAS_FINALIZER), register_finalizer);
         __ ret(lr);
 
         __ bind(register_finalizer);
--- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -93,10 +93,8 @@
     // This method is only called just after the call into the vm in
     // call_VM_base, so the arg registers are available.
     ldrw(rscratch1, Address(rthread, JavaThread::popframe_condition_offset()));
-    tstw(rscratch1, JavaThread::popframe_pending_bit);
-    br(Assembler::EQ, L);
-    tstw(rscratch1, JavaThread::popframe_processing_bit);
-    br(Assembler::NE, L);
+    tbz(rscratch1, exact_log2(JavaThread::popframe_pending_bit), L);
+    tbnz(rscratch1, exact_log2(JavaThread::popframe_processing_bit), L);
     // Call Interpreter::remove_activation_preserving_args_entry() to get the
     // address of the same-named entrypoint in the generated interpreter code.
     call_VM_leaf(CAST_FROM_FN_PTR(address, Interpreter::remove_activation_preserving_args_entry));
@@ -505,8 +503,7 @@
  // get method access flags
   ldr(r1, Address(rfp, frame::interpreter_frame_method_offset * wordSize));
   ldr(r2, Address(r1, Method::access_flags_offset()));
-  tst(r2, JVM_ACC_SYNCHRONIZED);
-  br(Assembler::EQ, unlocked);
+  tbz(r2, exact_log2(JVM_ACC_SYNCHRONIZED), unlocked);
 
   // Don't unlock anything if the _do_not_unlock_if_synchronized flag
   // is set.
@@ -1582,8 +1579,8 @@
                            // do. The unknown bit may have been
                            // set already but no need to check.
 
-  tst(obj, TypeEntries::type_unknown);
-  br(Assembler::NE, next); // already unknown. Nothing to do anymore.
+  tbnz(obj, exact_log2(TypeEntries::type_unknown), next);
+  // already unknown. Nothing to do anymore.
 
   ldr(rscratch1, mdo_addr);
   cbz(rscratch1, none);
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -710,7 +710,7 @@
           __ BIND(L_loop);
           __ strb(zr, Address(start, count));
           __ subs(count, count, 1);
-          __ br(Assembler::HS, L_loop);
+          __ br(Assembler::GE, L_loop);
         }
         break;
       default:
@@ -1299,7 +1299,7 @@
       if (VerifyOops)
         verify_oop_array(size, d, count, r16);
       __ sub(count, count, 1); // make an inclusive end pointer
-      __ lea(count, Address(d, count, Address::uxtw(exact_log2(size))));
+      __ lea(count, Address(d, count, Address::lsl(exact_log2(size))));
       gen_write_ref_array_post_barrier(d, count, rscratch1);
     }
     __ leave();
@@ -2002,9 +2002,9 @@
     arraycopy_range_checks(src, src_pos, dst, dst_pos, scratch_length,
                            rscratch2, L_failed);
 
-    __ lea(from, Address(src, src_pos, Address::lsl(3)));
+    __ lea(from, Address(src, src_pos, Address::lsl(LogBytesPerHeapOop)));
     __ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
-    __ lea(to, Address(dst, dst_pos, Address::lsl(3)));
+    __ lea(to, Address(dst, dst_pos, Address::lsl(LogBytesPerHeapOop)));
     __ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
     __ movw(count, scratch_length); // length
   __ BIND(L_plain_copy);
@@ -2027,9 +2027,9 @@
       __ load_klass(rscratch2_dst_klass, dst); // reload
 
       // Marshal the base address arguments now, freeing registers.
-      __ lea(from, Address(src, src_pos, Address::lsl(3)));
+      __ lea(from, Address(src, src_pos, Address::lsl(LogBytesPerHeapOop)));
       __ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
-      __ lea(to, Address(dst, dst_pos, Address::lsl(3)));
+      __ lea(to, Address(dst, dst_pos, Address::lsl(LogBytesPerHeapOop)));
       __ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT));
       __ movw(count, length);           // length (reloaded)
       Register sco_temp = c_rarg3;      // this register is free now
--- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1242,8 +1242,7 @@
   {
     Label L;
     __ ldrw(t, Address(rmethod, Method::access_flags_offset()));
-    __ tst(t, JVM_ACC_STATIC);
-    __ br(Assembler::EQ, L);
+    __ tbz(t, exact_log2(JVM_ACC_STATIC), L);
     // get mirror
     __ load_mirror(t, rmethod);
     // copy mirror into activation frame
@@ -1435,8 +1434,7 @@
   {
     Label L;
     __ ldrw(t, Address(rmethod, Method::access_flags_offset()));
-    __ tst(t, JVM_ACC_SYNCHRONIZED);
-    __ br(Assembler::EQ, L);
+    __ tbz(t, exact_log2(JVM_ACC_SYNCHRONIZED), L);
     // the code below should be shared with interpreter macro
     // assembler implementation
     {
--- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -2190,9 +2190,8 @@
     __ ldr(c_rarg1, aaddress(0));
     __ load_klass(r3, c_rarg1);
     __ ldrw(r3, Address(r3, Klass::access_flags_offset()));
-    __ tst(r3, JVM_ACC_HAS_FINALIZER);
     Label skip_register_finalizer;
-    __ br(Assembler::EQ, skip_register_finalizer);
+    __ tbz(r3, exact_log2(JVM_ACC_HAS_FINALIZER), skip_register_finalizer);
 
     __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::register_finalizer), c_rarg1);
 
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -503,6 +503,10 @@
     LVSL_OPCODE    = (31u << OPCODE_SHIFT |    6u << 1),
     LVSR_OPCODE    = (31u << OPCODE_SHIFT |   38u << 1),
 
+    // Vector-Scalar (VSX) instruction support.
+    LXVD2X_OPCODE  = (31u << OPCODE_SHIFT |  844u << 1),
+    STXVD2X_OPCODE = (31u << OPCODE_SHIFT |  972u << 1),
+
     // Vector Permute and Formatting
     VPKPX_OPCODE   = (4u  << OPCODE_SHIFT |  782u     ),
     VPKSHSS_OPCODE = (4u  << OPCODE_SHIFT |  398u     ),
@@ -1085,6 +1089,19 @@
   static int vrs(   VectorRegister r)  { return  vrs(r->encoding());}
   static int vrt(   VectorRegister r)  { return  vrt(r->encoding());}
 
+  // Support Vector-Scalar (VSX) instructions.
+  static int vsra(      int         x)  { return  opp_u_field(x,            15, 11); }
+  static int vsrb(      int         x)  { return  opp_u_field(x,            20, 16); }
+  static int vsrc(      int         x)  { return  opp_u_field(x,            25, 21); }
+  static int vsrs(      int         x)  { return  opp_u_field(x,            10,  6); }
+  static int vsrt(      int         x)  { return  opp_u_field(x,            10,  6); }
+
+  static int vsra(   VectorSRegister r)  { return  vsra(r->encoding());}
+  static int vsrb(   VectorSRegister r)  { return  vsrb(r->encoding());}
+  static int vsrc(   VectorSRegister r)  { return  vsrc(r->encoding());}
+  static int vsrs(   VectorSRegister r)  { return  vsrs(r->encoding());}
+  static int vsrt(   VectorSRegister r)  { return  vsrt(r->encoding());}
+
   static int vsplt_uim( int        x)  { return  opp_u_field(x,             15, 12); } // for vsplt* instructions
   static int vsplti_sim(int        x)  { return  opp_u_field(x,             15, 11); } // for vsplti* instructions
   static int vsldoi_shb(int        x)  { return  opp_u_field(x,             25, 22); } // for vsldoi instruction
@@ -2069,6 +2086,10 @@
   inline void mtvscr(   VectorRegister b);
   inline void mfvscr(   VectorRegister d);
 
+  // Vector-Scalar (VSX) instructions.
+  inline void lxvd2x(   VectorSRegister d, Register a, Register b);
+  inline void stxvd2x(  VectorSRegister d, Register a, Register b);
+
   // AES (introduced with Power 8)
   inline void vcipher(     VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vcipherlast( VectorRegister d, VectorRegister a, VectorRegister b);
--- a/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -724,6 +724,10 @@
 inline void Assembler::lvsl(  VectorRegister d, Register s1, Register s2) { emit_int32( LVSL_OPCODE   | vrt(d) | ra0mem(s1) | rb(s2)); }
 inline void Assembler::lvsr(  VectorRegister d, Register s1, Register s2) { emit_int32( LVSR_OPCODE   | vrt(d) | ra0mem(s1) | rb(s2)); }
 
+// Vector-Scalar (VSX) instructions.
+inline void Assembler::lxvd2x (VectorSRegister d, Register s1, Register s2) { emit_int32( LXVD2X_OPCODE  | vsrt(d) | ra(s1) | rb(s2)); }
+inline void Assembler::stxvd2x(VectorSRegister d, Register s1, Register s2) { emit_int32( STXVD2X_OPCODE | vsrt(d) | ra(s1) | rb(s2)); }
+
 inline void Assembler::vpkpx(   VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VPKPX_OPCODE   | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vpkshss( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VPKSHSS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vpkswss( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VPKSWSS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
--- a/hotspot/src/cpu/ppc/vm/register_ppc.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/register_ppc.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -75,3 +75,14 @@
   };
   return is_valid() ? names[encoding()] : "vnoreg";
 }
+
+const char* VectorSRegisterImpl::name() const {
+  const char* names[number_of_registers] = {
+    "VSR0",  "VSR1",  "VSR2",  "VSR3",  "VSR4",  "VSR5",  "VSR6",  "VSR7",
+    "VSR8",  "VSR9",  "VSR10", "VSR11", "VSR12", "VSR13", "VSR14", "VSR15",
+    "VSR16", "VSR17", "VSR18", "VSR19", "VSR20", "VSR21", "VSR22", "VSR23",
+    "VSR24", "VSR25", "VSR26", "VSR27", "VSR28", "VSR29", "VSR30", "VSR31"
+  };
+  return is_valid() ? names[encoding()] : "vsnoreg";
+}
+
--- a/hotspot/src/cpu/ppc/vm/register_ppc.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/register_ppc.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -491,6 +491,106 @@
 #endif // DONT_USE_REGISTER_DEFINES
 
 
+// Use VectorSRegister as a shortcut.
+class VectorSRegisterImpl;
+typedef VectorSRegisterImpl* VectorSRegister;
+
+inline VectorSRegister as_VectorSRegister(int encoding) {
+  return (VectorSRegister)(intptr_t)encoding;
+}
+
+// The implementation of Vector-Scalar (VSX) registers on POWER architecture.
+class VectorSRegisterImpl: public AbstractRegisterImpl {
+ public:
+  enum {
+    number_of_registers = 32
+  };
+
+  // construction
+  inline friend VectorSRegister as_VectorSRegister(int encoding);
+
+  // accessors
+  int encoding() const { assert(is_valid(), "invalid register"); return value(); }
+
+  // testers
+  bool is_valid() const { return 0 <=  value() &&  value() < number_of_registers; }
+
+  const char* name() const;
+};
+
+// The Vector-Scalar (VSX) registers of the POWER architecture.
+
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, vsnoreg, (-1));
+
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR0,  ( 0));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR1,  ( 1));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR2,  ( 2));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR3,  ( 3));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR4,  ( 4));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR5,  ( 5));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR6,  ( 6));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR7,  ( 7));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR8,  ( 8));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR9,  ( 9));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR10, (10));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR11, (11));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR12, (12));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR13, (13));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR14, (14));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR15, (15));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR16, (16));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR17, (17));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR18, (18));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR19, (19));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR20, (20));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR21, (21));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR22, (22));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR23, (23));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR24, (24));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR25, (25));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR26, (26));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR27, (27));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR28, (28));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR29, (29));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR30, (30));
+CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR31, (31));
+
+#ifndef DONT_USE_REGISTER_DEFINES
+#define vsnoregi ((VectorSRegister)(vsnoreg_VectorSRegisterEnumValue))
+#define VSR0    ((VectorSRegister)(   VSR0_VectorSRegisterEnumValue))
+#define VSR1    ((VectorSRegister)(   VSR1_VectorSRegisterEnumValue))
+#define VSR2    ((VectorSRegister)(   VSR2_VectorSRegisterEnumValue))
+#define VSR3    ((VectorSRegister)(   VSR3_VectorSRegisterEnumValue))
+#define VSR4    ((VectorSRegister)(   VSR4_VectorSRegisterEnumValue))
+#define VSR5    ((VectorSRegister)(   VSR5_VectorSRegisterEnumValue))
+#define VSR6    ((VectorSRegister)(   VSR6_VectorSRegisterEnumValue))
+#define VSR7    ((VectorSRegister)(   VSR7_VectorSRegisterEnumValue))
+#define VSR8    ((VectorSRegister)(   VSR8_VectorSRegisterEnumValue))
+#define VSR9    ((VectorSRegister)(   VSR9_VectorSRegisterEnumValue))
+#define VSR10   ((VectorSRegister)(  VSR10_VectorSRegisterEnumValue))
+#define VSR11   ((VectorSRegister)(  VSR11_VectorSRegisterEnumValue))
+#define VSR12   ((VectorSRegister)(  VSR12_VectorSRegisterEnumValue))
+#define VSR13   ((VectorSRegister)(  VSR13_VectorSRegisterEnumValue))
+#define VSR14   ((VectorSRegister)(  VSR14_VectorSRegisterEnumValue))
+#define VSR15   ((VectorSRegister)(  VSR15_VectorSRegisterEnumValue))
+#define VSR16   ((VectorSRegister)(  VSR16_VectorSRegisterEnumValue))
+#define VSR17   ((VectorSRegister)(  VSR17_VectorSRegisterEnumValue))
+#define VSR18   ((VectorSRegister)(  VSR18_VectorSRegisterEnumValue))
+#define VSR19   ((VectorSRegister)(  VSR19_VectorSRegisterEnumValue))
+#define VSR20   ((VectorSRegister)(  VSR20_VectorSRegisterEnumValue))
+#define VSR21   ((VectorSRegister)(  VSR21_VectorSRegisterEnumValue))
+#define VSR22   ((VectorSRegister)(  VSR22_VectorSRegisterEnumValue))
+#define VSR23   ((VectorSRegister)(  VSR23_VectorSRegisterEnumValue))
+#define VSR24   ((VectorSRegister)(  VSR24_VectorSRegisterEnumValue))
+#define VSR25   ((VectorSRegister)(  VSR25_VectorSRegisterEnumValue))
+#define VSR26   ((VectorSRegister)(  VSR26_VectorSRegisterEnumValue))
+#define VSR27   ((VectorSRegister)(  VSR27_VectorSRegisterEnumValue))
+#define VSR28   ((VectorSRegister)(  VSR28_VectorSRegisterEnumValue))
+#define VSR29   ((VectorSRegister)(  VSR29_VectorSRegisterEnumValue))
+#define VSR30   ((VectorSRegister)(  VSR30_VectorSRegisterEnumValue))
+#define VSR31   ((VectorSRegister)(  VSR31_VectorSRegisterEnumValue))
+#endif // DONT_USE_REGISTER_DEFINES
+
 // Maximum number of incoming arguments that can be passed in i registers.
 const int PPC_ARGS_IN_REGS_NUM = 8;
 
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1341,10 +1341,13 @@
     Register tmp3 = R8_ARG6;
     Register tmp4 = R9_ARG7;
 
+    VectorSRegister tmp_vsr1  = VSR1;
+    VectorSRegister tmp_vsr2  = VSR2;
+
     address start = __ function_entry();
     assert_positive_int(R5_ARG3);
 
-      Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8;
+    Label l_1, l_2, l_3, l_4, l_5, l_6, l_7, l_8, l_9;
 
     // don't try anything fancy if arrays don't have many elements
     __ li(tmp3, 0);
@@ -1403,22 +1406,60 @@
       __ andi_(R5_ARG3, R5_ARG3, 15);
       __ mtctr(tmp1);
 
-      __ bind(l_8);
-      // Use unrolled version for mass copying (copy 16 elements a time).
-      // Load feeding store gets zero latency on Power6, however not on Power5.
-      // Therefore, the following sequence is made for the good of both.
-      __ ld(tmp1, 0, R3_ARG1);
-      __ ld(tmp2, 8, R3_ARG1);
-      __ ld(tmp3, 16, R3_ARG1);
-      __ ld(tmp4, 24, R3_ARG1);
-      __ std(tmp1, 0, R4_ARG2);
-      __ std(tmp2, 8, R4_ARG2);
-      __ std(tmp3, 16, R4_ARG2);
-      __ std(tmp4, 24, R4_ARG2);
-      __ addi(R3_ARG1, R3_ARG1, 32);
-      __ addi(R4_ARG2, R4_ARG2, 32);
-      __ bdnz(l_8);
-    }
+      if (!VM_Version::has_vsx()) {
+
+        __ bind(l_8);
+        // Use unrolled version for mass copying (copy 16 elements a time).
+        // Load feeding store gets zero latency on Power6, however not on Power5.
+        // Therefore, the following sequence is made for the good of both.
+        __ ld(tmp1, 0, R3_ARG1);
+        __ ld(tmp2, 8, R3_ARG1);
+        __ ld(tmp3, 16, R3_ARG1);
+        __ ld(tmp4, 24, R3_ARG1);
+        __ std(tmp1, 0, R4_ARG2);
+        __ std(tmp2, 8, R4_ARG2);
+        __ std(tmp3, 16, R4_ARG2);
+        __ std(tmp4, 24, R4_ARG2);
+        __ addi(R3_ARG1, R3_ARG1, 32);
+        __ addi(R4_ARG2, R4_ARG2, 32);
+        __ bdnz(l_8);
+
+      } else { // Processor supports VSX, so use it to mass copy.
+
+        // Prefetch src data into L2 cache.
+        __ dcbt(R3_ARG1, 0);
+
+        // If supported set DSCR pre-fetch to deepest.
+        if (VM_Version::has_mfdscr()) {
+          __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
+          __ mtdscr(tmp2);
+        }
+        __ li(tmp1, 16);
+
+        // Backbranch target aligned to 32-byte. It's not aligned 16-byte
+        // as loop contains < 8 instructions that fit inside a single
+        // i-cache sector.
+        __ align(32);
+
+        __ bind(l_9);
+        // Use loop with VSX load/store instructions to
+        // copy 16 elements a time.
+        __ lxvd2x(tmp_vsr1, 0, R3_ARG1);     // Load from src.
+        __ stxvd2x(tmp_vsr1, 0, R4_ARG2);    // Store to dst.
+        __ lxvd2x(tmp_vsr2, R3_ARG1, tmp1);  // Load from src + 16.
+        __ stxvd2x(tmp_vsr2, R4_ARG2, tmp1); // Store to dst + 16.
+        __ addi(R3_ARG1, R3_ARG1, 32);       // Update src+=32.
+        __ addi(R4_ARG2, R4_ARG2, 32);       // Update dsc+=32.
+        __ bdnz(l_9);                        // Dec CTR and loop if not zero.
+
+        // Restore DSCR pre-fetch value.
+        if (VM_Version::has_mfdscr()) {
+          __ load_const_optimized(tmp2, VM_Version::_dscr_val);
+          __ mtdscr(tmp2);
+        }
+
+      }
+    } // FasterArrayCopy
     __ bind(l_6);
 
     // copy 2 elements at a time
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -38,7 +38,7 @@
 # include <sys/sysinfo.h>
 
 bool VM_Version::_is_determine_features_test_running = false;
-
+uint64_t VM_Version::_dscr_val = 0;
 
 #define MSG(flag)   \
   if (flag && !FLAG_IS_DEFAULT(flag))                                  \
@@ -111,7 +111,7 @@
   // Create and print feature-string.
   char buf[(num_features+1) * 16]; // Max 16 chars per feature.
   jio_snprintf(buf, sizeof(buf),
-               "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s",
+               "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
                (has_fsqrt()   ? " fsqrt"   : ""),
                (has_isel()    ? " isel"    : ""),
                (has_lxarxeh() ? " lxarxeh" : ""),
@@ -125,7 +125,8 @@
                (has_vcipher() ? " aes"     : ""),
                (has_vpmsumb() ? " vpmsumb" : ""),
                (has_tcheck()  ? " tcheck"  : ""),
-               (has_mfdscr()  ? " mfdscr"  : "")
+               (has_mfdscr()  ? " mfdscr"  : ""),
+               (has_vsx()     ? " vsx"     : "")
                // Make sure number of %s matches num_features!
               );
   _features_string = os::strdup(buf);
@@ -643,6 +644,7 @@
   a->vpmsumb(VR0, VR1, VR2);                   // code[11] -> vpmsumb
   a->tcheck(0);                                // code[12] -> tcheck
   a->mfdscr(R0);                               // code[13] -> mfdscr
+  a->lxvd2x(VSR0, 0, R3_ARG1);                 // code[14] -> vsx
   a->blr();
 
   // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it.
@@ -691,6 +693,7 @@
   if (code[feature_cntr++]) features |= vpmsumb_m;
   if (code[feature_cntr++]) features |= tcheck_m;
   if (code[feature_cntr++]) features |= mfdscr_m;
+  if (code[feature_cntr++]) features |= vsx_m;
 
   // Print the detection code.
   if (PrintAssembly) {
@@ -733,31 +736,31 @@
   }
 
   // Apply the configuration if needed.
-  uint64_t dscr_val = (*get_dscr)();
+  _dscr_val = (*get_dscr)();
   if (Verbose) {
-    tty->print_cr("dscr value was 0x%lx" , dscr_val);
+    tty->print_cr("dscr value was 0x%lx" , _dscr_val);
   }
   bool change_requested = false;
   if (DSCR_PPC64 != (uintx)-1) {
-    dscr_val = DSCR_PPC64;
+    _dscr_val = DSCR_PPC64;
     change_requested = true;
   }
   if (DSCR_DPFD_PPC64 <= 7) {
     uint64_t mask = 0x7;
-    if ((dscr_val & mask) != DSCR_DPFD_PPC64) {
-      dscr_val = (dscr_val & ~mask) | (DSCR_DPFD_PPC64);
+    if ((_dscr_val & mask) != DSCR_DPFD_PPC64) {
+      _dscr_val = (_dscr_val & ~mask) | (DSCR_DPFD_PPC64);
       change_requested = true;
     }
   }
   if (DSCR_URG_PPC64 <= 7) {
     uint64_t mask = 0x7 << 6;
-    if ((dscr_val & mask) != DSCR_DPFD_PPC64 << 6) {
-      dscr_val = (dscr_val & ~mask) | (DSCR_URG_PPC64 << 6);
+    if ((_dscr_val & mask) != DSCR_DPFD_PPC64 << 6) {
+      _dscr_val = (_dscr_val & ~mask) | (DSCR_URG_PPC64 << 6);
       change_requested = true;
     }
   }
   if (change_requested) {
-    (*set_dscr)(dscr_val);
+    (*set_dscr)(_dscr_val);
     if (Verbose) {
       tty->print_cr("dscr was set to 0x%lx" , (*get_dscr)());
     }
--- a/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/ppc/vm/vm_version_ppc.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -46,6 +46,7 @@
     vpmsumb,
     tcheck,
     mfdscr,
+    vsx,
     num_features // last entry to count features
   };
   enum Feature_Flag_Set {
@@ -64,6 +65,7 @@
     vpmsumb_m             = (1 << vpmsumb),
     tcheck_m              = (1 << tcheck ),
     mfdscr_m              = (1 << mfdscr ),
+    vsx_m                 = (1 << vsx    ),
     all_features_m        = (unsigned long)-1
   };
 
@@ -97,10 +99,14 @@
   static bool has_vpmsumb() { return (_features & vpmsumb_m) != 0; }
   static bool has_tcheck()  { return (_features & tcheck_m) != 0; }
   static bool has_mfdscr()  { return (_features & mfdscr_m) != 0; }
+  static bool has_vsx()     { return (_features & vsx_m) != 0; }
 
   // Assembler testing
   static void allow_all();
   static void revert();
+
+  // POWER 8: DSCR current value.
+  static uint64_t _dscr_val;
 };
 
 #endif // CPU_PPC_VM_VM_VERSION_PPC_HPP
--- a/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/c1_LinearScan_x86.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -68,7 +68,6 @@
       if (b->number_of_preds() > 1) {
         int id = b->first_lir_instruction_id();
         ResourceBitMap regs(FrameMap::nof_fpu_regs);
-        regs.clear();
 
         iw.walk_to(id);   // walk after the first instruction (always a label) of the block
         assert(iw.current_position() == id, "did not walk completely to id");
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -7046,7 +7046,6 @@
                                       int ae) {
   ShortBranchVerifier sbv(this);
   assert(UseSSE42Intrinsics, "SSE4.2 intrinsics are required");
-  assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
   assert(ae != StrIntrinsicNode::LU, "Invalid encoding");
 
   // This method uses the pcmpestri instruction with bound registers
@@ -7225,7 +7224,6 @@
                                     int ae) {
   ShortBranchVerifier sbv(this);
   assert(UseSSE42Intrinsics, "SSE4.2 intrinsics are required");
-  assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
   assert(ae != StrIntrinsicNode::LU, "Invalid encoding");
 
   //
@@ -7543,7 +7541,6 @@
                                          XMMRegister vec1, XMMRegister vec2, XMMRegister vec3, Register tmp) {
   ShortBranchVerifier sbv(this);
   assert(UseSSE42Intrinsics, "SSE4.2 intrinsics are required");
-  assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
 
   int stride = 8;
 
@@ -7723,7 +7720,6 @@
   }
 
   if (UseAVX >= 2 && UseSSE42Intrinsics) {
-    assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
     Label COMPARE_WIDE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_WIDE_TAIL, COMPARE_SMALL_STR;
     Label COMPARE_WIDE_VECTORS_LOOP, COMPARE_16_CHARS, COMPARE_INDEX_CHAR;
     Label COMPARE_WIDE_VECTORS_LOOP_AVX2;
@@ -7891,7 +7887,6 @@
 
     bind(COMPARE_SMALL_STR);
   } else if (UseSSE42Intrinsics) {
-    assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
     Label COMPARE_WIDE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_TAIL;
     int pcmpmask = 0x19;
     // Setup to compare 8-char (16-byte) vectors,
@@ -8179,7 +8174,6 @@
       // Fallthru to tail compare
     }
     else if (UseSSE42Intrinsics) {
-      assert(UseSSE >= 4, "SSE4 must be  for SSE4.2 intrinsics to be available");
       // With SSE4.2, use double quad vector compare
       Label COMPARE_WIDE_VECTORS, COMPARE_TAIL;
 
@@ -8383,7 +8377,6 @@
     movl(limit, result);
     // Fallthru to tail compare
   } else if (UseSSE42Intrinsics) {
-    assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
     // With SSE4.2, use double quad vector compare
     Label COMPARE_WIDE_VECTORS, COMPARE_TAIL;
 
@@ -8747,7 +8740,6 @@
   negptr(len);
 
   if (UseSSE42Intrinsics || UseAVX >= 2) {
-    assert(UseSSE42Intrinsics ? UseSSE >= 4 : true, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
     Label L_chars_8_check, L_copy_8_chars, L_copy_8_chars_exit;
     Label L_chars_16_check, L_copy_16_chars, L_copy_16_chars_exit;
 
@@ -10159,7 +10151,13 @@
   movdqa(xmm1, Address(buf, 0));
   movdl(rax, xmm1);
   xorl(crc, rax);
-  pinsrd(xmm1, crc, 0);
+  if (VM_Version::supports_sse4_1()) {
+    pinsrd(xmm1, crc, 0);
+  } else {
+    pinsrw(xmm1, crc, 0);
+    shrl(crc, 16);
+    pinsrw(xmm1, crc, 1);
+  }
   addptr(buf, 16);
   subl(len, 4); // len > 0
   jcc(Assembler::less, L_fold_tail);
@@ -10881,7 +10879,6 @@
     clear_vector_masking();   // closing of the stub context for programming mask registers
   }
   if (UseSSE42Intrinsics) {
-    assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
     Label copy_32_loop, copy_16, copy_tail;
 
     bind(below_threshold);
@@ -11045,7 +11042,6 @@
     clear_vector_masking();   // closing of the stub context for programming mask registers
   }
   if (UseSSE42Intrinsics) {
-    assert(UseSSE >= 4, "SSE4 must be enabled for SSE4.2 intrinsics to be available");
     Label copy_16_loop, copy_8_loop, copy_bytes, copy_new_tail, copy_tail;
 
     movl(tmp2, len);
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -658,7 +658,7 @@
           FLAG_SET_DEFAULT(UseAESCTRIntrinsics, false);
         }
       } else {
-        if(supports_sse4_1() && UseSSE >= 4) {
+        if(supports_sse4_1()) {
           if (FLAG_IS_DEFAULT(UseAESCTRIntrinsics)) {
             FLAG_SET_DEFAULT(UseAESCTRIntrinsics, true);
           }
@@ -970,7 +970,7 @@
         UseXmmI2D = false;
       }
     }
-    if (supports_sse4_2() && UseSSE >= 4) {
+    if (supports_sse4_2()) {
       if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) {
         FLAG_SET_DEFAULT(UseSSE42Intrinsics, true);
       }
@@ -1050,7 +1050,7 @@
           UseUnalignedLoadStores = true; // use movdqu on newest Intel cpus
         }
       }
-      if (supports_sse4_2() && UseSSE >= 4) {
+      if (supports_sse4_2()) {
         if (FLAG_IS_DEFAULT(UseSSE42Intrinsics)) {
           FLAG_SET_DEFAULT(UseSSE42Intrinsics, true);
         }
--- a/hotspot/src/cpu/x86/vm/x86.ad	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/cpu/x86/vm/x86.ad	Thu Jun 23 17:07:27 2016 -0700
@@ -1718,7 +1718,7 @@
         ret_value = false;
       break;
     case Op_StrIndexOfChar:
-      if (!(UseSSE > 4))
+      if (!UseSSE42Intrinsics)
         ret_value = false;
       break;
     case Op_OnSpinWait:
--- a/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/Universe.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/Universe.java	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,6 +96,8 @@
     narrowOopShiftField = type.getCIntegerField("_narrow_oop._shift");
     narrowKlassBaseField = type.getAddressField("_narrow_klass._base");
     narrowKlassShiftField = type.getCIntegerField("_narrow_klass._shift");
+
+    UniverseExt.initialize(heapConstructor);
   }
 
   public Universe() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/UniverseExt.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+package sun.jvm.hotspot.memory;
+
+import sun.jvm.hotspot.runtime.*;
+
+public class UniverseExt {
+    public static void initialize(VirtualConstructor heapConstructor) { }
+}
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Thu Jun 23 17:07:27 2016 -0700
@@ -31,10 +31,13 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.ServiceLoader;
 import java.util.TreeMap;
 
 import jdk.internal.misc.VM;
@@ -213,7 +216,22 @@
 
     private final Map<Class<? extends Architecture>, JVMCIBackend> backends = new HashMap<>();
 
-    private final Iterable<HotSpotVMEventListener> vmEventListeners;
+    private volatile List<HotSpotVMEventListener> vmEventListeners;
+
+    private Iterable<HotSpotVMEventListener> getVmEventListeners() {
+        if (vmEventListeners == null) {
+            synchronized (this) {
+                if (vmEventListeners == null) {
+                    List<HotSpotVMEventListener> listeners = new ArrayList<>();
+                    for (HotSpotVMEventListener vmEventListener : ServiceLoader.load(HotSpotVMEventListener.class)) {
+                        listeners.add(vmEventListener);
+                    }
+                    vmEventListeners = listeners;
+                }
+            }
+        }
+        return vmEventListeners;
+    }
 
     /**
      * Stores the result of {@link HotSpotJVMCICompilerFactory#getTrivialPrefixes()} so that it can
@@ -240,8 +258,6 @@
             hostBackend = registerBackend(factory.createJVMCIBackend(this, null));
         }
 
-        vmEventListeners = Services.load(HotSpotVMEventListener.class);
-
         metaAccessContext = new HotSpotJVMCIMetaAccessContext();
 
         boolean printFlags = Option.PrintFlags.getBoolean();
@@ -370,7 +386,7 @@
      */
     @SuppressWarnings({"unused"})
     private void shutdown() throws Exception {
-        for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
+        for (HotSpotVMEventListener vmEventListener : getVmEventListeners()) {
             vmEventListener.notifyShutdown();
         }
     }
@@ -382,7 +398,7 @@
      */
     @SuppressWarnings({"unused"})
     private void bootstrapFinished() throws Exception {
-        for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
+        for (HotSpotVMEventListener vmEventListener : getVmEventListeners()) {
             vmEventListener.notifyBootstrapFinished();
         }
     }
@@ -395,7 +411,7 @@
      * @param compiledCode
      */
     void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) {
-        for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
+        for (HotSpotVMEventListener vmEventListener : getVmEventListeners()) {
             vmEventListener.notifyInstall(hotSpotCodeCacheProvider, installedCode, compiledCode);
         }
     }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Thu Jun 23 17:07:27 2016 -0700
@@ -144,8 +144,18 @@
         return ret;
     }
 
-    @Override
-    public JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) {
+    /**
+     * Reads a value of this kind using a base address and a displacement. No bounds checking or
+     * type checking is performed. Returns {@code null} if the value is not available at this point.
+     *
+     * @param baseConstant the base address from which the value is read.
+     * @param displacement the displacement within the object in bytes
+     * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the
+     *         value cannot be read.
+     * @throws IllegalArgumentException if {@code kind} is {@code null}, {@link JavaKind#Void}, not
+     *             {@link JavaKind#Object} or not {@linkplain JavaKind#isPrimitive() primitive} kind
+     */
+    JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant baseConstant, long displacement) {
         if (kind == null) {
             throw new IllegalArgumentException("null JavaKind");
         }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java	Thu Jun 23 17:07:27 2016 -0700
@@ -28,19 +28,6 @@
 public interface MemoryAccessProvider {
 
     /**
-     * Reads a value of this kind using a base address and a displacement. No bounds checking or
-     * type checking is performed. Returns {@code null} if the value is not available at this point.
-     *
-     * @param base the base address from which the value is read.
-     * @param displacement the displacement within the object in bytes
-     * @return the read value encapsulated in a {@link JavaConstant} object, or {@code null} if the
-     *         value cannot be read.
-     * @throws IllegalArgumentException if {@code kind} is {@code null}, {@link JavaKind#Void}, not
-     *             {@link JavaKind#Object} or not {@linkplain JavaKind#isPrimitive() primitive} kind
-     */
-    JavaConstant readUnsafeConstant(JavaKind kind, JavaConstant base, long displacement) throws IllegalArgumentException;
-
-    /**
      * Reads a primitive value using a base address and a displacement.
      *
      * @param kind the {@link JavaKind} of the returned {@link JavaConstant} object
--- a/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -264,7 +264,7 @@
   assert(array == NULL || FoldStableValues, "not enabled");
 
   // Constant fold loads from stable arrays.
-  if (array != NULL && index != NULL) {
+  if (!x->mismatched() && array != NULL && index != NULL) {
     jint idx = index->value();
     if (idx < 0 || idx >= array->value()->length()) {
       // Leave the load as is. The range check will handle it.
@@ -310,8 +310,6 @@
       return;
     }
   }
-
-
 }
 
 
--- a/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -4227,11 +4227,11 @@
   Value index = args->at(1);
   if (is_store) {
     Value value = args->at(2);
-    Instruction* store = append(new StoreIndexed(array, index, NULL, T_CHAR, value, state_before, false));
+    Instruction* store = append(new StoreIndexed(array, index, NULL, T_CHAR, value, state_before, false, true));
     store->set_flag(Instruction::NeedsRangeCheckFlag, false);
     _memory->store_value(value);
   } else {
-    Instruction* load = append(new LoadIndexed(array, index, NULL, T_CHAR, state_before));
+    Instruction* load = append(new LoadIndexed(array, index, NULL, T_CHAR, state_before, true));
     load->set_flag(Instruction::NeedsRangeCheckFlag, false);
     push(load->type(), load);
   }
--- a/hotspot/src/share/vm/c1/c1_IR.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_IR.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -147,10 +147,8 @@
   _wrote_volatile     = false;
   _start              = NULL;
 
-  if (osr_bci == -1) {
-    _requires_phi_function.clear();
-  } else {
-        // selective creation of phi functions is not possibel in osr-methods
+  if (osr_bci != -1) {
+    // selective creation of phi functions is not possibel in osr-methods
     _requires_phi_function.set_range(0, method->max_locals());
   }
 
@@ -540,7 +538,6 @@
 {
   TRACE_LINEAR_SCAN(2, tty->print_cr("***** computing linear-scan block order"));
 
-  init_visited();
   count_edges(start_block, NULL);
 
   if (compilation()->is_profiling()) {
@@ -646,7 +643,6 @@
   TRACE_LINEAR_SCAN(3, tty->print_cr("----- marking loops"));
 
   _loop_map = BitMap2D(_num_loops, _max_block_id);
-  _loop_map.clear();
 
   for (int i = _loop_end_blocks.length() - 1; i >= 0; i--) {
     BlockBegin* loop_end   = _loop_end_blocks.at(i);
--- a/hotspot/src/share/vm/c1/c1_Instruction.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_Instruction.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -912,14 +912,16 @@
   Value     _index;
   Value     _length;
   BasicType _elt_type;
+  bool      _mismatched;
 
  public:
   // creation
-  AccessIndexed(Value array, Value index, Value length, BasicType elt_type, ValueStack* state_before)
+  AccessIndexed(Value array, Value index, Value length, BasicType elt_type, ValueStack* state_before, bool mismatched)
   : AccessArray(as_ValueType(elt_type), array, state_before)
   , _index(index)
   , _length(length)
   , _elt_type(elt_type)
+  , _mismatched(mismatched)
   {
     set_flag(Instruction::NeedsRangeCheckFlag, true);
     ASSERT_VALUES
@@ -929,6 +931,7 @@
   Value index() const                            { return _index; }
   Value length() const                           { return _length; }
   BasicType elt_type() const                     { return _elt_type; }
+  bool mismatched() const                        { return _mismatched; }
 
   void clear_length()                            { _length = NULL; }
   // perform elimination of range checks involving constants
@@ -945,8 +948,8 @@
 
  public:
   // creation
-  LoadIndexed(Value array, Value index, Value length, BasicType elt_type, ValueStack* state_before)
-  : AccessIndexed(array, index, length, elt_type, state_before)
+  LoadIndexed(Value array, Value index, Value length, BasicType elt_type, ValueStack* state_before, bool mismatched = false)
+  : AccessIndexed(array, index, length, elt_type, state_before, mismatched)
   , _explicit_null_check(NULL) {}
 
   // accessors
@@ -974,8 +977,9 @@
 
  public:
   // creation
-  StoreIndexed(Value array, Value index, Value length, BasicType elt_type, Value value, ValueStack* state_before, bool check_boolean)
-  : AccessIndexed(array, index, length, elt_type, state_before)
+  StoreIndexed(Value array, Value index, Value length, BasicType elt_type, Value value, ValueStack* state_before,
+               bool check_boolean, bool mismatched = false)
+  : AccessIndexed(array, index, length, elt_type, state_before, mismatched)
   , _value(value), _profiled_method(NULL), _profiled_bci(0), _check_boolean(check_boolean)
   {
     set_flag(NeedsWriteBarrierFlag, (as_ValueType(elt_type)->is_object()));
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1387,7 +1387,6 @@
 void LIRGenerator::set_vreg_flag(int vreg_num, VregFlag f) {
   if (_vreg_flags.size_in_bits() == 0) {
     BitMap2D temp(100, num_vreg_flags);
-    temp.clear();
     _vreg_flags = temp;
   }
   _vreg_flags.at_put_grow(vreg_num, f, true);
--- a/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_LinearScan.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -562,14 +562,13 @@
   LIR_OpVisitState visitor;
 
   BitMap2D local_interval_in_loop = BitMap2D(_num_virtual_regs, num_loops());
-  local_interval_in_loop.clear();
 
   // iterate all blocks
   for (int i = 0; i < num_blocks; i++) {
     BlockBegin* block = block_at(i);
 
-    ResourceBitMap live_gen(live_size);  live_gen.clear();
-    ResourceBitMap live_kill(live_size); live_kill.clear();
+    ResourceBitMap live_gen(live_size);
+    ResourceBitMap live_kill(live_size);
 
     if (block->is_set(BlockBegin::exception_entry_flag)) {
       // Phi functions at the begin of an exception handler are
@@ -715,8 +714,8 @@
 
     block->set_live_gen (live_gen);
     block->set_live_kill(live_kill);
-    block->set_live_in  (ResourceBitMap(live_size)); block->live_in().clear();
-    block->set_live_out (ResourceBitMap(live_size)); block->live_out().clear();
+    block->set_live_in  (ResourceBitMap(live_size));
+    block->set_live_out (ResourceBitMap(live_size));
 
     TRACE_LINEAR_SCAN(4, tty->print("live_gen  B%d ", block->block_id()); print_bitmap(block->live_gen()));
     TRACE_LINEAR_SCAN(4, tty->print("live_kill B%d ", block->block_id()); print_bitmap(block->live_kill()));
@@ -741,7 +740,7 @@
   bool change_occurred;
   bool change_occurred_in_block;
   int  iteration_count = 0;
-  ResourceBitMap live_out(live_set_size()); live_out.clear(); // scratch set for calculations
+  ResourceBitMap live_out(live_set_size()); // scratch set for calculations
 
   // Perform a backward dataflow analysis to compute live_out and live_in for each block.
   // The loop is executed until a fixpoint is reached (no changes in an iteration)
@@ -827,7 +826,6 @@
 
   // check that the live_in set of the first block is empty
   ResourceBitMap live_in_args(ir()->start()->live_in().size());
-  live_in_args.clear();
   if (!ir()->start()->live_in().is_same(live_in_args)) {
 #ifdef ASSERT
     tty->print_cr("Error: live_in set of first block must be empty (when this fails, virtual registers are used before they are defined)");
@@ -1774,8 +1772,8 @@
 
   int num_blocks = block_count();
   MoveResolver move_resolver(this);
-  ResourceBitMap block_completed(num_blocks);  block_completed.clear();
-  ResourceBitMap already_resolved(num_blocks); already_resolved.clear();
+  ResourceBitMap block_completed(num_blocks);
+  ResourceBitMap already_resolved(num_blocks);
 
   int i;
   for (i = 0; i < num_blocks; i++) {
@@ -3750,7 +3748,6 @@
 
 
   ResourceBitMap used_regs(LinearScan::nof_regs + allocator()->frame_map()->argcount() + allocator()->max_spills());
-  used_regs.clear();
   if (!_multiple_reads_allowed) {
     for (i = 0; i < _mapping_from.length(); i++) {
       Interval* it = _mapping_from.at(i);
@@ -6319,7 +6316,6 @@
 void ControlFlowOptimizer::delete_jumps_to_return(BlockList* code) {
 #ifdef ASSERT
   ResourceBitMap return_converted(BlockBegin::number_of_blocks());
-  return_converted.clear();
 #endif
 
   for (int i = code->length() - 1; i >= 0; i--) {
--- a/hotspot/src/share/vm/c1/c1_ValueSet.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/c1/c1_ValueSet.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -53,7 +53,6 @@
 };
 
 inline ValueSet::ValueSet() : _map(Instruction::number_of_instructions()) {
-  _map.clear();
 }
 
 
--- a/hotspot/src/share/vm/ci/ciMethod.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -449,7 +449,6 @@
   OopMapCache::compute_one_oop_map(get_Method(), bci, &mask);
   int mask_size = max_locals();
   ResourceBitMap result(mask_size);
-  result.clear();
   int i;
   for (i = 0; i < mask_size ; i++ ) {
     if (mask.is_oop(i)) result.set_bit(i);
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -4673,6 +4673,7 @@
 }
 
 // Unqualified names may not contain the characters '.', ';', '[', or '/'.
+// In class names, '/' separates unqualified names.  This is verified in this function also.
 // Method names also may not contain the characters '<' or '>', unless <init>
 // or <clinit>.  Note that method names may not be <init> or <clinit> in this
 // method.  Because these names have been checked as special cases before
@@ -4698,8 +4699,16 @@
       if (ch == ';' || ch == '[' ) {
         return false;   // do not permit '.', ';', or '['
       }
-      if (type != ClassFileParser::LegalClass && ch == '/') {
-        return false;   // do not permit '/' unless it's class name
+      if (ch == '/') {
+        // check for '//' or leading or trailing '/' which are not legal
+        // unqualified name must not be empty
+        if (type == ClassFileParser::LegalClass) {
+          if (p == name || p+1 >= name+length || *(p+1) == '/') {
+           return false;
+          }
+        } else {
+          return false;   // do not permit '/' unless it's class name
+        }
       }
       if (type == ClassFileParser::LegalMethod && (ch == '<' || ch == '>')) {
         return false;   // do not permit '<' or '>' in method names
@@ -5347,15 +5356,7 @@
   if (!is_internal()) {
     if (log_is_enabled(Info, class, load)) {
       ResourceMark rm;
-      const char* module_name = NULL;
-      static const size_t modules_image_name_len = strlen(MODULES_IMAGE_NAME);
-      size_t stream_len = strlen(_stream->source());
-      // See if _stream->source() ends in "modules"
-      if (module_entry->is_named() && modules_image_name_len < stream_len &&
-        (strncmp(_stream->source() + stream_len - modules_image_name_len,
-                 MODULES_IMAGE_NAME, modules_image_name_len) == 0)) {
-        module_name = module_entry->name()->as_C_string();
-      }
+      const char* module_name = (module_entry->name() == NULL) ? UNNAMED_MODULE : module_entry->name()->as_C_string();
 
       if (log_is_enabled(Info, class, load)) {
         ik->print_loading_log(LogLevel::Info, _loader_data, module_name, _stream);
--- a/hotspot/src/share/vm/classfile/classLoader.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -181,26 +181,59 @@
 }
 
 // Used to obtain the package name from a fully qualified class name.
-// It is the responsibility of the caller to establish ResourceMark.
-const char* ClassLoader::package_from_name(const char* class_name) {
-  const char* last_slash = strrchr(class_name, '/');
+// It is the responsibility of the caller to establish a ResourceMark.
+const char* ClassLoader::package_from_name(const char* const class_name, bool* bad_class_name) {
+  if (class_name == NULL) {
+    if (bad_class_name != NULL) {
+      *bad_class_name = true;
+    }
+    return NULL;
+  }
+
+  if (bad_class_name != NULL) {
+    *bad_class_name = false;
+  }
+
+  const char* const last_slash = strrchr(class_name, '/');
   if (last_slash == NULL) {
     // No package name
     return NULL;
   }
-  int length = last_slash - class_name;
+
+  char* class_name_ptr = (char*) class_name;
+  // Skip over '['s
+  if (*class_name_ptr == '[') {
+    do {
+      class_name_ptr++;
+    } while (*class_name_ptr == '[');
 
-  // A class name could have just the slash character in the name,
-  // resulting in a negative length.
+    // Fully qualified class names should not contain a 'L'.
+    // Set bad_class_name to true to indicate that the package name
+    // could not be obtained due to an error condition.
+    // In this situation, is_same_class_package returns false.
+    if (*class_name_ptr == 'L') {
+      if (bad_class_name != NULL) {
+        *bad_class_name = true;
+      }
+      return NULL;
+    }
+  }
+
+  int length = last_slash - class_name_ptr;
+
+  // A class name could have just the slash character in the name.
   if (length <= 0) {
     // No package name
+    if (bad_class_name != NULL) {
+      *bad_class_name = true;
+    }
     return NULL;
   }
 
   // drop name after last slash (including slash)
   // Ex., "java/lang/String.class" => "java/lang"
   char* pkg_name = NEW_RESOURCE_ARRAY(char, length + 1);
-  strncpy(pkg_name, class_name, length);
+  strncpy(pkg_name, class_name_ptr, length);
   *(pkg_name+length) = '\0';
 
   return (const char *)pkg_name;
@@ -228,8 +261,9 @@
 
 ClassFileStream* ClassPathDirEntry::open_stream(const char* name, TRAPS) {
   // construct full path name
-  char path[JVM_MAXPATHLEN];
-  if (jio_snprintf(path, sizeof(path), "%s%s%s", _dir, os::file_separator(), name) == -1) {
+  char* path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JVM_MAXPATHLEN);
+  if (jio_snprintf(path, JVM_MAXPATHLEN, "%s%s%s", _dir, os::file_separator(), name) == -1) {
+    FREE_RESOURCE_ARRAY(char, path, JVM_MAXPATHLEN);
     return NULL;
   }
   // check if file exists
@@ -256,6 +290,7 @@
         if (UsePerfData) {
           ClassLoader::perf_sys_classfile_bytes_read()->inc(num_read);
         }
+        FREE_RESOURCE_ARRAY(char, path, JVM_MAXPATHLEN);
         // Resource allocated
         return new ClassFileStream(buffer,
                                    st.st_size,
@@ -264,6 +299,7 @@
       }
     }
   }
+  FREE_RESOURCE_ARRAY(char, path, JVM_MAXPATHLEN);
   return NULL;
 }
 
@@ -344,9 +380,9 @@
 
     if (is_multi_ver) {
       int n;
-      char entry_name[JVM_MAXPATHLEN];
+      char* entry_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JVM_MAXPATHLEN);
       if (version > 0) {
-        n = jio_snprintf(entry_name, sizeof(entry_name), "META-INF/versions/%d/%s", version, name);
+        n = jio_snprintf(entry_name, JVM_MAXPATHLEN, "META-INF/versions/%d/%s", version, name);
         entry_name[n] = '\0';
         buffer = open_entry((const char*)entry_name, filesize, false, CHECK_NULL);
         if (buffer == NULL) {
@@ -355,7 +391,7 @@
       }
       if (buffer == NULL) {
         for (int i = cur_ver; i >= base_version; i--) {
-          n = jio_snprintf(entry_name, sizeof(entry_name), "META-INF/versions/%d/%s", i, name);
+          n = jio_snprintf(entry_name, JVM_MAXPATHLEN, "META-INF/versions/%d/%s", i, name);
           entry_name[n] = '\0';
           buffer = open_entry((const char*)entry_name, filesize, false, CHECK_NULL);
           if (buffer != NULL) {
@@ -363,6 +399,7 @@
           }
         }
       }
+      FREE_RESOURCE_ARRAY(char, entry_name, JVM_MAXPATHLEN);
     }
   }
   return buffer;
@@ -508,7 +545,8 @@
         const char* name, const char* extension, void* arg) {
   if (strcmp(extension, "class") == 0) {
     Thread* THREAD = Thread::current();
-    char path[JIMAGE_MAX_PATH];
+    ResourceMark rm(THREAD);
+    char* path = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, JIMAGE_MAX_PATH);
     jio_snprintf(path, JIMAGE_MAX_PATH - 1, "%s/%s.class", package, name);
     ClassLoader::compile_the_world_in(path, *(Handle*)arg, THREAD);
     return !HAS_PENDING_EXCEPTION;
@@ -750,9 +788,10 @@
   JavaThread* thread = JavaThread::current();
   ClassPathEntry* new_entry = NULL;
   if ((st->st_mode & S_IFREG) == S_IFREG) {
+    ResourceMark rm(thread);
     // Regular file, should be a zip or jimage file
     // Canonicalized filename
-    char canonical_path[JVM_MAXPATHLEN];
+    char* canonical_path = NEW_RESOURCE_ARRAY_IN_THREAD(thread, char, JVM_MAXPATHLEN);
     if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
       // This matches the classic VM
       if (throw_exception) {
@@ -777,14 +816,13 @@
       if (zip != NULL && error_msg == NULL) {
         new_entry = new ClassPathZipEntry(zip, path, is_boot_append);
       } else {
-        ResourceMark rm(thread);
         char *msg;
         if (error_msg == NULL) {
-          msg = NEW_RESOURCE_ARRAY(char, strlen(path) + 128); ;
+          msg = NEW_RESOURCE_ARRAY_IN_THREAD(thread, char, strlen(path) + 128); ;
           jio_snprintf(msg, strlen(path) + 127, "error in opening JAR file %s", path);
         } else {
           int len = (int)(strlen(path) + strlen(error_msg) + 128);
-          msg = NEW_RESOURCE_ARRAY(char, len); ;
+          msg = NEW_RESOURCE_ARRAY_IN_THREAD(thread, char, len); ;
           jio_snprintf(msg, len - 1, "error in opening JAR file <%s> %s", error_msg, path);
         }
         // Don't complain about bad jar files added via -Xbootclasspath/a:.
@@ -1112,13 +1150,11 @@
   assert(fullq_class_name != NULL, "just checking");
 
   // Get package name from fully qualified class name.
-  const char *cp = strrchr(fullq_class_name, '/');
+  ResourceMark rm;
+  const char *cp = package_from_name(fullq_class_name);
   if (cp != NULL) {
-    int len = cp - fullq_class_name;
-    PackageEntryTable* pkg_entry_tbl =
-      ClassLoaderData::the_null_class_loader_data()->packages();
-    TempNewSymbol pkg_symbol =
-      SymbolTable::new_symbol(fullq_class_name, len, CHECK_false);
+    PackageEntryTable* pkg_entry_tbl = ClassLoaderData::the_null_class_loader_data()->packages();
+    TempNewSymbol pkg_symbol = SymbolTable::new_symbol(cp, CHECK_false);
     PackageEntry* pkg_entry = pkg_entry_tbl->lookup_only(pkg_symbol);
     if (pkg_entry != NULL) {
       assert(classpath_index != -1, "Unexpected classpath_index");
@@ -1226,11 +1262,9 @@
   // jimage, it is determined by the class path entry.
   jshort loader_type = ClassLoader::APP_LOADER;
   if (e->is_jrt()) {
-    int length = 0;
-    const jbyte* pkg_string = InstanceKlass::package_from_name(class_name, length);
-    if (pkg_string != NULL) {
-      ResourceMark rm;
-      TempNewSymbol pkg_name = SymbolTable::new_symbol((const char*)pkg_string, length, THREAD);
+    ResourceMark rm;
+    TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK_0);
+    if (pkg_name != NULL) {
       const char* pkg_name_C_string = (const char*)(pkg_name->as_C_string());
       ClassPathImageEntry* cpie = (ClassPathImageEntry*)e;
       JImageFile* jimage = cpie->jimage();
--- a/hotspot/src/share/vm/classfile/classLoader.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -444,7 +444,9 @@
   static bool string_ends_with(const char* str, const char* str_to_find);
 
   // obtain package name from a fully qualified class name
-  static const char* package_from_name(const char* class_name);
+  // *bad_class_name is set to true if there's a problem with parsing class_name, to
+  // distinguish from a class_name with no package name, as both cases have a NULL return value
+  static const char* package_from_name(const char* const class_name, bool* bad_class_name = NULL);
 
   static bool is_jrt(const char* name) { return string_ends_with(name, MODULES_IMAGE_NAME); }
 
--- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -54,12 +54,14 @@
                                       const s2 classpath_index,
                                       instanceKlassHandle result, TRAPS) {
       if (ClassLoader::add_package(_file_name, classpath_index, THREAD)) {
+#if INCLUDE_CDS
         if (DumpSharedSpaces) {
           s2 classloader_type = ClassLoader::classloader_type(
                           class_name, e, classpath_index, CHECK_(result));
           result->set_shared_classpath_index(classpath_index);
           result->set_class_loader_type(classloader_type);
         }
+#endif
         return result;
       } else {
         return instanceKlassHandle(); // NULL
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -3245,6 +3245,15 @@
   mname->address_field_put(_vmindex_offset, (address) index);
 }
 
+bool java_lang_invoke_MemberName::equals(oop mn1, oop mn2) {
+  if (mn1 == mn2) {
+     return true;
+  }
+  return (vmtarget(mn1) == vmtarget(mn2) && flags(mn1) == flags(mn2) &&
+          vmindex(mn1) == vmindex(mn2) &&
+          clazz(mn1) == clazz(mn2));
+}
+
 oop java_lang_invoke_LambdaForm::vmentry(oop lform) {
   assert(is_instance(lform), "wrong type");
   return lform->obj_field(_vmentry_offset);
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1114,6 +1114,8 @@
   static int flags_offset_in_bytes()            { return _flags_offset; }
   static int vmtarget_offset_in_bytes()         { return _vmtarget_offset; }
   static int vmindex_offset_in_bytes()          { return _vmindex_offset; }
+
+  static bool equals(oop mt1, oop mt2);
 };
 
 
--- a/hotspot/src/share/vm/classfile/moduleEntry.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/moduleEntry.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -201,7 +201,7 @@
 }
 
 void ModuleEntryTable::create_unnamed_module(ClassLoaderData* loader_data) {
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
 
   // Each ModuleEntryTable has exactly one unnamed module
   if (loader_data->is_the_null_class_loader_data()) {
@@ -227,7 +227,7 @@
 ModuleEntry* ModuleEntryTable::new_entry(unsigned int hash, Handle module_handle, Symbol* name,
                                          Symbol* version, Symbol* location,
                                          ClassLoaderData* loader_data) {
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
   ModuleEntry* entry = (ModuleEntry*) NEW_C_HEAP_ARRAY(char, entry_size(), mtModule);
 
   // Initialize everything BasicHashtable would
@@ -258,7 +258,7 @@
 }
 
 void ModuleEntryTable::add_entry(int index, ModuleEntry* new_entry) {
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
   Hashtable<Symbol*, mtModule>::add_entry(index, (HashtableEntry<Symbol*, mtModule>*)new_entry);
 }
 
@@ -268,7 +268,7 @@
                                                            Symbol* module_location,
                                                            ClassLoaderData* loader_data) {
   assert(module_name != NULL, "ModuleEntryTable locked_create_entry_or_null should never be called for unnamed module.");
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
   // Check if module already exists.
   if (lookup_only(module_name) != NULL) {
     return NULL;
@@ -309,7 +309,7 @@
 }
 
 void ModuleEntryTable::finalize_javabase(Handle module_handle, Symbol* version, Symbol* location) {
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
   ClassLoaderData* boot_loader_data = ClassLoaderData::the_null_class_loader_data();
   ModuleEntryTable* module_table = boot_loader_data->modules();
 
--- a/hotspot/src/share/vm/classfile/modules.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/modules.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -568,8 +568,8 @@
                       to_module_entry->is_named() ?
                         to_module_entry->name()->as_C_string() : UNNAMED_MODULE);
 
-  // Do nothing if modules are the same or if package is already exported unqualifiedly.
-  if (from_module_entry != to_module_entry && !package_entry->is_unqual_exported()) {
+  // Do nothing if modules are the same.
+  if (from_module_entry != to_module_entry) {
     package_entry->set_exported(to_module_entry);
   }
 }
--- a/hotspot/src/share/vm/classfile/packageEntry.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/packageEntry.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -49,7 +49,7 @@
 
 // Add a module to the package's qualified export list.
 void PackageEntry::add_qexport(ModuleEntry* m) {
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
   if (!has_qual_exports_list()) {
     // Lazily create a package's qualified exports list.
     // Initial size is small, do not anticipate export lists to be large.
@@ -157,7 +157,7 @@
 }
 
 PackageEntry* PackageEntryTable::new_entry(unsigned int hash, Symbol* name, ModuleEntry* module) {
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
   PackageEntry* entry = (PackageEntry*) NEW_C_HEAP_ARRAY(char, entry_size(), mtModule);
 
   // Initialize everything BasicHashtable would
@@ -180,14 +180,14 @@
 }
 
 void PackageEntryTable::add_entry(int index, PackageEntry* new_entry) {
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
   Hashtable<Symbol*, mtModule>::add_entry(index, (HashtableEntry<Symbol*, mtModule>*)new_entry);
 }
 
 // Create package in loader's package entry table and return the entry.
 // If entry already exists, return null.  Assume Module lock was taken by caller.
 PackageEntry* PackageEntryTable::locked_create_entry_or_null(Symbol* name, ModuleEntry* module) {
-  assert_locked_or_safepoint(Module_lock);
+  assert(Module_lock->owned_by_self(), "should have the Module_lock");
   // Check if package already exists.  Return NULL if it does.
   if (lookup_only(name) != NULL) {
     return NULL;
--- a/hotspot/src/share/vm/classfile/packageEntry.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/packageEntry.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -40,11 +40,7 @@
 //     package is exported to.
 //
 // Packages can be exported in the following 3 ways:
-//   - not exported:        the package has not been explicitly qualified to a
-//                            particular module nor has it been specified to be
-//                            unqualifiedly exported to all modules. If all states
-//                            of exportedness are false, the package is considered
-//                            not exported.
+//   - not exported:        the package does not have qualified or unqualified exports.
 //   - qualified exports:   the package has been explicitly qualified to at least
 //                            one particular module or has been qualifiedly exported
 //                            to all unnamed modules.
@@ -125,6 +121,7 @@
     return _is_exported_unqualified;
   }
   void set_unqual_exported() {
+    assert(Module_lock->owned_by_self(), "should have the Module_lock");
     _is_exported_unqualified = true;
     _is_exported_allUnnamed = false;
     _qualified_exports = NULL;
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -70,6 +70,7 @@
 #include "services/threadService.hpp"
 #include "trace/traceMacros.hpp"
 #include "utilities/macros.hpp"
+#include "utilities/stringUtils.hpp"
 #include "utilities/ticks.hpp"
 #if INCLUDE_CDS
 #include "classfile/sharedClassUtil.hpp"
@@ -1154,12 +1155,10 @@
     // It is illegal to define classes in the "java." package from
     // JVM_DefineClass or jni_DefineClass unless you're the bootclassloader
     ResourceMark rm(THREAD);
-    char* name = parsed_name->as_C_string();
-    char* index = strrchr(name, '/');
-    *index = '\0'; // chop to just the package name
-    while ((index = strchr(name, '/')) != NULL) {
-      *index = '.'; // replace '/' with '.' in package name
-    }
+    TempNewSymbol pkg_name = InstanceKlass::package_from_name(parsed_name, CHECK_NULL);
+    assert(pkg_name != NULL, "Error in parsing package name starting with 'java/'");
+    char* name = pkg_name->as_C_string();
+    StringUtils::replace_no_expand(name, "/", ".");
     const char* msg_text = "Prohibited package name: ";
     size_t len = strlen(msg_text) + strlen(name) + 1;
     char* message = NEW_RESOURCE_ARRAY(char, len);
@@ -1257,6 +1256,7 @@
 bool SystemDictionary::is_shared_class_visible(Symbol* class_name,
                                                instanceKlassHandle ik,
                                                Handle class_loader, TRAPS) {
+  ResourceMark rm;
   int path_index = ik->shared_classpath_index();
   SharedClassPathEntry* ent =
             (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index);
@@ -1270,12 +1270,11 @@
   TempNewSymbol pkg_name = NULL;
   PackageEntry* pkg_entry = NULL;
   ModuleEntry* mod_entry = NULL;
-  int length = 0;
+  const char* pkg_string = NULL;
   ClassLoaderData* loader_data = class_loader_data(class_loader);
-  const jbyte* pkg_string = InstanceKlass::package_from_name(class_name, length);
-  if (pkg_string != NULL) {
-    pkg_name = SymbolTable::new_symbol((const char*)pkg_string,
-                                       length, CHECK_(false));
+  pkg_name = InstanceKlass::package_from_name(class_name, CHECK_false);
+  if (pkg_name != NULL) {
+    pkg_string = pkg_name->as_C_string();
     if (loader_data != NULL) {
       pkg_entry = loader_data->packages()->lookup_only(pkg_name);
     }
@@ -1432,15 +1431,14 @@
   instanceKlassHandle nh = instanceKlassHandle(); // null Handle
 
   if (class_loader.is_null()) {
-    int length = 0;
+    ResourceMark rm;
     PackageEntry* pkg_entry = NULL;
     bool search_only_bootloader_append = false;
     ClassLoaderData *loader_data = class_loader_data(class_loader);
 
     // Find the package in the boot loader's package entry table.
-    const jbyte* pkg_string = InstanceKlass::package_from_name(class_name, length);
-    if (pkg_string != NULL) {
-      TempNewSymbol pkg_name = SymbolTable::new_symbol((const char*)pkg_string, length, CHECK_(nh));
+    TempNewSymbol pkg_name = InstanceKlass::package_from_name(class_name, CHECK_NULL);
+    if (pkg_name != NULL) {
       pkg_entry = loader_data->packages()->lookup_only(pkg_name);
     }
 
@@ -1477,7 +1475,7 @@
       assert(!DumpSharedSpaces, "Archive dumped after module system initialization");
       // After the module system has been initialized, check if the class'
       // package is in a module defined to the boot loader.
-      if (pkg_string == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
+      if (pkg_name == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) {
         // Class is either in the unnamed package, in a named package
         // within a module not defined to the boot loader or in a
         // a named package within the unnamed module.  In all cases,
--- a/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/classfile/systemDictionaryShared.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
   static bool is_shared_class_visible_for_classloader(
                                       instanceKlassHandle ik,
                                       Handle class_loader,
-                                      const jbyte* pkg_string,
+                                      const char* pkg_string,
                                       Symbol* pkg_name,
                                       PackageEntry* pkg_entry,
                                       ModuleEntry* mod_entry,
--- a/hotspot/src/share/vm/compiler/methodLiveness.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/compiler/methodLiveness.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -137,11 +137,6 @@
   _arena = arena;
   _method = method;
   _bit_map_size_bits = method->max_locals();
-
-
-#ifdef COMPILER1
-  _bci_block_start.clear();
-#endif
 }
 
 void MethodLiveness::compute_liveness() {
@@ -587,14 +582,6 @@
     new (analyzer->arena()) GrowableArray<MethodLiveness::BasicBlock*>(analyzer->arena(), 5, 0, NULL);
   _exception_predecessors =
     new (analyzer->arena()) GrowableArray<MethodLiveness::BasicBlock*>(analyzer->arena(), 5, 0, NULL);
-  _normal_exit.clear();
-  _exception_exit.clear();
-  _entry.clear();
-
-  // this initialization is not strictly necessary.
-  // _gen and _kill are cleared at the beginning of compute_gen_kill_range()
-  _gen.clear();
-  _kill.clear();
 }
 
 
@@ -1020,7 +1007,6 @@
     _last_bci = bci;
   }
 
-  answer.clear();
   answer.set_union(_normal_exit);
   answer.set_difference(_kill);
   answer.set_union(_gen);
--- a/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1605,6 +1605,9 @@
   _inter_sweep_timer.reset();
   _inter_sweep_timer.start();
 
+  // No longer a need to do a concurrent collection for Metaspace.
+  MetaspaceGC::set_should_concurrent_collect(false);
+
   gch->post_full_gc_dump(gc_timer);
 
   gc_timer->register_gc_end();
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -3474,7 +3474,8 @@
   double remove_self_forwards_start = os::elapsedTime();
 
   remove_self_forwarding_pointers();
-  _preserved_marks_set.restore(workers());
+  SharedRestorePreservedMarksTaskExecutor task_executor(workers());
+  _preserved_marks_set.restore(&task_executor);
 
   g1_policy()->phase_times()->record_evac_fail_remove_self_forwards((os::elapsedTime() - remove_self_forwards_start) * 1000.0);
 }
--- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.inline.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -109,7 +109,7 @@
   _old_set.remove(hr);
 }
 
-// It dirties the cards that cover the block so that so that the post
+// It dirties the cards that cover the block so that the post
 // write barrier never queues anything when updating objects on this
 // block. It is assumed (and in fact we assert) that the block
 // belongs to a young region.
--- a/hotspot/src/share/vm/gc/g1/g1StringDedupStat.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/g1/g1StringDedupStat.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -80,7 +80,7 @@
   log_info(gc, stringdedup)(
     "Concurrent String Deduplication "
     G1_STRDEDUP_BYTES_FORMAT_NS "->" G1_STRDEDUP_BYTES_FORMAT_NS "(" G1_STRDEDUP_BYTES_FORMAT_NS "), avg "
-    G1_STRDEDUP_PERCENT_FORMAT_NS ", " G1_STRDEDUP_TIME_FORMAT "]",
+    G1_STRDEDUP_PERCENT_FORMAT_NS ", " G1_STRDEDUP_TIME_FORMAT,
     G1_STRDEDUP_BYTES_PARAM(last_stat._new_bytes),
     G1_STRDEDUP_BYTES_PARAM(last_stat._new_bytes - last_stat._deduped_bytes),
     G1_STRDEDUP_BYTES_PARAM(last_stat._deduped_bytes),
--- a/hotspot/src/share/vm/gc/parallel/psPromotionManager.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/parallel/psPromotionManager.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "gc/parallel/gcTaskManager.hpp"
 #include "gc/parallel/mutableSpace.hpp"
 #include "gc/parallel/parallelScavengeHeap.hpp"
 #include "gc/parallel/psOldGen.hpp"
@@ -237,8 +238,53 @@
   _preserved_marks = preserved_marks;
 }
 
+class ParRestoreGCTask : public GCTask {
+private:
+  const uint _id;
+  PreservedMarksSet* const _preserved_marks_set;
+  volatile size_t* const _total_size_addr;
+
+public:
+  virtual char* name() {
+    return (char*) "preserved mark restoration task";
+  }
+
+  virtual void do_it(GCTaskManager* manager, uint which){
+    _preserved_marks_set->get(_id)->restore_and_increment(_total_size_addr);
+  }
+
+  ParRestoreGCTask(uint id,
+                   PreservedMarksSet* preserved_marks_set,
+                   volatile size_t* total_size_addr)
+    : _id(id),
+      _preserved_marks_set(preserved_marks_set),
+      _total_size_addr(total_size_addr) { }
+};
+
+class PSRestorePreservedMarksTaskExecutor : public RestorePreservedMarksTaskExecutor {
+private:
+  GCTaskManager* _gc_task_manager;
+
+public:
+  PSRestorePreservedMarksTaskExecutor(GCTaskManager* gc_task_manager)
+      : _gc_task_manager(gc_task_manager) { }
+
+  void restore(PreservedMarksSet* preserved_marks_set,
+               volatile size_t* total_size_addr) {
+    // GCTask / GCTaskQueue are ResourceObjs
+    ResourceMark rm;
+
+    GCTaskQueue* q = GCTaskQueue::create();
+    for (uint i = 0; i < preserved_marks_set->num(); i += 1) {
+      q->enqueue(new ParRestoreGCTask(i, preserved_marks_set, total_size_addr));
+    }
+    _gc_task_manager->execute_and_wait(q);
+  }
+};
+
 void PSPromotionManager::restore_preserved_marks() {
-  _preserved_marks_set->restore(PSScavenge::gc_task_manager());
+  PSRestorePreservedMarksTaskExecutor task_executor(PSScavenge::gc_task_manager());
+  _preserved_marks_set->restore(&task_executor);
 }
 
 void PSPromotionManager::drain_stacks_depth(bool totally_drain) {
--- a/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/serial/defNewGeneration.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -739,7 +739,8 @@
   eden()->object_iterate(&rspc);
   from()->object_iterate(&rspc);
 
-  _preserved_marks_set.restore(GenCollectedHeap::heap()->workers());
+  SharedRestorePreservedMarksTaskExecutor task_executor(GenCollectedHeap::heap()->workers());
+  _preserved_marks_set.restore(&task_executor);
 }
 
 void DefNewGeneration::handle_promotion_failure(oop old) {
--- a/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/collectedHeap.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -386,7 +386,7 @@
 //     initialized by this point, a fact that we assert when doing the
 //     card-mark.)
 // (c) G1CollectedHeap(G1) uses two kinds of write barriers. When a
-//     G1 concurrent marking is in progress an SATB (pre-write-)barrier is
+//     G1 concurrent marking is in progress an SATB (pre-write-)barrier
 //     is used to remember the pre-value of any store. Initializing
 //     stores will not need this barrier, so we need not worry about
 //     compensating for the missing pre-barrier here. Turning now
--- a/hotspot/src/share/vm/gc/shared/preservedMarks.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/preservedMarks.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -28,9 +28,6 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc/parallel/gcTaskManager.hpp"
-#endif
 
 void PreservedMarks::restore() {
   while (!_stack.is_empty()) {
@@ -40,6 +37,15 @@
   assert_empty();
 }
 
+void PreservedMarks::restore_and_increment(volatile size_t* const total_size_addr) {
+  const size_t stack_size = size();
+  restore();
+  // Only do the atomic add if the size is > 0.
+  if (stack_size > 0) {
+    Atomic::add(stack_size, total_size_addr);
+  }
+}
+
 #ifndef PRODUCT
 void PreservedMarks::assert_empty() {
   assert(_stack.is_empty(), "stack expected to be empty, size = "SIZE_FORMAT,
@@ -82,13 +88,7 @@
   virtual void work(uint worker_id) {
     uint task_id = 0;
     while (!_sub_tasks.is_task_claimed(/* reference */ task_id)) {
-      PreservedMarks* const preserved_marks = _preserved_marks_set->get(task_id);
-      const size_t size = preserved_marks->size();
-      preserved_marks->restore();
-      // Only do the atomic add if the size is > 0.
-      if (size > 0) {
-        Atomic::add(size, _total_size_addr);
-      }
+      _preserved_marks_set->get(task_id)->restore_and_increment(_total_size_addr);
     }
     _sub_tasks.all_tasks_completed();
   }
@@ -104,53 +104,6 @@
   }
 };
 
-void PreservedMarksSet::restore_internal(WorkGang* workers,
-                                         volatile size_t* total_size_addr) {
-  assert(workers != NULL, "pre-condition");
-  ParRestoreTask task(workers->active_workers(), this, total_size_addr);
-  workers->run_task(&task);
-}
-
-#if INCLUDE_ALL_GCS
-class ParRestoreGCTask : public GCTask {
-private:
-  const uint _id;
-  PreservedMarksSet* const _preserved_marks_set;
-  volatile size_t* const _total_size_addr;
-
-public:
-  virtual char* name() { return (char*) "preserved mark restoration task"; }
-
-  virtual void do_it(GCTaskManager* manager, uint which) {
-    PreservedMarks* const preserved_marks = _preserved_marks_set->get(_id);
-    const size_t size = preserved_marks->size();
-    preserved_marks->restore();
-    // Only do the atomic add if the size is > 0.
-    if (size > 0) {
-      Atomic::add(size, _total_size_addr);
-    }
-  }
-
-  ParRestoreGCTask(uint id,
-                   PreservedMarksSet* preserved_marks_set,
-                   volatile size_t* total_size_addr)
-    : _id(id),
-      _preserved_marks_set(preserved_marks_set),
-      _total_size_addr(total_size_addr) { }
-};
-
-void PreservedMarksSet::restore_internal(GCTaskManager* gc_task_manager,
-                                         volatile size_t* total_size_addr) {
-  // GCTask / GCTaskQueue are ResourceObjs
-  ResourceMark rm;
-
-  GCTaskQueue* q = GCTaskQueue::create();
-  for (uint i = 0; i < num(); i += 1) {
-    q->enqueue(new ParRestoreGCTask(i, this, total_size_addr));
-  }
-  gc_task_manager->execute_and_wait(q);
-}
-#endif
 
 void PreservedMarksSet::reclaim() {
   assert_empty();
@@ -176,3 +129,16 @@
   }
 }
 #endif // ndef PRODUCT
+
+void SharedRestorePreservedMarksTaskExecutor::restore(PreservedMarksSet* preserved_marks_set,
+                                                      volatile size_t* total_size_addr) {
+  if (_workers == NULL) {
+    for (uint i = 0; i < preserved_marks_set->num(); i += 1) {
+      *total_size_addr += preserved_marks_set->get(i)->size();
+      preserved_marks_set->get(i)->restore();
+    }
+  } else {
+    ParRestoreTask task(_workers->active_workers(), preserved_marks_set, total_size_addr);
+    _workers->run_task(&task);
+  }
+}
--- a/hotspot/src/share/vm/gc/shared/preservedMarks.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/preservedMarks.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -30,7 +30,7 @@
 #include "oops/oop.hpp"
 #include "utilities/stack.hpp"
 
-class GCTaskManager;
+class PreservedMarksSet;
 class WorkGang;
 
 class PreservedMarks VALUE_OBJ_CLASS_SPEC {
@@ -61,6 +61,7 @@
   // reclaim the memory taken up by the stack segments.
   void restore();
 
+  void restore_and_increment(volatile size_t* const _total_size_addr);
   inline static void init_forwarded_mark(oop obj);
 
   // Assert the stack is empty and has no cached segments.
@@ -75,6 +76,24 @@
   virtual void do_object(oop obj);
 };
 
+class RestorePreservedMarksTaskExecutor {
+public:
+  void virtual restore(PreservedMarksSet* preserved_marks_set,
+                       volatile size_t* total_size_addr) = 0;
+};
+
+class SharedRestorePreservedMarksTaskExecutor : public RestorePreservedMarksTaskExecutor {
+private:
+    WorkGang* _workers;
+
+public:
+    SharedRestorePreservedMarksTaskExecutor(WorkGang* workers) : _workers(workers) { }
+
+    void restore(PreservedMarksSet* preserved_marks_set,
+                 volatile size_t* total_size_addr);
+
+};
+
 class PreservedMarksSet : public CHeapObj<mtGC> {
 private:
   // true -> _stacks will be allocated in the C heap
@@ -91,13 +110,6 @@
   // or == NULL if they have not.
   Padded<PreservedMarks>* _stacks;
 
-  // Internal version of restore() that uses a WorkGang for parallelism.
-  void restore_internal(WorkGang* workers, volatile size_t* total_size_addr);
-
-  // Internal version of restore() that uses a GCTaskManager for parallelism.
-  void restore_internal(GCTaskManager* gc_task_manager,
-                        volatile size_t* total_size_addr);
-
 public:
   uint num() const { return _num; }
 
@@ -111,14 +123,11 @@
   // Allocate stack array.
   void init(uint num);
 
-  // Itrerate over all stacks, restore all presered marks, and reclaim
-  // the memory taken up by the stack segments. If the executor is
-  // NULL, restoration will be done serially. If the executor is not
-  // NULL, restoration could be done in parallel (when it makes
-  // sense). Supported executors: WorkGang (Serial, CMS, G1),
-  // GCTaskManager (PS).
-  template <class E>
-  inline void restore(E* executor);
+  // Iterate over all stacks, restore all preserved marks, and reclaim
+  // the memory taken up by the stack segments.
+  // Supported executors: SharedRestorePreservedMarksTaskExecutor (Serial, CMS, G1),
+  // PSRestorePreservedMarksTaskExecutor (PS).
+  inline void restore(RestorePreservedMarksTaskExecutor* executor);
 
   // Reclaim stack array.
   void reclaim();
--- a/hotspot/src/share/vm/gc/shared/preservedMarks.inline.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/preservedMarks.inline.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -49,8 +49,7 @@
   obj->init_mark();
 }
 
-template <class E>
-inline void PreservedMarksSet::restore(E* executor) {
+inline void PreservedMarksSet::restore(RestorePreservedMarksTaskExecutor* executor) {
   volatile size_t total_size = 0;
 
 #ifdef ASSERT
@@ -61,17 +60,7 @@
   }
 #endif // def ASSERT
 
-  if (executor == NULL) {
-    for (uint i = 0; i < _num; i += 1) {
-      total_size += get(i)->size();
-      get(i)->restore();
-    }
-  } else {
-    // Right now, if the executor is not NULL we do the work in
-    // parallel. In the future we might want to do the restoration
-    // serially, if there's only a small number of marks per stack.
-    restore_internal(executor, &total_size);
-  }
+  executor->restore(this, &total_size);
   assert_empty();
 
   assert(total_size == total_size_before,
--- a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -108,8 +108,9 @@
     // do nothing.  tlabs must be inited by initialize() calls
   }
 
-  static const size_t min_size()                 { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); }
-  static const size_t max_size()                 { assert(_max_size != 0, "max_size not set up"); return _max_size; }
+  static size_t min_size()                       { return align_object_size(MinTLABSize / HeapWordSize) + alignment_reserve(); }
+  static size_t max_size()                       { assert(_max_size != 0, "max_size not set up"); return _max_size; }
+  static size_t max_size_in_bytes()              { return max_size() * BytesPerWord; }
   static void set_max_size(size_t max_size)      { _max_size = max_size; }
 
   HeapWord* start() const                        { return _start; }
--- a/hotspot/src/share/vm/gc/shared/workgroup.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/workgroup.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -44,11 +44,6 @@
     vm_exit_out_of_memory(0, OOM_MALLOC_ERROR, "Cannot create GangWorker array.");
   }
 
-  _active_workers = ParallelGCThreads;
-  if (UseDynamicNumberOfGCThreads && !FLAG_IS_CMDLINE(ParallelGCThreads)) {
-    _active_workers = 1U;
-  }
-
   add_workers(true);
 }
 
@@ -60,6 +55,10 @@
 }
 
 void AbstractWorkGang::add_workers(bool initializing) {
+  add_workers(_active_workers, initializing);
+}
+
+void AbstractWorkGang::add_workers(uint active_workers, bool initializing) {
 
   os::ThreadType worker_type;
   if (are_ConcurrentGC_threads()) {
@@ -69,7 +68,7 @@
   }
 
   _created_workers = WorkerManager::add_workers(this,
-                                                _active_workers,
+                                                active_workers,
                                                 _total_workers,
                                                 _created_workers,
                                                 worker_type,
@@ -268,10 +267,11 @@
 }
 
 void WorkGang::run_task(AbstractGangTask* task, uint num_workers) {
-  guarantee(num_workers <= active_workers(),
-            "Trying to execute task %s with %u workers which is more than the amount of active workers %u.",
-            task->name(), num_workers, active_workers());
+  guarantee(num_workers <= total_workers(),
+            "Trying to execute task %s with %u workers which is more than the amount of total workers %u.",
+            task->name(), num_workers, total_workers());
   guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name());
+  add_workers(num_workers, false);
   _dispatcher->coordinator_execute_on_workers(task, num_workers);
 }
 
--- a/hotspot/src/share/vm/gc/shared/workgroup.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/gc/shared/workgroup.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -170,6 +170,9 @@
   // Add GC workers as needed.
   void add_workers(bool initializing);
 
+  // Add GC workers as needed to reach the specified number of workers.
+  void add_workers(uint active_workers, bool initializing);
+
   // Return the Ith worker.
   AbstractGangWorker* worker(uint i) const;
 
@@ -214,7 +217,8 @@
   virtual void run_task(AbstractGangTask* task);
   // Run a task with the given number of workers, returns
   // when the task is done. The number of workers must be at most the number of
-  // active workers.
+  // active workers.  Additional workers may be created if an insufficient
+  // number currently exists.
   void run_task(AbstractGangTask* task, uint num_workers);
 
 protected:
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -40,31 +40,6 @@
 #define JVMCI_ERROR_OK(...)   JVMCI_ERROR_(JVMCIEnv::ok, __VA_ARGS__)
 #define CHECK_OK              CHECK_(JVMCIEnv::ok)
 
-class ParseClosure : public StackObj {
-  int _lineNo;
-  char* _filename;
-  bool _abort;
-protected:
-  void abort() { _abort = true; }
-  void warn_and_abort(const char* message) {
-    warn(message);
-    abort();
-  }
-  void warn(const char* message) {
-    warning("Error at line %d while parsing %s: %s", _lineNo, _filename == NULL ? "?" : _filename, message);
-  }
- public:
-  ParseClosure() : _lineNo(0), _filename(NULL), _abort(false) {}
-  void parse_line(char* line) {
-    _lineNo++;
-    do_line(line);
-  }
-  virtual void do_line(char* line) = 0;
-  int lineNo() { return _lineNo; }
-  bool is_aborted() { return _abort; }
-  void set_filename(char* path) {_filename = path; _lineNo = 0;}
-};
-
 class JVMCIRuntime: public AllStatic {
  public:
   // Constants describing whether JVMCI wants to be able to adjust the compilation
--- a/hotspot/src/share/vm/logging/logConfiguration.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/logging/logConfiguration.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -484,13 +484,13 @@
               " -Xlog:gc::uptime,tid\n"
               "\t Log messages tagged with 'gc' tag using 'info' level to output 'stdout', using 'uptime' and 'tid' decorations.\n\n"
 
-              " -Xlog:gc*=info,rt*=off\n"
-              "\t Log messages tagged with at least 'gc' using 'info' level, but turn off logging of messages tagged with 'rt'.\n"
-              "\t (Messages tagged with both 'gc' and 'rt' will not be logged.)\n\n"
+              " -Xlog:gc*=info,safepoint*=off\n"
+              "\t Log messages tagged with at least 'gc' using 'info' level, but turn off logging of messages tagged with 'safepoint'.\n"
+              "\t (Messages tagged with both 'gc' and 'safepoint' will not be logged.)\n\n"
 
-              " -Xlog:disable -Xlog:rt=trace:rttrace.txt\n"
+              " -Xlog:disable -Xlog:safepoint=trace:safepointtrace.txt\n"
               "\t Turn off all logging, including warnings and errors,\n"
-              "\t and then enable messages tagged with 'rt' using 'trace' level to file 'rttrace.txt'.\n");
+              "\t and then enable messages tagged with 'safepoint' using 'trace' level to file 'safepointtrace.txt'.\n");
 }
 
 void LogConfiguration::rotate_all_outputs() {
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -2933,7 +2933,7 @@
   // Don't use large pages for the class space.
   bool large_pages = false;
 
-#ifndef AARCH64
+#if !(defined(AARCH64) || defined(AIX))
   ReservedSpace metaspace_rs = ReservedSpace(compressed_class_space_size(),
                                              _reserve_alignment,
                                              large_pages,
@@ -2945,18 +2945,25 @@
   // bits.
   if ((uint64_t)requested_addr + compressed_class_space_size() < 4*G) {
     metaspace_rs = ReservedSpace(compressed_class_space_size(),
-                                             _reserve_alignment,
-                                             large_pages,
-                                             requested_addr);
+                                 _reserve_alignment,
+                                 large_pages,
+                                 requested_addr);
   }
 
   if (! metaspace_rs.is_reserved()) {
-    // Try to align metaspace so that we can decode a compressed klass
-    // with a single MOVK instruction.  We can do this iff the
+    // Aarch64: Try to align metaspace so that we can decode a compressed
+    // klass with a single MOVK instruction.  We can do this iff the
     // compressed class base is a multiple of 4G.
-    for (char *a = (char*)align_ptr_up(requested_addr, 4*G);
+    // Aix: Search for a place where we can find memory. If we need to load
+    // the base, 4G alignment is helpful, too.
+    size_t increment = AARCH64_ONLY(4*)G;
+    for (char *a = (char*)align_ptr_up(requested_addr, increment);
          a < (char*)(1024*G);
-         a += 4*G) {
+         a += increment) {
+      if (a == (char *)(32*G)) {
+        // Go faster from here on. Zero-based is no longer possible.
+        increment = 4*G;
+      }
 
 #if INCLUDE_CDS
       if (UseSharedSpaces
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -2182,39 +2182,21 @@
   return dest;
 }
 
-const jbyte* InstanceKlass::package_from_name(const Symbol* name, int& length) {
-  ResourceMark rm;
-  length = 0;
+// Used to obtain the package name from a fully qualified class name.
+Symbol* InstanceKlass::package_from_name(const Symbol* name, TRAPS) {
   if (name == NULL) {
     return NULL;
   } else {
-    const jbyte* base_name = name->base();
-    const jbyte* last_slash = UTF8::strrchr(base_name, name->utf8_length(), '/');
-
-    if (last_slash == NULL) {
-      // No package name
+    if (name->utf8_length() <= 0) {
       return NULL;
-    } else {
-      // Skip over '['s
-      if (*base_name == '[') {
-        do {
-          base_name++;
-        } while (*base_name == '[');
-        if (*base_name != 'L') {
-          // Fully qualified class names should not contain a 'L'.
-          // Set length to -1 to indicate that the package name
-          // could not be obtained due to an error condition.
-          // In this situtation, is_same_class_package returns false.
-          length = -1;
-          return NULL;
-        }
-      }
-
-      // Found the package name, look it up in the symbol table.
-      length = last_slash - base_name;
-      assert(length > 0, "Bad length for package name");
-      return base_name;
     }
+    ResourceMark rm;
+    const char* package_name = ClassLoader::package_from_name((const char*) name->as_C_string());
+    if (package_name == NULL) {
+      return NULL;
+    }
+    Symbol* pkg_name = SymbolTable::new_symbol(package_name, THREAD);
+    return pkg_name;
   }
 }
 
@@ -2230,12 +2212,9 @@
 }
 
 void InstanceKlass::set_package(ClassLoaderData* loader_data, TRAPS) {
-  int length = 0;
-  const jbyte* base_name = package_from_name(name(), length);
-
-  if (base_name != NULL && loader_data != NULL) {
-    TempNewSymbol pkg_name = SymbolTable::new_symbol((const char*)base_name, length, CHECK);
-
+  TempNewSymbol pkg_name = package_from_name(name(), CHECK);
+
+  if (pkg_name != NULL && loader_data != NULL) {
     // Find in class loader's package entry table.
     _package_entry = loader_data->packages()->lookup_only(pkg_name);
 
@@ -2331,20 +2310,18 @@
   if (class_loader1 != class_loader2) {
     return false;
   } else if (class_name1 == class_name2) {
-    return true;                // skip painful bytewise comparison
+    return true;
   } else {
     ResourceMark rm;
 
-    // The Symbol*'s are in UTF8 encoding. Since we only need to check explicitly
-    // for ASCII characters ('/', 'L', '['), we can keep them in UTF8 encoding.
-    // Otherwise, we just compare jbyte values between the strings.
-    int length1 = 0;
-    int length2 = 0;
-    const jbyte *name1 = package_from_name(class_name1, length1);
-    const jbyte *name2 = package_from_name(class_name2, length2);
-
-    if ((length1 < 0) || (length2 < 0)) {
-      // error occurred parsing package name.
+    bool bad_class_name = false;
+    const char* name1 = ClassLoader::package_from_name((const char*) class_name1->as_C_string(), &bad_class_name);
+    if (bad_class_name) {
+      return false;
+    }
+
+    const char* name2 = ClassLoader::package_from_name((const char*) class_name2->as_C_string(), &bad_class_name);
+    if (bad_class_name) {
       return false;
     }
 
@@ -2354,13 +2331,13 @@
       return name1 == name2;
     }
 
-    // Check that package part is identical
-    return UTF8::equal(name1, length1, name2, length2);
+    // Check that package is identical
+    return (strcmp(name1, name2) == 0);
   }
 }
 
 // Returns true iff super_method can be overridden by a method in targetclassname
-// See JSL 3rd edition 8.4.6.1
+// See JLS 3rd edition 8.4.6.1
 // Assumes name-signature match
 // "this" is InstanceKlass of super_method which must exist
 // note that the InstanceKlass of the method in the targetclassname has not always been created yet
@@ -2716,7 +2693,7 @@
   return NULL;
 }
 
-bool InstanceKlass::add_member_name(Handle mem_name) {
+oop InstanceKlass::add_member_name(Handle mem_name, bool intern) {
   jweak mem_name_wref = JNIHandles::make_weak_global(mem_name);
   MutexLocker ml(MemberNameTable_lock);
   DEBUG_ONLY(NoSafepointVerifier nsv);
@@ -2726,7 +2703,7 @@
   // is called!
   Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name());
   if (method->is_obsolete()) {
-    return false;
+    return NULL;
   } else if (method->is_old()) {
     // Replace method with redefined version
     java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum()));
@@ -2735,8 +2712,11 @@
   if (_member_names == NULL) {
     _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count());
   }
-  _member_names->add_member_name(mem_name_wref);
-  return true;
+  if (intern) {
+    return _member_names->find_or_add_member_name(mem_name_wref);
+  } else {
+    return _member_names->add_member_name(mem_name_wref);
+  }
 }
 
 // -----------------------------------------------------------------------------------------------------
@@ -3027,7 +3007,11 @@
   if (cfs != NULL) {
     if (cfs->source() != NULL) {
       if (module_name != NULL) {
-        log->print(" source: jrt:/%s", module_name);
+        if (ClassLoader::is_jrt(cfs->source())) {
+          log->print(" source: jrt:/%s", module_name);
+        } else {
+          log->print(" source: %s", cfs->source());
+        }
       } else {
         log->print(" source: %s", cfs->source());
       }
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1108,7 +1108,7 @@
 
   // Naming
   const char* signature_name() const;
-  static const jbyte* package_from_name(const Symbol* name, int& length);
+  static Symbol* package_from_name(const Symbol* name, TRAPS);
 
   // GC specific object visitors
   //
@@ -1298,7 +1298,7 @@
   // JSR-292 support
   MemberNameTable* member_names() { return _member_names; }
   void set_member_names(MemberNameTable* member_names) { _member_names = member_names; }
-  bool add_member_name(Handle member_name);
+  oop add_member_name(Handle member_name, bool intern);
 
 public:
   // JVMTI support
--- a/hotspot/src/share/vm/oops/method.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/oops/method.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -246,7 +246,7 @@
   int code_size() const                  { return constMethod()->code_size(); }
 
   // method size in words
-  int method_size() const                { return sizeof(Method)/wordSize + is_native() ? 2 : 0; }
+  int method_size() const                { return sizeof(Method)/wordSize + ( is_native() ? 2 : 0 ); }
 
   // constant pool for Klass* holding this method
   ConstantPool* constants() const              { return constMethod()->constants(); }
--- a/hotspot/src/share/vm/opto/arraycopynode.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/opto/arraycopynode.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -204,7 +204,8 @@
   }
 
   if (!finish_transform(phase, can_reshape, ctl, mem)) {
-    return NULL;
+    // Return NodeSentinel to indicate that the transform failed
+    return NodeSentinel;
   }
 
   return mem;
@@ -222,6 +223,7 @@
   Node* dest = in(ArrayCopyNode::Dest);
   const Type* src_type = phase->type(src);
   const TypeAryPtr* ary_src = src_type->isa_aryptr();
+  assert(ary_src != NULL, "should be an array copy/clone");
 
   if (is_arraycopy() || is_copyofrange() || is_copyof()) {
     const Type* dest_type = phase->type(dest);
@@ -520,7 +522,7 @@
 
   Node* mem = try_clone_instance(phase, can_reshape, count);
   if (mem != NULL) {
-    return mem;
+    return (mem == NodeSentinel) ? NULL : mem;
   }
 
   Node* adr_src = NULL;
@@ -627,31 +629,37 @@
   return CallNode::may_modify_arraycopy_helper(dest_t, t_oop, phase);
 }
 
-bool ArrayCopyNode::may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase) {
+bool ArrayCopyNode::may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, ArrayCopyNode*& ac) {
   if (n->is_Proj()) {
     n = n->in(0);
     if (n->is_Call() && n->as_Call()->may_modify(t_oop, phase)) {
+      if (n->isa_ArrayCopy() != NULL) {
+        ac = n->as_ArrayCopy();
+      }
       return true;
     }
   }
   return false;
 }
 
-bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase) {
+bool ArrayCopyNode::may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase, ArrayCopyNode*& ac) {
   Node* mem = mb->in(TypeFunc::Memory);
 
   if (mem->is_MergeMem()) {
     Node* n = mem->as_MergeMem()->memory_at(Compile::AliasIdxRaw);
-    if (may_modify_helper(t_oop, n, phase)) {
+    if (may_modify_helper(t_oop, n, phase, ac)) {
       return true;
     } else if (n->is_Phi()) {
       for (uint i = 1; i < n->req(); i++) {
         if (n->in(i) != NULL) {
-          if (may_modify_helper(t_oop, n->in(i), phase)) {
+          if (may_modify_helper(t_oop, n->in(i), phase, ac)) {
             return true;
           }
         }
       }
+    } else if (n->Opcode() == Op_StoreCM) {
+      // Ignore card mark stores
+      return may_modify_helper(t_oop, n->in(MemNode::Memory), phase, ac);
     }
   }
 
--- a/hotspot/src/share/vm/opto/arraycopynode.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/opto/arraycopynode.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,7 +107,7 @@
                             BasicType copy_type, const Type* value_type, int count);
   bool finish_transform(PhaseGVN *phase, bool can_reshape,
                         Node* ctl, Node *mem);
-  static bool may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase);
+  static bool may_modify_helper(const TypeOopPtr *t_oop, Node* n, PhaseTransform *phase, ArrayCopyNode*& ac);
 
 public:
 
@@ -162,7 +162,7 @@
 
   bool is_alloc_tightly_coupled() const { return _alloc_tightly_coupled; }
 
-  static bool may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase);
+  static bool may_modify(const TypeOopPtr *t_oop, MemBarNode* mb, PhaseTransform *phase, ArrayCopyNode*& ac);
   bool modifies(intptr_t offset_lo, intptr_t offset_hi, PhaseTransform* phase, bool must_modify);
 
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -4306,8 +4306,15 @@
       } __ end_if();
     } __ end_if();
   } else {
-    // Object.clone() instrinsic uses this path.
-    g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
+    // The Object.clone() intrinsic uses this path if !ReduceInitialCardMarks.
+    // We don't need a barrier here if the destination is a newly allocated object
+    // in Eden. Otherwise, GC verification breaks because we assume that cards in Eden
+    // are set to 'g1_young_gen' (see G1SATBCardTableModRefBS::verify_g1_young_region()).
+    assert(!use_ReduceInitialCardMarks(), "can only happen with card marking");
+    Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
+    __ if_then(card_val, BoolTest::ne, young_card); {
+      g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
+    } __ end_if();
   }
 
   // Final sync IdealKit and GraphKit.
--- a/hotspot/src/share/vm/opto/macro.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/opto/macro.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 #include "opto/cfgnode.hpp"
 #include "opto/compile.hpp"
 #include "opto/convertnode.hpp"
+#include "opto/graphKit.hpp"
 #include "opto/locknode.hpp"
 #include "opto/loopnode.hpp"
 #include "opto/macro.hpp"
@@ -263,41 +264,58 @@
     // checks if the store done to a different from the value's region.
     // And replace Cmp with #0 (false) to collapse G1 post barrier.
     Node* xorx = p2x->find_out_with(Op_XorX);
-    assert(xorx != NULL, "missing G1 post barrier");
-    Node* shift = xorx->unique_out();
-    Node* cmpx = shift->unique_out();
-    assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
-    cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
-    "missing region check in G1 post barrier");
-    _igvn.replace_node(cmpx, makecon(TypeInt::CC_EQ));
+    if (xorx != NULL) {
+      Node* shift = xorx->unique_out();
+      Node* cmpx = shift->unique_out();
+      assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
+      cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
+      "missing region check in G1 post barrier");
+      _igvn.replace_node(cmpx, makecon(TypeInt::CC_EQ));
 
-    // Remove G1 pre barrier.
+      // Remove G1 pre barrier.
 
-    // Search "if (marking != 0)" check and set it to "false".
-    // There is no G1 pre barrier if previous stored value is NULL
-    // (for example, after initialization).
-    if (this_region->is_Region() && this_region->req() == 3) {
-      int ind = 1;
-      if (!this_region->in(ind)->is_IfFalse()) {
-        ind = 2;
-      }
-      if (this_region->in(ind)->is_IfFalse()) {
-        Node* bol = this_region->in(ind)->in(0)->in(1);
-        assert(bol->is_Bool(), "");
-        cmpx = bol->in(1);
-        if (bol->as_Bool()->_test._test == BoolTest::ne &&
-            cmpx->is_Cmp() && cmpx->in(2) == intcon(0) &&
-            cmpx->in(1)->is_Load()) {
-          Node* adr = cmpx->in(1)->as_Load()->in(MemNode::Address);
-          const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() +
-                                              SATBMarkQueue::byte_offset_of_active());
-          if (adr->is_AddP() && adr->in(AddPNode::Base) == top() &&
-              adr->in(AddPNode::Address)->Opcode() == Op_ThreadLocal &&
-              adr->in(AddPNode::Offset) == MakeConX(marking_offset)) {
-            _igvn.replace_node(cmpx, makecon(TypeInt::CC_EQ));
+      // Search "if (marking != 0)" check and set it to "false".
+      // There is no G1 pre barrier if previous stored value is NULL
+      // (for example, after initialization).
+      if (this_region->is_Region() && this_region->req() == 3) {
+        int ind = 1;
+        if (!this_region->in(ind)->is_IfFalse()) {
+          ind = 2;
+        }
+        if (this_region->in(ind)->is_IfFalse()) {
+          Node* bol = this_region->in(ind)->in(0)->in(1);
+          assert(bol->is_Bool(), "");
+          cmpx = bol->in(1);
+          if (bol->as_Bool()->_test._test == BoolTest::ne &&
+              cmpx->is_Cmp() && cmpx->in(2) == intcon(0) &&
+              cmpx->in(1)->is_Load()) {
+            Node* adr = cmpx->in(1)->as_Load()->in(MemNode::Address);
+            const int marking_offset = in_bytes(JavaThread::satb_mark_queue_offset() +
+                                                SATBMarkQueue::byte_offset_of_active());
+            if (adr->is_AddP() && adr->in(AddPNode::Base) == top() &&
+                adr->in(AddPNode::Address)->Opcode() == Op_ThreadLocal &&
+                adr->in(AddPNode::Offset) == MakeConX(marking_offset)) {
+              _igvn.replace_node(cmpx, makecon(TypeInt::CC_EQ));
+            }
           }
         }
       }
+    } else {
+      assert(!GraphKit::use_ReduceInitialCardMarks(), "can only happen with card marking");
+      // This is a G1 post barrier emitted by the Object.clone() intrinsic.
+      // Search for the CastP2X->URShiftX->AddP->LoadB->Cmp path which checks if the card
+      // is marked as young_gen and replace the Cmp with 0 (false) to collapse the barrier.
+      Node* shift = p2x->find_out_with(Op_URShiftX);
+      assert(shift != NULL, "missing G1 post barrier");
+      Node* addp = shift->unique_out();
+      Node* load = addp->find_out_with(Op_LoadB);
+      assert(load != NULL, "missing G1 post barrier");
+      Node* cmpx = load->unique_out();
+      assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
+             cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
+             "missing card value check in G1 post barrier");
+      _igvn.replace_node(cmpx, makecon(TypeInt::CC_EQ));
+      // There is no G1 pre barrier in this case
     }
     // Now CastP2X can be removed since it is used only on dead path
     // which currently still alive until igvn optimize it.
@@ -326,17 +344,15 @@
         CallNode *call = in->as_Call();
         if (call->may_modify(tinst, phase)) {
           assert(call->is_ArrayCopy(), "ArrayCopy is the only call node that doesn't make allocation escape");
-
           if (call->as_ArrayCopy()->modifies(offset, offset, phase, false)) {
             return in;
           }
         }
         mem = in->in(TypeFunc::Memory);
       } else if (in->is_MemBar()) {
-        if (ArrayCopyNode::may_modify(tinst, in->as_MemBar(), phase)) {
-          assert(in->in(0)->is_Proj() && in->in(0)->in(0)->is_ArrayCopy(), "should be arraycopy");
-          ArrayCopyNode* ac = in->in(0)->in(0)->as_ArrayCopy();
-          assert(ac->is_clonebasic(), "Only basic clone is a non escaping clone");
+        ArrayCopyNode* ac = NULL;
+        if (ArrayCopyNode::may_modify(tinst, in->as_MemBar(), phase, ac)) {
+          assert(ac != NULL && ac->is_clonebasic(), "Only basic clone is a non escaping clone");
           return ac;
         }
         mem = in->in(TypeFunc::Memory);
--- a/hotspot/src/share/vm/opto/memnode.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/opto/memnode.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -160,7 +160,8 @@
           }
         }
       } else if (proj_in->is_MemBar()) {
-        if (ArrayCopyNode::may_modify(t_oop, proj_in->as_MemBar(), phase)) {
+        ArrayCopyNode* ac = NULL;
+        if (ArrayCopyNode::may_modify(t_oop, proj_in->as_MemBar(), phase, ac)) {
           break;
         }
         result = proj_in->in(TypeFunc::Memory);
@@ -657,7 +658,8 @@
           continue;         // (a) advance through independent call memory
         }
       } else if (mem->is_Proj() && mem->in(0)->is_MemBar()) {
-        if (ArrayCopyNode::may_modify(addr_t, mem->in(0)->as_MemBar(), phase)) {
+        ArrayCopyNode* ac = NULL;
+        if (ArrayCopyNode::may_modify(addr_t, mem->in(0)->as_MemBar(), phase, ac)) {
           break;
         }
         mem = mem->in(0)->in(TypeFunc::Memory);
--- a/hotspot/src/share/vm/opto/parse.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/opto/parse.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -166,14 +166,11 @@
     int                _all_successors; // Include exception paths also.
     Block**            _successors;
 
-    // Use init_node/init_graph to initialize Blocks.
-    // Block() : _live_locals((uintptr_t*)NULL,0) { ShouldNotReachHere(); }
-    Block() : _live_locals() { ShouldNotReachHere(); }
-
    public:
 
     // Set up the block data structure itself.
-    void init_node(Parse* outer, int po);
+    Block(Parse* outer, int rpo);
+
     // Set up the block's relations to other blocks.
     void init_graph(Parse* outer);
 
--- a/hotspot/src/share/vm/opto/parse1.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/opto/parse1.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1235,29 +1235,33 @@
   // Create the blocks.
   _block_count = flow()->block_count();
   _blocks = NEW_RESOURCE_ARRAY(Block, _block_count);
-  Copy::zero_to_bytes(_blocks, sizeof(Block)*_block_count);
-
-  int rpo;
 
   // Initialize the structs.
-  for (rpo = 0; rpo < block_count(); rpo++) {
+  for (int rpo = 0; rpo < block_count(); rpo++) {
     Block* block = rpo_at(rpo);
-    block->init_node(this, rpo);
+    new(block) Block(this, rpo);
   }
 
   // Collect predecessor and successor information.
-  for (rpo = 0; rpo < block_count(); rpo++) {
+  for (int rpo = 0; rpo < block_count(); rpo++) {
     Block* block = rpo_at(rpo);
     block->init_graph(this);
   }
 }
 
 //-------------------------------init_node-------------------------------------
-void Parse::Block::init_node(Parse* outer, int rpo) {
+Parse::Block::Block(Parse* outer, int rpo) : _live_locals() {
   _flow = outer->flow()->rpo_at(rpo);
   _pred_count = 0;
   _preds_parsed = 0;
   _count = 0;
+  _is_parsed = false;
+  _is_handler = false;
+  _has_merged_backedge = false;
+  _start_map = NULL;
+  _num_successors = 0;
+  _all_successors = 0;
+  _successors = NULL;
   assert(pred_count() == 0 && preds_parsed() == 0, "sanity");
   assert(!(is_merged() || is_parsed() || is_handler() || has_merged_backedge()), "sanity");
   assert(_live_locals.size() == 0, "sanity");
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -695,7 +695,7 @@
       // This can safepoint and redefine method, so need both new_obj and method
       // in a handle, for two different reasons.  new_obj can move, method can be
       // deleted if nothing is using it on the stack.
-      m->method_holder()->add_member_name(new_obj());
+      m->method_holder()->add_member_name(new_obj(), false);
     }
   }
 
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -319,15 +319,7 @@
 JvmtiEnv::GetObjectSize(jobject object, jlong* size_ptr) {
   oop mirror = JNIHandles::resolve_external_guard(object);
   NULL_CHECK(mirror, JVMTI_ERROR_INVALID_OBJECT);
-
-  if (mirror->klass() == SystemDictionary::Class_klass() &&
-      !java_lang_Class::is_primitive(mirror)) {
-    Klass* k = java_lang_Class::as_Klass(mirror);
-    assert(k != NULL, "class for non-primitive mirror must exist");
-    *size_ptr = (jlong)k->size() * wordSize;
-  } else {
-    *size_ptr = (jlong)mirror->size() * wordSize;
-    }
+  *size_ptr = (jlong)mirror->size() * wordSize;
   return JVMTI_ERROR_NONE;
 } /* end GetObjectSize */
 
--- a/hotspot/src/share/vm/prims/methodHandles.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -178,7 +178,7 @@
   return NULL;
 }
 
-oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
+oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info, bool intern) {
   assert(info.resolved_appendix().is_null(), "only normal methods here");
   methodHandle m = info.resolved_method();
   assert(m.not_null(), "null method handle");
@@ -279,13 +279,7 @@
   // If relevant, the vtable or itable value is stored as vmindex.
   // This is done eagerly, since it is readily available without
   // constructing any new objects.
-  // TO DO: maybe intern mname_oop
-  if (m->method_holder()->add_member_name(mname)) {
-    return mname();
-  } else {
-    // Redefinition caused this to fail.  Return NULL (and an exception?)
-    return NULL;
-  }
+  return m->method_holder()->add_member_name(mname, intern);
 }
 
 oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool is_setter) {
@@ -975,7 +969,9 @@
         if (!java_lang_invoke_MemberName::is_instance(result()))
           return -99;  // caller bug!
         CallInfo info(m);
-        oop saved = MethodHandles::init_method_MemberName(result, info);
+        // Since this is going through the methods to create MemberNames, don't search
+        // for matching methods already in the table
+        oop saved = MethodHandles::init_method_MemberName(result, info, /*intern*/false);
         if (saved != result())
           results->obj_at_put(rfill-1, saved);  // show saved instance to user
       } else if (++overflow >= overflow_limit) {
@@ -1056,9 +1052,34 @@
   }
 }
 
-void MemberNameTable::add_member_name(jweak mem_name_wref) {
+oop MemberNameTable::add_member_name(jweak mem_name_wref) {
   assert_locked_or_safepoint(MemberNameTable_lock);
   this->push(mem_name_wref);
+  return JNIHandles::resolve(mem_name_wref);
+}
+
+oop MemberNameTable::find_or_add_member_name(jweak mem_name_wref) {
+  assert_locked_or_safepoint(MemberNameTable_lock);
+  oop new_mem_name = JNIHandles::resolve(mem_name_wref);
+
+  // Find matching member name in the list.
+  // This is linear because these because these are short lists.
+  int len = this->length();
+  int new_index = len;
+  for (int idx = 0; idx < len; idx++) {
+    oop mname = JNIHandles::resolve(this->at(idx));
+    if (mname == NULL) {
+      new_index = idx;
+      continue;
+    }
+    if (java_lang_invoke_MemberName::equals(new_mem_name, mname)) {
+      JNIHandles::destroy_weak_global(mem_name_wref);
+      return mname;
+    }
+  }
+  // Not found, push the new one, or reuse empty slot
+  this->at_put_grow(new_index, mem_name_wref);
+  return new_mem_name;
 }
 
 #if INCLUDE_JVMTI
--- a/hotspot/src/share/vm/prims/methodHandles.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
   static Handle new_MemberName(TRAPS);  // must be followed by init_MemberName
   static oop init_MemberName(Handle mname_h, Handle target_h); // compute vmtarget/vmindex from target
   static oop init_field_MemberName(Handle mname_h, fieldDescriptor& fd, bool is_setter = false);
-  static oop init_method_MemberName(Handle mname_h, CallInfo& info);
+  static oop init_method_MemberName(Handle mname_h, CallInfo& info, bool intern = true);
   static int method_ref_kind(Method* m, bool do_dispatch_if_possible = true);
   static int find_MemberNames(KlassHandle k, Symbol* name, Symbol* sig,
                               int mflags, KlassHandle caller,
@@ -253,7 +253,8 @@
  public:
   MemberNameTable(int methods_cnt);
   ~MemberNameTable();
-  void add_member_name(jweak mem_name_ref);
+  oop add_member_name(jweak mem_name_ref);
+  oop find_or_add_member_name(jweak mem_name_ref);
 
 #if INCLUDE_JVMTI
   // RedefineClasses() API support:
--- a/hotspot/src/share/vm/prims/unsafe.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/prims/unsafe.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -356,19 +356,6 @@
   return JNIHandles::make_local(env, v);
 } UNSAFE_END
 
-UNSAFE_ENTRY(jclass, Unsafe_GetJavaMirror(JNIEnv *env, jobject unsafe, jlong metaspace_klass)) {
-  Klass* klass = (Klass*) (address) metaspace_klass;
-
-  return (jclass) JNIHandles::make_local(klass->java_mirror());
-} UNSAFE_END
-
-UNSAFE_ENTRY(jlong, Unsafe_GetKlassPointer(JNIEnv *env, jobject unsafe, jobject obj)) {
-  oop o = JNIHandles::resolve(obj);
-  jlong klass = (jlong) (address) o->klass();
-
-  return klass;
-} UNSAFE_END
-
 #ifndef SUPPORTS_NATIVE_CX8
 
 // VM_Version::supports_cx8() is a surrogate for 'supports atomic long memory ops'.
@@ -1152,8 +1139,6 @@
     {CC "putObjectVolatile",CC "(" OBJ "J" OBJ ")V",  FN_PTR(Unsafe_PutObjectVolatile)},
 
     {CC "getUncompressedObject", CC "(" ADR ")" OBJ,  FN_PTR(Unsafe_GetUncompressedObject)},
-    {CC "getJavaMirror",         CC "(" ADR ")" CLS,  FN_PTR(Unsafe_GetJavaMirror)},
-    {CC "getKlassPointer",       CC "(" OBJ ")" ADR,  FN_PTR(Unsafe_GetKlassPointer)},
 
     DECLARE_GETPUTOOP(Boolean, Z),
     DECLARE_GETPUTOOP(Byte, B),
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1433,6 +1433,10 @@
   return (jlong) MetaspaceGC::capacity_until_GC();
 WB_END
 
+WB_ENTRY(jboolean, WB_MetaspaceShouldConcurrentCollect(JNIEnv* env, jobject wb))
+  return MetaspaceGC::should_concurrent_collect();
+WB_END
+
 
 WB_ENTRY(void, WB_AssertMatchingSafepointCalls(JNIEnv* env, jobject o, jboolean mutexSafepointValue, jboolean attemptedNoSafepointValue))
   Monitor::SafepointCheckRequired sfpt_check_required = mutexSafepointValue ?
@@ -1813,6 +1817,7 @@
      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"metaspaceShouldConcurrentCollect", CC"()Z",     (void*)&WB_MetaspaceShouldConcurrentCollect },
   {CC"getCPUFeatures",     CC"()Ljava/lang/String;",  (void*)&WB_GetCPUFeatures     },
   {CC"getNMethod0",         CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
                                                       (void*)&WB_GetNMethod         },
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -498,6 +498,19 @@
   }
 #endif
 
+  if (thread->frames_to_pop_failed_realloc() > 0 && exec_mode != Unpack_uncommon_trap) {
+    assert(thread->has_pending_exception(), "should have thrown OOME");
+    thread->set_exception_oop(thread->pending_exception());
+    thread->clear_pending_exception();
+    exec_mode = Unpack_exception;
+  }
+
+#if INCLUDE_JVMCI
+  if (thread->frames_to_pop_failed_realloc() > 0) {
+    thread->set_pending_monitorenter(false);
+  }
+#endif
+
   UnrollBlock* info = new UnrollBlock(array->frame_size() * BytesPerWord,
                                       caller_adjustment * BytesPerWord,
                                       caller_was_method_handle ? 0 : callee_parameters,
--- a/hotspot/src/share/vm/runtime/java.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/runtime/java.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -446,6 +446,14 @@
     os::infinite_sleep();
   }
 
+  EventThreadEnd event;
+  if (event.should_commit()) {
+    event.set_thread(THREAD_TRACE_ID(thread));
+    event.commit();
+  }
+
+  TRACE_VM_EXIT();
+
   // Stop the WatcherThread. We do this before disenrolling various
   // PeriodicTasks to reduce the likelihood of races.
   if (PeriodicTask::num_tasks() > 0) {
@@ -484,13 +492,6 @@
     JvmtiExport::post_thread_end(thread);
   }
 
-
-  EventThreadEnd event;
-  if (event.should_commit()) {
-      event.set_thread(THREAD_TRACE_ID(thread));
-      event.commit();
-  }
-
   // Always call even when there are not JVMTI environments yet, since environments
   // may be attached late and JVMTI must track phases of VM execution
   JvmtiExport::post_vm_death();
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -274,7 +274,7 @@
   def(JfrMsg_lock                  , Monitor, leaf,        true,  Monitor::_safepoint_check_always);
   def(JfrBuffer_lock               , Mutex,   leaf,        true,  Monitor::_safepoint_check_never);
   def(JfrThreadGroups_lock         , Mutex,   leaf,        true,  Monitor::_safepoint_check_always);
-  def(JfrStream_lock               , Mutex,   nonleaf,     true,  Monitor::_safepoint_check_never);
+  def(JfrStream_lock               , Mutex,   leaf+1,      true,  Monitor::_safepoint_check_never);      // ensure to rank lower than 'safepoint'
   def(JfrStacktrace_lock           , Mutex,   special,     true,  Monitor::_safepoint_check_sometimes);
 #endif
 
--- a/hotspot/src/share/vm/runtime/reflectionUtils.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/runtime/reflectionUtils.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,10 +73,7 @@
 
 
 void FilteredFieldsMap::initialize() {
-  int offset;
-  offset = java_lang_Throwable::get_backtrace_offset();
-  _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset));
-  offset = reflect_ConstantPool::oop_offset();
+  int offset = reflect_ConstantPool::oop_offset();
   _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
   offset = reflect_UnsafeStaticFieldAccessorImpl::base_offset();
   _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -3405,6 +3405,8 @@
 //
 //     After phase 2, The VM will begin search classes from -Xbootclasspath/a.
 static void call_initPhase2(TRAPS) {
+  TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, modules, startuptime));
+
   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
   instanceKlassHandle klass (THREAD, k);
 
--- a/hotspot/src/share/vm/runtime/thread.inline.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/runtime/thread.inline.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -71,9 +71,12 @@
   jlong allocated_bytes = OrderAccess::load_acquire(&_allocated_bytes);
   if (UseTLAB) {
     size_t used_bytes = tlab().used_bytes();
-    if ((ssize_t)used_bytes > 0) {
-      // More-or-less valid tlab. The load_acquire above should ensure
-      // that the result of the add is <= the instantaneous value.
+    if (used_bytes <= ThreadLocalAllocBuffer::max_size_in_bytes()) {
+      // Comparing used_bytes with the maximum allowed size will ensure
+      // that we don't add the used bytes from a semi-initialized TLAB
+      // ending up with incorrect values. There is still a race between
+      // incrementing _allocated_bytes and clearing the TLAB, that might
+      // cause double counting in rare cases.
       return allocated_bytes + used_bytes;
     }
   }
--- a/hotspot/src/share/vm/runtime/vframeArray.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/runtime/vframeArray.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -171,6 +171,8 @@
                                          int exec_mode) {
   JavaThread* thread = (JavaThread*) Thread::current();
 
+  bool realloc_failure_exception = thread->frames_to_pop_failed_realloc() > 0;
+
   // Look at bci and decide on bcp and continuation pc
   address bcp;
   // C++ interpreter doesn't need a pc since it will figure out what to do when it
@@ -204,10 +206,12 @@
   //
   // For Compiler1, deoptimization can occur while throwing a NullPointerException at monitorenter,
   // in which case bcp should point to the monitorenter since it is within the exception's range.
+  //
+  // For realloc failure exception we just pop frames, skip the guarantee.
 
   assert(*bcp != Bytecodes::_monitorenter || is_top_frame, "a _monitorenter must be a top frame");
   assert(thread->deopt_compiled_method() != NULL, "compiled method should be known");
-  guarantee(!(thread->deopt_compiled_method()->is_compiled_by_c2() &&
+  guarantee(realloc_failure_exception || !(thread->deopt_compiled_method()->is_compiled_by_c2() &&
               *bcp == Bytecodes::_monitorenter             &&
               exec_mode == Deoptimization::Unpack_exception),
             "shouldn't get exception during monitorenter");
@@ -237,12 +241,17 @@
         // Deoptimization::fetch_unroll_info_helper
         popframe_preserved_args_size_in_words = in_words(thread->popframe_preserved_args_size_in_words());
       }
-    } else if (JvmtiExport::can_force_early_return() && state != NULL && state->is_earlyret_pending()) {
+    } else if (!realloc_failure_exception && JvmtiExport::can_force_early_return() && state != NULL && state->is_earlyret_pending()) {
       // Force early return from top frame after deoptimization
 #ifndef CC_INTERP
       pc = Interpreter::remove_activation_early_entry(state->earlyret_tos());
 #endif
     } else {
+      if (realloc_failure_exception && JvmtiExport::can_force_early_return() && state != NULL && state->is_earlyret_pending()) {
+        state->clr_earlyret_pending();
+        state->set_earlyret_oop(NULL);
+        state->clr_earlyret_value();
+      }
       // Possibly override the previous pc computation of the top (youngest) frame
       switch (exec_mode) {
       case Deoptimization::Unpack_deopt:
--- a/hotspot/src/share/vm/trace/traceBackend.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/trace/traceBackend.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -48,9 +48,6 @@
   static void on_unloading_classes(void) {
   }
 
-  static void on_vm_error(bool) {
-  }
-
 };
 
 class TraceThreadData {
--- a/hotspot/src/share/vm/trace/traceMacros.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/trace/traceMacros.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -43,6 +43,8 @@
 #define TRACE_REGISTER_NATIVES ((void*)((address_word)(&trace_register_natives)))
 #define TRACE_START() JNI_OK
 #define TRACE_INITIALIZE() JNI_OK
+#define TRACE_VM_EXIT()
+#define TRACE_VM_ERROR()
 
 #define TRACE_DEFINE_TRACE_ID_METHODS typedef int ___IGNORED_hs_trace_type1
 #define TRACE_DEFINE_TRACE_ID_FIELD typedef int ___IGNORED_hs_trace_type2
--- a/hotspot/src/share/vm/utilities/bitMap.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/utilities/bitMap.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -435,7 +435,6 @@
   void clear_bit(idx_t slot_index, idx_t bit_within_slot_index);
   void at_put(idx_t slot_index, idx_t bit_within_slot_index, bool value);
   void at_put_grow(idx_t slot_index, idx_t bit_within_slot_index, bool value);
-  void clear();
 };
 
 // Closure for iterating over BitMaps
--- a/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/utilities/bitMap.inline.hpp	Thu Jun 23 17:07:27 2016 -0700
@@ -367,8 +367,4 @@
   _map.at_put(bit, value);
 }
 
-inline void BitMap2D::clear() {
-  _map.clear();
-}
-
 #endif // SHARE_VM_UTILITIES_BITMAP_INLINE_HPP
--- a/hotspot/src/share/vm/utilities/debug.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -54,10 +54,6 @@
 #include "utilities/macros.hpp"
 #include "utilities/vmError.hpp"
 
-#if INCLUDE_TRACE
-#include "trace/tracing.hpp"
-#endif
-
 #include <stdio.h>
 
 #ifndef ASSERT
@@ -306,11 +302,6 @@
    exit(2);
 }
 
-static void notify_tracing() {
-#if INCLUDE_TRACE
-  Tracing::on_vm_error(true);
-#endif
-}
 
 void report_insufficient_metaspace(size_t required_size) {
   warning("\nThe MaxMetaspaceSize of " SIZE_FORMAT " bytes is not large enough.\n"
@@ -334,8 +325,6 @@
       HeapDumper::dump_heap_from_oome();
     }
 
-    notify_tracing();
-
     if (OnOutOfMemoryError && OnOutOfMemoryError[0]) {
       VMError::report_java_out_of_memory(message);
     }
--- a/hotspot/src/share/vm/utilities/vmError.cpp	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/src/share/vm/utilities/vmError.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -39,6 +39,7 @@
 #include "runtime/vmThread.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/memTracker.hpp"
+#include "trace/traceMacros.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/decoder.hpp"
 #include "utilities/defaultStream.hpp"
@@ -1165,6 +1166,8 @@
     // are handled properly.
     reset_signal_handlers();
 
+    TRACE_VM_ERROR();
+
   } else {
     // If UseOsErrorReporting we call this for each level of the call stack
     // while searching for the exception handler.  Only the first level needs
--- a/hotspot/test/TEST.ROOT	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/TEST.ROOT	Thu Jun 23 17:07:27 2016 -0700
@@ -1,4 +1,4 @@
-# 
+#
 # Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
@@ -19,7 +19,7 @@
 # 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.
-# 
+#
 
 #
 
@@ -31,10 +31,10 @@
 
 groups=TEST.groups [closed/TEST.groups]
 
-# Source files for classes that will be used at the beginning of each test suite run, 
-# to determine additional characteristics of the system for use with the @requires tag. 
+# Source files for classes that will be used at the beginning of each test suite run,
+# to determine additional characteristics of the system for use with the @requires tag.
 requires.extraPropDefns = ../../test/jtreg-ext/requires/VMProps.java
-requires.properties=sun.arch.data.model
+requires.properties=sun.arch.data.model vm.simpleArch vm.flightRecorder
 
 # Tests using jtreg 4.2 b02 features
 requiredVersion=4.2 b02
--- a/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/arraycopy/TestEliminatedArrayCopyDeopt.java	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,10 @@
 
 /*
  * @test
- * @bug 8130847
+ * @bug 8130847 8156760
  * @summary Eliminated instance/array written to by an array copy variant must be correctly initialized when reallocated at a deopt
  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestEliminatedArrayCopyDeopt
- *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestEliminatedArrayCopyDeopt
  */
 
 // Test that if an ArrayCopy node is eliminated because it doesn't
--- a/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/arraycopy/TestInstanceCloneAsLoadsStores.java	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,12 @@
 
 /*
  * @test
- * @bug 6700100
+ * @bug 6700100 8156760
  * @summary small instance clone as loads/stores
  * @compile TestInstanceCloneAsLoadsStores.java TestInstanceCloneUtils.java
  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* TestInstanceCloneAsLoadsStores
  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode TestInstanceCloneAsLoadsStores
- *
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestInstanceCloneAsLoadsStores
  */
 
 public class TestInstanceCloneAsLoadsStores extends TestInstanceCloneUtils {
--- a/hotspot/test/compiler/c2/6857159/Test6857159.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/c2/6857159/Test6857159.java	Thu Jun 23 17:07:27 2016 -0700
@@ -34,12 +34,12 @@
 import jdk.test.lib.*;
 
 public class Test6857159 {
-    public static void main(String[] args) throws Exception {
-        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbatch", "-XX:+PrintCompilation",
-                                                                  "-XX:CompileOnly=Test$ct.run", "Test");
-        OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+    public static void main(String[] args) throws Throwable {
+        OutputAnalyzer analyzer = ProcessTools.executeTestJvm("-Xbatch",
+                "-XX:+PrintCompilation", "-XX:CompileOnly=Test$ct.run", "Test");
         analyzer.shouldNotContain("COMPILE SKIPPED");
         analyzer.shouldContain("Test$ct0::run (16 bytes)");
+        analyzer.shouldHaveExitValue(0);
     }
 }
 
--- a/hotspot/test/compiler/c2/6857159/Test6857159.sh	Wed Jul 05 21:53:18 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#!/bin/sh
-# 
-# Copyright (c) 2009, 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.
-# 
-# 
-## some tests require path to find test source dir
-if [ "${TESTSRC}" = "" ]
-then
-  TESTSRC=${PWD}
-  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
-fi
-echo "TESTSRC=${TESTSRC}"
-## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../../test_env.sh
-
-set -x
-
-cp ${TESTSRC}/Test6857159.java .
-cp ${TESTSRC}/Test6857159.sh .
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} -d . Test6857159.java
-
-${TESTJAVA}/bin/java  ${TESTOPTS} -Xbatch -XX:+PrintCompilation -XX:CompileOnly=Test6857159\$ct.run Test6857159 > test.out 2>&1
-
-grep "COMPILE SKIPPED" test.out
-
-result=$?
-if [ $result -eq 1 ]
-then
-  echo "Passed"
-  exit 0
-else
-  echo "Failed"
-  exit 1
-fi
--- a/hotspot/test/compiler/c2/6894807/IsInstanceTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/c2/6894807/IsInstanceTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,8 +25,7 @@
  * @test
  * @bug 6894807
  * @summary No ClassCastException for HashAttributeSet constructors if run with -Xcomp
- * @compile IsInstanceTest.java
- * @run shell Test6894807.sh
+ * @run main IsInstanceTest
 */
 
 public class IsInstanceTest {
@@ -35,13 +34,7 @@
         BaseInterface baseInterfaceImpl = new BaseInterfaceImpl();
         for (int i = 0; i < 100000; i++) {
             if (isInstanceOf(baseInterfaceImpl, ExtendedInterface.class)) {
-                System.out.println("Failed at index:" + i);
-                System.out.println("Arch: "+System.getProperty("os.arch", "")+
-                                   " OS: "+System.getProperty("os.name", "")+
-                                   " OSV: "+System.getProperty("os.version", "")+
-                                   " Cores: "+Runtime.getRuntime().availableProcessors()+
-                                   " JVM: "+System.getProperty("java.version", "")+" "+System.getProperty("sun.arch.data.model", ""));
-                break;
+                throw new AssertionError("Failed at index:" + i);
             }
         }
         System.out.println("Done!");
--- a/hotspot/test/compiler/c2/6894807/Test6894807.sh	Wed Jul 05 21:53:18 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#!/bin/sh
-#
-#  Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
-#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
-#  This code is free software; you can redistribute it and/or modify it
-#  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.
-# 
-
-if [ "${TESTSRC}" = "" ]
-then
-  TESTSRC=${PWD}
-  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
-fi
-echo "TESTSRC=${TESTSRC}"
-
-## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../../test_env.sh
-
-${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} IsInstanceTest > test.out 2>&1
-
-cat test.out
-
-grep "Failed at index" test.out
-
-if [ $? = 0 ]
-then
-    echo "Test Failed"
-    exit 1
-else
-    echo "Test Passed"
-    exit 0
-fi
--- a/hotspot/test/compiler/c2/7070134/Stemmer.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/c2/7070134/Stemmer.java	Thu Jun 23 17:07:27 2016 -0700
@@ -2,8 +2,10 @@
  * @test
  * @bug 7070134
  * @summary Hotspot crashes with sigsegv from PorterStemmer
- *
- * @run shell Test7070134.sh
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary
+ * @run driver jdk.test.lib.FileInstaller words words
+ * @run main/othervm -Xbatch Stemmer words
  */
 
 /*
@@ -61,7 +63,7 @@
   * by calling one of the various stem(something) methods.
   */
 
-class Stemmer
+public class Stemmer
 {  private char[] b;
    private int i,     /* offset into b */
                i_end, /* offset to end of stemmed word */
--- a/hotspot/test/compiler/c2/7070134/Test7070134.sh	Wed Jul 05 21:53:18 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#!/bin/sh
-# 
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-# 
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-# 
-# 
-## some tests require path to find test source dir
-if [ "${TESTSRC}" = "" ]
-then
-  TESTSRC=${PWD}
-  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
-fi
-echo "TESTSRC=${TESTSRC}"
-## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../../test_env.sh
-
-set -x
-
-cp ${TESTSRC}/Stemmer.java .
-cp ${TESTSRC}/words .
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} -d . Stemmer.java
-
-${TESTJAVA}/bin/java ${TESTOPTS} -Xbatch Stemmer words > test.out 2>&1
-
-exit $?
-
--- a/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/codecache/jmx/PoolsIndependenceTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -38,6 +38,7 @@
 /*
  * @test PoolsIndependenceTest
  * @modules java.base/jdk.internal.misc
+ *          java.management
  * @library /testlibrary /test/lib
  * @build PoolsIndependenceTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/cpuflags/TestSSE4Disabled.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 TestSSE4Disabled
+ * @bug 8158214
+ * @requires (vm.simpleArch == "x64")
+ * @summary Test correct execution without SSE 4.
+ * @run main/othervm -Xcomp -XX:UseSSE=3 TestSSE4Disabled
+ */
+public class TestSSE4Disabled {
+    public static void main(String args[]) {
+        System.out.println("Passed");
+    }
+}
+
--- a/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/floatingpoint/Test15FloatJNIArgs.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,9 +25,9 @@
  * @bug 8139258
  * @summary Regression test for 8139258 which failed to properly pass float args
  *          to a jni function on ppc64le.
- * @run main/othervm -Xint Test15FloatJNIArgs
- * @run main/othervm -XX:+TieredCompilation -Xcomp Test15FloatJNIArgs
- * @run main/othervm -XX:-TieredCompilation -Xcomp Test15FloatJNIArgs
+ * @run main/othervm/native -Xint Test15FloatJNIArgs
+ * @run main/othervm/native -XX:+TieredCompilation -Xcomp Test15FloatJNIArgs
+ * @run main/othervm/native -XX:-TieredCompilation -Xcomp Test15FloatJNIArgs
  */
 
 public class Test15FloatJNIArgs {
--- a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  * @modules jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/SecurityRestrictionsTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library common/patches
  * @modules java.base/jdk.internal.misc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,1 @@
+compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/common/services/jdk.vm.ci.runtime.services.JVMCICompilerFactory	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,1 @@
+compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
--- a/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/CollectCountersTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib/
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DebugOutputTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -21,7 +21,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @ignore 8139383
--- a/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/FindUniqueConcreteMethodTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetBytecodeTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetClassInitializerTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
@@ -138,17 +138,6 @@
                 return CompilerToVMHelper.getConstantPool(cpInst, ptr);
             }
         },
-        OBJECT_TYPE_BASE {
-            @Override
-            ConstantPool getConstantPool() {
-                HotSpotResolvedObjectType type
-                        = HotSpotResolvedObjectType.fromObjectClass(
-                                OBJECT_TYPE_BASE.getClass());
-                long ptrToClass = UNSAFE.getKlassPointer(OBJECT_TYPE_BASE);
-                return CompilerToVMHelper.getConstantPool(type,
-                        getPtrToCpAddress() - ptrToClass);
-            }
-        },
         ;
         abstract ConstantPool getConstantPool();
     }
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetExceptionTableTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetImplementorTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib/
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLineNumberTableTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @library ../common/patches
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetLocalVariableTableTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetMaxCallTargetOffsetTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib/
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetNextStackFrameTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodAtSlotTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
  /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,8 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @ignore 8158860
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
@@ -149,25 +150,12 @@
                         ptr, COMPRESSED);
             }
         },
-        OBJECT_TYPE_BASE {
-            @Override
-            HotSpotResolvedObjectType getResolvedJavaType() {
-                HotSpotResolvedObjectType type
-                        = HotSpotResolvedObjectType.fromObjectClass(
-                        OBJECT_TYPE_BASE.getClass());
-                long ptrToClass = UNSAFE.getKlassPointer(OBJECT_TYPE_BASE);
-                return CompilerToVMHelper.getResolvedJavaType(type,
-                        getPtrToKlass() - ptrToClass, COMPRESSED);
-            }
-        },
         ;
         abstract HotSpotResolvedObjectType getResolvedJavaType();
     }
 
     private static final Unsafe UNSAFE = Utils.getUnsafe();
     private static final WhiteBox WB = WhiteBox.getWhiteBox();
-    private static final long PTR = UNSAFE.getKlassPointer(
-            new GetResolvedJavaTypeTest());
     private static final Class TEST_CLASS = GetResolvedJavaTypeTest.class;
     /* a compressed parameter for tested method is set to false because
        unsafe.getKlassPointer always returns uncompressed pointer */
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetStackTraceElementTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetSymbolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/GetVtableIndexForInterfaceTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/HasFinalizableSubclassTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InitializeConfigurationTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/IsMatureTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/JVM_RegisterJVMCINatives.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @summary Testing compiler.jvmci.CompilerToVM.lookupKlassInPool method
  * @library /testlibrary /test/lib /
  * @library ../common/patches
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8138708
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8138708
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8138708
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8138708
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8138708
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/LookupTypeTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ReprofileTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8138708
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveMethodTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8138708
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @summary Testing compiler.jvmci.CompilerToVM.resolveTypeInPool method
  * @library /testlibrary /test/lib /
  * @library ../common/patches
--- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldDebugNonSafepointsTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary /test/lib/
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,7 +25,7 @@
 /**
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.code.site
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.code.site
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.code.site
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.config	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,1 @@
+compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8156034
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
+ * @library / /testlibrary
+ * @library ../common/patches
+ * @modules java.base/jdk.internal.misc
+            java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.org.objectweb.asm.tree
+ *          jdk.vm.ci/jdk.vm.ci.hotspot
+ *          jdk.vm.ci/jdk.vm.ci.code
+ *          jdk.vm.ci/jdk.vm.ci.meta
+ *          jdk.vm.ci/jdk.vm.ci.runtime
+ * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
+ * @build compiler.jvmci.common.JVMCIHelpers
+ *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
+ * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
+ * @run main jdk.test.lib.FileInstaller ./JvmciNotifyBootstrapFinishedEventTest.config
+ *     ./META-INF/services/jdk.vm.ci.hotspot.services.HotSpotVMEventListener
+ * @run main ClassFileInstaller
+ *     compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
+ *     compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
+ *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
+ *     jdk.test.lib.Asserts
+ *     jdk.test.lib.Utils
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ *     -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
+ *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
+ *     -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=false
+ *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
+ *     -Djvmci.Compiler=EmptyCompiler -Xbootclasspath/a:.
+ *     -XX:+UseJVMCICompiler -XX:+BootstrapJVMCI
+ *     -Dcompiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap=true
+ *     compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
+ */
+
+package compiler.jvmci.events;
+
+import jdk.test.lib.Asserts;
+import jdk.vm.ci.hotspot.services.HotSpotVMEventListener;
+
+public class JvmciNotifyBootstrapFinishedEventTest extends HotSpotVMEventListener {
+    private static final boolean BOOTSTRAP = Boolean
+            .getBoolean("compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest.bootstrap");
+    private static volatile int gotBoostrapNotification = 0;
+
+    public static void main(String args[]) {
+        if (BOOTSTRAP) {
+            Asserts.assertEQ(gotBoostrapNotification, 1, "Did not receive expected number of bootstrap events");
+        } else {
+            Asserts.assertEQ(gotBoostrapNotification, 0, "Got unexpected bootstrap event");
+        }
+    }
+
+    @Override
+    public void notifyBootstrapFinished() {
+        gotBoostrapNotification++;
+    }
+}
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library / /testlibrary
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/events/JvmciShutdownEventTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8136421
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/DataPatchTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9") & os.arch != "aarch64"
  * @library /
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/InterpreterFrameSizeTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9") & os.arch != "aarch64"
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.code.site
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleCodeInstallationTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9") & os.arch != "aarch64"
  * @library /
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/SimpleDebugInfoTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9") & os.arch != "aarch64"
  * @library /
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.code.test/src/jdk/vm/ci/code/test/VirtualObjectDebugInfoTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9") & os.arch != "aarch64"
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9") & os.arch != "aarch64"
  * @library /
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test jdk.vm.ci.hotspot.test.HotSpotConstantReflectionProviderTest
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @modules jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8152341
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.common
@@ -49,26 +49,6 @@
     private static final MemoryAccessProvider PROVIDER = JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection().getMemoryAccessProvider();
 
     @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class)
-    public void testPositiveReadUnsafeConstant(JavaKind kind, JavaConstant base, Long offset, Object expected, int bitsCount) {
-        Assert.assertEquals(PROVIDER.readUnsafeConstant(kind, base, offset), expected, "Failed to read constant");
-    }
-
-    @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
-    public void testReadUnsafeConstantNullBase(JavaKind kind, JavaConstant base, Long offset, Object expected, int bitsCount) {
-        PROVIDER.readUnsafeConstant(kind, null, offset);
-    }
-
-    @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
-    public void testNegativeReadUnsafeConstantNullKind(JavaKind kind, JavaConstant base, Long offset, Object expected, int bitsCount) {
-        Assert.assertNull(PROVIDER.readUnsafeConstant(null, base, offset), "Expected null return");
-    }
-
-    @Test(dataProvider = "negative", dataProviderClass = MemoryAccessProviderData.class, expectedExceptions = {IllegalArgumentException.class})
-    public void testNegativeReadUnsafeConstant(JavaKind kind, JavaConstant base) {
-        PROVIDER.readUnsafeConstant(kind, base, 0L);
-    }
-
-    @Test(dataProvider = "positivePrimitive", dataProviderClass = MemoryAccessProviderData.class)
     public void testPositiveReadPrimitiveConstant(JavaKind kind, Constant base, Long offset, Object expected, int bitsCount) {
         Assert.assertEquals(PROVIDER.readPrimitiveConstant(kind, base, offset, bitsCount), expected, "Failed to read constant");
     }
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MethodHandleAccessProviderTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8152343
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /compiler/jvmci/jdk.vm.ci.hotspot.test/src
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ConstantTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
@@ -31,7 +31,6 @@
  * @build jdk.vm.ci.runtime.test.ConstantTest
  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ConstantTest
  */
-// * @compile ConstantTest.java FieldUniverse.java TypeUniverse.java TestMetaAccessProvider.java
 package jdk.vm.ci.runtime.test;
 
 import org.junit.Assert;
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/RedefineClassTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveConcreteMethodTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ResolvedJavaTypeResolveConcreteMethodTest
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/ResolvedJavaTypeResolveMethodTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
  * @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI jdk.vm.ci.runtime.test.ResolvedJavaTypeResolveMethodTest
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestConstantReflectionProvider.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaField.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaMethod.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestJavaType.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaField.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library ../../../../../
  * @modules java.base/jdk.internal.reflect
  *          jdk.vm.ci/jdk.vm.ci.meta
--- a/hotspot/test/compiler/jvmci/meta/StableFieldTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/compiler/jvmci/meta/StableFieldTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 8151664
- * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
+ * @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  * @modules java.base/jdk.internal.vm.annotation
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/stable/TestStableMismatched.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 TestStableMismatched
+ * @bug 8158228
+ * @summary Tests if mismatched char load from stable byte[] returns correct result
+ * @run main/othervm -XX:-CompactStrings -XX:TieredStopAtLevel=1 -Xcomp
+ *                   -XX:CompileOnly=TestStableMismatched::test,::charAt
+ *                   TestStableMismatched
+ * @run main/othervm -XX:-CompactStrings -XX:-TieredCompilation -Xcomp
+ *                   -XX:CompileOnly=TestStableMismatched::test,::charAt
+ *                   TestStableMismatched
+ */
+public class TestStableMismatched {
+    public static void main(String args[]) {
+        test();
+    }
+
+    public static void test() {
+        String text = "abcdefg";
+        // Mismatched char load from @Stable byte[] String.value field
+        char returned = text.charAt(6);
+        if (returned != 'g') {
+            throw new RuntimeException("failed: charAt(6) returned '" + returned + "' instead of 'g'");
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/uncommontrap/DeoptReallocFailure.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8146416
+ * @library /test/lib /testlibrary /
+ * @build sun.hotspot.WhiteBox
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbatch -XX:CompileCommand=exclude,DeoptReallocFailure::main -Xmx100m DeoptReallocFailure
+ *
+ */
+import java.lang.reflect.Method;
+import sun.hotspot.WhiteBox;
+
+class MemoryChunk {
+    MemoryChunk other;
+    Object[][] array;
+
+    MemoryChunk(MemoryChunk other) {
+        this.other = other;
+        array = new Object[1024 * 256][];
+    }
+}
+
+class NoEscape {
+    long f1;
+}
+
+public class DeoptReallocFailure {
+
+    static MemoryChunk root;
+    private static final WhiteBox WB = WhiteBox.getWhiteBox();
+
+    public static synchronized long  test() {
+        NoEscape[] noEscape = new NoEscape[45];
+        noEscape[0] = new NoEscape();
+        for (int i=0;i<1024*256;i++) {
+           root.array[i]= new Object[45];
+        }
+        return noEscape[0].f1;
+    }
+
+    public static void main(String[] args) throws Throwable {
+
+        //Exhaust Memory
+        root = null;
+        try {
+            while (true) {
+                root = new MemoryChunk(root);
+            }
+        } catch (OutOfMemoryError oom) {
+        }
+
+        if (root == null) {
+          return;
+        }
+
+        try {
+            NoEscape dummy = new NoEscape();
+            Method m = DeoptReallocFailure.class.getMethod("test");
+            WB.enqueueMethodForCompilation(m, 4);
+            test();
+        } catch (OutOfMemoryError oom) {
+            root = null;
+            oom.printStackTrace();
+        }
+        System.out.println("TEST PASSED");
+    }
+}
--- a/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/arguments/TestTargetSurvivorRatioFlag.java	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test TestTargetSurvivorRatioFlag
  * @key gc
  * @summary Verify that option TargetSurvivorRatio affects survivor space occupancy after minor GC.
+ * @requires (vm.opt.ExplicitGCInvokesConcurrent == null) | (vm.opt.ExplicitGCInvokesConcurrent == false)
+ * @requires (vm.opt.UseJVMCICompiler == null) | (vm.opt.UseJVMCICompiler == false)
  * @library /testlibrary /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/GC.java	Thu Jun 23 17:07:27 2016 -0700
@@ -38,6 +38,61 @@
  * referenced objects after GCs
  */
 public enum GC {
+    CMC {
+        @Override
+        public Runnable get() {
+            return () -> {
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+                WHITE_BOX.g1StartConcMarkCycle();
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+            };
+        }
+
+        public Consumer<ReferenceInfo<Object[]>> getChecker() {
+            return getCheckerImpl(false, false, true, false);
+        }
+
+        @Override
+        public List<String> shouldContain() {
+            return Arrays.asList(GCTokens.WB_INITIATED_CMC);
+        }
+
+        @Override
+        public List<String> shouldNotContain() {
+            return Arrays.asList(GCTokens.WB_INITIATED_YOUNG_GC, GCTokens.WB_INITIATED_MIXED_GC,
+                    GCTokens.FULL_GC, GCTokens.YOUNG_GC);
+        }
+    },
+
+    CMC_NO_SURV_ROOTS {
+        @Override
+        public Runnable get() {
+            return () -> {
+                WHITE_BOX.youngGC();
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+                WHITE_BOX.youngGC();
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+
+                WHITE_BOX.g1StartConcMarkCycle();
+                Helpers.waitTillCMCFinished(WHITE_BOX, 0);
+            };
+        }
+
+        public Consumer<ReferenceInfo<Object[]>> getChecker() {
+            return getCheckerImpl(true, false, true, false);
+        }
+
+        @Override
+        public List<String> shouldContain() {
+            return Arrays.asList(GCTokens.WB_INITIATED_CMC);
+        }
+
+        @Override
+        public List<String> shouldNotContain() {
+            return Arrays.asList(GCTokens.WB_INITIATED_MIXED_GC,
+                    GCTokens.FULL_GC, GCTokens.YOUNG_GC);
+        }
+    },
 
     YOUNG_GC {
         @Override
@@ -60,6 +115,7 @@
                     GCTokens.CMC, GCTokens.YOUNG_GC);
         }
     },
+
     FULL_GC {
         @Override
         public Runnable get() {
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/README	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/README	Thu Jun 23 17:07:27 2016 -0700
@@ -31,6 +31,13 @@
 
 3. Full GC with memory pressure - weakly and softly referenced non-humongous and humongous objects are collected.
 
+4. CMC -  weakly referenced non-humongous objects are collected, other objects are not collected since weak references
+          from Young Gen is handled as strong during CMC.
+
+5. CMC_NO_SURV_ROOTS -  weakly referenced non-humongous and humongous objects are collected, softly referenced
+                        non-humongous and humongous objects are not collected since we make 2 Young GC to promote all
+                        weak references to Old Gen.
+
 The test gets gc type as a command line argument.
 Then the test allocates object graph in heap (currently testing scenarios are pre-generated and stored in
 TestcaseData.getPregeneratedTestcases()) with TestObjectGraphAfterGC::allocateObjectGraph.
--- a/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/g1/humongousObjects/objectGraphTest/TestObjectGraphAfterGC.java	Thu Jun 23 17:07:27 2016 -0700
@@ -77,6 +77,14 @@
  * -XX:G1HeapRegionSize=1M -Xlog:gc=info:file=TestObjectGraphAfterGC_FULL_GC_MEMORY_PRESSURE.gc.log
  * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC FULL_GC_MEMORY_PRESSURE
  *
+ * @run main/othervm -Xms200M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:G1HeapRegionSize=1M -Xlog:gc=info:file=TestObjectGraphAfterGC_CMC.gc.log -XX:MaxTenuringThreshold=16
+ * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC CMC
+ *
+ * @run main/othervm -Xms200M -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
+ * -XX:G1HeapRegionSize=1M -Xlog:gc=info:file=TestObjectGraphAfterGC_CMC_NO_SURV_ROOTS.gc.log -XX:MaxTenuringThreshold=1
+ * gc.g1.humongousObjects.objectGraphTest.TestObjectGraphAfterGC CMC_NO_SURV_ROOTS
+ *
  */
 
 /**
--- a/hotspot/test/gc/g1/ihop/TestIHOPErgo.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/g1/ihop/TestIHOPErgo.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,8 +25,8 @@
  * @test TestIHOPErgo
  * @bug 8148397
  * @summary Test checks that behavior of Adaptive and Static IHOP at concurrent cycle initiation
- * @requires vm.gc=="G1" | vm.gc=="null"
- * @requires vm.opt.FlightRecorder != true
+ * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires !vm.flightRecorder
  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  * @requires vm.opt.MaxGCPauseMillis == "null"
  * @library /testlibrary /test/lib /
--- a/hotspot/test/gc/g1/ihop/TestIHOPStatic.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/g1/ihop/TestIHOPStatic.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,8 +25,8 @@
  * @test TestIHOPStatic
  * @bug 8148397
  * @summary Test checks concurrent cycle initiation which depends on IHOP value.
- * @requires vm.gc=="G1" | vm.gc=="null"
- * @requires vm.opt.FlightRecorder != true
+ * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires !vm.flightRecorder
  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  * @library /testlibrary /
  * @modules java.base/jdk.internal.misc
--- a/hotspot/test/gc/g1/plab/TestPLABPromotion.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/g1/plab/TestPLABPromotion.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,8 +25,8 @@
  * @test TestPLABPromotion
  * @bug 8141278 8141141
  * @summary Test PLAB promotion
- * @requires vm.gc=="G1" | vm.gc=="null"
- * @requires vm.opt.FlightRecorder != true
+ * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires !vm.flightRecorder
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  * @modules java.management
--- a/hotspot/test/gc/g1/plab/TestPLABResize.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/g1/plab/TestPLABResize.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,8 +25,8 @@
  * @test TestPLABResize
  * @bug 8141278 8141141
  * @summary Test for PLAB resizing
- * @requires vm.gc=="G1" | vm.gc=="null"
- * @requires vm.opt.FlightRecorder != true
+ * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires !vm.flightRecorder
  * @library /testlibrary /test/lib /
  * @modules java.base/jdk.internal.misc
  * @modules java.management
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/metaspace/TestMetaspaceCMSCancel.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.Asserts;
+import sun.hotspot.WhiteBox;
+
+/* @test TestMetaspaceCMSCancel
+ * @bug 8026752
+ * @summary Tests cancel of CMS concurrent cycle for Metaspace after a full GC
+ * @library /testlibrary /test/lib /test/lib/share/classes
+ * @modules java.base/jdk.internal.misc
+ * @build TestMetaspaceCMSCancel
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm TestMetaspaceCMSCancel
+ */
+
+
+public class TestMetaspaceCMSCancel {
+
+    public static void main(String[] args) throws Exception {
+        // Set a small MetaspaceSize so that a CMS concurrent collection will be
+        // scheduled.  Set CMSWaitDuration to 5s so that the concurrent collection
+        // start may be delayed.  It does not guarantee 5s before the start of the
+        // concurrent collection but does increase the probability that it will
+        // be started later.  System.gc() is used to invoke a full collection.  Set
+        // ExplicitGCInvokesConcurrent to off so it is a STW collection.
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xbootclasspath/a:.",
+                                                                  "-XX:+UnlockDiagnosticVMOptions",
+                                                                  "-XX:+WhiteBoxAPI",
+                                                                  "-XX:+UseConcMarkSweepGC",
+                                                                  "-XX:MetaspaceSize=2m",
+                                                                  "-XX:CMSWaitDuration=5000",
+                                                                  "-XX:-ExplicitGCInvokesConcurrent",
+                                                                  "-Xlog:gc*=debug",
+                                                                  MetaspaceGCTest.class.getName());
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("Concurrent Reset");
+        output.shouldHaveExitValue(0);
+    }
+
+    static class MetaspaceGCTest {
+        public static void main(String [] args) {
+            WhiteBox wb = WhiteBox.getWhiteBox();
+            System.gc();
+            Asserts.assertFalse(wb.metaspaceShouldConcurrentCollect());
+        }
+    }
+}
--- a/hotspot/test/gc/stress/TestGCOld.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/stress/TestGCOld.java	Thu Jun 23 17:07:27 2016 -0700
@@ -32,6 +32,7 @@
  * @run main/othervm -Xmx384M -XX:+UseParallelGC -XX:-UseParallelOldGC TestGCOld 50 1 20 10 10000
  * @run main/othervm -Xmx384M -XX:+UseConcMarkSweepGC TestGCOld 50 1 20 10 10000
  * @run main/othervm -Xmx384M -XX:+UseG1GC TestGCOld 50 1 20 10 10000
+ * @run main/othervm -Xms64m -Xmx128m -XX:+UseG1GC -XX:+UseDynamicNumberOfGCThreads -Xlog:gc,gc+task=trace TestGCOld 50 5 20 1 5000
  */
 
 import java.text.*;
--- a/hotspot/test/gc/stress/TestStressG1Humongous.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/gc/stress/TestStressG1Humongous.java	Thu Jun 23 17:07:27 2016 -0700
@@ -26,7 +26,8 @@
  * @key gc
  * @key stress
  * @summary Stress G1 by humongous allocations in situation near OOM
- * @requires vm.gc=="G1" | vm.gc=="null"
+ * @requires vm.gc == "G1" | vm.gc == "null"
+ * @requires !vm.flightRecorder
  * @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=4m
  *              -Dtimeout=120 -Dthreads=3 -Dhumongoussize=1.1 -Dregionsize=4 TestStressG1Humongous
  * @run main/othervm/timeout=200 -Xlog:gc=debug -Xmx1g -XX:+UseG1GC -XX:G1HeapRegionSize=16m
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/runtime/test_classLoader.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "classfile/classLoader.hpp"
+#include "memory/resourceArea.hpp"
+#include "unittest.hpp"
+
+// Tests ClassLoader::package_from_name()
+TEST_VM(classLoader, null_class_name) {
+  ResourceMark rm;
+  bool bad_class_name = false;
+  const char* retval= ClassLoader::package_from_name(NULL, &bad_class_name);
+  ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with NULL class name";
+  ASSERT_STREQ(retval, NULL) << "Wrong package for NULL class name pointer";
+}
+
+TEST_VM(classLoader, empty_class_name) {
+  ResourceMark rm;
+  const char* retval = ClassLoader::package_from_name("");
+  ASSERT_STREQ(retval, NULL) << "Wrong package for empty string";
+}
+
+TEST_VM(classLoader, no_slash) {
+  ResourceMark rm;
+  const char* retval = ClassLoader::package_from_name("L");
+  ASSERT_STREQ(retval, NULL) << "Wrong package for class with no slashes";
+}
+
+TEST_VM(classLoader, just_slash) {
+  ResourceMark rm;
+  bool bad_class_name = false;
+  const char* retval = ClassLoader::package_from_name("/", &bad_class_name);
+  ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with package of length 0";
+  ASSERT_STREQ(retval, NULL) << "Wrong package for class with just slash";
+}
+
+TEST_VM(classLoader, multiple_slashes) {
+  ResourceMark rm;
+  const char* retval = ClassLoader::package_from_name("///");
+  ASSERT_STREQ(retval, "//") << "Wrong package for class with just slashes";
+}
+
+TEST_VM(classLoader, standard_case_1) {
+  ResourceMark rm;
+  bool bad_class_name = true;
+  const char* retval = ClassLoader::package_from_name("package/class", &bad_class_name);
+  ASSERT_FALSE(bad_class_name) << "Function did not reset bad_class_name";
+  ASSERT_STREQ(retval, "package") << "Wrong package for class with one slash";
+}
+
+TEST_VM(classLoader, standard_case_2) {
+  ResourceMark rm;
+  const char* retval = ClassLoader::package_from_name("package/folder/class");
+  ASSERT_STREQ(retval, "package/folder") << "Wrong package for class with multiple slashes";
+}
+
+TEST_VM(classLoader, class_array) {
+  ResourceMark rm;
+  bool bad_class_name = false;
+  const char* retval = ClassLoader::package_from_name("[package/class", &bad_class_name);
+  ASSERT_FALSE(bad_class_name) << "Function set bad_class_name with class array";
+  ASSERT_STREQ(retval, "package") << "Wrong package for class with leading bracket";
+}
+
+TEST_VM(classLoader, class_object_array) {
+  ResourceMark rm;
+  bool bad_class_name = false;
+  const char* retval = ClassLoader::package_from_name("[Lpackage/class", &bad_class_name);
+  ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with array of class objects";
+  ASSERT_STREQ(retval, NULL) << "Wrong package for class with leading '[L'";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/native/runtime/test_instanceKlass.cpp	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "classfile/symbolTable.hpp"
+#include "memory/resourceArea.hpp"
+#include "oops/instanceKlass.hpp"
+#include "unittest.hpp"
+
+// Tests InstanceKlass::package_from_name()
+TEST_VM(instanceKlass, null_symbol) {
+  ResourceMark rm;
+  TempNewSymbol package_sym = InstanceKlass::package_from_name(NULL, NULL);
+  ASSERT_TRUE(package_sym == NULL) << "Wrong package for NULL symbol";
+}
--- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,8 +48,9 @@
 
     public static void main(String[] args) throws Exception {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-Xmx64m", "-XX:-TransmitErrorReport", "-XX:-CreateCoredumpOnCrash", Crasher.class.getName());
+            "-Xmx64m", "-XX:-TransmitErrorReport", "-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED", "-XX:-CreateCoredumpOnCrash", Crasher.class.getName());
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("Exception in thread");
         output.shouldNotMatch("error occurred during error reporting \\(printing problematic frame\\)");
     }
 }
--- a/hotspot/test/runtime/NMT/CommitOverlappingRegions.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/runtime/NMT/CommitOverlappingRegions.java	Thu Jun 23 17:07:27 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,12 @@
     public static WhiteBox wb = WhiteBox.getWhiteBox();
     public static void main(String args[]) throws Exception {
         OutputAnalyzer output;
+
         long size = 32 * 1024;
+        int pagesize = wb.getVMPageSize();
+        if (size < pagesize) { size = pagesize; }  // Should be aligned.
+        long sizek = size / 1024;
+
         long addr = wb.NMTReserveMemory(8*size);
 
         String pid = Long.toString(ProcessTools.getProcessId());
@@ -52,93 +57,93 @@
 
         // Start: . . . . . . . .
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=0KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=0KB)");
 
         // Committing: * * * . . . . .
         // Region:     * * * . . . . .
-        // Expected Total: 3 x 32KB = 96KB
+        // Expected Total: 3 x sizek KB
         wb.NMTCommitMemory(addr + 0*size, 3*size);
 
         // Committing: . . . . * * * .
         // Region:     * * * . * * * .
-        // Expected Total: 6 x 32KB = 192KB
+        // Expected Total: 6 x sizek KB
         wb.NMTCommitMemory(addr + 4*size, 3*size);
 
         // Check output after first 2 commits.
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=192KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 6*sizek + "KB)");
 
         // Committing: . . * * * . . .
         // Region:     * * * * * * * .
-        // Expected Total: 7 x 32KB = 224KB
+        // Expected Total: 7 x sizek KB
         wb.NMTCommitMemory(addr + 2*size, 3*size);
 
         // Check output after overlapping commit.
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=224KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 7*sizek + "KB)");
 
         // Uncommitting: * * * * * * * *
         // Region:       . . . . . . . .
-        // Expected Total: 0 x 32KB = 0KB
+        // Expected Total: 0 x sizek KB
         wb.NMTUncommitMemory(addr + 0*size, 8*size);
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=0KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=0KB)");
 
         // Committing: * * . . . . . .
         // Region:     * * . . . . . .
-        // Expected Total: 2 x 32KB = 64KB
+        // Expected Total: 2 x sizek KB
         wb.NMTCommitMemory(addr + 0*size, 2*size);
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=64KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 2*sizek + "KB)");
 
         // Committing: . * * * . . . .
         // Region:     * * * * . . . .
-        // Expected Total: 4 x 32KB = 128KB
+        // Expected Total: 4 x sizek KB
         wb.NMTCommitMemory(addr + 1*size, 3*size);
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=128KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 4*sizek + "KB)");
 
         // Uncommitting: * * * . . . . .
         // Region:       . . . * . . . .
-        // Expected Total: 1 x 32KB = 32KB
+        // Expected Total: 1 x sizek KB
         wb.NMTUncommitMemory(addr + 0*size, 3*size);
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=32KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 1*sizek + "KB)");
 
         // Committing: . . . * * . . .
         // Region:     . . . * * . . .
-        // Expected Total: 2 x 32KB = 64KB
+        // Expected Total: 2 x sizek KB
         wb.NMTCommitMemory(addr + 3*size, 2*size);
         System.out.println("Address is " + Long.toHexString(addr + 3*size));
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=64KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 2*sizek + "KB)");
 
         // Committing: . . . . * * . .
         // Region:     . . . * * * . .
-        // Expected Total: 3 x 32KB = 96KB
+        // Expected Total: 3 x sizek KB
         wb.NMTCommitMemory(addr + 4*size, 2*size);
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=96KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 3*sizek + "KB)");
 
         // Committing: . . . . . * * .
         // Region:     . . . * * * * .
-        // Expected Total: 4 x 32KB = 128KB
+        // Expected Total: 4 x sizek KB
         wb.NMTCommitMemory(addr + 5*size, 2*size);
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=128KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 4*sizek + "KB)");
 
         // Committing: . . . . . . * *
         // Region:     . . . * * * * *
-        // Expected Total: 5 x 32KB = 160KB
+        // Expected Total: 5 x sizek KB
         wb.NMTCommitMemory(addr + 6*size, 2*size);
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=160KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=" + 5*sizek + "KB)");
 
         // Uncommitting: * * * * * * * *
         // Region:       . . . . . . . .
-        // Expected Total: 0 x 32KB = 32KB
+        // Expected Total: 0 x sizek KB
         wb.NMTUncommitMemory(addr + 0*size, 8*size);
         output = new OutputAnalyzer(pb.start());
-        output.shouldContain("Test (reserved=256KB, committed=0KB)");
+        output.shouldContain("Test (reserved=" + 8*sizek + "KB, committed=0KB)");
     }
 }
--- a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Thu Jun 23 17:07:27 2016 -0700
@@ -27,6 +27,7 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.misc
  *          java.management
+ * @ignore 8154204
  * @run main DefaultUseWithClient
  * @bug 8032224
  */
--- a/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/runtime/ThreadSignalMask/ThreadSignalMask.java	Thu Jun 23 17:07:27 2016 -0700
@@ -35,7 +35,7 @@
  * @key cte_test
  * @bug 4345157
  * @summary JDK 1.3.0 alters thread signal mask
- * @requires (os.simpleArch == "sparcv9")
+ * @requires (vm.simpleArch == "sparcv9")
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary
  * @compile Prog.java
--- a/hotspot/test/runtime/Unsafe/GetKlassPointerGetJavaMirror.java	Wed Jul 05 21:53:18 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * 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 8022853
- * @library /testlibrary
- * @modules java.base/jdk.internal.misc
- * @build jdk.test.lib.*
- * @run main GetKlassPointerGetJavaMirror
- */
-
-import static jdk.test.lib.Asserts.*;
-
-import jdk.test.lib.*;
-import jdk.internal.misc.Unsafe;
-
-public class GetKlassPointerGetJavaMirror {
-
-    public static void main(String args[]) throws Exception {
-        Unsafe unsafe = Utils.getUnsafe();
-        Object o = new GetKlassPointerGetJavaMirror();
-        final long metaspaceKlass = unsafe.getKlassPointer(o);
-        Class<?> c = unsafe.getJavaMirror(metaspaceKlass);
-        assertEquals(o.getClass(), c);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/TestBadClassName.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8158297
+ * @summary Constant pool utf8 entry for class name cannot have empty qualified name '//'
+ * @compile p1/BadInterface1.jcod
+ * @compile p1/BadInterface2.jcod
+ * @compile UseBadInterface1.jcod
+ * @compile UseBadInterface2.jcod
+ * @run main/othervm -Xverify:all TestBadClassName
+ */
+
+public class TestBadClassName {
+    public static void main(String args[]) throws Throwable {
+
+        System.out.println("Regression test for bug 8042660");
+
+        // Test class name with p1//BadInterface2
+        try {
+            Class newClass = Class.forName("UseBadInterface1");
+            throw new RuntimeException("Expected ClassFormatError exception not thrown");
+        } catch (java.lang.ClassFormatError e) {
+            System.out.println("Test UseBadInterface1 passed test case with illegal class name");
+        }
+
+        // Test class name with p1/BadInterface2/
+        try {
+            Class newClass = Class.forName("UseBadInterface2");
+            throw new RuntimeException("Expected ClassFormatError exception not thrown");
+        } catch (java.lang.ClassFormatError e) {
+            System.out.println("Test UseBadInterface1 passed test case with illegal class name");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/UseBadInterface1.jcod	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ *
+ */
+
+// jcod file for UseBadInterface1.java
+// class UseBadInterface1 implements p1.BadInterface1 {
+//     int i;
+//     UseBadInterface1() {}
+//     public static void main(java.lang.String[] unused) { }
+// }
+
+class UseBadInterface1 {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #10; // #1    
+    Utf8 "UseBadInterface1.java"; // #2    
+    class #4; // #3    
+    Utf8 "java/lang/Object"; // #4    
+    class #8; // #5    
+    Utf8 "([Ljava/lang/String;)V"; // #6    
+    class #11; // #7    
+    Utf8 "UseBadInterface1"; // #8    
+    Utf8 "main"; // #9    
+    NameAndType #17 #13; // #10    
+    Utf8 "p1//BadInterface1"; // #11    
+    Utf8 "SourceFile"; // #12    
+    Utf8 "()V"; // #13    
+    Utf8 "I"; // #14    
+    Utf8 "Code"; // #15    
+    Utf8 "i"; // #16    
+    Utf8 "<init>"; // #17    
+  } // Constant Pool
+
+  0x0020; // access
+  #5;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+    #7;
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x0000; // access
+      #16; // name_cpx
+      #14; // sig_cpx
+      [] { // Attributes
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #17; // name_cpx
+      #13; // sig_cpx
+      [] { // Attributes
+        Attr(#15) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #9; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#15) { // Code
+          0; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#12) { // SourceFile
+      #2;
+    } // end SourceFile
+  } // Attributes
+} // end class UseBadInterface1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/UseBadInterface2.jcod	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ *
+ */
+
+// jcod file for UseBadInterface2.java
+// class UseBadInterface2 implements p1.BadInterface2 {
+//     int i;
+//     UseBadInterface2() {}
+//     public static void main(java.lang.String[] unused) { }
+// }
+
+class UseBadInterface2 {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Method #3 #10; // #1    
+    Utf8 "UseBadInterface2.java"; // #2    
+    class #4; // #3    
+    Utf8 "java/lang/Object"; // #4    
+    class #8; // #5    
+    Utf8 "([Ljava/lang/String;)V"; // #6    
+    class #11; // #7    
+    Utf8 "UseBadInterface2"; // #8    
+    Utf8 "main"; // #9    
+    NameAndType #17 #13; // #10    
+    Utf8 "p1/BadInterface2/"; // #11    
+    Utf8 "SourceFile"; // #12    
+    Utf8 "()V"; // #13    
+    Utf8 "I"; // #14    
+    Utf8 "Code"; // #15    
+    Utf8 "i"; // #16    
+    Utf8 "<init>"; // #17    
+  } // Constant Pool
+
+  0x0020; // access
+  #5;// this_cpx
+  #3;// super_cpx
+
+  [] { // Interfaces
+    #7;
+  } // Interfaces
+
+  [] { // fields
+    { // Member
+      0x0000; // access
+      #16; // name_cpx
+      #14; // sig_cpx
+      [] { // Attributes
+      } // Attributes
+    } // Member
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0000; // access
+      #17; // name_cpx
+      #13; // sig_cpx
+      [] { // Attributes
+        Attr(#15) { // Code
+          1; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0x2AB70001B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0009; // access
+      #9; // name_cpx
+      #6; // sig_cpx
+      [] { // Attributes
+        Attr(#15) { // Code
+          0; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#12) { // SourceFile
+      #2;
+    } // end SourceFile
+  } // Attributes
+} // end class UseBadInterface2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/p1/BadInterface1.jcod	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ *
+ */
+
+// Interface that should get a ClassFormatException for the "//" in the name
+
+// package p1;
+// public interface cls1 {}
+
+class p1//BadInterface1 {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    class #5; // #1    
+    class #6; // #2    
+    Utf8 "SourceFile"; // #3    
+    Utf8 "BadInterface1.java"; // #4    
+    Utf8 "p1//BadInterface1"; // #5    
+    Utf8 "java/lang/Object"; // #6    
+  } // Constant Pool
+
+  0x0601; // access
+  #1;// this_cpx
+  #2;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+  } // methods
+
+  [] { // Attributes
+    Attr(#3) { // SourceFile
+      #4;
+    } // end SourceFile
+  } // Attributes
+} // end class p1//BadInterface1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/p1/BadInterface2.jcod	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ *
+ */
+
+// Interface that should get a ClassFormatException for the trailing "/" in the name
+
+// package p1;
+// public interface cls1 {}
+
+class p1/BadInterface2/ {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    class #5; // #1    
+    class #6; // #2    
+    Utf8 "SourceFile"; // #3    
+    Utf8 "BadInterface2.java"; // #4    
+    Utf8 "p1/BadInterface2/"; // #5    
+    Utf8 "java/lang/Object"; // #6    
+  } // Constant Pool
+
+  0x0601; // access
+  #1;// this_cpx
+  #2;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+  } // methods
+
+  [] { // Attributes
+    Attr(#3) { // SourceFile
+      #4;
+    } // end SourceFile
+  } // Attributes
+} // end class p1/BadInterface2
--- a/hotspot/test/runtime/logging/StartupTimeTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/runtime/logging/StartupTimeTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -50,6 +50,18 @@
         output.shouldHaveExitValue(0);
     }
 
+    static void analyzeModulesOutputOn(ProcessBuilder pb) throws Exception {
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldMatch("(Phase2 initialization, [0-9]+.[0-9]+ secs)");
+        output.shouldHaveExitValue(0);
+    }
+
+    static void analyzeModulesOutputOff(ProcessBuilder pb) throws Exception {
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldNotContain("[modules,startuptime]");
+        output.shouldHaveExitValue(0);
+    }
+
     public static void main(String[] args) throws Exception {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime",
                                                                   InnerClass.class.getName());
@@ -58,6 +70,14 @@
         pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime=off",
                                                    InnerClass.class.getName());
         analyzeOutputOff(pb);
+
+        pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules",
+                                                   InnerClass.class.getName());
+        analyzeModulesOutputOn(pb);
+
+        pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules=off",
+                                                   InnerClass.class.getName());
+        analyzeModulesOutputOff(pb);
     }
 
     public static class InnerClass {
--- a/hotspot/test/runtime/memory/ReserveMemory.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/runtime/memory/ReserveMemory.java	Thu Jun 23 17:07:27 2016 -0700
@@ -21,10 +21,12 @@
  * questions.
  */
 
+// Aix commits on touch, so this test won't work.
 /*
  * @test
  * @key regression
  * @bug 8012015
+ * @requires !(os.family == "aix")
  * @summary Make sure reserved (but uncommitted) memory is not accessible
  * @library /testlibrary /test/lib
  * @modules java.base/jdk.internal.misc
@@ -36,18 +38,11 @@
  */
 
 import jdk.test.lib.*;
+import jdk.test.lib.Platform;
 
 import sun.hotspot.WhiteBox;
 
 public class ReserveMemory {
-  private static boolean isWindows() {
-    return System.getProperty("os.name").toLowerCase().startsWith("win");
-  }
-
-  private static boolean isOsx() {
-    return System.getProperty("os.name").toLowerCase().startsWith("mac");
-  }
-
   public static void main(String args[]) throws Exception {
     if (args.length > 0) {
       WhiteBox.getWhiteBox().readReservedMemory();
@@ -66,9 +61,9 @@
           "test");
 
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    if (isWindows()) {
+    if (Platform.isWindows()) {
       output.shouldContain("EXCEPTION_ACCESS_VIOLATION");
-    } else if (isOsx()) {
+    } else if (Platform.isOSX()) {
       output.shouldContain("SIGBUS");
     } else {
       output.shouldContain("SIGSEGV");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/modules/CompilerUtils.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 javax.tools.JavaCompiler;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * This class consists exclusively of static utility methods for invoking the
+ * java compiler.
+ *
+ * This class will eventually move to jdk.testlibrary.
+ */
+
+public final class CompilerUtils {
+    private CompilerUtils() { }
+
+    /**
+     * Compile all the java sources in {@code <source>/**} to
+     * {@code <destination>/**}. The destination directory will be created if
+     * it doesn't exist.
+     *
+     * All warnings/errors emitted by the compiler are output to System.out/err.
+     *
+     * @return true if the compilation is successful
+     *
+     * @throws IOException if there is an I/O error scanning the source tree or
+     *                     creating the destination directory
+     */
+    public static boolean compile(Path source, Path destination, String ... options)
+        throws IOException
+    {
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
+
+        List<Path> sources
+            = Files.find(source, Integer.MAX_VALUE,
+                (file, attrs) -> (file.toString().endsWith(".java")))
+                .collect(Collectors.toList());
+
+        Files.createDirectories(destination);
+        jfm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT,
+                                 Arrays.asList(destination));
+
+        List<String> opts = Arrays.asList(options);
+        JavaCompiler.CompilationTask task
+            = compiler.getTask(null, jfm, null, opts, null,
+                jfm.getJavaFileObjectsFromPaths(sources));
+
+        return task.call();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/ExportModuleStressTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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 8156871
+ * @summary package in the boot layer is repeatedly exported to unique module created in layers on top of the boot layer
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary /test/lib
+ * @compile ../CompilerUtils.java
+ * @build ExportModuleStressTest
+ * @run main/othervm ExportModuleStressTest
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import jdk.test.lib.*;
+
+public class ExportModuleStressTest {
+
+    private static final String TEST_SRC = System.getProperty("test.src");
+    private static final String TEST_CLASSES = System.getProperty("test.classes");
+
+    private static final Path SRC_DIR = Paths.get(TEST_SRC, "src");
+    private static final Path MODS_DIR = Paths.get(TEST_CLASSES, "mods");
+
+    /**
+     * Compiles all module definitions used by the test
+     */
+    public static void main(String[] args) throws Exception {
+
+        boolean compiled;
+        // Compile module jdk.test declaration
+        compiled = CompilerUtils.compile(
+            SRC_DIR.resolve("jdk.test"),
+            MODS_DIR.resolve("jdk.test"));
+        if (!compiled) {
+            throw new RuntimeException("Test failed to compile module jdk.test");
+        }
+
+        // Compile module jdk.translet declaration
+        compiled = CompilerUtils.compile(
+            SRC_DIR.resolve("jdk.translet"),
+            MODS_DIR.resolve("jdk.translet"),
+            "-XaddExports:jdk.test/test=jdk.translet",
+            "-mp", MODS_DIR.toString());
+        if (!compiled) {
+            throw new RuntimeException("Test failed to compile module jdk.translet");
+        }
+
+        // Sanity check that the test, jdk.test/test/Main.java
+        // runs without error.
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-mp", MODS_DIR.toString(),
+            "-m", "jdk.test/test.Main");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("failed: 0")
+              .shouldHaveExitValue(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/module-info.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+module jdk.test {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.test/test/Main.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package test;
+
+import java.lang.module.Configuration;
+import java.lang.module.ModuleFinder;
+import java.lang.reflect.Layer;
+import java.lang.reflect.Method;
+import java.lang.reflect.Module;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+public class Main {
+
+    private static final Path MODS_DIR = Paths.get(System.getProperty("jdk.module.path"));
+    static final String MODULE_NAME = "jdk.translet";
+
+    public static void main(String[] args) throws Exception {
+
+        ModuleFinder finder = ModuleFinder.of(MODS_DIR);
+        Layer layerBoot = Layer.boot();
+
+        Configuration cf = layerBoot
+                .configuration()
+                .resolveRequires(ModuleFinder.of(), finder, Set.of(MODULE_NAME));
+
+        Module testModule = Main.class.getModule();
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        // Create an unique module/class loader in a layer above the boot layer.
+        // Export this module to the jdk.test/test package.
+        Callable<Void> task = new Callable<Void>() {
+            @Override
+            public Void call() throws Exception {
+                Layer layer = Layer.boot().defineModulesWithOneLoader(cf, scl);
+                Module transletModule = layer.findModule(MODULE_NAME).get();
+                testModule.addExports("test", transletModule);
+                Class<?> c = layer.findLoader(MODULE_NAME).loadClass("translet.Main");
+                Method method = c.getDeclaredMethod("go");
+                method.invoke(null);
+                return null;
+            }
+        };
+
+        List<Future<Void>> results = new ArrayList<>();
+
+        // Repeatedly create the layer above stressing the exportation of
+        // package jdk.test/test to several different modules.
+        ExecutorService pool = Executors.newFixedThreadPool(Math.min(100, Runtime.getRuntime().availableProcessors()*10));
+        try {
+            for (int i = 0; i < 10000; i++) {
+                results.add(pool.submit(task));
+            }
+        } finally {
+            pool.shutdown();
+        }
+
+        int passed = 0;
+        int failed = 0;
+
+        // The failed state should be 0, the created modules in layers above the
+        // boot layer should be allowed access to the contents of the jdk.test/test
+        // package since that package was exported to the transletModule above.
+        for (Future<Void> result : results) {
+            try {
+                result.get();
+                passed++;
+            } catch (Throwable x) {
+                x.printStackTrace();
+                failed++;
+            }
+        }
+
+        System.out.println("passed: " + passed);
+        System.out.println("failed: " + failed);
+    }
+
+    public static void callback() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.translet/module-info.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.
+ */
+
+module jdk.translet {
+    requires jdk.test;
+    exports translet;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/modules/ModuleStress/src/jdk.translet/translet/Main.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package translet;
+
+public class Main {
+    public static void go() {
+        test.Main.callback();
+    }
+}
--- a/hotspot/test/runtime/modules/Xpatch/XpatchJavaBase.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/runtime/modules/Xpatch/XpatchJavaBase.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,6 +25,7 @@
  * @test
  * @bug 8130399
  * @summary Make sure -Xpatch works for java.base.
+ * @modules java.base/jdk.internal.misc
  * @library /testlibrary
  * @compile XpatchMain.java
  * @run main XpatchJavaBase
--- a/hotspot/test/serviceability/dcmd/framework/HelpTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/serviceability/dcmd/framework/HelpTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -37,7 +37,6 @@
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @ignore 8072440
  * @build jdk.test.lib.*
  * @build jdk.test.lib.dcmd.*
  * @run testng/othervm -XX:+UsePerfData HelpTest
--- a/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -37,7 +37,6 @@
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @ignore 8072440
  * @build jdk.test.lib.*
  * @build jdk.test.lib.dcmd.*
  * @run testng/othervm -XX:+UsePerfData InvalidCommandTest
--- a/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -38,7 +38,6 @@
  *          java.compiler
  *          java.management
  *          jdk.jvmstat/sun.jvmstat.monitor
- * @ignore 8072440
  * @build jdk.test.lib.*
  * @build jdk.test.lib.dcmd.*
  * @run testng/othervm -XX:+UsePerfData VMVersionTest
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/GetObjectSizeClass.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.PrintWriter;
+import jdk.test.lib.*;
+
+/*
+ * @test
+ * @bug 8075030
+ * @summary JvmtiEnv::GetObjectSize reports incorrect java.lang.Class instance size
+ * @library /testlibrary
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ *          java.instrument
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
+ * @build ClassFileInstaller jdk.test.lib.* GetObjectSizeClassAgent
+ * @run main ClassFileInstaller GetObjectSizeClassAgent
+ * @run main GetObjectSizeClass
+ */
+public class GetObjectSizeClass {
+    public static void main(String[] args) throws Exception  {
+        PrintWriter pw = new PrintWriter("MANIFEST.MF");
+        pw.println("Premain-Class: GetObjectSizeClassAgent");
+        pw.close();
+
+        ProcessBuilder pb = new ProcessBuilder();
+        pb.command(new String[] { JDKToolFinder.getJDKTool("jar"), "cmf", "MANIFEST.MF", "agent.jar", "GetObjectSizeClassAgent.class"});
+        pb.start().waitFor();
+
+        ProcessBuilder pt = ProcessTools.createJavaProcessBuilder(true, "-javaagent:agent.jar",  "GetObjectSizeClassAgent");
+        OutputAnalyzer output = new OutputAnalyzer(pt.start());
+
+        output.stdoutShouldContain("GetObjectSizeClass passed");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/serviceability/jvmti/GetObjectSizeClassAgent.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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.instrument.*;
+
+public class GetObjectSizeClassAgent {
+
+    static Instrumentation instrumentation;
+
+    public static void premain(String agentArgs, Instrumentation instrumentation) {
+        GetObjectSizeClassAgent.instrumentation = instrumentation;
+    }
+
+    public static void main(String[] args) throws Exception {
+        long sizeA = instrumentation.getObjectSize(A.class);
+        long sizeB = instrumentation.getObjectSize(B.class);
+
+        if (sizeA != sizeB) {
+            throw new RuntimeException("java.lang.Class sizes disagree: " + sizeA + " vs. " + sizeB);
+        }
+
+        System.out.println("GetObjectSizeClass passed");
+    }
+
+    static class A {
+    }
+
+    static class B {
+        void m() {}
+    }
+
+}
--- a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java	Thu Jun 23 17:07:27 2016 -0700
@@ -33,7 +33,6 @@
  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  * @build common.*
  * @build utils.*
- * @ignore 8149778
  * @run main/othervm -XX:+UsePerfData -Xmx128M GcCapacityTest
  */
 public class GcCapacityTest {
--- a/hotspot/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/serviceability/tmtools/jstat/utils/GcProvokerImpl.java	Thu Jun 23 17:07:27 2016 -0700
@@ -42,8 +42,9 @@
         // uses fixed small objects to avoid Humongous objects allocation in G1
         int memoryChunk = 2048;
         List<Object> list = new ArrayList<>();
-        float used = 0;
-        while (used < targetUsage * maxMemory) {
+        long used = 0;
+        long target = (long) (maxMemory * targetUsage);
+        while (used < target) {
             try {
                 list.add(new byte[memoryChunk]);
                 used += memoryChunk;
--- a/hotspot/test/testlibrary/jdk/test/lib/FileInstaller.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jdk/test/lib/FileInstaller.java	Thu Jun 23 17:07:27 2016 -0700
@@ -45,8 +45,8 @@
         if (args.length != 2) {
             throw new IllegalArgumentException("Unexpected number of arguments for file copy");
         }
-        Path src = Paths.get(Utils.TEST_SRC, args[0]);
-        Path dst = Paths.get(args[1]);
+        Path src = Paths.get(Utils.TEST_SRC, args[0]).toAbsolutePath();
+        Path dst = Paths.get(args[1]).toAbsolutePath();
         if (src.toFile().exists()) {
             if (src.toFile().isDirectory()) {
                 Files.walkFileTree(src, new CopyFileVisitor(src, dst));
--- a/hotspot/test/testlibrary/jittester/Makefile	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/Makefile	Thu Jun 23 17:07:27 2016 -0700
@@ -44,6 +44,10 @@
 	APPLICATION_ARGS += --seed $(SEED)
 endif
 
+ifneq "x$(EXTRA_SRC_DIR)" "x"
+        EXTRA_SRC_FILES := $(shell find $(EXTRA_SRC_DIR) -name '*.java')
+endif
+
 JAVA = $(JDK_HOME)/bin/java
 JAVAC = $(JDK_HOME)/bin/javac
 JAR = $(JDK_HOME)/bin/jar
@@ -99,6 +103,7 @@
 filelist: $(SRC_FILES)
 		@rm -f $@
 		@echo $(SRC_FILES) > $@
+		@echo $(EXTRA_SRC_FILES) >> $@
 
 INIT: $(DIST_DIR)
 	$(shell if [ ! -d $(CLASSES_DIR) ]; then mkdir -p $(CLASSES_DIR); fi)
--- a/hotspot/test/testlibrary/jittester/conf/default.properties	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/conf/default.properties	Thu Jun 23 17:07:27 2016 -0700
@@ -9,3 +9,5 @@
 print-complexity=true
 print-hierarchy=true
 disable-static=true
+generatorsFactories=jdk.test.lib.jittester.TestGeneratorsFactory
+generators=JavaCode,ByteCode
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java	Thu Jun 23 17:07:27 2016 -0700
@@ -25,50 +25,19 @@
 
 import jdk.test.lib.Pair;
 import jdk.test.lib.jittester.factories.IRNodeBuilder;
-import jdk.test.lib.jittester.jtreg.Printer;
 import jdk.test.lib.jittester.types.TypeKlass;
 import jdk.test.lib.jittester.utils.FixedTrees;
 import jdk.test.lib.jittester.utils.OptionResolver;
 import jdk.test.lib.jittester.utils.OptionResolver.Option;
 import jdk.test.lib.jittester.utils.PseudoRandom;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.time.LocalTime;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
+import java.util.function.Function;
 
 public class Automatic {
-    private static final int MINUTES_TO_WAIT = Integer.getInteger("jdk.test.lib.jittester", 3);
-
-    static String getJtregHeader(String mainClass, boolean addCompile) {
-        String synopsis = "seed = '" + ProductionParams.seed.value() + "'"
-                + ", specificSeed = '" + PseudoRandom.getCurrentSeed() + "'";
-        StringBuilder header = new StringBuilder();
-        header.append("/*\n * @test\n * @summary ")
-                .append(synopsis)
-                .append(" \n* @library / ../\n");
-        if (addCompile) {
-            header.append("\n * @compile ")
-                    .append(mainClass)
-                    .append(".java\n");
-        }
-        header.append(" * @run build jdk.test.lib.jittester.jtreg.JitTesterDriver "
-                        + "jdk.test.lib.jittester.jtreg.Printer\n")
-                .append(" * @run driver jdk.test.lib.jittester.jtreg.JitTesterDriver ")
-                .append(mainClass)
-                .append("\n */\n\n");
-        if (ProductionParams.printHierarchy.value()) {
-            header.append("/*\n")
-                .append(Automatic.printHierarchy())
-                .append("*/\n");
-        }
-        return header.toString();
-    }
+    public static final int MINUTES_TO_WAIT = Integer.getInteger("jdk.test.lib.jittester", 3);
 
     private static Pair<IRNode, IRNode> generateIRTree(String name) {
         SymbolTable.removeAll();
@@ -120,123 +89,48 @@
         }
     }
 
+    private static List<TestsGenerator> getTestGenerators() {
+        List<TestsGenerator> result = new ArrayList<>();
+        Class<?> factoryClass;
+        Function<String[], List<TestsGenerator>> factory;
+        String[] factoryClassNames = ProductionParams.generatorsFactories.value().split(",");
+        String[] generatorNames = ProductionParams.generators.value().split(",");
+        for (String factoryClassName : factoryClassNames) {
+            try {
+                factoryClass = Class.forName(factoryClassName);
+                factory = (Function<String[], List<TestsGenerator>>) factoryClass.newInstance();
+            } catch (ReflectiveOperationException roe) {
+                throw new Error("Can't instantiate generators factory", roe);
+            }
+            result.addAll(factory.apply(generatorNames));
+        }
+        return result;
+    }
+
     public static void main(String[] args) {
         initializeTestGenerator(args);
         int counter = 0;
-        try {
-            Path testbaseDir = Paths.get(ProductionParams.testbaseDir.value());
-            System.out.printf(" %13s | %8s | %8s | %8s |%n", "start time", "count", "generat",
-                              "running");
-            System.out.printf(" %13s | %8s | %8s | %8s |%n", "---", "---", "---","---");
-            String path = getJavaPath();
-            String javacPath = Paths.get(path, "javac").toString();
-            String javaPath = Paths.get(path, "java").toString();
-
-            // compile Printer class first. A common one for all tests
-            ensureExisting(testbaseDir);
-            ProcessBuilder pbPrinter = new ProcessBuilder(javacPath,
-                    Paths.get(testbaseDir.toString(), "jdk", "test", "lib", "jittester",
-                            "jtreg", "Printer.java").toString());
-            runProcess(pbPrinter, testbaseDir.resolve("Printer").toString());
-            do {
-                double start = System.currentTimeMillis();
-                System.out.print("[" + LocalTime.now() + "] |");
-                String name = "Test_" + counter;
-                Pair<IRNode, IRNode> irTree = generateIRTree(name);
-                System.out.printf(" %8d |", counter);
-                double generationTime = System.currentTimeMillis() - start;
-                System.out.printf(" %8.0f |", generationTime);
-                if (!ProductionParams.disableJavacodeGeneration.value()) {
-                    JavaCodeGenerator generator = new JavaCodeGenerator();
-                    String javaFile = generator.apply(irTree.first, irTree.second);
-                    ProcessBuilder pb = new ProcessBuilder(javacPath, "-cp", testbaseDir.toString()
-                            + ":" + generator.getTestbase().toString(), javaFile);
-                    runProcess(pb, generator.getTestbase().resolve(name).toString());
-                    start = System.currentTimeMillis();
-
-                    // Run compiled class files
-                    pb = new ProcessBuilder(javaPath, "-Xint", "-cp", testbaseDir.toString()
-                            + ":" + generator.getTestbase().toString(), name);
-                    String goldFile = name + ".gold";
-                    runProcess(pb, generator.getTestbase().resolve(goldFile).toString());
-                }
-
-                if (!ProductionParams.disableBytecodeGeneration.value()) {
-                    ByteCodeGenerator generator = new ByteCodeGenerator();
-                    generator.apply(irTree.first, irTree.second);
-                    generator.writeJtregBytecodeRunner(name);
-                    // Run generated bytecode
-                    ProcessBuilder pb = new ProcessBuilder(javaPath, "-Xint", "-Xverify", "-cp",
-                            testbaseDir.toString() + ":" + generator.getTestbase().toString(),
-                            name);
-                    String goldFile = name + ".gold";
-                    start = System.currentTimeMillis();
-                    runProcess(pb, generator.getTestbase().resolve(goldFile).toString());
-                }
-
-                double runningTime = System.currentTimeMillis() - start;
-                System.out.printf(" %8.0f |%n", runningTime);
-                if (runningTime < TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT)) {
-                    ++counter;
-                }
-            } while (counter < ProductionParams.numberOfTests.value());
-        } catch (IOException | InterruptedException ex) {
-            ex.printStackTrace();
-        }
-    }
-
-    private static String getJavaPath() {
-        String[] env = { "JDK_HOME", "JAVA_HOME", "BOOTDIR" };
-        for (String name : env) {
-            String path = System.getenv(name);
-            if (path != null) {
-                return path + "/bin/";
+        System.out.printf(" %13s | %8s | %8s | %8s |%n", "start time", "count", "generat",
+                "running");
+        System.out.printf(" %13s | %8s | %8s | %8s |%n", "---", "---", "---", "---");
+        List<TestsGenerator> generators = getTestGenerators();
+        do {
+            double start = System.currentTimeMillis();
+            System.out.print("[" + LocalTime.now() + "] |");
+            String name = "Test_" + counter;
+            Pair<IRNode, IRNode> irTree = generateIRTree(name);
+            System.out.printf(" %8d |", counter);
+            double generationTime = System.currentTimeMillis() - start;
+            System.out.printf(" %8.0f |", generationTime);
+            start = System.currentTimeMillis();
+            for (TestsGenerator generator : generators) {
+                generator.accept(irTree.first, irTree.second);
             }
-        }
-        return "";
-    }
-
-    private static int runProcess(ProcessBuilder pb, String name)
-            throws IOException, InterruptedException {
-        pb.redirectError(new File(name + ".err"));
-        pb.redirectOutput(new File(name + ".out"));
-        Process process = pb.start();
-        if (process.waitFor(MINUTES_TO_WAIT, TimeUnit.MINUTES)) {
-            try (FileWriter file = new FileWriter(name + ".exit")) {
-                file.write(Integer.toString(process.exitValue()));
+            double runningTime = System.currentTimeMillis() - start;
+            System.out.printf(" %8.0f |%n", runningTime);
+            if (runningTime < TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT)) {
+                ++counter;
             }
-            return process.exitValue();
-        } else {
-            process.destroyForcibly();
-            return -1;
-        }
-    }
-
-    private static String printHierarchy() {
-        return TypeList.getAll().stream()
-                .filter(t -> t instanceof TypeKlass)
-                .map(t -> typeDescription((TypeKlass) t))
-                .collect(Collectors.joining("\n","CLASS HIERARCHY:\n", "\n"));
-    }
-
-    private static String typeDescription(TypeKlass type) {
-        StringBuilder result = new StringBuilder();
-        String parents = type.getParentsNames().stream().collect(Collectors.joining(","));
-        result.append(type.isAbstract() ? "abstract " : "")
-              .append(type.isFinal() ? "final " : "")
-              .append(type.isInterface() ? "interface " : "class ")
-              .append(type.getName())
-              .append(parents.isEmpty() ? "" : ": " + parents);
-        return result.toString();
-    }
-
-    static void ensureExisting(Path path) {
-        if (Files.notExists(path)) {
-            try {
-                Files.createDirectories(path);
-            } catch (IOException ex) {
-                ex.printStackTrace();
-            }
-        }
+        } while (counter < ProductionParams.numberOfTests.value());
     }
 }
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ByteCodeGenerator.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ByteCodeGenerator.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,54 +23,60 @@
 
 package jdk.test.lib.jittester;
 
-import jdk.test.lib.jittester.visitors.ByteCodeVisitor;
-
 import java.io.FileOutputStream;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
-import java.util.function.BiFunction;
+import java.util.function.Function;
+import jdk.test.lib.jittester.visitors.ByteCodeVisitor;
 
 /**
- * Generates class files from bytecode
+ * Generates class files from IRTree
  */
-class ByteCodeGenerator implements BiFunction<IRNode, IRNode, String> {
-    private final Path testbase = Paths.get(ProductionParams.testbaseDir.value(),
-            "bytecode_tests");
+class ByteCodeGenerator extends TestsGenerator {
+    private static final String DEFAULT_SUFFIX = "bytecode_tests";
 
-    public void writeJtregBytecodeRunner(String name) {
-        try (FileWriter file = new FileWriter(testbase.resolve(name + ".java").toFile())) {
-            file.write(Automatic.getJtregHeader(name, false));
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
+    ByteCodeGenerator() {
+        super(DEFAULT_SUFFIX);
+    }
+
+    ByteCodeGenerator(String suffix, Function<String, String[]> preRunActions, String jtDriverOptions) {
+        super(suffix, preRunActions, jtDriverOptions);
     }
 
-    public String apply(IRNode mainClass, IRNode privateClasses) {
-        Automatic.ensureExisting(testbase);
+    @Override
+    public void accept(IRNode mainClass, IRNode privateClasses) {
+        generateClassFiles(mainClass, privateClasses);
+        generateSeparateJtregHeader(mainClass);
+        compilePrinter();
+        generateGoldenOut(mainClass.getName());
+    }
+
+    private void generateSeparateJtregHeader(IRNode mainClass) {
+        String mainClassName = mainClass.getName();
+        writeFile(generatorDir, mainClassName + ".java", getJtregHeader(mainClassName));
+    }
+
+    private void generateClassFiles(IRNode mainClass, IRNode privateClasses) {
+        String mainClassName = mainClass.getName();
+        ensureExisting(generatorDir);
         try {
             ByteCodeVisitor vis = new ByteCodeVisitor();
             if (privateClasses != null) {
                 privateClasses.accept(vis);
             }
             mainClass.accept(vis);
-
-            Path mainClassPath = testbase.resolve(mainClass.getName() + ".class");
-            writeToClassFile(mainClassPath, vis.getByteCode(mainClass.getName()));
+            writeFile(mainClassName + ".class", vis.getByteCode(mainClassName));
             if (privateClasses != null) {
                 privateClasses.getChildren().forEach(c -> {
                     String name = c.getName();
-                    Path classPath = testbase.resolve(name + ".class");
-                    writeToClassFile(classPath, vis.getByteCode(name));
+                    writeFile(name + ".class", vis.getByteCode(name));
                 });
             }
-            return mainClassPath.toString();
         } catch (Throwable t) {
-            Path errFile = testbase.resolve(mainClass.getName() + ".err");
+            Path errFile = generatorDir.resolve(mainClassName + ".err");
             try (PrintWriter pw = new PrintWriter(Files.newOutputStream(errFile,
                     StandardOpenOption.CREATE_NEW))) {
                 t.printStackTrace(pw);
@@ -78,16 +84,11 @@
                 t.printStackTrace();
                 throw new Error("can't write error to error file " + errFile, e);
             }
-            return null;
         }
     }
 
-    public Path getTestbase() {
-        return testbase;
-    }
-
-    private void writeToClassFile(Path path, byte[] bytecode) {
-        try (FileOutputStream file = new FileOutputStream(path.toString())) {
+    private void writeFile(String fileName, byte[] bytecode) {
+        try (FileOutputStream file = new FileOutputStream(generatorDir.resolve(fileName).toFile())) {
             file.write(bytecode);
         } catch (IOException ex) {
             ex.printStackTrace();
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/JavaCodeGenerator.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/JavaCodeGenerator.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,48 +23,59 @@
 
 package jdk.test.lib.jittester;
 
-import jdk.test.lib.jittester.visitors.JavaCodeVisitor;
-
-import java.io.FileWriter;
+import java.io.File;
 import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.function.BiFunction;
+import java.util.function.Function;
+import jdk.test.lib.jittester.visitors.JavaCodeVisitor;
 
 /**
- * Generates class files from java source code
+ * Generates java source code from IRTree
  */
-class JavaCodeGenerator implements BiFunction<IRNode, IRNode, String> {
-    private final Path testbase = Paths.get(ProductionParams.testbaseDir.value(), "java_tests");
+public class JavaCodeGenerator extends TestsGenerator {
+    private static final String DEFAULT_SUFFIX = "java_tests";
+
+    JavaCodeGenerator() {
+        this(DEFAULT_SUFFIX, JavaCodeGenerator::generatePrerunAction, "");
+    }
+
+    JavaCodeGenerator(String prefix, Function<String, String[]> preRunActions, String jtDriverOptions) {
+        super(prefix, preRunActions, jtDriverOptions);
+    }
 
-    private String generateJavaCode(IRNode mainClass, IRNode privateClasses) {
+    @Override
+    public void accept(IRNode mainClass, IRNode privateClasses) {
+        String mainClassName = mainClass.getName();
+        generateSources(mainClass, privateClasses);
+        compilePrinter();
+        compileJavaFile(mainClassName);
+        generateGoldenOut(mainClassName);
+    }
+
+    private void generateSources(IRNode mainClass, IRNode privateClasses) {
+        String mainClassName = mainClass.getName();
         StringBuilder code = new StringBuilder();
         JavaCodeVisitor vis = new JavaCodeVisitor();
-
-        code.append(Automatic.getJtregHeader(mainClass.getName(), true));
+        code.append(getJtregHeader(mainClassName));
         if (privateClasses != null) {
             code.append(privateClasses.accept(vis));
         }
         code.append(mainClass.accept(vis));
-
-        return code.toString();
-    }
-
-    public Path getTestbase() {
-        return testbase;
+        ensureExisting(generatorDir);
+        writeFile(generatorDir, mainClassName + ".java", code.toString());
     }
 
-    @Override
-    public String apply(IRNode mainClass, IRNode privateClasses) {
-        String code = generateJavaCode(mainClass, privateClasses);
-        Automatic.ensureExisting(testbase);
-        Path fileName = testbase.resolve(mainClass.getName() + ".java");
-        try (FileWriter file = new FileWriter(fileName.toFile())) {
-            file.write(code);
-            return fileName.toString();
-        } catch (IOException ex) {
-            ex.printStackTrace();
+    private void compileJavaFile(String mainClassName) {
+        String classPath = getRoot() + File.pathSeparator + generatorDir;
+        ProcessBuilder pb = new ProcessBuilder(JAVAC, "-cp", classPath,
+                generatorDir.resolve(mainClassName + ".java").toString());
+        try {
+            runProcess(pb, generatorDir.resolve(mainClassName).toString());
+        } catch (IOException | InterruptedException e) {
+            throw new Error("Can't compile sources ", e);
         }
-        return "";
+    }
+
+    private static String[] generatePrerunAction(String mainClassName) {
+        return new String[] {"@compile " + mainClassName + ".java"};
     }
 }
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ProductionParams.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/ProductionParams.java	Thu Jun 23 17:07:27 2016 -0700
@@ -68,8 +68,6 @@
     public static Option<Boolean> disableNestedBlocks = null;
     public static Option<Boolean> disableArrays = null;
     public static Option<Boolean> enableFinalizers = null;
-    public static Option<Boolean> disableBytecodeGeneration = null;
-    public static Option<Boolean> disableJavacodeGeneration = null;
     // workaraound: to reduce chance throwing ArrayIndexOutOfBoundsException
     public static Option<Integer> chanceExpressionIndex = null;
     public static Option<String> testbaseDir = null;
@@ -78,6 +76,8 @@
     public static Option<Long> specificSeed = null;
     public static Option<String> classesFile = null;
     public static Option<String> excludeMethodsFile = null;
+    public static Option<String> generators = null;
+    public static Option<String> generatorsFactories = null;
 
     public static void register(OptionResolver optionResolver) {
         productionLimit = optionResolver.addIntegerOption('l', "production-limit", 100, "Limit on steps in the production of an expression");
@@ -120,8 +120,6 @@
         disableNestedBlocks = optionResolver.addBooleanOption("disable-nested-blocks", "Disable generation of nested blocks");
         disableArrays = optionResolver.addBooleanOption("disable-arrays", "Disable generation of arrays");
         enableFinalizers = optionResolver.addBooleanOption("enable-finalizers", "Enable finalizers (for stress testing)");
-        disableBytecodeGeneration = optionResolver.addBooleanOption("disable-bytecode-generation", "Disable generation of bytecode output");
-        disableJavacodeGeneration = optionResolver.addBooleanOption("disable-javacode-generation", "Disable generation of java source code output");
         chanceExpressionIndex = optionResolver.addIntegerOption("chance-expression-index", 0, "A non negative decimal integer used to restrict chane of generating expression in array index while creating or accessing by index");
         testbaseDir = optionResolver.addStringOption("testbase-dir", ".", "Testbase dir");
         numberOfTests = optionResolver.addIntegerOption('n', "number-of-tests", 0, "Number of test classes to generate");
@@ -129,5 +127,7 @@
         specificSeed = optionResolver.addLongOption('z', "specificSeed", 0L, "A seed to be set for specific test generation(regular seed still needed for initialization)");
         classesFile = optionResolver.addStringOption('f', "classes-file", "conf/classes.lst", "File to read classes from");
         excludeMethodsFile = optionResolver.addStringOption('r', "exclude-methods-file", "conf/exclude.methods.lst", "File to read excluded methods from");
+        generators = optionResolver.addStringOption("generators", "", "Comma-separated list of generator names");
+        generatorsFactories = optionResolver.addStringOption("generatorsFactories", "", "Comma-separated list of generators factories class names");
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TestGeneratorsFactory.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.jittester;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Function;
+
+public class TestGeneratorsFactory implements Function<String[], List<TestsGenerator>> {
+
+    @Override
+    public List<TestsGenerator> apply(String[] input) {
+        List<TestsGenerator> result = new ArrayList<>();
+        for (String generatorName : input) {
+            switch (generatorName) {
+                case "JavaCode":
+                    result.add(new JavaCodeGenerator());
+                    break;
+                case "ByteCode":
+                    result.add(new ByteCodeGenerator());
+                    break;
+                default:
+                    throw new IllegalArgumentException("Unknown generator: " + generatorName);
+            }
+        }
+        return result;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java	Thu Jun 23 17:07:27 2016 -0700
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.test.lib.jittester;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.concurrent.TimeUnit;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import jdk.test.lib.jittester.types.TypeKlass;
+import jdk.test.lib.jittester.utils.PseudoRandom;
+
+public abstract class TestsGenerator implements BiConsumer<IRNode, IRNode> {
+    protected static final String JAVA_BIN = getJavaPath();
+    protected static final String JAVAC = Paths.get(JAVA_BIN, "javac").toString();
+    protected static final String JAVA = Paths.get(JAVA_BIN, "java").toString();
+    protected final Path generatorDir;
+    protected final Function<String, String[]> preRunActions;
+    protected final String jtDriverOptions;
+
+    protected TestsGenerator(String suffix) {
+        this(suffix, s -> new String[0], "");
+    }
+
+    protected TestsGenerator(String suffix, Function<String, String[]> preRunActions,
+            String jtDriverOptions) {
+        generatorDir = getRoot().resolve(suffix);
+        this.preRunActions = preRunActions;
+        this.jtDriverOptions = jtDriverOptions;
+    }
+
+    protected void generateGoldenOut(String mainClassName) {
+        String classPath = getRoot() + File.pathSeparator + generatorDir;
+        ProcessBuilder pb = new ProcessBuilder(JAVA, "-Xint", "-Xverify", "-cp", classPath,
+                mainClassName);
+        String goldFile = mainClassName + ".gold";
+        try {
+            runProcess(pb, generatorDir.resolve(goldFile).toString());
+        } catch (IOException | InterruptedException e)  {
+            throw new Error("Can't run generated test ", e);
+        }
+    }
+
+    protected static int runProcess(ProcessBuilder pb, String name)
+            throws IOException, InterruptedException {
+        pb.redirectError(new File(name + ".err"));
+        pb.redirectOutput(new File(name + ".out"));
+        Process process = pb.start();
+        if (process.waitFor(Automatic.MINUTES_TO_WAIT, TimeUnit.MINUTES)) {
+            try (FileWriter file = new FileWriter(name + ".exit")) {
+                file.write(Integer.toString(process.exitValue()));
+            }
+            return process.exitValue();
+        } else {
+            process.destroyForcibly();
+            return -1;
+        }
+    }
+
+    protected static void compilePrinter() {
+        Path root = getRoot();
+        ProcessBuilder pbPrinter = new ProcessBuilder(JAVAC,
+                root.resolve("jdk")
+                    .resolve("test")
+                    .resolve("lib")
+                    .resolve("jittester")
+                    .resolve("jtreg")
+                    .resolve("Printer.java")
+                    .toString());
+        try {
+            int exitCode = runProcess(pbPrinter, root.resolve("Printer").toString());
+            if (exitCode != 0) {
+                throw new Error("Printer compilation returned exit code " + exitCode);
+            }
+        } catch (IOException | InterruptedException e) {
+            throw new Error("Can't compile printer", e);
+        }
+    }
+
+    protected static void ensureExisting(Path path) {
+        if (Files.notExists(path)) {
+            try {
+                Files.createDirectories(path);
+            } catch (IOException ex) {
+                ex.printStackTrace();
+            }
+        }
+    }
+
+    protected String getJtregHeader(String mainClassName) {
+        String synopsis = "seed = '" + ProductionParams.seed.value() + "'"
+                + ", specificSeed = '" + PseudoRandom.getCurrentSeed() + "'";
+        StringBuilder header = new StringBuilder();
+        header.append("/*\n * @test\n * @summary ")
+              .append(synopsis)
+              .append(" \n * @library / ../\n");
+        header.append(" * @run build jdk.test.lib.jittester.jtreg.JitTesterDriver "
+                        + "jdk.test.lib.jittester.jtreg.Printer\n");
+        for (String action : preRunActions.apply(mainClassName)) {
+            header.append(" * ")
+                  .append(action)
+                  .append("\n");
+        }
+        header.append(" * @run driver jdk.test.lib.jittester.jtreg.JitTesterDriver ")
+              .append(jtDriverOptions)
+              .append(" ")
+              .append(mainClassName)
+              .append("\n */\n\n");
+        if (ProductionParams.printHierarchy.value()) {
+            header.append("/*\n")
+                  .append(printHierarchy())
+                  .append("*/\n");
+        }
+        return header.toString();
+    }
+
+    protected static Path getRoot() {
+        return Paths.get(ProductionParams.testbaseDir.value());
+    }
+
+    protected static void writeFile(Path targetDir, String fileName, String content) {
+        try (FileWriter file = new FileWriter(targetDir.resolve(fileName).toFile())) {
+            file.write(content);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static String printHierarchy() {
+        return TypeList.getAll()
+                .stream()
+                .filter(t -> t instanceof TypeKlass)
+                .map(t -> typeDescription((TypeKlass) t))
+                .collect(Collectors.joining("\n","CLASS HIERARCHY:\n", "\n"));
+    }
+
+    private static String typeDescription(TypeKlass type) {
+        StringBuilder result = new StringBuilder();
+        String parents = type.getParentsNames().stream().collect(Collectors.joining(","));
+        result.append(type.isAbstract() ? "abstract " : "")
+              .append(type.isFinal() ? "final " : "")
+              .append(type.isInterface() ? "interface " : "class ")
+              .append(type.getName())
+              .append(parents.isEmpty() ? "" : ": " + parents);
+        return result.toString();
+    }
+
+    private static String getJavaPath() {
+        String[] env = { "JDK_HOME", "JAVA_HOME", "BOOTDIR" };
+        for (String name : env) {
+            String path = System.getenv(name);
+            if (path != null) {
+                return path + "/bin/";
+            }
+        }
+        return "";
+    }
+}
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/LiteralFactory.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/LiteralFactory.java	Thu Jun 23 17:07:27 2016 -0700
@@ -51,13 +51,13 @@
         } else if (resultType.equals(TypeList.LONG)) {
             literal = new Literal((long) (PseudoRandom.random() * Long.MAX_VALUE), TypeList.LONG);
         } else if (resultType.equals(TypeList.FLOAT)) {
-            literal = new Literal(new Float(String.format(
+            literal = new Literal(Float.valueOf(String.format(
                     (Locale) null,
                     "%." + ProductionParams.floatingPointPrecision.value() + "EF",
                     (float) PseudoRandom.random() * Float.MAX_VALUE)),
                     TypeList.FLOAT);
         } else if (resultType.equals(TypeList.DOUBLE)) {
-            literal = new Literal(new Double(String.format(
+            literal = new Literal(Double.valueOf(String.format(
                     (Locale) null,
                     "%." + 2 * ProductionParams.floatingPointPrecision.value() + "E",
                     PseudoRandom.random() * Double.MAX_VALUE)),
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java	Thu Jun 23 17:07:27 2016 -0700
@@ -40,40 +40,36 @@
 public class JitTesterDriver {
 
     public static void main(String[] args) {
-        if (args.length != 1) {
+        if (args.length < 1) {
             throw new IllegalArgumentException(
                     "[TESTBUG]: wrong number of argument : " + args.length
-                    + ". Expected 1 argument -- jit-tester test name.");
+                    + ". Expected at least 1 argument -- jit-tester test name.");
         }
         OutputAnalyzer oa;
         try {
-            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, args[0]);
+            ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, args);
             oa = new OutputAnalyzer(pb.start());
         } catch (Exception e) {
             throw new Error("Unexpected exception on test jvm start :" + e, e);
         }
 
+        String name = args[args.length - 1];
         Pattern splitOut = Pattern.compile("\\n"); // tests use \n only in stdout
         Pattern splitErr = Pattern.compile("\\r?\\n"); // can handle both \r\n and \n
         Path testDir = Paths.get(Utils.TEST_SRC);
-        String goldOut = formatOutput(streamGoldFile(testDir, args[0], "out"), s -> true);
-        String anlzOut = formatOutput(Arrays.stream(splitOut.split(oa.getStdout())), s -> true);
+        String goldOut = formatOutput(streamGoldFile(testDir, name, "out"));
+        String anlzOut = formatOutput(Arrays.stream(splitOut.split(oa.getStdout())));
         Asserts.assertEQ(anlzOut, goldOut, "Actual stdout isn't equal to golden one");
-        // TODO: add a comment why we skip such lines
-        Predicate<String> notStartWhitespaces = s -> !(s.startsWith("\t") || s.startsWith(" "));
-        String goldErr = formatOutput(streamGoldFile(testDir, args[0], "err"), notStartWhitespaces);
-        String anlzErr = formatOutput(Arrays.stream(splitErr.split(oa.getStderr())),
-                                      notStartWhitespaces);
+        String goldErr = formatOutput(streamGoldFile(testDir, name, "err"));
+        String anlzErr = formatOutput(Arrays.stream(splitErr.split(oa.getStderr())));
         Asserts.assertEQ(anlzErr, goldErr, "Actual stderr isn't equal to golden one");
 
-        int exitValue = Integer.parseInt(streamGoldFile(testDir, args[0], "exit").findFirst().get());
+        int exitValue = Integer.parseInt(streamGoldFile(testDir, name, "exit").findFirst().get());
         oa.shouldHaveExitValue(exitValue);
     }
 
-    private static String formatOutput(Stream<String> stream, Predicate<String> predicate) {
-        String result = stream
-                .filter(predicate)
-                .collect(Collectors.joining(Utils.NEW_LINE));
+    private static String formatOutput(Stream<String> stream) {
+        String result = stream.collect(Collectors.joining(Utils.NEW_LINE));
         if (result.length() > 0) {
             result += Utils.NEW_LINE;
         }
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/FixedTrees.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/FixedTrees.java	Thu Jun 23 17:07:27 2016 -0700
@@ -23,9 +23,11 @@
 
 package jdk.test.lib.jittester.utils;
 
+import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
+
 import jdk.test.lib.jittester.BinaryOperator;
 import jdk.test.lib.jittester.Block;
 import jdk.test.lib.jittester.CatchBlock;
@@ -60,6 +62,8 @@
 import jdk.test.lib.jittester.types.TypeKlass;
 
 public class FixedTrees {
+    private static final Literal EOL = new Literal("\n", TypeList.STRING);
+
     public static FunctionDefinition printVariablesAsFunction(PrintVariables node) {
         TypeKlass owner = node.getOwner();
 
@@ -72,7 +76,6 @@
         List<Symbol> vars = node.getVars();
 
         TypeKlass printerKlass = new TypeKlass(Printer.class.getName());
-        Literal EOL = new Literal("\n", TypeList.STRING);
         VariableInfo thisInfo = new VariableInfo("this", node.getOwner(),
                 node.getOwner(), VariableInfo.LOCAL | VariableInfo.INITIALIZED);
 
@@ -109,6 +112,7 @@
         FunctionInfo toStringInfo = new FunctionInfo("toString", owner, TypeList.STRING, 0L, FunctionInfo.PUBLIC, thisInfo);
         return new FunctionDefinition(toStringInfo, new ArrayList<>(), block, new Return(resultVar));
     }
+
     public static FunctionDefinition generateMainOrExecuteMethod(TypeKlass owner, boolean isMain) {
         Nothing nothing = new Nothing();
         ArrayList<IRNode> testCallNodeContent = new ArrayList<>();
@@ -149,39 +153,50 @@
         List<Type> throwables = new ArrayList<>();
         throwables.add(throwableKlass);
 
-        VariableInfo exInfo = new VariableInfo("ex", owner, throwableKlass,
-                VariableInfo.LOCAL | VariableInfo.INITIALIZED);
-        FunctionInfo printStackTraceInfo = new FunctionInfo("printStackTrace", throwableKlass,
-                TypeList.VOID, 0, FunctionInfo.PUBLIC, exInfo);
-        Function printStackTraceCall = new Function(throwableKlass, printStackTraceInfo, null);
-        printStackTraceCall.addChild(new LocalVariable(exInfo));
-        ArrayList<IRNode> printStackTraceCallBlockContent = new ArrayList<>();
-        // { ex.printStackTrace(); }
-        printStackTraceCallBlockContent.add(new Statement(printStackTraceCall, true));
-
-        Block printStackTraceCallBlock = new Block(owner, TypeList.VOID, printStackTraceCallBlockContent, 3);
-        List<CatchBlock> catchBlocks1 = new ArrayList<>();
-        catchBlocks1.add(new CatchBlock(printStackTraceCallBlock, throwables, 3));
-        List<CatchBlock> catchBlocks2 = new ArrayList<>();
-        catchBlocks2.add(new CatchBlock(printStackTraceCallBlock, throwables, 3));
-        List<CatchBlock> catchBlocks3 = new ArrayList<>();
-        catchBlocks3.add(new CatchBlock(printStackTraceCallBlock, throwables, 2));
-
-        TryCatchBlock tryCatch1 = new TryCatchBlock(tryNode, nothing, catchBlocks1, 3);
         TypeKlass printStreamKlass = new TypeKlass("java.io.PrintStream");
-        TypeKlass systemKlass = new TypeKlass("java.lang.System");
-        FunctionInfo systemOutPrintInfo = new FunctionInfo("print", printStreamKlass,
+        FunctionInfo printInfo = new FunctionInfo("print", printStreamKlass,
                 TypeList.VOID, 0, FunctionInfo.PUBLIC,
                 new VariableInfo("this", owner, printStreamKlass, VariableInfo.LOCAL | VariableInfo.INITIALIZED),
                 new VariableInfo("t", owner, TypeList.OBJECT,
                         VariableInfo.LOCAL  | VariableInfo.INITIALIZED));
+        TypeKlass systemKlass = new TypeKlass("java.lang.System");
+        StaticMemberVariable systemErrVar = new StaticMemberVariable(owner,
+                new VariableInfo("err", systemKlass, printStreamKlass, VariableInfo.STATIC | VariableInfo.PUBLIC));
+
+        LocalVariable exVar = new LocalVariable(
+                new VariableInfo("ex", owner, throwableKlass, VariableInfo.LOCAL | VariableInfo.INITIALIZED));
+        TypeKlass classKlass = new TypeKlass("java.lang.Class");
+        FunctionInfo getClassInfo = new FunctionInfo("getClass", TypeList.OBJECT,
+                classKlass, 0, FunctionInfo.PUBLIC,
+                new VariableInfo("this", owner, TypeList.OBJECT, VariableInfo.LOCAL | VariableInfo.INITIALIZED));
+        Function getClass = new Function(TypeList.OBJECT, getClassInfo, Arrays.asList(exVar));
+        FunctionInfo getNameInfo = new FunctionInfo("getName", classKlass,
+                TypeList.STRING, 0, FunctionInfo.PUBLIC,
+                new VariableInfo("this", owner, TypeList.OBJECT, VariableInfo.LOCAL | VariableInfo.INITIALIZED));
+        Function getName = new Function(classKlass, getNameInfo, Arrays.asList(getClass));
+        ArrayList<IRNode> printExceptionBlockContent = new ArrayList<>();
+        // { System.err.print(ex.getClass().getName()); System.err.print("\n"); }
+        printExceptionBlockContent.add(new Statement(
+            new Function(printStreamKlass, printInfo, Arrays.asList(systemErrVar, getName)), true));
+        printExceptionBlockContent.add(new Statement(
+            new Function(printStreamKlass, printInfo, Arrays.asList(systemErrVar, EOL)), true));
+
+        Block printExceptionBlock = new Block(owner, TypeList.VOID, printExceptionBlockContent, 3);
+        List<CatchBlock> catchBlocks1 = new ArrayList<>();
+        catchBlocks1.add(new CatchBlock(printExceptionBlock, throwables, 3));
+        List<CatchBlock> catchBlocks2 = new ArrayList<>();
+        catchBlocks2.add(new CatchBlock(printExceptionBlock, throwables, 3));
+        List<CatchBlock> catchBlocks3 = new ArrayList<>();
+        catchBlocks3.add(new CatchBlock(printExceptionBlock, throwables, 2));
+
+        TryCatchBlock tryCatch1 = new TryCatchBlock(tryNode, nothing, catchBlocks1, 3);
         List<IRNode> printArgs = new ArrayList<>();
         VariableInfo systemOutInfo = new VariableInfo("out", systemKlass, printStreamKlass,
                 VariableInfo.STATIC | VariableInfo.PUBLIC);
         StaticMemberVariable systemOutVar = new StaticMemberVariable(owner, systemOutInfo);
         printArgs.add(systemOutVar);
         printArgs.add(tVar);
-        Function print = new Function(printStreamKlass, systemOutPrintInfo, printArgs);
+        Function print = new Function(printStreamKlass, printInfo, printArgs);
         ArrayList<IRNode> printBlockContent = new ArrayList<>();
         printBlockContent.add(new Statement(print, true));
         Block printBlock = new Block(owner, TypeList.VOID, printBlockContent, 3);
--- a/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/OptionResolver.java	Wed Jul 05 21:53:18 2017 +0200
+++ b/hotspot/test/testlibrary/jittester/src/jdk/test/lib/jittester/utils/OptionResolver.java	Thu Jun 23 17:07:27 2016 -0700
@@ -230,7 +230,7 @@
 
         @Override
         public Long parseFromString(String arg) {
-            return new Long(arg);
+            return Long.valueOf(arg);
         }
     }
 
@@ -242,7 +242,7 @@
 
         @Override
         public Integer parseFromString(String arg) {
-            return new Integer(arg);
+            return Integer.valueOf(arg);
         }
     }