changeset 11702:7f9be2d3ed2b

Merge
author rbackman
date Mon, 11 Jul 2016 13:14:19 +0200
parents 46fba2696985 ee13fc537367
children 6d76a3e7702e
files
diffstat 106 files changed, 1602 insertions(+), 656 deletions(-) [+]
line wrap: on
line diff
--- a/.mx.jvmci/mx_jvmci.py	Wed Jul 06 20:58:08 2016 +0900
+++ b/.mx.jvmci/mx_jvmci.py	Mon Jul 11 13:14:19 2016 +0200
@@ -64,7 +64,7 @@
 _jdkDebugLevels = ['release', 'fastdebug', 'slowdebug']
 
 # TODO: add client once/if it can be built on 64-bit platforms
-_jdkJvmVariants = ['server']
+_jdkJvmVariants = ['server', 'client']
 
 """
 Translation table from mx_jvmci:8 --vmbuild values to mx_jvmci:9 --jdk-debug-level values.
--- a/src/cpu/aarch64/vm/aarch64.ad	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/aarch64.ad	Mon Jul 11 13:14:19 2016 +0200
@@ -1942,11 +1942,34 @@
 
   bool is_CAS(int opcode)
   {
-    return (opcode == Op_CompareAndSwapI ||
-	    opcode == Op_CompareAndSwapL ||
-	    opcode == Op_CompareAndSwapN ||
-	    opcode == Op_CompareAndSwapP);
-  }
+    switch(opcode) {
+      // We handle these
+    case Op_CompareAndSwapI:
+    case Op_CompareAndSwapL:
+    case Op_CompareAndSwapP:
+    case Op_CompareAndSwapN:
+ // case Op_CompareAndSwapB:
+ // case Op_CompareAndSwapS:
+      return true;
+      // These are TBD
+    case Op_WeakCompareAndSwapB:
+    case Op_WeakCompareAndSwapS:
+    case Op_WeakCompareAndSwapI:
+    case Op_WeakCompareAndSwapL:
+    case Op_WeakCompareAndSwapP:
+    case Op_WeakCompareAndSwapN:
+    case Op_CompareAndExchangeB:
+    case Op_CompareAndExchangeS:
+    case Op_CompareAndExchangeI:
+    case Op_CompareAndExchangeL:
+    case Op_CompareAndExchangeP:
+    case Op_CompareAndExchangeN:
+      return false;
+    default:
+      return false;
+    }
+  }
+
 
   // leading_to_trailing
   //
@@ -3330,9 +3353,6 @@
 const bool Matcher::match_rule_supported(int opcode) {
 
   switch (opcode) {
-  case Op_StrComp:
-    if (CompactStrings)  return false;
-    break;
   default:
     break;
   }
@@ -4241,14 +4261,16 @@
     MacroAssembler _masm(&cbuf);
     guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
     __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
-               Assembler::xword, /*acquire*/ false, /*release*/ true);
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, noreg);
   %}
 
   enc_class aarch64_enc_cmpxchgw(memory mem, iRegINoSp oldval, iRegINoSp newval) %{
     MacroAssembler _masm(&cbuf);
     guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
     __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
-               Assembler::word, /*acquire*/ false, /*release*/ true);
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, noreg);
   %}
 
 
@@ -4260,14 +4282,16 @@
     MacroAssembler _masm(&cbuf);
     guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
     __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
-               Assembler::xword, /*acquire*/ true, /*release*/ true);
+               Assembler::xword, /*acquire*/ true, /*release*/ true,
+               /*weak*/ false, noreg);
   %}
 
   enc_class aarch64_enc_cmpxchgw_acq(memory mem, iRegINoSp oldval, iRegINoSp newval) %{
     MacroAssembler _masm(&cbuf);
     guarantee($mem$$index == -1 && $mem$$disp == 0, "impossible encoding");
     __ cmpxchg($mem$$base$$Register, $oldval$$Register, $newval$$Register,
-               Assembler::word, /*acquire*/ true, /*release*/ true);
+               Assembler::word, /*acquire*/ true, /*release*/ true,
+               /*weak*/ false, noreg);
   %}
 
 
@@ -5806,6 +5830,7 @@
 %{
   constraint(ALLOC_IN_RC(no_special_reg));
   match(RegL);
+  match(iRegL_R0);
   format %{ %}
   interface(REG_INTER);
 %}
@@ -5927,6 +5952,39 @@
   interface(REG_INTER);
 %}
 
+// Long 64 bit Register R0 only
+operand iRegL_R0()
+%{
+  constraint(ALLOC_IN_RC(r0_reg));
+  match(RegL);
+  match(iRegLNoSp);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
+// Long 64 bit Register R2 only
+operand iRegL_R2()
+%{
+  constraint(ALLOC_IN_RC(r2_reg));
+  match(RegL);
+  match(iRegLNoSp);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
+// Long 64 bit Register R3 only
+operand iRegL_R3()
+%{
+  constraint(ALLOC_IN_RC(r3_reg));
+  match(RegL);
+  match(iRegLNoSp);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
 // Long 64 bit Register R11 only
 operand iRegL_R11()
 %{
@@ -5983,7 +6041,7 @@
 %}
 
 
-// Register R2 only
+// Register R4 only
 operand iRegI_R4()
 %{
   constraint(ALLOC_IN_RC(int_r4_reg));
@@ -6007,6 +6065,33 @@
   interface(REG_INTER);
 %}
 
+operand iRegN_R0()
+%{
+  constraint(ALLOC_IN_RC(r0_reg));
+  match(iRegN);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
+operand iRegN_R2()
+%{
+  constraint(ALLOC_IN_RC(r2_reg));
+  match(iRegN);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
+operand iRegN_R3()
+%{
+  constraint(ALLOC_IN_RC(r3_reg));
+  match(iRegN);
+  op_cost(0);
+  format %{ %}
+  interface(REG_INTER);
+%}
+
 // Integer 64 bit Register not Special
 operand iRegNNoSp()
 %{
@@ -9393,12 +9478,12 @@
   ins_pipe(pipe_slow);
 %}
 
+// standard CompareAndSwapX when we are using barriers
+// these have higher priority than the rules selected by a predicate
+
 // XXX No flag versions for CompareAndSwap{I,L,P,N} because matcher
 // can't match them
 
-// standard CompareAndSwapX when we are using barriers
-// these have higher priority than the rules selected by a predicate
-
 instruct compareAndSwapI(iRegINoSp res, indirect mem, iRegINoSp oldval, iRegINoSp newval, rFlagsReg cr) %{
 
   match(Set res (CompareAndSwapI mem (Binary oldval newval)));
@@ -9550,6 +9635,216 @@
 %}
 
 
+// ---------------------------------------------------------------------
+// Sundry CAS operations.  Note that release is always true,
+// regardless of the memory ordering of the CAS.  This is because we
+// need the volatile case to be sequentially consistent but there is
+// no trailing StoreLoad barrier emitted by C2.  Unfortunately we
+// can't check the type of memory ordering here, so we always emit a
+// STLXR.
+
+// This section is generated from aarch64_ad_cas.m4
+
+
+instruct compareAndExchangeB(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeB mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (byte, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ uxtbw(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::byte, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+    __ sxtbw($res$$Register, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeS(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeS mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (short, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ uxthw(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::halfword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+    __ sxthw($res$$Register, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeI(iRegI_R0 res, indirect mem, iRegI_R2 oldval, iRegI_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeI mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (int, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeL(iRegL_R0 res, indirect mem, iRegL_R2 oldval, iRegL_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeL mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (long, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeN(iRegN_R0 res, indirect mem, iRegN_R2 oldval, iRegN_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeN mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (narrow oop, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct compareAndExchangeP(iRegP_R0 res, indirect mem, iRegP_R2 oldval, iRegP_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchangeP mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapB(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapB mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (byte, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ uxtbw(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::byte, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapS(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapS mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (short, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ uxthw(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::halfword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapI(iRegINoSp res, indirect mem, iRegI oldval, iRegI newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapI mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (int, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapL(iRegINoSp res, indirect mem, iRegL oldval, iRegL newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapL mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (long, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapN(iRegINoSp res, indirect mem, iRegN oldval, iRegN newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapN mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (narrow oop, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::word, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+
+instruct weakCompareAndSwapP(iRegINoSp res, indirect mem, iRegP oldval, iRegP newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwapP mem (Binary oldval newval)));
+  ins_cost(2 * VOLATILE_REF_COST);
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# (ptr, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::xword, /*acquire*/ false, /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}
+// ---------------------------------------------------------------------
+
 instruct get_and_setI(indirect mem, iRegINoSp newv, iRegI prev) %{
   match(Set prev (GetAndSetI mem newv));
   format %{ "atomic_xchgw  $prev, $newv, [$mem]" %}
@@ -14988,11 +15283,61 @@
   format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
   ins_encode %{
     // Count is in 8-bit bytes; non-Compact chars are 16 bits.
-    __ asrw($cnt1$$Register, $cnt1$$Register, 1);
-    __ asrw($cnt2$$Register, $cnt2$$Register, 1);
     __ string_compare($str1$$Register, $str2$$Register,
                       $cnt1$$Register, $cnt2$$Register, $result$$Register,
-                      $tmp1$$Register);
+                      $tmp1$$Register,
+                      fnoreg, fnoreg, StrIntrinsicNode::UU);
+  %}
+  ins_pipe(pipe_class_memory);
+%}
+
+instruct string_compareL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
+                        iRegI_R0 result, iRegP_R10 tmp1, rFlagsReg cr)
+%{
+  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL);
+  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
+  effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
+
+  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
+  ins_encode %{
+    __ string_compare($str1$$Register, $str2$$Register,
+                      $cnt1$$Register, $cnt2$$Register, $result$$Register,
+                      $tmp1$$Register,
+                      fnoreg, fnoreg, StrIntrinsicNode::LL);
+  %}
+  ins_pipe(pipe_class_memory);
+%}
+
+instruct string_compareUL(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
+                        iRegI_R0 result, vRegD vtmp1, vRegD vtmp2, iRegP_R10 tmp1, rFlagsReg cr)
+%{
+  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UL);
+  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
+  effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP vtmp1, TEMP vtmp2, KILL cr);
+
+  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
+  ins_encode %{
+    __ string_compare($str1$$Register, $str2$$Register,
+                      $cnt1$$Register, $cnt2$$Register, $result$$Register,
+                      $tmp1$$Register,
+                      $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, StrIntrinsicNode::UL);
+  %}
+  ins_pipe(pipe_class_memory);
+%}
+
+instruct string_compareLU(iRegP_R1 str1, iRegI_R2 cnt1, iRegP_R3 str2, iRegI_R4 cnt2,
+                        iRegI_R0 result, vRegD vtmp1, vRegD vtmp2, iRegP_R10 tmp1, rFlagsReg cr)
+%{
+  predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LU);
+  match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
+  effect(KILL tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, TEMP vtmp1, TEMP vtmp2, KILL cr);
+
+  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   # KILL $tmp1" %}
+  ins_encode %{
+    __ string_compare($str1$$Register, $str2$$Register,
+                      $cnt1$$Register, $cnt2$$Register, $result$$Register,
+                      $tmp1$$Register,
+                      $vtmp1$$FloatRegister, $vtmp2$$FloatRegister, StrIntrinsicNode::LU);
   %}
   ins_pipe(pipe_class_memory);
 %}
--- a/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/c1_LIRAssembler_aarch64.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -1556,13 +1556,13 @@
 }
 
 void LIR_Assembler::casw(Register addr, Register newval, Register cmpval) {
-  __ cmpxchg(addr, cmpval, newval, Assembler::word, /* acquire*/ true, /* release*/ true, rscratch1);
+  __ cmpxchg(addr, cmpval, newval, Assembler::word, /* acquire*/ true, /* release*/ true, /* weak*/ false, rscratch1);
   __ cset(rscratch1, Assembler::NE);
   __ membar(__ AnyAny);
 }
 
 void LIR_Assembler::casl(Register addr, Register newval, Register cmpval) {
-  __ cmpxchg(addr, cmpval, newval, Assembler::xword, /* acquire*/ true, /* release*/ true, rscratch1);
+  __ cmpxchg(addr, cmpval, newval, Assembler::xword, /* acquire*/ true, /* release*/ true, /* weak*/ false, rscratch1);
   __ cset(rscratch1, Assembler::NE);
   __ membar(__ AnyAny);
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cpu/aarch64/vm/cas.m4	Mon Jul 11 13:14:19 2016 +0200
@@ -0,0 +1,109 @@
+// Sundry CAS operations.  Note that release is always true,
+// regardless of the memory ordering of the CAS.  This is because we
+// need the volatile case to be sequentially consistent but there is
+// no trailing StoreLoad barrier emitted by C2.  Unfortunately we
+// can't check the type of memory ordering here, so we always emit a
+// STLXR.
+
+define(`CAS_INSN',
+`
+instruct compareAndExchange$1$5(iReg$2_R0 res, indirect mem, iReg$2_R2 oldval, iReg$2_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchange$1 mem (Binary oldval newval)));
+  ifelse($5,Acq,'  predicate(needs_acquiring_load_exclusive(n));
+  ins_cost(VOLATILE_REF_COST);`,'  ins_cost(2 * VOLATILE_REF_COST);`)
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
+               /*weak*/ false, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}')dnl
+define(`CAS_INSN4',
+`
+instruct compareAndExchange$1$7(iReg$2_R0 res, indirect mem, iReg$2_R2 oldval, iReg$2_R3 newval, rFlagsReg cr) %{
+  match(Set res (CompareAndExchange$1 mem (Binary oldval newval)));
+  ifelse($7,Acq,'  predicate(needs_acquiring_load_exclusive(n));
+  ins_cost(VOLATILE_REF_COST);`,'  ins_cost(2 * VOLATILE_REF_COST);`)
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
+  %}
+  ins_encode %{
+    __ $5(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
+               /*weak*/ false, $res$$Register);
+    __ $6($res$$Register, $res$$Register);
+  %}
+  ins_pipe(pipe_slow);
+%}')dnl
+CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw)
+CAS_INSN4(S,I,short,halfword,uxthw,sxthw)
+CAS_INSN(I,I,int,word)
+CAS_INSN(L,L,long,xword)
+CAS_INSN(N,N,narrow oop,word)
+CAS_INSN(P,P,ptr,xword)
+dnl
+dnl CAS_INSN4(B,I,byte,byte,uxtbw,sxtbw,Acq)
+dnl CAS_INSN4(S,I,short,halfword,uxthw,sxthw,Acq)
+dnl CAS_INSN(I,I,int,word,Acq)
+dnl CAS_INSN(L,L,long,xword,Acq)
+dnl CAS_INSN(N,N,narrow oop,word,Acq)
+dnl CAS_INSN(P,P,ptr,xword,Acq)
+dnl
+define(`CAS_INSN2',
+`
+instruct weakCompareAndSwap$1$6(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval)));
+  ifelse($6,Acq,'  predicate(needs_acquiring_load_exclusive(n));
+  ins_cost(VOLATILE_REF_COST);`,'  ins_cost(2 * VOLATILE_REF_COST);`)
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ uxt$5(rscratch2, $oldval$$Register);
+    __ cmpxchg($mem$$Register, rscratch2, $newval$$Register,
+               Assembler::$4, /*acquire*/ ifelse($6,Acq,true,false), /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}')dnl
+define(`CAS_INSN3',
+`
+instruct weakCompareAndSwap$1$5(iRegINoSp res, indirect mem, iReg$2 oldval, iReg$2 newval, rFlagsReg cr) %{
+  match(Set res (WeakCompareAndSwap$1 mem (Binary oldval newval)));
+  ifelse($5,Acq,'  predicate(needs_acquiring_load_exclusive(n));
+  ins_cost(VOLATILE_REF_COST);`,'  ins_cost(2 * VOLATILE_REF_COST);`)
+  effect(KILL cr);
+  format %{
+    "cmpxchg $res = $mem, $oldval, $newval\t# ($3, weak) if $mem == $oldval then $mem <-- $newval"
+    "csetw $res, EQ\t# $res <-- (EQ ? 1 : 0)"
+  %}
+  ins_encode %{
+    __ cmpxchg($mem$$Register, $oldval$$Register, $newval$$Register,
+               Assembler::$4, /*acquire*/ ifelse($5,Acq,true,false), /*release*/ true,
+               /*weak*/ true, noreg);
+    __ csetw($res$$Register, Assembler::EQ);
+  %}
+  ins_pipe(pipe_slow);
+%}')dnl
+CAS_INSN2(B,I,byte,byte,bw)
+CAS_INSN2(S,I,short,halfword,hw)
+CAS_INSN3(I,I,int,word)
+CAS_INSN3(L,L,long,xword)
+CAS_INSN3(N,N,narrow oop,word)
+CAS_INSN3(P,P,ptr,xword)
+dnl CAS_INSN2(B,I,byte,byte,bw,Acq)
+dnl CAS_INSN2(S,I,short,halfword,hw,Acq)
+dnl CAS_INSN3(I,I,int,word,Acq)
+dnl CAS_INSN3(L,L,long,xword,Acq)
+dnl CAS_INSN3(N,N,narrow oop,word,Acq)
+dnl CAS_INSN3(P,P,ptr,xword,Acq)
+dnl
--- a/src/cpu/aarch64/vm/globals_aarch64.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/globals_aarch64.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -118,6 +118,7 @@
 // Don't attempt to use Neon on builtin sim until builtin sim supports it
 #define UseCRC32 false
 #define UseSIMDForMemoryOps    false
+#define AvoidUnalignedAcesses false
 
 #else
 #define UseBuiltinSim           false
@@ -144,6 +145,8 @@
           "Use CRC32 instructions for CRC32 computation")               \
   product(bool, UseSIMDForMemoryOps, false,                             \
           "Use SIMD instructions in generated memory move code")        \
+  product(bool, AvoidUnalignedAccesses, false,                          \
+          "Avoid generating unaligned memory accesses")                 \
   product(bool, UseLSE, false,                                          \
           "Use LSE instructions")                                       \
   product(bool, UseBlockZeroing, true,                                  \
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -36,6 +36,7 @@
 #include "oops/klass.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "opto/compile.hpp"
+#include "opto/intrinsicnode.hpp"
 #include "opto/node.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/icache.hpp"
@@ -565,11 +566,6 @@
   br(Assembler::EQ, done);
 }
 
-
-// added to make this compile
-
-REGISTER_DEFINITION(Register, noreg);
-
 static void pass_arg0(MacroAssembler* masm, Register arg) {
   if (c_rarg0 != arg ) {
     masm->mov(c_rarg0, arg);
@@ -2145,30 +2141,40 @@
     b(*fail);
 }
 
-// A generic CAS; success or failure is in the EQ flag.
+// A generic CAS; success or failure is in the EQ flag.  A weak CAS
+// doesn't retry and may fail spuriously.  If the oldval is wanted,
+// Pass a register for the result, otherwise pass noreg.
+
+// Clobbers rscratch1
 void MacroAssembler::cmpxchg(Register addr, Register expected,
                              Register new_val,
                              enum operand_size size,
                              bool acquire, bool release,
-                             Register tmp) {
+                             bool weak,
+                             Register result) {
+  if (result == noreg)  result = rscratch1;
   if (UseLSE) {
-    mov(tmp, expected);
-    lse_cas(tmp, new_val, addr, size, acquire, release, /*not_pair*/ true);
-    cmp(tmp, expected);
+    mov(result, expected);
+    lse_cas(result, new_val, addr, size, acquire, release, /*not_pair*/ true);
+    cmp(result, expected);
   } else {
     BLOCK_COMMENT("cmpxchg {");
     Label retry_load, done;
     if ((VM_Version::features() & VM_Version::CPU_STXR_PREFETCH))
       prfm(Address(addr), PSTL1STRM);
     bind(retry_load);
-    load_exclusive(tmp, addr, size, acquire);
+    load_exclusive(result, addr, size, acquire);
     if (size == xword)
-      cmp(tmp, expected);
+      cmp(result, expected);
     else
-      cmpw(tmp, expected);
+      cmpw(result, expected);
     br(Assembler::NE, done);
-    store_exclusive(tmp, new_val, addr, size, release);
-    cbnzw(tmp, retry_load);
+    store_exclusive(rscratch1, new_val, addr, size, release);
+    if (weak) {
+      cmpw(rscratch1, 0u);  // If the store fails, return NE to our caller.
+    } else {
+      cbnzw(rscratch1, retry_load);
+    }
     bind(done);
     BLOCK_COMMENT("} cmpxchg");
   }
@@ -4500,21 +4506,49 @@
   BIND(DONE);
 }
 
+typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr);
+typedef void (MacroAssembler::* uxt_insn)(Register Rd, Register Rn);
+
 // Compare strings.
 void MacroAssembler::string_compare(Register str1, Register str2,
                                     Register cnt1, Register cnt2, Register result,
-                                    Register tmp1) {
+                                    Register tmp1,
+                                    FloatRegister vtmp, FloatRegister vtmpZ, int ae) {
   Label LENGTH_DIFF, DONE, SHORT_LOOP, SHORT_STRING,
     NEXT_WORD, DIFFERENCE;
 
+  bool isLL = ae == StrIntrinsicNode::LL;
+  bool isLU = ae == StrIntrinsicNode::LU;
+  bool isUL = ae == StrIntrinsicNode::UL;
+
+  bool str1_isL = isLL || isLU;
+  bool str2_isL = isLL || isUL;
+
+  int str1_chr_shift = str1_isL ? 0 : 1;
+  int str2_chr_shift = str2_isL ? 0 : 1;
+  int str1_chr_size = str1_isL ? 1 : 2;
+  int str2_chr_size = str2_isL ? 1 : 2;
+
+  chr_insn str1_load_chr = str1_isL ? (chr_insn)&MacroAssembler::ldrb :
+                                      (chr_insn)&MacroAssembler::ldrh;
+  chr_insn str2_load_chr = str2_isL ? (chr_insn)&MacroAssembler::ldrb :
+                                      (chr_insn)&MacroAssembler::ldrh;
+  uxt_insn ext_chr = isLL ? (uxt_insn)&MacroAssembler::uxtbw :
+                            (uxt_insn)&MacroAssembler::uxthw;
+
   BLOCK_COMMENT("string_compare {");
 
+  // Bizzarely, the counts are passed in bytes, regardless of whether they
+  // are L or U strings, however the result is always in characters.
+  if (!str1_isL) asrw(cnt1, cnt1, 1);
+  if (!str2_isL) asrw(cnt2, cnt2, 1);
+
   // Compute the minimum of the string lengths and save the difference.
   subsw(tmp1, cnt1, cnt2);
   cselw(cnt2, cnt1, cnt2, Assembler::LE); // min
 
   // A very short string
-  cmpw(cnt2, 4);
+  cmpw(cnt2, isLL ? 8:4);
   br(Assembler::LT, SHORT_STRING);
 
   // Check if the strings start at the same location.
@@ -4523,20 +4557,37 @@
 
   // Compare longwords
   {
-    subw(cnt2, cnt2, 4); // The last longword is a special case
+    subw(cnt2, cnt2, isLL ? 8:4); // The last longword is a special case
 
     // Move both string pointers to the last longword of their
     // strings, negate the remaining count, and convert it to bytes.
-    lea(str1, Address(str1, cnt2, Address::uxtw(1)));
-    lea(str2, Address(str2, cnt2, Address::uxtw(1)));
-    sub(cnt2, zr, cnt2, LSL, 1);
+    lea(str1, Address(str1, cnt2, Address::uxtw(str1_chr_shift)));
+    lea(str2, Address(str2, cnt2, Address::uxtw(str2_chr_shift)));
+    if (isLU || isUL) {
+      sub(cnt1, zr, cnt2, LSL, str1_chr_shift);
+      eor(vtmpZ, T16B, vtmpZ, vtmpZ);
+    }
+    sub(cnt2, zr, cnt2, LSL, str2_chr_shift);
 
     // Loop, loading longwords and comparing them into rscratch2.
     bind(NEXT_WORD);
-    ldr(result, Address(str1, cnt2));
-    ldr(cnt1, Address(str2, cnt2));
-    adds(cnt2, cnt2, wordSize);
-    eor(rscratch2, result, cnt1);
+    if (isLU) {
+      ldrs(vtmp, Address(str1, cnt1));
+      zip1(vtmp, T8B, vtmp, vtmpZ);
+      umov(result, vtmp, D, 0);
+    } else {
+      ldr(result, Address(str1, isUL ? cnt1:cnt2));
+    }
+    if (isUL) {
+      ldrs(vtmp, Address(str2, cnt2));
+      zip1(vtmp, T8B, vtmp, vtmpZ);
+      umov(rscratch1, vtmp, D, 0);
+    } else {
+      ldr(rscratch1, Address(str2, cnt2));
+    }
+    adds(cnt2, cnt2, isUL ? 4:8);
+    if (isLU || isUL) add(cnt1, cnt1, isLU ? 4:8);
+    eor(rscratch2, result, rscratch1);
     cbnz(rscratch2, DIFFERENCE);
     br(Assembler::LT, NEXT_WORD);
 
@@ -4544,9 +4595,21 @@
     // same longword twice, but that's still faster than another
     // conditional branch.
 
-    ldr(result, Address(str1));
-    ldr(cnt1, Address(str2));
-    eor(rscratch2, result, cnt1);
+    if (isLU) {
+      ldrs(vtmp, Address(str1));
+      zip1(vtmp, T8B, vtmp, vtmpZ);
+      umov(result, vtmp, D, 0);
+    } else {
+      ldr(result, Address(str1));
+    }
+    if (isUL) {
+      ldrs(vtmp, Address(str2));
+      zip1(vtmp, T8B, vtmp, vtmpZ);
+      umov(rscratch1, vtmp, D, 0);
+    } else {
+      ldr(rscratch1, Address(str2));
+    }
+    eor(rscratch2, result, rscratch1);
     cbz(rscratch2, LENGTH_DIFF);
 
     // Find the first different characters in the longwords and
@@ -4554,12 +4617,12 @@
     bind(DIFFERENCE);
     rev(rscratch2, rscratch2);
     clz(rscratch2, rscratch2);
-    andr(rscratch2, rscratch2, -16);
+    andr(rscratch2, rscratch2, isLL ? -8 : -16);
     lsrv(result, result, rscratch2);
-    uxthw(result, result);
-    lsrv(cnt1, cnt1, rscratch2);
-    uxthw(cnt1, cnt1);
-    subw(result, result, cnt1);
+    (this->*ext_chr)(result, result);
+    lsrv(rscratch1, rscratch1, rscratch2);
+    (this->*ext_chr)(rscratch1, rscratch1);
+    subw(result, result, rscratch1);
     b(DONE);
   }
 
@@ -4568,8 +4631,8 @@
   cbz(cnt2, LENGTH_DIFF);
 
   bind(SHORT_LOOP);
-  load_unsigned_short(result, Address(post(str1, 2)));
-  load_unsigned_short(cnt1, Address(post(str2, 2)));
+  (this->*str1_load_chr)(result, Address(post(str1, str1_chr_size)));
+  (this->*str2_load_chr)(cnt1, Address(post(str2, str2_chr_size)));
   subw(result, result, cnt1);
   cbnz(result, DONE);
   sub(cnt2, cnt2, 1);
--- a/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -995,10 +995,11 @@
   }
 
   // A generic CAS; success or failure is in the EQ flag.
+  // Clobbers rscratch1
   void cmpxchg(Register addr, Register expected, Register new_val,
                enum operand_size size,
-               bool acquire, bool release,
-               Register tmp = rscratch1);
+               bool acquire, bool release, bool weak,
+               Register result);
 
   // Calls
 
@@ -1198,7 +1199,8 @@
 
   void string_compare(Register str1, Register str2,
                       Register cnt1, Register cnt2, Register result,
-                      Register tmp1);
+                      Register tmp1,
+                      FloatRegister vtmp, FloatRegister vtmpZ, int ae);
 
   void arrays_equals(Register a1, Register a2,
                      Register result, Register cnt1,
--- a/src/cpu/aarch64/vm/register_definitions_aarch64.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/register_definitions_aarch64.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -29,6 +29,8 @@
 #include "register_aarch64.hpp"
 # include "interp_masm_aarch64.hpp"
 
+REGISTER_DEFINITION(Register, noreg);
+
 REGISTER_DEFINITION(Register, r0);
 REGISTER_DEFINITION(Register, r1);
 REGISTER_DEFINITION(Register, r2);
@@ -62,6 +64,8 @@
 REGISTER_DEFINITION(Register, r30);
 REGISTER_DEFINITION(Register, sp);
 
+REGISTER_DEFINITION(FloatRegister, fnoreg);
+
 REGISTER_DEFINITION(FloatRegister, v0);
 REGISTER_DEFINITION(FloatRegister, v1);
 REGISTER_DEFINITION(FloatRegister, v2);
--- a/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -801,6 +801,12 @@
     StubCodeMark mark(this, "StubRoutines", stub_name);
     __ align(CodeEntryAlignment);
     __ bind(start);
+
+    Label unaligned_copy_long;
+    if (AvoidUnalignedAccesses) {
+      __ tbnz(d, 3, unaligned_copy_long);
+    }
+
     if (direction == copy_forwards) {
       __ sub(s, s, bias);
       __ sub(d, d, bias);
@@ -901,6 +907,198 @@
     }
 
     __ ret(lr);
+
+    if (AvoidUnalignedAccesses) {
+      Label drain, again;
+      // Register order for storing. Order is different for backward copy.
+
+      __ bind(unaligned_copy_long);
+
+      // source address is even aligned, target odd aligned
+      //
+      // when forward copying word pairs we read long pairs at offsets
+      // {0, 2, 4, 6} (in long words). when backwards copying we read
+      // long pairs at offsets {-2, -4, -6, -8}. We adjust the source
+      // address by -2 in the forwards case so we can compute the
+      // source offsets for both as {2, 4, 6, 8} * unit where unit = 1
+      // or -1.
+      //
+      // when forward copying we need to store 1 word, 3 pairs and
+      // then 1 word at offsets {0, 1, 3, 5, 7}. Rather thna use a
+      // zero offset We adjust the destination by -1 which means we
+      // have to use offsets { 1, 2, 4, 6, 8} * unit for the stores.
+      //
+      // When backwards copyng we need to store 1 word, 3 pairs and
+      // then 1 word at offsets {-1, -3, -5, -7, -8} i.e. we use
+      // offsets {1, 3, 5, 7, 8} * unit.
+
+      if (direction == copy_forwards) {
+        __ sub(s, s, 16);
+        __ sub(d, d, 8);
+      }
+
+      // Fill 8 registers
+      //
+      // for forwards copy s was offset by -16 from the original input
+      // value of s so the register contents are at these offsets
+      // relative to the 64 bit block addressed by that original input
+      // and so on for each successive 64 byte block when s is updated
+      //
+      // t0 at offset 0,  t1 at offset 8
+      // t2 at offset 16, t3 at offset 24
+      // t4 at offset 32, t5 at offset 40
+      // t6 at offset 48, t7 at offset 56
+
+      // for backwards copy s was not offset so the register contents
+      // are at these offsets into the preceding 64 byte block
+      // relative to that original input and so on for each successive
+      // preceding 64 byte block when s is updated. this explains the
+      // slightly counter-intuitive looking pattern of register usage
+      // in the stp instructions for backwards copy.
+      //
+      // t0 at offset -16, t1 at offset -8
+      // t2 at offset -32, t3 at offset -24
+      // t4 at offset -48, t5 at offset -40
+      // t6 at offset -64, t7 at offset -56
+
+      __ ldp(t0, t1, Address(s, 2 * unit));
+      __ ldp(t2, t3, Address(s, 4 * unit));
+      __ ldp(t4, t5, Address(s, 6 * unit));
+      __ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
+
+      __ subs(count, count, 16);
+      __ br(Assembler::LO, drain);
+
+      int prefetch = PrefetchCopyIntervalInBytes;
+      bool use_stride = false;
+      if (direction == copy_backwards) {
+         use_stride = prefetch > 256;
+         prefetch = -prefetch;
+         if (use_stride) __ mov(stride, prefetch);
+      }
+
+      __ bind(again);
+
+      if (PrefetchCopyIntervalInBytes > 0)
+        __ prfm(use_stride ? Address(s, stride) : Address(s, prefetch), PLDL1KEEP);
+
+      if (direction == copy_forwards) {
+       // allowing for the offset of -8 the store instructions place
+       // registers into the target 64 bit block at the following
+       // offsets
+       //
+       // t0 at offset 0
+       // t1 at offset 8,  t2 at offset 16
+       // t3 at offset 24, t4 at offset 32
+       // t5 at offset 40, t6 at offset 48
+       // t7 at offset 56
+
+        __ str(t0, Address(d, 1 * unit));
+        __ stp(t1, t2, Address(d, 2 * unit));
+        __ ldp(t0, t1, Address(s, 2 * unit));
+        __ stp(t3, t4, Address(d, 4 * unit));
+        __ ldp(t2, t3, Address(s, 4 * unit));
+        __ stp(t5, t6, Address(d, 6 * unit));
+        __ ldp(t4, t5, Address(s, 6 * unit));
+        __ str(t7, Address(__ pre(d, 8 * unit)));
+        __ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
+      } else {
+       // d was not offset when we started so the registers are
+       // written into the 64 bit block preceding d with the following
+       // offsets
+       //
+       // t1 at offset -8
+       // t3 at offset -24, t0 at offset -16
+       // t5 at offset -48, t2 at offset -32
+       // t7 at offset -56, t4 at offset -48
+       //                   t6 at offset -64
+       //
+       // note that this matches the offsets previously noted for the
+       // loads
+
+        __ str(t1, Address(d, 1 * unit));
+        __ stp(t3, t0, Address(d, 3 * unit));
+        __ ldp(t0, t1, Address(s, 2 * unit));
+        __ stp(t5, t2, Address(d, 5 * unit));
+        __ ldp(t2, t3, Address(s, 4 * unit));
+        __ stp(t7, t4, Address(d, 7 * unit));
+        __ ldp(t4, t5, Address(s, 6 * unit));
+        __ str(t6, Address(__ pre(d, 8 * unit)));
+        __ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
+      }
+
+      __ subs(count, count, 8);
+      __ br(Assembler::HS, again);
+
+      // Drain
+      //
+      // this uses the same pattern of offsets and register arguments
+      // as above
+      __ bind(drain);
+      if (direction == copy_forwards) {
+        __ str(t0, Address(d, 1 * unit));
+        __ stp(t1, t2, Address(d, 2 * unit));
+        __ stp(t3, t4, Address(d, 4 * unit));
+        __ stp(t5, t6, Address(d, 6 * unit));
+        __ str(t7, Address(__ pre(d, 8 * unit)));
+      } else {
+        __ str(t1, Address(d, 1 * unit));
+        __ stp(t3, t0, Address(d, 3 * unit));
+        __ stp(t5, t2, Address(d, 5 * unit));
+        __ stp(t7, t4, Address(d, 7 * unit));
+        __ str(t6, Address(__ pre(d, 8 * unit)));
+      }
+      // now we need to copy any remaining part block which may
+      // include a 4 word block subblock and/or a 2 word subblock.
+      // bits 2 and 1 in the count are the tell-tale for whetehr we
+      // have each such subblock
+      {
+        Label L1, L2;
+        __ tbz(count, exact_log2(4), L1);
+       // this is the same as above but copying only 4 longs hence
+       // with ony one intervening stp between the str instructions
+       // but note that the offsets and registers still follow the
+       // same pattern
+        __ ldp(t0, t1, Address(s, 2 * unit));
+        __ ldp(t2, t3, Address(__ pre(s, 4 * unit)));
+        if (direction == copy_forwards) {
+          __ str(t0, Address(d, 1 * unit));
+          __ stp(t1, t2, Address(d, 2 * unit));
+          __ str(t3, Address(__ pre(d, 4 * unit)));
+        } else {
+          __ str(t1, Address(d, 1 * unit));
+          __ stp(t3, t0, Address(d, 3 * unit));
+          __ str(t2, Address(__ pre(d, 4 * unit)));
+        }
+        __ bind(L1);
+
+        __ tbz(count, 1, L2);
+       // this is the same as above but copying only 2 longs hence
+       // there is no intervening stp between the str instructions
+       // but note that the offset and register patterns are still
+       // the same
+        __ ldp(t0, t1, Address(__ pre(s, 2 * unit)));
+        if (direction == copy_forwards) {
+          __ str(t0, Address(d, 1 * unit));
+          __ str(t1, Address(__ pre(d, 2 * unit)));
+        } else {
+          __ str(t1, Address(d, 1 * unit));
+          __ str(t0, Address(__ pre(d, 2 * unit)));
+        }
+        __ bind(L2);
+
+       // for forwards copy we need to re-adjust the offsets we
+       // applied so that s and d are follow the last words written
+
+       if (direction == copy_forwards) {
+         __ add(s, s, 16);
+         __ add(d, d, 8);
+       }
+
+      }
+
+      __ ret(lr);
+      }
   }
 
   // Small copy: less than 16 bytes.
@@ -1024,11 +1222,9 @@
     // (96 bytes if SIMD because we do 32 byes per instruction)
     __ bind(copy80);
     if (UseSIMDForMemoryOps) {
-      __ ldpq(v0, v1, Address(s, 0));
-      __ ldpq(v2, v3, Address(s, 32));
+      __ ld4(v0, v1, v2, v3, __ T16B, Address(s, 0));
       __ ldpq(v4, v5, Address(send, -32));
-      __ stpq(v0, v1, Address(d, 0));
-      __ stpq(v2, v3, Address(d, 32));
+      __ st4(v0, v1, v2, v3, __ T16B, Address(d, 0));
       __ stpq(v4, v5, Address(dend, -32));
     } else {
       __ ldp(t0, t1, Address(s, 0));
--- a/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -2434,7 +2434,7 @@
   __ ldrsb(r0, field);
   __ push(ztos);
   // Rewrite bytecode to be faster
-  if (!is_static) {
+  if (rc == may_rewrite) {
     // use btos rewriting, no truncating to t/f bit is needed for getfield.
     patch_bytecode(Bytecodes::_fast_bgetfield, bc, r1);
   }
@@ -2670,7 +2670,7 @@
     if (!is_static) pop_and_check_object(obj);
     __ andw(r0, r0, 0x1);
     __ strb(r0, field);
-    if (!is_static) {
+    if (rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_zputfield, bc, r1, true, byte_no);
     }
     __ b(Done);
--- a/src/cpu/aarch64/vm/vm_version_aarch64.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/aarch64/vm/vm_version_aarch64.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -175,7 +175,15 @@
   }
 
   // Enable vendor specific features
-  if (_cpu == CPU_CAVIUM && _variant == 0) _features |= CPU_DMB_ATOMICS;
+  if (_cpu == CPU_CAVIUM) {
+    if (_variant == 0) _features |= CPU_DMB_ATOMICS;
+    if (FLAG_IS_DEFAULT(AvoidUnalignedAccesses)) {
+      FLAG_SET_DEFAULT(AvoidUnalignedAccesses, true);
+    }
+    if (FLAG_IS_DEFAULT(UseSIMDForMemoryOps)) {
+      FLAG_SET_DEFAULT(UseSIMDForMemoryOps, (_variant > 0));
+    }
+  }
   if (_cpu == CPU_ARM && (_model == 0xd03 || _model2 == 0xd03)) _features |= CPU_A53MAC;
   if (_cpu == CPU_ARM && (_model == 0xd07 || _model2 == 0xd07)) _features |= CPU_STXR_PREFETCH;
   // If an olde style /proc/cpuinfo (cpu_lines == 1) then if _model is an A57 (0xd07)
--- a/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -1668,9 +1668,13 @@
         __ lwz(Rscratch3, in_bytes(MethodData::backedge_mask_offset()), Rmdo);
         __ addi(Rscratch2, Rscratch2, increment);
         __ stw(Rscratch2, mdo_bc_offs, Rmdo);
-        __ and_(Rscratch3, Rscratch2, Rscratch3);
-        __ bne(CCR0, Lforward);
-        __ b(Loverflow);
+        if (UseOnStackReplacement) {
+          __ and_(Rscratch3, Rscratch2, Rscratch3);
+          __ bne(CCR0, Lforward);
+          __ b(Loverflow);
+        } else {
+          __ b(Lforward);
+        }
       }
 
       // If there's no MDO, increment counter in method.
@@ -1680,9 +1684,12 @@
       __ lwz(Rscratch3, in_bytes(MethodCounters::backedge_mask_offset()), R4_counters);
       __ addi(Rscratch2, Rscratch2, increment);
       __ stw(Rscratch2, mo_bc_offs, R4_counters);
-      __ and_(Rscratch3, Rscratch2, Rscratch3);
-      __ bne(CCR0, Lforward);
-
+      if (UseOnStackReplacement) {
+        __ and_(Rscratch3, Rscratch2, Rscratch3);
+        __ bne(CCR0, Lforward);
+      } else {
+        __ b(Lforward);
+      }
       __ bind(Loverflow);
 
       // Notify point for loop, pass branch bytecode.
--- a/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/ppc/vm/vtableStubs_ppc_64.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -243,7 +243,7 @@
 }
 
 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
-  if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) {
+  if (DebugVtables || CountCompiledCalls || VerifyOops) {
     return 1000;
   } else {
     int decode_klass_size = MacroAssembler::instr_size_for_decode_klass_not_null();
--- a/src/cpu/sparc/vm/compiledIC_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/compiledIC_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -77,8 +77,7 @@
   // This doesn't need to be accurate but it must be larger or equal to
   // the real size of the stub.
   return (NativeMovConstReg::instruction_size +  // sethi/setlo;
-          NativeJump::instruction_size + // sethi; jmp; nop
-          (TraceJumps ? 20 * BytesPerInstWord : 0) );
+          NativeJump::instruction_size); // sethi; jmp; nop
 }
 
 // Relocation entries for call stub, compiled java to interpreter.
--- a/src/cpu/sparc/vm/icBuffer_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/icBuffer_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -33,12 +33,10 @@
 
 int InlineCacheBuffer::ic_stub_code_size() {
 #ifdef _LP64
-  if (TraceJumps) return 600 * wordSize;
   return (NativeMovConstReg::instruction_size +  // sethi;add
           NativeJump::instruction_size +          // sethi; jmp; delay slot
           (1*BytesPerInstWord) + 1);            // flush + 1 extra byte
 #else
-  if (TraceJumps) return 300 * wordSize;
   return (2+2+ 1) * wordSize + 1; // set/jump_to/nop + 1 byte so that code_end can be set in CodeBuffer
 #endif
 }
--- a/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -184,72 +184,10 @@
 
 void MacroAssembler::jmp2(Register r1, Register r2, const char* file, int line ) {
   assert_not_delayed();
-  // This can only be traceable if r1 & r2 are visible after a window save
-  if (TraceJumps) {
-#ifndef PRODUCT
-    save_frame(0);
-    verify_thread();
-    ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
-    add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
-    sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
-    add(O2, O1, O1);
-
-    add(r1->after_save(), r2->after_save(), O2);
-    set((intptr_t)file, O3);
-    set(line, O4);
-    Label L;
-    // get nearby pc, store jmp target
-    call(L, relocInfo::none);  // No relocation for call to pc+0x8
-    delayed()->st(O2, O1, 0);
-    bind(L);
-
-    // store nearby pc
-    st(O7, O1, sizeof(intptr_t));
-    // store file
-    st(O3, O1, 2*sizeof(intptr_t));
-    // store line
-    st(O4, O1, 3*sizeof(intptr_t));
-    add(O0, 1, O0);
-    and3(O0, JavaThread::jump_ring_buffer_size  - 1, O0);
-    st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
-    restore();
-#endif /* PRODUCT */
-  }
   jmpl(r1, r2, G0);
 }
 void MacroAssembler::jmp(Register r1, int offset, const char* file, int line ) {
   assert_not_delayed();
-  // This can only be traceable if r1 is visible after a window save
-  if (TraceJumps) {
-#ifndef PRODUCT
-    save_frame(0);
-    verify_thread();
-    ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
-    add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
-    sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
-    add(O2, O1, O1);
-
-    add(r1->after_save(), offset, O2);
-    set((intptr_t)file, O3);
-    set(line, O4);
-    Label L;
-    // get nearby pc, store jmp target
-    call(L, relocInfo::none);  // No relocation for call to pc+0x8
-    delayed()->st(O2, O1, 0);
-    bind(L);
-
-    // store nearby pc
-    st(O7, O1, sizeof(intptr_t));
-    // store file
-    st(O3, O1, 2*sizeof(intptr_t));
-    // store line
-    st(O4, O1, 3*sizeof(intptr_t));
-    add(O0, 1, O0);
-    and3(O0, JavaThread::jump_ring_buffer_size  - 1, O0);
-    st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
-    restore();
-#endif /* PRODUCT */
-  }
   jmp(r1, offset);
 }
 
@@ -260,44 +198,7 @@
   // variable length instruction streams.
   patchable_sethi(addrlit, temp);
   Address a(temp, addrlit.low10() + offset);  // Add the offset to the displacement.
-  if (TraceJumps) {
-#ifndef PRODUCT
-    // Must do the add here so relocation can find the remainder of the
-    // value to be relocated.
-    add(a.base(), a.disp(), a.base(), addrlit.rspec(offset));
-    save_frame(0);
-    verify_thread();
-    ld(G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()), O0);
-    add(G2_thread, in_bytes(JavaThread::jmp_ring_offset()), O1);
-    sll(O0, exact_log2(4*sizeof(intptr_t)), O2);
-    add(O2, O1, O1);
-
-    set((intptr_t)file, O3);
-    set(line, O4);
-    Label L;
-
-    // get nearby pc, store jmp target
-    call(L, relocInfo::none);  // No relocation for call to pc+0x8
-    delayed()->st(a.base()->after_save(), O1, 0);
-    bind(L);
-
-    // store nearby pc
-    st(O7, O1, sizeof(intptr_t));
-    // store file
-    st(O3, O1, 2*sizeof(intptr_t));
-    // store line
-    st(O4, O1, 3*sizeof(intptr_t));
-    add(O0, 1, O0);
-    and3(O0, JavaThread::jump_ring_buffer_size  - 1, O0);
-    st(O0, G2_thread, in_bytes(JavaThread::jmp_ring_index_offset()));
-    restore();
-    jmpl(a.base(), G0, d);
-#else
-    jmpl(a.base(), a.disp(), d);
-#endif /* PRODUCT */
-  } else {
-    jmpl(a.base(), a.disp(), d);
-  }
+  jmpl(a.base(), a.disp(), d);
 }
 
 void MacroAssembler::jump(const AddressLiteral& addrlit, Register temp, int offset, const char* file, int line) {
--- a/src/cpu/sparc/vm/macroAssembler_sparc.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/macroAssembler_sparc.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -703,8 +703,8 @@
 
   inline void tst( Register s );
 
-  inline void ret(  bool trace = TraceJumps );
-  inline void retl( bool trace = TraceJumps );
+  inline void ret(  bool trace = false );
+  inline void retl( bool trace = false );
 
   // Required platform-specific helpers for Label::patch_instructions.
   // They _shadow_ the declarations in AbstractAssembler, which are undefined.
--- a/src/cpu/sparc/vm/nativeInst_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/nativeInst_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -760,8 +760,7 @@
   Register rd = inv_rd(i0);
 #ifndef _LP64
   if (!(is_op2(i0, Assembler::sethi_op2) && rd != G0 &&
-        (is_op3(i1, Assembler::jmpl_op3, Assembler::arith_op) ||
-        (TraceJumps && is_op3(i1, Assembler::add_op3, Assembler::arith_op))) &&
+        (is_op3(i1, Assembler::jmpl_op3, Assembler::arith_op)) &&
         inv_immed(i1) && (unsigned)get_simm13(i1) < (1 << 10) &&
         rd == inv_rs1(i1))) {
     fatal("not a jump_to instruction");
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -3368,9 +3368,7 @@
   // setup code generation tools
   // Measured 8/7/03 at 896 in 32bit debug build (no VerifyThread)
   // Measured 8/7/03 at 1080 in 32bit debug build (VerifyThread)
-  // even larger with TraceJumps
-  int pad = TraceJumps ? 512 : 0;
-  CodeBuffer buffer("handler_blob", 1600 + pad, 512);
+  CodeBuffer buffer("handler_blob", 1600, 512);
   MacroAssembler* masm                = new MacroAssembler(&buffer);
   int             frame_size_words;
   OopMapSet *oop_maps = new OopMapSet();
@@ -3462,9 +3460,7 @@
   // setup code generation tools
   // Measured 8/7/03 at 896 in 32bit debug build (no VerifyThread)
   // Measured 8/7/03 at 1080 in 32bit debug build (VerifyThread)
-  // even larger with TraceJumps
-  int pad = TraceJumps ? 512 : 0;
-  CodeBuffer buffer(name, 1600 + pad, 512);
+  CodeBuffer buffer(name, 1600, 512);
   MacroAssembler* masm                = new MacroAssembler(&buffer);
   int             frame_size_words;
   OopMapSet *oop_maps = new OopMapSet();
--- a/src/cpu/sparc/vm/sparc.ad	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/sparc.ad	Mon Jul 11 13:14:19 2016 +0200
@@ -501,16 +501,10 @@
   static int emit_deopt_handler(CodeBuffer& cbuf);
 
   static uint size_exception_handler() {
-    if (TraceJumps) {
-      return (400); // just a guess
-    }
     return ( NativeJump::instruction_size ); // sethi;jmp;nop
   }
 
   static uint size_deopt_handler() {
-    if (TraceJumps) {
-      return (400); // just a guess
-    }
     return ( 4+  NativeJump::instruction_size ); // save;sethi;jmp;restore
   }
 };
@@ -720,7 +714,7 @@
   return offset;
 }
 
-static inline jdouble replicate_immI(int con, int count, int width) {
+static inline jlong replicate_immI(int con, int count, int width) {
   // Load a constant replicated "count" times with width "width"
   assert(count*width == 8 && width <= 4, "sanity");
   int bit_width = width * 8;
@@ -729,17 +723,15 @@
   for (int i = 0; i < count - 1; i++) {
     val |= (val << bit_width);
   }
-  jdouble dval = *((jdouble*) &val);  // coerce to double type
-  return dval;
-}
-
-static inline jdouble replicate_immF(float con) {
+  return val;
+}
+
+static inline jlong replicate_immF(float con) {
   // Replicate float con 2 times and pack into vector.
   int val = *((int*)&con);
   jlong lval = val;
   lval = (lval << 32) | (lval & 0xFFFFFFFFl);
-  jdouble dval = *((jdouble*) &lval);  // coerce to double type
-  return dval;
+  return lval;
 }
 
 // Standard Sparc opcode form2 field breakdown
@@ -2661,8 +2653,7 @@
 
       // Emit stub for static call.
       address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
-      // Stub does not fit into scratch buffer if TraceJumps is enabled
-      if (stub == NULL && !(TraceJumps && Compile::current()->in_scratch_emit_size())) {
+      if (stub == NULL) {
         ciEnv::current()->record_failure("CodeCache is full");
         return;
       }
--- a/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -1560,13 +1560,7 @@
     __ bind(ok);
   }
 #endif
-  if (TraceJumps) {
-    // Move target to register that is recordable
-    __ mov(Lscratch, G3_scratch);
-    __ JMP(G3_scratch, 0);
-  } else {
-    __ jmp(Lscratch, 0);
-  }
+  __ jmp(Lscratch, 0);
   __ delayed()->nop();
 
 
--- a/src/cpu/sparc/vm/templateTable_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/templateTable_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -1636,7 +1636,7 @@
                                                  in_bytes(InvocationCounter::counter_offset()));
         Address mask(G4_scratch, in_bytes(MethodData::backedge_mask_offset()));
         __ increment_mask_and_jump(mdo_backedge_counter, increment, mask, G3_scratch, O0,
-                                   Assembler::notZero, &Lforward);
+                                   (UseOnStackReplacement ? Assembler::notZero : Assembler::always), &Lforward);
         __ ba_short(Loverflow);
       }
 
@@ -1647,7 +1647,7 @@
               in_bytes(InvocationCounter::counter_offset()));
       Address mask(G3_method_counters, in_bytes(MethodCounters::backedge_mask_offset()));
       __ increment_mask_and_jump(backedge_counter, increment, mask, G4_scratch, O0,
-                                 Assembler::notZero, &Lforward);
+                                 (UseOnStackReplacement ? Assembler::notZero : Assembler::always), &Lforward);
       __ bind(Loverflow);
 
       // notify point for loop, pass branch bytecode
--- a/src/cpu/sparc/vm/vtableStubs_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/sparc/vm/vtableStubs_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -221,7 +221,7 @@
 
 
 int VtableStub::pd_code_size_limit(bool is_vtable_stub) {
-  if (TraceJumps || DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
+  if (DebugVtables || CountCompiledCalls || VerifyOops) return 1000;
   else {
     const int slop = 2*BytesPerInstWord; // sethi;add  (needed for long offsets)
     if (is_vtable_stub) {
--- a/src/cpu/x86/vm/macroAssembler_x86_tan.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/x86/vm/macroAssembler_x86_tan.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -1060,7 +1060,7 @@
 
   bind(B1_4);
   addq(rsp, 16);
-
+  pop(rbx);
 }
 #else
 // The 32 bit code is at most SSE2 compliant
--- a/src/cpu/x86/vm/x86.ad	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/cpu/x86/vm/x86.ad	Mon Jul 11 13:14:19 2016 +0200
@@ -2131,7 +2131,7 @@
   return size+offset_size;
 }
 
-static inline jfloat replicate4_imm(int con, int width) {
+static inline jint replicate4_imm(int con, int width) {
   // Load a constant of "width" (in bytes) and replicate it to fill 32bit.
   assert(width == 1 || width == 2, "only byte or short types here");
   int bit_width = width * 8;
@@ -2141,11 +2141,10 @@
     val |= (val << bit_width);
     bit_width <<= 1;
   }
-  jfloat fval = *((jfloat*) &val);  // coerce to float type
-  return fval;
+  return val;
 }
 
-static inline jdouble replicate8_imm(int con, int width) {
+static inline jlong replicate8_imm(int con, int width) {
   // Load a constant of "width" (in bytes) and replicate it to fill 64bit.
   assert(width == 1 || width == 2 || width == 4, "only byte, short or int types here");
   int bit_width = width * 8;
@@ -2155,8 +2154,7 @@
     val |= (val << bit_width);
     bit_width <<= 1;
   }
-  jdouble dval = *((jdouble*) &val);  // coerce to double type
-  return dval;
+  return val;
 }
 
 #ifndef PRODUCT
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Mon Jul 11 13:14:19 2016 +0200
@@ -109,13 +109,7 @@
         }
     }
 
-    private boolean verifyReadRawObject(Object expected, Constant base, long displacement, boolean compressed) {
-        if (compressed == runtime.getConfig().useCompressedOops) {
-            Object obj = asObject(base);
-            if (obj != null) {
-                assert expected == UNSAFE.getObject(obj, displacement) : "readUnsafeOop doesn't agree with unsafe.getObject";
-            }
-        }
+    private boolean verifyReadRawObject(Object expected, Constant base, long displacement) {
         if (base instanceof HotSpotMetaspaceConstant) {
             MetaspaceWrapperObject metaspaceObject = HotSpotMetaspaceConstantImpl.getMetaspaceObject(base);
             if (metaspaceObject instanceof HotSpotResolvedObjectTypeImpl) {
@@ -136,11 +130,11 @@
             assert !compressed;
             displacement += asRawPointer(baseConstant);
             ret = UNSAFE.getUncompressedObject(displacement);
+            assert verifyReadRawObject(ret, baseConstant, initialDisplacement);
         } else {
             assert runtime.getConfig().useCompressedOops == compressed;
             ret = UNSAFE.getObject(base, displacement);
         }
-        assert verifyReadRawObject(ret, baseConstant, initialDisplacement, compressed);
         return ret;
     }
 
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ConstantReflectionProvider.java	Mon Jul 11 13:14:19 2016 +0200
@@ -97,15 +97,6 @@
     ResolvedJavaType asJavaType(Constant constant);
 
     /**
-     * Check if the constant is embeddable in the code.
-     *
-     * @param constant the constant to test
-     */
-    default boolean isEmbeddable(Constant constant) {
-        return true;
-    }
-
-    /**
      * Gets access to the internals of {@link MethodHandle}.
      */
     MethodHandleAccessProvider getMethodHandleAccess();
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LineNumberTable.java	Mon Jul 11 13:14:19 2016 +0200
@@ -30,32 +30,46 @@
 public class LineNumberTable {
 
     private final int[] lineNumbers;
-    private final int[] bci;
+    private final int[] bcis;
 
     /**
      *
-     * @param lineNumbers an array or source line numbers. This array is now owned by this object
+     * @param lineNumbers an array of source line numbers. This array is now owned by this object
      *            and should not be mutated by the caller.
-     * @param bci an array of bytecode indexes the same length at {@code lineNumbers} whose entries
+     * @param bcis an array of bytecode indexes the same length at {@code lineNumbers} whose entries
      *            are sorted in ascending order. This array is now owned by this object and must not
      *            be mutated by the caller.
      */
     @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `lineNumbers` and `bcis`")
-    public LineNumberTable(int[] lineNumbers, int[] bci) {
-        assert bci.length == lineNumbers.length;
+    public LineNumberTable(int[] lineNumbers, int[] bcis) {
+        assert bcis.length == lineNumbers.length;
         this.lineNumbers = lineNumbers;
-        this.bci = bci;
+        this.bcis = bcis;
     }
 
     /**
-     * Gets a source line number for {@code atBci}.
+     * Gets a source line number for bytecode index {@code atBci}.
      */
     public int getLineNumber(int atBci) {
-        for (int i = 0; i < this.bci.length - 1; i++) {
-            if (this.bci[i] <= atBci && atBci < this.bci[i + 1]) {
+        for (int i = 0; i < this.bcis.length - 1; i++) {
+            if (this.bcis[i] <= atBci && atBci < this.bcis[i + 1]) {
                 return lineNumbers[i];
             }
         }
         return lineNumbers[lineNumbers.length - 1];
     }
+
+    /**
+     * Gets a copy of the array of line numbers that was passed to this object's constructor.
+     */
+    public int[] getLineNumbers() {
+        return lineNumbers.clone();
+    }
+
+    /**
+     * Gets a copy of the array of bytecode indexes that was passed to this object's constructor.
+     */
+    public int[] getBcis() {
+        return bcis.clone();
+    }
 }
--- a/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LocalVariableTable.java	Mon Jul 11 13:14:19 2016 +0200
@@ -26,6 +26,8 @@
 import java.util.List;
 
 /**
+ * Describes the {@link Local}s for a Java method.
+ *
  * @see "https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.13"
  */
 public class LocalVariableTable {
@@ -33,6 +35,7 @@
     private final Local[] locals;
 
     /**
+     * Creates an object describing the {@link Local}s for a Java method.
      *
      * @param locals array of objects describing local variables. This array is now owned by this
      *            object and must not be mutated by the caller.
@@ -42,6 +45,13 @@
         this.locals = locals;
     }
 
+    /**
+     * Gets a description of a local variable that occupies the bytecode frame slot indexed by
+     * {@code slot} and is live at the bytecode index {@code bci}
+     *
+     * @return a description of the requested local variable or null if no such variable matches
+     *         {@code slot} and {@code bci}
+     */
     public Local getLocal(int slot, int bci) {
         Local result = null;
         for (Local local : locals) {
@@ -56,6 +66,16 @@
         return result;
     }
 
+    /**
+     * Gets a copy of the array of {@link Local}s that was passed to this object's constructor.
+     */
+    public Local[] getLocals() {
+        return locals.clone();
+    }
+
+    /**
+     * Gets a description of all the local variables live at the bytecode index {@code bci}
+     */
     public Local[] getLocalsAt(int bci) {
         List<Local> result = new ArrayList<>();
         for (Local l : locals) {
--- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -545,10 +545,6 @@
     // factor me: setPC
     os::Solaris::ucontext_set_pc(uc, stub);
 
-#ifndef PRODUCT
-    if (TraceJumps) thread->record_jump(stub, NULL, __FILE__, __LINE__);
-#endif /* PRODUCT */
-
     return true;
   }
 
--- a/src/share/vm/asm/assembler.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/asm/assembler.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -337,6 +337,15 @@
   //
   // We must remember the code section (insts or stubs) in c1
   // so we can reset to the proper section in end_a_const().
+  address int_constant(jint c) {
+    CodeSection* c1 = _code_section;
+    address ptr = start_a_const(sizeof(c), sizeof(c));
+    if (ptr != NULL) {
+      emit_int32(c);
+      end_a_const(c1);
+    }
+    return ptr;
+  }
   address long_constant(jlong c) {
     CodeSection* c1 = _code_section;
     address ptr = start_a_const(sizeof(c), sizeof(c));
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -3434,7 +3434,7 @@
   __ load(counter, result);
   __ add(result, LIR_OprFact::intConst(InvocationCounter::count_increment), result);
   __ store(result, counter);
-  if (notify) {
+  if (notify && (!backedge || UseOnStackReplacement)) {
     LIR_Opr meth = LIR_OprFact::metadataConst(method->constant_encoding());
     // The bci for info can point to cmp for if's we want the if bci
     CodeStub* overflow = new CounterOverflowStub(info, bci, meth);
--- a/src/share/vm/compiler/compileBroker.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/compiler/compileBroker.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -551,17 +551,6 @@
       } else {
         c1_count = JVMCIHostThreads;
       }
-
-      if (!UseInterpreter || !BackgroundCompilation) {
-        // Force initialization of JVMCI compiler otherwise JVMCI
-        // compilations will not block until JVMCI is initialized
-        ResourceMark rm;
-        TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
-        TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
-        Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
-        JavaValue result(T_OBJECT);
-        JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK);
-      }
     }
   }
 #endif // INCLUDE_JVMCI
--- a/src/share/vm/compiler/oopMap.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/compiler/oopMap.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -273,14 +273,9 @@
 static DoNothingClosure do_nothing;
 
 static void add_derived_oop(oop* base, oop* derived) {
-#ifndef TIERED
+#if !defined(TIERED) && !defined(INCLUDE_JVMCI)
   COMPILER1_PRESENT(ShouldNotReachHere();)
-#if INCLUDE_JVMCI
-  if (UseJVMCICompiler) {
-    ShouldNotReachHere();
-  }
-#endif
-#endif // TIERED
+#endif // !defined(TIERED) && !defined(INCLUDE_JVMCI)
 #if defined(COMPILER2) || INCLUDE_JVMCI
   DerivedPointerTable::add(derived, base);
 #endif // COMPILER2 || INCLUDE_JVMCI
@@ -473,13 +468,8 @@
 #ifndef PRODUCT
 
 bool ImmutableOopMap::has_derived_pointer() const {
-#ifndef TIERED
+#if !defined(TIERED) && !defined(INCLUDE_JVMCI)
   COMPILER1_PRESENT(return false);
-#if INCLUDE_JVMCI
-  if (UseJVMCICompiler) {
-    return false;
-  }
-#endif
 #endif // !TIERED
 #if defined(COMPILER2) || INCLUDE_JVMCI
   OopMapStream oms(this,OopMapValue::derived_oop_value);
--- a/src/share/vm/jvmci/jvmciRuntime.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/jvmci/jvmciRuntime.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -612,6 +612,17 @@
   return value;
 JRT_END
 
+void JVMCIRuntime::force_initialization(TRAPS) {
+  JVMCIRuntime::initialize_well_known_classes(CHECK);
+
+  ResourceMark rm;
+  TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK);
+  TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK);
+  Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK);
+  JavaValue result(T_OBJECT);
+  JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK);
+}
+
 // private static JVMCIRuntime JVMCI.initializeRuntime()
 JVM_ENTRY(jobject, JVM_GetJVMCIRuntime(JNIEnv *env, jclass c))
   if (!EnableJVMCI) {
--- a/src/share/vm/jvmci/jvmciRuntime.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/jvmci/jvmciRuntime.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -157,6 +157,9 @@
   static void throw_klass_external_name_exception(JavaThread* thread, const char* exception, Klass* klass);
   static void throw_class_cast_exception(JavaThread* thread, const char* exception, Klass* caster_klass, Klass* target_klass);
 
+  // Forces initialization of the JVMCI runtime.
+  static void force_initialization(TRAPS);
+
   // Test only function
   static int test_deoptimize_call_int(JavaThread* thread, int value);
 };
--- a/src/share/vm/jvmci/jvmci_globals.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/jvmci/jvmci_globals.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -148,6 +148,22 @@
 #undef JVMCI_PRODUCT_FLAG_VALUE_CHANGED_CHECK_CODE
 #undef JVMCI_EXPERIMENTAL_FLAG_VALUE_CHANGED_CHECK_CODE
 
+#ifndef TIERED
+  // JVMCI is only usable as a jit compiler if the VM supports tiered compilation.
+#define JVMCI_CHECK_TIERED_ONLY_FLAG(FLAG)                         \
+  if (!FLAG_IS_DEFAULT(FLAG)) {                                   \
+    jio_fprintf(defaultStream::error_stream(), "VM option '%s' cannot be set in non-tiered VM\n", #FLAG); \
+    return false; \
+  }
+  JVMCI_CHECK_TIERED_ONLY_FLAG(UseJVMCICompiler)
+  JVMCI_CHECK_TIERED_ONLY_FLAG(BootstrapJVMCI)
+  JVMCI_CHECK_TIERED_ONLY_FLAG(PrintBootstrap)
+  JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCIThreads)
+  JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCIHostThreads)
+  JVMCI_CHECK_TIERED_ONLY_FLAG(JVMCICountersExcludeCompiler)
+#undef JVMCI_CHECK_TIERED_ONLY_FLAG
+#endif
+
   return true;
 }
 
--- a/src/share/vm/jvmci/vmStructs_jvmci.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/jvmci/vmStructs_jvmci.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -550,7 +550,7 @@
   declare_function(os::javaTimeNanos)                                     \
                                                                           \
   declare_function(Deoptimization::fetch_unroll_info)                     \
-  COMPILER2_PRESENT(declare_function(Deoptimization::uncommon_trap))      \
+  declare_function(Deoptimization::uncommon_trap)                         \
   declare_function(Deoptimization::unpack_frames)                         \
                                                                           \
   declare_function(JVMCIRuntime::new_instance) \
--- a/src/share/vm/opto/compile.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/compile.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -3814,6 +3814,7 @@
   if (can_be_reused() != other.can_be_reused())  return false;
   // For floating point values we compare the bit pattern.
   switch (type()) {
+  case T_INT:
   case T_FLOAT:   return (_v._value.i == other._v._value.i);
   case T_LONG:
   case T_DOUBLE:  return (_v._value.j == other._v._value.j);
@@ -3828,6 +3829,7 @@
 
 static int type_to_size_in_bytes(BasicType t) {
   switch (t) {
+  case T_INT:     return sizeof(jint   );
   case T_LONG:    return sizeof(jlong  );
   case T_FLOAT:   return sizeof(jfloat );
   case T_DOUBLE:  return sizeof(jdouble);
@@ -3896,6 +3898,7 @@
     Constant con = _constants.at(i);
     address constant_addr = NULL;
     switch (con.type()) {
+    case T_INT:    constant_addr = _masm.int_constant(   con.get_jint()   ); break;
     case T_LONG:   constant_addr = _masm.long_constant(  con.get_jlong()  ); break;
     case T_FLOAT:  constant_addr = _masm.float_constant( con.get_jfloat() ); break;
     case T_DOUBLE: constant_addr = _masm.double_constant(con.get_jdouble()); break;
--- a/src/share/vm/opto/compile.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/compile.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -264,6 +264,7 @@
 
     BasicType type()      const    { return _type; }
 
+    jint    get_jint()    const    { return _v._value.i; }
     jlong   get_jlong()   const    { return _v._value.j; }
     jfloat  get_jfloat()  const    { return _v._value.f; }
     jdouble get_jdouble() const    { return _v._value.d; }
@@ -320,6 +321,14 @@
     Constant add(MachConstantNode* n, BasicType type, jvalue value);
     Constant add(Metadata* metadata);
     Constant add(MachConstantNode* n, MachOper* oper);
+    Constant add(MachConstantNode* n, jint i) {
+      jvalue value; value.i = i;
+      return add(n, T_INT, value);
+    }
+    Constant add(MachConstantNode* n, jlong j) {
+      jvalue value; value.j = j;
+      return add(n, T_LONG, value);
+    }
     Constant add(MachConstantNode* n, jfloat f) {
       jvalue value; value.f = f;
       return add(n, T_FLOAT, value);
--- a/src/share/vm/opto/library_call.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/library_call.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -222,7 +222,6 @@
   Node* round_double_node(Node* n);
   bool runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName);
   bool inline_math_native(vmIntrinsics::ID id);
-  bool inline_trig(vmIntrinsics::ID id);
   bool inline_math(vmIntrinsics::ID id);
   template <typename OverflowOp>
   bool inline_math_overflow(Node* arg1, Node* arg2);
@@ -1404,20 +1403,22 @@
          (!compress && src_elem == T_BYTE && (dst_elem == T_BYTE || dst_elem == T_CHAR)),
          "Unsupported array types for inline_string_copy");
 
+  // Convert char[] offsets to byte[] offsets
+  bool convert_src = (compress && src_elem == T_BYTE);
+  bool convert_dst = (!compress && dst_elem == T_BYTE);
+  if (convert_src) {
+    src_offset = _gvn.transform(new LShiftINode(src_offset, intcon(1)));
+  } else if (convert_dst) {
+    dst_offset = _gvn.transform(new LShiftINode(dst_offset, intcon(1)));
+  }
+
   // Range checks
-  generate_string_range_check(src, src_offset, length, compress && src_elem == T_BYTE);
-  generate_string_range_check(dst, dst_offset, length, !compress && dst_elem == T_BYTE);
+  generate_string_range_check(src, src_offset, length, convert_src);
+  generate_string_range_check(dst, dst_offset, length, convert_dst);
   if (stopped()) {
     return true;
   }
 
-  // Convert char[] offsets to byte[] offsets
-  if (compress && src_elem == T_BYTE) {
-    src_offset = _gvn.transform(new LShiftINode(src_offset, intcon(1)));
-  } else if (!compress && dst_elem == T_BYTE) {
-    dst_offset = _gvn.transform(new LShiftINode(dst_offset, intcon(1)));
-  }
-
   Node* src_start = array_element_address(src, src_offset, src_elem);
   Node* dst_start = array_element_address(dst, dst_offset, dst_elem);
   // 'src_start' points to src array + scaled offset
@@ -1691,94 +1692,6 @@
   return true;
 }
 
-//------------------------------inline_trig----------------------------------
-// Inline sin/cos/tan instructions, if possible.  If rounding is required, do
-// argument reduction which will turn into a fast/slow diamond.
-bool LibraryCallKit::inline_trig(vmIntrinsics::ID id) {
-  Node* arg = round_double_node(argument(0));
-  Node* n = NULL;
-
-  n = _gvn.transform(n);
-
-  // Rounding required?  Check for argument reduction!
-  if (Matcher::strict_fp_requires_explicit_rounding) {
-    static const double     pi_4 =  0.7853981633974483;
-    static const double neg_pi_4 = -0.7853981633974483;
-    // pi/2 in 80-bit extended precision
-    // static const unsigned char pi_2_bits_x[] = {0x35,0xc2,0x68,0x21,0xa2,0xda,0x0f,0xc9,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00};
-    // -pi/2 in 80-bit extended precision
-    // static const unsigned char neg_pi_2_bits_x[] = {0x35,0xc2,0x68,0x21,0xa2,0xda,0x0f,0xc9,0xff,0xbf,0x00,0x00,0x00,0x00,0x00,0x00};
-    // Cutoff value for using this argument reduction technique
-    //static const double    pi_2_minus_epsilon =  1.564660403643354;
-    //static const double neg_pi_2_plus_epsilon = -1.564660403643354;
-
-    // Pseudocode for sin:
-    // if (x <= Math.PI / 4.0) {
-    //   if (x >= -Math.PI / 4.0) return  fsin(x);
-    //   if (x >= -Math.PI / 2.0) return -fcos(x + Math.PI / 2.0);
-    // } else {
-    //   if (x <=  Math.PI / 2.0) return  fcos(x - Math.PI / 2.0);
-    // }
-    // return StrictMath.sin(x);
-
-    // Pseudocode for cos:
-    // if (x <= Math.PI / 4.0) {
-    //   if (x >= -Math.PI / 4.0) return  fcos(x);
-    //   if (x >= -Math.PI / 2.0) return  fsin(x + Math.PI / 2.0);
-    // } else {
-    //   if (x <=  Math.PI / 2.0) return -fsin(x - Math.PI / 2.0);
-    // }
-    // return StrictMath.cos(x);
-
-    // Actually, sticking in an 80-bit Intel value into C2 will be tough; it
-    // requires a special machine instruction to load it.  Instead we'll try
-    // the 'easy' case.  If we really need the extra range +/- PI/2 we'll
-    // probably do the math inside the SIN encoding.
-
-    // Make the merge point
-    RegionNode* r = new RegionNode(3);
-    Node* phi = new PhiNode(r, Type::DOUBLE);
-
-    // Flatten arg so we need only 1 test
-    Node *abs = _gvn.transform(new AbsDNode(arg));
-    // Node for PI/4 constant
-    Node *pi4 = makecon(TypeD::make(pi_4));
-    // Check PI/4 : abs(arg)
-    Node *cmp = _gvn.transform(new CmpDNode(pi4,abs));
-    // Check: If PI/4 < abs(arg) then go slow
-    Node *bol = _gvn.transform(new BoolNode( cmp, BoolTest::lt ));
-    // Branch either way
-    IfNode *iff = create_and_xform_if(control(),bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
-    set_control(opt_iff(r,iff));
-
-    // Set fast path result
-    phi->init_req(2, n);
-
-    // Slow path - non-blocking leaf call
-    Node* call = NULL;
-    switch (id) {
-    case vmIntrinsics::_dtan:
-      call = make_runtime_call(RC_LEAF, OptoRuntime::Math_D_D_Type(),
-                               CAST_FROM_FN_PTR(address, SharedRuntime::dtan),
-                               "Tan", NULL, arg, top());
-      break;
-    }
-    assert(control()->in(0) == call, "");
-    Node* slow_result = _gvn.transform(new ProjNode(call, TypeFunc::Parms));
-    r->init_req(1, control());
-    phi->init_req(1, slow_result);
-
-    // Post-merge
-    set_control(_gvn.transform(r));
-    record_for_igvn(r);
-    n = _gvn.transform(phi);
-
-    C->set_has_split_ifs(true); // Has chance for split-if optimization
-  }
-  set_result(n);
-  return true;
-}
-
 //------------------------------runtime_math-----------------------------
 bool LibraryCallKit::runtime_math(const TypeFunc* call_type, address funcAddr, const char* funcName) {
   assert(call_type == OptoRuntime::Math_DD_D_Type() || call_type == OptoRuntime::Math_D_D_Type(),
@@ -2424,6 +2337,8 @@
       return false;
     }
     mismatched = (bt != type);
+  } else if (alias_type->adr_type() == TypeOopPtr::BOTTOM) {
+    mismatched = true; // conservatively mark all "wide" on-heap accesses as mismatched
   }
 
   // First guess at the value type.
--- a/src/share/vm/opto/loopTransform.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/loopTransform.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -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
@@ -70,9 +70,9 @@
 }
 
 //------------------------------compute_exact_trip_count-----------------------
-// Compute loop exact trip count if possible. Do not recalculate trip count for
+// Compute loop trip count if possible. Do not recalculate trip count for
 // split loops (pre-main-post) which have their limits and inits behind Opaque node.
-void IdealLoopTree::compute_exact_trip_count( PhaseIdealLoop *phase ) {
+void IdealLoopTree::compute_trip_count(PhaseIdealLoop* phase) {
   if (!_head->as_Loop()->is_valid_counted_loop()) {
     return;
   }
@@ -94,17 +94,21 @@
 
   Node* init_n = cl->init_trip();
   Node* limit_n = cl->limit();
-  if (init_n  != NULL &&  init_n->is_Con() &&
-      limit_n != NULL && limit_n->is_Con()) {
+  if (init_n != NULL && limit_n != NULL) {
     // Use longs to avoid integer overflow.
-    int stride_con  = cl->stride_con();
-    jlong init_con   = cl->init_trip()->get_int();
-    jlong limit_con  = cl->limit()->get_int();
-    int stride_m    = stride_con - (stride_con > 0 ? 1 : -1);
+    int stride_con = cl->stride_con();
+    jlong init_con = phase->_igvn.type(init_n)->is_int()->_lo;
+    jlong limit_con = phase->_igvn.type(limit_n)->is_int()->_hi;
+    int stride_m   = stride_con - (stride_con > 0 ? 1 : -1);
     jlong trip_count = (limit_con - init_con + stride_m)/stride_con;
     if (trip_count > 0 && (julong)trip_count < (julong)max_juint) {
-      // Set exact trip count.
-      cl->set_exact_trip_count((uint)trip_count);
+      if (init_n->is_Con() && limit_n->is_Con()) {
+        // Set exact trip count.
+        cl->set_exact_trip_count((uint)trip_count);
+      } else if (cl->unrolled_count() == 1) {
+        // Set maximum trip count before unrolling.
+        cl->set_trip_count((uint)trip_count);
+      }
     }
   }
 }
@@ -1305,7 +1309,7 @@
   assert(main_exit->Opcode() == Op_IfFalse, "");
   int dd_main_exit = dom_depth(main_exit);
 
-  // Step A1: Clone the loop body of main.  The clone becomes the vector post-loop.
+  // Step A1: Clone the loop body of main. The clone becomes the post-loop.
   // The main loop pre-header illegally has 2 control users (old & new loops).
   clone_loop(loop, old_new, dd_main_exit);
   assert(old_new[main_end->_idx]->Opcode() == Op_CountedLoopEnd, "");
@@ -2095,8 +2099,7 @@
   // the loop is in canonical form to multiversion.
   closed_range_checks = 0;
 
-  // Check loop body for tests of trip-counter plus loop-invariant vs
-  // loop-invariant.
+  // Check loop body for tests of trip-counter plus loop-invariant vs loop-variant.
   for( uint i = 0; i < loop->_body.size(); i++ ) {
     Node *iff = loop->_body[i];
     if (iff->Opcode() == Op_If ||
@@ -2298,7 +2301,7 @@
   // skip this loop if it is already checked
   if (cl->has_been_range_checked()) return;
 
-  // Now check for existance of range checks
+  // Now check for existence of range checks
   for (uint i = 0; i < loop->_body.size(); i++) {
     Node *iff = loop->_body[i];
     int iff_opc = iff->Opcode();
@@ -2319,7 +2322,7 @@
   CountedLoopNode *legacy_cl = legacy_loop->_head->as_CountedLoop();
   assert(legacy_cl->is_post_loop(), "");
 
-  // Check for existance of range checks using the unique instance to make a guard with
+  // Check for existence of range checks using the unique instance to make a guard with
   Unique_Node_List worklist;
   for (uint i = 0; i < legacy_loop->_body.size(); i++) {
     Node *iff = legacy_loop->_body[i];
@@ -2422,7 +2425,7 @@
 }
 
 //-------------------------poison_rce_post_loop--------------------------------
-// Causes the rce'd post loop to be optimized away if multiverioning fails
+// Causes the rce'd post loop to be optimized away if multiversioning fails
 void PhaseIdealLoop::poison_rce_post_loop(IdealLoopTree *rce_loop) {
   CountedLoopNode *rce_cl = rce_loop->_head->as_CountedLoop();
   Node* ctrl = rce_cl->in(LoopNode::EntryControl);
@@ -2710,8 +2713,8 @@
 //=============================================================================
 //------------------------------iteration_split_impl---------------------------
 bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_new ) {
-  // Compute exact loop trip count if possible.
-  compute_exact_trip_count(phase);
+  // Compute loop trip count if possible.
+  compute_trip_count(phase);
 
   // Convert one iteration loop into normal code.
   if (policy_do_one_iteration_loop(phase))
--- a/src/share/vm/opto/loopnode.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/loopnode.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -520,8 +520,8 @@
   // Return TRUE if "iff" is a range check.
   bool is_range_check_if(IfNode *iff, PhaseIdealLoop *phase, Invariance& invar) const;
 
-  // Compute loop exact trip count if possible
-  void compute_exact_trip_count( PhaseIdealLoop *phase );
+  // Compute loop trip count if possible
+  void compute_trip_count(PhaseIdealLoop* phase);
 
   // Compute loop trip count from profile data
   void compute_profile_trip_cnt( PhaseIdealLoop *phase );
--- a/src/share/vm/opto/macro.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/macro.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -1596,8 +1596,12 @@
         // All nodes that depended on the InitializeNode for control
         // and memory must now depend on the MemBarNode that itself
         // depends on the InitializeNode
-        _igvn.replace_node(init_ctrl, ctrl);
-        _igvn.replace_node(init_mem, mem);
+        if (init_ctrl != NULL) {
+          _igvn.replace_node(init_ctrl, ctrl);
+        }
+        if (init_mem != NULL) {
+          _igvn.replace_node(init_mem, mem);
+        }
       }
     }
 
--- a/src/share/vm/opto/memnode.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/memnode.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -1713,9 +1713,6 @@
       }
     }
   } else if (tp->base() == Type::InstPtr) {
-    ciEnv* env = C->env();
-    const TypeInstPtr* tinst = tp->is_instptr();
-    ciKlass* klass = tinst->klass();
     assert( off != Type::OffsetBot ||
             // arrays can be cast to Objects
             tp->is_oopptr()->klass()->is_java_lang_Object() ||
@@ -1723,9 +1720,11 @@
             C->has_unsafe_access(),
             "Field accesses must be precise" );
     // For oop loads, we expect the _type to be precise.
-    // Optimizations for constant objects
+
+    // Optimize loads from constant fields.
+    const TypeInstPtr* tinst = tp->is_instptr();
     ciObject* const_oop = tinst->const_oop();
-    if (const_oop != NULL && const_oop->is_instance()) {
+    if (!is_mismatched_access() && off != Type::OffsetBot && const_oop != NULL && const_oop->is_instance()) {
       const Type* con_type = Type::make_constant_from_field(const_oop->as_instance(), off, is_unsigned(), memory_type());
       if (con_type != NULL) {
         return con_type;
--- a/src/share/vm/opto/output.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/output.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -952,7 +952,7 @@
   // Set the initially allocated size
   int  code_req   = initial_code_capacity;
   int  locs_req   = initial_locs_capacity;
-  int  stub_req   = TraceJumps ? initial_stub_capacity * 10 : initial_stub_capacity;
+  int  stub_req   = initial_stub_capacity;
   int  const_req  = initial_const_capacity;
 
   int  pad_req    = NativeCall::instruction_size;
--- a/src/share/vm/opto/type.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/opto/type.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -936,7 +936,7 @@
 };
 
 //------------------------------TypeOopPtr-------------------------------------
-// Some kind of oop (Java pointer), either klass or instance or array.
+// Some kind of oop (Java pointer), either instance or array.
 class TypeOopPtr : public TypePtr {
 protected:
   TypeOopPtr(TYPES t, PTR ptr, ciKlass* k, bool xk, ciObject* o, int offset, int instance_id,
--- a/src/share/vm/runtime/globals.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/runtime/globals.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -802,9 +802,6 @@
   develop(bool, TracePcPatching, false,                                     \
           "Trace usage of frame::patch_pc")                                 \
                                                                             \
-  develop(bool, TraceJumps, false,                                          \
-          "Trace assembly jumps in thread ring buffer")                     \
-                                                                            \
   develop(bool, TraceRelocator, false,                                      \
           "Trace the bytecode relocator")                                   \
                                                                             \
--- a/src/share/vm/runtime/simpleThresholdPolicy.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -238,9 +238,14 @@
   }
 
 #if INCLUDE_JVMCI
-  // We can't compile with a JVMCI compiler until the module system is initialized.
-  if (level == CompLevel_full_optimization && UseJVMCICompiler && !Universe::is_module_initialized()) {
-    return;
+  // We can't compile with a JVMCI compiler until the module system is initialized past
+  // phase 3.  The JVMCI API itself isn't available until phase 2 and ServiceLoader isn't
+  // usable until after phase 3.
+  if (level == CompLevel_full_optimization && EnableJVMCI && UseJVMCICompiler) {
+    if (SystemDictionary::java_system_loader() == NULL) {
+      return;
+     }
+     assert(Universe::is_module_initialized(), "must be");
   }
 #endif
 
--- a/src/share/vm/runtime/thread.cpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/runtime/thread.cpp	Mon Jul 11 13:14:19 2016 +0200
@@ -3770,6 +3770,13 @@
   // Final system initialization including security manager and system class loader
   call_initPhase3(CHECK_JNI_ERR);
 
+#if INCLUDE_JVMCI
+  if (EnableJVMCI && UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation)) {
+    // 8145270: Force initialization of JVMCI runtime otherwise requests for blocking
+    // compilations via JVMCI will not actually block until JVMCI is initialized.
+    JVMCIRuntime::force_initialization(CHECK_JNI_ERR);
+  }
+#endif
   // cache the system class loader
   SystemDictionary::compute_java_system_loader(CHECK_(JNI_ERR));
 
--- a/src/share/vm/utilities/globalDefinitions.hpp	Wed Jul 06 20:58:08 2016 +0900
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Mon Jul 11 13:14:19 2016 +0200
@@ -951,7 +951,7 @@
   CompLevel_full_profile      = 3,         // C1, invocation & backedge counters + mdo
   CompLevel_full_optimization = 4,         // C2, Shark or JVMCI
 
-#if defined(COMPILER2) || defined(SHARK) || INCLUDE_JVMCI
+#if defined(COMPILER2) || defined(SHARK)
   CompLevel_highest_tier      = CompLevel_full_optimization,  // pure C2 and tiered or JVMCI and tiered
 #elif defined(COMPILER1)
   CompLevel_highest_tier      = CompLevel_simple,             // pure C1 or JVMCI
--- a/test/compiler/codecache/jmx/PeakUsageTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/codecache/jmx/PeakUsageTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -27,8 +27,8 @@
 
 /*
  * @test PeakUsageTest
+ * @library /testlibrary /test/lib
  * @ignore 8151345
- * @library /testlibrary /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build PeakUsageTest
--- a/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -24,10 +24,10 @@
 /*
  * @test
  * @bug 8137167
- * @ignore 8140405
  * @summary Tests jcmd to be able to clear directives added via options
  * @modules java.base/jdk.internal.misc
  * @library /testlibrary /test/lib ../share /
+ * @ignore 8140405
  * @build compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/test/compiler/gcbarriers/PreserveFPRegistersTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/gcbarriers/PreserveFPRegistersTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -25,15 +25,22 @@
 /**
  * @test
  * @bug 8148175
- * @ignore 8153194
- * @run main/othervm/timeout=300 -Xbatch -Xmx128m PreserveFPRegistersTest
+ * @requires vm.gc=="G1" | vm.gc=="null"
+ * @library /testlibrary /test/lib
+ * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI -Xmx300m -XX:+UseG1GC PreserveFPRegistersTest
  */
+
+import sun.hotspot.WhiteBox;
+
 public class PreserveFPRegistersTest {
 
     public static void main(String... args) throws InterruptedException {
         new PreserveFPRegistersTest().go();
     }
 
+    private static WhiteBox wb = WhiteBox.getWhiteBox();
+
     public final Object[][] storage;
 
     /**
@@ -52,18 +59,32 @@
     public final int regionCount;
 
     PreserveFPRegistersTest() {
-        long regionSize = 1_000_000; //WB.g1RegionSize();
-
+        long regionSize = wb.g1RegionSize();
         Runtime rt = Runtime.getRuntime();
         long used = rt.totalMemory() - rt.freeMemory();
         long totalFree = rt.maxMemory() - used;
         regionCount = (int) ( (totalFree / regionSize) * 0.9);
-        int refSize = 4;
+        int refSize = wb.getHeapOopSize();
+        N = (int) ((regionSize / K ) / refSize) - 5;
 
-        N = (int) ((regionSize / K ) / refSize) - 5;
-        storage = new Object[regionCount * K][];
-        for (int i = 0; i < storage.length; i++) {
-            storage[i] = new Object[N];
+        System.out.println("%% Memory");
+        System.out.println("%%   used          :        " + used / 1024 + "M");
+        System.out.println("%%   available     :        " + totalFree / 1024 + "M");
+        System.out.println("%%   G1 Region Size:        " + regionSize / 1024 + "M");
+        System.out.println("%%   region count  :        " + regionCount);
+
+        System.out.println("%% Objects storage");
+        System.out.println("%%   N (array length)      : " + N);
+        System.out.println("%%   K (objects in regions): " + K);
+        System.out.println("%%   Reference size        : " + refSize);
+
+        try {
+            storage = new Object[regionCount * K][];
+            for (int i = 0; i < storage.length; i++) {
+                storage[i] = new Object[N];
+            }
+        } catch(OutOfMemoryError e) {
+            throw new AssertionError("Test Failed with unexpected OutOfMemoryError exception");
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/interpreter/DisableOSRTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016 SAP SE. 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 8159620
+ * @summary testing that -XX:-UseOnStackReplacement works with both -XX:(+/-)TieredCompilation
+ * @modules java.base/jdk.internal.misc
+ * @library /testlibrary /test/lib /
+ * @build sun.hotspot.WhiteBox
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation
+ *                   -XX:-BackgroundCompilation -XX:-TieredCompilation -XX:-UseOnStackReplacement DisableOSRTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+PrintCompilation
+ *                   -XX:-BackgroundCompilation -XX:+TieredCompilation -XX:-UseOnStackReplacement DisableOSRTest
+ */
+
+import java.lang.reflect.Method;
+import java.util.Random;
+import sun.hotspot.WhiteBox;
+
+public class DisableOSRTest {
+    private static final WhiteBox WB = WhiteBox.getWhiteBox();
+    private static final Random RANDOM = new Random();
+
+    public static int foo() {
+        return RANDOM.nextInt();
+    }
+
+    public static void main(String[] args) throws Exception {
+        Method m = DisableOSRTest.class.getMethod("main", String[].class);
+
+        for (int i = 0; i < 100_000; i++) {
+            foo();
+        }
+
+        if (WB.isMethodCompiled(m, true /* isOsr */)) {
+            throw new RuntimeException("\"" + m + "\" shouldn't be OSR compiled if running with -XX:-UseOnStackReplacement!");
+        }
+    }
+}
--- a/test/compiler/intrinsics/bmi/TestAndnI.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/intrinsics/bmi/TestAndnI.java	Mon Jul 11 13:14:19 2016 +0200
@@ -31,7 +31,7 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @build TestAndnI BMITestRunner Expr
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI TestAndnI
--- a/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/intrinsics/bmi/verifycode/BmiIntrinsicBase.java	Mon Jul 11 13:14:19 2016 +0200
@@ -28,6 +28,8 @@
 import sun.hotspot.code.NMethod;
 import sun.hotspot.cpuinfo.CPUInfo;
 
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Method;
 import java.util.concurrent.Callable;
--- a/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/intrinsics/string/TestStringIntrinsicRangeChecks.java	Mon Jul 11 13:14:19 2016 +0200
@@ -30,7 +30,7 @@
  * @library /compiler/patches /testlibrary /test/lib /
  * @build java.base/java.lang.Helper
  * @build compiler.intrinsics.string.TestStringIntrinsicRangeChecks
- * @run main compiler.intrinsics.string.TestStringIntrinsicRangeChecks
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:-TieredCompilation compiler.intrinsics.string.TestStringIntrinsicRangeChecks
  */
 package compiler.intrinsics.string;
 
--- a/test/compiler/jsr292/NonInlinedCall/RedefineTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jsr292/NonInlinedCall/RedefineTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -29,13 +29,16 @@
  *          java.base/jdk.internal.vm.annotation
  * @library /testlibrary /test/lib / ../patches
  * @requires vm.flavor != "minimal"
+ *
  * @build sun.hotspot.WhiteBox
  * @build java.base/java.lang.invoke.MethodHandleHelper
  * @build compiler.jsr292.NonInlinedCall.RedefineTest
- * @run main compiler.jsr292.NonInlinedCall.Agent agent.jar compiler.jsr292.NonInlinedCall.RedefineTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- *                              compiler.jsr292.NonInlinedCall.RedefineTest
+ * @run driver compiler.jsr292.NonInlinedCall.Agent
+ *             agent.jar
+ *             compiler.jsr292.NonInlinedCall.RedefineTest
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
+ *                                compiler.jsr292.NonInlinedCall.RedefineTest
  * @run main/bootclasspath/othervm -javaagent:agent.jar
  *                                 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
--- a/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -32,11 +32,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.AllocateCompileIdTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/CanInlineMethodTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -33,11 +33,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.CanInlineMethodTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/DisassembleCodeBlobTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -33,12 +33,13 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @ignore 8139700
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.DisassembleCodeBlobTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/DoNotInlineOrCompileTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -33,11 +33,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.DoNotInlineOrCompileTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/ExecuteInstalledCodeTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -33,8 +33,8 @@
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.ExecuteInstalledCodeTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/GetConstantPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -31,12 +31,13 @@
  * @modules java.base/jdk.internal.misc
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
  * @build compiler.jvmci.compilerToVM.GetConstantPoolTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/GetResolvedJavaMethodTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -29,12 +29,12 @@
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  *        jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
  * @build compiler.jvmci.compilerToVM.GetResolvedJavaMethodTest
- * @run main ClassFileInstaller
- *      sun.hotspot.WhiteBox
- *      sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/GetResolvedJavaTypeTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -24,20 +24,20 @@
 /*
  * @test
  * @bug 8136421
- * @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
  * @modules jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
+ * @ignore 8158860
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  *        jdk.vm.ci/jdk.vm.ci.hotspot.PublicMetaspaceWrapperObject
  * @build compiler.jvmci.compilerToVM.GetResolvedJavaTypeTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller
- *      sun.hotspot.WhiteBox
- *      sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/HasCompiledCodeForOSRTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -33,11 +33,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.HasCompiledCodeForOSRTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -34,12 +34,13 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @ignore 8139700
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.InvalidateInstalledCodeTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -36,11 +36,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupKlassInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
--- a/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupKlassRefIndexInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupKlassRefIndexInPoolTest
--- a/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupMethodInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupMethodInPoolTest
--- a/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupNameAndTypeRefIndexInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupNameAndTypeRefIndexInPoolTest
--- a/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupNameInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupNameInPoolTest
--- a/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.LookupSignatureInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.LookupSignatureInPoolTest
--- a/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -33,11 +33,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xmixed -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/ReprofileTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/ReprofileTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -34,13 +34,13 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @ignore 8157861
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  * @build compiler.jvmci.compilerToVM.ReprofileTest
- * @run main ClassFileInstaller
- *      sun.hotspot.WhiteBox
- *      sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -34,11 +34,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.ResolveConstantInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
--- a/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.ResolveFieldInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.ResolveFieldInPoolTest
--- a/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
  *                   -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest
--- a/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -35,11 +35,12 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.meta
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build sun.hotspot.WhiteBox
  *        compiler.jvmci.compilerToVM.ResolveTypeInPoolTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
--- a/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/compilerToVM/ShouldInlineMethodTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -33,11 +33,12 @@
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
+ *
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.compilerToVM.ShouldInlineMethodTest
  * @build sun.hotspot.WhiteBox
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                                sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:.
  *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
--- a/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/events/JvmciNotifyBootstrapFinishedEventTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -28,24 +28,27 @@
  * @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
  *          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
+ *        compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
+ * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
+ * @run driver 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 driver ClassFileInstaller
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
+ *      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
--- a/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -34,21 +34,24 @@
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @ignore 8144964
  * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
  * @build compiler.jvmci.common.JVMCIHelpers
  *     compiler.jvmci.events.JvmciNotifyInstallEventTest
- * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
- * @run main jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config
+ * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
+ * @run driver jdk.test.lib.FileInstaller ./JvmciNotifyInstallEventTest.config
  *     ./META-INF/services/jdk.vm.ci.hotspot.HotSpotVMEventListener
- * @run main ClassFileInstaller
- *     compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
- *     compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
- *     compiler.jvmci.events.JvmciNotifyInstallEventTest
- *     compiler.jvmci.common.CTVMUtilities
- *     compiler.jvmci.common.testcases.SimpleClass
- *     jdk.test.lib.Asserts
- *     jdk.test.lib.Utils
+ * @run driver ClassFileInstaller
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
+ *       compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
+ *      compiler.jvmci.events.JvmciNotifyInstallEventTest
+ *      compiler.jvmci.common.CTVMUtilities
+ *      compiler.jvmci.common.testcases.SimpleClass
+ *      jdk.test.lib.Asserts
+ *      jdk.test.lib.Utils
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
  *     -Djvmci.compiler=EmptyCompiler -Xbootclasspath/a:. -Xmixed
  *     -XX:+UseJVMCICompiler -XX:-BootstrapJVMCI
--- a/test/compiler/jvmci/events/JvmciShutdownEventTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/events/JvmciShutdownEventTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -31,21 +31,22 @@
  *          jdk.vm.ci/jdk.vm.ci.code
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @build compiler.jvmci.common.JVMCIHelpers
  *        compiler.jvmci.events.JvmciShutdownEventListener
  *        compiler.jvmci.events.JvmciShutdownEventTest
- * @run main jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
- * @run main jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.config
+ * @run driver jdk.test.lib.FileInstaller ../common/services/ ./META-INF/services/
+ * @run driver jdk.test.lib.FileInstaller ./JvmciShutdownEventTest.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.JvmciShutdownEventListener
+ * @run driver ClassFileInstaller
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
+ *      compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
+ *      compiler.jvmci.events.JvmciShutdownEventListener
  * @run main/othervm compiler.jvmci.events.JvmciShutdownEventTest
  */
 
- // as soon as CODETOOLS-7901589 fixed, '@run main/othervm' at L43 should be replaced w/ '@run driver'
-
 package compiler.jvmci.events;
 
 import jdk.test.lib.ExitCode;
--- a/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/HotSpotConstantReflectionProviderTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -120,12 +120,6 @@
         Assert.assertEquals(actual, expected, "Unexpected result:");
     }
 
-    @Test(dataProvider = "isEmbeddableDataProvider", dataProviderClass = IsEmbeddableDataProvider.class)
-    public void testIsEmbeddable(JavaConstant constant, boolean expected) {
-        boolean actual = CONSTANT_REFLECTION_PROVIDER.isEmbeddable(constant);
-        Assert.assertEquals(actual, expected, "Unexpected result:");
-    }
-
     @Test
     public void testGetMemoryAccessProvider() {
         MemoryAccessProvider actual = CONSTANT_REFLECTION_PROVIDER.getMemoryAccessProvider();
--- a/test/compiler/jvmci/meta/StableFieldTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/jvmci/meta/StableFieldTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -31,8 +31,9 @@
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
+ *
  * @compile StableFieldTest.java
- * @run main ClassFileInstaller compiler.jvmci.meta.StableFieldTest
+ * @run driver ClassFileInstaller compiler.jvmci.meta.StableFieldTest
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Xbootclasspath/a:. compiler.jvmci.meta.StableFieldTest
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/loopopts/TestOverunrolling.java	Mon Jul 11 13:14:19 2016 +0200
@@ -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 8159016
+ * @requires vm.gc == "Parallel" | vm.gc == "null"
+ * @summary Tests correct dominator information after over-unrolling a loop.
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-TieredCompilation
+ *                   -XX:-UseG1GC -XX:+UseParallelGC TestOverunrolling
+ */
+public class TestOverunrolling {
+
+    public static Object test(int arg) {
+        Object arr[] = new Object[3];
+        int lim = (arg & 3);
+        // The pre loop is executed for one iteration, initializing p[0].
+        // The main loop is unrolled twice, initializing p[1], p[2], p[3] and p[4].
+        // The p[3] and p[4] stores are always out of bounds and removed. However,
+        // C2 is unable to remove the "over-unrolled", dead main loop. As a result,
+        // there is a control path from the main loop to the post loop without a
+        // memory path (because the last store was replaced by TOP). We crash
+        // because we use a memory edge from a non-dominating region.
+        for (int i = 0; i < lim; ++i) {
+            arr[i] = new Object();
+        }
+        // Avoid EA
+        return arr;
+    }
+
+    public static void main(String args[]) {
+        for (int i = 0; i < 42; ++i) {
+            test(i);
+        }
+    }
+}
+
--- a/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/rangechecks/TestRangeCheckEliminationDisabled.java	Mon Jul 11 13:14:19 2016 +0200
@@ -26,7 +26,9 @@
  * @test TestRangeCheckEliminationDisabled
  * @bug 8154763
  * @summary Tests PostLoopMultiversioning with RangeCheckElimination disabled.
- * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination TestRangeCheckEliminationDisabled
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+PostLoopMultiversioning -XX:-RangeCheckElimination
+ *                   TestRangeCheckEliminationDisabled
  */
 public class TestRangeCheckEliminationDisabled {
 
--- a/test/compiler/startup/SmallCodeCacheStartup.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/compiler/startup/SmallCodeCacheStartup.java	Mon Jul 11 13:14:19 2016 +0200
@@ -23,12 +23,12 @@
 
 /*
  * @test
- * @ignore 8134286
  * @bug 8023014
  * @summary Test ensures that there is no crash if there is not enough ReservedCodeCacheSize
  *          to initialize all compiler threads. The option -Xcomp gives the VM more time to
  *          trigger the old bug.
  * @library /testlibrary
+ * @ignore 8134286
  * @modules java.base/jdk.internal.misc
  *          java.management
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/vectorization/TestNaNVector.java	Mon Jul 11 13:14:19 2016 +0200
@@ -0,0 +1,84 @@
+/*
+ * 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 8160425
+ * @summary Test vectorization with a signalling NaN.
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill TestNaNVector
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-OptimizeFill -XX:MaxVectorSize=4 TestNaNVector
+ */
+public class TestNaNVector {
+    private char[] array;
+    private static final int LEN = 1024;
+
+    public static void main(String args[]) {
+        TestNaNVector test = new TestNaNVector();
+        // Check double precision NaN
+        for (int i = 0; i < 10_000; ++i) {
+          test.vectorizeNaNDP();
+        }
+        System.out.println("Checking double precision Nan");
+        test.checkResult(0xfff7);
+
+        // Check single precision NaN
+        for (int i = 0; i < 10_000; ++i) {
+          test.vectorizeNaNSP();
+        }
+        System.out.println("Checking single precision Nan");
+        test.checkResult(0xff80);
+    }
+
+    public TestNaNVector() {
+        array = new char[LEN];
+    }
+
+    public void vectorizeNaNDP() {
+        // This loop will be vectorized and the array store will be replaced by
+        // a 64-bit vector store to four subsequent array elements. The vector
+        // should look like this '0xfff7fff7fff7fff7' and is read from the constant
+        // table. However, in floating point arithmetic this is a signalling NaN
+        // which may be converted to a quiet NaN when processed by the x87 FPU.
+        // If the signalling bit is set, the vector ends up in the constant table
+        // as '0xfffffff7fff7fff7' which leads to an incorrect result.
+        for (int i = 0; i < LEN; ++i) {
+            array[i] = 0xfff7;
+        }
+    }
+
+    public void vectorizeNaNSP() {
+        // Same as above but with single precision
+        for (int i = 0; i < LEN; ++i) {
+            array[i] = 0xff80;
+        }
+    }
+
+    public void checkResult(int expected) {
+        for (int i = 0; i < LEN; ++i) {
+            if (array[i] != expected) {
+                throw new RuntimeException("Invalid result: array[" + i + "] = " + (int)array[i] + " != " + expected);
+            }
+        }
+    }
+}
+
--- a/test/testlibrary/ctw/Makefile	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/Makefile	Mon Jul 11 13:14:19 2016 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 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
@@ -35,12 +35,13 @@
 SRC_DIR = src
 BUILD_DIR = build
 OUTPUT_DIR = $(BUILD_DIR)/classes
-WHITEBOX_DIR = ../whitebox
+TESTLIBRARY_DIR = ../../../../test/lib
 
 JAVAC = $(JDK_HOME)/bin/javac
 JAR = $(JDK_HOME)/bin/jar
 
-SRC_FILES = $(shell find $(SRC_DIR) -name '*.java')
+SRC_FILES = $(shell find $(SRC_DIR) $(TESTLIBRARY_DIR)/share/classes -name '*.java')
+WB_SRC_FILES = $(shell find $(TESTLIBRARY_DIR)/sun/hotspot -name '*.java')
 
 MAIN_CLASS = sun.hotspot.tools.ctw.CompileTheWorld
 
@@ -52,22 +53,29 @@
 	@rm -rf ctw.jar wb.jar
 
 cleantmp:
-	@rm -rf filelist manifest.mf
+	@rm -rf filelist wb_filelist manifest.mf
 	@rm -rf $(BUILD_DIR)
 
-ctw.jar: filelist wb.jar manifest.mf
+ctw.jar: filelist wb.jar
 	@mkdir -p $(OUTPUT_DIR)
-	$(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp wb.jar @filelist
-	$(JAR) cfm ctw.jar manifest.mf -C $(OUTPUT_DIR) .
+	$(JAVAC) -XaddExports:java.base/jdk.internal.jimage=ALL-UNNAMED \
+		-XaddExports:java.base/jdk.internal.misc=ALL-UNNAMED \
+		-XaddExports:java.base/jdk.internal.reflect=ALL-UNNAMED \
+		-sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp wb.jar @filelist
+	$(JAR) --create --file=$@ --main-class $(MAIN_CLASS) -C $(OUTPUT_DIR) .
 
-wb.jar: 
-	make -C ${WHITEBOX_DIR} wb.jar
-	cp ${WHITEBOX_DIR}/wb.jar ./
-	make -C ${WHITEBOX_DIR} clean
+wb.jar: wb_filelist
+	@mkdir -p $(OUTPUT_DIR)
+	$(JAVAC)  -sourcepath $(TESTLIBRARY_DIR) \
+		-d $(OUTPUT_DIR) \
+		-cp $(OUTPUT_DIR) \
+		@wb_filelist
+	$(JAR) --create --file=$@ -C $(OUTPUT_DIR) .
+
+wb_filelist: $(WB_SRC_FILES)
+	@rm -f $@
+	@echo $(WB_SRC_FILES) > $@
 
 filelist: $(SRC_FILES)
 	@rm -f $@
 	@echo $(SRC_FILES) > $@
-
-manifest.mf:
-	@echo "Main-Class: ${MAIN_CLASS}" > manifest.mf
--- a/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathDirEntry.java	Mon Jul 11 13:14:19 2016 +0200
@@ -54,7 +54,7 @@
 
     @Override
     public void process() {
-        System.out.println("# dir: " + root);
+        CompileTheWorld.OUT.println("# dir: " + root);
         if (!Files.exists(root)) {
             return;
         }
--- a/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarEntry.java	Mon Jul 11 13:14:19 2016 +0200
@@ -50,7 +50,7 @@
 
     @Override
     public void process() {
-        System.out.println("# jar: " + root);
+        CompileTheWorld.OUT.println("# jar: " + root);
         if (!Files.exists(root)) {
             return;
         }
--- a/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJarInDirEntry.java	Mon Jul 11 13:14:19 2016 +0200
@@ -40,7 +40,7 @@
 
     @Override
     public void process() {
-        System.out.println("# jar_in_dir: " + root);
+        CompileTheWorld.OUT.println("# jar_in_dir: " + root);
         if (!Files.exists(root)) {
             return;
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java	Mon Jul 11 13:14:19 2016 +0200
@@ -0,0 +1,68 @@
+/*
+ * 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.hotspot.tools.ctw;
+
+import jdk.internal.jimage.ImageReader;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.concurrent.Executor;
+
+/**
+ * Handler for jimage-files containing classes to compile.
+ */
+public class ClassPathJimageEntry extends PathHandler {
+    public ClassPathJimageEntry(Path root, Executor executor) {
+        super(root, executor);
+        try {
+            URL url = root.toUri().toURL();
+            setLoader(new URLClassLoader(new URL[]{url}));
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void process() {
+        CompileTheWorld.OUT.println("# jimage: " + root);
+        if (!Files.exists(root)) {
+            return;
+        }
+        try {
+            ImageReader reader = ImageReader.open(root);
+            Arrays.stream(reader.getEntryNames())
+                    .filter(name -> name.endsWith(".class"))
+                    .filter(name -> !name.endsWith("module-info.class"))
+                    .map(Utils::fileNameToClassName)
+                    .forEach(this::processClass);
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        }
+    }
+}
--- a/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassesListInFile.java	Mon Jul 11 13:14:19 2016 +0200
@@ -40,7 +40,7 @@
 
     @Override
     public void process() {
-        System.out.println("# list: " + root);
+        CompileTheWorld.OUT.println("# list: " + root);
         if (!Files.exists(root)) {
             return;
         }
--- a/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/CompileTheWorld.java	Mon Jul 11 13:14:19 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -33,14 +33,20 @@
 import java.util.concurrent.*;
 
 public class CompileTheWorld {
+    // in case when a static constructor changes System::out and System::err
+    // we hold these values of output streams
+    public static final PrintStream OUT = System.out;
+    public static final PrintStream ERR = System.err;
     /**
-     * Entry point. Compiles classes in {@code args}, or all classes in
-     * boot-classpath if args is empty
+     * Entry point. Compiles classes in {@code paths}
      *
-     * @param args paths to jar/zip, dir contains classes, or to .lst file
-     *             contains list of classes to compile
+     * @param paths paths to jar/zip, dir contains classes, or to .lst file
+     *              contains list of classes to compile
      */
-    public static void main(String[] args) {
+    public static void main(String[] paths) {
+        if (paths.length == 0) {
+            throw new IllegalArgumentException("Expect a path to a compile target.");
+        }
         String logfile = Utils.LOG_FILE;
         PrintStream os = null;
         if (logfile != null) {
@@ -62,12 +68,6 @@
             } catch (java.lang.NoClassDefFoundError e) {
                 // compact1, compact2 support
             }
-            String[] paths = args;
-            boolean skipRtJar = false;
-            if (args.length == 0) {
-                paths = getDefaultPaths();
-                skipRtJar = true;
-            }
             ExecutorService executor = createExecutor();
             long start = System.currentTimeMillis();
             try {
@@ -75,17 +75,13 @@
                 for (int i = 0, n = paths.length; i < n
                         && !PathHandler.isFinished(); ++i) {
                     path = paths[i];
-                    if (skipRtJar && i > 0 && isRtJar(path)) {
-                        // rt.jar is not first, so skip it
-                        continue;
-                    }
                     PathHandler.create(path, executor).process();
                 }
             } finally {
                 await(executor);
             }
-            System.out.printf("Done (%d classes, %d methods, %d ms)%n",
-                    Compiler.getClassCount(),
+            CompileTheWorld.OUT.printf("Done (%d classes, %d methods, %d ms)%n",
+                    PathHandler.getClassCount(),
                     Compiler.getMethodCount(),
                     System.currentTimeMillis() - start);
         } finally {
@@ -93,6 +89,9 @@
                 os.close();
             }
         }
+        // in case when a static constructor creates and runs a new thread
+        // we force it to exit
+        System.exit(0);
     }
 
     private static ExecutorService createExecutor() {
@@ -111,13 +110,6 @@
         return result;
     }
 
-    private static String[] getDefaultPaths() {
-        String property = System.getProperty("sun.boot.class.path");
-        System.out.println(
-                "# use 'sun.boot.class.path' as args: " + property);
-        return Utils.PATH_SEPARATOR.split(property);
-    }
-
     private static void await(ExecutorService executor) {
         executor.shutdown();
         while (!executor.isTerminated()) {
@@ -130,10 +122,6 @@
         }
     }
 
-    private static boolean isRtJar(String path) {
-        return Utils.endsWithIgnoreCase(path, File.separator + "rt.jar");
-    }
-
     private static class CurrentThreadExecutor extends AbstractExecutorService {
         private boolean isShutdown;
 
--- a/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java	Mon Jul 11 13:14:19 2016 +0200
@@ -26,7 +26,6 @@
 import sun.hotspot.WhiteBox;
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.reflect.ConstantPool;
-
 import java.lang.reflect.Executable;
 
 import java.util.Objects;
@@ -38,18 +37,11 @@
  * Also contains compiled methods and classes counters.
  */
 public class Compiler {
+
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    private static final AtomicLong METHOD_COUNT = new AtomicLong(0L);
+
     private Compiler() { }
-    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
-    private static final AtomicLong CLASS_COUNT = new AtomicLong(0L);
-    private static final AtomicLong METHOD_COUNT = new AtomicLong(0L);
-    private static volatile boolean CLASSES_LIMIT_REACHED = false;
-
-    /**
-     * @return count of processed classes
-     */
-    public static long getClassCount() {
-        return CLASS_COUNT.get();
-    }
 
     /**
      * @return count of processed methods
@@ -59,58 +51,46 @@
     }
 
     /**
-     * @return {@code true} if classes limit is reached
-     */
-    public static boolean isLimitReached() {
-        return CLASSES_LIMIT_REACHED;
-    }
-
-    /**
      * Compiles all methods and constructors.
      *
      * @param aClass class to compile
+     * @param id an id of the class
      * @param executor executor used for compile task invocation
      * @throws NullPointerException if {@code class} or {@code executor}
      *                              is {@code null}
      */
-    public static void compileClass(Class aClass, Executor executor) {
+    public static void compileClass(Class<?> aClass, long id, Executor executor) {
         Objects.requireNonNull(aClass);
         Objects.requireNonNull(executor);
-        long id = CLASS_COUNT.incrementAndGet();
-        if (id > Utils.COMPILE_THE_WORLD_STOP_AT) {
-            CLASS_COUNT.decrementAndGet();
-            CLASSES_LIMIT_REACHED = true;
-            return;
-        }
+        try {
+            ConstantPool constantPool = SharedSecrets.getJavaLangAccess().
+                    getConstantPool(aClass);
+            if (Utils.COMPILE_THE_WORLD_PRELOAD_CLASSES) {
+                preloadClasses(aClass.getName(), id, constantPool);
+            }
+            int startLevel = Utils.INITIAL_COMP_LEVEL;
+            int endLevel = Utils.TIERED_COMPILATION ? Utils.TIERED_STOP_AT_LEVEL : startLevel;
+            for (int i = startLevel; i <= endLevel; ++i) {
+                WHITE_BOX.enqueueInitializerForCompilation(aClass, i);
+            }
+            long methodCount = 0;
+            for (Executable e : aClass.getDeclaredConstructors()) {
+                ++methodCount;
+                executor.execute(new CompileMethodCommand(id, e));
+            }
+            for (Executable e : aClass.getDeclaredMethods()) {
+                ++methodCount;
+                executor.execute(new CompileMethodCommand(id, e));
+            }
+            METHOD_COUNT.addAndGet(methodCount);
 
-        if (id >= Utils.COMPILE_THE_WORLD_START_AT) {
-            String name = aClass.getName();
-            try {
-                System.out.printf("[%d]\t%s%n", id, name);
-                ConstantPool constantPool = SharedSecrets.getJavaLangAccess().
-                        getConstantPool(aClass);
-                if (Utils.COMPILE_THE_WORLD_PRELOAD_CLASSES) {
-                    preloadClasses(name, id, constantPool);
-                }
-                long methodCount = 0;
-                for (Executable e : aClass.getDeclaredConstructors()) {
-                    ++methodCount;
-                    executor.execute(new CompileMethodCommand(id, name, e));
-                }
-                for (Executable e : aClass.getDeclaredMethods()) {
-                    ++methodCount;
-                    executor.execute(new CompileMethodCommand(id, name, e));
-                }
-                METHOD_COUNT.addAndGet(methodCount);
-
-                if (Utils.DEOPTIMIZE_ALL_CLASSES_RATE > 0
-                        && (id % Utils.DEOPTIMIZE_ALL_CLASSES_RATE == 0)) {
-                    WHITE_BOX.deoptimizeAll();
-                }
-            } catch (Throwable t) {
-                System.out.printf("[%d]\t%s\tskipping %s%n", id, name, t);
-                t.printStackTrace();
+            if (Utils.DEOPTIMIZE_ALL_CLASSES_RATE > 0
+                    && (id % Utils.DEOPTIMIZE_ALL_CLASSES_RATE == 0)) {
+                WHITE_BOX.deoptimizeAll();
             }
+        } catch (Throwable t) {
+            CompileTheWorld.OUT.printf("[%d]\t%s\tskipping %s%n", id, aClass.getName(), t);
+            t.printStackTrace();
         }
     }
 
@@ -124,8 +104,8 @@
                 }
             }
         } catch (Throwable t) {
-            System.out.printf("[%d]\t%s\tpreloading failed : %s%n", id,
-                    className, t);
+            CompileTheWorld.OUT.printf("[%d]\t%s\tpreloading failed : %s%n",
+                    id, className, t);
         }
     }
 
@@ -142,13 +122,11 @@
 
         /**
          * @param classId   id of class
-         * @param className name of class
          * @param method    compiled for compilation
          */
-        public CompileMethodCommand(long classId, String className,
-                Executable method) {
+        public CompileMethodCommand(long classId, Executable method) {
             this.classId = classId;
-            this.className = className;
+            this.className = method.getDeclaringClass().getName();
             this.method = method;
         }
 
@@ -158,10 +136,10 @@
             if (Utils.TIERED_COMPILATION) {
                 for (int i = compLevel; i <= Utils.TIERED_STOP_AT_LEVEL; ++i) {
                     WHITE_BOX.deoptimizeMethod(method);
-                    compileMethod(method, i);
+                    compileAtLevel(i);
                 }
             } else {
-                compileMethod(method, compLevel);
+                compileAtLevel(compLevel);
             }
         }
 
@@ -183,29 +161,29 @@
             }
         }
 
-        private void compileMethod(Executable method, int compLevel) {
+        private void compileAtLevel(int compLevel) {
             if (WHITE_BOX.isMethodCompilable(method, compLevel)) {
                 try {
                     WHITE_BOX.enqueueMethodForCompilation(method, compLevel);
                     waitCompilation();
                     int tmp = WHITE_BOX.getMethodCompilationLevel(method);
                     if (tmp != compLevel) {
-                        logMethod(method, "compilation level = " + tmp
+                        log("compilation level = " + tmp
                                 + ", but not " + compLevel);
                     } else if (Utils.IS_VERBOSE) {
-                        logMethod(method, "compilation level = " + tmp + ". OK");
+                        log("compilation level = " + tmp + ". OK");
                     }
                 } catch (Throwable t) {
-                    logMethod(method, "error on compile at " + compLevel
+                    log("error on compile at " + compLevel
                             + " level");
                     t.printStackTrace();
                 }
             } else if (Utils.IS_VERBOSE) {
-                logMethod(method, "not compilable at " + compLevel);
+                log("not compilable at " + compLevel);
             }
         }
 
-        private void logMethod(Executable method, String message) {
+        private void log(String message) {
             StringBuilder builder = new StringBuilder("[");
             builder.append(classId);
             builder.append("]\t");
@@ -226,7 +204,7 @@
                 builder.append('\t');
                 builder.append(message);
             }
-            System.err.println(builder);
+            CompileTheWorld.ERR.println(builder);
         }
     }
 
--- a/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/PathHandler.java	Mon Jul 11 13:14:19 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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,14 @@
 
 package sun.hotspot.tools.ctw;
 
+import jdk.internal.misc.Unsafe;
+
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.io.File;
 
 import java.util.Objects;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 import java.util.concurrent.Executor;
@@ -38,6 +40,9 @@
  * Concrete subclasses should implement method {@link #process()}.
  */
 public abstract class PathHandler {
+    private static final Unsafe UNSAFE = jdk.test.lib.Utils.getUnsafe();
+    private static final AtomicLong CLASS_COUNT = new AtomicLong(0L);
+    private static volatile boolean CLASSES_LIMIT_REACHED = false;
     private static final Pattern JAR_IN_DIR_PATTERN
             = Pattern.compile("^(.*[/\\\\])?\\*$");
     protected final Path root;
@@ -81,6 +86,8 @@
                 return new ClassPathJarEntry(p, executor);
             } else if (isListFile(p)) {
                 return new ClassesListInFile(p, executor);
+            } else if (isJimageFile(p)) {
+                return new ClassPathJimageEntry(p, executor);
             } else {
                 return new ClassPathDirEntry(p, executor);
             }
@@ -96,6 +103,13 @@
         return false;
     }
 
+    private static boolean isJimageFile(Path path) {
+        String filename = path.getFileName().toString();
+        return Files.isRegularFile(path)
+                && ("modules".equals(filename)
+                || Utils.endsWithIgnoreCase(filename, ".jimage"));
+    }
+
     private static boolean isListFile(Path path) {
         if (Files.isRegularFile(path)) {
             String name = path.toString();
@@ -122,24 +136,51 @@
     }
 
     /**
-     * Processes specificed class.
+     * Processes specified class.
      * @param name fully qualified name of class to process
      */
     protected final void processClass(String name) {
-        try {
-            Class aClass = Class.forName(name, true, loader);
-            Compiler.compileClass(aClass, executor);
-        } catch (ClassNotFoundException | LinkageError e) {
-            System.out.printf("Class %s loading failed : %s%n", name,
-                e.getMessage());
+        Objects.requireNonNull(name);
+        if (CLASSES_LIMIT_REACHED) {
+            return;
+        }
+        long id = CLASS_COUNT.incrementAndGet();
+        if (id > Utils.COMPILE_THE_WORLD_STOP_AT) {
+            CLASSES_LIMIT_REACHED = true;
+            return;
+        }
+        if (id >= Utils.COMPILE_THE_WORLD_START_AT) {
+            try {
+                Class<?> aClass = loader.loadClass(name);
+                UNSAFE.ensureClassInitialized(aClass);
+                CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name);
+                Compiler.compileClass(aClass, id, executor);
+            } catch (ClassNotFoundException e) {
+                CompileTheWorld.OUT.printf("Class %s loading failed : %s%n",
+                        name, e.getMessage());
+            }
         }
     }
 
     /**
-     * @return {@code true} if processing should be stopped
+     * @return count of processed classes
+     */
+    public static long getClassCount() {
+        long id = CLASS_COUNT.get();
+        if (id < Utils.COMPILE_THE_WORLD_START_AT) {
+            return 0;
+        }
+        if (id > Utils.COMPILE_THE_WORLD_STOP_AT) {
+            return Utils.COMPILE_THE_WORLD_STOP_AT - Utils.COMPILE_THE_WORLD_START_AT + 1;
+        }
+        return id - Utils.COMPILE_THE_WORLD_START_AT + 1;
+    }
+
+    /**
+     * @return {@code true} if classes limit is reached and processing should be stopped
      */
     public static boolean isFinished() {
-        return Compiler.isLimitReached();
+        return CLASSES_LIMIT_REACHED;
     }
 
 }
--- a/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java	Mon Jul 11 13:14:19 2016 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -207,7 +207,12 @@
      */
     public static String fileNameToClassName(String filename) {
         assert isClassFile(filename);
-        return filename.substring(0, filename.length() - CLASSFILE_EXT.length())
-                       .replace(File.separatorChar, '.');
+        // workaround for the class naming in jimage : /<module>/<class_name>
+        final char nameSeparator = '/';
+        int nameStart = filename.charAt(0) == nameSeparator
+                ? filename.indexOf(nameSeparator, 1) + 1
+                : 0;
+        return filename.substring(nameStart, filename.length() - CLASSFILE_EXT.length())
+                       .replace(nameSeparator, '.');
     }
 }
--- a/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary/jittester/src/jdk/test/lib/jittester/Automatic.java	Mon Jul 11 13:14:19 2016 +0200
@@ -120,16 +120,30 @@
             String name = "Test_" + counter;
             Pair<IRNode, IRNode> irTree = generateIRTree(name);
             System.out.printf(" %8d |", counter);
+            long maxWaitTime = TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT);
             double generationTime = System.currentTimeMillis() - start;
             System.out.printf(" %8.0f |", generationTime);
             start = System.currentTimeMillis();
-            for (TestsGenerator generator : generators) {
-                generator.accept(irTree.first, irTree.second);
+            Thread generatorThread = new Thread(() -> {
+                for (TestsGenerator generator : generators) {
+                        generator.accept(irTree.first, irTree.second);
+                }
+            });
+            generatorThread.start();
+            try {
+                generatorThread.join(maxWaitTime);
+            } catch (InterruptedException ie) {
+                throw new Error("Test generation interrupted: " + ie, ie);
             }
-            double runningTime = System.currentTimeMillis() - start;
-            System.out.printf(" %8.0f |%n", runningTime);
-            if (runningTime < TimeUnit.MINUTES.toMillis(MINUTES_TO_WAIT)) {
-                ++counter;
+            if (generatorThread.isAlive()) {
+                // maxTime reached, so, proceed to next test generation
+                generatorThread.interrupt();
+            } else {
+                double runningTime = System.currentTimeMillis() - start;
+                System.out.printf(" %8.0f |%n", runningTime);
+                if (runningTime < maxWaitTime) {
+                    ++counter;
+                }
             }
         } while (counter < ProductionParams.numberOfTests.value());
     }
--- a/test/testlibrary_tests/ctw/ClassesDirTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary_tests/ctw/ClassesDirTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -25,7 +25,8 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.jimage
+ *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.reflect
  *          java.management
  * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
--- a/test/testlibrary_tests/ctw/ClassesListTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary_tests/ctw/ClassesListTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -25,7 +25,8 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.jimage
+ *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.reflect
  *          java.management
  * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
--- a/test/testlibrary_tests/ctw/JarDirTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary_tests/ctw/JarDirTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -25,7 +25,8 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.jimage
+ *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.reflect
  *          java.compiler
  *          java.management
--- a/test/testlibrary_tests/ctw/JarsTest.java	Wed Jul 06 20:58:08 2016 +0900
+++ b/test/testlibrary_tests/ctw/JarsTest.java	Mon Jul 11 13:14:19 2016 +0200
@@ -25,7 +25,8 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /test/lib /testlibrary/ctw/src
- * @modules java.base/jdk.internal.misc
+ * @modules java.base/jdk.internal.jimage
+ *          java.base/jdk.internal.misc
  *          java.base/jdk.internal.reflect
  *          java.compiler
  *          java.management