Merge
authorjwilhelm
Thu, 11 Feb 2016 21:07:38 +0100
changeset 35951 eb6971bc8c95
parent 35950 c6142cb6bc4a (current diff)
parent 35846 f5a8b47778ef (diff)
child 35952 a99b4b16202c
Merge
hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java
hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java
hotspot/src/share/vm/code/nmethod.cpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/.mx.jvmci/suite.py	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/.mx.jvmci/suite.py	Thu Feb 11 21:07:38 2016 +0100
@@ -1,5 +1,5 @@
 suite = {
-  "mxversion" : "5.6.11",
+  "mxversion" : "5.6.16",
   "name" : "jvmci",
   "url" : "http://openjdk.java.net/projects/graal",
   "developer" : {
--- a/hotspot/src/cpu/aarch64/vm/aarch64.ad	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad	Thu Feb 11 21:07:38 2016 +0100
@@ -14928,7 +14928,22 @@
   ins_pipe(pipe_class_memory);
 %}
 
-instruct array_equals(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
+instruct array_equalsB(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
+                      iRegP_R10 tmp, rFlagsReg cr)
+%{
+  predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::LL);
+  match(Set result (AryEq ary1 ary2));
+  effect(KILL tmp, USE_KILL ary1, USE_KILL ary2, KILL cr);
+
+  format %{ "Array Equals $ary1,ary2 -> $result    // KILL $tmp" %}
+  ins_encode %{
+    __ byte_arrays_equals($ary1$$Register, $ary2$$Register,
+                          $result$$Register, $tmp$$Register);
+  %}
+  ins_pipe(pipe_class_memory);
+%}
+
+instruct array_equalsC(iRegP_R1 ary1, iRegP_R2 ary2, iRegI_R0 result,
                       iRegP_R10 tmp, rFlagsReg cr)
 %{
   predicate(((AryEqNode*)n)->encoding() == StrIntrinsicNode::UU);
--- a/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/aarch64/vm/globals_aarch64.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -40,11 +40,7 @@
 define_pd_global(bool, TrapBasedNullChecks,  false);
 define_pd_global(bool, UncommonNullCast,         true);  // Uncommon-trap NULLs past to check cast
 
-#if defined(COMPILER2) || INCLUDE_JVMCI
 define_pd_global(intx, CodeEntryAlignment,       64);
-#else
-define_pd_global(intx, CodeEntryAlignment,       16);
-#endif // COMPILER2
 define_pd_global(intx, OptoLoopAlignment,        16);
 define_pd_global(intx, InlineFrequencyCount,     100);
 
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -127,7 +127,10 @@
                      Instruction_aarch64::extract(insn2, 4, 0)) {
         // movk #imm16<<32
         Instruction_aarch64::patch(branch + 4, 20, 5, (uint64_t)target >> 32);
-        offset &= (1<<20)-1;
+        long dest = ((long)target & 0xffffffffL) | ((long)branch & 0xffff00000000L);
+        long pc_page = (long)branch >> 12;
+        long adr_page = (long)dest >> 12;
+        offset = adr_page - pc_page;
         instructions = 2;
       }
     }
@@ -3993,11 +3996,12 @@
   if (offset_high >= -(1<<20) && offset_low < (1<<20)) {
     _adrp(reg1, dest.target());
   } else {
-    unsigned long pc_page = (unsigned long)pc() >> 12;
-    long offset = dest_page - pc_page;
-    offset = (offset & ((1<<20)-1)) << 12;
-    _adrp(reg1, pc()+offset);
-    movk(reg1, (unsigned long)dest.target() >> 32, 32);
+    unsigned long target = (unsigned long)dest.target();
+    unsigned long adrp_target
+      = (target & 0xffffffffUL) | ((unsigned long)pc() & 0xffff00000000UL);
+
+    _adrp(reg1, (address)adrp_target);
+    movk(reg1, target >> 32, 32);
   }
   byte_offset = (unsigned long)dest.target() & 0xfff;
 }
@@ -4552,6 +4556,82 @@
   BLOCK_COMMENT("} string_equals");
 }
 
+
+void MacroAssembler::byte_arrays_equals(Register ary1, Register ary2,
+                                        Register result, Register tmp1)
+{
+  Register cnt1 = rscratch1;
+  Register cnt2 = rscratch2;
+  Register tmp2 = rscratch2;
+
+  Label SAME, DIFFER, NEXT, TAIL07, TAIL03, TAIL01;
+
+  int length_offset  = arrayOopDesc::length_offset_in_bytes();
+  int base_offset    = arrayOopDesc::base_offset_in_bytes(T_BYTE);
+
+  BLOCK_COMMENT("byte_arrays_equals  {");
+
+    // different until proven equal
+    mov(result, false);
+
+    // same array?
+    cmp(ary1, ary2);
+    br(Assembler::EQ, SAME);
+
+    // ne if either null
+    cbz(ary1, DIFFER);
+    cbz(ary2, DIFFER);
+
+    // lengths ne?
+    ldrw(cnt1, Address(ary1, length_offset));
+    ldrw(cnt2, Address(ary2, length_offset));
+    cmp(cnt1, cnt2);
+    br(Assembler::NE, DIFFER);
+
+    lea(ary1, Address(ary1, base_offset));
+    lea(ary2, Address(ary2, base_offset));
+
+    subs(cnt1, cnt1, 8);
+    br(LT, TAIL07);
+
+  BIND(NEXT);
+    ldr(tmp1, Address(post(ary1, 8)));
+    ldr(tmp2, Address(post(ary2, 8)));
+    subs(cnt1, cnt1, 8);
+    eor(tmp1, tmp1, tmp2);
+    cbnz(tmp1, DIFFER);
+    br(GE, NEXT);
+
+  BIND(TAIL07);  // 0-7 bytes left, cnt1 = #bytes left - 4
+    tst(cnt1, 0b100);
+    br(EQ, TAIL03);
+    ldrw(tmp1, Address(post(ary1, 4)));
+    ldrw(tmp2, Address(post(ary2, 4)));
+    cmp(tmp1, tmp2);
+    br(NE, DIFFER);
+
+  BIND(TAIL03);  // 0-3 bytes left, cnt1 = #bytes left - 4
+    tst(cnt1, 0b10);
+    br(EQ, TAIL01);
+    ldrh(tmp1, Address(post(ary1, 2)));
+    ldrh(tmp2, Address(post(ary2, 2)));
+    cmp(tmp1, tmp2);
+    br(NE, DIFFER);
+  BIND(TAIL01);  // 0-1 byte left
+    tst(cnt1, 0b01);
+    br(EQ, SAME);
+    ldrb(tmp1, ary1);
+    ldrb(tmp2, ary2);
+    cmp(tmp1, tmp2);
+    br(NE, DIFFER);
+
+  BIND(SAME);
+    mov(result, true);
+  BIND(DIFFER); // result already set
+
+  BLOCK_COMMENT("} byte_arrays_equals");
+}
+
 // Compare char[] arrays aligned to 4 bytes
 void MacroAssembler::char_arrays_equals(Register ary1, Register ary2,
                                         Register result, Register tmp1)
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -1191,6 +1191,8 @@
                      Register tmp1);
   void char_arrays_equals(Register ary1, Register ary2,
                           Register result, Register tmp1);
+  void byte_arrays_equals(Register ary1, Register ary2,
+                          Register result, Register tmp1);
   void encode_iso_array(Register src, Register dst,
                         Register len, Register result,
                         FloatRegister Vtmp1, FloatRegister Vtmp2,
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -786,12 +786,19 @@
     int offset;
     const Register t0 = r3, t1 = r4, t2 = r5, t3 = r6,
       t4 = r7, t5 = r10, t6 = r11, t7 = r12;
+    const Register stride = r13;
 
     assert_different_registers(rscratch1, t0, t1, t2, t3, t4, t5, t6, t7);
     assert_different_registers(s, d, count, rscratch1);
 
     Label again, large, small;
-    __ align(6);
+    const char *stub_name;
+    if (direction == copy_forwards)
+      stub_name = "foward_copy_longs";
+    else
+      stub_name = "backward_copy_longs";
+    StubCodeMark mark(this, "StubRoutines", stub_name);
+    __ align(CodeEntryAlignment);
     __ bind(start);
     __ cmp(count, 8);
     __ br(Assembler::LO, small);
@@ -836,7 +843,7 @@
 
     __ ret(lr);
 
-    __ align(6);
+    __ align(CodeEntryAlignment);
     __ bind(large);
 
     // Fill 8 registers
@@ -845,10 +852,18 @@
     __ ldp(t4, t5, Address(s, 6 * unit));
     __ ldp(t6, t7, Address(__ pre(s, 8 * unit)));
 
+    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 (direction == copy_forwards && PrefetchCopyIntervalInBytes > 0)
-      __ prfm(Address(s, PrefetchCopyIntervalInBytes), PLDL1KEEP);
+    if (PrefetchCopyIntervalInBytes > 0)
+      __ prfm(use_stride ? Address(s, stride) : Address(s, prefetch), PLDL1KEEP);
 
     __ stp(t0, t1, Address(d, 2 * unit));
     __ ldp(t0, t1, Address(s, 2 * unit));
@@ -962,7 +977,7 @@
       __ lea(d, Address(d, count, Address::lsl(exact_log2(-step))));
     }
 
-    Label done, tail;
+    Label tail;
 
     __ cmp(count, 16/granularity);
     __ br(Assembler::LO, tail);
@@ -987,7 +1002,8 @@
       }
       // rscratch2 is the byte adjustment needed to align s.
       __ cbz(rscratch2, aligned);
-      __ lsr(rscratch2, rscratch2, exact_log2(granularity));
+      int shift = exact_log2(granularity);
+      if (shift)  __ lsr(rscratch2, rscratch2, shift);
       __ sub(count, count, rscratch2);
 
 #if 0
@@ -1150,8 +1166,11 @@
       // caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
       BLOCK_COMMENT("Entry:");
     }
-    __ cmp(d, s);
-    __ br(Assembler::LS, nooverlap_target);
+
+    // use fwd copy when (d-s) above_equal (count*size)
+    __ sub(rscratch1, d, s);
+    __ cmp(rscratch1, count, Assembler::LSL, exact_log2(size));
+    __ br(Assembler::HS, nooverlap_target);
 
     if (is_oop) {
       __ push(RegSet::of(d, count), sp);
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -120,7 +120,14 @@
     FLAG_SET_DEFAULT(AllocatePrefetchStepSize, 64);
   FLAG_SET_DEFAULT(PrefetchScanIntervalInBytes, 256);
   FLAG_SET_DEFAULT(PrefetchFieldsAhead, 256);
-  FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 256);
+  if (FLAG_IS_DEFAULT(PrefetchCopyIntervalInBytes))
+    FLAG_SET_DEFAULT(PrefetchCopyIntervalInBytes, 256);
+  if ((PrefetchCopyIntervalInBytes & 7) || (PrefetchCopyIntervalInBytes >= 32768)) {
+    warning("PrefetchCopyIntervalInBytes must be a multiple of 8 and < 32768");
+    PrefetchCopyIntervalInBytes &= ~7;
+    if (PrefetchCopyIntervalInBytes >= 32768)
+      PrefetchCopyIntervalInBytes = 32760;
+  }
 
   unsigned long auxv = getauxval(AT_HWCAP);
 
--- a/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -45,13 +45,6 @@
   if( cache_line_size > AllocatePrefetchStepSize )
     AllocatePrefetchStepSize = cache_line_size;
 
-  assert(AllocatePrefetchLines > 0, "invalid value");
-  if( AllocatePrefetchLines < 1 )     // set valid value in product VM
-    AllocatePrefetchLines = 3;
-  assert(AllocateInstancePrefetchLines > 0, "invalid value");
-  if( AllocateInstancePrefetchLines < 1 ) // set valid value in product VM
-    AllocateInstancePrefetchLines = 1;
-
   AllocatePrefetchDistance = allocate_prefetch_distance();
   AllocatePrefetchStyle    = allocate_prefetch_style();
 
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -114,15 +114,20 @@
 
 OopMap* RegisterSaver::save_live_registers(MacroAssembler* masm, int additional_frame_words,
                                            int* total_frame_words, bool verify_fpu, bool save_vectors) {
-  int vect_words = 0;
   int num_xmm_regs = XMMRegisterImpl::number_of_registers;
+  int ymm_bytes = num_xmm_regs * 16;
+  int zmm_bytes = num_xmm_regs * 32;
 #ifdef COMPILER2
   if (save_vectors) {
-    assert(UseAVX > 0, "512bit vectors are supported only with EVEX");
-    assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
-    // Save upper half of ZMM/YMM registers :
-    vect_words = 8 * 16 / wordSize;
-    additional_frame_words += vect_words;
+    assert(UseAVX > 0, "up to 512bit vectors are supported with EVEX");
+    assert(MaxVectorSize <= 64, "up to 512bit vectors are supported now");
+    // Save upper half of YMM registers
+    int vect_bytes = ymm_bytes;
+    if (UseAVX > 2) {
+      // Save upper half of ZMM registers as well
+      vect_bytes += zmm_bytes;
+    }
+    additional_frame_words += vect_bytes / wordSize;
   }
 #else
   assert(!save_vectors, "vectors are generated only by C2");
@@ -185,13 +190,14 @@
 
   off = xmm0_off;
   delta = xmm1_off - off;
-  if(UseSSE == 1) {           // Save the XMM state
+  if(UseSSE == 1) {
+    // Save the XMM state
     for (int n = 0; n < num_xmm_regs; n++) {
       __ movflt(Address(rsp, off*wordSize), as_XMMRegister(n));
       off += delta;
     }
   } else if(UseSSE >= 2) {
-    // Save whole 128bit (16 bytes) XMM regiters
+    // Save whole 128bit (16 bytes) XMM registers
     for (int n = 0; n < num_xmm_regs; n++) {
       __ movdqu(Address(rsp, off*wordSize), as_XMMRegister(n));
       off += delta;
@@ -199,13 +205,14 @@
   }
 
   if (save_vectors) {
-    assert(vect_words*wordSize == 128, "");
-    __ subptr(rsp, 128); // Save upper half of YMM registes
+    __ subptr(rsp, ymm_bytes);
+    // Save upper half of YMM registers
     for (int n = 0; n < num_xmm_regs; n++) {
       __ vextractf128h(Address(rsp, n*16), as_XMMRegister(n));
     }
     if (UseAVX > 2) {
-      __ subptr(rsp, 256); // Save upper half of ZMM registes
+      __ subptr(rsp, zmm_bytes);
+      // Save upper half of ZMM registers
       for (int n = 0; n < num_xmm_regs; n++) {
         __ vextractf64x4h(Address(rsp, n*32), as_XMMRegister(n), 1);
       }
@@ -255,48 +262,57 @@
 
 void RegisterSaver::restore_live_registers(MacroAssembler* masm, bool restore_vectors) {
   int num_xmm_regs = XMMRegisterImpl::number_of_registers;
+  int ymm_bytes = num_xmm_regs * 16;
+  int zmm_bytes = num_xmm_regs * 32;
   // Recover XMM & FPU state
   int additional_frame_bytes = 0;
 #ifdef COMPILER2
   if (restore_vectors) {
-    assert(UseAVX > 0, "512bit vectors are supported only with EVEX");
-    assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
-    additional_frame_bytes = 128;
+    assert(UseAVX > 0, "up to 512bit vectors are supported with EVEX");
+    assert(MaxVectorSize <= 64, "up to 512bit vectors are supported now");
+    // Save upper half of YMM registers
+    additional_frame_bytes = ymm_bytes;
+    if (UseAVX > 2) {
+      // Save upper half of ZMM registers as well
+      additional_frame_bytes += zmm_bytes;
+    }
   }
 #else
   assert(!restore_vectors, "vectors are generated only by C2");
 #endif
 
+  int off = xmm0_off;
+  int delta = xmm1_off - off;
+
+  if (UseSSE == 1) {
+    // Restore XMM registers
+    assert(additional_frame_bytes == 0, "");
+    for (int n = 0; n < num_xmm_regs; n++) {
+      __ movflt(as_XMMRegister(n), Address(rsp, off*wordSize));
+      off += delta;
+    }
+  } else if (UseSSE >= 2) {
+    // Restore whole 128bit (16 bytes) XMM registers. Do this before restoring YMM and
+    // ZMM because the movdqu instruction zeros the upper part of the XMM register.
+    for (int n = 0; n < num_xmm_regs; n++) {
+      __ movdqu(as_XMMRegister(n), Address(rsp, off*wordSize+additional_frame_bytes));
+      off += delta;
+    }
+  }
+
   if (restore_vectors) {
-    assert(additional_frame_bytes == 128, "");
     if (UseAVX > 2) {
       // Restore upper half of ZMM registers.
       for (int n = 0; n < num_xmm_regs; n++) {
         __ vinsertf64x4h(as_XMMRegister(n), Address(rsp, n*32), 1);
       }
-      __ addptr(rsp, additional_frame_bytes*2); // Save upper half of ZMM registes
+      __ addptr(rsp, zmm_bytes);
     }
-    // Restore upper half of YMM registes.
+    // Restore upper half of YMM registers.
     for (int n = 0; n < num_xmm_regs; n++) {
       __ vinsertf128h(as_XMMRegister(n), Address(rsp, n*16));
     }
-    __ addptr(rsp, additional_frame_bytes); // Save upper half of YMM registes
-  }
-
-  int off = xmm0_off;
-  int delta = xmm1_off - off;
-
-  if (UseSSE == 1) {
-    for (int n = 0; n < num_xmm_regs; n++) {
-      __ movflt(as_XMMRegister(n), Address(rsp, off*wordSize));
-      off += delta;
-    }
-  } else if (UseSSE >= 2) {
-    // additional_frame_bytes only populated for the restore_vector case, else it is 0
-    for (int n = 0; n < num_xmm_regs; n++) {
-      __ movdqu(as_XMMRegister(n), Address(rsp, off*wordSize+additional_frame_bytes));
-      off += delta;
-    }
+    __ addptr(rsp, ymm_bytes);
   }
 
   __ pop_FPU_state();
@@ -306,7 +322,6 @@
   __ popa();
   // Get the rbp, described implicitly by the frame sender code (no oopMap)
   __ pop(rbp);
-
 }
 
 void RegisterSaver::restore_result_registers(MacroAssembler* masm) {
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -150,8 +150,8 @@
   }
 #if defined(COMPILER2) || INCLUDE_JVMCI
   if (save_vectors) {
-    assert(UseAVX > 0, "512bit vectors are supported only with EVEX");
-    assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
+    assert(UseAVX > 0, "up to 512bit vectors are supported with EVEX");
+    assert(MaxVectorSize <= 64, "up to 512bit vectors are supported now");
   }
 #else
   assert(!save_vectors, "vectors are generated only by C2 and JVMCI");
@@ -176,18 +176,18 @@
 
   // push cpu state handles this on EVEX enabled targets
   if (save_vectors) {
-    // Save upper half of YMM registes(0..15)
+    // Save upper half of YMM registers(0..15)
     int base_addr = XSAVE_AREA_YMM_BEGIN;
     for (int n = 0; n < 16; n++) {
       __ vextractf128h(Address(rsp, base_addr+n*16), as_XMMRegister(n));
     }
     if (VM_Version::supports_evex()) {
-      // Save upper half of ZMM registes(0..15)
+      // Save upper half of ZMM registers(0..15)
       base_addr = XSAVE_AREA_ZMM_BEGIN;
       for (int n = 0; n < 16; n++) {
         __ vextractf64x4h(Address(rsp, base_addr+n*32), as_XMMRegister(n), 1);
       }
-      // Save full ZMM registes(16..num_xmm_regs)
+      // Save full ZMM registers(16..num_xmm_regs)
       base_addr = XSAVE_AREA_UPPERBANK;
       off = 0;
       int vector_len = Assembler::AVX_512bit;
@@ -321,8 +321,8 @@
 
 #if defined(COMPILER2) || INCLUDE_JVMCI
   if (restore_vectors) {
-    assert(UseAVX > 0, "512bit vectors are supported only with EVEX");
-    assert(MaxVectorSize == 64, "only 512bit vectors are supported now");
+    assert(UseAVX > 0, "up to 512bit vectors are supported with EVEX");
+    assert(MaxVectorSize <= 64, "up to 512bit vectors are supported now");
   }
 #else
   assert(!restore_vectors, "vectors are generated only by C2");
@@ -330,18 +330,18 @@
 
   // On EVEX enabled targets everything is handled in pop fpu state
   if (restore_vectors) {
-    // Restore upper half of YMM registes (0..15)
+    // Restore upper half of YMM registers (0..15)
     int base_addr = XSAVE_AREA_YMM_BEGIN;
     for (int n = 0; n < 16; n++) {
       __ vinsertf128h(as_XMMRegister(n), Address(rsp,  base_addr+n*16));
     }
     if (VM_Version::supports_evex()) {
-      // Restore upper half of ZMM registes (0..15)
+      // Restore upper half of ZMM registers (0..15)
       base_addr = XSAVE_AREA_ZMM_BEGIN;
       for (int n = 0; n < 16; n++) {
         __ vinsertf64x4h(as_XMMRegister(n), Address(rsp, base_addr+n*32), 1);
       }
-      // Restore full ZMM registes(16..num_xmm_regs)
+      // Restore full ZMM registers(16..num_xmm_regs)
       base_addr = XSAVE_AREA_UPPERBANK;
       int vector_len = Assembler::AVX_512bit;
       int off = 0;
@@ -351,7 +351,7 @@
     }
   } else {
     if (VM_Version::supports_evex()) {
-      // Restore upper bank of ZMM registes(16..31) for double/float usage
+      // Restore upper bank of ZMM registers(16..31) for double/float usage
       int base_addr = XSAVE_AREA_UPPERBANK;
       int off = 0;
       for (int n = 16; n < num_xmm_regs; n++) {
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -1163,13 +1163,6 @@
   if( cache_line_size > AllocatePrefetchStepSize )
     AllocatePrefetchStepSize = cache_line_size;
 
-  assert(AllocatePrefetchLines > 0, "invalid value");
-  if( AllocatePrefetchLines < 1 )     // set valid value in product VM
-    AllocatePrefetchLines = 3;
-  assert(AllocateInstancePrefetchLines > 0, "invalid value");
-  if( AllocateInstancePrefetchLines < 1 ) // set valid value in product VM
-    AllocateInstancePrefetchLines = 1;
-
   AllocatePrefetchDistance = allocate_prefetch_distance();
   AllocatePrefetchStyle    = allocate_prefetch_style();
 
@@ -1183,7 +1176,9 @@
     }
     if (supports_sse4_2() && supports_ht()) { // Nehalem based cpus
       AllocatePrefetchDistance = 192;
-      AllocatePrefetchLines = 4;
+      if (FLAG_IS_DEFAULT(AllocatePrefetchLines)) {
+        FLAG_SET_DEFAULT(AllocatePrefetchLines, 4);
+      }
     }
 #ifdef COMPILER2
     if (supports_sse4_2()) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64.java	Thu Feb 11 21:07:38 2016 +0100
@@ -76,14 +76,14 @@
     public static final Register zr = r31;
     public static final Register sp = r31;
 
+    // @formatter:off
     public static final Register[] cpuRegisters = {
-        // @formatter:off
         r0,  r1,  r2,  r3,  r4,  r5,  r6,  r7,
         r8,  r9,  r10, r11, r12, r13, r14, r15,
         r16, r17, r18, r19, r20, r21, r22, r23,
         r24, r25, r26, r27, r28, r29, r30, r31
-        // @formatter:on
     };
+    // @formatter:on
 
     public static final RegisterCategory SIMD = new RegisterCategory("SIMD");
 
@@ -121,17 +121,17 @@
     public static final Register v30 = new Register(62, 30, "v30", SIMD);
     public static final Register v31 = new Register(63, 31, "v31", SIMD);
 
+    // @formatter:off
     public static final Register[] simdRegisters = {
-        // @formatter:off
         v0,  v1,  v2,  v3,  v4,  v5,  v6,  v7,
         v8,  v9,  v10, v11, v12, v13, v14, v15,
         v16, v17, v18, v19, v20, v21, v22, v23,
         v24, v25, v26, v27, v28, v29, v30, v31
-        // @formatter:on
     };
+    // @formatter:on
 
+    // @formatter:off
     public static final Register[] allRegisters = {
-        // @formatter:off
         r0,  r1,  r2,  r3,  r4,  r5,  r6,  r7,
         r8,  r9,  r10, r11, r12, r13, r14, r15,
         r16, r17, r18, r19, r20, r21, r22, r23,
@@ -141,14 +141,14 @@
         v8,  v9,  v10, v11, v12, v13, v14, v15,
         v16, v17, v18, v19, v20, v21, v22, v23,
         v24, v25, v26, v27, v28, v29, v30, v31
-        // @formatter:on
     };
+    // @formatter:on
 
     /**
      * Basic set of CPU features mirroring what is returned from the cpuid instruction. See:
      * {@code VM_Version::cpuFeatureFlags}.
      */
-    public static enum CPUFeature {
+    public enum CPUFeature {
         FP,
         ASIMD,
         EVTSTRM,
@@ -166,7 +166,7 @@
     /**
      * Set of flags to control code emission.
      */
-    public static enum Flag {
+    public enum Flag {
         UseBarriersForVolatile,
         UseCRC32,
         UseNeon
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64Kind.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.aarch64/src/jdk/vm/ci/aarch64/AArch64Kind.java	Thu Feb 11 21:07:38 2016 +0100
@@ -58,13 +58,13 @@
     private final AArch64Kind scalar;
     private final EnumKey<AArch64Kind> key = new EnumKey<>(this);
 
-    private AArch64Kind(int size) {
+    AArch64Kind(int size) {
         this.size = size;
         this.scalar = this;
         this.vectorLength = 1;
     }
 
-    private AArch64Kind(int size, AArch64Kind scalar) {
+    AArch64Kind(int size, AArch64Kind scalar) {
         this.size = size;
         this.scalar = scalar;
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64.java	Thu Feb 11 21:07:38 2016 +0100
@@ -169,7 +169,7 @@
      * Basic set of CPU features mirroring what is returned from the cpuid instruction. See:
      * {@code VM_Version::cpuFeatureFlags}.
      */
-    public static enum CPUFeature {
+    public enum CPUFeature {
         CX8,
         CMOV,
         FXSR,
@@ -210,7 +210,7 @@
     /**
      * Set of flags to control code emission.
      */
-    public static enum Flag {
+    public enum Flag {
         UseCountLeadingZerosInstruction,
         UseCountTrailingZerosInstruction
     }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64Kind.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.amd64/src/jdk/vm/ci/amd64/AMD64Kind.java	Thu Feb 11 21:07:38 2016 +0100
@@ -74,13 +74,13 @@
     private final AMD64Kind scalar;
     private final EnumKey<AMD64Kind> key = new EnumKey<>(this);
 
-    private AMD64Kind(int size) {
+    AMD64Kind(int size) {
         this.size = size;
         this.scalar = this;
         this.vectorLength = 1;
     }
 
-    private AMD64Kind(int size, AMD64Kind scalar) {
+    AMD64Kind(int size, AMD64Kind scalar) {
         this.size = size;
         this.scalar = scalar;
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/SourceStackTrace.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.code/src/jdk/vm/ci/code/SourceStackTrace.java	Thu Feb 11 21:07:38 2016 +0100
@@ -23,7 +23,7 @@
 package jdk.vm.ci.code;
 
 /**
- * Class representing a exception with a stack trace of the currently processed position in the
+ * Class representing an exception with a stack trace of the currently processed position in the
  * compiled Java program instead of the stack trace of the compiler. The exception of the compiler
  * is saved as the cause of this exception.
  */
@@ -36,7 +36,7 @@
             private static final long serialVersionUID = 6279381376051787907L;
 
             @Override
-            public final synchronized Throwable fillInStackTrace() {
+            public synchronized Throwable fillInStackTrace() {
                 assert elements != null;
                 setStackTrace(elements);
                 return this;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCallingConventionType.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCallingConventionType.java	Thu Feb 11 21:07:38 2016 +0100
@@ -49,7 +49,7 @@
 
     public static final Type[] VALUES = values();
 
-    private HotSpotCallingConventionType(boolean out) {
+    HotSpotCallingConventionType(boolean out) {
         this.out = out;
     }
 }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledCode.java	Thu Feb 11 21:07:38 2016 +0100
@@ -24,6 +24,7 @@
 
 import jdk.vm.ci.code.BytecodeFrame;
 import jdk.vm.ci.code.CompiledCode;
+import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.code.site.DataPatch;
 import jdk.vm.ci.code.site.Infopoint;
 import jdk.vm.ci.code.site.Site;
@@ -99,9 +100,9 @@
     protected final int totalFrameSize;
 
     /**
-     * Offset in bytes for the custom stack area (relative to sp).
+     * The deopt rescue slot. Must be non-null if there is a safepoint in the method.
      */
-    protected final int customStackAreaOffset;
+    protected final StackSlot deoptRescueSlot;
 
     public static class Comment {
 
@@ -115,7 +116,7 @@
     }
 
     public HotSpotCompiledCode(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
-                    int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, int customStackAreaOffset) {
+                    int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot) {
         this.name = name;
         this.targetCode = targetCode;
         this.targetCodeSize = targetCodeSize;
@@ -129,7 +130,7 @@
         this.dataSectionPatches = dataSectionPatches;
         this.isImmutablePIC = isImmutablePIC;
         this.totalFrameSize = totalFrameSize;
-        this.customStackAreaOffset = customStackAreaOffset;
+        this.deoptRescueSlot = deoptRescueSlot;
 
         assert validateFrames();
     }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompiledNmethod.java	Thu Feb 11 21:07:38 2016 +0100
@@ -22,6 +22,7 @@
  */
 package jdk.vm.ci.hotspot;
 
+import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.code.site.DataPatch;
 import jdk.vm.ci.code.site.Site;
 import jdk.vm.ci.inittimer.SuppressFBWarnings;
@@ -55,9 +56,9 @@
     @SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "set by the VM") private String installationFailureMessage;
 
     public HotSpotCompiledNmethod(String name, byte[] targetCode, int targetCodeSize, Site[] sites, Assumption[] assumptions, ResolvedJavaMethod[] methods, Comment[] comments, byte[] dataSection,
-                    int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, int customStackAreaOffset, HotSpotResolvedJavaMethod method, int entryBCI,
+                    int dataSectionAlignment, DataPatch[] dataSectionPatches, boolean isImmutablePIC, int totalFrameSize, StackSlot deoptRescueSlot, HotSpotResolvedJavaMethod method, int entryBCI,
                     int id, long jvmciEnv, boolean hasUnsafeAccess) {
-        super(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC, totalFrameSize, customStackAreaOffset);
+        super(name, targetCode, targetCodeSize, sites, assumptions, methods, comments, dataSection, dataSectionAlignment, dataSectionPatches, isImmutablePIC, totalFrameSize, deoptRescueSlot);
         this.method = method;
         this.entryBCI = entryBCI;
         this.id = id;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java	Thu Feb 11 21:07:38 2016 +0100
@@ -126,7 +126,7 @@
         private static final int InternalMin = config().jvmConstantInternalMin;
         private static final int InternalMax = config().jvmConstantInternalMax;
 
-        private JVM_CONSTANT(int tag) {
+        JVM_CONSTANT(int tag) {
             this.tag = tag;
         }
 
@@ -171,7 +171,7 @@
         int lastCpi = Integer.MIN_VALUE;
         JavaType javaType;
 
-        public LookupTypeCacheElement(int lastCpi, JavaType javaType) {
+        LookupTypeCacheElement(int lastCpi, JavaType javaType) {
             super();
             this.lastCpi = lastCpi;
             this.javaType = javaType;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotForeignCallTarget.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotForeignCallTarget.java	Thu Feb 11 21:07:38 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,9 @@
  */
 package jdk.vm.ci.hotspot;
 
-public class HotSpotForeignCallTarget {
+import jdk.vm.ci.meta.InvokeTarget;
+
+public class HotSpotForeignCallTarget implements InvokeTarget {
 
     /**
      * The entry point address of this call's target.
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Thu Feb 11 21:07:38 2016 +0100
@@ -43,6 +43,7 @@
 import jdk.vm.ci.code.InstalledCode;
 import jdk.vm.ci.common.JVMCIError;
 import jdk.vm.ci.inittimer.InitTimer;
+import jdk.vm.ci.inittimer.SuppressFBWarnings;
 import jdk.vm.ci.meta.JVMCIMetaAccessContext;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaType;
@@ -115,7 +116,7 @@
         private boolean isDefault;
         private final String help;
 
-        private Option(Class<?> type, Object defaultValue, String help) {
+        Option(Class<?> type, Object defaultValue, String help) {
             assert Character.isUpperCase(name().charAt(0)) : "Option name must start with upper-case letter: " + name();
             this.type = type;
             this.value = UNINITIALIZED;
@@ -123,6 +124,7 @@
             this.help = help;
         }
 
+        @SuppressFBWarnings(value = "ES_COMPARING_STRINGS_WITH_EQ", justification = "sentinel must be String since it's a static final in an enum")
         private Object getValue() {
             if (value == UNINITIALIZED) {
                 String propertyValue = VM.getSavedProperty(JVMCI_OPTION_PROPERTY_PREFIX + name());
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMemoryAccessProviderImpl.java	Thu Feb 11 21:07:38 2016 +0100
@@ -38,7 +38,7 @@
 
     protected final HotSpotJVMCIRuntimeProvider runtime;
 
-    public HotSpotMemoryAccessProviderImpl(HotSpotJVMCIRuntimeProvider runtime) {
+    HotSpotMemoryAccessProviderImpl(HotSpotJVMCIRuntimeProvider runtime) {
         this.runtime = runtime;
     }
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodData.java	Thu Feb 11 21:07:38 2016 +0100
@@ -413,7 +413,7 @@
         private static final int COUNTER_DATA_SIZE = cellIndexToOffset(1);
         private static final int COUNTER_DATA_COUNT_OFFSET = cellIndexToOffset(config.methodDataCountOffset);
 
-        public CounterData() {
+        CounterData() {
             super(Tag.CounterData, COUNTER_DATA_SIZE);
         }
 
@@ -442,7 +442,7 @@
         protected static final int TAKEN_COUNT_OFFSET = cellIndexToOffset(config.jumpDataTakenOffset);
         protected static final int TAKEN_DISPLACEMENT_OFFSET = cellIndexToOffset(config.jumpDataDisplacementOffset);
 
-        public JumpData() {
+        JumpData() {
             super(Tag.JumpData, JUMP_DATA_SIZE);
         }
 
@@ -476,7 +476,7 @@
         final long[] counts;
         final long totalCount;
 
-        public RawItemProfile(int entries, T[] items, long[] counts, long totalCount) {
+        RawItemProfile(int entries, T[] items, long[] counts, long totalCount) {
             this.entries = entries;
             this.items = items;
             this.counts = counts;
@@ -587,7 +587,7 @@
 
         private static final int TYPE_CHECK_DATA_SIZE = cellIndexToOffset(2) + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
 
-        public ReceiverTypeData() {
+        ReceiverTypeData() {
             super(Tag.ReceiverTypeData, TYPE_CHECK_DATA_SIZE);
         }
 
@@ -612,7 +612,7 @@
         private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_OFFSET = TYPE_DATA_FIRST_TYPE_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
         private static final int VIRTUAL_CALL_DATA_FIRST_METHOD_COUNT_OFFSET = TYPE_DATA_FIRST_TYPE_COUNT_OFFSET + TYPE_DATA_ROW_SIZE * config.typeProfileWidth;
 
-        public VirtualCallData() {
+        VirtualCallData() {
             super(Tag.VirtualCallData, VIRTUAL_CALL_DATA_SIZE);
         }
 
@@ -714,7 +714,7 @@
 
     private static class VirtualCallTypeData extends VirtualCallData {
 
-        public VirtualCallTypeData() {
+        VirtualCallTypeData() {
             super(Tag.VirtualCallTypeData, 0);
         }
 
@@ -730,7 +730,7 @@
         private static final int RET_DATA_ROW_SIZE = cellsToBytes(3);
         private static final int RET_DATA_SIZE = cellIndexToOffset(1) + RET_DATA_ROW_SIZE * config.bciProfileWidth;
 
-        public RetData() {
+        RetData() {
             super(Tag.RetData, RET_DATA_SIZE);
         }
     }
@@ -740,7 +740,7 @@
         private static final int BRANCH_DATA_SIZE = cellIndexToOffset(3);
         private static final int NOT_TAKEN_COUNT_OFFSET = cellIndexToOffset(config.branchDataNotTakenOffset);
 
-        public BranchData() {
+        BranchData() {
             super(Tag.BranchData, BRANCH_DATA_SIZE);
         }
 
@@ -773,7 +773,7 @@
         private static final int ARRAY_DATA_LENGTH_OFFSET = cellIndexToOffset(config.arrayDataArrayLenOffset);
         protected static final int ARRAY_DATA_START_OFFSET = cellIndexToOffset(config.arrayDataArrayStartOffset);
 
-        public ArrayData(Tag tag, int staticSize) {
+        ArrayData(Tag tag, int staticSize) {
             super(tag, staticSize);
         }
 
@@ -800,7 +800,7 @@
         private static final int MULTI_BRANCH_DATA_FIRST_COUNT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(0);
         private static final int MULTI_BRANCH_DATA_FIRST_DISPLACEMENT_OFFSET = ARRAY_DATA_START_OFFSET + cellsToBytes(1);
 
-        public MultiBranchData() {
+        MultiBranchData() {
             super(Tag.MultiBranchData, MULTI_BRANCH_DATA_SIZE);
         }
 
@@ -882,13 +882,13 @@
 
         private static final int ARG_INFO_DATA_SIZE = cellIndexToOffset(1);
 
-        public ArgInfoData() {
+        ArgInfoData() {
             super(Tag.ArgInfoData, ARG_INFO_DATA_SIZE);
         }
     }
 
     private static class UnknownProfileData extends AbstractMethodData {
-        public UnknownProfileData(Tag tag) {
+        UnknownProfileData(Tag tag) {
             super(tag, 0);
         }
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodDataAccessor.java	Thu Feb 11 21:07:38 2016 +0100
@@ -56,7 +56,7 @@
 
         private final int value;
 
-        private Tag(int value) {
+        Tag(int value) {
             this.value = value;
         }
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodUnresolved.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotMethodUnresolved.java	Thu Feb 11 21:07:38 2016 +0100
@@ -34,7 +34,7 @@
     private final Signature signature;
     protected JavaType holder;
 
-    public HotSpotMethodUnresolved(String name, Signature signature, JavaType holder) {
+    HotSpotMethodUnresolved(String name, Signature signature, JavaType holder) {
         super(name);
         this.holder = holder;
         this.signature = signature;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaFieldImpl.java	Thu Feb 11 21:07:38 2016 +0100
@@ -56,7 +56,7 @@
     public static class FieldLocationIdentity extends LocationIdentity {
         HotSpotResolvedJavaField inner;
 
-        public FieldLocationIdentity(HotSpotResolvedJavaFieldImpl inner) {
+        FieldLocationIdentity(HotSpotResolvedJavaFieldImpl inner) {
             this.inner = inner;
         }
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Thu Feb 11 21:07:38 2016 +0100
@@ -33,7 +33,6 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.net.URL;
 import java.nio.ByteOrder;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -49,7 +48,6 @@
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.JavaType;
-import jdk.vm.ci.meta.MetaUtil;
 import jdk.vm.ci.meta.ModifiersProvider;
 import jdk.vm.ci.meta.ResolvedJavaField;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
@@ -555,7 +553,7 @@
          *
          * @param index index to the fields array
          */
-        public FieldInfo(int index) {
+        FieldInfo(int index) {
             HotSpotVMConfig config = config();
             // Get Klass::_fields
             final long metaspaceFields = UNSAFE.getAddress(getMetaspaceKlass() + config.instanceKlassFieldsOffset);
@@ -839,12 +837,6 @@
     }
 
     @Override
-    public URL getClassFilePath() {
-        Class<?> cls = mirror();
-        return cls.getResource(MetaUtil.getSimpleName(cls, true).replace('.', '$') + ".class");
-    }
-
-    @Override
     public boolean isLocal() {
         return mirror().isLocalClass();
     }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java	Thu Feb 11 21:07:38 2016 +0100
@@ -27,7 +27,6 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
 import java.lang.reflect.Modifier;
-import java.net.URL;
 
 import jdk.vm.ci.common.JVMCIError;
 import jdk.vm.ci.meta.Assumptions.AssumptionResult;
@@ -240,11 +239,6 @@
     }
 
     @Override
-    public URL getClassFilePath() {
-        return null;
-    }
-
-    @Override
     public boolean isLocal() {
         return false;
     }
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Thu Feb 11 21:07:38 2016 +0100
@@ -360,7 +360,7 @@
 
         private final long address;
 
-        public VMFields(long address) {
+        VMFields(long address) {
             this.address = address;
         }
 
@@ -477,7 +477,7 @@
 
         private final long address;
 
-        public VMTypes(long address) {
+        VMTypes(long address) {
             this.address = address;
         }
 
@@ -580,7 +580,7 @@
 
         private final long address;
 
-        public VMIntConstants(long address) {
+        VMIntConstants(long address) {
             this.address = address;
         }
 
@@ -639,7 +639,7 @@
 
         private final long address;
 
-        public VMLongConstants(long address) {
+        VMLongConstants(long address) {
             this.address = address;
         }
 
@@ -698,7 +698,7 @@
 
         private final long address;
 
-        public VMAddresses(long address) {
+        VMAddresses(long address) {
             this.address = address;
         }
 
@@ -753,7 +753,7 @@
         private final long nameOffset;
         private final long addrOffset;
 
-        public Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
+        Flags(HashMap<String, VMFields.Field> vmStructs, HashMap<String, VMTypes.Type> vmTypes) {
             address = vmStructs.get("Flag::flags").getValue();
             entrySize = vmTypes.get("Flag").getSize();
             typeOffset = vmStructs.get("Flag::_type").getOffset();
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/DeoptimizationAction.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/DeoptimizationAction.java	Thu Feb 11 21:07:38 2016 +0100
@@ -59,7 +59,7 @@
 
     private final boolean invalidatesCompilation;
 
-    private DeoptimizationAction(boolean invalidatesCompilation) {
+    DeoptimizationAction(boolean invalidatesCompilation) {
         this.invalidatesCompilation = invalidatesCompilation;
     }
 
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaKind.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/JavaKind.java	Thu Feb 11 21:07:38 2016 +0100
@@ -72,7 +72,7 @@
     private final Class<?> boxedJavaClass;
     private final int slotCount;
 
-    private JavaKind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class<?> primitiveJavaClass, Class<?> boxedJavaClass) {
+    JavaKind(char typeChar, String javaName, int slotCount, boolean isStackInt, Class<?> primitiveJavaClass, Class<?> boxedJavaClass) {
         this.typeChar = typeChar;
         this.javaName = javaName;
         this.slotCount = slotCount;
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LIRKind.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/LIRKind.java	Thu Feb 11 21:07:38 2016 +0100
@@ -57,7 +57,7 @@
  */
 public final class LIRKind {
 
-    private static enum IllegalKind implements PlatformKind {
+    private enum IllegalKind implements PlatformKind {
         ILLEGAL;
 
         private final EnumKey<IllegalKind> key = new EnumKey<>(this);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MethodHandleAccessProvider.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MethodHandleAccessProvider.java	Thu Feb 11 21:07:38 2016 +0100
@@ -35,7 +35,7 @@
      * Identification for methods defined on the class {@link MethodHandle} that are processed by
      * the {@link MethodHandleAccessProvider}.
      */
-    public enum IntrinsicMethod {
+    enum IntrinsicMethod {
         /** The method {@code MethodHandle.invokeBasic}. */
         INVOKE_BASIC,
         /** The method {@code MethodHandle.linkToStatic}. */
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/PlatformKind.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/PlatformKind.java	Thu Feb 11 21:07:38 2016 +0100
@@ -33,7 +33,7 @@
 
     }
 
-    public class EnumKey<E extends Enum<E>> implements Key {
+    class EnumKey<E extends Enum<E>> implements Key {
         private final Enum<E> e;
 
         public EnumKey(Enum<E> e) {
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/ResolvedJavaType.java	Thu Feb 11 21:07:38 2016 +0100
@@ -23,7 +23,6 @@
 package jdk.vm.ci.meta;
 
 import java.lang.annotation.Annotation;
-import java.net.URL;
 
 import jdk.vm.ci.meta.Assumptions.AssumptionResult;
 
@@ -308,11 +307,6 @@
     String getSourceFileName();
 
     /**
-     * Returns the class file path - if available - of this type, or {@code null}.
-     */
-    URL getClassFilePath();
-
-    /**
      * Returns {@code true} if the type is a local type.
      */
     boolean isLocal();
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARCKind.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARCKind.java	Thu Feb 11 21:07:38 2016 +0100
@@ -47,13 +47,13 @@
     private final SPARCKind scalar;
     private final EnumKey<SPARCKind> key = new EnumKey<>(this);
 
-    private SPARCKind(int size) {
+    SPARCKind(int size) {
         this.size = size;
         this.scalar = this;
         this.vectorLength = 1;
     }
 
-    private SPARCKind(int size, SPARCKind scalar) {
+    SPARCKind(int size, SPARCKind scalar) {
         this.size = size;
         this.scalar = scalar;
 
--- a/hotspot/src/share/vm/ci/ciField.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/ci/ciField.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -72,7 +72,7 @@
 
   assert(ciObjectFactory::is_initialized(), "not a shared field");
 
-  assert(klass->get_instanceKlass()->is_linked(), "must be linked before using its constan-pool");
+  assert(klass->get_instanceKlass()->is_linked(), "must be linked before using its constant-pool");
 
   constantPoolHandle cpool(thread, klass->get_instanceKlass()->constants());
 
@@ -106,10 +106,31 @@
   // even though we may not need to.
   int holder_index = cpool->klass_ref_index_at(index);
   bool holder_is_accessible;
-  ciInstanceKlass* declared_holder =
-    ciEnv::current(thread)->get_klass_by_index(cpool, holder_index,
-                                               holder_is_accessible,
-                                               klass)->as_instance_klass();
+
+  ciKlass* generic_declared_holder = ciEnv::current(thread)->get_klass_by_index(cpool, holder_index,
+                                                                                holder_is_accessible,
+                                                                                klass);
+
+  if (generic_declared_holder->is_array_klass()) {
+    // If the declared holder of the field is an array class, assume that
+    // the canonical holder of that field is java.lang.Object. Arrays
+    // do not have fields; java.lang.Object is the only supertype of an
+    // array type that can declare fields and is therefore the canonical
+    // holder of the array type.
+    //
+    // Furthermore, the compilers assume that java.lang.Object does not
+    // have any fields. Therefore, the field is not looked up. Instead,
+    // the method returns partial information that will trigger special
+    // handling in ciField::will_link and will result in a
+    // java.lang.NoSuchFieldError exception being thrown by the compiled
+    // code (the expected behavior in this case).
+    _holder = ciEnv::current(thread)->Object_klass();
+    _offset = -1;
+    _is_constant = false;
+    return;
+  }
+
+  ciInstanceKlass* declared_holder = generic_declared_holder->as_instance_klass();
 
   // The declared holder of this field may not have been loaded.
   // Bail out with partial field information.
--- a/hotspot/src/share/vm/code/codeCache.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/code/codeCache.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -1494,7 +1494,7 @@
 }
 
 void CodeCache::print_codelist(outputStream* st) {
-  assert_locked_or_safepoint(CodeCache_lock);
+  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
   NMethodIterator iter;
   while(iter.next_alive()) {
@@ -1508,9 +1508,8 @@
 }
 
 void CodeCache::print_layout(outputStream* st) {
-  assert_locked_or_safepoint(CodeCache_lock);
+  MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   ResourceMark rm;
-
   print_summary(st, true);
 }
 
--- a/hotspot/src/share/vm/code/nmethod.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -322,9 +322,12 @@
 
 bool ExceptionCache::add_address_and_handler(address addr, address handler) {
   if (test_address(addr) == handler) return true;
-  if (count() < cache_size) {
-    set_pc_at(count(),addr);
-    set_handler_at(count(), handler);
+
+  int index = count();
+  if (index < cache_size) {
+    set_pc_at(index, addr);
+    set_handler_at(index, handler);
+    OrderAccess::storestore();
     increment_count();
     return true;
   }
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -466,9 +466,16 @@
   return NULL;
 }
 
+void CompileBroker::print_compile_queues(outputStream* st) {
+  st->print_cr("Current compiles: ");
+  MutexLocker locker(MethodCompileQueue_lock);
+  MutexLocker locker2(Threads_lock);
 
-void CompileBroker::print_compile_queues(outputStream* st) {
-  MutexLocker locker(MethodCompileQueue_lock);
+  char buf[2000];
+  int buflen = sizeof(buf);
+  Threads::print_threads_compiling(st, buf, buflen);
+
+  st->cr();
   if (_c1_compile_queue != NULL) {
     _c1_compile_queue->print(st);
   }
@@ -479,8 +486,7 @@
 
 void CompileQueue::print(outputStream* st) {
   assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
-  st->print_cr("Contents of %s", name());
-  st->print_cr("----------------------------");
+  st->print_cr("%s:", name());
   CompileTask* task = _first;
   if (task == NULL) {
     st->print_cr("Empty");
@@ -490,7 +496,7 @@
       task = task->next();
     }
   }
-  st->print_cr("----------------------------");
+  st->cr();
 }
 
 void CompileQueue::print_tty() {
@@ -539,7 +545,7 @@
         c1_count = JVMCIHostThreads;
       }
 
-      if (!UseInterpreter) {
+      if (!UseInterpreter || !BackgroundCompilation) {
         // Force initialization of JVMCI compiler otherwise JVMCI
         // compilations will not block until JVMCI is initialized
         ResourceMark rm;
@@ -1340,49 +1346,55 @@
 }
 
 #if INCLUDE_JVMCI
-// The number of milliseconds to wait before checking if the
-// JVMCI compiler thread is blocked.
-static const long BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE = 500;
+// The number of milliseconds to wait before checking if
+// JVMCI compilation has made progress.
+static const long JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE = 500;
 
-// The number of successive times the above check is allowed to
-// see a blocked JVMCI compiler thread before unblocking the
-// thread waiting for the compilation to finish.
-static const int BLOCKING_JVMCI_COMPILATION_WAIT_TO_UNBLOCK_ATTEMPTS = 5;
+// The number of JVMCI compilation progress checks that must fail
+// before unblocking a thread waiting for a blocking compilation.
+static const int JVMCI_COMPILATION_PROGRESS_WAIT_ATTEMPTS = 5;
 
 /**
  * Waits for a JVMCI compiler to complete a given task. This thread
- * waits until either the task completes or it sees the JVMCI compiler
- * thread is blocked for N consecutive milliseconds where N is
- * BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE *
- * BLOCKING_JVMCI_COMPILATION_WAIT_TO_UNBLOCK_ATTEMPTS.
+ * waits until either the task completes or it sees no JVMCI compilation
+ * progress for N consecutive milliseconds where N is
+ * JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE *
+ * JVMCI_COMPILATION_PROGRESS_WAIT_ATTEMPTS.
  *
  * @return true if this thread needs to free/recycle the task
  */
-bool CompileBroker::wait_for_jvmci_completion(CompileTask* task, JavaThread* thread) {
+bool CompileBroker::wait_for_jvmci_completion(JVMCICompiler* jvmci, CompileTask* task, JavaThread* thread) {
   MutexLocker waiter(task->lock(), thread);
-  int consecutively_blocked = 0;
-  while (task->lock()->wait(!Mutex::_no_safepoint_check_flag, BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE)) {
+  int progress_wait_attempts = 0;
+  int methods_compiled = jvmci->methods_compiled();
+  while (!task->is_complete() && !is_compilation_disabled_forever() &&
+         task->lock()->wait(!Mutex::_no_safepoint_check_flag, JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE)) {
     CompilerThread* jvmci_compiler_thread = task->jvmci_compiler_thread();
+
+    bool progress;
     if (jvmci_compiler_thread != NULL) {
-      JavaThreadState state;
-      {
-        // A JVMCI compiler thread should not disappear at this point
-        // but let's be extra safe.
-        MutexLocker mu(Threads_lock, thread);
-        state = jvmci_compiler_thread->thread_state();
-      }
-      if (state == _thread_blocked) {
-        if (++consecutively_blocked == BLOCKING_JVMCI_COMPILATION_WAIT_TO_UNBLOCK_ATTEMPTS) {
-          if (PrintCompilation) {
-            task->print(tty, "wait for blocking compilation timed out");
-          }
-          break;
+      // If the JVMCI compiler thread is not blocked, we deem it to be making progress.
+      progress = jvmci_compiler_thread->thread_state() != _thread_blocked;
+    } else {
+      // Still waiting on JVMCI compiler queue. This thread may be holding a lock
+      // that all JVMCI compiler threads are blocked on. We use the counter for
+      // successful JVMCI compilations to determine whether JVMCI compilation
+      // is still making progress through the JVMCI compiler queue.
+      progress = jvmci->methods_compiled() != methods_compiled;
+    }
+
+    if (!progress) {
+      if (++progress_wait_attempts == JVMCI_COMPILATION_PROGRESS_WAIT_ATTEMPTS) {
+        if (PrintCompilation) {
+          task->print(tty, "wait for blocking compilation timed out");
         }
-      } else {
-        consecutively_blocked = 0;
+        break;
       }
     } else {
-      // Still waiting on JVMCI compiler queue
+      progress_wait_attempts = 0;
+      if (jvmci_compiler_thread == NULL) {
+        methods_compiled = jvmci->methods_compiled();
+      }
     }
   }
   task->clear_waiter();
@@ -1407,8 +1419,9 @@
   methodHandle method(thread, task->method());
   bool free_task;
 #if INCLUDE_JVMCI
-  if (compiler(task->comp_level())->is_jvmci()) {
-    free_task = wait_for_jvmci_completion(task, thread);
+  AbstractCompiler* comp = compiler(task->comp_level());
+  if (comp->is_jvmci()) {
+    free_task = wait_for_jvmci_completion((JVMCICompiler*) comp, task, thread);
   } else
 #endif
   {
@@ -2355,10 +2368,3 @@
   }
 }
 
-
-void CompileBroker::print_compiler_threads_on(outputStream* st) {
-#ifndef PRODUCT
-  st->print_cr("Compiler thread printing unimplemented.");
-  st->cr();
-#endif
-}
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -32,6 +32,9 @@
 #include "runtime/perfData.hpp"
 #include "trace/tracing.hpp"
 #include "utilities/stack.hpp"
+#if INCLUDE_JVMCI
+#include "jvmci/jvmciCompiler.hpp"
+#endif
 
 class nmethod;
 class nmethodLocker;
@@ -234,7 +237,7 @@
                                           bool                blocking);
   static void wait_for_completion(CompileTask* task);
 #if INCLUDE_JVMCI
-  static bool wait_for_jvmci_completion(CompileTask* task, JavaThread* thread);
+  static bool wait_for_jvmci_completion(JVMCICompiler* comp, CompileTask* task, JavaThread* thread);
 #endif
 
   static void invoke_compiler_on_method(CompileTask* task);
@@ -350,8 +353,6 @@
   // Debugging output for failure
   static void print_last_compile();
 
-  static void print_compiler_threads_on(outputStream* st);
-
   // compiler name for debugging
   static const char* compiler_name(int comp_level);
 
--- a/hotspot/src/share/vm/compiler/disassembler.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/compiler/disassembler.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -85,6 +85,7 @@
 
  public:
   static bool can_decode() {
+    ttyLocker tl;
     return (_decode_instructions_virtual != NULL) ||
            (_decode_instructions != NULL) ||
            load_library();
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -546,7 +546,7 @@
       // Make sure a valid compile_id is associated with every compile
       id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
     }
-    result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer,
+    result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer,
                                        stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
                                        compiler, _debug_recorder, _dependencies, env, id,
                                        has_unsafe_access, _has_wide_vector, installed_code, compiled_code, speculation_log);
@@ -576,7 +576,19 @@
   _code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code));
   _code_size = HotSpotCompiledCode::targetCodeSize(compiled_code);
   _total_frame_size = HotSpotCompiledCode::totalFrameSize(compiled_code);
-  _custom_stack_area_offset = HotSpotCompiledCode::customStackAreaOffset(compiled_code);
+
+  oop deoptRescueSlot = HotSpotCompiledCode::deoptRescueSlot(compiled_code);
+  if (deoptRescueSlot == NULL) {
+    _orig_pc_offset = -1;
+  } else {
+    _orig_pc_offset = StackSlot::offset(deoptRescueSlot);
+    if (StackSlot::addFrameSize(deoptRescueSlot)) {
+      _orig_pc_offset += _total_frame_size;
+    }
+    if (_orig_pc_offset < 0) {
+      JVMCI_ERROR("invalid deopt rescue slot: %d", _orig_pc_offset);
+    }
+  }
 
   // Pre-calculate the constants section size.  This is required for PC-relative addressing.
   _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code));
@@ -724,6 +736,9 @@
       if (site_InfopointReason::SAFEPOINT() == reason || site_InfopointReason::CALL() == reason || site_InfopointReason::IMPLICIT_EXCEPTION() == reason) {
         TRACE_jvmci_4("safepoint at %i", pc_offset);
         site_Safepoint(buffer, pc_offset, site, CHECK_OK);
+        if (_orig_pc_offset < 0) {
+          JVMCI_ERROR_OK("method contains safepoint, but has no deopt rescue slot");
+        }
       } else {
         TRACE_jvmci_4("infopoint at %i", pc_offset);
         site_Infopoint(buffer, pc_offset, site, CHECK_OK);
--- a/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCodeInstaller.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -125,7 +125,7 @@
   jobject       _code_handle;
   jint          _code_size;
   jint          _total_frame_size;
-  jint          _custom_stack_area_offset;
+  jint          _orig_pc_offset;
   jint          _parameter_count;
   jint          _constants_size;
 #ifndef PRODUCT
--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -38,7 +38,7 @@
 
 JVMCICompiler::JVMCICompiler() : AbstractCompiler(jvmci) {
   _bootstrapping = false;
-  _methodsCompiled = 0;
+  _methods_compiled = 0;
   assert(_instance == NULL, "only one instance allowed");
   _instance = this;
 }
@@ -99,7 +99,7 @@
     } while (first_round && qsize == 0);
     first_round = false;
     if (PrintBootstrap) {
-      while (z < (_methodsCompiled / 100)) {
+      while (z < (_methods_compiled / 100)) {
         ++z;
         tty->print_raw(".");
       }
@@ -107,7 +107,7 @@
   } while (qsize != 0);
 
   if (PrintBootstrap) {
-    tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methodsCompiled);
+    tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methods_compiled);
   }
   _bootstrapping = false;
 }
@@ -176,7 +176,7 @@
           env->set_failure("no nmethod produced", true);
         } else {
           env->task()->set_num_inlined_bytecodes(CompilationRequestResult::inlinedBytecodes(result_object));
-          _methodsCompiled++;
+          Atomic::inc(&_methods_compiled);
         }
       }
     } else {
--- a/hotspot/src/share/vm/jvmci/jvmciCompiler.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciCompiler.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -33,10 +33,10 @@
   bool _bootstrapping;
 
   /**
-   * Number of methods compiled by JVMCI. This is not synchronized
-   * so may not be 100% accurate.
+   * Number of methods successfully compiled by a call to
+   * JVMCICompiler::compile_method().
    */
-  volatile int _methodsCompiled;
+  volatile int _methods_compiled;
 
   static JVMCICompiler* _instance;
 
@@ -80,8 +80,11 @@
   // Print compilation timers and statistics
   virtual void print_timers();
 
-  // Print compilation statistics
-  void reset_compilation_stats();
+  /**
+   * Gets the number of methods that have been successfully compiled by
+   * a call to JVMCICompiler::compile_method().
+   */
+  int methods_compiled() { return _methods_compiled; }
 
   // Print compilation timers and statistics
   static void print_compilation_timers();
--- a/hotspot/src/share/vm/jvmci/jvmciJavaClasses.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciJavaClasses.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -91,7 +91,7 @@
     objArrayOop_field(HotSpotCompiledCode, dataSectionPatches, "[Ljdk/vm/ci/code/site/DataPatch;")                                                             \
     boolean_field(HotSpotCompiledCode, isImmutablePIC)                                                                                                         \
     int_field(HotSpotCompiledCode, totalFrameSize)                                                                                                             \
-    int_field(HotSpotCompiledCode, customStackAreaOffset)                                                                                                      \
+    oop_field(HotSpotCompiledCode, deoptRescueSlot, "Ljdk/vm/ci/code/StackSlot;")                                                                              \
   end_class                                                                                                                                                    \
   start_class(HotSpotCompiledCode_Comment)                                                                                                                     \
     oop_field(HotSpotCompiledCode_Comment, text, "Ljava/lang/String;")                                                                                         \
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -634,6 +634,7 @@
 
 void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) {
   if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) {
+    ResourceMark rm;
 #ifdef ASSERT
     // This should only be called in the context of the JVMCI class being initialized
     TempNewSymbol name = SymbolTable::new_symbol("jdk/vm/ci/runtime/JVMCI", CHECK);
--- a/hotspot/src/share/vm/opto/addnode.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/opto/addnode.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -61,7 +61,7 @@
 
 //------------------------------commute----------------------------------------
 // Commute operands to move loads and constants to the right.
-static bool commute( Node *add, int con_left, int con_right ) {
+static bool commute(Node *add, bool con_left, bool con_right) {
   Node *in1 = add->in(1);
   Node *in2 = add->in(2);
 
@@ -110,8 +110,8 @@
 Node *AddNode::Ideal(PhaseGVN *phase, bool can_reshape) {
   const Type *t1 = phase->type( in(1) );
   const Type *t2 = phase->type( in(2) );
-  int con_left  = t1->singleton();
-  int con_right = t2->singleton();
+  bool con_left  = t1->singleton();
+  bool con_right = t2->singleton();
 
   // Check for commutative operation desired
   if( commute(this,con_left,con_right) ) return this;
--- a/hotspot/src/share/vm/opto/callGenerator.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/opto/callGenerator.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -867,17 +867,18 @@
           }
         }
         // Cast reference arguments to its type.
-        for (int i = 0; i < signature->count(); i++) {
+        for (int i = 0, j = 0; i < signature->count(); i++) {
           ciType* t = signature->type_at(i);
           if (t->is_klass()) {
-            Node* arg = kit.argument(receiver_skip + i);
+            Node* arg = kit.argument(receiver_skip + j);
             const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
             const Type*       sig_type = TypeOopPtr::make_from_klass(t->as_klass());
             if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
               Node* cast_obj = gvn.transform(new CheckCastPPNode(kit.control(), arg, sig_type));
-              kit.set_argument(receiver_skip + i, cast_obj);
+              kit.set_argument(receiver_skip + j, cast_obj);
             }
           }
+          j += t->size();  // long and double take two slots
         }
 
         // Try to get the most accurate receiver type
--- a/hotspot/src/share/vm/opto/loopTransform.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -2404,15 +2404,25 @@
   if (needs_guard) {
     // Check for an obvious zero trip guard.
     Node* inctrl = PhaseIdealLoop::skip_loop_predicates(cl->in(LoopNode::EntryControl));
-    if (inctrl->Opcode() == Op_IfTrue) {
+    if (inctrl->Opcode() == Op_IfTrue || inctrl->Opcode() == Op_IfFalse) {
+      bool maybe_swapped = (inctrl->Opcode() == Op_IfFalse);
       // The test should look like just the backedge of a CountedLoop
       Node* iff = inctrl->in(0);
       if (iff->is_If()) {
         Node* bol = iff->in(1);
-        if (bol->is_Bool() && bol->as_Bool()->_test._test == cl->loopexit()->test_trip()) {
-          Node* cmp = bol->in(1);
-          if (cmp->is_Cmp() && cmp->in(1) == cl->init_trip() && cmp->in(2) == cl->limit()) {
-            needs_guard = false;
+        if (bol->is_Bool()) {
+          BoolTest test = bol->as_Bool()->_test;
+          if (maybe_swapped) {
+            test._test = test.commute();
+            test._test = test.negate();
+          }
+          if (test._test == cl->loopexit()->test_trip()) {
+            Node* cmp = bol->in(1);
+            int init_idx = maybe_swapped ? 2 : 1;
+            int limit_idx = maybe_swapped ? 1 : 2;
+            if (cmp->is_Cmp() && cmp->in(init_idx) == cl->init_trip() && cmp->in(limit_idx) == cl->limit()) {
+              needs_guard = false;
+            }
           }
         }
       }
@@ -3048,7 +3058,7 @@
   // state of the loop.  It's safe in this case to replace it with the
   // result_mem.
   _igvn.replace_node(store->in(MemNode::Memory), result_mem);
-  _igvn.replace_node(exit, result_ctrl);
+  lazy_replace(exit, result_ctrl);
   _igvn.replace_node(store, result_mem);
   // Any uses the increment outside of the loop become the loop limit.
   _igvn.replace_node(head->incr(), head->limit());
--- a/hotspot/src/share/vm/opto/loopnode.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/opto/loopnode.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -755,8 +755,8 @@
     set_loop(iff2, get_loop(iffalse));
 
     // Lazy update of 'get_ctrl' mechanism.
-    lazy_replace_proj( iffalse, iff2 );
-    lazy_replace_proj( iftrue,  ift2 );
+    lazy_replace(iffalse, iff2);
+    lazy_replace(iftrue,  ift2);
 
     // Swap names
     iffalse = iff2;
--- a/hotspot/src/share/vm/opto/loopnode.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/opto/loopnode.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -693,13 +693,18 @@
   }
 
 private:
-  Node *get_ctrl_no_update( Node *i ) const {
+  Node *get_ctrl_no_update_helper(Node *i) const {
+    assert(has_ctrl(i), "should be control, not loop");
+    return (Node*)(((intptr_t)_nodes[i->_idx]) & ~1);
+  }
+
+  Node *get_ctrl_no_update(Node *i) const {
     assert( has_ctrl(i), "" );
-    Node *n = (Node*)(((intptr_t)_nodes[i->_idx]) & ~1);
+    Node *n = get_ctrl_no_update_helper(i);
     if (!n->in(0)) {
       // Skip dead CFG nodes
       do {
-        n = (Node*)(((intptr_t)_nodes[n->_idx]) & ~1);
+        n = get_ctrl_no_update_helper(n);
       } while (!n->in(0));
       n = find_non_split_ctrl(n);
     }
@@ -721,22 +726,15 @@
   // from old_node to new_node to support the lazy update.  Reference
   // replaces loop reference, since that is not needed for dead node.
 public:
-  void lazy_update( Node *old_node, Node *new_node ) {
-    assert( old_node != new_node, "no cycles please" );
-    //old_node->set_req( 1, new_node /*NO DU INFO*/ );
-    // Nodes always have DU info now, so re-use the side array slot
-    // for this node to provide the forwarding pointer.
-    _nodes.map( old_node->_idx, (Node*)((intptr_t)new_node + 1) );
+  void lazy_update(Node *old_node, Node *new_node) {
+    assert(old_node != new_node, "no cycles please");
+    // Re-use the side array slot for this node to provide the
+    // forwarding pointer.
+    _nodes.map(old_node->_idx, (Node*)((intptr_t)new_node + 1));
   }
-  void lazy_replace( Node *old_node, Node *new_node ) {
-    _igvn.replace_node( old_node, new_node );
-    lazy_update( old_node, new_node );
-  }
-  void lazy_replace_proj( Node *old_node, Node *new_node ) {
-    assert( old_node->req() == 1, "use this for Projs" );
-    _igvn.hash_delete(old_node); // Must hash-delete before hacking edges
-    old_node->add_req( NULL );
-    lazy_replace( old_node, new_node );
+  void lazy_replace(Node *old_node, Node *new_node) {
+    _igvn.replace_node(old_node, new_node);
+    lazy_update(old_node, new_node);
   }
 
 private:
--- a/hotspot/src/share/vm/opto/macro.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/opto/macro.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -2654,9 +2654,9 @@
   eliminate_macro_nodes();
 
   // Make sure expansion will not cause node limit to be exceeded.
-  // Worst case is a macro node gets expanded into about 50 nodes.
+  // Worst case is a macro node gets expanded into about 200 nodes.
   // Allow 50% more for optimization.
-  if (C->check_node_count(C->macro_count() * 75, "out of nodes before macro expansion" ) )
+  if (C->check_node_count(C->macro_count() * 300, "out of nodes before macro expansion" ) )
     return true;
 
   // Eliminate Opaque and LoopLimit nodes. Do it after all loop optimizations.
--- a/hotspot/src/share/vm/opto/split_if.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/opto/split_if.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -472,7 +472,7 @@
 
     // Replace in the graph with lazy-update mechanism
     new_iff->set_req(0, new_iff); // hook self so it does not go dead
-    lazy_replace_proj( ifp, ifpx );
+    lazy_replace(ifp, ifpx);
     new_iff->set_req(0, region);
 
     // Record bits for later xforms
--- a/hotspot/src/share/vm/opto/subnode.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/opto/subnode.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -1334,6 +1334,65 @@
     return new BoolNode( ncmp, _test.negate() );
   }
 
+  // Change ((x & m) u<= m) or ((m & x) u<= m) to always true
+  // Same with ((x & m) u< m+1) and ((m & x) u< m+1)
+  if (cop == Op_CmpU &&
+      cmp1->Opcode() == Op_AndI) {
+    Node* bound = NULL;
+    if (_test._test == BoolTest::le) {
+      bound = cmp2;
+    } else if (_test._test == BoolTest::lt &&
+               cmp2->Opcode() == Op_AddI &&
+               cmp2->in(2)->find_int_con(0) == 1) {
+      bound = cmp2->in(1);
+    }
+    if (cmp1->in(2) == bound || cmp1->in(1) == bound) {
+      return ConINode::make(1);
+    }
+  }
+
+  // Change ((x & (m - 1)) u< m) into (m > 0)
+  // This is the off-by-one variant of the above
+  if (cop == Op_CmpU &&
+      _test._test == BoolTest::lt &&
+      cmp1->Opcode() == Op_AndI) {
+    Node* l = cmp1->in(1);
+    Node* r = cmp1->in(2);
+    for (int repeat = 0; repeat < 2; repeat++) {
+      bool match = r->Opcode() == Op_AddI && r->in(2)->find_int_con(0) == -1 &&
+                   r->in(1) == cmp2;
+      if (match) {
+        // arraylength known to be non-negative, so a (arraylength != 0) is sufficient,
+        // but to be compatible with the array range check pattern, use (arraylength u> 0)
+        Node* ncmp = cmp2->Opcode() == Op_LoadRange
+                     ? phase->transform(new CmpUNode(cmp2, phase->intcon(0)))
+                     : phase->transform(new CmpINode(cmp2, phase->intcon(0)));
+        return new BoolNode(ncmp, BoolTest::gt);
+      } else {
+        // commute and try again
+        l = cmp1->in(2);
+        r = cmp1->in(1);
+      }
+    }
+  }
+
+  // Change (arraylength <= 0) or (arraylength == 0)
+  //   into (arraylength u<= 0)
+  // Also change (arraylength != 0) into (arraylength u> 0)
+  // The latter version matches the code pattern generated for
+  // array range checks, which will more likely be optimized later.
+  if (cop == Op_CmpI &&
+      cmp1->Opcode() == Op_LoadRange &&
+      cmp2->find_int_con(-1) == 0) {
+    if (_test._test == BoolTest::le || _test._test == BoolTest::eq) {
+      Node* ncmp = phase->transform(new CmpUNode(cmp1, cmp2));
+      return new BoolNode(ncmp, BoolTest::le);
+    } else if (_test._test == BoolTest::ne) {
+      Node* ncmp = phase->transform(new CmpUNode(cmp1, cmp2));
+      return new BoolNode(ncmp, BoolTest::gt);
+    }
+  }
+
   // Change "bool eq/ne (cmp (Conv2B X) 0)" into "bool eq/ne (cmp X 0)".
   // This is a standard idiom for branching on a boolean value.
   Node *c2b = cmp1;
@@ -1496,4 +1555,3 @@
   double d = t1->getd();
   return TypeD::make( StubRoutines::intrinsic_log10( d ) );
 }
-
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsCompiler.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -118,27 +118,46 @@
 }
 
 Flag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) {
-  if (value < 1 || value > max_jint) {
+  intx max_value = 512;
+  if (value < 1 || value > max_value) {
     CommandLineError::print(verbose,
                             "AllocatePrefetchStepSize (" INTX_FORMAT ") "
                             "must be between 1 and %d\n",
                             AllocatePrefetchStepSize,
-                            max_jint);
+                            max_value);
     return Flag::VIOLATES_CONSTRAINT;
   }
 
   if (AllocatePrefetchDistance % AllocatePrefetchStepSize != 0) {
-     CommandLineError::print(verbose,
-                             "AllocatePrefetchDistance (" INTX_FORMAT ") "
-                             "%% AllocatePrefetchStepSize (" INTX_FORMAT ") "
-                             "= " INTX_FORMAT " "
-                             "must be 0\n",
-                             AllocatePrefetchDistance, AllocatePrefetchStepSize,
-                             AllocatePrefetchDistance % AllocatePrefetchStepSize);
-     return Flag::VIOLATES_CONSTRAINT;
-   }
+    CommandLineError::print(verbose,
+                            "AllocatePrefetchDistance (" INTX_FORMAT ") "
+                            "%% AllocatePrefetchStepSize (" INTX_FORMAT ") "
+                            "= " INTX_FORMAT " "
+                            "must be 0\n",
+                            AllocatePrefetchDistance, AllocatePrefetchStepSize,
+                            AllocatePrefetchDistance % AllocatePrefetchStepSize);
+    return Flag::VIOLATES_CONSTRAINT;
+  }
 
-   return Flag::SUCCESS;
+  /* The limit of 64 for the quotient of AllocatePrefetchDistance and AllocatePrefetchSize
+   * originates from the limit of 64 for AllocatePrefetchLines/AllocateInstancePrefetchLines.
+   * If AllocatePrefetchStyle == 2, the quotient from above is used in PhaseMacroExpand::prefetch_allocation()
+   * to determine the number of lines to prefetch. For other values of AllocatePrefetchStyle,
+   * AllocatePrefetchDistance and AllocatePrefetchSize is used. For consistency, all these
+   * quantities must have the same limit (64 in this case).
+   */
+  if (AllocatePrefetchDistance / AllocatePrefetchStepSize > 64) {
+    CommandLineError::print(verbose,
+                            "AllocatePrefetchDistance (" INTX_FORMAT ") too large or "
+                            "AllocatePrefetchStepSize (" INTX_FORMAT ") too small; "
+                            "try decreasing/increasing values so that "
+                            "AllocatePrefetchDistance / AllocatePrefetchStepSize <= 64\n",
+                            AllocatePrefetchDistance, AllocatePrefetchStepSize,
+                            AllocatePrefetchDistance % AllocatePrefetchStepSize);
+    return Flag::VIOLATES_CONSTRAINT;
+  }
+
+  return Flag::SUCCESS;
 }
 
 Flag::Error CompileThresholdConstraintFunc(intx value, bool verbose) {
--- a/hotspot/src/share/vm/runtime/globals.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -2965,16 +2965,16 @@
                                                                             \
   product(intx,  AllocatePrefetchLines, 3,                                  \
           "Number of lines to prefetch ahead of array allocation pointer")  \
-          range(1, max_jint / 2)                                            \
+          range(1, 64)                                                      \
                                                                             \
   product(intx,  AllocateInstancePrefetchLines, 1,                          \
           "Number of lines to prefetch ahead of instance allocation "       \
           "pointer")                                                        \
-          range(1, max_jint / 2)                                            \
+          range(1, 64)                                                      \
                                                                             \
   product(intx,  AllocatePrefetchStepSize, 16,                              \
           "Step size in bytes of sequential prefetch instructions")         \
-          range(1, max_jint)                                                \
+          range(1, 512)                                                     \
           constraint(AllocatePrefetchStepSizeConstraintFunc,AfterMemoryInit)\
                                                                             \
   product(intx,  AllocatePrefetchInstr, 0,                                  \
--- a/hotspot/src/share/vm/runtime/thread.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -31,6 +31,7 @@
 #include "code/codeCacheExtensions.hpp"
 #include "code/scopeDesc.hpp"
 #include "compiler/compileBroker.hpp"
+#include "compiler/compileTask.hpp"
 #include "gc/shared/gcId.hpp"
 #include "gc/shared/gcLocker.inline.hpp"
 #include "gc/shared/workgroup.hpp"
@@ -2884,6 +2885,20 @@
   print_thread_state_on(st);
   _safepoint_state->print_on(st);
 #endif // PRODUCT
+  if (is_Compiler_thread()) {
+    CompilerThread* ct = (CompilerThread*)this;
+    if (ct->task() != NULL) {
+      st->print("   Compiling: ");
+      ct->task()->print(st, NULL, true, false);
+    } else {
+      st->print("   No compile task");
+    }
+    st->cr();
+  }
+}
+
+void JavaThread::print_name_on_error(outputStream* st, char *buf, int buflen) const {
+  st->print("%s", get_thread_name_string(buf, buflen));
 }
 
 // Called by fatal error handler. The difference between this and
@@ -4386,7 +4401,6 @@
     wt->print_on(st);
     st->cr();
   }
-  CompileBroker::print_compiler_threads_on(st);
   st->flush();
 }
 
@@ -4439,8 +4453,24 @@
     current->print_on_error(st, buf, buflen);
     st->cr();
   }
+  st->cr();
+  st->print_cr("Threads with active compile tasks:");
+  print_threads_compiling(st, buf, buflen);
 }
 
+void Threads::print_threads_compiling(outputStream* st, char* buf, int buflen) {
+  ALL_JAVA_THREADS(thread) {
+    if (thread->is_Compiler_thread()) {
+      CompilerThread* ct = (CompilerThread*) thread;
+      if (ct->task() != NULL) {
+        thread->print_name_on_error(st, buf, buflen);
+        ct->task()->print(st, NULL, true, true);
+      }
+    }
+  }
+}
+
+
 // Internal SpinLock and Mutex
 // Based on ParkEvent
 
--- a/hotspot/src/share/vm/runtime/thread.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/runtime/thread.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -1660,6 +1660,7 @@
   void print_thread_state_on(outputStream*) const      PRODUCT_RETURN;
   void print_thread_state() const                      PRODUCT_RETURN;
   void print_on_error(outputStream* st, char* buf, int buflen) const;
+  void print_name_on_error(outputStream* st, char* buf, int buflen) const;
   void verify();
   const char* get_thread_name() const;
  private:
@@ -2158,6 +2159,7 @@
     print_on(tty, print_stacks, internal_format, false /* no concurrent lock printed */);
   }
   static void print_on_error(outputStream* st, Thread* current, char* buf, int buflen);
+  static void print_threads_compiling(outputStream* st, char* buf, int buflen);
 
   // Get Java threads that are waiting to enter a monitor. If doLock
   // is true, then Threads_lock is grabbed as needed. Otherwise, the
--- a/hotspot/src/share/vm/runtime/vm_operations.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/runtime/vm_operations.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -485,18 +485,6 @@
   }
 }
 
-void VM_PrintCompileQueue::doit() {
-  CompileBroker::print_compile_queues(_out);
-}
-
-void VM_PrintCodeList::doit() {
-  CodeCache::print_codelist(_out);
-}
-
-void VM_PrintCodeCache::doit() {
-  CodeCache::print_layout(_out);
-}
-
 #if INCLUDE_SERVICES
 void VM_PrintClassHierarchy::doit() {
   KlassHierarchy::print_class_hierarchy(_out, _print_interfaces, _print_subclasses, _classname);
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp	Thu Feb 11 21:07:38 2016 +0100
@@ -105,9 +105,6 @@
   template(DumpHashtable)                         \
   template(DumpTouchedMethods)                    \
   template(MarkActiveNMethods)                    \
-  template(PrintCompileQueue)                     \
-  template(PrintCodeList)                         \
-  template(PrintCodeCache)                        \
   template(PrintClassHierarchy)                   \
 
 class VM_Operation: public CHeapObj<mtInternal> {
@@ -424,37 +421,6 @@
   void doit();
 };
 
-class VM_PrintCompileQueue: public VM_Operation {
- private:
-  outputStream* _out;
-
- public:
-  VM_PrintCompileQueue(outputStream* st) : _out(st) {}
-  VMOp_Type type() const { return VMOp_PrintCompileQueue; }
-  Mode evaluation_mode() const { return _no_safepoint; }
-  void doit();
-};
-
-class VM_PrintCodeList: public VM_Operation {
- private:
-  outputStream* _out;
-
- public:
-  VM_PrintCodeList(outputStream* st) : _out(st) {}
-  VMOp_Type type() const { return VMOp_PrintCodeList; }
-  void doit();
-};
-
-class VM_PrintCodeCache: public VM_Operation {
- private:
-  outputStream* _out;
-
- public:
-  VM_PrintCodeCache(outputStream* st) : _out(st) {}
-  VMOp_Type type() const { return VMOp_PrintCodeCache; }
-  void doit();
-};
-
 #if INCLUDE_SERVICES
 class VM_PrintClassHierarchy: public VM_Operation {
  private:
--- a/hotspot/src/share/vm/services/diagnosticCommand.cpp	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp	Thu Feb 11 21:07:38 2016 +0100
@@ -832,18 +832,15 @@
 }
 
 void CompileQueueDCmd::execute(DCmdSource source, TRAPS) {
-  VM_PrintCompileQueue printCompileQueueOp(output());
-  VMThread::execute(&printCompileQueueOp);
+  CompileBroker::print_compile_queues(output());
 }
 
 void CodeListDCmd::execute(DCmdSource source, TRAPS) {
-  VM_PrintCodeList printCodeListOp(output());
-  VMThread::execute(&printCodeListOp);
+  CodeCache::print_codelist(output());
 }
 
 void CodeCacheDCmd::execute(DCmdSource source, TRAPS) {
-  VM_PrintCodeCache printCodeCacheOp(output());
-  VMThread::execute(&printCodeCacheOp);
+  CodeCache::print_layout(output());
 }
 
 void CompilerDirectivesPrintDCmd::execute(DCmdSource source, TRAPS) {
--- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityBase.java	Thu Feb 11 21:07:38 2016 +0100
@@ -24,7 +24,7 @@
 /*
  * @test TestCompilerDirectivesCompatibilityBase
  * @bug 8137167
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.compiler
  *          java.management
--- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOff.java	Thu Feb 11 21:07:38 2016 +0100
@@ -24,7 +24,7 @@
 /*
  * @test TestCompilerDirectivesCompatibilityCommandOff
  * @bug 8137167
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.compiler
  *          java.management
--- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityCommandOn.java	Thu Feb 11 21:07:38 2016 +0100
@@ -24,7 +24,7 @@
 /*
  * @test TestCompilerDirectivesCompatibilityCommandOn
  * @bug 8137167
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.compiler
  *          java.management
--- a/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/TestCompilerDirectivesCompatibilityFlag.java	Thu Feb 11 21:07:38 2016 +0100
@@ -24,7 +24,7 @@
 /*
  * @test TestCompilerDirectivesCompatibilityFlag
  * @bug 8137167
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @modules java.base/sun.misc
  *          java.compiler
  *          java.management
--- a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests CompileCommand=compileonly
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.commandfile.CompileOnlyTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests CompileCommand=exclude
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.commandfile.ExcludeTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests CompileCommand=log
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.commandfile.LogTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,8 @@
  * @test
  * @bug 8137167
  * @summary Tests CompileCommand=print
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @ignore 8140354
  * @build compiler.compilercontrol.commandfile.PrintTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests CompileCommand=compileonly
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.commands.CompileOnlyTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests CompileCommand=exclude
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.commands.ExcludeTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/commands/LogTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/commands/LogTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests CompileCommand=log
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.commands.LogTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,8 @@
  * @test
  * @bug 8137167
  * @summary Tests CompileCommand=print
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @ignore 8140354
  * @build compiler.compilercontrol.commands.PrintTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests directives to be able to compile only specified  methods
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.directives.CompileOnlyTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests directives to be able to exclude methods from compilation
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.directives.ExcludeTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/directives/LogTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/directives/LogTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests directives to be able to turn on LogCompilation
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.directives.LogTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,8 @@
  * @test
  * @bug 8137167
  * @summary Tests directives to be able to turn on print_assembly
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @ignore 8140354
  * @build compiler.compilercontrol.directives.PrintTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests directives to be able to add and remove directives
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.jcmd.AddAndRemoveTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to compile only specified methods
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.jcmd.AddCompileOnlyTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to exclude only specified methods
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.jcmd.AddExcludeTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to log only specified methods
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.jcmd.AddLogTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -26,7 +26,7 @@
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to print assembly
  *          only for specified methods
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.jcmd.AddPrintAssemblyTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -26,6 +26,7 @@
  * @bug 8137167
  * @summary Tests jcmd to be able to add a directive to compile only specified methods
  * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @ignore 8140354
  * @build compiler.compilercontrol.jcmd.PrintDirectivesTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -27,6 +27,7 @@
  * @summary Tests jcmd to be able to add a lot of huge directive files with
  *          parallel executed jcmds until timeout has reached
  * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @ignore 8148563
  * @build compiler.compilercontrol.jcmd.StressAddMultiThreadedTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,7 @@
  * @test
  * @bug 8137167
  * @summary Randomly generates commands with random types
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
  * @build compiler.compilercontrol.mixed.RandomCommandsTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -25,7 +25,8 @@
  * @test
  * @bug 8137167
  * @summary Randomly generates valid commands with random types
- * @library /testlibrary /../../test/lib /compiler/testlibrary ../share /
+ * @library /testlibrary /test/lib /compiler/testlibrary ../share /
+ * @ignore 8140354
  * @build compiler.compilercontrol.mixed.RandomValidCommandsTest
  *        pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
  *        compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
--- a/hotspot/test/compiler/compilercontrol/share/scenario/Command.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/Command.java	Thu Feb 11 21:07:38 2016 +0100
@@ -32,8 +32,8 @@
 public enum Command {
     COMPILEONLY("compileonly", ".*", "-Xbatch"),
     EXCLUDE("exclude", "", "-Xbatch"),
-    INLINE("inline", ".*"),
-    DONTINLINE("dontinline", ""),
+    INLINE("inline", ".*", "-Xbatch"),
+    DONTINLINE("dontinline", "", "-Xbatch"),
     LOG("log", "", "-XX:+UnlockDiagnosticVMOptions",
             "-XX:+LogCompilation", "-XX:LogFile=" + LogProcessor.LOG_FILE),
     PRINT("print", ""),
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java	Thu Feb 11 21:07:38 2016 +0100
@@ -27,7 +27,7 @@
 
 /*
  * @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /test/lib /compiler/whitebox
  *          /compiler/testlibrary /compiler/codegen/7184394
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java	Thu Feb 11 21:07:38 2016 +0100
@@ -28,7 +28,7 @@
 
 /*
  * @test
- * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @library /testlibrary /test/lib /compiler/whitebox
  *          /compiler/testlibrary /compiler/codegen/7184394
  * @modules java.base/sun.misc
  *          java.management
--- a/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/intrinsics/IntrinsicDisabledTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8138651
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @build IntrinsicDisabledTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/intrinsics/montgomerymultiply/MontgomeryMultiplyTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -42,7 +42,7 @@
  * @test
  * @bug 8130150 8131779 8139907
  * @summary Verify that the Montgomery multiply and square intrinsic works and correctly checks their arguments.
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @library /testlibrary
  * @build MontgomeryMultiplyTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/intrinsics/string/TestStringIntrinsics2.java	Thu Feb 11 21:07:38 2016 +0100
@@ -26,7 +26,7 @@
  * @test
  * @bug 8145336
  * @summary PPC64: fix string intrinsics after CompactStrings change
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @build sun.hotspot.WhiteBox
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/jsr292/LongReferenceCastingTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+import java.lang.invoke.*;
+
+/**
+ * @test
+ * @bug 8148752
+ * @summary Test correct casting of MH arguments during inlining.
+ * @run main LongReferenceCastingTest
+ */
+public class LongReferenceCastingTest {
+    static final String MY_STRING = "myString";
+    static final MethodHandle MH;
+
+    static {
+        try {
+            MethodHandles.Lookup lookup = MethodHandles.lookup();
+            MethodType mt = MethodType.methodType(String.class, long.class, Object.class, String.class);
+            MH = lookup.findVirtual(LongReferenceCastingTest.class, "myMethod", mt);
+        } catch (Exception e) {
+            throw new Error(e);
+        }
+    }
+
+    public String myMethod(long l, Object o, String s) {
+        // The long argument occupies two stack slots, causing C2 to treat it as
+        // two arguments and casting the fist one two long and the second one to Object.
+        // As a result, Object o is casted to String and the o.toString() call is
+        // inlined as String::toString(). We fail at runtime because 'o' is not a String.
+        return o.toString();
+    }
+
+    public String toString() {
+        return MY_STRING;
+    }
+
+    public static void main(String[] args) throws Exception {
+        LongReferenceCastingTest test = new LongReferenceCastingTest();
+        try {
+            for (int i = 0; i < 20_000; ++i) {
+                if (!test.invoke().equals(MY_STRING)) {
+                    throw new RuntimeException("Invalid string");
+                }
+            }
+        } catch (Throwable t) {
+            throw new RuntimeException("Test failed", t);
+        }
+    }
+
+    public String invoke() throws Throwable {
+        return (String) MH.invokeExact(this, 0L, (Object)this, MY_STRING);
+    }
+}
--- a/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/JVM_GetJVMCIRuntimeTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -35,6 +35,16 @@
  *      -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=false
  *      -XX:-EnableJVMCI
  *      compiler.jvmci.JVM_GetJVMCIRuntimeTest
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions
+ *      -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=true
+ *      -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.threaded=true
+ *      -XX:+EnableJVMCI
+ *      compiler.jvmci.JVM_GetJVMCIRuntimeTest
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions
+ *      -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.positive=false
+ *      -Dcompiler.jvmci.JVM_GetJVMCIRuntimeTest.threaded=true
+ *      -XX:-EnableJVMCI
+ *      compiler.jvmci.JVM_GetJVMCIRuntimeTest
 
  */
 
@@ -43,22 +53,27 @@
 import jdk.vm.ci.runtime.JVMCI;
 import jdk.test.lib.Asserts;
 
-import java.lang.reflect.Method;
-
-public class JVM_GetJVMCIRuntimeTest {
+public class JVM_GetJVMCIRuntimeTest implements Runnable {
     private static final boolean IS_POSITIVE = Boolean.getBoolean(
             "compiler.jvmci.JVM_GetJVMCIRuntimeTest.positive");
-
-    private final Method initializeRuntime;
+    private static final boolean IN_THREAD = Boolean.getBoolean(
+            "compiler.jvmci.JVM_GetJVMCIRuntimeTest.threaded");
 
-    public static void main(String[] args) {
-        new JVM_GetJVMCIRuntimeTest().runTest();
+    public static void main(String[] args) throws Throwable {
+        JVM_GetJVMCIRuntimeTest instance = new JVM_GetJVMCIRuntimeTest();
+        if (IN_THREAD) {
+            Thread t = new Thread(instance);
+            t.start();
+            t.join();
+        } else {
+            instance.run();
+        }
     }
 
-    private void runTest() {
+    public void run() {
         Object result;
         try {
-            result = invoke();
+            result = JVMCI.getRuntime();
         } catch (InternalError e) {
             if (IS_POSITIVE) {
                 throw new AssertionError("unexpected exception", e);
@@ -70,28 +85,8 @@
         }
         Asserts.assertNotNull(result,
                 "initializeRuntime returned null");
-        Asserts.assertEQ(result, invoke(),
+        Asserts.assertEQ(result, JVMCI.getRuntime(),
                 "initializeRuntime returns different results");
 
     }
-    private Object invoke() {
-        Object result;
-        try {
-            result = initializeRuntime.invoke(JVMCI.class);
-        } catch (ReflectiveOperationException e) {
-            throw new Error("can't invoke initializeRuntime", e);
-        }
-        return result;
-    }
-
-    private JVM_GetJVMCIRuntimeTest() {
-        Method method;
-        try {
-            method = JVMCI.class.getDeclaredMethod("initializeRuntime");
-            method.setAccessible(true);
-        } catch (NoSuchMethodException e) {
-            throw new Error("can't find JVMCI::initializeRuntime", e);
-        }
-        initializeRuntime = method;
-    }
 }
--- a/hotspot/test/compiler/jvmci/code/CodeInstallationTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/code/CodeInstallationTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -92,6 +92,7 @@
 
         asm.emitPrologue();
         compiler.compile(asm);
+        asm.emitEpilogue();
 
         HotSpotCompiledCode code = asm.finish(resolvedMethod);
         InstalledCode installed = codeCache.addCode(resolvedMethod, code, null, null);
--- a/hotspot/test/compiler/jvmci/code/TestAssembler.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/code/TestAssembler.java	Thu Feb 11 21:07:38 2016 +0100
@@ -32,11 +32,13 @@
 import jdk.vm.ci.code.DebugInfo;
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.StackSlot;
+import jdk.vm.ci.code.site.Call;
 import jdk.vm.ci.code.site.ConstantReference;
 import jdk.vm.ci.code.site.DataPatch;
 import jdk.vm.ci.code.site.DataSectionReference;
 import jdk.vm.ci.code.site.Infopoint;
 import jdk.vm.ci.code.site.InfopointReason;
+import jdk.vm.ci.code.site.Mark;
 import jdk.vm.ci.code.site.Reference;
 import jdk.vm.ci.code.site.Site;
 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
@@ -45,6 +47,7 @@
 import jdk.vm.ci.hotspot.HotSpotConstant;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
 import jdk.vm.ci.meta.Assumptions.Assumption;
+import jdk.vm.ci.meta.InvokeTarget;
 import jdk.vm.ci.meta.LIRKind;
 import jdk.vm.ci.meta.PlatformKind;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
@@ -61,6 +64,11 @@
     public abstract void emitPrologue();
 
     /**
+     * Emit the method epilogue code (e.g. the deopt handler).
+     */
+    public abstract void emitEpilogue();
+
+    /**
      * Emit code to grow the stack frame.
      *
      * @param size the size in bytes that the stack should grow
@@ -181,6 +189,8 @@
     private int stackAlignment;
     private int curStackSlot;
 
+    private StackSlot deoptRescue;
+
     protected TestAssembler(CodeCacheProvider codeCache, int initialFrameSize, int stackAlignment, PlatformKind narrowOopKind, Register... registers) {
         this.narrowOopKind = LIRKind.reference(narrowOopKind);
 
@@ -216,6 +226,18 @@
         return StackSlot.get(kind, -curStackSlot, true);
     }
 
+    protected void setDeoptRescueSlot(StackSlot deoptRescue) {
+        this.deoptRescue = deoptRescue;
+    }
+
+    protected void recordCall(InvokeTarget target, int size, boolean direct, DebugInfo debugInfo) {
+        sites.add(new Call(target, code.position(), size, direct, debugInfo));
+    }
+
+    protected void recordMark(Object id) {
+        sites.add(new Mark(code.position(), id));
+    }
+
     protected void recordImplicitException(DebugInfo info) {
         sites.add(new Infopoint(code.position(), info, InfopointReason.IMPLICIT_EXCEPTION));
     }
@@ -249,7 +271,7 @@
         byte[] finishedData = data.finish();
         DataPatch[] finishedDataPatches = dataPatches.toArray(new DataPatch[0]);
         return new HotSpotCompiledNmethod(method.getName(), finishedCode, finishedCode.length, finishedSites, new Assumption[0], new ResolvedJavaMethod[]{method}, new Comment[0], finishedData, 16,
-                        finishedDataPatches, false, frameSize, 0, method, 0, id, 0L, false);
+                        finishedDataPatches, false, frameSize, deoptRescue, method, 0, id, 0L, false);
     }
 
     protected static class Buffer {
--- a/hotspot/test/compiler/jvmci/code/amd64/AMD64TestAssembler.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/code/amd64/AMD64TestAssembler.java	Thu Feb 11 21:07:38 2016 +0100
@@ -33,6 +33,8 @@
 import jdk.vm.ci.code.site.DataSectionReference;
 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
 import jdk.vm.ci.hotspot.HotSpotConstant;
+import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
+import jdk.vm.ci.hotspot.HotSpotVMConfig;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.LIRKind;
 import jdk.vm.ci.meta.VMConstant;
@@ -63,6 +65,16 @@
         emitFatNop();
         code.emitByte(0x50 | AMD64.rbp.encoding);  // PUSH rbp
         emitMove(true, AMD64.rbp, AMD64.rsp);      // MOV rbp, rsp
+        setDeoptRescueSlot(newStackSlot(LIRKind.value(AMD64Kind.QWORD)));
+    }
+
+    @Override
+    public void emitEpilogue() {
+        HotSpotVMConfig config = HotSpotVMConfig.config();
+        recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
+        recordCall(new HotSpotForeignCallTarget(config.handleDeoptStub), 5, true, null);
+        code.emitByte(0xE8); // CALL rel32
+        code.emitInt(0xDEADDEAD);
     }
 
     @Override
--- a/hotspot/test/compiler/jvmci/code/sparc/SPARCTestAssembler.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/code/sparc/SPARCTestAssembler.java	Thu Feb 11 21:07:38 2016 +0100
@@ -32,7 +32,9 @@
 import jdk.vm.ci.hotspot.HotSpotCallingConventionType;
 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
 import jdk.vm.ci.hotspot.HotSpotConstant;
+import jdk.vm.ci.hotspot.HotSpotForeignCallTarget;
 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
+import jdk.vm.ci.hotspot.HotSpotVMConfig;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.LIRKind;
 import jdk.vm.ci.meta.VMConstant;
@@ -68,6 +70,15 @@
     @Override
     public void emitPrologue() {
         emitOp3(0b10, SPARC.sp, 0b111100, SPARC.sp, -SPARC.REGISTER_SAFE_AREA_SIZE); // SAVE sp, -128, sp
+        setDeoptRescueSlot(newStackSlot(LIRKind.value(SPARCKind.XWORD)));
+    }
+
+    @Override
+    public void emitEpilogue() {
+        HotSpotVMConfig config = HotSpotVMConfig.config();
+        recordMark(config.MARKID_DEOPT_HANDLER_ENTRY);
+        recordCall(new HotSpotForeignCallTarget(config.handleDeoptStub), 4, true, null);
+        code.emitInt(1 << 30); // CALL
     }
 
     @Override
--- a/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/errors/CodeInstallerTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -28,6 +28,7 @@
 import jdk.vm.ci.code.Architecture;
 import jdk.vm.ci.code.CodeCacheProvider;
 import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.code.site.DataPatch;
 import jdk.vm.ci.code.site.Site;
 import jdk.vm.ci.hotspot.HotSpotCompiledCode;
@@ -71,9 +72,9 @@
         dummyMethod = metaAccess.lookupJavaMethod(method);
     }
 
-    protected void installEmptyCode(Site[] sites, Assumption[] assumptions, Comment[] comments, int dataSectionAlignment, DataPatch[] dataSectionPatches) {
+    protected void installEmptyCode(Site[] sites, Assumption[] assumptions, Comment[] comments, int dataSectionAlignment, DataPatch[] dataSectionPatches, StackSlot deoptRescueSlot) {
         HotSpotCompiledCode code = new HotSpotCompiledCode("dummyMethod", new byte[0], 0, sites, assumptions, new ResolvedJavaMethod[]{dummyMethod}, comments, new byte[8], dataSectionAlignment,
-                        dataSectionPatches, false, 0, 0);
+                        dataSectionPatches, false, 0, deoptRescueSlot);
         codeCache.addCode(dummyMethod, code, null, null);
     }
 
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidCompilationResult.java	Thu Feb 11 21:07:38 2016 +0100
@@ -30,6 +30,7 @@
 
 package compiler.jvmci.errors;
 
+import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.code.site.ConstantReference;
 import jdk.vm.ci.code.site.DataPatch;
 import jdk.vm.ci.code.site.DataSectionReference;
@@ -80,104 +81,111 @@
 
     @Test(expected = JVMCIError.class)
     public void testInvalidAssumption() {
-        installEmptyCode(new Site[0], new Assumption[]{new InvalidAssumption()}, new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[0], new Assumption[]{new InvalidAssumption()}, new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInvalidAlignment() {
-        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 7, new DataPatch[0]);
+        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 7, new DataPatch[0], null);
     }
 
     @Test(expected = NullPointerException.class)
     public void testNullDataPatchInDataSection() {
-        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{null});
+        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{null}, null);
     }
 
     @Test(expected = NullPointerException.class)
     public void testNullReferenceInDataSection() {
-        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, null)});
+        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, null)}, null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInvalidDataSectionReference() {
         DataSectionReference ref = new DataSectionReference();
         ref.setOffset(0);
-        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)});
+        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)}, null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInvalidNarrowMethodInDataSection() {
         HotSpotConstant c = (HotSpotConstant) dummyMethod.getEncoding();
         ConstantReference ref = new ConstantReference((VMConstant) c.compress());
-        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)});
+        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)}, null);
     }
 
     @Test(expected = NullPointerException.class)
     public void testNullConstantInDataSection() {
         ConstantReference ref = new ConstantReference(null);
-        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)});
+        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)}, null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInvalidConstantInDataSection() {
         ConstantReference ref = new ConstantReference(new InvalidVMConstant());
-        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)});
+        installEmptyCode(new Site[0], new Assumption[0], new Comment[0], 16, new DataPatch[]{new DataPatch(0, ref)}, null);
     }
 
     @Test(expected = NullPointerException.class)
     public void testNullReferenceInCode() {
-        installEmptyCode(new Site[]{new DataPatch(0, null)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new DataPatch(0, null)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = NullPointerException.class)
     public void testNullConstantInCode() {
         ConstantReference ref = new ConstantReference(null);
-        installEmptyCode(new Site[]{new DataPatch(0, ref)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new DataPatch(0, ref)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInvalidConstantInCode() {
         ConstantReference ref = new ConstantReference(new InvalidVMConstant());
-        installEmptyCode(new Site[]{new DataPatch(0, ref)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new DataPatch(0, ref)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInvalidReference() {
         InvalidReference ref = new InvalidReference();
-        installEmptyCode(new Site[]{new DataPatch(0, ref)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new DataPatch(0, ref)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testOutOfBoundsDataSectionReference() {
         DataSectionReference ref = new DataSectionReference();
         ref.setOffset(0x1000);
-        installEmptyCode(new Site[]{new DataPatch(0, ref)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new DataPatch(0, ref)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInvalidMark() {
-        installEmptyCode(new Site[]{new Mark(0, new Object())}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new Mark(0, new Object())}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInvalidMarkInt() {
-        installEmptyCode(new Site[]{new Mark(0, -1)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new Mark(0, -1)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = NullPointerException.class)
     public void testNullSite() {
-        installEmptyCode(new Site[]{null}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{null}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testInfopointMissingDebugInfo() {
         Infopoint info = new Infopoint(0, null, InfopointReason.METHOD_START);
-        installEmptyCode(new Site[]{info}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{info}, new Assumption[0], new Comment[0], 16, new DataPatch[0], null);
     }
 
     @Test(expected = JVMCIError.class)
     public void testSafepointMissingDebugInfo() {
         Infopoint info = new Infopoint(0, null, InfopointReason.SAFEPOINT);
-        installEmptyCode(new Site[]{info}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        StackSlot deoptRescueSlot = StackSlot.get(null, 0, true);
+        installEmptyCode(new Site[]{info}, new Assumption[0], new Comment[0], 16, new DataPatch[0], deoptRescueSlot);
+    }
+
+    @Test(expected = JVMCIError.class)
+    public void testInvalidDeoptRescueSlot() {
+        StackSlot deoptRescueSlot = StackSlot.get(null, -1, false);
+        installEmptyCode(new Site[]{}, new Assumption[0], new Comment[0], 16, new DataPatch[0], deoptRescueSlot);
     }
 }
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidDebugInfo.java	Thu Feb 11 21:07:38 2016 +0100
@@ -66,10 +66,14 @@
     }
 
     private void test(VirtualObject[] vobj, JavaValue[] values, JavaKind[] slotKinds, int locals, int stack, int locks) {
+        test(vobj, values, slotKinds, locals, stack, locks, StackSlot.get(null, 0, true));
+    }
+
+    private void test(VirtualObject[] vobj, JavaValue[] values, JavaKind[] slotKinds, int locals, int stack, int locks, StackSlot deoptRescueSlot) {
         BytecodeFrame frame = new BytecodeFrame(null, dummyMethod, 0, false, false, values, slotKinds, locals, stack, locks);
         DebugInfo info = new DebugInfo(frame, vobj);
         info.setReferenceMap(new HotSpotReferenceMap(new Location[0], new Location[0], new int[0], 8));
-        installEmptyCode(new Site[]{new Infopoint(0, info, InfopointReason.SAFEPOINT)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new Infopoint(0, info, InfopointReason.SAFEPOINT)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], deoptRescueSlot);
     }
 
     @Test(expected = NullPointerException.class)
@@ -83,6 +87,11 @@
     }
 
     @Test(expected = JVMCIError.class)
+    public void testMissingDeoptRescueSlot() {
+        test(null, new JavaValue[0], new JavaKind[0], 0, 0, 0, null);
+    }
+
+    @Test(expected = JVMCIError.class)
     public void testUnexpectedScopeValuesLength() {
         test(new JavaValue[]{JavaConstant.FALSE}, new JavaKind[0], 0, 0, 0);
     }
--- a/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/errors/TestInvalidOopMap.java	Thu Feb 11 21:07:38 2016 +0100
@@ -35,6 +35,7 @@
 import jdk.vm.ci.code.Location;
 import jdk.vm.ci.code.ReferenceMap;
 import jdk.vm.ci.code.Register;
+import jdk.vm.ci.code.StackSlot;
 import jdk.vm.ci.code.site.DataPatch;
 import jdk.vm.ci.code.site.Infopoint;
 import jdk.vm.ci.code.site.InfopointReason;
@@ -61,7 +62,7 @@
         BytecodePosition pos = new BytecodePosition(null, dummyMethod, 0);
         DebugInfo info = new DebugInfo(pos);
         info.setReferenceMap(refMap);
-        installEmptyCode(new Site[]{new Infopoint(0, info, InfopointReason.SAFEPOINT)}, new Assumption[0], new Comment[0], 16, new DataPatch[0]);
+        installEmptyCode(new Site[]{new Infopoint(0, info, InfopointReason.SAFEPOINT)}, new Assumption[0], new Comment[0], 16, new DataPatch[0], StackSlot.get(null, 0, true));
     }
 
     @Test(expected = NullPointerException.class)
--- a/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/events/JvmciNotifyInstallEventTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -109,7 +109,7 @@
                 .getResolvedMethod(SimpleClass.class, testMethod);
         HotSpotCompiledCode compiledCode = new HotSpotCompiledCode(METHOD_NAME, new byte[0], 0, new Site[0],
                 new Assumption[0], new ResolvedJavaMethod[]{method}, new Comment[0], new byte[0], 16,
-                new DataPatch[0], false, 0, 0);
+                new DataPatch[0], false, 0, null);
         codeCache.installCode(method, compiledCode, /* installedCode = */ null, /* speculationLog = */ null,
                 /* isDefault = */ false);
         Asserts.assertEQ(gotInstallNotification, 1,
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/NameAndSignature.java	Thu Feb 11 21:07:38 2016 +0100
@@ -39,7 +39,7 @@
     final Class<?> returnType;
     final Class<?>[] parameterTypes;
 
-    public NameAndSignature(Method m) {
+    NameAndSignature(Method m) {
         this.name = m.getName();
         this.returnType = m.getReturnType();
         this.parameterTypes = m.getParameterTypes();
--- a/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Thu Feb 11 21:07:38 2016 +0100
@@ -47,7 +47,6 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
-import java.net.URL;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -501,7 +500,7 @@
         final Method implementation;
         final Set<Method> declarations;
 
-        public Declarations(Method impl) {
+        Declarations(Method impl) {
             this.implementation = impl;
             declarations = new HashSet<>();
         }
@@ -850,23 +849,6 @@
     }
 
     @Test
-    public void classFilePathTest() {
-        for (Class<?> c : classes) {
-            ResolvedJavaType type = metaAccess.lookupJavaType(c);
-            URL path = type.getClassFilePath();
-            if (type.isPrimitive() || type.isArray()) {
-                assertEquals(null, path);
-            } else {
-                assertNotNull(path);
-                String pathString = path.getPath();
-                if (type.isLocal() || type.isMember()) {
-                    assertTrue(pathString.indexOf('$') > 0);
-                }
-            }
-        }
-    }
-
-    @Test
     public void isTrustedInterfaceTypeTest() {
         for (Class<?> c : classes) {
             ResolvedJavaType type = metaAccess.lookupJavaType(c);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/loopopts/TestArraysFillDeadControl.java	Thu Feb 11 21:07:38 2016 +0100
@@ -0,0 +1,53 @@
+/*
+ * 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 8147645
+ * @summary Array.fill intrinsification code doesn't mark replaced control as dead
+ * @run main/othervm  -XX:-TieredCompilation -XX:CompileCommand=dontinline,TestArraysFillDeadControl::dont_inline TestArraysFillDeadControl
+ *
+ */
+
+import java.util.Arrays;
+
+public class TestArraysFillDeadControl {
+
+    static void dont_inline() {
+    }
+
+    static int i = 1;
+
+    public static void main(String[] args) {
+        for (int j = 0; j < 200000; j++) {
+            int[] a = new int[2];
+            int b = i;
+
+            Arrays.fill(a, 1);
+            Arrays.fill(a, 1+b);
+
+            dont_inline();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/rangechecks/PowerOf2SizedArraysChecks.java	Thu Feb 11 21:07:38 2016 +0100
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/**
+ * @test
+ * @bug 8003585
+ * @summary strength reduce or eliminate range checks for power-of-two sized arrays
+ * @run main/othervm -XX:CompileCommand=compileonly,PowerOf2SizedArraysChecks::test* -XX:-BackgroundCompilation PowerOf2SizedArraysChecks
+ *
+ */
+
+import java.util.function.*;
+
+public class PowerOf2SizedArraysChecks {
+
+    static void check_result(String name, int x, int m, boolean expected, boolean res) {
+        if (expected != res) {
+            throw new RuntimeException("Bad result in " + name + " for x =  " + x + " m = " + m + " expected " + expected  + " got " + res);
+        }
+    }
+
+    static void helper(String name, BiFunction<Integer, int[], Boolean> test, int[] x_values, int[] m_values, boolean[][] expected) {
+        for (int i = 0; i < x_values.length; i++) {
+            int x = x_values[i];
+            for (int j = 0; j < m_values.length; j++) {
+                int m = m_values[j];
+                int[] array = new int[m];
+                boolean res = test.apply(x, array);
+                check_result(name, x, m, expected[i][j], res);
+            }
+        }
+    }
+
+    static void check_result(String name, int m, boolean expected, boolean res) {
+        if (expected != res) {
+            throw new RuntimeException("Bad result in " + name + " for m = " + m + " expected " + expected  + " got " + res);
+        }
+    }
+
+    static void helper2(String name, Function<int[], Boolean> test, int[] m_values, boolean[] expected) {
+        for (int j = 0; j < m_values.length; j++) {
+            int m = m_values[j];
+            int[] array = new int[m];
+            boolean res = test.apply(array);
+            check_result(name, m, expected[j], res);
+        }
+    }
+
+    // ((x & m) u<= m) is always true
+    static boolean test1(int x, int[] array) {
+        int m = array.length;
+        if ((x & m) < 0 || (x & m) > m) {
+            return false;
+        }
+        return true;
+    }
+
+    // ((x & (m - 1)) u< m) iff (m > 0)
+    static boolean test2(int x, int[] array) {
+        int m = array.length;
+        if ((x & (m-1)) < 0 || (x & (m-1)) >= m) {
+            return false;
+        }
+        return true;
+    }
+
+    static boolean test3(int x, int[] array) {
+        try {
+            int v = array[x & (array.length-1)];
+        } catch(ArrayIndexOutOfBoundsException aioobe) {
+            return false;
+        }
+        return true;
+    }
+
+    // arraylength <= 0 to arraylength u<= 0
+    static boolean test4(int[] array) {
+        if (array.length <= 0) {
+            return false;
+        }
+        return true;
+    }
+
+    // arraylength == 0 to arraylength u<= 0
+    static boolean test5(int[] array) {
+        if (array.length == 0) {
+            return false;
+        }
+        return true;
+    }
+
+    // arraylength != 0 to arraylength u> 0
+    static boolean test6(int[] array) {
+        if (array.length != 0) {
+            return false;
+        }
+        return true;
+    }
+
+    static public void main(String[] args) {
+        int[] x_values = {-10, -5, 0, 5, 8, 16, 100};
+        int[] m_values = { 16, 10, 0 };
+
+        boolean[][] test1_expected = new boolean[x_values.length][m_values.length];
+        for (int i = 0; i < x_values.length; i++) {
+            for (int j = 0; j < m_values.length; j++) {
+                test1_expected[i][j] = true;
+            }
+        }
+
+        boolean[][] test2_expected = new boolean[x_values.length][m_values.length];
+        for (int i = 0; i < x_values.length; i++) {
+            for (int j = 0; j < m_values.length; j++) {
+                test2_expected[i][j] = (m_values[j] > 0);
+            }
+        }
+
+        boolean[] test4_expected = new boolean[m_values.length];
+        for (int i = 0; i < m_values.length; i++) {
+            test4_expected[i] = (m_values[i] > 0);
+        }
+        boolean[] test5_expected = new boolean[m_values.length];
+        for (int i = 0; i < m_values.length; i++) {
+            test5_expected[i] = (m_values[i] != 0);
+        }
+        boolean[] test6_expected = new boolean[m_values.length];
+        for (int i = 0; i < m_values.length; i++) {
+            test6_expected[i] = (m_values[i] == 0);
+        }
+
+        for (int i = 0; i < 20000; i++) {
+            helper("test1", PowerOf2SizedArraysChecks::test1, x_values, m_values, test1_expected);
+            helper("test2", PowerOf2SizedArraysChecks::test2, x_values, m_values, test2_expected);
+            helper("test3", PowerOf2SizedArraysChecks::test3, x_values, m_values, test2_expected);
+            helper2("test4", PowerOf2SizedArraysChecks::test4, m_values, test4_expected);
+            helper2("test5", PowerOf2SizedArraysChecks::test5, m_values, test5_expected);
+            helper2("test6", PowerOf2SizedArraysChecks::test6, m_values, test6_expected);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/runtime/safepoints/TestRegisterRestoring.java	Thu Feb 11 21:07:38 2016 +0100
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+
+/**
+ * @test
+ * @bug 8148490
+ * @summary Test correct saving and restoring of vector registers at safepoints.
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xbatch -XX:-TieredCompilation -XX:CompileCommand=exclude,TestRegisterRestoring::main -XX:+SafepointALot TestRegisterRestoring
+ */
+public class TestRegisterRestoring {
+  public static void main(String args[]) throws Exception {
+    // Initialize
+    float[] array = new float[100];
+    for (int i = 0; i < array.length; ++i) {
+      array[i] = 0;
+    }
+    // Test
+    for (int j = 0; j < 20_000; ++j) {
+      increment(array);
+      // Check result
+      for (int i = 0; i < array.length; i++) {
+        if (array[i] != 10_000) {
+          throw new RuntimeException("Test failed: array[" + i + "] = " + array[i] + " but should be 10.000");
+        }
+        array[i] = 0;
+      }
+    }
+  }
+
+  static void increment(float[] array) {
+    // Loop with safepoint
+    for (long l = 0; l < 10_000; l++) {
+      // Vectorized loop
+      for (int i = 0; i < array.length; ++i) {
+        array[i] += 1;
+      }
+    }
+  }
+}
+
--- a/hotspot/test/compiler/stable/TestStableMemoryBarrier.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/stable/TestStableMemoryBarrier.java	Thu Feb 11 21:07:38 2016 +0100
@@ -27,7 +27,7 @@
  * @test TestStableMemoryBarrier
  * @bug 8139758
  * @summary tests memory barrier correctly inserted for stable fields
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  *
  * @run main/bootclasspath -Xcomp -XX:CompileOnly=::testCompile
  *                   java.lang.invoke.TestStableMemoryBarrier
--- a/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java	Thu Feb 11 21:07:38 2016 +0100
@@ -27,7 +27,7 @@
  * @summary C2 can not handle returns with inccompatible interface arrays
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.base/sun.misc
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @build sun.hotspot.WhiteBox
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -92,33 +92,36 @@
 
     private void test() {
         System.out.printf("type %s%n", type);
+
+        // Measure the code cache usage after allocate/free.
         long start = getUsage();
-        long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
-        Asserts.assertNE(0, addr, "allocation failed");
+        long addr1 = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+        long firstAllocation = getUsage();
+        WHITE_BOX.freeCodeBlob(addr1);
+        long firstFree = getUsage();
+        long addr2 = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+        long secondAllocation = getUsage();
+        WHITE_BOX.freeCodeBlob(addr2);
 
-        long firstAllocation = getUsage();
+        // The following code may trigger resolving of invokedynamic
+        // instructions and therefore method handle intrinsic creation
+        // in the code cache. Make sure this is executed after measuring
+        // the code cache usage.
+        Asserts.assertNE(0, addr1, "first allocation failed");
+        Asserts.assertNE(0, addr2, "second allocation failed");
         Asserts.assertLTE(start + SIZE, firstAllocation,
                 "allocation should increase memory usage: "
                 + start + " + " + SIZE + " <= " + firstAllocation);
-
-        WHITE_BOX.freeCodeBlob(addr);
-        long firstFree = getUsage();
         Asserts.assertLTE(firstFree, firstAllocation,
                 "free shouldn't increase memory usage: "
                 + firstFree + " <= " + firstAllocation);
-
-        addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
-        Asserts.assertNE(0, addr, "allocation failed");
-
-        long secondAllocation = getUsage();
         Asserts.assertEQ(firstAllocation, secondAllocation);
 
-        WHITE_BOX.freeCodeBlob(addr);
         System.out.println("allocating till possible...");
         ArrayList<Long> blobs = new ArrayList<>();
         int size = (int) (CODE_CACHE_SIZE >> 7);
-        while ((addr = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) {
-            blobs.add(addr);
+        while ((addr1 = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) {
+            blobs.add(addr1);
         }
         for (Long blob : blobs) {
             WHITE_BOX.freeCodeBlob(blob);
--- a/hotspot/test/gc/g1/TestPLABOutput.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/gc/g1/TestPLABOutput.java	Thu Feb 11 21:07:38 2016 +0100
@@ -27,7 +27,7 @@
  * @summary Check that G1 does not report empty PLAB statistics in the first evacuation.
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @key gc
- * @library /testlibrary /../../test/lib
+ * @library /testlibrary /test/lib
  * @build sun.hotspot.WhiteBox
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run driver TestPLABOutput
--- a/hotspot/test/testlibrary/jittester/Makefile	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/testlibrary/jittester/Makefile	Thu Feb 11 21:07:38 2016 +0100
@@ -35,6 +35,15 @@
 	TESTBASE_DIR := ws/hotspot/test
 endif
 
+APPLICATION_ARGS =
+ifneq "x$(TESTS_NUMBER)" "x"
+	APPLICATION_ARGS += --number-of-tests $(TESTS_NUMBER)
+endif
+
+ifneq "x$(SEED)" "x"
+	APPLICATION_ARGS += --seed $(SEED)
+endif
+
 JAVA = $(JDK_HOME)/bin/java
 JAVAC = $(JDK_HOME)/bin/javac
 JAR = $(JDK_HOME)/bin/jar
@@ -43,8 +52,9 @@
 CLASSES_DIR = $(BUILD_DIR)/classes
 SRC_DIR = src
 TEST_DIR = test
+DRIVER_DIR = $(TESTBASE_DIR)/jdk/test/lib/jittester/jtreg
 MANIFEST = manifest.mf
-APPLICATION_ARGS = \
+APPLICATION_ARGS += \
     --property-file $(PROPERTY_FILE) \
     --testbase-dir $(TESTBASE_DIR)
 MAIN_CLASS = JitTestGenerator.Automatic
@@ -103,8 +113,8 @@
 	@rm filelist
 	@rm -rf $(CLASSES_DIR)
 
-copytestlibrary:
-	@cp -r src/jdk/test/lib/jittester/jtreg $(TESTBASE_DIR)/
+copytestlibrary: $(DRIVER_DIR)
+	@cp -r src/jdk/test/lib/jittester/jtreg/*.java $(DRIVER_DIR)
 	@cp -r ../jdk $(TESTBASE_DIR)/
 
 testgroup: $(TESTBASE_DIR)
@@ -117,9 +127,6 @@
 testroot: $(TESTBASE_DIR)
 	@echo 'groups=TEST.groups' > $(TESTROOT_FILE)
 
-$(TESTBASE_DIR):
+$(TESTBASE_DIR) $(DIST_DIR) $(DRIVER_DIR):
 	$(shell if [ ! -d $@ ]; then mkdir -p $@; fi)
 
-$(DIST_DIR):
-	$(shell if [ ! -d $@ ]; then mkdir -p $@; fi)
-
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java	Tue Feb 09 12:19:05 2016 +0100
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java	Thu Feb 11 21:07:38 2016 +0100
@@ -23,13 +23,13 @@
 
 /*
  * @test IntxTest
- * @bug 8028756
+ * @bug 8038756
  * @library /testlibrary /test/lib
  * @modules java.management/sun.management
  * @build IntxTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-ProfileInterpreter IntxTest
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xint -XX:-ProfileInterpreter IntxTest
  * @summary testing of WB::set/getIntxVMFlag()
  * @author igor.ignatyev@oracle.com
  */