Merge
authorbobv
Wed, 13 Jun 2018 13:44:56 -0400
changeset 50547 a1a3d41b6c13
parent 50546 52b866a1a63a (current diff)
parent 50542 b6ff4cd463e3 (diff)
child 50548 c7633e5f8657
Merge
--- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -1880,7 +1880,7 @@
       // cpu register - cpu register
       Register reg2 = opr2->as_register();
       if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) {
-        __ cmp(reg1, reg2);
+        __ cmpoop(reg1, reg2);
       } else {
         assert(opr2->type() != T_OBJECT && opr2->type() != T_ARRAY, "cmp int, oop?");
         __ cmpw(reg1, reg2);
@@ -1911,8 +1911,9 @@
         break;
       case T_OBJECT:
       case T_ARRAY:
-        imm = jlong(opr2->as_constant_ptr()->as_jobject());
-        break;
+        jobject2reg(opr2->as_constant_ptr()->as_jobject(), rscratch1);
+        __ cmpoop(reg1, rscratch1);
+        return;
       default:
         ShouldNotReachHere();
         imm = 0;  // unreachable
--- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -109,6 +109,11 @@
   }
 }
 
+void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
+                                     Register obj1, Register obj2) {
+  __ cmp(obj1, obj2);
+}
+
 void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
                                                         Register obj, Register tmp, Label& slowpath) {
   // If mask changes we need to ensure that the inverse is still encodable as an immediate
--- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -40,6 +40,9 @@
   virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                         Address dst, Register val, Register tmp1, Register tmp2);
 
+  virtual void obj_equals(MacroAssembler* masm,
+                          Register obj1, Register obj2);
+
   virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
                                              Register obj, Register tmp, Label& slowpath);
 
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -3651,6 +3651,11 @@
   cmp(src1, rscratch1);
 }
 
+void MacroAssembler::cmpoop(Register obj1, Register obj2) {
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->obj_equals(this, obj1, obj2);
+}
+
 void MacroAssembler::load_klass(Register dst, Register src) {
   if (UseCompressedClassPointers) {
     ldrw(dst, Address(src, oopDesc::klass_offset_in_bytes()));
@@ -5048,6 +5053,8 @@
     // a1 & a2 == 0 means (some-pointer is null) or
     // (very-rare-or-even-probably-impossible-pointer-values)
     // so, we can save one branch in most cases
+    cmpoop(a1, a2);
+    br(EQ, SAME);
     eor(rscratch1, a1, a2);
     tst(a1, a2);
     mov(result, false);
@@ -5131,7 +5138,7 @@
     // faster to perform another branch before comparing a1 and a2
     cmp(cnt1, elem_per_word);
     br(LE, SHORT); // short or same
-    cmp(a1, a2);
+    cmpoop(a1, a2);
     br(EQ, SAME);
     ldr(tmp3, Address(pre(a1, base_offset)));
     cmp(cnt1, stubBytesThreshold);
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -979,6 +979,8 @@
   void addptr(const Address &dst, int32_t src);
   void cmpptr(Register src1, Address src2);
 
+  void cmpoop(Register obj1, Register obj2);
+
   // Various forms of CAS
 
   void cmpxchg_obj_header(Register oldv, Register newv, Register obj, Register tmp,
--- a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -152,7 +152,7 @@
     // assert(sizeof(u2) == sizeof(Method::_size_of_parameters), "");
     Label L;
     __ ldr(rscratch1, __ argument_address(temp2, -1));
-    __ cmp(recv, rscratch1);
+    __ cmpoop(recv, rscratch1);
     __ br(Assembler::EQ, L);
     __ ldr(r0, __ argument_address(temp2, -1));
     __ hlt(0);
--- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -2027,7 +2027,7 @@
   // assume branch is more often taken than not (loops use backward branches)
   Label not_taken;
   __ pop_ptr(r1);
-  __ cmp(r1, r0);
+  __ cmpoop(r1, r0);
   __ br(j_not(cc), not_taken);
   branch(false, false);
   __ bind(not_taken);
--- a/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/sparc/c1_LIRAssembler_sparc.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -3202,23 +3202,38 @@
   const Register dest_reg = dest->as_pointer_register();
   const Register base_reg = addr->base()->as_pointer_register();
 
-  if (Assembler::is_simm13(addr->disp())) {
-    if (addr->index()->is_valid()) {
-      const Register index_reg = addr->index()->as_pointer_register();
-      assert(index_reg != G3_scratch, "invariant");
-      __ add(base_reg, addr->disp(), G3_scratch);
-      __ add(index_reg, G3_scratch, dest_reg);
-    } else {
-      __ add(base_reg, addr->disp(), dest_reg);
-    }
-  } else {
-    __ set(addr->disp(), G3_scratch);
+  if (patch_code != lir_patch_none) {
+    PatchingStub* patch = new PatchingStub(_masm, PatchingStub::access_field_id);
+    assert(addr->disp() != 0, "must have");
+    assert(base_reg != G3_scratch, "invariant");
+    __ patchable_set(0, G3_scratch);
+    patching_epilog(patch, patch_code, base_reg, info);
+    assert(dest_reg != G3_scratch, "invariant");
     if (addr->index()->is_valid()) {
       const Register index_reg = addr->index()->as_pointer_register();
       assert(index_reg != G3_scratch, "invariant");
       __ add(index_reg, G3_scratch, G3_scratch);
     }
     __ add(base_reg, G3_scratch, dest_reg);
+  } else {
+    if (Assembler::is_simm13(addr->disp())) {
+      if (addr->index()->is_valid()) {
+        const Register index_reg = addr->index()->as_pointer_register();
+        assert(index_reg != G3_scratch, "invariant");
+        __ add(base_reg, addr->disp(), G3_scratch);
+        __ add(index_reg, G3_scratch, dest_reg);
+      } else {
+        __ add(base_reg, addr->disp(), dest_reg);
+      }
+    } else {
+      __ set(addr->disp(), G3_scratch);
+      if (addr->index()->is_valid()) {
+        const Register index_reg = addr->index()->as_pointer_register();
+        assert(index_reg != G3_scratch, "invariant");
+        __ add(index_reg, G3_scratch, G3_scratch);
+      }
+      __ add(base_reg, G3_scratch, dest_reg);
+    }
   }
 }
 
--- a/src/hotspot/cpu/sparc/vm_version_ext_sparc.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/sparc/vm_version_ext_sparc.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -31,10 +31,13 @@
 int   VM_Version_Ext::_no_of_threads = 0;
 int   VM_Version_Ext::_no_of_cores = 0;
 int   VM_Version_Ext::_no_of_sockets = 0;
+#if defined(SOLARIS)
 kid_t VM_Version_Ext::_kcid = -1;
+#endif
 char  VM_Version_Ext::_cpu_name[CPU_TYPE_DESC_BUF_SIZE] = {0};
 char  VM_Version_Ext::_cpu_desc[CPU_DETAILED_DESC_BUF_SIZE] = {0};
 
+#if defined(SOLARIS)
 // get cpu information. It takes into account if the kstat chain id
 // has been changed and update the info if necessary.
 bool VM_Version_Ext::initialize_cpu_information(void) {
@@ -144,6 +147,13 @@
   kstat_close(kc);
   return true;
 }
+#elif defined(LINUX)
+// get cpu information.
+bool VM_Version_Ext::initialize_cpu_information(void) {
+  // Not yet implemented.
+  return false;
+}
+#endif
 
 int VM_Version_Ext::number_of_threads(void) {
   initialize_cpu_information();
--- a/src/hotspot/cpu/sparc/vm_version_ext_sparc.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/sparc/vm_version_ext_sparc.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -27,8 +27,11 @@
 
 #include "utilities/macros.hpp"
 #include "vm_version_sparc.hpp"
+
+#if defined(SOLARIS)
 #include <kstat.h>
 #include <sys/processor.h>
+#endif
 
 #define CPU_INFO        "cpu_info"
 #define CPU_TYPE        "fpu_type"
@@ -45,7 +48,9 @@
   static int               _no_of_threads;
   static int               _no_of_cores;
   static int               _no_of_sockets;
+#if defined(SOLARIS)
   static kid_t             _kcid;
+#endif
   static char              _cpu_name[CPU_TYPE_DESC_BUF_SIZE];
   static char              _cpu_desc[CPU_DETAILED_DESC_BUF_SIZE];
 
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -187,6 +187,27 @@
   }
 }
 
+#ifndef _LP64
+void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
+                                     Address obj1, jobject obj2) {
+  __ cmpoop_raw(obj1, obj2);
+}
+
+void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
+                                     Register obj1, jobject obj2) {
+  __ cmpoop_raw(obj1, obj2);
+}
+#endif
+void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
+                                     Register obj1, Address obj2) {
+  __ cmpptr(obj1, obj2);
+}
+
+void BarrierSetAssembler::obj_equals(MacroAssembler* masm,
+                                     Register obj1, Register obj2) {
+  __ cmpptr(obj1, obj2);
+}
+
 void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
                                                         Register obj, Register tmp, Label& slowpath) {
   __ clear_jweak_tag(obj);
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -44,6 +44,18 @@
   virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
                         Address dst, Register val, Register tmp1, Register tmp2);
 
+#ifndef _LP64
+  virtual void obj_equals(MacroAssembler* masm,
+                          Address obj1, jobject obj2);
+  virtual void obj_equals(MacroAssembler* masm,
+                          Register obj1, jobject obj2);
+#endif
+
+  virtual void obj_equals(MacroAssembler* masm,
+                          Register obj1, Register obj2);
+  virtual void obj_equals(MacroAssembler* masm,
+                          Register obj1, Address obj2);
+
   // Support for jniFastGetField to try resolving a jobject/jweak in native
   virtual void try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
                                              Register obj, Register tmp, Label& slowpath);
--- a/src/hotspot/cpu/x86/globals_x86.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/x86/globals_x86.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -150,6 +150,9 @@
   product(bool, UseUnalignedLoadStores, false,                              \
           "Use SSE2 MOVDQU instruction for Arraycopy")                      \
                                                                             \
+  product(bool, UseXMMForObjInit, false,                                    \
+          "Use XMM/YMM MOVDQU instruction for Object Initialization")       \
+                                                                            \
   product(bool, UseFastStosb, false,                                        \
           "Use fast-string operation for zeroing: rep stosb")               \
                                                                             \
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -118,12 +118,22 @@
   cmp_literal32(src1, (int32_t)obj, metadata_Relocation::spec_for_immediate());
 }
 
+void MacroAssembler::cmpoop_raw(Address src1, jobject obj) {
+  cmp_literal32(src1, (int32_t)obj, oop_Relocation::spec_for_immediate());
+}
+
+void MacroAssembler::cmpoop_raw(Register src1, jobject obj) {
+  cmp_literal32(src1, (int32_t)obj, oop_Relocation::spec_for_immediate());
+}
+
 void MacroAssembler::cmpoop(Address src1, jobject obj) {
-  cmp_literal32(src1, (int32_t)obj, oop_Relocation::spec_for_immediate());
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->obj_equals(this, src1, obj);
 }
 
 void MacroAssembler::cmpoop(Register src1, jobject obj) {
-  cmp_literal32(src1, (int32_t)obj, oop_Relocation::spec_for_immediate());
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->obj_equals(this, src1, obj);
 }
 
 void MacroAssembler::extend_sign(Register hi, Register lo) {
@@ -2785,17 +2795,20 @@
 }
 
 void MacroAssembler::cmpoop(Register src1, Register src2) {
-  cmpptr(src1, src2);
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->obj_equals(this, src1, src2);
 }
 
 void MacroAssembler::cmpoop(Register src1, Address src2) {
-  cmpptr(src1, src2);
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->obj_equals(this, src1, src2);
 }
 
 #ifdef _LP64
 void MacroAssembler::cmpoop(Register src1, jobject src2) {
   movoop(rscratch1, src2);
-  cmpptr(src1, rscratch1);
+  BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  bs->obj_equals(this, src1, rscratch1);
 }
 #endif
 
@@ -6777,7 +6790,59 @@
 
 }
 
-void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp, bool is_large) {
+// clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers
+void MacroAssembler::xmm_clear_mem(Register base, Register cnt, XMMRegister xtmp) {
+  // cnt - number of qwords (8-byte words).
+  // base - start address, qword aligned.
+  Label L_zero_64_bytes, L_loop, L_sloop, L_tail, L_end;
+  if (UseAVX >= 2) {
+    vpxor(xtmp, xtmp, xtmp, AVX_256bit);
+  } else {
+    pxor(xtmp, xtmp);
+  }
+  jmp(L_zero_64_bytes);
+
+  BIND(L_loop);
+  if (UseAVX >= 2) {
+    vmovdqu(Address(base,  0), xtmp);
+    vmovdqu(Address(base, 32), xtmp);
+  } else {
+    movdqu(Address(base,  0), xtmp);
+    movdqu(Address(base, 16), xtmp);
+    movdqu(Address(base, 32), xtmp);
+    movdqu(Address(base, 48), xtmp);
+  }
+  addptr(base, 64);
+
+  BIND(L_zero_64_bytes);
+  subptr(cnt, 8);
+  jccb(Assembler::greaterEqual, L_loop);
+  addptr(cnt, 4);
+  jccb(Assembler::less, L_tail);
+  // Copy trailing 32 bytes
+  if (UseAVX >= 2) {
+    vmovdqu(Address(base, 0), xtmp);
+  } else {
+    movdqu(Address(base,  0), xtmp);
+    movdqu(Address(base, 16), xtmp);
+  }
+  addptr(base, 32);
+  subptr(cnt, 4);
+
+  BIND(L_tail);
+  addptr(cnt, 4);
+  jccb(Assembler::lessEqual, L_end);
+  decrement(cnt);
+
+  BIND(L_sloop);
+  movq(Address(base, 0), xtmp);
+  addptr(base, 8);
+  decrement(cnt);
+  jccb(Assembler::greaterEqual, L_sloop);
+  BIND(L_end);
+}
+
+void MacroAssembler::clear_mem(Register base, Register cnt, Register tmp, XMMRegister xtmp, bool is_large) {
   // cnt - number of qwords (8-byte words).
   // base - start address, qword aligned.
   // is_large - if optimizers know cnt is larger than InitArrayShortSize
@@ -6789,7 +6854,9 @@
 
   Label DONE;
 
-  xorptr(tmp, tmp);
+  if (!is_large || !UseXMMForObjInit) {
+    xorptr(tmp, tmp);
+  }
 
   if (!is_large) {
     Label LOOP, LONG;
@@ -6815,6 +6882,9 @@
   if (UseFastStosb) {
     shlptr(cnt, 3); // convert to number of bytes
     rep_stosb();
+  } else if (UseXMMForObjInit) {
+    movptr(tmp, base);
+    xmm_clear_mem(tmp, cnt, xtmp);
   } else {
     NOT_LP64(shlptr(cnt, 1);) // convert to number of 32-bit words for 32-bit VM
     rep_stos();
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -741,11 +741,13 @@
   void cmpklass(Address dst, Metadata* obj);
   void cmpklass(Register dst, Metadata* obj);
   void cmpoop(Address dst, jobject obj);
+  void cmpoop_raw(Address dst, jobject obj);
 #endif // _LP64
 
   void cmpoop(Register src1, Register src2);
   void cmpoop(Register src1, Address src2);
   void cmpoop(Register dst, jobject obj);
+  void cmpoop_raw(Register dst, jobject obj);
 
   // NOTE src2 must be the lval. This is NOT an mem-mem compare
   void cmpptr(Address src1, AddressLiteral src2);
@@ -1578,7 +1580,10 @@
 
   // clear memory of size 'cnt' qwords, starting at 'base';
   // if 'is_large' is set, do not try to produce short loop
-  void clear_mem(Register base, Register cnt, Register rtmp, bool is_large);
+  void clear_mem(Register base, Register cnt, Register rtmp, XMMRegister xtmp, bool is_large);
+
+  // clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers
+  void xmm_clear_mem(Register base, Register cnt, XMMRegister xtmp);
 
 #ifdef COMPILER2
   void string_indexof_char(Register str1, Register cnt1, Register ch, Register result,
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -1396,6 +1396,16 @@
     FLAG_SET_DEFAULT(UseFastStosb, false);
   }
 
+  // Use XMM/YMM MOVDQU instruction for Object Initialization
+  if (!UseFastStosb && UseSSE >= 2 && UseUnalignedLoadStores) {
+    if (FLAG_IS_DEFAULT(UseXMMForObjInit)) {
+      UseXMMForObjInit = true;
+    }
+  } else if (UseXMMForObjInit) {
+    warning("UseXMMForObjInit requires SSE2 and unaligned load/stores. Feature is switched off.");
+    FLAG_SET_DEFAULT(UseXMMForObjInit, false);
+  }
+
 #ifdef COMPILER2
   if (FLAG_IS_DEFAULT(AlignVector)) {
     // Modern processors allow misaligned memory operations for vectors.
--- a/src/hotspot/cpu/x86/x86_32.ad	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/x86/x86_32.ad	Wed Jun 13 13:44:56 2018 -0400
@@ -11482,10 +11482,10 @@
 
 // =======================================================================
 // fast clearing of an array
-instruct rep_stos(eCXRegI cnt, eDIRegP base, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
+instruct rep_stos(eCXRegI cnt, eDIRegP base, regD tmp, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
   predicate(!((ClearArrayNode*)n)->is_large());
   match(Set dummy (ClearArray cnt base));
-  effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+  effect(USE_KILL cnt, USE_KILL base, TEMP tmp, KILL zero, KILL cr);
 
   format %{ $$template
     $$emit$$"XOR    EAX,EAX\t# ClearArray:\n\t"
@@ -11502,6 +11502,32 @@
     if (UseFastStosb) {
        $$emit$$"SHL    ECX,3\t# Convert doublewords to bytes\n\t"
        $$emit$$"REP STOSB\t# store EAX into [EDI++] while ECX--\n\t"
+    } else if (UseXMMForObjInit) {
+       $$emit$$"MOV     RDI,RAX\n\t"
+       $$emit$$"VPXOR    YMM0,YMM0,YMM0\n\t"
+       $$emit$$"JMPQ    L_zero_64_bytes\n\t"
+       $$emit$$"# L_loop:\t# 64-byte LOOP\n\t"
+       $$emit$$"VMOVDQU YMM0,(RAX)\n\t"
+       $$emit$$"VMOVDQU YMM0,0x20(RAX)\n\t"
+       $$emit$$"ADD     0x40,RAX\n\t"
+       $$emit$$"# L_zero_64_bytes:\n\t"
+       $$emit$$"SUB     0x8,RCX\n\t"
+       $$emit$$"JGE     L_loop\n\t"
+       $$emit$$"ADD     0x4,RCX\n\t"
+       $$emit$$"JL      L_tail\n\t"
+       $$emit$$"VMOVDQU YMM0,(RAX)\n\t"
+       $$emit$$"ADD     0x20,RAX\n\t"
+       $$emit$$"SUB     0x4,RCX\n\t"
+       $$emit$$"# L_tail:\t# Clearing tail bytes\n\t"
+       $$emit$$"ADD     0x4,RCX\n\t"
+       $$emit$$"JLE     L_end\n\t"
+       $$emit$$"DEC     RCX\n\t"
+       $$emit$$"# L_sloop:\t# 8-byte short loop\n\t"
+       $$emit$$"VMOVQ   XMM0,(RAX)\n\t"
+       $$emit$$"ADD     0x8,RAX\n\t"
+       $$emit$$"DEC     RCX\n\t"
+       $$emit$$"JGE     L_sloop\n\t"
+       $$emit$$"# L_end:\n\t"
     } else {
        $$emit$$"SHL    ECX,1\t# Convert doublewords to words\n\t"
        $$emit$$"REP STOS\t# store EAX into [EDI++] while ECX--\n\t"
@@ -11509,28 +11535,57 @@
     $$emit$$"# DONE"
   %}
   ins_encode %{
-    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, false);
-  %}
-  ins_pipe( pipe_slow );
-%}
-
-instruct rep_stos_large(eCXRegI cnt, eDIRegP base, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register,
+                 $tmp$$XMMRegister, false);
+  %}
+  ins_pipe( pipe_slow );
+%}
+
+instruct rep_stos_large(eCXRegI cnt, eDIRegP base, regD tmp, eAXRegI zero, Universe dummy, eFlagsReg cr) %{
   predicate(((ClearArrayNode*)n)->is_large());
   match(Set dummy (ClearArray cnt base));
-  effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+  effect(USE_KILL cnt, USE_KILL base, TEMP tmp, KILL zero, KILL cr);
   format %{ $$template
-    $$emit$$"XOR    EAX,EAX\t# ClearArray:\n\t"
     if (UseFastStosb) {
+       $$emit$$"XOR    EAX,EAX\t# ClearArray:\n\t"
        $$emit$$"SHL    ECX,3\t# Convert doublewords to bytes\n\t"
        $$emit$$"REP STOSB\t# store EAX into [EDI++] while ECX--\n\t"
+    } else if (UseXMMForObjInit) {
+       $$emit$$"MOV     RDI,RAX\t# ClearArray:\n\t"
+       $$emit$$"VPXOR   YMM0,YMM0,YMM0\n\t"
+       $$emit$$"JMPQ    L_zero_64_bytes\n\t"
+       $$emit$$"# L_loop:\t# 64-byte LOOP\n\t"
+       $$emit$$"VMOVDQU YMM0,(RAX)\n\t"
+       $$emit$$"VMOVDQU YMM0,0x20(RAX)\n\t"
+       $$emit$$"ADD     0x40,RAX\n\t"
+       $$emit$$"# L_zero_64_bytes:\n\t"
+       $$emit$$"SUB     0x8,RCX\n\t"
+       $$emit$$"JGE     L_loop\n\t"
+       $$emit$$"ADD     0x4,RCX\n\t"
+       $$emit$$"JL      L_tail\n\t"
+       $$emit$$"VMOVDQU YMM0,(RAX)\n\t"
+       $$emit$$"ADD     0x20,RAX\n\t"
+       $$emit$$"SUB     0x4,RCX\n\t"
+       $$emit$$"# L_tail:\t# Clearing tail bytes\n\t"
+       $$emit$$"ADD     0x4,RCX\n\t"
+       $$emit$$"JLE     L_end\n\t"
+       $$emit$$"DEC     RCX\n\t"
+       $$emit$$"# L_sloop:\t# 8-byte short loop\n\t"
+       $$emit$$"VMOVQ   XMM0,(RAX)\n\t"
+       $$emit$$"ADD     0x8,RAX\n\t"
+       $$emit$$"DEC     RCX\n\t"
+       $$emit$$"JGE     L_sloop\n\t"
+       $$emit$$"# L_end:\n\t"
     } else {
+       $$emit$$"XOR    EAX,EAX\t# ClearArray:\n\t"
        $$emit$$"SHL    ECX,1\t# Convert doublewords to words\n\t"
        $$emit$$"REP STOS\t# store EAX into [EDI++] while ECX--\n\t"
     }
     $$emit$$"# DONE"
   %}
   ins_encode %{
-    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, true);
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register,
+                 $tmp$$XMMRegister, true);
   %}
   ins_pipe( pipe_slow );
 %}
--- a/src/hotspot/cpu/x86/x86_64.ad	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/cpu/x86/x86_64.ad	Wed Jun 13 13:44:56 2018 -0400
@@ -10770,12 +10770,12 @@
 
 // =======================================================================
 // fast clearing of an array
-instruct rep_stos(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
-                  rFlagsReg cr)
+instruct rep_stos(rcx_RegL cnt, rdi_RegP base, regD tmp, rax_RegI zero,
+                  Universe dummy, rFlagsReg cr)
 %{
   predicate(!((ClearArrayNode*)n)->is_large());
   match(Set dummy (ClearArray cnt base));
-  effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+  effect(USE_KILL cnt, USE_KILL base, TEMP tmp, KILL zero, KILL cr);
 
   format %{ $$template
     $$emit$$"xorq    rax, rax\t# ClearArray:\n\t"
@@ -10791,35 +10791,90 @@
     if (UseFastStosb) {
        $$emit$$"shlq    rcx,3\t# Convert doublewords to bytes\n\t"
        $$emit$$"rep     stosb\t# Store rax to *rdi++ while rcx--\n\t"
+    } else if (UseXMMForObjInit) {
+       $$emit$$"mov     rdi,rax\n\t"
+       $$emit$$"vpxor   ymm0,ymm0,ymm0\n\t"
+       $$emit$$"jmpq    L_zero_64_bytes\n\t"
+       $$emit$$"# L_loop:\t# 64-byte LOOP\n\t"
+       $$emit$$"vmovdqu ymm0,(rax)\n\t"
+       $$emit$$"vmovdqu ymm0,0x20(rax)\n\t"
+       $$emit$$"add     0x40,rax\n\t"
+       $$emit$$"# L_zero_64_bytes:\n\t"
+       $$emit$$"sub     0x8,rcx\n\t"
+       $$emit$$"jge     L_loop\n\t"
+       $$emit$$"add     0x4,rcx\n\t"
+       $$emit$$"jl      L_tail\n\t"
+       $$emit$$"vmovdqu ymm0,(rax)\n\t"
+       $$emit$$"add     0x20,rax\n\t"
+       $$emit$$"sub     0x4,rcx\n\t"
+       $$emit$$"# L_tail:\t# Clearing tail bytes\n\t"
+       $$emit$$"add     0x4,rcx\n\t"
+       $$emit$$"jle     L_end\n\t"
+       $$emit$$"dec     rcx\n\t"
+       $$emit$$"# L_sloop:\t# 8-byte short loop\n\t"
+       $$emit$$"vmovq   xmm0,(rax)\n\t"
+       $$emit$$"add     0x8,rax\n\t"
+       $$emit$$"dec     rcx\n\t"
+       $$emit$$"jge     L_sloop\n\t"
+       $$emit$$"# L_end:\n\t"
     } else {
        $$emit$$"rep     stosq\t# Store rax to *rdi++ while rcx--\n\t"
     }
     $$emit$$"# DONE"
   %}
   ins_encode %{
-    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, false);
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register,
+                 $tmp$$XMMRegister, false);
   %}
   ins_pipe(pipe_slow);
 %}
 
-instruct rep_stos_large(rcx_RegL cnt, rdi_RegP base, rax_RegI zero, Universe dummy,
-                  rFlagsReg cr)
+instruct rep_stos_large(rcx_RegL cnt, rdi_RegP base, regD tmp, rax_RegI zero, 
+                        Universe dummy, rFlagsReg cr)
 %{
   predicate(((ClearArrayNode*)n)->is_large());
   match(Set dummy (ClearArray cnt base));
-  effect(USE_KILL cnt, USE_KILL base, KILL zero, KILL cr);
+  effect(USE_KILL cnt, USE_KILL base, TEMP tmp, KILL zero, KILL cr);
 
   format %{ $$template
-    $$emit$$"xorq    rax, rax\t# ClearArray:\n\t"
     if (UseFastStosb) {
+       $$emit$$"xorq    rax, rax\t# ClearArray:\n\t"
        $$emit$$"shlq    rcx,3\t# Convert doublewords to bytes\n\t"
        $$emit$$"rep     stosb\t# Store rax to *rdi++ while rcx--"
+    } else if (UseXMMForObjInit) {
+       $$emit$$"mov     rdi,rax\t# ClearArray:\n\t"
+       $$emit$$"vpxor   ymm0,ymm0,ymm0\n\t"
+       $$emit$$"jmpq    L_zero_64_bytes\n\t"
+       $$emit$$"# L_loop:\t# 64-byte LOOP\n\t"
+       $$emit$$"vmovdqu ymm0,(rax)\n\t"
+       $$emit$$"vmovdqu ymm0,0x20(rax)\n\t"
+       $$emit$$"add     0x40,rax\n\t"
+       $$emit$$"# L_zero_64_bytes:\n\t"
+       $$emit$$"sub     0x8,rcx\n\t"
+       $$emit$$"jge     L_loop\n\t"
+       $$emit$$"add     0x4,rcx\n\t"
+       $$emit$$"jl      L_tail\n\t"
+       $$emit$$"vmovdqu ymm0,(rax)\n\t"
+       $$emit$$"add     0x20,rax\n\t"
+       $$emit$$"sub     0x4,rcx\n\t"
+       $$emit$$"# L_tail:\t# Clearing tail bytes\n\t"
+       $$emit$$"add     0x4,rcx\n\t"
+       $$emit$$"jle     L_end\n\t"
+       $$emit$$"dec     rcx\n\t"
+       $$emit$$"# L_sloop:\t# 8-byte short loop\n\t"
+       $$emit$$"vmovq   xmm0,(rax)\n\t"
+       $$emit$$"add     0x8,rax\n\t"
+       $$emit$$"dec     rcx\n\t"
+       $$emit$$"jge     L_sloop\n\t"
+       $$emit$$"# L_end:\n\t"
     } else {
+       $$emit$$"xorq    rax, rax\t# ClearArray:\n\t"
        $$emit$$"rep     stosq\t# Store rax to *rdi++ while rcx--"
     }
   %}
   ins_encode %{
-    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, true);
+    __ clear_mem($base$$Register, $cnt$$Register, $zero$$Register, 
+                 $tmp$$XMMRegister, true);
   %}
   ins_pipe(pipe_slow);
 %}
--- a/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -35,6 +35,13 @@
   return frame(last_Java_sp(), frame::unpatchable, _anchor.last_Java_pc());
 }
 
+bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {
+  ucontext_t* uc = (ucontext_t*) ucontext;
+  *fr_addr = frame((intptr_t*)uc->uc_mcontext.mc_i7, frame::unpatchable,
+                   (address)uc->uc_mcontext.mc_gregs[MC_PC]);
+  return true;
+}
+
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
 bool JavaThread::pd_get_top_frame_for_signal_handler(frame* fr_addr,
--- a/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/os_cpu/linux_sparc/thread_linux_sparc.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -85,8 +85,9 @@
     _base_of_stack_pointer = sp;
   }
 
-  bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext,
-    bool isInJava);
+  bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava);
+
+  bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava);
 
   // These routines are only used on cpu architectures that
   // have separate register stacks (Itanium).
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -526,6 +526,10 @@
   fill_with_object_impl(start, words, zap);
 }
 
+void CollectedHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) {
+  CollectedHeap::fill_with_object(start, end, zap);
+}
+
 HeapWord* CollectedHeap::allocate_new_tlab(size_t min_size,
                                            size_t requested_size,
                                            size_t* actual_size) {
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -350,6 +350,8 @@
     fill_with_object(start, pointer_delta(end, start), zap);
   }
 
+  virtual void fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap);
+
   // Return the address "addr" aligned by "alignment_in_bytes" if such
   // an address is below "end".  Return NULL otherwise.
   inline static HeapWord* align_allocation_or_fail(HeapWord* addr,
--- a/src/hotspot/share/gc/shared/plab.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/share/gc/shared/plab.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -82,14 +82,14 @@
 size_t PLAB::retire_internal() {
   size_t result = 0;
   if (_top < _hard_end) {
-    CollectedHeap::fill_with_object(_top, _hard_end);
+    Universe::heap()->fill_with_dummy_object(_top, _hard_end, true);
     result += invalidate();
   }
   return result;
 }
 
 void PLAB::add_undo_waste(HeapWord* obj, size_t word_sz) {
-  CollectedHeap::fill_with_object(obj, word_sz);
+  Universe::heap()->fill_with_dummy_object(obj, obj + word_sz, true);
   _undo_wasted += word_sz;
 }
 
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -114,7 +114,7 @@
       myThread()->incr_allocated_bytes(used_bytes());
     }
 
-    CollectedHeap::fill_with_object(top(), hard_end(), retire && zap);
+    Universe::heap()->fill_with_dummy_object(top(), hard_end(), retire && zap);
 
     if (retire || ZeroTLAB) {  // "Reset" the TLAB
       set_start(NULL);
--- a/src/hotspot/share/services/memTracker.hpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/hotspot/share/services/memTracker.hpp	Wed Jun 13 13:44:56 2018 -0400
@@ -241,6 +241,11 @@
     }
   }
 
+#ifdef _AIX
+  // See JDK-8202772 - temporarily disable thread stack tracking on AIX.
+  static inline void record_thread_stack(void* addr, size_t size) {}
+  static inline void release_thread_stack(void* addr, size_t size) {}
+#else
   static inline void record_thread_stack(void* addr, size_t size) {
     if (tracking_level() < NMT_summary) return;
     if (addr != NULL) {
@@ -260,6 +265,7 @@
       VirtualMemoryTracker::remove_released_region((address)addr, size);
     }
   }
+#endif
 
   // Query lock is used to synchronize the access to tracking data.
   // So far, it is only used by JCmd query, but it may be used by
Binary file src/java.base/share/lib/security/cacerts has changed
--- a/src/java.compiler/share/classes/javax/annotation/processing/Messager.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/java.compiler/share/classes/javax/annotation/processing/Messager.java	Wed Jun 13 13:44:56 2018 -0400
@@ -25,7 +25,6 @@
 
 package javax.annotation.processing;
 
-import javax.annotation.*;
 import javax.tools.Diagnostic;
 import javax.lang.model.element.*;
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Wed Jun 13 13:44:56 2018 -0400
@@ -181,7 +181,8 @@
         DIAMOND_WITH_ANONYMOUS_CLASS_CREATION(JDK9, Fragments.FeatureDiamondAndAnonClass, DiagKind.NORMAL),
         UNDERSCORE_IDENTIFIER(MIN, JDK8),
         PRIVATE_INTERFACE_METHODS(JDK9, Fragments.FeaturePrivateIntfMethods, DiagKind.PLURAL),
-        LOCAL_VARIABLE_TYPE_INFERENCE(JDK10);
+        LOCAL_VARIABLE_TYPE_INFERENCE(JDK10),
+        IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES(JDK1_2, JDK8);
 
         enum DiagKind {
             NORMAL,
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java	Wed Jun 13 13:44:56 2018 -0400
@@ -3650,17 +3650,8 @@
         OUTER: for (JCImport imp : toplevel.getImports()) {
             if (!imp.staticImport && TreeInfo.name(imp.qualid) == names.asterisk) {
                 TypeSymbol tsym = ((JCFieldAccess)imp.qualid).selected.type.tsym;
-                if (toplevel.modle.visiblePackages != null) {
-                    //TODO - unclear: selects like javax.* will get resolved from the current module
-                    //(as javax is not an exported package from any module). And as javax in the current
-                    //module typically does not contain any classes or subpackages, we need to go through
-                    //the visible packages to find a sub-package:
-                    for (PackageSymbol known : toplevel.modle.visiblePackages.values()) {
-                        if (Convert.packagePart(known.fullname) == tsym.flatName())
-                            continue OUTER;
-                    }
-                }
-                if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) {
+                if (tsym.kind == PCK && tsym.members().isEmpty() &&
+                    !(Feature.IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES.allowedInSource(source) && tsym.exists())) {
                     log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, Errors.DoesntExist(tsym));
                 }
             }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Wed Jun 13 13:44:56 2018 -0400
@@ -164,11 +164,18 @@
                     JCMemberReference result = new JCMemberReference(t.mode, t.name, expr, typeargs) {
                         @Override
                         public void setOverloadKind(OverloadKind overloadKind) {
-                            super.setOverloadKind(overloadKind);
-                            if (t.getOverloadKind() == null) {
+                            OverloadKind previous = t.getOverloadKind();
+                            if (previous == null) {
                                 t.setOverloadKind(overloadKind);
+                            } else {
+                                Assert.check(previous == overloadKind);
                             }
                         }
+
+                        @Override
+                        public OverloadKind getOverloadKind() {
+                            return t.getOverloadKind();
+                        }
                     };
                     result.pos = t.pos;
                     return result;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Jun 13 13:44:56 2018 -0400
@@ -2012,7 +2012,7 @@
                     }
                 }
                 return null;
-            }, sym -> sym.kind == Kind.TYP, false, typeNotFound);
+            }, sym -> sym.kind == Kind.TYP, typeNotFound);
         }
     };
 
@@ -2049,18 +2049,11 @@
         PackageSymbol pack = syms.lookupPackage(env.toplevel.modle, name);
 
         if (allowModules && isImportOnDemand(env, name)) {
-            pack.complete();
-            if (!pack.exists()) {
-                Name nameAndDot = name.append('.', names.empty);
-                boolean prefixOfKnown =
-                        env.toplevel.modle.visiblePackages.values()
-                                                          .stream()
-                                                          .anyMatch(p -> p.fullname.startsWith(nameAndDot));
-
+            if (pack.members().isEmpty()) {
                 return lookupInvisibleSymbol(env, name, syms::getPackagesForName, syms::enterPackage, sym -> {
                     sym.complete();
-                    return sym.exists();
-                }, prefixOfKnown, pack);
+                    return !sym.members().isEmpty();
+                }, pack);
             }
         }
 
@@ -2087,7 +2080,6 @@
                                                             Function<Name, Iterable<S>> get,
                                                             BiFunction<ModuleSymbol, Name, S> load,
                                                             Predicate<S> validate,
-                                                            boolean suppressError,
                                                             Symbol defaultResult) {
         //even if a class/package cannot be found in the current module and among packages in modules
         //it depends on that are exported for any or this module, the class/package may exist internally
@@ -2097,7 +2089,7 @@
 
         for (S sym : candidates) {
             if (validate.test(sym))
-                return createInvisibleSymbolError(env, suppressError, sym);
+                return createInvisibleSymbolError(env, sym);
         }
 
         Set<ModuleSymbol> recoverableModules = new HashSet<>(syms.getAllModules());
@@ -2117,7 +2109,7 @@
                     S sym = load.apply(ms, name);
 
                     if (sym != null && validate.test(sym)) {
-                        return createInvisibleSymbolError(env, suppressError, sym);
+                        return createInvisibleSymbolError(env, sym);
                     }
                 }
             }
@@ -2126,11 +2118,11 @@
         return defaultResult;
     }
 
-    private Symbol createInvisibleSymbolError(Env<AttrContext> env, boolean suppressError, Symbol sym) {
+    private Symbol createInvisibleSymbolError(Env<AttrContext> env, Symbol sym) {
         if (symbolPackageVisible(env, sym)) {
             return new AccessError(env, null, sym);
         } else {
-            return new InvisibleSymbolError(env, suppressError, sym);
+            return new InvisibleSymbolError(env, false, sym);
         }
     }
 
--- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp	Tue Jun 12 18:53:38 2018 -0400
+++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp	Wed Jun 13 13:44:56 2018 -0400
@@ -38,6 +38,8 @@
 class CommittedVirtualMemoryTest {
 public:
   static void test() {
+#ifndef _AIX
+    // See JDK-8202772: temporarily disabled.
     Thread* thr = Thread::current();
     address stack_end = thr->stack_end();
     size_t  stack_size = thr->stack_size();
@@ -81,6 +83,7 @@
     ASSERT_TRUE(i >= 1);
     ASSERT_TRUE(found_stack_top);
     ASSERT_TRUE(found_i_addr);
+#endif // !_AIX
   }
 
   static void check_covered_pages(address addr, size_t size, address base, size_t touch_pages, int* page_num) {
--- a/test/jdk/java/rmi/transport/dgcDeadLock/TestImpl.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/test/jdk/java/rmi/transport/dgcDeadLock/TestImpl.java	Wed Jun 13 13:44:56 2018 -0400
@@ -26,7 +26,6 @@
 
 import java.rmi.*;
 import sun.rmi.transport.*;
-import sun.rmi.*;
 import java.io.*;
 import java.lang.reflect.*;
 import java.rmi.dgc.*;
--- a/test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/test/jdk/java/time/tck/java/time/zone/TCKZoneRules.java	Wed Jun 13 13:44:56 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -112,11 +112,13 @@
         return ZoneId.of("Europe/London").getRules();
     }
 
+    @Test
     public void test_London() {
         ZoneRules test = europeLondon();
         assertEquals(test.isFixedOffset(), false);
     }
 
+    @Test
     public void test_London_preTimeZones() {
         ZoneRules test = europeLondon();
         ZonedDateTime old = createZDT(1800, 1, 1, ZoneOffset.UTC);
@@ -129,6 +131,7 @@
         assertEquals(test.isDaylightSavings(instant), false);
     }
 
+    @Test
     public void test_London_getOffset() {
         ZoneRules test = europeLondon();
         assertEquals(test.getOffset(createInstant(2008, 1, 1, ZoneOffset.UTC)), OFFSET_ZERO);
@@ -145,6 +148,7 @@
         assertEquals(test.getOffset(createInstant(2008, 12, 1, ZoneOffset.UTC)), OFFSET_ZERO);
     }
 
+    @Test
     public void test_London_getOffset_toDST() {
         ZoneRules test = europeLondon();
         assertEquals(test.getOffset(createInstant(2008, 3, 24, ZoneOffset.UTC)), OFFSET_ZERO);
@@ -160,6 +164,7 @@
         assertEquals(test.getOffset(createInstant(2008, 3, 30, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_PONE);
     }
 
+    @Test
     public void test_London_getOffset_fromDST() {
         ZoneRules test = europeLondon();
         assertEquals(test.getOffset(createInstant(2008, 10, 24, ZoneOffset.UTC)), OFFSET_PONE);
@@ -175,6 +180,7 @@
         assertEquals(test.getOffset(createInstant(2008, 10, 26, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_ZERO);
     }
 
+    @Test
     public void test_London_getOffsetInfo() {
         ZoneRules test = europeLondon();
         checkOffset(test, createLDT(2008, 1, 1), OFFSET_ZERO, 1);
@@ -191,6 +197,7 @@
         checkOffset(test, createLDT(2008, 12, 1), OFFSET_ZERO, 1);
     }
 
+    @Test
     public void test_London_getOffsetInfo_toDST() {
         ZoneRules test = europeLondon();
         checkOffset(test, createLDT(2008, 3, 24), OFFSET_ZERO, 1);
@@ -206,6 +213,7 @@
         checkOffset(test, LocalDateTime.of(2008, 3, 30, 2, 0, 0, 0), OFFSET_PONE, 1);
     }
 
+    @Test
     public void test_London_getOffsetInfo_fromDST() {
         ZoneRules test = europeLondon();
         checkOffset(test, createLDT(2008, 10, 24), OFFSET_PONE, 1);
@@ -221,6 +229,7 @@
         checkOffset(test, LocalDateTime.of(2008, 10, 26, 2, 0, 0, 0), OFFSET_ZERO, 1);
     }
 
+    @Test
     public void test_London_getOffsetInfo_gap() {
         ZoneRules test = europeLondon();
         final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 30, 1, 0, 0, 0);
@@ -246,6 +255,7 @@
         assertEquals(trans.hashCode(), otherTrans.hashCode());
     }
 
+    @Test
     public void test_London_getOffsetInfo_overlap() {
         ZoneRules test = europeLondon();
         final LocalDateTime dateTime = LocalDateTime.of(2008, 10, 26, 1, 0, 0, 0);
@@ -272,6 +282,7 @@
         assertEquals(trans.hashCode(), otherTrans.hashCode());
     }
 
+    @Test
     public void test_London_getStandardOffset() {
         ZoneRules test = europeLondon();
         ZonedDateTime zdt = createZDT(1840, 1, 1, ZoneOffset.UTC);
@@ -288,6 +299,7 @@
         }
     }
 
+    @Test
     public void test_London_getTransitions() {
         ZoneRules test = europeLondon();
         List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -365,6 +377,7 @@
         assertEquals(it.hasNext(), false);
     }
 
+    @Test
     public void test_London_getTransitionRules() {
         ZoneRules test = europeLondon();
         List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
@@ -392,6 +405,7 @@
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void test_London_nextTransition_historic() {
         ZoneRules test = europeLondon();
         List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -408,6 +422,7 @@
         }
     }
 
+    @Test
     public void test_London_nextTransition_rulesBased() {
         ZoneRules test = europeLondon();
         List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
@@ -429,6 +444,7 @@
         }
     }
 
+    @Test
     public void test_London_nextTransition_lastYear() {
         ZoneRules test = europeLondon();
         List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
@@ -437,6 +453,7 @@
     }
 
     //-----------------------------------------------------------------------
+    @Test
     public void test_London_previousTransition_historic() {
         ZoneRules test = europeLondon();
         List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -455,6 +472,7 @@
         }
     }
 
+    @Test
     public void test_London_previousTransition_rulesBased() {
         ZoneRules test = europeLondon();
         List<ZoneOffsetTransitionRule> rules = test.getTransitionRules();
@@ -492,11 +510,13 @@
         return ZoneId.of("Europe/Paris").getRules();
     }
 
+    @Test
     public void test_Paris() {
         ZoneRules test = europeParis();
         assertEquals(test.isFixedOffset(), false);
     }
 
+    @Test
     public void test_Paris_preTimeZones() {
         ZoneRules test = europeParis();
         ZonedDateTime old = createZDT(1800, 1, 1, ZoneOffset.UTC);
@@ -509,6 +529,7 @@
         assertEquals(test.isDaylightSavings(instant), false);
     }
 
+    @Test
     public void test_Paris_getOffset() {
         ZoneRules test = europeParis();
         assertEquals(test.getOffset(createInstant(2008, 1, 1, ZoneOffset.UTC)), OFFSET_PONE);
@@ -525,6 +546,7 @@
         assertEquals(test.getOffset(createInstant(2008, 12, 1, ZoneOffset.UTC)), OFFSET_PONE);
     }
 
+    @Test
     public void test_Paris_getOffset_toDST() {
         ZoneRules test = europeParis();
         assertEquals(test.getOffset(createInstant(2008, 3, 24, ZoneOffset.UTC)), OFFSET_PONE);
@@ -540,6 +562,7 @@
         assertEquals(test.getOffset(createInstant(2008, 3, 30, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_PTWO);
     }
 
+    @Test
     public void test_Paris_getOffset_fromDST() {
         ZoneRules test = europeParis();
         assertEquals(test.getOffset(createInstant(2008, 10, 24, ZoneOffset.UTC)), OFFSET_PTWO);
@@ -555,6 +578,7 @@
         assertEquals(test.getOffset(createInstant(2008, 10, 26, 1, 0, 0, 0, ZoneOffset.UTC)), OFFSET_PONE);
     }
 
+    @Test
     public void test_Paris_getOffsetInfo() {
         ZoneRules test = europeParis();
         checkOffset(test, createLDT(2008, 1, 1), OFFSET_PONE, 1);
@@ -571,6 +595,7 @@
         checkOffset(test, createLDT(2008, 12, 1), OFFSET_PONE, 1);
     }
 
+    @Test
     public void test_Paris_getOffsetInfo_toDST() {
         ZoneRules test = europeParis();
         checkOffset(test, createLDT(2008, 3, 24), OFFSET_PONE, 1);
@@ -586,6 +611,7 @@
         checkOffset(test, LocalDateTime.of(2008, 3, 30, 3, 0, 0, 0), OFFSET_PTWO, 1);
     }
 
+    @Test
     public void test_Paris_getOffsetInfo_fromDST() {
         ZoneRules test = europeParis();
         checkOffset(test, createLDT(2008, 10, 24), OFFSET_PTWO, 1);
@@ -601,6 +627,7 @@
         checkOffset(test, LocalDateTime.of(2008, 10, 26, 3, 0, 0, 0), OFFSET_PONE, 1);
     }
 
+    @Test
     public void test_Paris_getOffsetInfo_gap() {
         ZoneRules test = europeParis();
         final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 30, 2, 0, 0, 0);
@@ -624,6 +651,7 @@
         assertEquals(trans.hashCode(), otherTrans.hashCode());
     }
 
+    @Test
     public void test_Paris_getOffsetInfo_overlap() {
         ZoneRules test = europeParis();
         final LocalDateTime dateTime = LocalDateTime.of(2008, 10, 26, 2, 0, 0, 0);
@@ -648,6 +676,7 @@
         assertEquals(trans.hashCode(), otherTrans.hashCode());
     }
 
+    @Test
     public void test_Paris_getStandardOffset() {
         ZoneRules test = europeParis();
         ZonedDateTime zdt = createZDT(1840, 1, 1, ZoneOffset.UTC);
@@ -675,11 +704,13 @@
         return ZoneId.of("America/New_York").getRules();
     }
 
+    @Test
     public void test_NewYork() {
         ZoneRules test = americaNewYork();
         assertEquals(test.isFixedOffset(), false);
     }
 
+    @Test
     public void test_NewYork_preTimeZones() {
         ZoneRules test = americaNewYork();
         ZonedDateTime old = createZDT(1800, 1, 1, ZoneOffset.UTC);
@@ -692,6 +723,7 @@
         assertEquals(test.isDaylightSavings(instant), false);
     }
 
+    @Test
     public void test_NewYork_getOffset() {
         ZoneRules test = americaNewYork();
         ZoneOffset offset = ZoneOffset.ofHours(-5);
@@ -721,6 +753,7 @@
         assertEquals(test.getOffset(createInstant(2008, 12, 28, offset)), ZoneOffset.ofHours(-5));
     }
 
+    @Test
     public void test_NewYork_getOffset_toDST() {
         ZoneRules test = americaNewYork();
         ZoneOffset offset = ZoneOffset.ofHours(-5);
@@ -736,6 +769,7 @@
         assertEquals(test.getOffset(createInstant(2008, 3, 9, 2, 0, 0, 0, offset)), ZoneOffset.ofHours(-4));
     }
 
+    @Test
     public void test_NewYork_getOffset_fromDST() {
         ZoneRules test = americaNewYork();
         ZoneOffset offset = ZoneOffset.ofHours(-4);
@@ -751,6 +785,7 @@
         assertEquals(test.getOffset(createInstant(2008, 11, 2, 2, 0, 0, 0, offset)), ZoneOffset.ofHours(-5));
     }
 
+    @Test
     public void test_NewYork_getOffsetInfo() {
         ZoneRules test = americaNewYork();
         checkOffset(test, createLDT(2008, 1, 1), ZoneOffset.ofHours(-5), 1);
@@ -779,6 +814,7 @@
         checkOffset(test, createLDT(2008, 12, 28), ZoneOffset.ofHours(-5), 1);
     }
 
+    @Test
     public void test_NewYork_getOffsetInfo_toDST() {
         ZoneRules test = americaNewYork();
         checkOffset(test, createLDT(2008, 3, 8), ZoneOffset.ofHours(-5), 1);
@@ -793,6 +829,7 @@
         checkOffset(test, LocalDateTime.of(2008, 3, 9, 3, 0, 0, 0), ZoneOffset.ofHours(-4), 1);
     }
 
+    @Test
     public void test_NewYork_getOffsetInfo_fromDST() {
         ZoneRules test = americaNewYork();
         checkOffset(test, createLDT(2008, 11, 1), ZoneOffset.ofHours(-4), 1);
@@ -807,6 +844,7 @@
         checkOffset(test, LocalDateTime.of(2008, 11, 2, 2, 0, 0, 0), ZoneOffset.ofHours(-5), 1);
     }
 
+    @Test
     public void test_NewYork_getOffsetInfo_gap() {
         ZoneRules test = americaNewYork();
         final LocalDateTime dateTime = LocalDateTime.of(2008, 3, 9, 2, 0, 0, 0);
@@ -830,6 +868,7 @@
         assertEquals(trans.hashCode(), otherTrans.hashCode());
     }
 
+    @Test
     public void test_NewYork_getOffsetInfo_overlap() {
         ZoneRules test = americaNewYork();
         final LocalDateTime dateTime = LocalDateTime.of(2008, 11, 2, 1, 0, 0, 0);
@@ -854,6 +893,7 @@
         assertEquals(trans.hashCode(), otherTrans.hashCode());
     }
 
+    @Test
     public void test_NewYork_getStandardOffset() {
         ZoneRules test = americaNewYork();
         ZonedDateTime dateTime = createZDT(1860, 1, 1, ZoneOffset.UTC);
@@ -875,6 +915,7 @@
         return ZoneId.of("Asia/Kathmandu").getRules();
     }
 
+    @Test
     public void test_Kathmandu_nextTransition_historic() {
         ZoneRules test = asiaKathmandu();
         List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -891,6 +932,7 @@
         }
     }
 
+    @Test
     public void test_Kathmandu_nextTransition_noRules() {
         ZoneRules test = asiaKathmandu();
         List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -906,6 +948,7 @@
         return ZoneId.of("Pacific/Apia").getRules();
     }
 
+    @Test
     public void test_Apia_nextTransition_historic() {
         ZoneRules test = pacificApia();
         List<ZoneOffsetTransition> trans = test.getTransitions();
@@ -922,6 +965,7 @@
         }
     }
 
+    @Test
     public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() {
         // transition occurred at 2011-12-30T00:00-10:00
         ZoneRules test = pacificApia();
@@ -940,6 +984,7 @@
         assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0));
     }
 
+    @Test
     public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() {
         // transition occurred at 1892-07-04T00:00+12:33:04
         ZoneRules test = pacificApia();
@@ -974,6 +1019,7 @@
     //-----------------------------------------------------------------------
     // of()
     //-----------------------------------------------------------------------
+    @Test
     public void test_of(){
         //used for standard offset
         ZoneOffset stdOffset1 = ZoneOffset.UTC;
@@ -1049,6 +1095,7 @@
     //-----------------------------------------------------------------------
     // equals() / hashCode()
     //-----------------------------------------------------------------------
+    @Test
     public void test_equals() {
         ZoneRules test1 = europeLondon();
         ZoneRules test2 = europeParis();
@@ -1065,14 +1112,17 @@
         assertEquals(test2.hashCode() == test2b.hashCode(), true);
     }
 
+    @Test
     public void test_equals_null() {
         assertEquals(europeLondon().equals(null), false);
     }
 
+    @Test
     public void test_equals_notZoneRules() {
         assertEquals(europeLondon().equals("Europe/London"), false);
     }
 
+    @Test
     public void test_toString() {
         assertEquals(europeLondon().toString().contains("ZoneRules"), true);
     }
--- a/test/jdk/lib/security/cacerts/VerifyCACerts.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/test/jdk/lib/security/cacerts/VerifyCACerts.java	Wed Jun 13 13:44:56 2018 -0400
@@ -24,7 +24,7 @@
 
 /**
  * @test
- * @bug 8189131 8198240 8191844 8189949 8191031 8196141
+ * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923
  * @requires java.runtime.name ~= "OpenJDK.*"
  * @summary Check root CA entries in cacerts file
  */
@@ -42,7 +42,7 @@
             + File.separator + "security" + File.separator + "cacerts";
 
     // The numbers of certs now.
-    private static final int COUNT = 74;
+    private static final int COUNT = 75;
 
     // map of cert alias to SHA-256 fingerprint
     private static final Map<String, String> FINGERPRINT_MAP
@@ -128,6 +128,8 @@
                     "3F:9F:27:D5:83:20:4B:9E:09:C8:A3:D2:06:6C:4B:57:D3:A2:47:9C:36:93:65:08:80:50:56:98:10:5D:BC:E9");
             put("verisigntsaca [jdk]",
                     "CB:6B:05:D9:E8:E5:7C:D8:82:B1:0B:4D:B7:0D:E4:BB:1D:E4:2B:A4:8A:7B:D0:31:8B:63:5B:F6:E7:78:1A:9D");
+            put("verisignclass2g2ca [jdk]",
+                    "3A:43:E2:20:FE:7F:3E:A9:65:3D:1E:21:74:2E:AC:2B:75:C2:0F:D8:98:03:05:BC:50:2C:AF:8C:2D:9B:41:A1");
             put("verisignclass3ca [jdk]",
                     "A4:B6:B3:99:6F:C2:F3:06:B3:FD:86:81:BD:63:41:3D:8C:50:09:CC:4F:A3:29:C2:CC:F0:E2:FA:1B:14:03:05");
             put("verisignclass3g2ca [jdk]",
--- a/test/jdk/sun/security/tools/jarsigner/JarSigningNonAscii.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/JarSigningNonAscii.java	Wed Jun 13 13:44:56 2018 -0400
@@ -29,9 +29,7 @@
  * @run main/othervm JarSigningNonAscii
  */
 
-import sun.security.tools.*;
 import java.io.*;
-import java.security.Security;
 import java.util.*;
 import java.util.jar.*;
 import java.security.cert.Certificate;
--- a/test/langtools/tools/javac/importChecks/ImportsObservable.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/test/langtools/tools/javac/importChecks/ImportsObservable.java	Wed Jun 13 13:44:56 2018 -0400
@@ -23,9 +23,10 @@
 
 /*
  * @test
- * @bug 4869999
+ * @bug 4869999 8193302
  * @summary Verify that the compiler does not prematurely decide a package is not observable.
- * @compile ImportsObservable.java
+ * @compile -source 8 -Xlint:-options ImportsObservable.java
+ * @compile/fail/ref=ImportsObservable.out -XDrawDiagnostics ImportsObservable.java
  */
 
 import javax.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/importChecks/ImportsObservable.out	Wed Jun 13 13:44:56 2018 -0400
@@ -0,0 +1,2 @@
+ImportsObservable.java:32:1: compiler.err.doesnt.exist: javax
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/methodReference/MethodRefStuckParenthesized.java	Wed Jun 13 13:44:56 2018 -0400
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018, Google LLC. 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 8203679
+ * @summary This is a negative regression test for an AssertionError in DeferredAttr.
+ * @compile/fail/ref=MethodRefStuckParenthesized.out -XDrawDiagnostics MethodRefStuckParenthesized.java
+ */
+
+public abstract class MethodRefStuckParenthesized {
+
+  interface I {
+    String v();
+  }
+
+  interface J {
+    String v();
+  }
+
+  abstract String v();
+
+  abstract void f(I v);
+
+  abstract <X extends J> J g(X x);
+
+  void test() {
+    f(g((this::v)));
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/methodReference/MethodRefStuckParenthesized.out	Wed Jun 13 13:44:56 2018 -0400
@@ -0,0 +1,2 @@
+MethodRefStuckParenthesized.java:48:5: compiler.err.cant.apply.symbol: kindname.method, f, MethodRefStuckParenthesized.I, MethodRefStuckParenthesized.J, kindname.class, MethodRefStuckParenthesized, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: X, MethodRefStuckParenthesized.J, MethodRefStuckParenthesized.I))
+1 error
--- a/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java	Tue Jun 12 18:53:38 2018 -0400
+++ b/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java	Wed Jun 13 13:44:56 2018 -0400
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8169197 8172668 8173117 8175007 8189765
+ * @bug 8169197 8172668 8173117 8175007 8189765 8193302
  * @summary Check convenient errors are produced for inaccessible classes.
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
@@ -433,29 +433,6 @@
     }
 
     @Test
-    public void testUnusedImportOnDemand1(Path base) throws Exception {
-        Path src = base.resolve("src");
-        tb.writeJavaFiles(src,
-                          "package test; import javax.annotation.*; public class Test { }");
-        Path classes = base.resolve("classes");
-        tb.createDirectories(classes);
-
-        List<String> log = new JavacTask(tb)
-                .options("-XDrawDiagnostics",
-                         "--add-modules", "java.compiler")
-                .outdir(classes)
-                .files(findJavaFiles(src))
-                .run()
-                .writeAll()
-                .getOutputLines(Task.OutputKind.DIRECT);
-
-        List<String> expected = Arrays.asList("");
-
-        if (!expected.equals(log))
-            throw new Exception("expected output not found; actual: " + log);
-    }
-
-    @Test
     public void testUnusedImportOnDemand2(Path base) throws Exception {
         Path src = base.resolve("src");
         Path src_m1 = src.resolve("m1x");
@@ -744,4 +721,155 @@
         if (!expected.equals(log))
             throw new Exception("expected output not found; actual: " + log);
     }
+
+    @Test
+    public void testPackagesUniquelyVisibleInImportOnDemand(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_ma = src.resolve("ma");
+        tb.writeJavaFiles(src_ma,
+                          "module ma { exports ma; }",
+                          "package ma; public class Api { }");
+        Path src_mb = src.resolve("mb");
+        tb.writeJavaFiles(src_mb,
+                          "module mb { exports ma.mb; }",
+                          "package ma.mb; public class Api { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        new JavacTask(tb)
+            .options("--module-source-path", src.toString())
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll();
+
+        Path test = src.resolve("test");
+        tb.writeJavaFiles(test,
+                          "module test { requires mb; }",
+                          "package test; import ma.*; public class Test { }");
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-path", classes.toString())
+                .outdir(classes)
+                .files(findJavaFiles(test))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:22: compiler.err.package.not.visible: ma, (compiler.misc.not.def.access.does.not.read: test, ma, ma)",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testPackagesUniquelyVisibleInImportOnDemandNoPrefixes(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path src_mb = src.resolve("mb");
+        tb.writeJavaFiles(src_mb,
+                          "module mb { exports ma.mb; }",
+                          "package ma.mb; public class Api { }");
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        new JavacTask(tb)
+            .options("--module-source-path", src.toString())
+            .outdir(classes)
+            .files(findJavaFiles(src))
+            .run()
+            .writeAll();
+
+        Path test = src.resolve("test");
+        tb.writeJavaFiles(test,
+                          "module test { requires mb; }",
+                          "package test; import ma.mb.*; import ma.*; public class Test { }");
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics",
+                         "--module-path", classes.toString())
+                .outdir(classes)
+                .files(findJavaFiles(test))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:31: compiler.err.doesnt.exist: ma",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+    }
+
+    @Test
+    public void testPackagesUniquelyVisibleInImportOnDemandThisModule(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path test = src.resolve("test");
+        tb.writeJavaFiles(test,
+                          "module test { }",
+                          "package ma.mb; public class Impl { }",
+                          "package test; import ma.*; public class Test { }");
+
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(classes)
+                .files(findJavaFiles(test))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:15: compiler.err.doesnt.exist: ma",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+
+        new JavacTask(tb)
+                .options("-source", "8")
+                .outdir(classes)
+                .files(findJavaFiles(test.resolve("ma"), test.resolve("test")))
+                .run(Task.Expect.SUCCESS)
+                .writeAll();
+    }
+
+    @Test
+    public void testPackagesUniquelyVisibleInImportOnDemandThisModuleUnnamed(Path base) throws Exception {
+        Path src = base.resolve("src");
+        Path test = src.resolve("test");
+        tb.writeJavaFiles(test,
+                          "package ma.mb; public class Impl { }",
+                          "package test; import ma.*; public class Test { }");
+
+        Path classes = base.resolve("classes");
+        tb.createDirectories(classes);
+
+        List<String> log = new JavacTask(tb)
+                .options("-XDrawDiagnostics")
+                .outdir(classes)
+                .files(findJavaFiles(test))
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutputLines(Task.OutputKind.DIRECT);
+
+        List<String> expected = Arrays.asList(
+                "Test.java:1:15: compiler.err.doesnt.exist: ma",
+                "1 error");
+
+        if (!expected.equals(log))
+            throw new Exception("expected output not found; actual: " + log);
+
+        new JavacTask(tb)
+                .options("-source", "8")
+                .outdir(classes)
+                .files(findJavaFiles(test))
+                .run(Task.Expect.SUCCESS)
+                .writeAll();
+    }
 }