Merge JDK-8200758-branch
authorherrick
Thu, 20 Jun 2019 14:47:20 -0400
branchJDK-8200758-branch
changeset 57415 50ac38fbd874
parent 57414 6eda749d3117 (current diff)
parent 55445 a7b9d6d4940e (diff)
child 57419 44c2481650ce
Merge
--- a/.hgtags	Thu Jun 20 14:13:50 2019 -0400
+++ b/.hgtags	Thu Jun 20 14:47:20 2019 -0400
@@ -563,4 +563,6 @@
 b034d2dee5fc93d42a81b65e58ce3f91e42586ff jdk-13+23
 7e2238451585029680f126ccbb46d01f2ff5607f jdk-13+24
 22b3b7983adab54e318f75aeb94471f7a4429c1e jdk-14+0
+22b3b7983adab54e318f75aeb94471f7a4429c1e jdk-13+25
 2f4e214781a1d597ed36bf5a36f20928c6c82996 jdk-14+1
+43627549a488b7d0b4df8fad436e36233df89877 jdk-14+2
--- a/make/autoconf/build-aux/config.guess	Thu Jun 20 14:13:50 2019 -0400
+++ b/make/autoconf/build-aux/config.guess	Thu Jun 20 14:47:20 2019 -0400
@@ -63,7 +63,7 @@
 # Test and fix wsl
 echo $OUT | grep x86_64-unknown-linux-gnu > /dev/null 2> /dev/null
 if test $? = 0; then
-  uname -r | grep Microsoft > /dev/null 2> /dev/null
+  uname -r | grep -i microsoft > /dev/null 2> /dev/null
   if test $? = 0; then
     OUT="x86_64-pc-wsl"
   fi
--- a/make/conf/jib-profiles.js	Thu Jun 20 14:13:50 2019 -0400
+++ b/make/conf/jib-profiles.js	Thu Jun 20 14:47:20 2019 -0400
@@ -1041,7 +1041,7 @@
             // build_number: "b07",
             // file: "bundles/jcov-3_0.zip",
             organization: common.organization,
-            revision: "3.0-57-support+1.0",
+            revision: "3.0-58-support+1.0",
             ext: "zip",
             environment_name: "JCOV_HOME",
         },
--- a/make/data/jdwp/jdwp.spec	Thu Jun 20 14:13:50 2019 -0400
+++ b/make/data/jdwp/jdwp.spec	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, 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
@@ -602,7 +602,7 @@
     (Command Signature=1
         "Returns the JNI signature of a reference type. "
         "JNI signature formats are described in the "
-        "<a href=\"http://java.sun.com/products/jdk/1.2/docs/guide/jni/index.html\">Java Native Inteface Specification</a>"
+        "<a href=\"../jni/index.html\">Java Native Interface Specification</a>"
         "<p>
         "For primitive classes "
         "the returned signature is the signature of the corresponding primitive "
--- a/make/jdk/src/classes/build/tools/generatecacerts/GenerateCacerts.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/make/jdk/src/classes/build/tools/generatecacerts/GenerateCacerts.java	Thu Jun 20 14:47:20 2019 -0400
@@ -25,12 +25,23 @@
 
 package build.tools.generatecacerts;
 
+import java.io.DataOutputStream;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.security.KeyStore;
+import java.security.DigestOutputStream;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * Generate cacerts
@@ -39,23 +50,99 @@
  */
 public class GenerateCacerts {
     public static void main(String[] args) throws Exception {
-        KeyStore ks = KeyStore.getInstance("JKS");
-        ks.load(null, null);
-        CertificateFactory cf = CertificateFactory.getInstance("X509");
-        Files.list(Path.of(args[0]))
-                .filter(p -> !p.getFileName().toString().equals("README"))
-                .forEach(p -> {
-                    try {
-                        String alias = p.getFileName().toString() + " [jdk]";
-                        try (InputStream fis = Files.newInputStream(p)) {
-                            ks.setCertificateEntry(alias, cf.generateCertificate(fis));
-                        }
-                    } catch (Exception e) {
-                        throw new RuntimeException(e);
-                    }
-                });
         try (FileOutputStream fos = new FileOutputStream(args[1])) {
-            ks.store(fos, "changeit".toCharArray());
+            store(args[0], fos, "changeit".toCharArray());
         }
     }
+
+    // The following code are copied from JavaKeyStore.java.
+
+    private static final int MAGIC = 0xfeedfeed;
+    private static final int VERSION_2 = 0x02;
+
+    // This method is a simplified version of JavaKeyStore::engineStore.
+    // A new "dir" argument is added. All cert names in "dir" is collected into
+    // a sorted array. Each cert is stored with a creation date set to its
+    // notBefore value. Thus the output is determined as long as the certs
+    // are the same.
+    public static void store(String dir, OutputStream stream, char[] password)
+            throws IOException, NoSuchAlgorithmException, CertificateException
+    {
+        byte[] encoded; // the certificate encoding
+        CertificateFactory cf = CertificateFactory.getInstance("X509");
+
+        MessageDigest md = getPreKeyedHash(password);
+        DataOutputStream dos
+                = new DataOutputStream(new DigestOutputStream(stream, md));
+
+        dos.writeInt(MAGIC);
+        // always write the latest version
+        dos.writeInt(VERSION_2);
+
+        // All file names in dir sorted.
+        // README is excluded. Name starting with "." excluded.
+        List<String> entries = Files.list(Path.of(dir))
+                .map(p -> p.getFileName().toString())
+                .filter(s -> !s.equals("README") && !s.startsWith("."))
+                .collect(Collectors.toList());
+
+        entries.sort(String::compareTo);
+
+        dos.writeInt(entries.size());
+
+        for (String entry : entries) {
+
+            String alias = entry + " [jdk]";
+            X509Certificate cert;
+            try (InputStream fis = Files.newInputStream(Path.of(dir, entry))) {
+                cert = (X509Certificate) cf.generateCertificate(fis);
+            }
+
+            dos.writeInt(2);
+
+            // Write the alias
+            dos.writeUTF(alias);
+
+            // Write the (entry creation) date, which is notBefore of the cert
+            dos.writeLong(cert.getNotBefore().getTime());
+
+            // Write the trusted certificate
+            encoded = cert.getEncoded();
+            dos.writeUTF(cert.getType());
+            dos.writeInt(encoded.length);
+            dos.write(encoded);
+        }
+
+        /*
+         * Write the keyed hash which is used to detect tampering with
+         * the keystore (such as deleting or modifying key or
+         * certificate entries).
+         */
+        byte[] digest = md.digest();
+
+        dos.write(digest);
+        dos.flush();
+    }
+
+    private static MessageDigest getPreKeyedHash(char[] password)
+            throws NoSuchAlgorithmException, UnsupportedEncodingException
+    {
+
+        MessageDigest md = MessageDigest.getInstance("SHA");
+        byte[] passwdBytes = convertToBytes(password);
+        md.update(passwdBytes);
+        Arrays.fill(passwdBytes, (byte) 0x00);
+        md.update("Mighty Aphrodite".getBytes("UTF8"));
+        return md;
+    }
+
+    private static byte[] convertToBytes(char[] password) {
+        int i, j;
+        byte[] passwdBytes = new byte[password.length * 2];
+        for (i=0, j=0; i<password.length; i++) {
+            passwdBytes[j++] = (byte)(password[i] >> 8);
+            passwdBytes[j++] = (byte)password[i];
+        }
+        return passwdBytes;
+    }
 }
--- a/src/hotspot/share/asm/assembler.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/asm/assembler.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -313,25 +313,22 @@
 bool MacroAssembler::uses_implicit_null_check(void* address) {
   // Exception handler checks the nmethod's implicit null checks table
   // only when this method returns false.
-  intptr_t int_address = reinterpret_cast<intptr_t>(address);
-  intptr_t cell_header_size = Universe::heap()->cell_header_size();
-  size_t region_size = os::vm_page_size() + cell_header_size;
+  uintptr_t addr = reinterpret_cast<uintptr_t>(address);
+  uintptr_t page_size = (uintptr_t)os::vm_page_size();
 #ifdef _LP64
   if (UseCompressedOops && CompressedOops::base() != NULL) {
     // A SEGV can legitimately happen in C2 code at address
     // (heap_base + offset) if  Matcher::narrow_oop_use_complex_address
     // is configured to allow narrow oops field loads to be implicitly
     // null checked
-    intptr_t start = ((intptr_t)CompressedOops::base()) - cell_header_size;
-    intptr_t end = start + region_size;
-    if (int_address >= start && int_address < end) {
+    uintptr_t start = (uintptr_t)CompressedOops::base();
+    uintptr_t end = start + page_size;
+    if (addr >= start && addr < end) {
       return true;
     }
   }
 #endif
-  intptr_t start = -cell_header_size;
-  intptr_t end = start + region_size;
-  return int_address >= start && int_address < end;
+  return addr < page_size;
 }
 
 bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
@@ -341,12 +338,8 @@
   // with -1. Another example is GraphBuilder::access_field(...) which uses -1 as placeholder
   // for offsets to be patched in later. The -1 there means the offset is not yet known
   // and may lie outside of the zero-trapping page, and thus we need to ensure we're forcing
-  // an explicit null check for -1, even if it may otherwise be in the range
-  // [-cell_header_size, os::vm_page_size).
-  // TODO: Find and replace all relevant uses of -1 with a reasonably named constant.
-  if (offset == -1) return true;
+  // an explicit null check for -1.
 
-  // Check if offset is outside of [-cell_header_size, os::vm_page_size)
-  return offset < -Universe::heap()->cell_header_size() ||
-         offset >= os::vm_page_size();
+  // Check if offset is outside of [0, os::vm_page_size()]
+  return offset < 0 || offset >= os::vm_page_size();
 }
--- a/src/hotspot/share/classfile/classFileParser.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -4958,6 +4958,7 @@
 bool ClassFileParser::verify_unqualified_name(const char* name,
                                               unsigned int length,
                                               int type) {
+  if (length == 0) return false;  // Must have at least one char.
   for (const char* p = name; p != name + length; p++) {
     switch(*p) {
       case '.':
@@ -5107,7 +5108,7 @@
           int newlen = c - (char*) signature;
           bool legal = verify_unqualified_name(signature, newlen, LegalClass);
           if (!legal) {
-            classfile_parse_error("Class name contains illegal character "
+            classfile_parse_error("Class name is empty or contains illegal character "
                                   "in descriptor in class file %s",
                                   CHECK_0);
             return NULL;
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -2861,14 +2861,17 @@
 }
 
 TableStatistics SystemDictionary::placeholders_statistics() {
+  MutexLocker ml(SystemDictionary_lock);
   return placeholders()->statistics_calculate();
 }
 
 TableStatistics SystemDictionary::loader_constraints_statistics() {
+  MutexLocker ml(SystemDictionary_lock);
   return constraints()->statistics_calculate();
 }
 
 TableStatistics SystemDictionary::protection_domain_cache_statistics() {
+  MutexLocker ml(SystemDictionary_lock);
   return pd_cache_table()->statistics_calculate();
 }
 
--- a/src/hotspot/share/classfile/verifier.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/classfile/verifier.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -165,22 +165,28 @@
                            PerfClassTraceTime::CLASS_VERIFY);
 
   // If the class should be verified, first see if we can use the split
-  // verifier.  If not, or if verification fails and FailOverToOldVerifier
-  // is set, then call the inference verifier.
+  // verifier.  If not, or if verification fails and can failover, then
+  // call the inference verifier.
   Symbol* exception_name = NULL;
   const size_t message_buffer_len = klass->name()->utf8_length() + 1024;
   char* message_buffer = NULL;
   char* exception_message = NULL;
 
-  bool can_failover = FailOverToOldVerifier &&
-     klass->major_version() < NOFAILOVER_MAJOR_VERSION;
-
   log_info(class, init)("Start class verification for: %s", klass->external_name());
   if (klass->major_version() >= STACKMAP_ATTRIBUTE_MAJOR_VERSION) {
     ClassVerifier split_verifier(klass, THREAD);
     split_verifier.verify_class(THREAD);
     exception_name = split_verifier.result();
-    if (can_failover && !HAS_PENDING_EXCEPTION &&
+
+    // If DumpSharedSpaces is set then don't fall back to the old verifier on
+    // verification failure. If a class fails verification with the split verifier,
+    // it might fail the CDS runtime verifier constraint check. In that case, we
+    // don't want to share the class. We only archive classes that pass the split
+    // verifier.
+    bool can_failover = !DumpSharedSpaces &&
+      klass->major_version() < NOFAILOVER_MAJOR_VERSION;
+
+    if (can_failover && !HAS_PENDING_EXCEPTION &&  // Split verifier doesn't set PENDING_EXCEPTION for failure
         (exception_name == vmSymbols::java_lang_VerifyError() ||
          exception_name == vmSymbols::java_lang_ClassFormatError())) {
       log_info(verification)("Fail over class verification to old verifier for: %s", klass->external_name());
--- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -391,8 +391,6 @@
 #endif // !PRODUCT
 
 HeapWord* G1BlockOffsetTablePart::initialize_threshold_raw() {
-  assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array),
-         "just checking");
   _next_offset_index = _bot->index_for_raw(_space->bottom());
   _next_offset_index++;
   _next_offset_threshold =
@@ -401,8 +399,6 @@
 }
 
 void G1BlockOffsetTablePart::zero_bottom_entry_raw() {
-  assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array),
-         "just checking");
   size_t bottom_index = _bot->index_for_raw(_space->bottom());
   assert(_bot->address_for_index_raw(bottom_index) == _space->bottom(),
          "Precondition of call");
@@ -410,8 +406,6 @@
 }
 
 HeapWord* G1BlockOffsetTablePart::initialize_threshold() {
-  assert(!G1CollectedHeap::heap()->is_in_reserved(_bot->_offset_array),
-         "just checking");
   _next_offset_index = _bot->index_for(_space->bottom());
   _next_offset_index++;
   _next_offset_threshold =
--- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -52,7 +52,7 @@
 
   // Array for keeping offsets for retrieving object start fast given an
   // address.
-  u_char* _offset_array;          // byte array keeping backwards offsets
+  volatile u_char* _offset_array;  // byte array keeping backwards offsets
 
   void check_offset(size_t offset, const char* msg) const {
     assert(offset <= BOTConstants::N_words,
@@ -64,10 +64,7 @@
   // For performance these have to devolve to array accesses in product builds.
   inline u_char offset_array(size_t index) const;
 
-  void set_offset_array_raw(size_t index, u_char offset) {
-    _offset_array[index] = offset;
-  }
-
+  inline void set_offset_array_raw(size_t index, u_char offset);
   inline void set_offset_array(size_t index, u_char offset);
 
   inline void set_offset_array(size_t index, HeapWord* high, HeapWord* low);
--- a/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/g1/g1BlockOffsetTable.inline.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -29,6 +29,7 @@
 #include "gc/g1/heapRegion.hpp"
 #include "gc/shared/memset_with_concurrent_readers.hpp"
 #include "gc/shared/space.hpp"
+#include "runtime/atomic.hpp"
 
 inline HeapWord* G1BlockOffsetTablePart::block_start(const void* addr) {
   if (addr >= _space->bottom() && addr < _space->end()) {
@@ -51,7 +52,11 @@
 
 u_char G1BlockOffsetTable::offset_array(size_t index) const {
   check_index(index, "index out of range");
-  return _offset_array[index];
+  return Atomic::load(&_offset_array[index]);
+}
+
+void G1BlockOffsetTable::set_offset_array_raw(size_t index, u_char offset) {
+  Atomic::store(offset, &_offset_array[index]);
 }
 
 void G1BlockOffsetTable::set_offset_array(size_t index, u_char offset) {
@@ -71,7 +76,8 @@
   check_index(right, "right index out of range");
   assert(left <= right, "indexes out of order");
   size_t num_cards = right - left + 1;
-  memset_with_concurrent_readers(&_offset_array[left], offset, num_cards);
+  memset_with_concurrent_readers
+    (const_cast<u_char*> (&_offset_array[left]), offset, num_cards);
 }
 
 // Variant of index_for that does not check the index for validity.
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -534,11 +534,6 @@
 
   virtual size_t obj_size(oop obj) const;
 
-  // Cells are memory slices allocated by the allocator. Objects are initialized
-  // in cells. The cell itself may have a header, found at a negative offset of
-  // oops. Usually, the size of the cell header is 0, but it may be larger.
-  virtual ptrdiff_t cell_header_size() const { return 0; }
-
   // Non product verification and debugging.
 #ifndef PRODUCT
   // Support for PromotionFailureALot.  Return true if it's time to cause a
--- a/src/hotspot/share/gc/shared/gcLocker.inline.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shared/gcLocker.inline.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -26,7 +26,7 @@
 #define SHARE_GC_SHARED_GCLOCKER_INLINE_HPP
 
 #include "gc/shared/gcLocker.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
 
 void GCLocker::lock_critical(JavaThread* thread) {
   if (!thread->in_critical()) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentRoots.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+
+#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
+#include "gc/shenandoah/shenandoahHeap.inline.hpp"
+
+bool ShenandoahConcurrentRoots::can_do_concurrent_roots() {
+  // Don't support traversal GC at this moment
+  return !ShenandoahHeap::heap()->is_concurrent_traversal_in_progress();
+}
+
+bool ShenandoahConcurrentRoots::should_do_concurrent_roots() {
+  ShenandoahHeap* const heap = ShenandoahHeap::heap();
+  bool stw_gc_in_progress = heap->is_full_gc_in_progress() ||
+                            heap->is_degenerated_gc_in_progress();
+  return can_do_concurrent_roots() &&
+         !stw_gc_in_progress;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentRoots.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
+ *
+ * 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.
+ *
+ */
+
+#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP
+#define SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP
+
+#include "memory/allocation.hpp"
+
+class ShenandoahConcurrentRoots : public AllStatic {
+public:
+  // Can GC settings allow concurrent root processing
+  static bool can_do_concurrent_roots();
+  // If current GC cycle can process roots concurrently
+  static bool should_do_concurrent_roots();
+};
+
+
+#endif // SHARE_GC_SHENANDOAH_SHENANDOAHCONCURRENTROOTS_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -377,6 +377,9 @@
   // Complete marking under STW, and start evacuation
   heap->vmop_entry_final_mark();
 
+  // Evacuate concurrent roots
+  heap->entry_roots();
+
   // Final mark might have reclaimed some immediate garbage, kick cleanup to reclaim
   // the space. This would be the last action if there is nothing to evacuate.
   heap->entry_cleanup();
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -38,6 +38,7 @@
 #include "gc/shenandoah/shenandoahCollectionSet.hpp"
 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
 #include "gc/shenandoah/shenandoahConcurrentMark.inline.hpp"
+#include "gc/shenandoah/shenandoahConcurrentRoots.hpp"
 #include "gc/shenandoah/shenandoahControlThread.hpp"
 #include "gc/shenandoah/shenandoahFreeSet.hpp"
 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
@@ -1071,9 +1072,11 @@
   DerivedPointerTable::clear();
 #endif
   assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only iterate roots while world is stopped");
-
   {
-    ShenandoahRootEvacuator rp(workers()->active_workers(), ShenandoahPhaseTimings::init_evac);
+    // Include concurrent roots if current cycle can not process those roots concurrently
+    ShenandoahRootEvacuator rp(workers()->active_workers(),
+                               ShenandoahPhaseTimings::init_evac,
+                               !ShenandoahConcurrentRoots::should_do_concurrent_roots());
     ShenandoahEvacuateUpdateRootsTask roots_task(&rp);
     workers()->run_task(&roots_task);
   }
@@ -1276,14 +1279,14 @@
 
   Stack<oop,mtGC> oop_stack;
 
-  // First, we process all GC roots. This populates the work stack with initial objects.
-  ShenandoahAllRootScanner rp(1, ShenandoahPhaseTimings::_num_phases);
+  // First, we process GC roots according to current GC cycle. This populates the work stack with initial objects.
+  ShenandoahHeapIterationRootScanner rp;
   ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack);
 
   if (unload_classes()) {
-    rp.strong_roots_do_unchecked(&oops);
+    rp.strong_roots_do(&oops);
   } else {
-    rp.roots_do_unchecked(&oops);
+    rp.roots_do(&oops);
   }
 
   // Work through the oop stack to traverse heap.
@@ -1517,7 +1520,11 @@
       }
 
       if (ShenandoahVerify) {
-        verifier()->verify_roots_no_forwarded();
+        if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
+          verifier()->verify_roots_no_forwarded_except(ShenandoahRootVerifier::JNIHandleRoots);
+        } else {
+          verifier()->verify_roots_no_forwarded();
+        }
         verifier()->verify_during_evacuation();
       }
     } else {
@@ -1578,6 +1585,30 @@
   free_set()->recycle_trash();
 }
 
+class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask {
+private:
+  ShenandoahJNIHandleRoots<true /*concurrent*/> _jni_roots;
+
+public:
+  ShenandoahConcurrentRootsEvacUpdateTask() :
+    AbstractGangTask("Shenandoah Evacuate/Update Concurrent Roots Task") {
+  }
+
+  void work(uint worker_id) {
+    ShenandoahEvacOOMScope oom;
+    ShenandoahEvacuateUpdateRootsClosure cl;
+    _jni_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
+  }
+};
+
+void ShenandoahHeap::op_roots() {
+  if (is_evacuation_in_progress() &&
+      ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
+    ShenandoahConcurrentRootsEvacUpdateTask task;
+    workers()->run_task(&task);
+  }
+}
+
 void ShenandoahHeap::op_reset() {
   reset_mark_bitmap();
 }
@@ -2178,6 +2209,11 @@
     concurrent_mark()->update_thread_roots(ShenandoahPhaseTimings::final_update_refs_roots);
   }
 
+  // Has to be done before cset is clear
+  if (ShenandoahVerify) {
+    verifier()->verify_roots_in_to_space();
+  }
+
   ShenandoahGCPhase final_update_refs(ShenandoahPhaseTimings::final_update_refs_recycle);
 
   trash_cset_regions();
@@ -2185,7 +2221,6 @@
   set_update_refs_in_progress(false);
 
   if (ShenandoahVerify) {
-    verifier()->verify_roots_no_forwarded();
     verifier()->verify_after_updaterefs();
   }
 
@@ -2555,6 +2590,22 @@
   try_inject_alloc_failure();
   op_updaterefs();
 }
+
+void ShenandoahHeap::entry_roots() {
+  ShenandoahGCPhase phase(ShenandoahPhaseTimings::conc_roots);
+
+  static const char* msg = "Concurrent roots processing";
+  GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true);
+  EventMark em("%s", msg);
+
+  ShenandoahWorkerScope scope(workers(),
+                              ShenandoahWorkerPolicy::calc_workers_for_conc_root_processing(),
+                              "concurrent root processing");
+
+  try_inject_alloc_failure();
+  op_roots();
+}
+
 void ShenandoahHeap::entry_cleanup() {
   ShenandoahGCPhase phase(ShenandoahPhaseTimings::conc_cleanup);
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -391,6 +391,7 @@
   void entry_reset();
   void entry_mark();
   void entry_preclean();
+  void entry_roots();
   void entry_cleanup();
   void entry_evac();
   void entry_updaterefs();
@@ -414,6 +415,7 @@
   void op_reset();
   void op_mark();
   void op_preclean();
+  void op_roots();
   void op_cleanup();
   void op_conc_evac();
   void op_stw_evac();
--- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -306,6 +306,7 @@
   f(conc_mark,                                       "Concurrent Marking")              \
   f(conc_termination,                                "  Termination")                   \
   f(conc_preclean,                                   "Concurrent Precleaning")          \
+  f(conc_roots,                                      "Concurrent Roots")                \
   f(conc_evac,                                       "Concurrent Evacuation")           \
   f(conc_update_refs,                                "Concurrent Update Refs")          \
   f(conc_cleanup,                                    "Concurrent Cleanup")              \
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -71,10 +71,6 @@
   _jvmti_root.oops_do(cl, worker_id);
 }
 
-ShenandoahJNIHandleRoots::ShenandoahJNIHandleRoots() :
-  ShenandoahSerialRoot(&JNIHandles::oops_do, ShenandoahPhaseTimings::JNIRoots) {
-}
-
 ShenandoahThreadRoots::ShenandoahThreadRoots(bool is_par) : _is_par(is_par) {
   Threads::change_thread_claim_token();
 }
@@ -126,16 +122,6 @@
   }
 }
 
-ShenandoahClassLoaderDataRoots::ShenandoahClassLoaderDataRoots() {
-  ClassLoaderDataGraph::clear_claimed_marks();
-}
-
-void ShenandoahClassLoaderDataRoots::clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id) {
-  ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
-  ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id);
-  ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds);
-}
-
 ShenandoahRootProcessor::ShenandoahRootProcessor(ShenandoahPhaseTimings::Phase phase) :
   _heap(ShenandoahHeap::heap()),
   _phase(phase) {
@@ -148,21 +134,22 @@
   _heap->phase_timings()->record_workers_end(_phase);
 }
 
-ShenandoahRootEvacuator::ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
+ShenandoahRootEvacuator::ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots) :
   ShenandoahRootProcessor(phase),
   _thread_roots(n_workers > 1),
-  _weak_roots(n_workers) {
+  _weak_roots(n_workers),
+  _include_concurrent_roots(include_concurrent_roots) {
 }
 
 void ShenandoahRootEvacuator::roots_do(uint worker_id, OopClosure* oops) {
   MarkingCodeBlobClosure blobsCl(oops, CodeBlobToOopClosure::FixRelocations);
   CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
-  CLDToOopClosure* weak_clds = ShenandoahHeap::heap()->unload_classes() ? NULL : &clds;
-
   AlwaysTrueClosure always_true;
 
   _serial_roots.oops_do(oops, worker_id);
-  _jni_roots.oops_do(oops, worker_id);
+  if (_include_concurrent_roots) {
+    _jni_roots.oops_do<OopClosure>(oops, worker_id);
+  }
 
   _thread_roots.oops_do(oops, NULL, worker_id);
   _cld_roots.clds_do(&clds, &clds, worker_id);
@@ -201,3 +188,37 @@
   _weak_roots.oops_do<AlwaysTrueClosure, OopClosure>(&always_true, oops, worker_id);
   _dedup_roots.oops_do(&always_true, oops, worker_id);
 }
+
+ ShenandoahHeapIterationRootScanner::ShenandoahHeapIterationRootScanner() :
+   ShenandoahRootProcessor(ShenandoahPhaseTimings::_num_phases),
+   _thread_roots(false /*is par*/) {
+ }
+
+ void ShenandoahHeapIterationRootScanner::roots_do(OopClosure* oops) {
+   assert(Thread::current()->is_VM_thread(), "Only by VM thread");
+   // Must use _claim_none to avoid interfering with concurrent CLDG iteration
+   CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
+   MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
+   ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
+   ResourceMark rm;
+
+   _serial_roots.oops_do(oops, 0);
+   _jni_roots.oops_do(oops, 0);
+   _cld_roots.clds_do(&clds, &clds, 0);
+   _thread_roots.threads_do(&tc_cl, 0);
+   _code_roots.code_blobs_do(&code, 0);
+ }
+
+ void ShenandoahHeapIterationRootScanner::strong_roots_do(OopClosure* oops) {
+   assert(Thread::current()->is_VM_thread(), "Only by VM thread");
+   // Must use _claim_none to avoid interfering with concurrent CLDG iteration
+   CLDToOopClosure clds(oops, ClassLoaderData::_claim_none);
+   MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
+   ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
+   ResourceMark rm;
+
+   _serial_roots.oops_do(oops, 0);
+   _jni_roots.oops_do(oops, 0);
+   _cld_roots.clds_do(&clds, NULL, 0);
+   _thread_roots.threads_do(&tc_cl, 0);
+ }
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -61,9 +61,15 @@
   void oops_do(OopClosure* cl, uint worker_id);
 };
 
-class ShenandoahJNIHandleRoots : public ShenandoahSerialRoot {
+template <bool CONCURRENT>
+class ShenandoahJNIHandleRoots {
+private:
+  OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
 public:
   ShenandoahJNIHandleRoots();
+
+  template <typename T>
+  void oops_do(T* cl, uint worker_id = 0);
 };
 
 class ShenandoahThreadRoots {
@@ -108,6 +114,7 @@
   void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
 };
 
+template <bool SINGLE_THREADED>
 class ShenandoahClassLoaderDataRoots {
 public:
   ShenandoahClassLoaderDataRoots();
@@ -129,11 +136,11 @@
 template <typename ITR>
 class ShenandoahRootScanner : public ShenandoahRootProcessor {
 private:
-  ShenandoahSerialRoots          _serial_roots;
-  ShenandoahJNIHandleRoots       _jni_roots;
-  ShenandoahClassLoaderDataRoots _cld_roots;
-  ShenandoahThreadRoots          _thread_roots;
-  ShenandoahCodeCacheRoots<ITR>  _code_roots;
+  ShenandoahSerialRoots                                     _serial_roots;
+  ShenandoahThreadRoots                                     _thread_roots;
+  ShenandoahCodeCacheRoots<ITR>                             _code_roots;
+  ShenandoahJNIHandleRoots<false /*concurrent*/ >           _jni_roots;
+  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
 public:
   ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 
@@ -146,27 +153,42 @@
   // roots when class unloading is disabled during this cycle
   void roots_do(uint worker_id, OopClosure* cl);
   void roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc = NULL);
-  // For heap object iteration
-  void roots_do_unchecked(OopClosure* cl);
-  void strong_roots_do_unchecked(OopClosure* cl);
 };
 
 typedef ShenandoahRootScanner<ShenandoahAllCodeRootsIterator> ShenandoahAllRootScanner;
 typedef ShenandoahRootScanner<ShenandoahCsetCodeRootsIterator> ShenandoahCSetRootScanner;
 
+// This scanner is only for SH::object_iteration() and only supports single-threaded
+// root scanning
+class ShenandoahHeapIterationRootScanner : public ShenandoahRootProcessor {
+private:
+  ShenandoahSerialRoots                                    _serial_roots;
+  ShenandoahThreadRoots                                    _thread_roots;
+  ShenandoahJNIHandleRoots<false /*concurrent*/>           _jni_roots;
+  ShenandoahClassLoaderDataRoots<true /*single threaded*/> _cld_roots;
+  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
+
+public:
+  ShenandoahHeapIterationRootScanner();
+
+  void roots_do(OopClosure* cl);
+  void strong_roots_do(OopClosure* cl);
+};
+
 // Evacuate all roots at a safepoint
 class ShenandoahRootEvacuator : public ShenandoahRootProcessor {
 private:
-  ShenandoahSerialRoots          _serial_roots;
-  ShenandoahJNIHandleRoots       _jni_roots;
-  ShenandoahClassLoaderDataRoots _cld_roots;
-  ShenandoahThreadRoots          _thread_roots;
-  ShenandoahWeakRoots            _weak_roots;
-  ShenandoahStringDedupRoots     _dedup_roots;
+  ShenandoahSerialRoots                                     _serial_roots;
+  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
+  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
+  ShenandoahThreadRoots                                     _thread_roots;
+  ShenandoahWeakRoots                                       _weak_roots;
+  ShenandoahStringDedupRoots                                _dedup_roots;
   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
+  bool                                                      _include_concurrent_roots;
 
 public:
-  ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase);
+  ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots);
 
   void roots_do(uint worker_id, OopClosure* oops);
 };
@@ -174,14 +196,14 @@
 // Update all roots at a safepoint
 class ShenandoahRootUpdater : public ShenandoahRootProcessor {
 private:
-  ShenandoahSerialRoots          _serial_roots;
-  ShenandoahJNIHandleRoots       _jni_roots;
-  ShenandoahClassLoaderDataRoots _cld_roots;
-  ShenandoahThreadRoots          _thread_roots;
-  ShenandoahWeakRoots            _weak_roots;
-  ShenandoahStringDedupRoots     _dedup_roots;
+  ShenandoahSerialRoots                                     _serial_roots;
+  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
+  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
+  ShenandoahThreadRoots                                     _thread_roots;
+  ShenandoahWeakRoots                                       _weak_roots;
+  ShenandoahStringDedupRoots                                _dedup_roots;
   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
-  const bool                     _update_code_cache;
+  const bool                                                _update_code_cache;
 
 public:
   ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache);
@@ -193,13 +215,13 @@
 // Adjuster all roots at a safepoint during full gc
 class ShenandoahRootAdjuster : public ShenandoahRootProcessor {
 private:
-  ShenandoahSerialRoots          _serial_roots;
-  ShenandoahJNIHandleRoots       _jni_roots;
-  ShenandoahClassLoaderDataRoots _cld_roots;
-  ShenandoahThreadRoots          _thread_roots;
-  ShenandoahWeakRoots            _weak_roots;
-  ShenandoahStringDedupRoots     _dedup_roots;
-  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
+  ShenandoahSerialRoots                                     _serial_roots;
+  ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
+  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
+  ShenandoahThreadRoots                                     _thread_roots;
+  ShenandoahWeakRoots                                       _weak_roots;
+  ShenandoahStringDedupRoots                                _dedup_roots;
+  ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
 
 public:
   ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase);
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -24,17 +24,58 @@
 #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
 
+#include "classfile/classLoaderDataGraph.hpp"
+#include "gc/shared/oopStorageParState.inline.hpp"
 #include "gc/shenandoah/shenandoahHeuristics.hpp"
 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
 #include "gc/shenandoah/shenandoahUtils.hpp"
 #include "memory/resourceArea.hpp"
+#include "runtime/safepoint.hpp"
+
+template <bool CONCURRENT>
+ShenandoahJNIHandleRoots<CONCURRENT>::ShenandoahJNIHandleRoots() :
+  _itr(JNIHandles::global_handles()) {
+}
+
+template <bool CONCURRENT>
+template <typename T>
+void ShenandoahJNIHandleRoots<CONCURRENT>::oops_do(T* cl, uint worker_id) {
+  if (CONCURRENT) {
+    _itr.oops_do(cl);
+  } else {
+    ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
+    ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::JNIRoots, worker_id);
+    _itr.oops_do(cl);
+  }
+}
 
 template <typename IsAlive, typename KeepAlive>
 void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) {
   _task.work<IsAlive, KeepAlive>(worker_id, is_alive, keep_alive);
 }
 
+template <bool SINGLE_THREADED>
+ShenandoahClassLoaderDataRoots<SINGLE_THREADED>::ShenandoahClassLoaderDataRoots() {
+  if (!SINGLE_THREADED) {
+    ClassLoaderDataGraph::clear_claimed_marks();
+  }
+}
+
+template <bool SINGLE_THREADED>
+void ShenandoahClassLoaderDataRoots<SINGLE_THREADED>::clds_do(CLDClosure* strong_clds, CLDClosure* weak_clds, uint worker_id) {
+  if (SINGLE_THREADED) {
+    assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
+    assert(Thread::current()->is_VM_thread(), "Single threaded CLDG iteration can only be done by VM thread");
+
+    ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds);
+  } else {
+    ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
+    ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id);
+    ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds);
+  }
+}
+
 template <typename ITR>
 ShenandoahCodeCacheRoots<ITR>::ShenandoahCodeCacheRoots() {
   nmethod::oops_do_marking_prologue();
@@ -112,33 +153,6 @@
 }
 
 template <typename ITR>
-void ShenandoahRootScanner<ITR>::roots_do_unchecked(OopClosure* oops) {
-  CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
-  MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
-  ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
-  ResourceMark rm;
-
-  _serial_roots.oops_do(oops, 0);
-  _jni_roots.oops_do(oops, 0);
-  _cld_roots.clds_do(&clds, &clds, 0);
-  _thread_roots.threads_do(&tc_cl, 0);
-  _code_roots.code_blobs_do(&code, 0);
-}
-
-template <typename ITR>
-void ShenandoahRootScanner<ITR>::strong_roots_do_unchecked(OopClosure* oops) {
-  CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
-  MarkingCodeBlobClosure code(oops, !CodeBlobToOopClosure::FixRelocations);
-  ShenandoahParallelOopsDoThreadClosure tc_cl(oops, &code, NULL);
-  ResourceMark rm;
-
-  _serial_roots.oops_do(oops, 0);
-  _jni_roots.oops_do(oops, 0);
-  _cld_roots.clds_do(&clds, NULL, 0);
-  _thread_roots.threads_do(&tc_cl, 0);
-}
-
-template <typename ITR>
 void ShenandoahRootScanner<ITR>::strong_roots_do(uint worker_id, OopClosure* oops, CLDClosure* clds, CodeBlobClosure* code, ThreadClosure* tc) {
   assert(ShenandoahHeap::heap()->unload_classes(), "Should be used during class unloading");
   ShenandoahParallelOopsDoThreadClosure tc_cl(oops, code, tc);
--- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -964,6 +964,44 @@
   void do_oop(oop* p)       { do_oop_work(p); }
 };
 
+class ShenandoahVerifyInToSpaceClosure : public OopClosure {
+private:
+  template <class T>
+  void do_oop_work(T* p) {
+    T o = RawAccess<>::oop_load(p);
+    if (!CompressedOops::is_null(o)) {
+      oop obj = CompressedOops::decode_not_null(o);
+      ShenandoahHeap* heap = ShenandoahHeap::heap_no_check();
+
+      if (!heap->marking_context()->is_marked(obj)) {
+        ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL,
+                "Verify Roots In To-Space", "Should be marked", __FILE__, __LINE__);
+      }
+
+      if (heap->in_collection_set(obj)) {
+        ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL,
+                "Verify Roots In To-Space", "Should not be in collection set", __FILE__, __LINE__);
+      }
+
+      oop fwd = (oop) ShenandoahForwarding::get_forwardee_raw_unchecked(obj);
+      if (!oopDesc::equals_raw(obj, fwd)) {
+        ShenandoahAsserts::print_failure(ShenandoahAsserts::_safe_all, obj, p, NULL,
+                "Verify Roots In To-Space", "Should not be forwarded", __FILE__, __LINE__);
+      }
+    }
+  }
+
+public:
+  void do_oop(narrowOop* p) { do_oop_work(p); }
+  void do_oop(oop* p)       { do_oop_work(p); }
+};
+
+void ShenandoahVerifier::verify_roots_in_to_space() {
+  ShenandoahRootVerifier verifier;
+  ShenandoahVerifyInToSpaceClosure cl;
+  verifier.oops_do(&cl);
+}
+
 void ShenandoahVerifier::verify_roots_no_forwarded() {
   ShenandoahRootVerifier verifier;
   ShenandoahVerifyNoForwared cl;
--- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -189,6 +189,7 @@
   void verify_generic(VerifyOption option);
 
   // Roots should only contain to-space oops
+  void verify_roots_in_to_space();
   void verify_roots_no_forwarded();
   void verify_roots_no_forwarded_except(ShenandoahRootVerifier::RootTypes types);
 };
--- a/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -30,6 +30,7 @@
 uint ShenandoahWorkerPolicy::_prev_par_marking     = 0;
 uint ShenandoahWorkerPolicy::_prev_conc_marking    = 0;
 uint ShenandoahWorkerPolicy::_prev_conc_evac       = 0;
+uint ShenandoahWorkerPolicy::_prev_conc_root_proc  = 0;
 uint ShenandoahWorkerPolicy::_prev_fullgc          = 0;
 uint ShenandoahWorkerPolicy::_prev_degengc         = 0;
 uint ShenandoahWorkerPolicy::_prev_stw_traversal   = 0;
@@ -63,6 +64,16 @@
   return _prev_par_marking;
 }
 
+// Calculate workers for concurrent root processing
+uint ShenandoahWorkerPolicy::calc_workers_for_conc_root_processing() {
+  uint active_workers = (_prev_conc_root_proc == 0) ? ConcGCThreads : _prev_conc_root_proc;
+  _prev_conc_root_proc =
+    WorkerPolicy::calc_active_conc_workers(ConcGCThreads,
+                                           active_workers,
+                                           Threads::number_of_non_daemon_threads());
+  return _prev_conc_root_proc;
+}
+
 // Calculate workers for concurrent evacuation (concurrent GC)
 uint ShenandoahWorkerPolicy::calc_workers_for_conc_evac() {
   uint active_workers = (_prev_conc_evac == 0) ? ConcGCThreads : _prev_conc_evac;
--- a/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/gc/shenandoah/shenandoahWorkerPolicy.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -30,6 +30,7 @@
 private:
   static uint _prev_par_marking;
   static uint _prev_conc_marking;
+  static uint _prev_conc_root_proc;
   static uint _prev_conc_evac;
   static uint _prev_fullgc;
   static uint _prev_degengc;
@@ -50,6 +51,9 @@
   // Calculate the number of workers for final marking
   static uint calc_workers_for_final_marking();
 
+  // Calculate workers for concurrent root processing
+  static uint calc_workers_for_conc_root_processing();
+
   // Calculate workers for concurrent evacuation (concurrent GC)
   static uint calc_workers_for_conc_evac();
 
--- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -308,7 +308,8 @@
         BOXED_BOOLEAN(box, *(jbyte*) vmField.address);
         assert(box.is_non_null(), "must have a box");
       } else if (strcmp(vmField.typeString, "int") == 0 ||
-                 strcmp(vmField.typeString, "jint") == 0) {
+                 strcmp(vmField.typeString, "jint") == 0 ||
+                 strcmp(vmField.typeString, "uint32_t") == 0) {
         BOXED_LONG(box, *(jint*) vmField.address);
         assert(box.is_non_null(), "must have a box");
       } else if (strcmp(vmField.typeString, "uint64_t") == 0) {
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -691,10 +691,10 @@
 
 #endif
 
-// AARCH64 is defined in closed port, too. TARGET_ARCH_aarch64 is not.
-#ifdef TARGET_ARCH_aarch64
+#ifdef AARCH64
 
 #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
+  static_field(VM_Version, _psr_info.dczid_el0, uint32_t)               \
   volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*)
 
 #define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
--- a/src/hotspot/share/opto/library_call.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/opto/library_call.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -4501,8 +4501,8 @@
     ciMethod* trap_method = alloc->jvms()->method();
     int trap_bci = alloc->jvms()->bci();
 
-    if (!C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_intrinsic) &
-          !C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_null_check)) {
+    if (!C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_intrinsic) &&
+        !C->too_many_traps(trap_method, trap_bci, Deoptimization::Reason_null_check)) {
       // Make sure there's no store between the allocation and the
       // arraycopy otherwise visible side effects could be rexecuted
       // in case of deoptimization and cause incorrect execution.
--- a/src/hotspot/share/prims/jvmtiEnvBase.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/prims/jvmtiEnvBase.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -1083,7 +1083,7 @@
           // If the monitor has no owner, then a non-suspended contending
           // thread could potentially change the state of the monitor by
           // entering it. The JVM/TI spec doesn't allow this.
-          if (owning_thread == NULL && !at_safepoint &
+          if (owning_thread == NULL && !at_safepoint &&
               !pending_thread->is_thread_fully_suspended(true, &debug_bits)) {
             if (ret.owner != NULL) {
               destroy_jni_reference(calling_thread, ret.owner);
--- a/src/hotspot/share/runtime/arguments.cpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Jun 20 14:47:20 2019 -0400
@@ -533,7 +533,6 @@
   { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "UseMembar",                    JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() },
   { "CompilationPolicyChoice",      JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
-  { "FailOverToOldVerifier",        JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
   { "AllowJNIEnvProxy",             JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
   { "ThreadLocalHandshakes",        JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
   { "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
@@ -563,6 +562,7 @@
   { "ProfilerNumberOfRuntimeStubNodes", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
   { "UseImplicitStableValues",       JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
   { "NeedsDeoptSuspend",             JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "FailOverToOldVerifier",         JDK_Version::undefined(), JDK_Version::jdk(14), JDK_Version::jdk(15) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
   // These entries will generate build errors.  Their purpose is to test the macros.
@@ -3465,14 +3465,6 @@
 
 void Arguments::set_shared_spaces_flags() {
   if (DumpSharedSpaces) {
-    if (FailOverToOldVerifier) {
-      // Don't fall back to the old verifier on verification failure. If a
-      // class fails verification with the split verifier, it might fail the
-      // CDS runtime verifier constraint check. In that case, we don't want
-      // to share the class. We only archive classes that pass the split verifier.
-      FLAG_SET_DEFAULT(FailOverToOldVerifier, false);
-    }
-
     if (RequireSharedSpaces) {
       warning("Cannot dump shared archive while using shared archive");
     }
--- a/src/hotspot/share/runtime/globals.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/runtime/globals.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -405,9 +405,6 @@
   notproduct(bool, VerifyLastFrame, false,                                  \
           "Verify oops on last frame on entry to VM")                       \
                                                                             \
-  product(bool, FailOverToOldVerifier, true,                                \
-          "Fail over to old verifier when split verifier fails")            \
-                                                                            \
   product(bool, SafepointTimeout, false,                                    \
           "Time out and warn or fail after SafepointTimeoutDelay "          \
           "milliseconds if failed to reach safepoint")                      \
--- a/src/hotspot/share/runtime/vframe.inline.hpp	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/hotspot/share/runtime/vframe.inline.hpp	Thu Jun 20 14:47:20 2019 -0400
@@ -26,6 +26,7 @@
 #define SHARE_RUNTIME_VFRAME_INLINE_HPP
 
 #include "runtime/frame.inline.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vframe.hpp"
 
 inline vframeStreamCommon::vframeStreamCommon(JavaThread* thread) : _reg_map(thread, false) {
--- a/src/java.base/share/classes/java/lang/Integer.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.base/share/classes/java/lang/Integer.java	Thu Jun 20 14:47:20 2019 -0400
@@ -347,59 +347,53 @@
         int chars = Math.max(((mag + (shift - 1)) / shift), 1);
         if (COMPACT_STRINGS) {
             byte[] buf = new byte[chars];
-            formatUnsignedInt(val, shift, buf, 0, chars);
+            formatUnsignedInt(val, shift, buf, chars);
             return new String(buf, LATIN1);
         } else {
             byte[] buf = new byte[chars * 2];
-            formatUnsignedIntUTF16(val, shift, buf, 0, chars);
+            formatUnsignedIntUTF16(val, shift, buf, chars);
             return new String(buf, UTF16);
         }
     }
 
     /**
-     * Format an {@code int} (treated as unsigned) into a character buffer. If
+     * Format an {@code int} (treated as unsigned) into a byte buffer (LATIN1 version). If
      * {@code len} exceeds the formatted ASCII representation of {@code val},
      * {@code buf} will be padded with leading zeroes.
      *
      * @param val the unsigned int to format
      * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary)
-     * @param buf the character buffer to write to
-     * @param offset the offset in the destination buffer to start at
+     * @param buf the byte buffer to write to
      * @param len the number of characters to write
      */
-    static void formatUnsignedInt(int val, int shift, char[] buf, int offset, int len) {
-        // assert shift > 0 && shift <=5 : "Illegal shift value";
-        // assert offset >= 0 && offset < buf.length : "illegal offset";
-        // assert len > 0 && (offset + len) <= buf.length : "illegal length";
-        int charPos = offset + len;
-        int radix = 1 << shift;
-        int mask = radix - 1;
-        do {
-            buf[--charPos] = Integer.digits[val & mask];
-            val >>>= shift;
-        } while (charPos > offset);
-    }
-
-    /** byte[]/LATIN1 version    */
-    static void formatUnsignedInt(int val, int shift, byte[] buf, int offset, int len) {
-        int charPos = offset + len;
+    private static void formatUnsignedInt(int val, int shift, byte[] buf, int len) {
+        int charPos = len;
         int radix = 1 << shift;
         int mask = radix - 1;
         do {
             buf[--charPos] = (byte)Integer.digits[val & mask];
             val >>>= shift;
-        } while (charPos > offset);
+        } while (charPos > 0);
     }
 
-    /** byte[]/UTF16 version    */
-    private static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int offset, int len) {
-        int charPos = offset + len;
+    /**
+     * Format an {@code int} (treated as unsigned) into a byte buffer (UTF16 version). If
+     * {@code len} exceeds the formatted ASCII representation of {@code val},
+     * {@code buf} will be padded with leading zeroes.
+     *
+     * @param val the unsigned int to format
+     * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary)
+     * @param buf the byte buffer to write to
+     * @param len the number of characters to write
+     */
+    private static void formatUnsignedIntUTF16(int val, int shift, byte[] buf, int len) {
+        int charPos = len;
         int radix = 1 << shift;
         int mask = radix - 1;
         do {
             StringUTF16.putChar(buf, --charPos, Integer.digits[val & mask]);
             val >>>= shift;
-        } while (charPos > offset);
+        } while (charPos > 0);
     }
 
     static final byte[] DigitTens = {
@@ -698,7 +692,7 @@
      */
     public static int parseInt(CharSequence s, int beginIndex, int endIndex, int radix)
                 throws NumberFormatException {
-        s = Objects.requireNonNull(s);
+        Objects.requireNonNull(s);
 
         if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) {
             throw new IndexOutOfBoundsException();
@@ -881,7 +875,7 @@
      */
     public static int parseUnsignedInt(CharSequence s, int beginIndex, int endIndex, int radix)
                 throws NumberFormatException {
-        s = Objects.requireNonNull(s);
+        Objects.requireNonNull(s);
 
         if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) {
             throw new IndexOutOfBoundsException();
--- a/src/java.base/share/classes/java/lang/Long.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.base/share/classes/java/lang/Long.java	Thu Jun 20 14:47:20 2019 -0400
@@ -398,19 +398,17 @@
     }
 
     /**
-     * Format a long (treated as unsigned) into a character buffer. If
+     * Format a long (treated as unsigned) into a byte buffer (LATIN1 version). If
      * {@code len} exceeds the formatted ASCII representation of {@code val},
      * {@code buf} will be padded with leading zeroes.
      *
      * @param val the unsigned long to format
      * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary)
-     * @param buf the character buffer to write to
+     * @param buf the byte buffer to write to
      * @param offset the offset in the destination buffer to start at
      * @param len the number of characters to write
      */
-
-    /** byte[]/LATIN1 version    */
-    static void formatUnsignedLong0(long val, int shift, byte[] buf, int offset, int len) {
+    private static void formatUnsignedLong0(long val, int shift, byte[] buf, int offset, int len) {
         int charPos = offset + len;
         int radix = 1 << shift;
         int mask = radix - 1;
@@ -420,7 +418,17 @@
         } while (charPos > offset);
     }
 
-    /** byte[]/UTF16 version    */
+    /**
+     * Format a long (treated as unsigned) into a byte buffer (UTF16 version). If
+     * {@code len} exceeds the formatted ASCII representation of {@code val},
+     * {@code buf} will be padded with leading zeroes.
+     *
+     * @param val the unsigned long to format
+     * @param shift the log2 of the base to format in (4 for hex, 3 for octal, 1 for binary)
+     * @param buf the byte buffer to write to
+     * @param offset the offset in the destination buffer to start at
+     * @param len the number of characters to write
+     */
     private static void formatUnsignedLong0UTF16(long val, int shift, byte[] buf, int offset, int len) {
         int charPos = offset + len;
         int radix = 1 << shift;
@@ -739,7 +747,7 @@
      */
     public static long parseLong(CharSequence s, int beginIndex, int endIndex, int radix)
                 throws NumberFormatException {
-        s = Objects.requireNonNull(s);
+        Objects.requireNonNull(s);
 
         if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) {
             throw new IndexOutOfBoundsException();
@@ -985,7 +993,7 @@
      */
     public static long parseUnsignedLong(CharSequence s, int beginIndex, int endIndex, int radix)
                 throws NumberFormatException {
-        s = Objects.requireNonNull(s);
+        Objects.requireNonNull(s);
 
         if (beginIndex < 0 || beginIndex > endIndex || endIndex > s.length()) {
             throw new IndexOutOfBoundsException();
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Thu Jun 20 14:47:20 2019 -0400
@@ -38,6 +38,7 @@
 import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.BiFunction;
 import javax.net.ssl.HandshakeCompletedListener;
@@ -618,27 +619,76 @@
 
         // Need a lock here so that the user_canceled alert and the
         // close_notify alert can be delivered together.
-        conContext.outputRecord.recordLock.lock();
-        try {
+        int linger = getSoLinger();
+        if (linger >= 0) {
+            // don't wait more than SO_LINGER for obtaining the
+            // the lock.
+            //
+            // keep and clear the current thread interruption status.
+            boolean interrupted = Thread.interrupted();
             try {
-                // send a user_canceled alert if needed.
-                if (useUserCanceled) {
-                    conContext.warning(Alert.USER_CANCELED);
+                if (conContext.outputRecord.recordLock.tryLock() ||
+                        conContext.outputRecord.recordLock.tryLock(
+                                linger, TimeUnit.SECONDS)) {
+                    try {
+                        handleClosedNotifyAlert(useUserCanceled);
+                    } finally {
+                        conContext.outputRecord.recordLock.unlock();
+                    }
+                } else {
+                    // For layered, non-autoclose sockets, we are not
+                    // able to bring them into a usable state, so we
+                    // treat it as fatal error.
+                    if (!super.isOutputShutdown()) {
+                        if (isLayered() && !autoClose) {
+                            throw new SSLException(
+                                    "SO_LINGER timeout, " +
+                                    "close_notify message cannot be sent.");
+                        } else {
+                            super.shutdownOutput();
+                            if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
+                                SSLLogger.warning(
+                                    "SSLSocket output duplex close failed: " +
+                                    "SO_LINGER timeout, " +
+                                    "close_notify message cannot be sent.");
+                            }
+                        }
+                    }
+
+                    // RFC2246 requires that the session becomes
+                    // unresumable if any connection is terminated
+                    // without proper close_notify messages with
+                    // level equal to warning.
+                    //
+                    // RFC4346 no longer requires that a session not be
+                    // resumed if failure to properly close a connection.
+                    //
+                    // We choose to make the session unresumable if
+                    // failed to send the close_notify message.
+                    //
+                    conContext.conSession.invalidate();
+                    if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
+                        SSLLogger.warning(
+                                "Invalidate the session: SO_LINGER timeout, " +
+                                "close_notify message cannot be sent.");
+                    }
                 }
+            } catch (InterruptedException ex) {
+                // keep interrupted status
+                interrupted = true;
+            }
 
-                // send a close_notify alert
-                conContext.warning(Alert.CLOSE_NOTIFY);
+            // restore the interrupted status
+            if (interrupted) {
+                Thread.currentThread().interrupt();
+            }
+        } else {
+            conContext.outputRecord.recordLock.lock();
+            try {
+                handleClosedNotifyAlert(useUserCanceled);
             } finally {
-                if (!conContext.isOutboundClosed()) {
-                    conContext.outputRecord.close();
-                }
-
-                if ((autoClose || !isLayered()) && !super.isOutputShutdown()) {
-                    super.shutdownOutput();
-                }
+                conContext.outputRecord.recordLock.unlock();
             }
-        } finally {
-            conContext.outputRecord.recordLock.unlock();
         }
 
         if (!isInputShutdown()) {
@@ -646,6 +696,28 @@
         }
     }
 
+    private void handleClosedNotifyAlert(
+            boolean useUserCanceled) throws IOException {
+        try {
+            // send a user_canceled alert if needed.
+            if (useUserCanceled) {
+                conContext.warning(Alert.USER_CANCELED);
+            }
+
+            // send a close_notify alert
+            conContext.warning(Alert.CLOSE_NOTIFY);
+        } finally {
+            if (!conContext.isOutboundClosed()) {
+                conContext.outputRecord.close();
+            }
+
+            if (!super.isOutputShutdown() &&
+                    (autoClose || !isLayered())) {
+                super.shutdownOutput();
+            }
+        }
+    }
+
     /**
      * Duplex close, start from closing inbound.
      *
--- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Thu Jun 20 14:47:20 2019 -0400
@@ -2418,9 +2418,9 @@
         out.println(form.format(source));
         out.println();
 
-        for (Enumeration<String> e = keyStore.aliases();
-                                        e.hasMoreElements(); ) {
-            String alias = e.nextElement();
+        List<String> aliases = Collections.list(keyStore.aliases());
+        aliases.sort(String::compareTo);
+        for (String alias : aliases) {
             doPrintEntry("<" + alias + ">", alias, out);
             if (verbose || rfc) {
                 out.println(rb.getString("NEWLINE"));
--- a/src/java.base/unix/native/libjava/ProcessImpl_md.c	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c	Thu Jun 20 14:47:20 2019 -0400
@@ -354,6 +354,27 @@
     free(errmsg);
 }
 
+/**
+ * Throws an IOException with a message composed from the result of waitpid status.
+ */
+static void throwExitCause(JNIEnv *env, int pid, int status) {
+    char ebuf[128];
+    if (WIFEXITED(status)) {
+        snprintf(ebuf, sizeof ebuf,
+            "Failed to exec spawn helper: pid: %d, exit value: %d",
+            pid, WEXITSTATUS(status));
+    } else if (WIFSIGNALED(status)) {
+        snprintf(ebuf, sizeof ebuf,
+            "Failed to exec spawn helper: pid: %d, signal: %d",
+            pid, WTERMSIG(status));
+    } else {
+        snprintf(ebuf, sizeof ebuf,
+            "Failed to exec spawn helper: pid: %d, status: 0x%08x",
+            pid, status);
+    }
+    throwIOException(env, 0, ebuf);
+}
+
 #ifdef DEBUG_PROCESS
 /* Debugging process code is difficult; where to write debug output? */
 static void
@@ -690,9 +711,12 @@
     if (c->sendAlivePing) {
         switch(readFully(fail[0], &errnum, sizeof(errnum))) {
         case 0: /* First exec failed; */
-            waitpid(resultPid, NULL, 0);
-            throwIOException(env, 0, "Failed to exec spawn helper.");
-            goto Catch;
+            {
+                int tmpStatus = 0;
+                int p = waitpid(resultPid, &tmpStatus, 0);
+                throwExitCause(env, p, tmpStatus);
+                goto Catch;
+            }
         case sizeof(errnum):
             assert(errnum == CHILD_IS_ALIVE);
             if (errnum != CHILD_IS_ALIVE) {
@@ -700,7 +724,7 @@
                  * helper should do is to send an alive ping to the parent,
                  * before doing any subsequent work. */
                 throwIOException(env, 0, "Bad code from spawn helper "
-                                         "(Failed to exec spawn helper.");
+                                         "(Failed to exec spawn helper)");
                 goto Catch;
             }
             break;
--- a/src/java.net.http/share/classes/java/net/http/HttpResponse.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.net.http/share/classes/java/net/http/HttpResponse.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1253,7 +1253,7 @@
         /**
          * Returns a {@code BodySubscriber} which buffers data before delivering
          * it to the given downstream subscriber. The subscriber guarantees to
-         * deliver {@code buffersize} bytes of data to each invocation of the
+         * deliver {@code bufferSize} bytes of data to each invocation of the
          * downstream's {@link BodySubscriber#onNext(Object) onNext} method,
          * except for the final invocation, just before
          * {@link BodySubscriber#onComplete() onComplete} is invoked. The final
--- a/src/java.net.http/share/classes/jdk/internal/net/http/LineSubscriberAdapter.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/LineSubscriberAdapter.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, 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
@@ -40,6 +40,7 @@
 import java.util.concurrent.Flow;
 import java.util.concurrent.Flow.Subscriber;
 import java.util.concurrent.Flow.Subscription;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Function;
@@ -56,6 +57,7 @@
     private final Function<? super S, ? extends R> finisher;
     private final Charset charset;
     private final String eol;
+    private final AtomicBoolean subscribed = new AtomicBoolean();
     private volatile LineSubscription downstream;
 
     private LineSubscriberAdapter(S subscriber,
@@ -72,6 +74,12 @@
 
     @Override
     public void onSubscribe(Subscription subscription) {
+        Objects.requireNonNull(subscription);
+        if (!subscribed.compareAndSet(false, true)) {
+            subscription.cancel();
+            return;
+        }
+
         downstream = LineSubscription.create(subscription,
                                              charset,
                                              eol,
@@ -82,6 +90,7 @@
 
     @Override
     public void onNext(List<ByteBuffer> item) {
+        Objects.requireNonNull(item);
         try {
             downstream.submit(item);
         } catch (Throwable t) {
@@ -91,6 +100,7 @@
 
     @Override
     public void onError(Throwable throwable) {
+        Objects.requireNonNull(throwable);
         try {
             downstream.signalError(throwable);
         } finally {
--- a/src/java.net.http/share/classes/jdk/internal/net/http/PullPublisher.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/PullPublisher.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -103,11 +103,19 @@
                 }
 
                 while (demand.tryDecrement() && !cancelled) {
-                    if (!iter.hasNext()) {
-                        break;
-                    } else {
-                        subscriber.onNext(iter.next());
+                    T next;
+                    try {
+                        if (!iter.hasNext()) {
+                            break;
+                        }
+                        next = iter.next();
+                    } catch (Throwable t1) {
+                        completed = true;
+                        pullScheduler.stop();
+                        subscriber.onError(t1);
+                        return;
                     }
+                    subscriber.onNext(next);
                 }
                 if (!iter.hasNext() && !cancelled) {
                     completed = true;
@@ -123,7 +131,7 @@
                 return;  // no-op
 
             if (n <= 0) {
-                error = new IllegalArgumentException("illegal non-positive request:" + n);
+                error = new IllegalArgumentException("non-positive subscription request: " + n);
             } else {
                 demand.increase(n);
             }
--- a/src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/RequestPublishers.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, 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
@@ -271,12 +271,13 @@
 
         @Override
         public void subscribe(Flow.Subscriber<? super ByteBuffer> subscriber) {
-            InputStream is;
+            InputStream is = null;
+            Throwable t = null;
             if (System.getSecurityManager() == null) {
                 try {
                     is = new FileInputStream(file);
                 } catch (IOException ioe) {
-                    throw new UncheckedIOException(ioe);
+                    t = ioe;
                 }
             } else {
                 try {
@@ -284,11 +285,16 @@
                             () -> new FileInputStream(file);
                     is = AccessController.doPrivileged(pa, null, filePermissions);
                 } catch (PrivilegedActionException pae) {
-                    throw new UncheckedIOException((IOException) pae.getCause());
+                    t = pae.getCause();
                 }
             }
-            PullPublisher<ByteBuffer> publisher =
-                    new PullPublisher<>(() -> new StreamIterator(is));
+            final InputStream fis = is;
+            PullPublisher<ByteBuffer> publisher;
+            if (t == null) {
+                publisher = new PullPublisher<>(() -> new StreamIterator(fis));
+            } else {
+                publisher = new PullPublisher<>(null, t);
+            }
             publisher.subscribe(subscriber);
         }
 
--- a/src/java.net.http/share/classes/jdk/internal/net/http/ResponseSubscribers.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/ResponseSubscribers.java	Thu Jun 20 14:47:20 2019 -0400
@@ -125,6 +125,7 @@
 
         @Override
         public void onSubscribe(Flow.Subscription subscription) {
+            Objects.requireNonNull(subscription);
             if (!subscribed.compareAndSet(false, true)) {
                 subscription.cancel();
             } else {
@@ -135,6 +136,7 @@
 
         @Override
         public void onNext(List<ByteBuffer> items) {
+            Objects.requireNonNull(items);
             for (ByteBuffer item : items) {
                 byte[] buf = new byte[item.remaining()];
                 item.get(buf);
@@ -145,6 +147,7 @@
 
         @Override
         public void onError(Throwable throwable) {
+            Objects.requireNonNull(throwable);
             result.completeExceptionally(throwable);
         }
 
@@ -172,6 +175,7 @@
         private final FilePermission[] filePermissions;
         private final CompletableFuture<Path> result = new MinimalFuture<>();
 
+        private final AtomicBoolean subscribed = new AtomicBoolean();
         private volatile Flow.Subscription subscription;
         private volatile FileChannel out;
 
@@ -211,6 +215,12 @@
 
         @Override
         public void onSubscribe(Flow.Subscription subscription) {
+            Objects.requireNonNull(subscription);
+            if (!subscribed.compareAndSet(false, true)) {
+                subscription.cancel();
+                return;
+            }
+
             this.subscription = subscription;
             if (System.getSecurityManager() == null) {
                 try {
@@ -470,6 +480,7 @@
 
         @Override
         public void onSubscribe(Flow.Subscription s) {
+            Objects.requireNonNull(s);
             try {
                 if (!subscribed.compareAndSet(false, true)) {
                     s.cancel();
@@ -600,6 +611,7 @@
 
         @Override
         public void onSubscribe(Flow.Subscription subscription) {
+            Objects.requireNonNull(subscription);
             if (!subscribed.compareAndSet(false, true)) {
                 subscription.cancel();
             } else {
@@ -614,6 +626,7 @@
 
         @Override
         public void onError(Throwable throwable) {
+            Objects.requireNonNull(throwable);
             cf.completeExceptionally(throwable);
         }
 
@@ -907,13 +920,21 @@
             }
         }
 
+        private final AtomicBoolean subscribed = new AtomicBoolean();
+
         @Override
         public void onSubscribe(Flow.Subscription subscription) {
-            subscriptionCF.complete(subscription);
+            Objects.requireNonNull(subscription);
+            if (!subscribed.compareAndSet(false, true)) {
+                subscription.cancel();
+            } else {
+                subscriptionCF.complete(subscription);
+            }
         }
 
         @Override
         public void onNext(List<ByteBuffer> item) {
+            Objects.requireNonNull(item);
             try {
                 // cannot be called before onSubscribe()
                 assert subscriptionCF.isDone();
@@ -941,6 +962,7 @@
             // onError can be called before request(1), and therefore can
             // be called before subscriberRef is set.
             signalError(throwable);
+            Objects.requireNonNull(throwable);
         }
 
         @Override
--- a/src/java.sql.rowset/share/classes/com/sun/rowset/providers/RIXMLProvider.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.sql.rowset/share/classes/com/sun/rowset/providers/RIXMLProvider.java	Thu Jun 20 14:47:20 2019 -0400
@@ -46,7 +46,7 @@
  * to read an XML data source or to write itself in XML format using the
  * <code>WebRowSet</code> XML schema definition available at
  * <pre>
- *     <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">http://java.sun.com/xml/ns/jdbc/webrowset.xsd</a>
+ *     <a href="http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd">http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd</a>
  * </pre>
  * The <code>RIXMLProvider</code> implementation has a synchronization level of
  * GRADE_NONE, which means that it does no checking at all for conflicts.  It
--- a/src/java.sql.rowset/share/classes/javax/sql/rowset/WebRowSet.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/WebRowSet.java	Thu Jun 20 14:47:20 2019 -0400
@@ -44,7 +44,7 @@
  * URI:
  * <ul>
  * <li>
- * <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">http://java.sun.com/xml/ns/jdbc/webrowset.xsd</a>
+ * <a href="http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd">http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd</a>
  * </li>
  * </ul>
  * It describes the standard XML document format required when describing a
--- a/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java	Thu Jun 20 14:47:20 2019 -0400
@@ -95,8 +95,8 @@
  * <code>SyncFactory</code> in the form of <code>SyncProvider</code>
  * implementations. In order to ensure well formed XML usage, a standard generic XML
  * Schema is defined and published at
- * <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">
- * <code>http://java.sun.com/xml/ns/jdbc/webrowset.xsd</code></a>.
+ * <a href="http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd">
+ * <code>http://xmlns.jcp.org/xml/ns//jdbc/webrowset.xsd</code></a>.
  *
  * <li><a href="FilteredRowSet.html"><b><code>FilteredRowSet</code></b></a> - A
  * <code>FilteredRowSet</code> object provides filtering functionality in a programmatic
@@ -154,7 +154,8 @@
  * <code>RowSet</code> objects exist in a connected or disconnected environment.
  * The <code>BaseRowSet</code> abstract class provides any <code>RowSet</code> implementation
  * with its base functionality, including property manipulation and event notification
- * that is fully compliant with <a href="http://java.sun.com/products/javabeans">JavaBeans</a>
+ * that is fully compliant with
+ * <a href="https://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html">JavaBeans</a>
  * component requirements. As an example, all implementations provided in the
  * reference implementations (contained in the <code>com.sun.rowset</code> package) use
  * the <code>BaseRowSet</code> class as a basis for their implementations.
--- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java	Thu Jun 20 14:47:20 2019 -0400
@@ -233,7 +233,7 @@
      * InputStream for the socket connection to get target VM
      */
     private class SocketInputStream extends InputStream {
-        int s;
+        int s = -1;
 
         public SocketInputStream(int s) {
             this.s = s;
@@ -261,7 +261,12 @@
         }
 
         public void close() throws IOException {
-            VirtualMachineImpl.close(s);
+            synchronized (this) {
+                if (s != -1) {
+                    VirtualMachineImpl.close(s);
+                    s = -1;
+                }
+            }
         }
     }
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java	Thu Jun 20 14:47:20 2019 -0400
@@ -477,7 +477,7 @@
         }
 
         try (InputStream in = getClass().getResourceAsStream('/' + className.replace('.', '/') + ".class")) {
-            final String algorithm = "MD5";
+            final String algorithm = "SHA-256";
             byte[] digest;
             MessageDigest md = MessageDigest.getInstance(algorithm);
             try (DigestInputStream din = new DigestInputStream(in, md)) {
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_general.c	Thu Jun 20 14:47:20 2019 -0400
@@ -51,6 +51,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
+#include "jlong.h"
 
 #include "sun_security_pkcs11_wrapper_PKCS11.h"
 
@@ -96,8 +97,8 @@
 Java_sun_security_pkcs11_wrapper_PKCS11_freeMechanism
 (JNIEnv *env, jclass thisClass, jlong ckpMechanism) {
     if (ckpMechanism != 0L) {
-        freeCKMechanismPtr((CK_MECHANISM_PTR) ckpMechanism);
-        TRACE1("DEBUG PKCS11_freeMechanism: free pMech = %x\n", (jlong)ckpMechanism);
+        freeCKMechanismPtr(jlong_to_ptr(ckpMechanism));
+        TRACE1("DEBUG PKCS11_freeMechanism: free pMech = %x\n", ckpMechanism);
     }
     return 0L;
 }
--- a/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/p11_sign.c	Thu Jun 20 14:47:20 2019 -0400
@@ -91,8 +91,8 @@
             (ckpMechanism->pParameter == NULL)) {
         freeCKMechanismPtr(ckpMechanism);
     } else {
-        (*env)->SetLongField(env, jMechanism, mech_pHandleID, (jlong)ckpMechanism);
-        TRACE1("DEBUG C_SignInit: stored pMech = 0x%lX\n", (jlong)ckpMechanism);
+        (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism));
+        TRACE1("DEBUG C_SignInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism));
     }
     TRACE0("FINISHED\n");
 }
@@ -303,8 +303,8 @@
             (ckpMechanism->pParameter == NULL)) {
         freeCKMechanismPtr(ckpMechanism);
     } else {
-        (*env)->SetLongField(env, jMechanism, mech_pHandleID, (jlong)ckpMechanism);
-        TRACE1("DEBUG C_SignRecoverInit, stored pMech = 0x%lX\n", (jlong)ckpMechanism);
+        (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism));
+        TRACE1("DEBUG C_SignRecoverInit, stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism));
     }
     TRACE0("FINISHED\n");
 }
@@ -413,8 +413,8 @@
             (ckpMechanism->pParameter == NULL)) {
         freeCKMechanismPtr(ckpMechanism);
     } else {
-        (*env)->SetLongField(env, jMechanism, mech_pHandleID, (jlong)ckpMechanism);
-        TRACE1("DEBUG C_VerifyInit: stored pMech = 0x%lX\n", (jlong)ckpMechanism);
+        (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism));
+        TRACE1("DEBUG C_VerifyInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism));
     }
     TRACE0("FINISHED\n");
 }
@@ -601,8 +601,8 @@
             (ckpMechanism->pParameter == NULL)) {
         freeCKMechanismPtr(ckpMechanism);
     } else {
-        (*env)->SetLongField(env, jMechanism, mech_pHandleID, (jlong)ckpMechanism);
-        TRACE1("DEBUG C_VerifyRecoverInit: stored pMech = 0x%lX\n", (jlong)ckpMechanism);
+        (*env)->SetLongField(env, jMechanism, mech_pHandleID, ptr_to_jlong(ckpMechanism));
+        TRACE1("DEBUG C_VerifyRecoverInit: stored pMech = 0x%lX\n", ptr_to_jlong(ckpMechanism));
     }
     TRACE0("FINISHED\n");
 }
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Thu Jun 20 14:47:20 2019 -0400
@@ -839,8 +839,51 @@
 #define LD_BASE_OFFSET        offsetof(struct r_debug,  r_ldbase)
 #define LINK_MAP_ADDR_OFFSET  offsetof(struct link_map, l_addr)
 #define LINK_MAP_NAME_OFFSET  offsetof(struct link_map, l_name)
+#define LINK_MAP_LD_OFFSET    offsetof(struct link_map, l_ld)
 #define LINK_MAP_NEXT_OFFSET  offsetof(struct link_map, l_next)
 
+// Calculate the load address of shared library
+// on prelink-enabled environment.
+//
+// In case of GDB, it would be calculated by offset of link_map.l_ld
+// and the address of .dynamic section.
+// See GDB implementation: lm_addr_check @ solib-svr4.c
+static uintptr_t calc_prelinked_load_address(struct ps_prochandle* ph, int lib_fd, ELF_EHDR* elf_ehdr, uintptr_t link_map_addr) {
+  ELF_PHDR *phbuf;
+  uintptr_t lib_ld;
+  uintptr_t lib_dyn_addr = 0L;
+  uintptr_t load_addr;
+  int i;
+
+  phbuf = read_program_header_table(lib_fd, elf_ehdr);
+  if (phbuf == NULL) {
+    print_debug("can't read program header of shared object\n");
+    return 0L;
+  }
+
+  // Get the address of .dynamic section from shared library.
+  for (i = 0; i < elf_ehdr->e_phnum; i++) {
+    if (phbuf[i].p_type == PT_DYNAMIC) {
+      lib_dyn_addr = phbuf[i].p_vaddr;
+      break;
+    }
+  }
+
+  free(phbuf);
+
+  if (ps_pdread(ph, (psaddr_t)link_map_addr + LINK_MAP_LD_OFFSET,
+               &lib_ld, sizeof(uintptr_t)) != PS_OK) {
+    print_debug("can't read address of dynamic section in shared object\n");
+    return 0L;
+  }
+
+  // Return the load address which is calculated by the address of .dynamic
+  // and link_map.l_ld .
+  load_addr = lib_ld - lib_dyn_addr;
+  print_debug("lib_ld = 0x%lx, lib_dyn_addr = 0x%lx -> lib_base_diff = 0x%lx\n", lib_ld, lib_dyn_addr, load_addr);
+  return load_addr;
+}
+
 // read shared library info from runtime linker's data structures.
 // This work is done by librtlb_db in Solaris
 static bool read_shared_lib_info(struct ps_prochandle* ph) {
@@ -942,6 +985,14 @@
             // continue with other libraries...
          } else {
             if (read_elf_header(lib_fd, &elf_ehdr)) {
+               if (lib_base_diff == 0x0L) {
+                 lib_base_diff = calc_prelinked_load_address(ph, lib_fd, &elf_ehdr, link_map_addr);
+                 if (lib_base_diff == 0x0L) {
+                   close(lib_fd);
+                   return false;
+                 }
+               }
+
                lib_base = lib_base_diff + find_base_address(lib_fd, &elf_ehdr);
                print_debug("reading library %s @ 0x%lx [ 0x%lx ]\n",
                            lib_name, lib_base, lib_base_diff);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/shared/CollectedHeap.java	Thu Jun 20 14:47:20 2019 -0400
@@ -64,8 +64,6 @@
   public abstract long capacity();
   public abstract long used();
 
-  public long oopOffset() { return 0; }
-
   public MemRegion reservedRegion() {
     return new MemRegion(addr.addOffsetTo(reservedFieldOffset));
   }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Thu Jun 20 14:47:20 2019 -0400
@@ -256,8 +256,6 @@
 
         while (handle.lessThan(top)) {
           Oop obj = null;
-          // Raw pointer walk
-          handle = handle.addOffsetToAsOopHandle(heap.oopOffset());
 
           try {
             obj = newOop(handle);
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/JavapTask.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, 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
@@ -808,7 +808,7 @@
             MessageDigest md  = null;
             if (options.sysInfo || options.verbose) {
                 try {
-                    md = MessageDigest.getInstance("MD5");
+                    md = MessageDigest.getInstance("SHA-256");
                 } catch (NoSuchAlgorithmException ignore) {
                 }
                 in = new DigestInputStream(in, md);
@@ -829,7 +829,7 @@
         if (options.sysInfo || options.verbose) {
             classWriter.setFile(info.fo.toUri());
             classWriter.setLastModified(info.fo.getLastModified());
-            classWriter.setDigest("MD5", info.digest);
+            classWriter.setDigest("SHA-256", info.digest);
             classWriter.setFileSize(info.size);
         }
 
--- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties	Thu Jun 20 14:13:50 2019 -0400
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap.properties	Thu Jun 20 14:47:20 2019 -0400
@@ -99,7 +99,7 @@
 \  -constants                       Show final constants
 
 main.opt.sysinfo=\
-\  -sysinfo                         Show system info (path, size, date, MD5 hash)\n\
+\  -sysinfo                         Show system info (path, size, date, SHA-256 hash)\n\
 \                                   of class being processed
 
 main.opt.module=\
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Thu Jun 20 14:47:20 2019 -0400
@@ -43,8 +43,6 @@
 
 compiler/graalunit/JttThreadsTest.java                          8207757   generic-all
 
-compiler/jvmci/SecurityRestrictionsTest.java                    8181837   generic-all
-
 compiler/unsafe/UnsafeGetConstantField.java                     8181833   generic-all
 compiler/unsafe/UnsafeGetStableArrayElement.java                8181833   generic-all
 compiler/unsafe/UnsafeOffHeapBooleanTest.java                   8181833   generic-all
@@ -62,7 +60,7 @@
 gc/g1/TestPeriodicCollection.java                               8196611   generic-all
 gc/g1/TestFromCardCacheIndex.java                               8196611   generic-all
 gc/parallel/TestPrintGCDetailsVerbose.java                      8196611   generic-all
-vm/gc/InfiniteList.java                                         8196611   generic-all
+gc/InfiniteList.java                                            8196611   generic-all
 
 vmTestbase/gc/lock/jni/jnilock001/TestDescription.java          8196611   generic-all
 vmTestbase/gc/lock/jniref/jnireflock04/TestDescription.java     8196611   generic-all
@@ -149,16 +147,16 @@
 # jvmti tests
 vmTestbase/nsk/jvmti/PopFrame/popframe009/TestDescription.java                     8195639   generic-all
 
-vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java     8195674   generic-all
-vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java     8195674   generic-all
+vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java     8195674,8195635   generic-all
+vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java     8195674,8195635   generic-all
 
 runtime/appcds/cacheObject/RedefineClassTest.java                                  8204506   macosx-all
-vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java        8204506   macosx-all
+vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java        8204506,8195635   macosx-all,generic-all
 vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002/TestDescription.java        8204506   macosx-all
 
-vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java                     8207013   generic-all
-vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java                     8207013   generic-all
-vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java                     8207013   generic-all
+vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java                     8207013,8195635   generic-all
+vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java                     8207013,8195635   generic-all
+vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java                     8207013,8195635   generic-all
 vmTestbase/nsk/jvmti/StopThread/stopthrd007/TestDescription.java                   8207013   generic-all
 
 serviceability/jvmti/FieldAccessWatch/FieldAccessWatch.java                        8202482   generic-all
@@ -176,7 +174,6 @@
 vmTestbase/nsk/jdi/BScenarios/hotswap/tc08x001/TestDescription.java                               8195635 generic-all
 vmTestbase/nsk/jdi/BScenarios/hotswap/tc10x002/TestDescription.java                               8195635 generic-all
 vmTestbase/nsk/jdi/MethodExitEvent/returnValue/returnValue003/returnValue003.java                 8195635 generic-all
-vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.jav                        8195635 generic-all
 vmTestbase/nsk/jdi/Scenarios/invokeMethod/popframes001/TestDescription.java                       8195635 generic-all
 vmTestbase/nsk/jdi/ThreadReference/popFrames/popframes001/TestDescription.java                    8195635 generic-all
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses002/TestDescription.java         8195635 generic-all
@@ -184,14 +181,8 @@
 vmTestbase/nsk/jdi/stress/serial/forceEarlyReturn002/TestDescription.java                         8195635 generic-all
 vmTestbase/nsk/jdi/stress/serial/mixed002/TestDescription.java                                    8195635 generic-all
 vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java 8195635 generic-all
-vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java                    8195635 generic-all
-vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java                    8195635 generic-all
-vmTestbase/nsk/jvmti/PopFrame/popframe001/TestDescription.java                                    8195635 generic-all
-vmTestbase/nsk/jvmti/PopFrame/popframe003/TestDescription.java                                    8195635 generic-all
-vmTestbase/nsk/jvmti/PopFrame/popframe005/TestDescription.java                                    8195635 generic-all
 vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/TestDescription.java                      8195635 generic-all
 vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java                      8195635 generic-all
-vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001/TestDescription.java                       8195635 generic-all
 vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/TestDescription.java                       8195635 generic-all
 vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java                       8195635 generic-all
 vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.java                             8195635 generic-all
--- a/test/hotspot/jtreg/ProblemList.txt	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/hotspot/jtreg/ProblemList.txt	Thu Jun 20 14:47:20 2019 -0400
@@ -49,8 +49,8 @@
 compiler/jvmci/compilerToVM/InvalidateInstalledCodeTest.java 8163894 generic-all
 compiler/tiered/LevelTransitionTest.java 8067651 generic-all
 
-compiler/types/correctness/CorrectnessTest.java 8225620 solaris-sparcv9
-compiler/types/correctness/OffTest.java         8225620 solaris-sparcv9
+compiler/types/correctness/CorrectnessTest.java 8225670,8225620 generic-all,solaris-sparcv9
+compiler/types/correctness/OffTest.java         8225670,8225620 generic-all,solaris-sparcv9
 
 compiler/c2/Test6852078.java 8194310 generic-all
 compiler/c2/Test8004741.java 8214904 generic-all
@@ -80,7 +80,6 @@
 
 # :hotspot_runtime
 
-runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all
 runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64
 
 #############################################################################
@@ -107,8 +106,6 @@
 serviceability/sa/ClhsdbRegionDetailsScanOopsForG1.java 8193639 solaris-all
 serviceability/sa/ClhsdbScanOops.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
 serviceability/sa/ClhsdbSource.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
-serviceability/sa/ClhsdbSymbol.java 8193639 solaris-all
-serviceability/sa/ClhsdbSymbolTable.java 8193639 solaris-all
 serviceability/sa/ClhsdbThread.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
 serviceability/sa/ClhsdbVmStructsDump.java 8193639 solaris-all
 serviceability/sa/ClhsdbWhere.java 8193639,8211767 solaris-all,linux-ppc64le,linux-ppc64
--- a/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/hotspot/jtreg/compiler/compilercontrol/share/scenario/Command.java	Thu Jun 20 14:47:20 2019 -0400
@@ -33,8 +33,8 @@
 public enum Command {
     COMPILEONLY("compileonly", ".*", "-Xbatch"),
     EXCLUDE("exclude", "", "-Xbatch"),
-    INLINE("inline", ".*", "-Xbatch"),
-    DONTINLINE("dontinline", "", "-Xbatch"),
+    INLINE("inline", ".*", "-Xbatch", "-XX:InlineSmallCode=4000"),
+    DONTINLINE("dontinline", "", "-Xbatch", "-XX:InlineSmallCode=4000"),
     LOG("log", "", "-XX:+UnlockDiagnosticVMOptions",
             "-XX:+LogCompilation", "-XX:LogFile=" + LogProcessor.LOG_FILE),
     PRINT("print", ""),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/classFileParserBug/EmptyUnqName.jasm	Thu Jun 20 14:47:20 2019 -0400
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+super public class EmptyUnqName version 56:0 {
+
+    public Method "<init>":"()V" stack 1 locals 1 {
+        aload_0;
+        invokespecial Method java/lang/Object."<init>":"()V";
+        return;
+    }
+
+    public static Method main:"([Ljava/lang/String;)V" stack 2 locals 1 {
+        getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
+        ldc String "Testing method param types";
+        invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/String;)V";
+        return;
+    }
+
+    public static Method func:"(L;)V" stack 0 locals 1 {
+        return;
+    }
+
+} // end Class EmptyUnqName
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/classFileParserBug/TestEmptyUnqName.java	Thu Jun 20 14:47:20 2019 -0400
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2019, 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 8225789
+ * @summary Test that an unqualified name of "L;" causes a ClassFormatError exception.
+ * @compile EmptyUnqName.jasm
+ * @run main/othervm -Xverify:remote TestEmptyUnqName
+ */
+
+public class TestEmptyUnqName {
+    public static void main(String args[]) throws Throwable {
+
+        System.out.println("Regression test for bug 8225789");
+
+        try {
+            Class newClass = Class.forName("EmptyUnqName");
+            throw new RuntimeException("Expected ClassFormatError exception not thrown");
+        } catch (java.lang.ClassFormatError e) {
+            if (!e.getMessage().contains("Class name is empty or contains illegal character")) {
+                throw new RuntimeException("Wrong ClassFormatError: " + e.getMessage());
+            }
+        }
+    }
+}
--- a/test/hotspot/jtreg/runtime/verifier/TestSigParse.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/hotspot/jtreg/runtime/verifier/TestSigParse.java	Thu Jun 20 14:47:20 2019 -0400
@@ -63,7 +63,7 @@
             throw new RuntimeException("Expected ClasFormatError exception not thrown");
         } catch (java.lang.ClassFormatError e) {
             String eMsg = e.getMessage();
-            if (!eMsg.contains("Class name contains illegal character")) {
+            if (!eMsg.contains("Class name is empty or contains illegal character")) {
                 throw new RuntimeException("Unexpected exception: " + eMsg);
             }
         }
--- a/test/jdk/ProblemList-aot.txt	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/ProblemList-aot.txt	Thu Jun 20 14:47:20 2019 -0400
@@ -30,3 +30,5 @@
 java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java  8222445 windows-x64
 java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java   8222445 windows-x64
 java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java     8222445 windows-x64
+java/lang/reflect/PublicMethods/PublicMethodsTest.java          8226309 generic-all
+java/lang/constant/MethodTypeDescTest.java                      8225349 windows-x64
--- a/test/jdk/ProblemList-graal.txt	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/ProblemList-graal.txt	Thu Jun 20 14:47:20 2019 -0400
@@ -76,30 +76,15 @@
 java/lang/ref/SoftReference/Pin.java                                    8196611   generic-all
 java/lang/Runtime/exec/LotsOfOutput.java                                8196611   generic-all
 java/util/concurrent/ScheduledThreadPoolExecutor/BasicCancelTest.java   8196611   generic-all
-vm/gc/InfiniteList.java                                                 8196611   generic-all
 
 # tests require pop_frame and force_early_return capabilities
-com/sun/jdi/RedefineTTYLineNumber.java                                  8195635   generic-all
-com/sun/jdi/RedefineG.java                                              8195635   generic-all
-com/sun/jdi/RedefineCrossStart.java                                     8195635   generic-all
-com/sun/jdi/PopSynchronousTest.java                                     8195635   generic-all
-com/sun/jdi/RedefineTTYLineNumber.java                                  8195635   generic-all
-com/sun/jdi/RedefineG.java                                              8195635   generic-all
-com/sun/jdi/RedefineCrossStart.java                                     8195635   generic-all
-com/sun/jdi/PopSynchronousTest.java                                     8195635   generic-all
-com/sun/jdi/PopAsynchronousTest.java                                    8195635   generic-all
+com/sun/jdi/EarlyReturnTest.java                                        8195635   generic-all
 com/sun/jdi/PopAndStepTest.java                                         8195635   generic-all
 com/sun/jdi/PopAsynchronousTest.java                                    8195635   generic-all
-com/sun/jdi/PopAndStepTest.java                                         8195635   generic-all
-com/sun/jdi/EarlyReturnTest.java                                        8195635   generic-all
-com/sun/jdi/RedefineTTYLineNumber.java                                  8195635   generic-all
-com/sun/jdi/RedefineG.java                                              8195635   generic-all
+com/sun/jdi/PopSynchronousTest.java                                     8195635   generic-all
 com/sun/jdi/RedefineCrossStart.java                                     8195635   generic-all
-com/sun/jdi/PopSynchronousTest.java                                     8195635   generic-all
-com/sun/jdi/PopAsynchronousTest.java                                    8195635   generic-all
-com/sun/jdi/PopAndStepTest.java                                         8195635   generic-all
-com/sun/jdi/EarlyReturnTest.java                                        8195635   generic-all
-com/sun/jdi/EarlyReturnTest.java                                        8195635   generic-all
+com/sun/jdi/RedefineG.java                                              8195635   generic-all
+com/sun/jdi/RedefineTTYLineNumber.java                                  8195635   generic-all
 
 # Next JFR tests fail with Graal. Assuming 8193210.
 jdk/jfr/event/compiler/TestCodeSweeper.java              8193210   generic-all
--- a/test/jdk/java/net/Authenticator/AuthNPETest.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/AuthNPETest.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -24,11 +24,15 @@
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import jdk.test.lib.net.URIBuilder;
 
 /**
  * @test
  * @bug 4662246
  * @summary  REGRESSION: plugin 14x client authentication dialog returns NullPointerException
+ * @library /test/lib
+ * @run main/othervm AuthNPETest
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true AuthNPETest
  */
 
 public class AuthNPETest {
@@ -53,45 +57,45 @@
             "Content-Type: text/html; charset=iso-8859-1\r\n" +
             "Content-Length: 10\r\n\r\n";
 
-        BasicServer (ServerSocket s) {
+        BasicServer(ServerSocket s) {
             server = s;
         }
 
-        void readAll (Socket s) throws IOException {
+        void readAll(Socket s) throws IOException {
             byte[] buf = new byte [128];
-            InputStream is = s.getInputStream ();
+            InputStream is = s.getInputStream();
             s.setSoTimeout(1000);
             try {
                 while (is.read(buf) > 0) ;
             } catch (SocketTimeoutException x) { }
         }
 
-        public void run () {
+        public void run() {
             try {
-                System.out.println ("Server 1: accept");
-                s = server.accept ();
-                System.out.println ("accepted");
+                System.out.println("Server 1: accept");
+                s = server.accept();
+                System.out.println("accepted");
                 os = s.getOutputStream();
-                os.write (reply1.getBytes());
-                readAll (s);
-                s.close ();
+                os.write(reply1.getBytes());
+                readAll(s);
+                s.close();
 
-                System.out.println ("Server 2: accept");
-                s = server.accept ();
-                System.out.println ("accepted");
+                System.out.println("Server 2: accept");
+                s = server.accept();
+                System.out.println("accepted");
                 os = s.getOutputStream();
-                os.write ((reply2+"HelloWorld").getBytes());
-                readAll (s);
-                s.close ();
+                os.write((reply2+"HelloWorld").getBytes());
+                readAll(s);
+                s.close();
 
             }
             catch (Exception e) {
                 System.out.println (e);
             }
-            finished ();
+            finished();
         }
 
-        public synchronized void finished () {
+        public synchronized void finished() {
             notifyAll();
         }
 
@@ -99,48 +103,54 @@
 
     static class MyAuthenticator extends Authenticator {
 
-        MyAuthenticator () {
-            super ();
+        MyAuthenticator() {
+            super();
         }
 
         int count = 0;
 
-        public PasswordAuthentication getPasswordAuthentication ()
+        public PasswordAuthentication getPasswordAuthentication()
             {
-            count ++;
-            System.out.println ("Auth called");
-            return (new PasswordAuthentication ("user", "passwordNotCheckedAnyway".toCharArray()));
+            count++;
+            System.out.println("Auth called");
+            return (new PasswordAuthentication("user", "passwordNotCheckedAnyway".toCharArray()));
         }
 
-        public int getCount () {
-            return (count);
+        public int getCount() {
+            return count;
         }
     }
 
 
-    static void read (InputStream is) throws IOException {
+    static void read(InputStream is) throws IOException {
         int c;
-        System.out.println ("reading");
+        System.out.println("reading");
         while ((c=is.read()) != -1) {
-            System.out.write (c);
+            System.out.write(c);
         }
-        System.out.println ("");
-        System.out.println ("finished reading");
+        System.out.println("");
+        System.out.println("finished reading");
     }
 
-    public static void main (String args[]) throws Exception {
-        MyAuthenticator auth = new MyAuthenticator ();
-        Authenticator.setDefault (auth);
-        ServerSocket ss = new ServerSocket (0);
-        int port = ss.getLocalPort ();
-        BasicServer server = new BasicServer (ss);
+    public static void main(String args[]) throws Exception {
+        MyAuthenticator auth = new MyAuthenticator();
+        Authenticator.setDefault(auth);
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        ServerSocket ss = new ServerSocket();
+        ss.bind(new InetSocketAddress(loopback, 0));
+        int port = ss.getLocalPort();
+        BasicServer server = new BasicServer(ss);
         synchronized (server) {
             server.start();
             System.out.println ("client 1");
-            URL url = new URL ("http://localhost:"+port);
-            URLConnection urlc = url.openConnection ();
-            InputStream is = urlc.getInputStream ();
-            read (is);
+            URL url = URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(port)
+                .toURL();
+            URLConnection urlc = url.openConnection(Proxy.NO_PROXY);
+            InputStream is = urlc.getInputStream();
+            read(is);
             is.close();
         }
     }
--- a/test/jdk/java/net/Authenticator/B4678055.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/B4678055.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,16 @@
  * @test
  * @bug 4678055
  * @modules java.base/sun.net.www
- * @library ../../../sun/net/www/httptest/
+ * @library ../../../sun/net/www/httptest/ /test/lib
  * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
- * @run main B4678055
+ * @run main/othervm B4678055
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true B4678055
  * @summary Basic Authentication fails with multiple realms
  */
 
 import java.io.*;
 import java.net.*;
+import jdk.test.lib.net.URIBuilder;
 
 public class B4678055 implements HttpCallback {
 
@@ -125,12 +127,21 @@
     public static void main (String[] args) throws Exception {
         MyAuthenticator auth = new MyAuthenticator ();
         Authenticator.setDefault (auth);
+        ProxySelector.setDefault(ProxySelector.of(null)); // no proxy
         try {
-            server = new TestHttpServer (new B4678055(), 1, 10, 0);
-            System.out.println ("Server: listening on port: " + server.getLocalPort());
-            client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
-            client ("http://localhost:"+server.getLocalPort()+"/d2/foo.html");
-            client ("http://localhost:"+server.getLocalPort()+"/d2/foo.html");
+            InetAddress loopback = InetAddress.getLoopbackAddress();
+            server = new TestHttpServer(new B4678055(), 1, 10, loopback, 0);
+            String serverURL = URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(server.getLocalPort())
+                .path("/")
+                .build()
+                .toString();
+            System.out.println("Server: listening at: " + serverURL);
+            client(serverURL + "d1/foo.html");
+            client(serverURL + "d2/foo.html");
+            client(serverURL + "d2/foo.html");
         } catch (Exception e) {
             if (server != null) {
                 server.terminate();
--- a/test/jdk/java/net/Authenticator/B4759514.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/B4759514.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,16 @@
  * @test
  * @bug 4759514
  * @modules java.base/sun.net.www
- * @library ../../../sun/net/www/httptest/
+ * @library ../../../sun/net/www/httptest/ /test/lib
  * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
- * @run main B4759514
+ * @run main/othervm B4759514
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true B4759514
  * @summary Digest Authentication is erroniously quoting the nc value, contrary to RFC 2617
  */
 
 import java.io.*;
 import java.net.*;
+import jdk.test.lib.net.URIBuilder;
 
 public class B4759514 implements HttpCallback {
 
@@ -97,10 +99,19 @@
     public static void main (String[] args) throws Exception {
         MyAuthenticator auth = new MyAuthenticator ();
         Authenticator.setDefault (auth);
+        ProxySelector.setDefault(ProxySelector.of(null)); // no proxy
         try {
-            server = new TestHttpServer (new B4759514(), 1, 10, 0);
-            System.out.println ("Server: listening on port: " + server.getLocalPort());
-            client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
+            InetAddress loopback = InetAddress.getLoopbackAddress();
+            server = new TestHttpServer (new B4759514(), 1, 10, loopback, 0);
+            String serverURL = URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(server.getLocalPort())
+                .path("/")
+                .build()
+                .toString();
+            System.out.println("Server: listening at: " + serverURL);
+            client(serverURL + "d1/foo.html");
         } catch (Exception e) {
             if (server != null) {
                 server.terminate();
--- a/test/jdk/java/net/Authenticator/B4769350.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/B4769350.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @modules jdk.httpserver
  * @run main/othervm B4769350 server
  * @run main/othervm B4769350 proxy
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true B4769350 server
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true B4769350 proxy
  * @summary proxy authentication username and password caching only works in serial case
  * Run in othervm since the test sets system properties that are read by the
  * networking stack and cached when the HTTP handler is invoked, and previous
@@ -99,7 +101,8 @@
         }
 
         public void startServer() {
-            InetSocketAddress addr = new InetSocketAddress(0);
+            InetAddress loopback = InetAddress.getLoopbackAddress();
+            InetSocketAddress addr = new InetSocketAddress(loopback, 0);
 
             try {
                 server = HttpServer.create(addr, 0);
@@ -456,17 +459,28 @@
             System.out.println ("Server: listening on port: "
                     + server.getPort());
             if (proxy) {
-                System.setProperty ("http.proxyHost", "localhost");
+                System.setProperty ("http.proxyHost",
+                        InetAddress.getLoopbackAddress().getHostAddress());
                 System.setProperty ("http.proxyPort",
                         Integer.toString(server.getPort()));
                 doProxyTests ("www.foo.com", server);
             } else {
-                doServerTests ("localhost:"+server.getPort(), server);
+                ProxySelector.setDefault(ProxySelector.of(null));
+                doServerTests (authority(server.getPort()), server);
             }
         }
 
     }
 
+    static String authority(int port) {
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        String hoststr = loopback.getHostAddress();
+        if (hoststr.indexOf(':') > -1) {
+            hoststr = "[" + hoststr + "]";
+        }
+        return hoststr + ":" + port;
+    }
+
     public static void except (String s, Server server) {
         server.close();
         throw new RuntimeException (s);
@@ -496,4 +510,3 @@
         }
     }
 }
-
--- a/test/jdk/java/net/Authenticator/B4921848.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/B4921848.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,17 @@
  * @test
  * @bug 4921848
  * @modules java.base/sun.net.www
- * @library ../../../sun/net/www/httptest/
+ * @library ../../../sun/net/www/httptest/ /test/lib
  * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
  * @run main/othervm -Dhttp.auth.preference=basic B4921848
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true
+ *                   -Dhttp.auth.preference=basic B4921848
  * @summary Allow user control over authentication schemes
  */
 
 import java.io.*;
 import java.net.*;
+import jdk.test.lib.net.URIBuilder;
 
 public class B4921848 implements HttpCallback {
 
@@ -88,10 +91,19 @@
     public static void main (String[] args) throws Exception {
         MyAuthenticator auth = new MyAuthenticator ();
         Authenticator.setDefault (auth);
+        ProxySelector.setDefault(ProxySelector.of(null)); // no proxy
         try {
-            server = new TestHttpServer (new B4921848(), 1, 10, 0);
-            System.out.println ("Server started: listening on port: " + server.getLocalPort());
-            client ("http://localhost:"+server.getLocalPort()+"/d1/d2/d3/foo.html");
+            InetAddress loopback = InetAddress.getLoopbackAddress();
+            server = new TestHttpServer (new B4921848(), 1, 10, loopback, 0);
+            String serverURL = URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(server.getLocalPort())
+                .path("/")
+                .build()
+                .toString();
+            System.out.println("Server: listening at: " + serverURL);
+            client(serverURL + "d1/d2/d3/foo.html");
         } catch (Exception e) {
             if (server != null) {
                 server.terminate();
--- a/test/jdk/java/net/Authenticator/B4933582.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/B4933582.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -21,10 +21,15 @@
  * questions.
  */
 
+// Note: this test saves a cache.ser file in the scratch directory,
+//       which the cache implementation will load its configuration
+//       from. Therefore adding several @run lines does not work.
+
 /*
  * @test
  * @bug 4933582
- * @library ../../../sun/net/www/httptest
+ * @key intermittent
+ * @library ../../../sun/net/www/httptest /test/lib
  * @modules java.base/sun.net.www
  *          java.base/sun.net.www.protocol.http
  * @build HttpCallback HttpTransaction TestHttpServer B4933582
@@ -34,6 +39,7 @@
 import java.net.*;
 import java.util.*;
 import sun.net.www.protocol.http.*;
+import jdk.test.lib.net.URIBuilder;
 
 public class B4933582 implements HttpCallback {
 
@@ -133,12 +139,21 @@
     public static void main (String[] args) throws Exception {
         MyAuthenticator auth = new MyAuthenticator ();
         Authenticator.setDefault (auth);
+        ProxySelector.setDefault(ProxySelector.of(null)); // no proxy
+        InetAddress loopback = InetAddress.getLoopbackAddress();
         CacheImpl cache;
         try {
-            server = new TestHttpServer (new B4933582(), 1, 10, 0);
+            server = new TestHttpServer(new B4933582(), 1, 10, loopback, 0);
             cache = new CacheImpl (server.getLocalPort());
             AuthCacheValue.setAuthCache (cache);
-            client ("http://localhost:"+server.getLocalPort()+"/d1/foo.html");
+            String serverURL = URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(server.getLocalPort())
+                .path("/")
+                .build()
+                .toString();
+            client(serverURL + "d1/foo.html");
         } finally {
             if (server != null) {
                 server.terminate();
@@ -157,7 +172,7 @@
         while (true) {
             try {
                 server = new TestHttpServer(new B4933582(), 1, 10,
-                        cache.getPort());
+                                            loopback, cache.getPort());
                 break;
             } catch (BindException e) {
                 if (retries++ < 5) {
@@ -173,7 +188,14 @@
 
         try {
             AuthCacheValue.setAuthCache(cache);
-            client("http://localhost:" + server.getLocalPort() + "/d1/foo.html");
+            String serverURL = URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(server.getLocalPort())
+                .path("/")
+                .build()
+                .toString();
+            client(serverURL + "d1/foo.html");
         } finally {
             if (server != null) {
                 server.terminate();
--- a/test/jdk/java/net/Authenticator/B4962064.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/B4962064.java	Thu Jun 20 14:47:20 2019 -0400
@@ -28,6 +28,7 @@
  * @library ../../../sun/net/www/httptest/
  * @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
  * @run main/othervm B4962064
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true B4962064
  * @summary Extend Authenticator to provide access to request URI and server/proxy
  */
 
@@ -91,18 +92,24 @@
 
     public static void main (String[] args) throws Exception {
         try {
-            server = new TestHttpServer (new B4962064(), 1, 10, 0);
+            InetAddress address = InetAddress.getLoopbackAddress();
+            InetAddress resolved = InetAddress.getByName(address.getHostName());
+            System.out.println("Lookup: " + address + " -> \""
+                               + address.getHostName() + "\" -> "
+                               + resolved);
+            server = new TestHttpServer (new B4962064(), 1, 10, address, 0);
             int port = server.getLocalPort();
-            System.setProperty ("http.proxyHost", "localhost");
+            String proxyHost = address.equals(resolved)
+                ? address.getHostName()
+                : address.getHostAddress();
+            System.setProperty ("http.proxyHost", proxyHost);
             System.setProperty ("http.proxyPort", Integer.toString (port));
             MyAuthenticator auth = new MyAuthenticator ();
             Authenticator.setDefault (auth);
             System.out.println ("Server started: listening on port: " + port);
-            //String s = new String ("http://localhost:"+port+"/d1/d2/d3/foo.html");
             String s = new String ("http://foo.com/d1/d2/d3/foo.html");
             urlsave = new URL (s);
             client (s);
-            //s = new String ("http://localhost:"+port+"/dr/d3/foo.html");
             s = new String ("http://bar.com/dr/d3/foo.html");
             urlsave = new URL (s);
             client (s);
--- a/test/jdk/java/net/Authenticator/B6870935.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/B6870935.java	Thu Jun 20 14:47:20 2019 -0400
@@ -26,6 +26,8 @@
  * @bug 6870935
  * @modules java.base/sun.net.www
  * @run main/othervm -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true
+ *                   -Dhttp.nonProxyHosts="" -Dhttp.auth.digest.validateProxy=true B6870935
  */
 
 import java.io.*;
@@ -80,18 +82,21 @@
 
         public void run () {
             try {
+                System.out.println("Server started");
                 Socket s1 = s.accept ();
                 is = s1.getInputStream ();
                 os = s1.getOutputStream ();
                 is.read ();
                 os.write (reply1.getBytes());
+                System.out.println("First response sent");
                 Thread.sleep (2000);
                 s1.close ();
+                System.out.println("First connection closed");
 
                 s1 = s.accept ();
                 is = s1.getInputStream ();
                 os = s1.getOutputStream ();
-                is.read ();
+                // is.read ();
                 // need to get the cnonce out of the response
                 MessageHeader header = new MessageHeader (is);
                 String raw = header.findValue ("Proxy-Authorization");
@@ -115,12 +120,16 @@
                         cnstring, passwd, username
                 ) +"\r\n";
                 os.write (reply.getBytes());
+                System.out.println("Second response sent");
                 Thread.sleep (2000);
                 s1.close ();
+                System.out.println("Second connection closed");
             }
             catch (Exception e) {
                 System.out.println (e);
                 e.printStackTrace();
+            } finally {
+                System.out.println("Server finished");
             }
         }
 
@@ -225,8 +234,17 @@
         DigestServer server;
         ServerSocket sock;
 
+        InetAddress address = InetAddress.getLoopbackAddress();
+        InetAddress resolved = InetAddress.getByName(address.getHostName());
+        System.out.println("Lookup: "
+                            + address + " -> \"" + address.getHostName() + "\" -> "
+                            + resolved);
+        String proxyHost = address.equals(resolved)
+            ? address.getHostName()
+            : address.getHostAddress();
         try {
-            sock = new ServerSocket (0);
+            sock = new ServerSocket();
+            sock.bind(new InetSocketAddress(address, 0));
             port = sock.getLocalPort ();
         }
         catch (Exception e) {
@@ -238,12 +256,12 @@
         server.start ();
 
         try  {
-
             Authenticator.setDefault (new MyAuthenticator ());
-            SocketAddress addr = new InetSocketAddress (InetAddress.getLoopbackAddress(), port);
+            SocketAddress addr = InetSocketAddress.createUnresolved(proxyHost, port);
             Proxy proxy = new Proxy (Proxy.Type.HTTP, addr);
             String s = "http://www.ibm.com";
             URL url = new URL(s);
+            System.out.println("opening connection through proxy: " + addr);
             java.net.URLConnection conURL =  url.openConnection(proxy);
 
             InputStream in = conURL.getInputStream();
@@ -255,6 +273,9 @@
         catch(IOException e) {
             e.printStackTrace();
             error = true;
+            sock.close();
+        } finally {
+            server.join();
         }
         if (error) {
             throw new RuntimeException ("Error in test");
--- a/test/jdk/java/net/Authenticator/B8034170.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/B8034170.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -24,13 +24,16 @@
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import jdk.test.lib.net.URIBuilder;
 
 /**
  * @test
  * @bug 8034170
  * @summary Digest authentication interop issue
+ * @library /test/lib
  * @run main/othervm B8034170 unquoted
  * @run main/othervm -Dhttp.auth.digest.quoteParameters=true B8034170 quoted
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true B8034170 unquoted
  */
 
 public class B8034170 {
@@ -176,14 +179,21 @@
 
         MyAuthenticator3 auth = new MyAuthenticator3 ();
         Authenticator.setDefault (auth);
-        ServerSocket ss = new ServerSocket (0);
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        ServerSocket ss = new ServerSocket();
+        ss.bind(new InetSocketAddress(loopback, 0));
         int port = ss.getLocalPort ();
         BasicServer server = new BasicServer (ss);
         synchronized (server) {
             server.start();
             System.out.println ("client 1");
-            URL url = new URL ("http://localhost:"+port+"/d1/d2/d3/foo.html");
-            URLConnection urlc = url.openConnection ();
+            URL url =  URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(port)
+                .path("/d1/d2/d3/foo.html")
+                .toURL();
+            URLConnection urlc = url.openConnection(Proxy.NO_PROXY);
             InputStream is = urlc.getInputStream ();
             read (is);
             is.close ();
--- a/test/jdk/java/net/Authenticator/BasicTest.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/BasicTest.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, 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
@@ -24,11 +24,15 @@
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import jdk.test.lib.net.URIBuilder;
 
 /**
  * @test
  * @bug 4474947
  * @summary  fix for bug #4244472 is incomplete - HTTP authorization still needs work
+ * @library /test/lib
+ * @run main/othervm BasicTest
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true BasicTest
  */
 
 /*
@@ -151,19 +155,28 @@
     public static void main (String args[]) throws Exception {
         MyAuthenticator auth = new MyAuthenticator ();
         Authenticator.setDefault (auth);
-        ServerSocket ss = new ServerSocket (0);
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        ServerSocket ss = new ServerSocket();
+        ss.bind(new InetSocketAddress(loopback, 0));
         int port = ss.getLocalPort ();
         BasicServer server = new BasicServer (ss);
         synchronized (server) {
             server.start();
             System.out.println ("client 1");
-            URL url = new URL ("http://localhost:"+port+"/d1/d2/d3/foo.html");
-            URLConnection urlc = url.openConnection ();
+            String base = URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(port)
+                .path("/")
+                .build()
+                .toString();
+            URL url = new URL(base + "d1/d2/d3/foo.html");
+            URLConnection urlc = url.openConnection(Proxy.NO_PROXY);
             InputStream is = urlc.getInputStream ();
             read (is);
             System.out.println ("client 2");
-            url = new URL ("http://localhost:"+port+"/d1/foo.html");
-            urlc = url.openConnection ();
+            url = new URL(base + "d1/foo.html");
+            urlc = url.openConnection(Proxy.NO_PROXY);
             is = urlc.getInputStream ();
             read (is);
             server.wait ();
--- a/test/jdk/java/net/Authenticator/BasicTest3.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/BasicTest3.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -24,11 +24,15 @@
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import jdk.test.lib.net.URIBuilder;
 
 /**
  * @test
  * @bug 4513440
  * @summary BasicAuthentication is zeroing out the given password
+ * @library /test/lib
+ * @run main/othervm BasicTest3
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true BasicTest3
  */
 
 public class BasicTest3 {
@@ -130,14 +134,21 @@
     public static void main (String args[]) throws Exception {
         MyAuthenticator3 auth = new MyAuthenticator3 ();
         Authenticator.setDefault (auth);
-        ServerSocket ss = new ServerSocket (0);
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        ServerSocket ss = new ServerSocket();
+        ss.bind(new InetSocketAddress(loopback, 0));
         int port = ss.getLocalPort ();
         BasicServer3 server = new BasicServer3 (ss);
         synchronized (server) {
             server.start();
             System.out.println ("client 1");
-            URL url = new URL ("http://localhost:"+port+"/d1/d2/d3/foo.html");
-            URLConnection urlc = url.openConnection ();
+            URL url =  URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(port)
+                .path("/d1/d2/d3/foo.html")
+                .toURL();
+            URLConnection urlc = url.openConnection(Proxy.NO_PROXY);
             InputStream is = urlc.getInputStream ();
             read (is);
             is.close ();
--- a/test/jdk/java/net/Authenticator/BasicTest4.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/BasicTest4.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -24,11 +24,15 @@
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import jdk.test.lib.net.URIBuilder;
 
 /**
  * @test
  * @bug 4623722
  * @summary  performance hit for Basic Authentication
+ * @library /test/lib
+ * @run main/othervm BasicTest4
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true BasicTest4
  */
 
 public class BasicTest4 {
@@ -59,12 +63,17 @@
 
         static boolean checkFor (InputStream in, char[] seq) throws IOException {
             System.out.println ("checkfor");
+            StringBuilder message = new StringBuilder();
             try {
                 int i=0, count=0;
                 while (true) {
                     int c = in.read();
-                    if (c == -1)
+                    if (c == -1) {
+                        System.out.println(new String(seq) + " not found in \n<<"
+                                           + message + ">>");
                         return false;
+                    }
+                    message.append((char)c);
                     count++;
                     if (c == seq[i]) {
                         i++;
@@ -77,6 +86,7 @@
                 }
             }
             catch (SocketTimeoutException e) {
+                System.out.println("checkFor: " + e);
                 return false;
             }
         }
@@ -194,23 +204,33 @@
     public static void main (String args[]) throws Exception {
         MyAuthenticator auth = new MyAuthenticator ();
         Authenticator.setDefault (auth);
-        ServerSocket ss = new ServerSocket (0);
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        ServerSocket ss = new ServerSocket();
+        ss.bind(new InetSocketAddress(loopback, 0));
         int port = ss.getLocalPort ();
         BasicServer server = new BasicServer (ss);
         synchronized (server) {
             server.start();
             System.out.println ("client 1");
-            URL url = new URL ("http://localhost:"+port+"/d1/d3/foo.html");
-            URLConnection urlc = url.openConnection ();
+            String base = URIBuilder.newBuilder()
+                .scheme("http")
+                .loopback()
+                .port(port)
+                .path("/d1/")
+                .build()
+                .toString();
+            System.out.println("Base URL: " + base);
+            URL url = new URL (base + "d3/foo.html");
+            URLConnection urlc = url.openConnection(Proxy.NO_PROXY);
             InputStream is = urlc.getInputStream ();
             read (is);
             System.out.println ("client 2");
-            url = new URL ("http://localhost:"+port+"/d1/d2/bar.html");
-            urlc = url.openConnection ();
+            url = new URL (base + "d2/bar.html");
+            urlc = url.openConnection(Proxy.NO_PROXY);
             is = urlc.getInputStream ();
             System.out.println ("client 3");
-            url = new URL ("http://localhost:"+port+"/d1/d4/foobar.html");
-            urlc = url.openConnection ();
+            url = new URL (base + "d4/foobar.html");
+            urlc = url.openConnection(Proxy.NO_PROXY);
             is = urlc.getInputStream ();
             read (is);
             server.wait ();
--- a/test/jdk/java/net/Authenticator/Deadlock.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/Authenticator/Deadlock.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,10 @@
  * @test
  * @bug 6648001
  * @modules jdk.httpserver
+ * @library /test/lib
  * @run main/othervm/timeout=20 -ea:sun.net.www.protocol.http.AuthenticationInfo -Dhttp.auth.serializeRequests=true Deadlock
+ * @run main/othervm/timeout=20 -Djava.net.preferIPv6Addresses=true
+ *                              -ea:sun.net.www.protocol.http.AuthenticationInfo -Dhttp.auth.serializeRequests=true Deadlock
  * @summary  cancelling HTTP authentication causes deadlock
  */
 
@@ -34,8 +37,10 @@
 import java.io.InputStream;
 import java.io.IOException;
 import java.net.HttpURLConnection;
+import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.PasswordAuthentication;
+import java.net.Proxy;
 import java.net.URL;
 import com.sun.net.httpserver.BasicAuthenticator;
 import com.sun.net.httpserver.Headers;
@@ -44,12 +49,14 @@
 import com.sun.net.httpserver.HttpHandler;
 import com.sun.net.httpserver.HttpPrincipal;
 import com.sun.net.httpserver.HttpServer;
+import jdk.test.lib.net.URIBuilder;
 
 public class Deadlock {
 
     public static void main (String[] args) throws Exception {
         Handler handler = new Handler();
-        InetSocketAddress addr = new InetSocketAddress (0);
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        InetSocketAddress addr = new InetSocketAddress (loopback, 0);
         HttpServer server = HttpServer.create(addr, 0);
         HttpContext ctx = server.createContext("/test", handler);
         BasicAuthenticator a = new BasicAuthenticator("foobar@test.realm") {
@@ -97,8 +104,13 @@
             URL url;
             HttpURLConnection urlc;
             try {
-                url = new URL("http://localhost:"+server.getAddress().getPort()+"/test/foo.html");
-                urlc = (HttpURLConnection)url.openConnection ();
+                url = URIBuilder.newBuilder()
+                    .scheme("http")
+                    .loopback()
+                    .port(server.getAddress().getPort())
+                    .path("/test/foo.html")
+                    .toURLUnchecked();
+                urlc = (HttpURLConnection)url.openConnection (Proxy.NO_PROXY);
             } catch (IOException e) {
                 error = true;
                 return;
--- a/test/jdk/java/net/CookieHandler/CookieHandlerTest.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/CookieHandler/CookieHandlerTest.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019 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
@@ -24,7 +24,9 @@
 /* @test
  * @summary Unit test for java.net.CookieHandler
  * @bug 4696506
+ * @library /test/lib
  * @run main/othervm CookieHandlerTest
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true CookieHandlerTest
  * @author Yingxian Wang
  */
 
@@ -34,6 +36,7 @@
 import java.net.*;
 import java.util.*;
 import java.io.*;
+import jdk.test.lib.net.URIBuilder;
 
 public class CookieHandlerTest implements Runnable {
     static Map<String,String> cookies;
@@ -92,15 +95,19 @@
     CookieHandlerTest() throws Exception {
 
         /* start the server */
-        ss = new ServerSocket(0);
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        ss = new ServerSocket();
+        ss.bind(new InetSocketAddress(loopback, 0));
         (new Thread(this)).start();
 
         /* establish http connection to server */
-        String uri = "http://localhost:" +
-                     Integer.toString(ss.getLocalPort());
-        URL url = new URL(uri);
+        URL url = URIBuilder.newBuilder()
+                    .scheme("http")
+                    .loopback()
+                    .port(ss.getLocalPort())
+                    .toURL();
 
-        HttpURLConnection http = (HttpURLConnection)url.openConnection();
+        HttpURLConnection http = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
 
         int respCode = http.getResponseCode();
         http.disconnect();
--- a/test/jdk/java/net/CookieHandler/CookieManagerTest.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/CookieHandler/CookieManagerTest.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -57,8 +57,9 @@
         } catch (IOException x) {
             System.out.println("Debug: caught:" + x);
         }
-        System.out.println("Using: \"127.0.0.1\"");
-        return "127.0.0.1";
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        System.out.println("Using: \"" + loopback.getHostAddress() + "\"");
+        return loopback.getHostAddress();
     }
 
     public static void main(String[] args) throws Exception {
@@ -73,7 +74,7 @@
 
    public static void startHttpServer() throws IOException {
         httpTrans = new CookieTransactionHandler();
-        server = HttpServer.create(new InetSocketAddress(0), 0);
+        server = HttpServer.create(new InetSocketAddress(hostAddress, 0), 0);
         server.createContext("/", httpTrans);
         server.start();
     }
--- a/test/jdk/java/net/CookieHandler/EmptyCookieHeader.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/CookieHandler/EmptyCookieHeader.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, 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
@@ -26,6 +26,9 @@
  * @bug 8015799
  * @modules jdk.httpserver
  * @summary HttpURLConnection.getHeaderFields() throws IllegalArgumentException
+ * @library /test/lib
+ * @run main EmptyCookieHeader
+ * @run main/othervm -Djava.net.preferIPv6Addresses=true EmptyCookieHeader
  */
 
 import com.sun.net.httpserver.*;
@@ -33,6 +36,7 @@
 import java.io.OutputStream;
 import java.net.*;
 import java.util.*;
+import jdk.test.lib.net.URIBuilder;
 
 public class EmptyCookieHeader {
 
@@ -43,11 +47,17 @@
     public void runTest() throws Exception {
         final CookieHandler oldHandler = CookieHandler.getDefault();
         CookieHandler.setDefault(new TestCookieHandler());
-        HttpServer s = HttpServer.create(new InetSocketAddress(0), 0);
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        HttpServer s = HttpServer.create(new InetSocketAddress(loopback, 0), 0);
         try {
             startServer(s);
-            URL url = new URL("http://localhost:" + s.getAddress().getPort() + "/");
-            HttpURLConnection c = (HttpURLConnection)url.openConnection();
+            URL url = URIBuilder.newBuilder()
+                    .scheme("http")
+                    .loopback()
+                    .port(s.getAddress().getPort())
+                    .path("/")
+                    .toURL();
+            HttpURLConnection c = (HttpURLConnection)url.openConnection(Proxy.NO_PROXY);
             c.getHeaderFields();
         } finally {
             CookieHandler.setDefault(oldHandler);
--- a/test/jdk/java/net/CookieHandler/LocalHostCookie.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/net/CookieHandler/LocalHostCookie.java	Thu Jun 20 14:47:20 2019 -0400
@@ -33,8 +33,11 @@
 /*
  * @test
  * @bug 7169142
+ * @key intermittent
  * @modules jdk.httpserver
- * @summary CookieHandler does not work with localhost
+ * @summary CookieHandler does not work with localhost. This requires
+ *    binding to the wildcard address and might fail intermittently
+ *    due to port reuse issues.
  * @run main/othervm LocalHostCookie
  */
 public class LocalHostCookie {
@@ -126,4 +129,3 @@
         }
     }
 }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/BodySubscribersTest.java	Thu Jun 20 14:47:20 2019 -0400
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2019, 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
+ * @summary Basic test for the standard BodySubscribers default behavior
+ * @bug 8225583
+ * @run testng BodySubscribersTest
+ */
+
+import java.net.http.HttpResponse.BodySubscriber;
+import java.nio.ByteBuffer;
+import java.nio.file.Path;
+import java.util.List;
+import java.util.concurrent.Flow;
+import java.util.function.Supplier;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static java.lang.System.out;
+import static java.net.http.HttpResponse.BodySubscribers.*;
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.nio.file.StandardOpenOption.CREATE;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.expectThrows;
+import static org.testng.Assert.fail;
+
+public class BodySubscribersTest {
+
+    static final Class<NullPointerException> NPE = NullPointerException.class;
+
+    // Supplier of BodySubscriber<?>, with a descriptive name
+    static class BSSupplier implements Supplier<BodySubscriber<?>> {
+        private final Supplier<BodySubscriber<?>> supplier;
+        private final String name;
+        private BSSupplier(Supplier<BodySubscriber<?>> supplier, String name) {
+            this.supplier = supplier;
+            this.name = name;
+        }
+        static BSSupplier create(String name, Supplier<BodySubscriber<?>> supplier) {
+            return new BSSupplier(supplier, name);
+        }
+        @Override public BodySubscriber<?> get() { return supplier.get(); }
+        @Override public String toString() { return name; }
+    }
+
+    static class LineSubscriber implements Flow.Subscriber<String> {
+        @Override public void onSubscribe(Flow.Subscription subscription) {  }
+        @Override public void onNext(String item) { fail(); }
+        @Override public void onError(Throwable throwable) { fail(); }
+        @Override public void onComplete() { fail(); }
+    }
+
+    static class BBSubscriber implements Flow.Subscriber<List<ByteBuffer>> {
+        @Override public void onSubscribe(Flow.Subscription subscription) {  }
+        @Override public void onNext(List<ByteBuffer> item) { fail(); }
+        @Override public void onError(Throwable throwable) { fail(); }
+        @Override public void onComplete() { fail(); }
+    }
+
+    @DataProvider(name = "bodySubscriberSuppliers")
+    public Object[][] bodySubscriberSuppliers() { ;
+        List<Supplier<BodySubscriber<?>>> list = List.of(
+            BSSupplier.create("ofByteArray",   () -> ofByteArray()),
+            BSSupplier.create("ofInputStream", () -> ofInputStream()),
+            BSSupplier.create("ofBAConsumer",  () -> ofByteArrayConsumer(ba -> { })),
+            BSSupplier.create("ofLines",       () -> ofLines(UTF_8)),
+            BSSupplier.create("ofPublisher",   () -> ofPublisher()),
+            BSSupplier.create("ofFile",        () -> ofFile(Path.of("f"))),
+            BSSupplier.create("ofFile-opts)",  () -> ofFile(Path.of("f"), CREATE)),
+            BSSupplier.create("ofString",      () -> ofString(UTF_8)),
+            BSSupplier.create("buffering",     () -> buffering(ofByteArray(), 10)),
+            BSSupplier.create("discarding",    () -> discarding()),
+            BSSupplier.create("mapping",       () -> mapping(ofString(UTF_8), s -> s)),
+            BSSupplier.create("replacing",     () -> replacing("hello")),
+            BSSupplier.create("fromSubscriber-1",     () -> fromSubscriber(new BBSubscriber())),
+            BSSupplier.create("fromSubscriber-2",     () -> fromSubscriber(new BBSubscriber(), s -> s)),
+            BSSupplier.create("fromLineSubscriber-1", () -> fromLineSubscriber(new LineSubscriber())),
+            BSSupplier.create("fromLineSubscriber-2", () -> fromLineSubscriber(new LineSubscriber(), s -> s, UTF_8, ","))
+        );
+
+        return list.stream().map(x -> new Object[] { x }).toArray(Object[][]::new);
+    }
+
+    @Test(dataProvider = "bodySubscriberSuppliers")
+    void nulls(Supplier<BodySubscriber<?>> bodySubscriberSupplier) {
+        BodySubscriber<?> bodySubscriber = bodySubscriberSupplier.get();
+        boolean subscribed = false;
+
+        do {
+            assertNotNull(bodySubscriber.getBody());
+            assertNotNull(bodySubscriber.getBody());
+            assertNotNull(bodySubscriber.getBody());
+            expectThrows(NPE, () -> bodySubscriber.onSubscribe(null));
+            expectThrows(NPE, () -> bodySubscriber.onSubscribe(null));
+            expectThrows(NPE, () -> bodySubscriber.onSubscribe(null));
+
+            expectThrows(NPE, () -> bodySubscriber.onNext(null));
+            expectThrows(NPE, () -> bodySubscriber.onNext(null));
+            expectThrows(NPE, () -> bodySubscriber.onNext(null));
+            expectThrows(NPE, () -> bodySubscriber.onNext(null));
+
+            expectThrows(NPE, () -> bodySubscriber.onError(null));
+            expectThrows(NPE, () -> bodySubscriber.onError(null));
+            expectThrows(NPE, () -> bodySubscriber.onError(null));
+
+            if (!subscribed) {
+                out.println("subscribing");
+                // subscribe the Subscriber and repeat
+                bodySubscriber.onSubscribe(new Flow.Subscription() {
+                    @Override public void request(long n) { /* do nothing */ }
+                    @Override public void cancel() { fail(); }
+                });
+                subscribed = true;
+                continue;
+            }
+            break;
+        } while (true);
+    }
+
+    @Test(dataProvider = "bodySubscriberSuppliers")
+    void subscribeMoreThanOnce(Supplier<BodySubscriber<?>> bodySubscriberSupplier) {
+        BodySubscriber<?> bodySubscriber = bodySubscriberSupplier.get();
+        bodySubscriber.onSubscribe(new Flow.Subscription() {
+            @Override public void request(long n) { /* do nothing */ }
+            @Override public void cancel() { fail(); }
+        });
+
+        for (int i = 0; i < 5; i++) {
+            var subscription = new Flow.Subscription() {
+                volatile boolean cancelled;
+                @Override public void request(long n) { fail(); }
+                @Override public void cancel() { cancelled = true; }
+            };
+            bodySubscriber.onSubscribe(subscription);
+            assertTrue(subscription.cancelled);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/RelayingPublishers.java	Thu Jun 20 14:47:20 2019 -0400
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.test.lib.util.FileUtils;
+import org.testng.annotations.Test;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.http.HttpRequest.BodyPublisher;
+import java.net.http.HttpRequest.BodyPublishers;
+import java.nio.ByteBuffer;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Flow;
+
+import static org.testng.Assert.assertEquals;
+
+/*
+ * @test
+ * @summary Verifies that some of the standard BodyPublishers relay exception
+ *          rather than throw it
+ * @bug 8226303
+ * @library /test/lib
+ * @run testng/othervm RelayingPublishers
+ */
+public class RelayingPublishers {
+
+    @Test
+    public void ofFile0() throws IOException {
+        Path directory = Files.createDirectory(Path.of("d"));
+        // Even though the path exists, the publisher should not be able
+        // to read from it, as that path denotes a directory, not a file
+        BodyPublisher pub = BodyPublishers.ofFile(directory);
+        CompletableSubscriber<ByteBuffer> s = new CompletableSubscriber<>();
+        pub.subscribe(s);
+        s.future().join();
+        // Interestingly enough, it's FileNotFoundException if a file
+        // is a directory
+        assertEquals(s.future().join().getClass(), FileNotFoundException.class);
+    }
+
+    @Test
+    public void ofFile1() throws IOException {
+        Path file = Files.createFile(Path.of("f"));
+        BodyPublisher pub = BodyPublishers.ofFile(file);
+        FileUtils.deleteFileWithRetry(file);
+        CompletableSubscriber<ByteBuffer> s = new CompletableSubscriber<>();
+        pub.subscribe(s);
+        assertEquals(s.future().join().getClass(), FileNotFoundException.class);
+    }
+
+    @Test
+    public void ofByteArrays() {
+        List<byte[]> bytes = new ArrayList<>();
+        bytes.add(null);
+        BodyPublisher pub = BodyPublishers.ofByteArrays(bytes);
+        CompletableSubscriber<ByteBuffer> s = new CompletableSubscriber<>();
+        pub.subscribe(s);
+        assertEquals(s.future().join().getClass(), NullPointerException.class);
+    }
+
+    static class CompletableSubscriber<T> implements Flow.Subscriber<T> {
+
+        final CompletableFuture<Throwable> f = new CompletableFuture<>();
+
+        @Override
+        public void onSubscribe(Flow.Subscription subscription) {
+            subscription.request(1);
+        }
+
+        @Override
+        public void onNext(T item) {
+            f.completeExceptionally(new RuntimeException("Unexpected onNext"));
+        }
+
+        @Override
+        public void onError(Throwable throwable) {
+            f.complete(throwable);
+        }
+
+        @Override
+        public void onComplete() {
+            f.completeExceptionally(new RuntimeException("Unexpected onNext"));
+        }
+
+        CompletableFuture<Throwable> future() {
+            return f.copy();
+        }
+    }
+}
--- a/test/jdk/java/util/zip/ZipFile/MultiThreadedReadTest.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/java/util/zip/ZipFile/MultiThreadedReadTest.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, 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
@@ -28,14 +28,14 @@
  * @build jdk.test.lib.Platform
  *        jdk.test.lib.util.FileUtils
  * @run main MultiThreadedReadTest
- * @key randomness
  */
 
+import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.nio.file.Paths;
-import java.util.Random;
+import java.util.zip.CRC32;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 import java.util.zip.ZipOutputStream;
@@ -44,7 +44,8 @@
 public class MultiThreadedReadTest extends Thread {
 
     private static final int NUM_THREADS = 10;
-    private static final String ZIPFILE_NAME = "large.zip";
+    private static final String ZIPFILE_NAME =
+        System.currentTimeMillis() + "-bug8038491-tmp.large.zip";
     private static final String ZIPENTRY_NAME = "random.txt";
     private static InputStream is = null;
 
@@ -63,23 +64,30 @@
                 threadArray[i].join();
             }
         } finally {
+            long t = System.currentTimeMillis();
             FileUtils.deleteFileIfExistsWithRetry(Paths.get(ZIPFILE_NAME));
+            System.out.println("Deleting zip file took:" +
+                    (System.currentTimeMillis() - t) + "ms");
         }
     }
 
     private static void createZipFile() throws Exception {
-        try (ZipOutputStream zos =
-            new ZipOutputStream(new FileOutputStream(ZIPFILE_NAME))) {
-
-            zos.putNextEntry(new ZipEntry(ZIPENTRY_NAME));
-            StringBuilder sb = new StringBuilder();
-            Random rnd = new Random();
-            for(int i = 0; i < 1000; i++) {
-                // append some random string for ZipEntry
-                sb.append(Long.toString(rnd.nextLong()));
-            }
-            byte[] b = sb.toString().getBytes();
-            zos.write(b, 0, b.length);
+        CRC32 crc32 = new CRC32();
+        long t = System.currentTimeMillis();
+        File zipFile = new File(ZIPFILE_NAME);
+        try (FileOutputStream fos = new FileOutputStream(zipFile);
+            BufferedOutputStream bos = new BufferedOutputStream(fos);
+            ZipOutputStream zos = new ZipOutputStream(bos)) {
+            ZipEntry e = new ZipEntry(ZIPENTRY_NAME);
+            e.setMethod(ZipEntry.STORED);
+            byte[] toWrite = "BLAH".repeat(10_000).getBytes();
+            e.setTime(t);
+            e.setSize(toWrite.length);
+            crc32.reset();
+            crc32.update(toWrite);
+            e.setCrc(crc32.getValue());
+            zos.putNextEntry(e);
+            zos.write(toWrite);
         }
     }
 
@@ -88,6 +96,7 @@
         try {
             while (is.read() != -1) { }
         } catch (Exception e) {
+            System.out.println("read exception:" + e);
             // Swallow any Exceptions (which are expected) - we're only interested in the crash
         }
     }
--- a/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/javax/net/ssl/SSLSocket/Tls13PacketSize.java	Thu Jun 20 14:47:20 2019 -0400
@@ -53,6 +53,9 @@
 
     @Override
     protected void runServerApplication(SSLSocket socket) throws Exception {
+        // Set SO_LINGER in case of slow socket
+        socket.setSoLinger(true, 10);
+
         // here comes the test logic
         InputStream sslIS = socket.getInputStream();
         OutputStream sslOS = socket.getOutputStream();
@@ -81,6 +84,9 @@
      * @see #isCustomizedClientConnection()
      */
     protected void runClientApplication(SSLSocket socket) throws Exception {
+        // Set SO_LINGER in case of slow socket
+        socket.setSoLinger(true, 10);
+
         socket.setEnabledProtocols(new String[] {"TLSv1.3"});
         InputStream sslIS = socket.getInputStream();
         OutputStream sslOS = socket.getOutputStream();
--- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java	Thu Jun 20 14:47:20 2019 -0400
@@ -26,11 +26,13 @@
  * @test
  * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779
  *      8209452 8209506 8210432 8195793 8216577 8222089 8222133 8222137 8222136
- *      8223499
+ *      8223499 8225392
  * @summary Check root CA entries in cacerts file
  */
+import java.io.ByteArrayInputStream;
 import java.io.File;
-import java.io.FileInputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.security.KeyStore;
 import java.security.MessageDigest;
 import java.security.cert.Certificate;
@@ -52,6 +54,11 @@
     // The numbers of certs now.
     private static final int COUNT = 88;
 
+    // SHA-256 of cacerts, can be generated with
+    // shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95
+    private static final String CHECKSUM
+            = "4E:21:94:7C:1D:49:28:BB:34:B0:40:DF:AE:19:B4:41:C6:B5:8A:EE:EB:D5:DE:B4:EF:07:AF:63:18:73:A6:FE";
+
     // map of cert alias to SHA-256 fingerprint
     @SuppressWarnings("serial")
     private static final Map<String, String> FINGERPRINT_MAP = new HashMap<>() {
@@ -255,8 +262,16 @@
     public static void main(String[] args) throws Exception {
         System.out.println("cacerts file: " + CACERTS);
         md = MessageDigest.getInstance("SHA-256");
+
+        byte[] data = Files.readAllBytes(Path.of(CACERTS));
+        String checksum = toHexString(md.digest(data));
+        if (!checksum.equals(CHECKSUM)) {
+            atLeastOneFailed = true;
+            System.err.println("ERROR: wrong checksum\n" + checksum);
+        }
+
         KeyStore ks = KeyStore.getInstance("JKS");
-        ks.load(new FileInputStream(CACERTS), "changeit".toCharArray());
+        ks.load(new ByteArrayInputStream(data), "changeit".toCharArray());
 
         // check the count of certs inside
         if (ks.size() != COUNT) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/BlockedAsyncClose.java	Thu Jun 20 14:47:20 2019 -0400
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+//
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+//
+
+/*
+ * @test
+ * @bug 8224829
+ * @summary AsyncSSLSocketClose.java has timing issue
+ * @run main/othervm BlockedAsyncClose
+ */
+
+import javax.net.ssl.*;
+import java.io.*;
+import java.net.SocketException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class BlockedAsyncClose implements Runnable {
+    SSLSocket socket;
+    SSLServerSocket ss;
+
+    // Is the socket ready to close?
+    private final CountDownLatch closeCondition = new CountDownLatch(1);
+
+    // Where do we find the keystores?
+    static String pathToStores = "../../../../javax/net/ssl/etc";
+    static String keyStoreFile = "keystore";
+    static String trustStoreFile = "truststore";
+    static String passwd = "passphrase";
+
+    public static void main(String[] args) throws Exception {
+        String keyFilename =
+            System.getProperty("test.src", "./") + "/" + pathToStores +
+                "/" + keyStoreFile;
+        String trustFilename =
+            System.getProperty("test.src", "./") + "/" + pathToStores +
+                "/" + trustStoreFile;
+
+        System.setProperty("javax.net.ssl.keyStore", keyFilename);
+        System.setProperty("javax.net.ssl.keyStorePassword", passwd);
+        System.setProperty("javax.net.ssl.trustStore", trustFilename);
+        System.setProperty("javax.net.ssl.trustStorePassword", passwd);
+
+        new BlockedAsyncClose();
+    }
+
+    public BlockedAsyncClose() throws Exception {
+        SSLServerSocketFactory sslssf =
+                (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
+        InetAddress loopback = InetAddress.getLoopbackAddress();
+        ss = (SSLServerSocket)sslssf.createServerSocket();
+        ss.bind(new InetSocketAddress(loopback, 0));
+
+        SSLSocketFactory sslsf =
+            (SSLSocketFactory)SSLSocketFactory.getDefault();
+        socket = (SSLSocket)sslsf.createSocket(loopback, ss.getLocalPort());
+        SSLSocket serverSoc = (SSLSocket)ss.accept();
+        ss.close();
+
+        (new Thread(this)).start();
+        serverSoc.startHandshake();
+
+        boolean closeIsReady = closeCondition.await(90L, TimeUnit.SECONDS);
+        if (!closeIsReady) {
+            System.out.println(
+                    "Ignore, the closure is not ready yet in 90 seconds.");
+            return;
+        }
+
+        socket.setSoLinger(true, 10);
+        System.out.println("Calling Socket.close");
+
+        // Sleep for a while so that the write thread blocks by hitting the
+        // output stream buffer limit.
+        Thread.sleep(1000);
+
+        socket.close();
+        System.out.println("ssl socket get closed");
+        System.out.flush();
+    }
+
+    // block in write
+    public void run() {
+        byte[] ba = new byte[1024];
+        for (int i = 0; i < ba.length; i++) {
+            ba[i] = 0x7A;
+        }
+
+        try {
+            OutputStream os = socket.getOutputStream();
+            int count = 0;
+
+            // 1st round write
+            count += ba.length;
+            System.out.println(count + " bytes to be written");
+            os.write(ba);
+            System.out.println(count + " bytes written");
+
+            // Signal, ready to close.
+            closeCondition.countDown();
+
+            // write more
+            while (true) {
+                count += ba.length;
+                System.out.println(count + " bytes to be written");
+                os.write(ba);
+                System.out.println(count + " bytes written");
+            }
+        } catch (SocketException se) {
+            // the closing may be in progress
+            System.out.println("interrupted? " + se);
+        } catch (Exception e) {
+            if (socket.isClosed() || socket.isOutputShutdown()) {
+                System.out.println("interrupted, the socket is closed");
+            } else {
+                throw new RuntimeException("interrupted?", e);
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/keytool/ListOrder.java	Thu Jun 20 14:47:20 2019 -0400
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2019, 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 8225392
+ * @summary Comparison builds are failing due to cacerts file
+ * @library /test/lib
+ */
+
+import jdk.test.lib.SecurityTools;
+
+import java.util.Random;
+
+public class ListOrder {
+
+    public static void main(String[] args) throws Throwable {
+
+        Random rand = new Random();
+        for (int i = 0; i < 10; i++) {
+            gen(String.format("a%02d", rand.nextInt(100)));
+        }
+
+        String last = "";
+        for (String line : SecurityTools.keytool(
+                "-keystore ks -storepass changeit -list").asLines()) {
+            if (line.contains("PrivateKeyEntry")) {
+                // This is the line starting with the alias
+                System.out.println(line);
+                if (line.compareTo(last) <= 0) {
+                    throw new RuntimeException("Not ordered");
+                } else {
+                    last = line;
+                }
+            }
+        }
+    }
+
+    static void gen(String a) throws Exception {
+        // Do not check result, there might be duplicated alias(es).
+        SecurityTools.keytool("-keystore ks -storepass changeit "
+                + "-keyalg ec -genkeypair -alias " + a + " -dname CN=" + a);
+    }
+}
--- a/test/langtools/tools/javac/T6942649.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/langtools/tools/javac/T6942649.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6942649
+ * @bug 6942649 8225748
  * @summary add hidden option to identify location and version of javac classes
  * @modules jdk.compiler
  */
@@ -60,7 +60,7 @@
                 throw new Exception("location of class not found in output");
         }
 
-        if (!out.contains("MD5 checksum: "))
+        if (!out.contains("SHA-256 checksum: "))
             throw new Exception("checksum not found in output");
     }
 }
--- a/test/langtools/tools/javap/T4884240.java	Thu Jun 20 14:13:50 2019 -0400
+++ b/test/langtools/tools/javap/T4884240.java	Thu Jun 20 14:47:20 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 4884240
+ * @bug 4884240 8225748
  * @summary additional option required for javap
  * @modules jdk.jdeps/com.sun.tools.javap
  */
@@ -47,7 +47,7 @@
         if (lines.length < 3
             || !lines[0].trim().startsWith("Classfile")
             || !lines[1].trim().startsWith("Last modified")
-            || !lines[2].trim().startsWith("MD5")) {
+            || !lines[2].trim().startsWith("SHA-256")) {
             System.out.println(sw);
             throw new Exception("unexpected output");
         }