changeset 54527:daf1ee5cff52 intrinsics-project

Automatic merge with default
author mcimadamore
date Wed, 23 Jan 2019 21:11:23 +0100
parents ee29b516a36a e3ed96060992
children 6b4df43ffc71
files .hgtags make/autoconf/flags-cflags.m4 make/conf/jib-profiles.js src/hotspot/cpu/aarch64/assembler_aarch64.hpp src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp src/hotspot/cpu/arm/nativeInst_arm_32.hpp src/hotspot/cpu/ppc/macroAssembler_ppc.hpp src/hotspot/cpu/ppc/stubGenerator_ppc.cpp src/hotspot/cpu/ppc/stubRoutines_ppc.hpp src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp src/hotspot/cpu/s390/codeBuffer_s390.hpp src/hotspot/cpu/sparc/nativeInst_sparc.hpp src/hotspot/cpu/x86/gc/z/zBarrierSetAssembler_x86.cpp src/hotspot/cpu/x86/nativeInst_x86.hpp src/hotspot/cpu/x86/x86.ad src/hotspot/os/aix/os_aix.inline.hpp src/hotspot/os/bsd/os_bsd.cpp src/hotspot/os/bsd/os_bsd.inline.hpp src/hotspot/os/linux/os_linux.cpp src/hotspot/os/linux/os_linux.hpp src/hotspot/os/linux/os_linux.inline.hpp src/hotspot/os/windows/os_windows.cpp src/hotspot/os/windows/os_windows.hpp src/hotspot/os/windows/os_windows.inline.hpp src/hotspot/os_cpu/linux_aarch64/globals_linux_aarch64.hpp src/hotspot/os_cpu/linux_s390/globals_linux_s390.hpp src/hotspot/share/adlc/arena.hpp src/hotspot/share/c1/c1_LIR.hpp src/hotspot/share/ci/bcEscapeAnalyzer.cpp src/hotspot/share/ci/ciEnv.hpp src/hotspot/share/ci/ciMethodData.cpp src/hotspot/share/ci/ciMethodData.hpp src/hotspot/share/ci/ciObjectFactory.hpp src/hotspot/share/classfile/classFileParser.cpp src/hotspot/share/classfile/dictionary.hpp src/hotspot/share/classfile/javaClasses.cpp src/hotspot/share/classfile/javaClasses.hpp src/hotspot/share/classfile/javaClasses.inline.hpp src/hotspot/share/classfile/packageEntry.hpp src/hotspot/share/classfile/symbolTable.hpp src/hotspot/share/classfile/systemDictionary.cpp src/hotspot/share/classfile/vmSymbols.hpp src/hotspot/share/code/codeHeapState.cpp src/hotspot/share/code/compiledMethod.hpp src/hotspot/share/code/location.hpp src/hotspot/share/code/nmethod.hpp src/hotspot/share/code/relocInfo.hpp src/hotspot/share/compiler/compileBroker.cpp src/hotspot/share/compiler/compileTask.hpp src/hotspot/share/compiler/compilerOracle.hpp src/hotspot/share/compiler/methodLiveness.cpp src/hotspot/share/compiler/methodLiveness.hpp src/hotspot/share/gc/cms/cmsOopClosures.hpp src/hotspot/share/gc/epsilon/epsilonHeap.hpp src/hotspot/share/gc/g1/dirtyCardQueue.hpp src/hotspot/share/gc/g1/evacuationInfo.hpp src/hotspot/share/gc/g1/g1Allocator.hpp src/hotspot/share/gc/g1/g1CollectedHeap.hpp src/hotspot/share/gc/g1/g1ConcurrentMark.hpp src/hotspot/share/gc/g1/g1ConcurrentMark.inline.hpp src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp src/hotspot/share/gc/shared/barrierSet.hpp src/hotspot/share/gc/shared/blockOffsetTable.hpp src/hotspot/share/gc/shared/collectedHeap.cpp src/hotspot/share/gc/shared/collectedHeap.hpp src/hotspot/share/gc/shared/collectedHeap.inline.hpp src/hotspot/share/gc/shared/gcPolicyCounters.hpp src/hotspot/share/gc/shared/gcTrace.hpp src/hotspot/share/gc/shared/parallelCleaning.hpp src/hotspot/share/gc/shared/ptrQueue.hpp src/hotspot/share/gc/shared/workerManager.hpp src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp src/hotspot/share/gc/shenandoah/shenandoahStrDedupQueue.cpp src/hotspot/share/gc/shenandoah/shenandoahStringDedup.cpp src/hotspot/share/gc/shenandoah/shenandoahStringDedup.hpp src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.hpp src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.inline.hpp src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp src/hotspot/share/interpreter/bytecodeTracer.hpp src/hotspot/share/interpreter/invocationCounter.hpp src/hotspot/share/interpreter/oopMapCache.hpp src/hotspot/share/jfr/leakprofiler/emitEventOperation.hpp src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp src/hotspot/share/jvmci/jvmciCompiler.cpp src/hotspot/share/jvmci/jvmciEnv.cpp src/hotspot/share/jvmci/jvmciEnv.hpp src/hotspot/share/logging/logDecorators.hpp src/hotspot/share/logging/logFileOutput.hpp src/hotspot/share/logging/logTag.hpp src/hotspot/share/memory/allocation.hpp src/hotspot/share/memory/padded.hpp src/hotspot/share/memory/virtualspace.hpp src/hotspot/share/oops/arrayKlass.hpp src/hotspot/share/oops/instanceKlass.cpp src/hotspot/share/oops/instanceKlass.hpp src/hotspot/share/oops/klass.cpp src/hotspot/share/oops/klass.hpp src/hotspot/share/oops/metadata.hpp src/hotspot/share/oops/method.hpp src/hotspot/share/oops/methodData.hpp src/hotspot/share/oops/objArrayKlass.hpp src/hotspot/share/oops/oop.hpp src/hotspot/share/oops/oopsHierarchy.hpp src/hotspot/share/oops/symbol.hpp src/hotspot/share/oops/typeArrayKlass.hpp src/hotspot/share/opto/callnode.hpp src/hotspot/share/opto/compile.cpp src/hotspot/share/opto/compile.hpp src/hotspot/share/opto/library_call.cpp src/hotspot/share/opto/loopPredicate.cpp src/hotspot/share/opto/loopTransform.cpp src/hotspot/share/opto/loopnode.hpp src/hotspot/share/opto/loopopts.cpp src/hotspot/share/opto/mulnode.hpp src/hotspot/share/opto/regmask.cpp src/hotspot/share/opto/regmask.hpp src/hotspot/share/prims/jni.cpp src/hotspot/share/prims/jvm.cpp src/hotspot/share/runtime/arguments.cpp src/hotspot/share/runtime/compilationPolicy.cpp src/hotspot/share/runtime/compilationPolicy.hpp src/hotspot/share/runtime/deoptimization.hpp src/hotspot/share/runtime/flags/jvmFlag.hpp src/hotspot/share/runtime/frame.hpp src/hotspot/share/runtime/globals.hpp src/hotspot/share/runtime/globals_extension.hpp src/hotspot/share/runtime/java.cpp src/hotspot/share/runtime/jniHandles.hpp src/hotspot/share/runtime/mutexLocker.hpp src/hotspot/share/runtime/os.hpp src/hotspot/share/runtime/os.inline.hpp src/hotspot/share/runtime/osThread.hpp src/hotspot/share/runtime/stackValue.hpp src/hotspot/share/runtime/thread.cpp src/hotspot/share/runtime/thread.hpp src/hotspot/share/runtime/thread.inline.hpp src/hotspot/share/runtime/tieredThresholdPolicy.cpp src/hotspot/share/utilities/concurrentHashTable.hpp src/hotspot/share/utilities/concurrentHashTable.inline.hpp src/hotspot/share/utilities/constantTag.hpp src/hotspot/share/utilities/exceptions.hpp src/hotspot/share/utilities/globalDefinitions.hpp src/java.base/share/classes/java/io/PrintStream.java src/java.base/share/classes/java/lang/Class.java src/java.base/share/classes/java/lang/Long.java src/java.base/share/classes/java/lang/String.java src/java.base/share/classes/java/lang/constant/ClassDesc.java src/java.base/share/classes/java/lang/constant/ConstantUtils.java src/java.base/share/classes/java/lang/constant/DirectMethodHandleDescImpl.java src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java src/java.base/share/classes/java/lang/constant/DynamicConstantDesc.java src/java.base/share/classes/java/lang/constant/ReferenceClassDescImpl.java src/java.base/share/classes/java/lang/invoke/VarHandle.java src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template src/java.base/share/classes/java/math/BigDecimal.java src/java.base/share/classes/sun/nio/ch/Net.java src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java src/java.base/share/classes/sun/security/tools/keytool/Main.java src/java.base/share/conf/security/java.security src/java.base/share/lib/security/default.policy src/java.base/unix/native/libnet/net_util_md.c src/java.base/unix/native/libnio/ch/Net.c src/java.base/unix/native/libnio/ch/SocketChannelImpl.c src/java.base/unix/native/libnio/ch/SocketDispatcher.c src/java.base/windows/native/libnio/ch/Net.c src/java.base/windows/native/libnio/ch/SocketChannelImpl.c src/java.compiler/share/classes/javax/lang/model/util/Elements.java src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m src/java.desktop/share/classes/sun/awt/Graphics2Delegate.java src/java.desktop/share/classes/sun/awt/TracedEventQueue.java src/java.desktop/share/classes/sun/awt/image/BadDepthException.java src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeMessageQueue.cpp src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java src/jdk.crypto.mscapi/windows/classes/sun/security/mscapi/CKeyStore.java src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java test/hotspot/gtest/utilities/test_globalDefinitions.cpp test/hotspot/jtreg/ProblemList.txt test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/TestDriver.java test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/TestDriver.java test/hotspot/jtreg/vmTestbase/nsk/share/test/StressOptions.java test/jdk/ProblemList.txt test/jdk/java/lang/String/AlignIndent.java test/jdk/java/lang/constant/ClassDescTest.java test/jdk/java/lang/constant/CondyDescTest.java test/jdk/java/lang/constant/boottest/java.base/java/lang/constant/ConstantUtilsTest.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java test/jdk/java/lang/invoke/VarHandles/VarHandleTestAccessString.java test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/InheritedChannelTest.java test/jdk/javax/net/ssl/compatibility/Parameter.java test/jdk/sun/security/util/Resources/NewNamesFormat.java test/jdk/sun/security/util/Resources/NewResourcesNames.java test/jdk/tools/launcher/ExecutionEnvironment.java test/jdk/tools/launcher/Test7029048.java test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLankmarkRegions.java test/langtools/tools/javac/RawStringLiteralLang.java test/langtools/tools/javac/RawStringLiteralLangAPI.java test/langtools/tools/javac/diags/examples/RawStringLiteral.java
diffstat 85 files changed, 7742 insertions(+), 2013 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/linux/waitBarrier_linux.cpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled/precompiled.hpp"
+#include "runtime/orderAccess.hpp"
+#include "runtime/os.hpp"
+#include "waitBarrier_linux.hpp"
+#include <sys/syscall.h>
+#include <linux/futex.h>
+
+#define check_with_errno(check_type, cond, msg)                             \
+  do {                                                                      \
+    int err = errno;                                                        \
+    check_type(cond, "%s: error='%s' (errno=%s)", msg, os::strerror(err),   \
+               os::errno_name(err));                                        \
+} while (false)
+
+#define guarantee_with_errno(cond, msg) check_with_errno(guarantee, cond, msg)
+
+static int futex(volatile int *addr, int futex_op, int op_arg) {
+  return syscall(SYS_futex, addr, futex_op, op_arg, NULL, NULL, 0);
+}
+
+void LinuxWaitBarrier::arm(int barrier_tag) {
+  assert(_futex_barrier == 0, "Should not be already armed: "
+         "_futex_barrier=%d", _futex_barrier);
+  _futex_barrier = barrier_tag;
+  OrderAccess::fence();
+}
+
+void LinuxWaitBarrier::disarm() {
+  assert(_futex_barrier != 0, "Should be armed/non-zero.");
+  _futex_barrier = 0;
+  int s = futex(&_futex_barrier,
+                FUTEX_WAKE_PRIVATE,
+                INT_MAX /* wake a max of this many threads */);
+  guarantee_with_errno(s > -1, "futex FUTEX_WAKE failed");
+}
+
+void LinuxWaitBarrier::wait(int barrier_tag) {
+  assert(barrier_tag != 0, "Trying to wait on disarmed value");
+  if (barrier_tag == 0 ||
+      barrier_tag != _futex_barrier) {
+    OrderAccess::fence();
+    return;
+  }
+  do {
+    int s = futex(&_futex_barrier,
+                  FUTEX_WAIT_PRIVATE,
+                  barrier_tag /* should be this tag */);
+    guarantee_with_errno((s == 0) ||
+                         (s == -1 && errno == EAGAIN) ||
+                         (s == -1 && errno == EINTR),
+                         "futex FUTEX_WAIT failed");
+    // Return value 0: woken up, but re-check in case of spurious wakeup.
+    // Error EINTR: woken by signal, so re-check and re-wait if necessary.
+    // Error EAGAIN: we are already disarmed and so will pass the check.
+  } while (barrier_tag == _futex_barrier);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os/linux/waitBarrier_linux.hpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef OS_LINUX_WAITBARRIER_LINUX_HPP
+#define OS_LINUX_WAITBARRIER_LINUX_HPP
+
+#include "memory/allocation.hpp"
+
+class LinuxWaitBarrier : public CHeapObj<mtInternal> {
+  volatile int _futex_barrier;
+
+  // Prevent copying and assignment of LinuxWaitBarrier instances.
+  LinuxWaitBarrier(const LinuxWaitBarrier&);
+  LinuxWaitBarrier& operator=(const LinuxWaitBarrier&);
+
+ public:
+  LinuxWaitBarrier() : _futex_barrier(0) {};
+  ~LinuxWaitBarrier() {};
+
+  const char* description() { return "futex"; }
+
+  void arm(int barrier_tag);
+  void disarm();
+  void wait(int barrier_tag);
+};
+
+#endif // OS_LINUX_WAITBARRIER_LINUX_HPP
--- a/src/hotspot/share/gc/g1/evacuationInfo.hpp	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_GC_G1_EVACUATIONINFO_HPP
-#define SHARE_VM_GC_G1_EVACUATIONINFO_HPP
-
-#include "memory/allocation.hpp"
-
-class EvacuationInfo : public StackObj {
-  uint _collectionset_regions;
-  uint _allocation_regions;
-  size_t _collectionset_used_before;
-  size_t _collectionset_used_after;
-  size_t _alloc_regions_used_before;
-  size_t _bytes_copied;
-  uint   _regions_freed;
-
-public:
-  EvacuationInfo() : _collectionset_regions(0), _allocation_regions(0), _collectionset_used_before(0),
-                     _collectionset_used_after(0), _alloc_regions_used_before(0),
-                     _bytes_copied(0), _regions_freed(0) { }
-
-  void set_collectionset_regions(uint collectionset_regions) {
-    _collectionset_regions = collectionset_regions;
-  }
-
-  void set_allocation_regions(uint allocation_regions) {
-    _allocation_regions = allocation_regions;
-  }
-
-  void set_collectionset_used_before(size_t used) {
-    _collectionset_used_before = used;
-  }
-
-  void increment_collectionset_used_after(size_t used) {
-    _collectionset_used_after += used;
-  }
-
-  void set_alloc_regions_used_before(size_t used) {
-    _alloc_regions_used_before = used;
-  }
-
-  void set_bytes_copied(size_t copied) {
-    _bytes_copied = copied;
-  }
-
-  void set_regions_freed(uint freed) {
-    _regions_freed += freed;
-  }
-
-  uint   collectionset_regions()     { return _collectionset_regions; }
-  uint   allocation_regions()        { return _allocation_regions; }
-  size_t collectionset_used_before() { return _collectionset_used_before; }
-  size_t collectionset_used_after()  { return _collectionset_used_after; }
-  size_t alloc_regions_used_before() { return _alloc_regions_used_before; }
-  size_t bytes_copied()              { return _bytes_copied; }
-  uint   regions_freed()             { return _regions_freed; }
-};
-
-#endif // SHARE_VM_GC_G1_EVACUATIONINFO_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1EvacuationInfo.hpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,81 @@
+/*
+ * 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
+ * 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_G1_G1EVACUATIONINFO_HPP
+#define SHARE_GC_G1_G1EVACUATIONINFO_HPP
+
+#include "memory/allocation.hpp"
+
+class G1EvacuationInfo : public StackObj {
+  uint _collectionset_regions;
+  uint _allocation_regions;
+  size_t _collectionset_used_before;
+  size_t _collectionset_used_after;
+  size_t _alloc_regions_used_before;
+  size_t _bytes_copied;
+  uint   _regions_freed;
+
+public:
+  G1EvacuationInfo() : _collectionset_regions(0), _allocation_regions(0), _collectionset_used_before(0),
+                     _collectionset_used_after(0), _alloc_regions_used_before(0),
+                     _bytes_copied(0), _regions_freed(0) { }
+
+  void set_collectionset_regions(uint collectionset_regions) {
+    _collectionset_regions = collectionset_regions;
+  }
+
+  void set_allocation_regions(uint allocation_regions) {
+    _allocation_regions = allocation_regions;
+  }
+
+  void set_collectionset_used_before(size_t used) {
+    _collectionset_used_before = used;
+  }
+
+  void increment_collectionset_used_after(size_t used) {
+    _collectionset_used_after += used;
+  }
+
+  void set_alloc_regions_used_before(size_t used) {
+    _alloc_regions_used_before = used;
+  }
+
+  void set_bytes_copied(size_t copied) {
+    _bytes_copied = copied;
+  }
+
+  void set_regions_freed(uint freed) {
+    _regions_freed += freed;
+  }
+
+  uint   collectionset_regions()     { return _collectionset_regions; }
+  uint   allocation_regions()        { return _allocation_regions; }
+  size_t collectionset_used_before() { return _collectionset_used_before; }
+  size_t collectionset_used_after()  { return _collectionset_used_after; }
+  size_t alloc_regions_used_before() { return _alloc_regions_used_before; }
+  size_t bytes_copied()              { return _bytes_copied; }
+  uint   regions_freed()             { return _regions_freed; }
+};
+
+#endif // SHARE_GC_G1_G1EVACUATIONINFO_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shared/barrierSet.inline.hpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. 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.
+ */
+
+#ifndef SHARE_GC_SHARED_BARRIERSET_INLINE_HPP
+#define SHARE_GC_SHARED_BARRIERSET_INLINE_HPP
+
+#include "gc/shared/barrierSet.hpp"
+#include "oops/accessDecorators.hpp"
+#include "oops/arrayOop.hpp"
+#include "oops/compressedOops.inline.hpp"
+#include "oops/objArrayOop.inline.hpp"
+#include "oops/oop.hpp"
+
+template <DecoratorSet decorators, typename BarrierSetT>
+template <typename T>
+inline bool BarrierSet::AccessBarrier<decorators, BarrierSetT>::oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
+                                                                                      arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
+                                                                                      size_t length) {
+  T* src = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
+  T* dst = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
+
+  if (!HasDecorator<decorators, ARRAYCOPY_CHECKCAST>::value) {
+    // Covariant, copy without checks
+    return Raw::oop_arraycopy(NULL, 0, src, NULL, 0, dst, length);
+  }
+
+  // Copy each element with checking casts
+  Klass* const dst_klass = objArrayOop(dst_obj)->element_klass();
+  for (const T* const end = src + length; src < end; src++, dst++) {
+    const T elem = *src;
+    if (!oopDesc::is_instanceof_or_null(CompressedOops::decode(elem), dst_klass)) {
+      return false;
+    }
+    *dst = elem;
+  }
+
+  return true;
+}
+
+#endif // SHARE_GC_SHARED_BARRIERSET_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,35 @@
+/*
+ * 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_SHENANDOAHSTRINGDEDUP_INLINE_HPP
+#define SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP
+
+#include "classfile/javaClasses.inline.hpp"
+#include "gc/shenandoah/shenandoahStringDedup.hpp"
+
+bool ShenandoahStringDedup::is_candidate(oop obj) {
+  return java_lang_String::is_instance_inlined(obj) &&
+         java_lang_String::value(obj) != NULL;
+}
+
+#endif // SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/utilities/lockFreeStack.hpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,177 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_UTILITIES_LOCKFREESTACK_HPP
+#define SHARE_UTILITIES_LOCKFREESTACK_HPP
+
+#include "runtime/atomic.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/macros.hpp"
+
+// The LockFreeStack class template provides a lock-free LIFO. The objects
+// in the sequence are intrusively linked via a member in the objects.  As
+// a result, there is no allocation involved in adding objects to the stack
+// or removing them from the stack.
+//
+// To be used in a LockFreeStack of objects of type T, an object of
+// type T must have a list entry member of type T* volatile, with an
+// non-member accessor function returning a pointer to that member.  A
+// LockFreeStack is associated with the class of its elements and an
+// entry member from that class.
+//
+// An object can be in multiple stacks at the same time, so long as
+// each stack uses a different entry member. That is, the class of the
+// object must have multiple LockFreeStack entry members, one for each
+// stack in which the object may simultaneously be an element.
+//
+// LockFreeStacks support polymorphic elements.  Because the objects
+// in a stack are externally managed, rather than being embedded
+// values in the stack, the actual type of such objects may be more
+// specific than the stack's element type.
+//
+// \tparam T is the class of the elements in the stack.
+//
+// \tparam next_ptr is a function pointer.  Applying this function to
+// an object of type T must return a pointer to the list entry member
+// of the object associated with the LockFreeStack type.
+template<typename T, T* volatile* (*next_ptr)(T&)>
+class LockFreeStack {
+  T* volatile _top;
+
+  void prepend_impl(T* first, T* last) {
+    T* cur = top();
+    T* old;
+    do {
+      old = cur;
+      set_next(*last, cur);
+      cur = Atomic::cmpxchg(first, &_top, cur);
+    } while (old != cur);
+  }
+
+  // Noncopyable.
+  LockFreeStack(const LockFreeStack&);
+  LockFreeStack& operator=(const LockFreeStack&);
+
+public:
+  LockFreeStack() : _top(NULL) {}
+  ~LockFreeStack() { assert(empty(), "stack not empty"); }
+
+  // Atomically removes the top object from this stack and returns a
+  // pointer to that object, or NULL if this stack is empty. Acts as a
+  // full memory barrier. Subject to ABA behavior; callers must ensure
+  // usage is safe.
+  T* pop() {
+    T* result = top();
+    T* old;
+    do {
+      old = result;
+      T* new_top = NULL;
+      if (result != NULL) {
+        new_top = next(*result);
+      }
+      // CAS even on empty pop, for consistent membar bahavior.
+      result = Atomic::cmpxchg(new_top, &_top, result);
+    } while (result != old);
+    if (result != NULL) {
+      set_next(*result, NULL);
+    }
+    return result;
+  }
+
+  // Atomically exchange the list of elements with NULL, returning the old
+  // list of elements.  Acts as a full memory barrier.
+  // postcondition: empty()
+  T* pop_all() {
+    return Atomic::xchg((T*)NULL, &_top);
+  }
+
+  // Atomically adds value to the top of this stack.  Acts as a full
+  // memory barrier.
+  void push(T& value) {
+    assert(next(value) == NULL, "precondition");
+    prepend_impl(&value, &value);
+  }
+
+  // Atomically adds the list of objects (designated by first and
+  // last) before the objects already in this stack, in the same order
+  // as in the list. Acts as a full memory barrier.
+  // precondition: next(last) == NULL.
+  // postcondition: top() == &first, next(last) == old top().
+  void prepend(T& first, T& last) {
+    assert(next(last) == NULL, "precondition");
+#ifdef ASSERT
+    for (T* p = &first; p != &last; p = next(*p)) {
+      assert(p != NULL, "invalid prepend list");
+    }
+#endif
+    prepend_impl(&first, &last);
+  }
+
+  // Atomically adds the list of objects headed by first before the
+  // objects already in this stack, in the same order as in the list.
+  // Acts as a full memory barrier.
+  // postcondition: top() == &first.
+  void prepend(T& first) {
+    T* last = &first;
+    while (true) {
+      T* step_to = next(*last);
+      if (step_to == NULL) break;
+      last = step_to;
+    }
+    prepend_impl(&first, last);
+  }
+
+  // Return true if the stack is empty.
+  bool empty() const { return top() == NULL; }
+
+  // Return the most recently pushed element, or NULL if the stack is empty.
+  // The returned element is not removed from the stack.
+  T* top() const { return Atomic::load(&_top); }
+
+  // Return the number of objects in the stack.  There must be no concurrent
+  // pops while the length is being determined.
+  size_t length() const {
+    size_t result = 0;
+    for (const T* current = top(); current != NULL; current = next(*current)) {
+      ++result;
+    }
+    return result;
+  }
+
+  // Return the entry following value in the list used by the
+  // specialized LockFreeStack class.
+  static T* next(const T& value) {
+    return Atomic::load(next_ptr(const_cast<T&>(value)));
+  }
+
+  // Set the entry following value to new_next in the list used by the
+  // specialized LockFreeStack class.  Not thread-safe; in particular,
+  // if value is in an instance of this specialization of LockFreeStack,
+  // there must be no concurrent push or pop operations on that stack.
+  static void set_next(T& value, T* new_next) {
+    Atomic::store(new_next, next_ptr(value));
+  }
+};
+
+#endif // SHARE_UTILITIES_LOCKFREESTACK_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/utilities/population_count.hpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_UTILITIES_POPULATION_COUNT_HPP
+#define SHARE_UTILITIES_POPULATION_COUNT_HPP
+
+#include "utilities/debug.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+// Returns the population count of x, i.e., the number of bits set in x.
+//
+// Adapted from Hacker's Delight, 2nd Edition, Figure 5-2.
+//
+// Ideally this should be dispatched per platform to use optimized
+// instructions when available, such as POPCNT on modern x86/AMD. Our builds
+// still target and support older architectures that might lack support for
+// these, however. For example, with current build configurations,
+// __builtin_popcount(x) would generate a call to a similar but slower 64-bit
+// version of this 32-bit implementation.
+static uint32_t population_count(uint32_t x) {
+  x -= ((x >> 1) & 0x55555555);
+  x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+  return (((x + (x >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
+}
+
+#endif // SHARE_UTILITIES_POPULATION_COUNT_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/utilities/waitBarrier.hpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_UTILITIES_WAITBARRIER_HPP
+#define SHARE_UTILITIES_WAITBARRIER_HPP
+
+#include "memory/allocation.hpp"
+#include "runtime/thread.hpp"
+#include "utilities/debug.hpp"
+#include "utilities/waitBarrier_generic.hpp"
+
+#if defined(LINUX)
+#include "waitBarrier_linux.hpp"
+typedef LinuxWaitBarrier WaitBarrierDefault;
+#else
+typedef GenericWaitBarrier WaitBarrierDefault;
+#endif
+
+// Platform independent WaitBarrier API.
+// An armed WaitBarrier prevents threads from advancing until the threads are
+// woken by calling disarm(). The barrier is armed by setting a non-zero value
+// - the tag. When the WaitBarrier is created, a thread is designated the owner
+// and is the thread that should arm and disarm the WaitBarrier. In debug builds
+// this is enforced.
+//
+// Expected Usage:
+//  - Arming thread:
+//     tag = ...;  // non-zero value
+//     barrier.arm(tag);
+//     <publish tag>
+//     <work>
+//     barrier.disarm();
+//
+//    - After arm(tag) returns any thread calling wait(tag) will block.
+//    - Calling disarm() guarantees any thread calling or that has wait(tag) will
+//      return. Either they will see the WaitBarrier as disarmed or they will be
+//      unblocked and eligible to execute again when disarm() returns.
+//    - After calling disarm() the barrier is ready to be re-armed with a new tag.
+//      (may not be re-armed with last used tag)
+//
+//  - Waiting threads
+//     wait(tag); // don't execute following code unless 'safe'
+//     <work>
+//
+//    - A call to wait(tag) will block if the barrier is armed with the value
+//      'tag'; else it will return immediately.
+//    - A blocked thread is eligible to execute again once the barrier is
+//      disarmed when disarm() has been called.
+//
+// It is a usage error to:
+//  - call arm on a barrier that is already armed
+//  - call disarm on a barrier that is not armed
+//  - arm with the same tag as last used
+// Usage errors are checked in debug builds but may be ignored otherwise.
+//
+// A primary goal of the WaitBarrier implementation is to wake all waiting
+// threads as fast, and as concurrently, as possible.
+//
+template <typename WaitBarrierImpl>
+class WaitBarrierType : public CHeapObj<mtInternal> {
+  WaitBarrierImpl _impl;
+
+  // Prevent copying and assignment of WaitBarrier instances.
+  WaitBarrierType(const WaitBarrierDefault&);
+  WaitBarrierType& operator=(const WaitBarrierDefault&);
+
+#ifdef ASSERT
+  int _last_arm_tag;
+  Thread* _owner;
+#endif
+
+ public:
+  WaitBarrierType(Thread* owner) : _impl() {
+#ifdef ASSERT
+    _last_arm_tag = 0;
+    _owner = owner;
+#endif
+  }
+  ~WaitBarrierType() {}
+
+  // Returns implementation description.
+  const char* description()    { return _impl.description(); }
+
+  // Guarantees any thread calling wait() with same tag will be blocked.
+  // Provides a trailing fence.
+  void arm(int barrier_tag) {
+#ifdef ASSERT
+    assert(_last_arm_tag != barrier_tag, "Re-arming with same tag");
+    _last_arm_tag = barrier_tag;
+    assert(_owner == Thread::current(), "Not owner thread");
+#endif
+    _impl.arm(barrier_tag);
+  }
+
+  // Guarantees any thread that called wait() will be awake when it returns.
+  // Provides a trailing fence.
+  void disarm() {
+    assert(_owner == Thread::current(), "Not owner thread");
+    _impl.disarm();
+  }
+
+  // Guarantees not to return until disarm() is called,
+  // if called with currently armed tag (otherwise returns immediately).
+  // Implementations must guarantee no spurious wakeups.
+  // Provides a trailing fence.
+  void wait(int barrier_tag) {
+    assert(_owner != Thread::current(), "Trying to wait with owner thread");
+    _impl.wait(barrier_tag);
+  }
+};
+
+typedef WaitBarrierType<WaitBarrierDefault> WaitBarrier;
+
+#endif // SHARE_UTILITIES_WAITBARRIER_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/utilities/waitBarrier_generic.cpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/orderAccess.hpp"
+#include "runtime/os.hpp"
+#include "utilities/waitBarrier_generic.hpp"
+#include "utilities/spinYield.hpp"
+
+void GenericWaitBarrier::arm(int barrier_tag) {
+  assert(_barrier_tag == 0, "Already armed");
+  assert(_waiters == 0, "We left a thread hanging");
+  _barrier_tag = barrier_tag;
+  _waiters = 0;
+  OrderAccess::fence();
+}
+
+int GenericWaitBarrier::wake_if_needed() {
+  assert(_barrier_tag == 0, "Not disarmed");
+  int w = _waiters;
+  if (w == 0) {
+    // Load of _barrier_threads in caller must not pass the load of _waiters.
+    OrderAccess::loadload();
+    return 0;
+  }
+  assert(w > 0, "Bad counting");
+  // We need an exact count which never goes below zero,
+  // otherwise the semaphore may be signalled too many times.
+  if (Atomic::cmpxchg(w - 1, &_waiters, w) == w) {
+    _sem_barrier.signal();
+    return w - 1;
+  }
+  return w;
+}
+
+void GenericWaitBarrier::disarm() {
+  assert(_barrier_tag != 0, "Not armed");
+  _barrier_tag = 0;
+  // Loads of _barrier_threads/_waiters must not float above disarm store and
+  // disarm store must not sink below.
+  OrderAccess::fence();
+  int left;
+  SpinYield sp;
+  do {
+    left = GenericWaitBarrier::wake_if_needed();
+    if (left == 0 && _barrier_threads > 0) {
+      // There is no thread to wake but we still have barrier threads.
+      sp.wait();
+    }
+    // We must loop here until there are no waiters or potential waiters.
+  } while (left > 0 || _barrier_threads > 0);
+  // API specifies disarm() must provide a trailing fence.
+  OrderAccess::fence();
+}
+
+void GenericWaitBarrier::wait(int barrier_tag) {
+  assert(barrier_tag != 0, "Trying to wait on disarmed value");
+  if (barrier_tag != _barrier_tag) {
+    // API specifies wait() must provide a trailing fence.
+    OrderAccess::fence();
+    return;
+  }
+  Atomic::add(1, &_barrier_threads);
+  if (barrier_tag != 0 && barrier_tag == _barrier_tag) {
+    Atomic::add(1, &_waiters);
+    _sem_barrier.wait();
+    // We help out with posting, but we need to do so before we decrement the
+    // _barrier_threads otherwise we might wake threads up in next wait.
+    GenericWaitBarrier::wake_if_needed();
+  }
+  Atomic::add(-1, &_barrier_threads);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/utilities/waitBarrier_generic.hpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,59 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef SHARE_UTILITIES_WAITBARRIER_GENERIC_HPP
+#define SHARE_UTILITIES_WAITBARRIER_GENERIC_HPP
+
+#include "memory/allocation.hpp"
+#include "runtime/semaphore.hpp"
+
+// In addition to the barrier tag, it uses two counters to keep the semaphore
+// count correct and not leave any late thread waiting.
+class GenericWaitBarrier : public CHeapObj<mtInternal> {
+  volatile int _barrier_tag;
+  // The number of threads waiting on or about to wait on the semaphore.
+  volatile int _waiters;
+  // The number of threads in the wait path, before or after the tag check.
+  // These threads can become waiters.
+  volatile int _barrier_threads;
+  Semaphore _sem_barrier;
+
+  // Prevent copying and assignment of GenericWaitBarrier instances.
+  GenericWaitBarrier(const GenericWaitBarrier&);
+  GenericWaitBarrier& operator=(const GenericWaitBarrier&);
+
+  int wake_if_needed();
+
+ public:
+  GenericWaitBarrier() : _barrier_tag(0), _waiters(0), _barrier_threads(0), _sem_barrier(0) {}
+  ~GenericWaitBarrier() {}
+
+  const char* description() { return "semaphore"; }
+
+  void arm(int barrier_tag);
+  void disarm();
+  void wait(int barrier_tag);
+};
+
+#endif // SHARE_UTILITIES_WAITBARRIER_GENERIC_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/vm/annotation/Hidden.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.vm.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * A method or constructor may be annotated as "hidden" to hint it is desirable
+ * to omit it from stack traces.
+ *
+ * @implNote
+ * This annotation only takes effect for methods or constructors of classes
+ * loaded by the boot loader.  Annotations on methods or constructors of classes
+ * loaded outside of the boot loader are ignored.
+ *
+ * <p>HotSpot JVM provides diagnostic option {@code -XX:+ShowHiddenFrames} to
+ * always show "hidden" frames.
+ */
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Hidden {
+}
--- a/src/java.base/unix/native/libnio/ch/SocketChannelImpl.c	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 <netdb.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <poll.h>
-
-#if __linux__
-#include <netinet/in.h>
-#endif
-
-#include "jni.h"
-#include "jni_util.h"
-#include "net_util.h"
-#include "jvm.h"
-#include "jlong.h"
-#include "sun_nio_ch_SocketChannelImpl.h"
-#include "nio_util.h"
-#include "nio.h"
-
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this,
-                                               jobject fdo, jboolean block)
-{
-    int error = 0;
-    socklen_t n = sizeof(int);
-    jint fd = fdval(env, fdo);
-    int result = 0;
-    struct pollfd poller;
-
-    poller.fd = fd;
-    poller.events = POLLOUT;
-    poller.revents = 0;
-    result = poll(&poller, 1, block ? -1 : 0);
-
-    if (result < 0) {
-        if (errno == EINTR) {
-            return IOS_INTERRUPTED;
-        } else {
-            JNU_ThrowIOExceptionWithLastError(env, "poll failed");
-            return IOS_THROWN;
-        }
-    }
-    if (!block && (result == 0))
-        return IOS_UNAVAILABLE;
-
-    if (result > 0) {
-        errno = 0;
-        result = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &n);
-        if (result < 0) {
-            return handleSocketError(env, errno);
-        } else if (error) {
-            return handleSocketError(env, error);
-        } else if ((poller.revents & POLLHUP) != 0) {
-            return handleSocketError(env, ENOTCONN);
-        }
-        // connected
-        return 1;
-    }
-    return 0;
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData(JNIEnv* env, jclass this,
-                                                    jobject fdo, jbyte b)
-{
-    int n = send(fdval(env, fdo), (const void*)&b, 1, MSG_OOB);
-    return convertReturnVal(env, n, JNI_FALSE);
-}
--- a/src/java.base/unix/native/libnio/ch/SocketDispatcher.c	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2000, 2009, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "jlong.h"
-
-/* this is a fake c file to make the build happy since there is no
-   real SocketDispatcher.c file on Solaris but there is on windows. */
-
-static jfieldID fd_fdID;        /* for jint 'fd' in java.io.FileDescriptor */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/windows/native/libnet/NTLMAuthentication.c	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 <jni.h>
+#include <windows.h>
+#include "jni_util.h"
+#include <urlmon.h>
+
+JNIEXPORT jboolean JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthentication_isTrustedSite(JNIEnv *env, jclass clazz, jstring url )
+{
+
+    HRESULT hr;
+    DWORD dwZone;
+    DWORD  pPolicy = 0;
+    IInternetSecurityManager *spSecurityManager;
+    jboolean ret;
+
+    // Create IInternetSecurityManager
+    hr = CoInternetCreateSecurityManager(NULL, &spSecurityManager, (DWORD)0);
+    if (FAILED(hr)) {
+        return JNI_FALSE;
+    }
+
+    const LPCWSTR bstrURL = (LPCWSTR)((*env)->GetStringChars(env, url, NULL));
+    if (bstrURL == NULL) {
+        if (!(*env)->ExceptionCheck(env))
+            JNU_ThrowOutOfMemoryError(env, NULL);
+        spSecurityManager->lpVtbl->Release(spSecurityManager);
+        return JNI_FALSE;
+    }
+
+    // Determines the policy for the URLACTION_CREDENTIALS_USE action and display
+    // a user interface, if the policy indicates that the user should be queried
+    hr = spSecurityManager->lpVtbl->ProcessUrlAction(
+        spSecurityManager,
+        bstrURL,
+        URLACTION_CREDENTIALS_USE,
+        (LPBYTE)&pPolicy,
+        sizeof(DWORD), 0, 0, 0, 0);
+
+    if (FAILED(hr)) {
+        ret = JNI_FALSE;
+        goto cleanupAndReturn;
+    }
+
+    // If these two User Authentication Logon options is selected
+    // Anonymous logon
+    // Prompt for user name and password
+    if (pPolicy == URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY ||
+        pPolicy == URLPOLICY_CREDENTIALS_MUST_PROMPT_USER) {
+        ret = JNI_FALSE;
+        goto cleanupAndReturn;
+    }
+
+    // Option "Automatic logon with current user name and password" is selected
+    if (pPolicy == URLPOLICY_CREDENTIALS_SILENT_LOGON_OK) {
+        ret = JNI_TRUE;
+        goto cleanupAndReturn;
+    }
+
+    // Option "Automatic logon only in intranet zone" is selected
+    if (pPolicy == URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT) {
+
+        // Gets the zone index from the specified URL
+        hr = spSecurityManager->lpVtbl->MapUrlToZone(
+                spSecurityManager, bstrURL, &dwZone, 0);
+        if (FAILED(hr)) {
+            ret = JNI_FALSE;
+            goto cleanupAndReturn;
+        }
+
+        // Check if the URL is in Local or Intranet zone
+        if (dwZone == URLZONE_INTRANET || dwZone == URLZONE_LOCAL_MACHINE) {
+            ret = JNI_TRUE;
+            goto cleanupAndReturn;
+        }
+    }
+    ret = JNI_FALSE;
+
+cleanupAndReturn:
+    (*env)->ReleaseStringChars(env, url, bstrURL);
+    spSecurityManager->lpVtbl->Release(spSecurityManager);
+    return ret;
+}
--- a/src/java.base/windows/native/libnio/ch/SocketChannelImpl.c	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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 <windows.h>
-#include <winsock2.h>
-#include <ctype.h>
-#include "jni.h"
-#include "jni_util.h"
-#include "jvm.h"
-#include "jlong.h"
-#include "sun_nio_ch_SocketChannelImpl.h"
-
-#include "nio.h"
-#include "nio_util.h"
-#include "net_util.h"
-
-
-static jfieldID ia_addrID;      /* java.net.InetAddress.address */
-
-JNIEXPORT void JNICALL
-Java_sun_nio_ch_SocketChannelImpl_initIDs(JNIEnv *env, jclass cls)
-{
-    CHECK_NULL(cls = (*env)->FindClass(env, "java/net/InetAddress"));
-    CHECK_NULL(ia_addrID = (*env)->GetFieldID(env, cls, "address", "I"));
-}
-
-jint
-handleSocketError(JNIEnv *env, int errorValue)
-{
-    NET_ThrowNew(env, errorValue, NULL);
-    return IOS_THROWN;
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv *env, jobject this,
-                                               jobject fdo, jboolean block)
-{
-    int optError = 0;
-    int result;
-    int n = sizeof(int);
-    jint fd = fdval(env, fdo);
-    fd_set wr, ex;
-    struct timeval t = { 0, 0 };
-
-    FD_ZERO(&wr);
-    FD_ZERO(&ex);
-    FD_SET((u_int)fd, &wr);
-    FD_SET((u_int)fd, &ex);
-
-    result = select(fd+1, 0, &wr, &ex, block ? NULL : &t);
-
-    if (result == 0) {  /* timeout */
-        return block ? 0 : IOS_UNAVAILABLE;
-    } else {
-        if (result == SOCKET_ERROR) { /* select failed */
-            handleSocketError(env, WSAGetLastError());
-            return IOS_THROWN;
-        }
-    }
-
-    // connection established if writable and no error to check
-    if (FD_ISSET(fd, &wr) && !FD_ISSET(fd, &ex)) {
-        return 1;
-    }
-
-    result = getsockopt((SOCKET)fd,
-                        SOL_SOCKET,
-                        SO_ERROR,
-                        (char *)&optError,
-                        &n);
-    if (result == SOCKET_ERROR) {
-        int lastError = WSAGetLastError();
-        if (lastError == WSAEINPROGRESS) {
-            return IOS_UNAVAILABLE;
-        }
-        NET_ThrowNew(env, lastError, "getsockopt");
-        return IOS_THROWN;
-    }
-    if (optError != NO_ERROR) {
-        handleSocketError(env, optError);
-        return IOS_THROWN;
-    }
-
-    return 0;
-}
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData(JNIEnv* env, jclass this,
-                                                    jobject fdo, jbyte b)
-{
-    int n = send(fdval(env, fdo), (const char*)&b, 1, MSG_OOB);
-    if (n == SOCKET_ERROR) {
-        handleSocketError(env, WSAGetLastError());
-        return IOS_THROWN;
-    } else {
-        return n;
-    }
-}
--- a/src/java.desktop/share/classes/sun/awt/Graphics2Delegate.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1999, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt;
-
-import java.awt.Color;
-
-
-public interface Graphics2Delegate {
-    void setBackground(Color color);
-}
--- a/src/java.desktop/share/classes/sun/awt/TracedEventQueue.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-
-/**
- * An EventQueue subclass which adds selective tracing of events as they
- * are posted to an EventQueue.  Tracing is globally enabled and disabled
- * by the AWT.TraceEventPosting property in awt.properties.  <P>
- *
- * The optional AWT.NoTraceIDs property defines a list of AWTEvent IDs
- * which should not be traced, such as MouseEvent.MOUSE_MOVED or PaintEvents.
- * This list is declared by specifying the decimal value of each event's ID,
- * separated by commas.
- *
- * @author  Thomas Ball
- */
-
-package sun.awt;
-
-import java.awt.EventQueue;
-import java.awt.AWTEvent;
-import java.awt.Toolkit;
-import java.util.StringTokenizer;
-
-public class TracedEventQueue extends EventQueue {
-
-    // Determines whether any event tracing is enabled.
-    static boolean trace = false;
-
-    // The list of event IDs to ignore when tracing.
-    static int[] suppressedIDs = null;
-
-    static {
-        String s = Toolkit.getProperty("AWT.IgnoreEventIDs", "");
-        if (s.length() > 0) {
-            StringTokenizer st = new StringTokenizer(s, ",");
-            int nIDs = st.countTokens();
-            suppressedIDs = new int[nIDs];
-            for (int i = 0; i < nIDs; i++) {
-                String idString = st.nextToken();
-                try {
-                    suppressedIDs[i] = Integer.parseInt(idString);
-                } catch (NumberFormatException e) {
-                    System.err.println("Bad ID listed in AWT.IgnoreEventIDs " +
-                                       "in awt.properties: \"" +
-                                       idString + "\" -- skipped");
-                    suppressedIDs[i] = 0;
-                }
-            }
-        } else {
-            suppressedIDs = new int[0];
-        }
-    }
-
-    public void postEvent(AWTEvent theEvent) {
-        boolean printEvent = true;
-        int id = theEvent.getID();
-        for (int i = 0; i < suppressedIDs.length; i++) {
-            if (id == suppressedIDs[i]) {
-                printEvent = false;
-                break;
-            }
-        }
-        if (printEvent) {
-            System.out.println(Thread.currentThread().getName() +
-                               ": " + theEvent);
-        }
-        super.postEvent(theEvent);
-    }
-}
--- a/src/java.desktop/share/classes/sun/awt/image/BadDepthException.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.awt.image;
-
-@SuppressWarnings("serial") // JDK-implementation class
-public class BadDepthException extends Exception {
-    public BadDepthException() {
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/gtest/utilities/test_lockFreeStack.cpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,306 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "memory/allocation.inline.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/orderAccess.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/lockFreeStack.hpp"
+#include "threadHelper.inline.hpp"
+#include "unittest.hpp"
+#include <new>
+
+class LockFreeStackTestElement {
+  typedef LockFreeStackTestElement Element;
+
+  Element* volatile _entry;
+  Element* volatile _entry1;
+  size_t _id;
+
+  static Element* volatile* entry_ptr(Element& e) { return &e._entry; }
+  static Element* volatile* entry1_ptr(Element& e) { return &e._entry1; }
+
+public:
+  LockFreeStackTestElement(size_t id = 0) : _entry(), _entry1(), _id(id) {}
+  size_t id() const { return _id; }
+  void set_id(size_t value) { _id = value; }
+
+  typedef LockFreeStack<Element, &entry_ptr> TestStack;
+  typedef LockFreeStack<Element, &entry1_ptr> TestStack1;
+};
+
+typedef LockFreeStackTestElement Element;
+typedef Element::TestStack TestStack;
+typedef Element::TestStack1 TestStack1;
+
+static void initialize_ids(Element* elements, size_t size) {
+  for (size_t i = 0; i < size; ++i) {
+    elements[i].set_id(i);
+  }
+}
+
+class LockFreeStackTestBasics : public ::testing::Test {
+public:
+  LockFreeStackTestBasics();
+
+  static const size_t nelements = 10;
+  Element elements[nelements];
+  TestStack stack;
+
+private:
+  void initialize();
+};
+
+const size_t LockFreeStackTestBasics::nelements;
+
+LockFreeStackTestBasics::LockFreeStackTestBasics() : stack() {
+  initialize_ids(elements, nelements);
+  initialize();
+}
+
+void LockFreeStackTestBasics::initialize() {
+  ASSERT_TRUE(stack.empty());
+  ASSERT_EQ(0u, stack.length());
+  ASSERT_TRUE(stack.pop() == NULL);
+  ASSERT_TRUE(stack.top() == NULL);
+
+  for (size_t id = 0; id < nelements; ++id) {
+    ASSERT_EQ(id, stack.length());
+    Element* e = &elements[id];
+    ASSERT_EQ(id, e->id());
+    stack.push(*e);
+    ASSERT_FALSE(stack.empty());
+    ASSERT_EQ(e, stack.top());
+  }
+}
+
+TEST_F(LockFreeStackTestBasics, push_pop) {
+  for (size_t i = nelements; i > 0; ) {
+    ASSERT_FALSE(stack.empty());
+    ASSERT_EQ(i, stack.length());
+    --i;
+    Element* e = stack.pop();
+    ASSERT_TRUE(e != NULL);
+    ASSERT_EQ(&elements[i], e);
+    ASSERT_EQ(i, e->id());
+  }
+  ASSERT_TRUE(stack.empty());
+  ASSERT_EQ(0u, stack.length());
+  ASSERT_TRUE(stack.pop() == NULL);
+}
+
+TEST_F(LockFreeStackTestBasics, prepend_one) {
+  TestStack other_stack;
+  ASSERT_TRUE(other_stack.empty());
+  ASSERT_TRUE(other_stack.pop() == NULL);
+  ASSERT_EQ(0u, other_stack.length());
+  ASSERT_TRUE(other_stack.top() == NULL);
+  ASSERT_TRUE(other_stack.pop() == NULL);
+
+  other_stack.prepend(*stack.pop_all());
+  ASSERT_EQ(nelements, other_stack.length());
+  ASSERT_TRUE(stack.empty());
+  ASSERT_EQ(0u, stack.length());
+  ASSERT_TRUE(stack.pop() == NULL);
+  ASSERT_TRUE(stack.top() == NULL);
+
+  for (size_t i = nelements; i > 0; ) {
+    ASSERT_EQ(i, other_stack.length());
+    --i;
+    Element* e = other_stack.pop();
+    ASSERT_TRUE(e != NULL);
+    ASSERT_EQ(&elements[i], e);
+    ASSERT_EQ(i, e->id());
+  }
+  ASSERT_EQ(0u, other_stack.length());
+  ASSERT_TRUE(other_stack.pop() == NULL);
+}
+
+TEST_F(LockFreeStackTestBasics, prepend_two) {
+  TestStack other_stack;
+  ASSERT_TRUE(other_stack.empty());
+  ASSERT_EQ(0u, other_stack.length());
+  ASSERT_TRUE(other_stack.top() == NULL);
+  ASSERT_TRUE(other_stack.pop() == NULL);
+
+  Element* top = stack.pop_all();
+  ASSERT_EQ(top, &elements[nelements - 1]);
+  other_stack.prepend(*top, elements[0]);
+
+  for (size_t i = nelements; i > 0; ) {
+    ASSERT_EQ(i, other_stack.length());
+    --i;
+    Element* e = other_stack.pop();
+    ASSERT_TRUE(e != NULL);
+    ASSERT_EQ(&elements[i], e);
+    ASSERT_EQ(i, e->id());
+  }
+  ASSERT_EQ(0u, other_stack.length());
+  ASSERT_TRUE(other_stack.pop() == NULL);
+}
+
+TEST_F(LockFreeStackTestBasics, two_stacks) {
+  TestStack1 stack1;
+  ASSERT_TRUE(stack1.pop() == NULL);
+
+  for (size_t id = 0; id < nelements; ++id) {
+    stack1.push(elements[id]);
+  }
+  ASSERT_EQ(nelements, stack1.length());
+  Element* e0 = stack.top();
+  Element* e1 = stack1.top();
+  while (true) {
+    ASSERT_EQ(e0, e1);
+    if (e0 == NULL) break;
+    e0 = stack.next(*e0);
+    e1 = stack1.next(*e1);
+  }
+
+  for (size_t i = nelements; i > 0; ) {
+    ASSERT_EQ(i, stack.length());
+    ASSERT_EQ(i, stack1.length());
+    --i;
+    Element* e = stack.pop();
+    ASSERT_TRUE(e != NULL);
+    ASSERT_EQ(&elements[i], e);
+    ASSERT_EQ(i, e->id());
+
+    Element* e1 = stack1.pop();
+    ASSERT_TRUE(e1 != NULL);
+    ASSERT_EQ(&elements[i], e1);
+    ASSERT_EQ(i, e1->id());
+
+    ASSERT_EQ(e, e1);
+  }
+  ASSERT_EQ(0u, stack.length());
+  ASSERT_EQ(0u, stack1.length());
+  ASSERT_TRUE(stack.pop() == NULL);
+  ASSERT_TRUE(stack1.pop() == NULL);
+}
+
+class LockFreeStackTestThread : public JavaTestThread {
+  uint _id;
+  TestStack* _from;
+  TestStack* _to;
+  volatile size_t* _processed;
+  size_t _process_limit;
+  size_t _local_processed;
+  volatile bool _ready;
+
+public:
+  LockFreeStackTestThread(Semaphore* post,
+                          uint id,
+                          TestStack* from,
+                          TestStack* to,
+                          volatile size_t* processed,
+                          size_t process_limit) :
+    JavaTestThread(post),
+    _id(id),
+    _from(from),
+    _to(to),
+    _processed(processed),
+    _process_limit(process_limit),
+    _local_processed(0),
+    _ready(false)
+  {}
+
+  virtual void main_run() {
+    OrderAccess::release_store_fence(&_ready, true);
+    while (true) {
+      Element* e = _from->pop();
+      if (e != NULL) {
+        _to->push(*e);
+        Atomic::inc(_processed);
+        ++_local_processed;
+      } else if (OrderAccess::load_acquire(_processed) == _process_limit) {
+        tty->print_cr("thread %u processed " SIZE_FORMAT, _id, _local_processed);
+        return;
+      }
+    }
+  }
+
+  bool ready() const { return OrderAccess::load_acquire(&_ready); }
+};
+
+TEST_VM(LockFreeStackTest, stress) {
+  Semaphore post;
+  TestStack initial_stack;
+  TestStack start_stack;
+  TestStack middle_stack;
+  TestStack final_stack;
+  volatile size_t stage1_processed = 0;
+  volatile size_t stage2_processed = 0;
+
+  const size_t nelements = 10000;
+  Element* elements = NEW_C_HEAP_ARRAY(Element, nelements, mtOther);
+  for (size_t id = 0; id < nelements; ++id) {
+    ::new (&elements[id]) Element(id);
+    initial_stack.push(elements[id]);
+  }
+  ASSERT_EQ(nelements, initial_stack.length());
+
+  // - stage1 threads pop from start_stack and push to middle_stack.
+  // - stage2 threads pop from middle_stack and push to final_stack.
+  // - all threads in a stage count the number of elements processed in
+  //   their corresponding stageN_processed counter.
+
+  const uint stage1_threads = 2;
+  const uint stage2_threads = 2;
+  const uint nthreads = stage1_threads + stage2_threads;
+  LockFreeStackTestThread* threads[nthreads] = {};
+
+  for (uint i = 0; i < ARRAY_SIZE(threads); ++i) {
+    TestStack* from = &start_stack;
+    TestStack* to = &middle_stack;
+    volatile size_t* processed = &stage1_processed;
+    if (i >= stage1_threads) {
+      from = &middle_stack;
+      to = &final_stack;
+      processed = &stage2_processed;
+    }
+    threads[i] =
+      new LockFreeStackTestThread(&post, i, from, to, processed, nelements);
+    threads[i]->doit();
+    while (!threads[i]->ready()) {} // Wait until ready to start test.
+  }
+
+  // Transfer elements to start_stack to start test.
+  start_stack.prepend(*initial_stack.pop_all());
+
+  // Wait for all threads to complete.
+  for (uint i = 0; i < nthreads; ++i) {
+    post.wait();
+  }
+
+  // Verify expected state.
+  ASSERT_EQ(nelements, stage1_processed);
+  ASSERT_EQ(nelements, stage2_processed);
+  ASSERT_EQ(0u, initial_stack.length());
+  ASSERT_EQ(0u, start_stack.length());
+  ASSERT_EQ(0u, middle_stack.length());
+  ASSERT_EQ(nelements, final_stack.length());
+  while (final_stack.pop() != NULL) {}
+
+  FREE_C_HEAP_ARRAY(Element, elements);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/gtest/utilities/test_population_count.cpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "libadt/vectset.hpp"
+#include "runtime/os.hpp"
+#include "utilities/population_count.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "unittest.hpp"
+
+uint8_t test_popcnt_bitsInByte[BITS_IN_BYTE_ARRAY_SIZE] = {
+        0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
+        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+        1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
+        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+        2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
+        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+        3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
+        4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
+};
+
+TEST(population_count, sparse) {
+  // Step through the entire input range from a random starting point,
+  // verify population_count return values against the lookup table
+  // approach used historically
+  uint32_t step = 4711;
+  for (uint32_t value = os::random() % step; value < UINT_MAX - step; value += step) {
+    uint32_t lookup = test_popcnt_bitsInByte[(value >> 24) & 0xff] +
+                      test_popcnt_bitsInByte[(value >> 16) & 0xff] +
+                      test_popcnt_bitsInByte[(value >> 8)  & 0xff] +
+                      test_popcnt_bitsInByte[ value        & 0xff];
+
+    EXPECT_EQ(lookup, population_count(value))
+        << "value = " << value;
+  }
+
+  // Test a few edge cases
+  EXPECT_EQ(0u, population_count(0u))
+      << "value = " << 0;
+  EXPECT_EQ(1u, population_count(1u))
+      << "value = " << 1;
+  EXPECT_EQ(1u, population_count(2u))
+      << "value = " << 2;
+  EXPECT_EQ(32u, population_count(UINT_MAX))
+      << "value = " << UINT_MAX;
+  EXPECT_EQ(31u, population_count(UINT_MAX - 1))
+      << "value = " << (UINT_MAX - 1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/gtest/utilities/test_waitBarrier.cpp	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/orderAccess.hpp"
+#include "runtime/os.hpp"
+#include "utilities/spinYield.hpp"
+#include "utilities/waitBarrier.hpp"
+#include "threadHelper.inline.hpp"
+
+static volatile int wait_tag = 0;
+static volatile int valid_value = 0;
+
+template <typename WaitBarrierImpl>
+class WBThread : public JavaTestThread {
+public:
+  static volatile bool _exit;
+  WaitBarrierType<WaitBarrierImpl>* _wait_barrier;
+  Semaphore* _wrt_start;
+  volatile int _on_barrier;
+
+  WBThread(Semaphore* post, WaitBarrierType<WaitBarrierImpl>* wb, Semaphore* wrt_start)
+    : JavaTestThread(post), _wait_barrier(wb), _wrt_start(wrt_start) {};
+  virtual ~WBThread(){}
+  void main_run() {
+    _wrt_start->signal();
+    int vv, tag;
+    // Similar to how a JavaThread would stop in a safepoint.
+    while (!_exit) {
+      // Load the published tag.
+      tag = OrderAccess::load_acquire(&wait_tag);
+      // Publish the tag this thread is going to wait for.
+      OrderAccess::release_store(&_on_barrier, tag);
+      if (_on_barrier == 0) {
+        SpinPause();
+        continue;
+      }
+      OrderAccess::storeload(); // Loads in WB must not float up.
+      // Wait until we are woken.
+      _wait_barrier->wait(tag);
+      // Verify that we do not see an invalid value.
+      vv = OrderAccess::load_acquire(&valid_value);
+      ASSERT_EQ((vv & 0x1), 0);
+      OrderAccess::release_store(&_on_barrier, 0);
+    }
+  }
+};
+
+template <typename WaitBarrierImpl>
+volatile bool WBThread<WaitBarrierImpl>::_exit = false;
+
+template <typename WaitBarrierImpl>
+class WBArmerThread : public JavaTestThread {
+public:
+  WBArmerThread(Semaphore* post) : JavaTestThread(post) {
+  };
+  virtual ~WBArmerThread(){}
+  void main_run() {
+    static const int NUMBER_OF_READERS = 4;
+    Semaphore post;
+    Semaphore wrt_start;
+    WaitBarrierType<WaitBarrierImpl> wb(this);
+
+    WBThread<WaitBarrierImpl>* reader1 = new WBThread<WaitBarrierImpl>(&post, &wb, &wrt_start);
+    WBThread<WaitBarrierImpl>* reader2 = new WBThread<WaitBarrierImpl>(&post, &wb, &wrt_start);
+    WBThread<WaitBarrierImpl>* reader3 = new WBThread<WaitBarrierImpl>(&post, &wb, &wrt_start);
+    WBThread<WaitBarrierImpl>* reader4 = new WBThread<WaitBarrierImpl>(&post, &wb, &wrt_start);
+
+    reader1->doit();
+    reader2->doit();
+    reader3->doit();
+    reader4->doit();
+
+    int nw = NUMBER_OF_READERS;
+    while (nw > 0) {
+      wrt_start.wait();
+      --nw;
+    }
+    jlong stop_ms = os::javaTimeMillis() + 1000; // 1 seconds max test time
+    int next_tag = 1;
+    // Similar to how the VM thread would use a WaitBarrier in a safepoint.
+    while (stop_ms > os::javaTimeMillis()) {
+      // Arm next tag.
+      wb.arm(next_tag);
+      // Publish tag.
+      OrderAccess::release_store_fence(&wait_tag, next_tag);
+
+      // Wait until threads picked up new tag.
+      while (reader1->_on_barrier != wait_tag ||
+             reader2->_on_barrier != wait_tag ||
+             reader3->_on_barrier != wait_tag ||
+             reader4->_on_barrier != wait_tag) {
+        SpinPause();
+      }
+
+      // Set an invalid value.
+      OrderAccess::release_store(&valid_value, valid_value + 1); // odd
+      os::naked_yield();
+      // Set a valid value.
+      OrderAccess::release_store(&valid_value, valid_value + 1); // even
+      // Publish inactive tag.
+      OrderAccess::release_store_fence(&wait_tag, 0); // Stores in WB must not float up.
+      wb.disarm();
+
+      // Wait until threads done valid_value verification.
+      while (reader1->_on_barrier != 0 ||
+             reader2->_on_barrier != 0 ||
+             reader3->_on_barrier != 0 ||
+             reader4->_on_barrier != 0) {
+        SpinPause();
+      }
+      ++next_tag;
+    }
+    WBThread<WaitBarrierImpl>::_exit = true;
+    for (int i = 0; i < NUMBER_OF_READERS; i++) {
+      post.wait();
+    }
+  }
+};
+
+TEST_VM(WaitBarrier, default_wb) {
+  WBThread<WaitBarrierDefault>::_exit = false;
+  mt_test_doer<WBArmerThread<WaitBarrierDefault> >();
+}
+
+#if defined(LINUX)
+TEST_VM(WaitBarrier, generic_wb) {
+  WBThread<GenericWaitBarrier>::_exit = false;
+  mt_test_doer<WBArmerThread<GenericWaitBarrier> >();
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/arguments/TestTraceICs.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 8217447
+ * @summary Test running TraceICs enabled.
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+TraceICs
+ *                   compiler.arguments.TestTraceICs
+ */
+
+package compiler.arguments;
+
+public class TestTraceICs {
+
+    static public void main(String[] args) {
+        System.out.println("Passed");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c2/Test8217359.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2019, Huawei Technologies Co. Ltd. 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 8217359
+ * @summary C2 compiler triggers SIGSEGV after transformation in ConvI2LNode::Ideal
+ *
+ * @run main/othervm -XX:-TieredCompilation
+ *      -XX:CompileCommand=compileonly,compiler.c2.Test8217359::test
+ *      compiler.c2.Test8217359
+ */
+
+package compiler.c2;
+
+public class Test8217359 {
+
+    public static int ival = 0;
+    public static long lsum = 0;
+    public static long lval = 0;
+
+    public static void test() {
+        short s = -25632;
+        float f = 0.512F, f1 = 2.556F;
+        int i6 = 32547, i7 = 9, i8 = -9, i9 = 36, i10 = -223;
+
+        for (i6 = 4; i6 < 182; i6++) {
+            i8 = 1;
+            while (++i8 < 17) {
+                f1 = 1;
+                do {
+                    i7 += (182 + (f1 * f1));
+                } while (++f1 < 1);
+
+                Test8217359.ival += (i8 | Test8217359.ival);
+            }
+        }
+
+        for (i9 = 9; i9 < 100; ++i9) {
+            i10 -= i6;
+            i10 >>= s;
+            i7 += (((i9 * i10) + i6) - Test8217359.lval);
+        }
+
+        lsum += i6 + i7 + i8;
+    }
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 16000; i++) {
+            test();
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c2/TestMatcherLargeOffset.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,60 @@
+/*
+ * 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 8202952
+ * @summary C2: Unexpected dead nodes after matching
+ *
+ * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileOnly=::test
+ *      compiler.c2.TestMatcherLargeOffset
+ */
+package compiler.c2;
+
+public class TestMatcherLargeOffset {
+    public static final int N = 400;
+    public static int iArrFld[] = new int[N];
+
+    public static void m(int i4) {
+        i4 |= -104;
+        iArrFld[(i4 >>> 1) % N] >>= i4;
+    }
+
+    public static void test() {
+        int i2 = 1, i24 = 65;
+        for (int i1 = 7; i1 < 384; ++i1) {
+            for (long l = 2; l < 67; l++) {
+                m(i2);
+                for (i24 = 1; 2 > i24; ++i24) {
+                    iArrFld = iArrFld;
+                }
+            }
+            i2 = (-229 / i24);
+        }
+    }
+    public static void main(String[] strArr) {
+        for (int i = 0; i < 5; i++ ) {
+            test();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/inlining/StringConcatInfiniteLoop.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. 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 8214862
+ * @summary Multiple passes of PhaseRemoveUseless causes infinite loop to be optimized out
+ *
+ * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileOnly=StringConcatInfiniteLoop::test -XX:CompileCommand=dontinline,*StringBuilder::* StringConcatInfiniteLoop
+ *
+ */
+
+public class StringConcatInfiniteLoop {
+    public static void main(String[] args) {
+        StringBuilder sb = new StringBuilder();
+        test(sb, "foo", "bar", true);
+    }
+
+    private static void test(Object v, String s1, String s2, boolean flag) {
+        if (flag) {
+            return;
+        }
+        int i = 0;
+        for (; i < 10; i++);
+        if (i == 10) {
+            v = null;
+        }
+        StringBuilder sb = new StringBuilder(s1);
+        sb.append(s2);
+        while (v == null);
+    }
+
+    private static class A {
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/loopopts/PeelingZeroTripCount.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. 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 8215044
+ * @summary C2 crash in loopTransform.cpp with assert(cl->trip_count() > 0) failed: peeling a fully unrolled loop
+ *
+ * @run main/othervm -XX:CompileOnly=PeelingZeroTripCount.test PeelingZeroTripCount
+ *
+ */
+
+public class PeelingZeroTripCount {
+
+    public static void main(String[] args) {
+        PeelingZeroTripCount issue = new PeelingZeroTripCount();
+        for (int i = 0; i < 10000; i++) {
+            issue.test(new int[999]);
+        }
+    }
+
+    public void test(int[] iaarg) {
+        int[] iarr = new int[777];
+        for (int i = 4; i > 0; i--) {
+            for (int j = 0; j <= i - 1; j++) {
+                int istep = 2 * j - i + 1;
+                int iadj = 0;
+                if (istep < 0) {
+                    iadj = iarr[0-istep] + iaarg[i-1];
+                } else {
+                    iadj = iarr[istep] + iaarg[i-1];
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/loopopts/Test8210392.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,65 @@
+/*
+ * 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 8210392
+ * @summary C2 Assert failure: Live node limit exceeded
+ *
+ * @run main/othervm compiler.loopopts.Test8210392
+ */
+
+package compiler.loopopts;
+
+public class Test8210392 {
+    public static int ival = 17;
+
+    public static int intFn() {
+        int v = 0, k = 0;
+        for (int i = 17; i < 311; i += 3) {
+            v = Test8210392.ival;
+            int j = 1;
+            do {
+                v *= i;
+                v += j * v;
+                while (++k < 1)
+                    ;
+            } while (++j < 13);
+        }
+        return v;
+    }
+
+    public void mainTest() {
+        for (int i = 0; i < 30000; i++) {
+            Test8210392.ival = intFn();
+        }
+    }
+
+    public static void main(String[] _args) {
+        Test8210392 tc = new Test8210392();
+        for (int i = 0; i < 10; i++) {
+            tc.mainTest();
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/rangechecks/RangeCheckEliminationScaleNotOne.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. 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 8215265
+ * @summary C2: range check elimination may allow illegal out of bound access
+ *
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:-UseLoopPredicate RangeCheckEliminationScaleNotOne
+ *
+ */
+
+import java.util.Arrays;
+
+public class RangeCheckEliminationScaleNotOne {
+    public static void main(String[] args) {
+        {
+            int[] array = new int[199];
+            boolean[] flags = new boolean[100];
+            Arrays.fill(flags, true);
+            flags[0] = false;
+            flags[1] = false;
+            for (int i = 0; i < 20_000; i++) {
+                test1(100, array, 0, flags);
+            }
+            boolean ex = false;
+            try {
+                test1(100, array, -5, flags);
+            } catch (ArrayIndexOutOfBoundsException aie) {
+                ex = true;
+            }
+            if (!ex) {
+                throw new RuntimeException("no AIOOB exception");
+            }
+        }
+
+        {
+            int[] array = new int[199];
+            boolean[] flags = new boolean[100];
+            Arrays.fill(flags, true);
+            flags[0] = false;
+            flags[1] = false;
+            for (int i = 0; i < 20_000; i++) {
+                test2(100, array, 198, flags);
+            }
+            boolean ex = false;
+            try {
+                test2(100, array, 203, flags);
+            } catch (ArrayIndexOutOfBoundsException aie) {
+                ex = true;
+            }
+            if (!ex) {
+                throw new RuntimeException("no AIOOB exception");
+            }
+        }
+    }
+
+    private static int test1(int stop, int[] array, int offset, boolean[] flags) {
+        if (array == null) {}
+        int res = 0;
+        for (int i = 0; i < stop; i++) {
+            if (flags[i]) {
+                res += array[2 * i + offset];
+            }
+        }
+        return res;
+    }
+
+
+    private static int test2(int stop, int[] array, int offset, boolean[] flags) {
+        if (array == null) {}
+        int res = 0;
+        for (int i = 0; i < stop; i++) {
+            if (flags[i]) {
+                res += array[-2 * i + offset];
+            }
+        }
+        return res;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/unsafe/MismatchedUnsafeLoadFromNewObject.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. 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 8216549
+ * @summary Mismatched unsafe access to non escaping object fails
+ *
+ * @modules java.base/jdk.internal.misc
+ * @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation MismatchedUnsafeLoadFromNewObject
+ */
+
+import java.lang.reflect.Field;
+import jdk.internal.misc.Unsafe;
+
+public class MismatchedUnsafeLoadFromNewObject {
+    public volatile int f_int = -1;
+    public volatile int f_int2 = -1;
+
+    public static Unsafe unsafe = Unsafe.getUnsafe();
+    public static final long f_int_off;
+    public static final long f_int2_off;
+
+    static {
+        Field f_int_field = null;
+        Field f_int2_field = null;
+        try {
+            f_int_field = MismatchedUnsafeLoadFromNewObject.class.getField("f_int");
+            f_int2_field = MismatchedUnsafeLoadFromNewObject.class.getField("f_int2");
+        } catch (Exception e) {
+            System.out.println("reflection failed " + e);
+            e.printStackTrace();
+        }
+        f_int_off = unsafe.objectFieldOffset(f_int_field);
+        f_int2_off = unsafe.objectFieldOffset(f_int2_field);
+    }
+
+    static public void main(String[] args) {
+        for (int i = 0; i < 20_000; i++) {
+            byte res = test1();
+            if (res != -1) {
+                throw new RuntimeException("Incorrect result: " + res);
+            }
+            res = test2();
+            if (res != -1) {
+                throw new RuntimeException("Incorrect result: " + res);
+            }
+            int res2 = test3();
+            if (res2 != -1) {
+                throw new RuntimeException("Incorrect result: " + res2);
+            }
+        }
+    }
+
+    static byte test1() {
+        MismatchedUnsafeLoadFromNewObject t = new MismatchedUnsafeLoadFromNewObject();
+        return unsafe.getByte(t, f_int_off);
+    }
+
+    static byte test2() {
+        MismatchedUnsafeLoadFromNewObject t = new MismatchedUnsafeLoadFromNewObject();
+        return unsafe.getByte(t, f_int_off+1);
+    }
+
+    static int test3() {
+        MismatchedUnsafeLoadFromNewObject t = new MismatchedUnsafeLoadFromNewObject();
+        if (f_int_off < f_int2_off) {
+            return unsafe.getIntUnaligned(t, f_int_off+1);
+        } else {
+            return unsafe.getIntUnaligned(t, f_int2_off+1);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/cms/TestCriticalPriority.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. 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 TestCriticalPriority
+ * @key gc
+ * @bug 8217378
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
+ * @summary Test critical priority is accepted
+ * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+UnlockExperimentalVMOptions -XX:+UseCriticalCMSThreadPriority TestCriticalPriority
+ */
+
+public class TestCriticalPriority {
+    public static void main(String args[]) throws Exception {
+        // The failure would be detected before entering main().
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/epsilon/TestArraycopyCheckcast.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. 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 TestArraycopyCheckcast
+ * @key gc
+ * @requires vm.gc.Epsilon & !vm.graal.enabled
+ * @summary Epsilon is able to handle checkcasted array copies
+ * @library /test/lib
+ * @bug 8215724
+ *
+ * @run main/othervm -Xmx1g                                        -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestArraycopyCheckcast
+ * @run main/othervm -Xmx1g -Xint                                  -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestArraycopyCheckcast
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp                         -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestArraycopyCheckcast
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:TieredStopAtLevel=1 -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestArraycopyCheckcast
+ * @run main/othervm -Xmx1g -Xbatch -Xcomp -XX:-TieredCompilation  -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC TestArraycopyCheckcast
+ */
+
+import java.util.Random;
+
+public class TestArraycopyCheckcast {
+
+  static int COUNT = Integer.getInteger("count", 1000);
+
+  public static void main(String[] args) throws Exception {
+    Object[] src = new Object[COUNT];
+    Object[] dst = new B[COUNT];
+
+    // Test 1. Copy nulls, should succeed
+    try {
+      System.arraycopy(src, 0, dst, 0, COUNT);
+    } catch (ArrayStoreException e) {
+      throw new IllegalStateException("Should have completed");
+    }
+
+    // Test 2. Copying incompatible type, should fail
+    for (int c = 0; c < COUNT; c++) {
+      src[c] = new A();
+    }
+
+    try {
+      System.arraycopy(src, 0, dst, 0, COUNT);
+      throw new IllegalStateException("Should have failed with ArrayStoreException");
+    } catch (ArrayStoreException e) {
+      // Expected
+    }
+
+    // Test 3. Copying compatible type, should succeeded
+    for (int c = 0; c < COUNT; c++) {
+      src[c] = new C();
+    }
+
+    try {
+      System.arraycopy(src, 0, dst, 0, COUNT);
+    } catch (ArrayStoreException e) {
+      throw new IllegalStateException("Should have completed");
+    }
+
+    for (int c = 0; c < COUNT; c++) {
+      if (src[c] != dst[c]) {
+        throw new IllegalStateException("Copy failed at index " + c);
+      }
+    }
+  }
+
+  static class A {}
+  static class B extends A {}
+  static class C extends B {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/epsilon/TestClasses.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. 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 TestClasses
+ * @key gc
+ * @requires vm.gc.Epsilon & !vm.graal.enabled
+ * @summary Epsilon is able to allocate a lot of classes
+ *
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/jdk.internal.misc
+ *
+ * @run main/othervm -Xmx128m -XX:MetaspaceSize=1m -XX:MaxMetaspaceSize=32m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -Xlog:gc+metaspace TestClasses
+ */
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Opcodes;
+
+import java.util.*;
+import java.io.*;
+import java.nio.*;
+import java.nio.file.*;
+
+public class TestClasses {
+
+  static final int COUNT = 32*1024;
+
+  static volatile Object sink;
+
+  static class MyClassLoader extends ClassLoader {
+    public byte[] createClass(String name) {
+      ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
+      cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, name, null, "java/lang/Object", null);
+      return cw.toByteArray();
+    }
+
+    public Class<?> loadClass(String name) throws ClassNotFoundException {
+      if (!name.startsWith("Dummy")) {
+        return super.loadClass(name);
+      }
+      byte[] cls = createClass(name);
+      return defineClass(name, cls, 0, cls.length, null);
+    }
+  }
+
+  public static void main(String[] args) throws Exception {
+    ClassLoader cl = new MyClassLoader();
+    for (int c = 0; c < COUNT; c++) {
+      Class<?> clazz = Class.forName("Dummy" + c, true, cl);
+      if (clazz.getClassLoader() != cl) {
+        throw new IllegalStateException("Should have loaded by target loader");
+      }
+      sink = c;
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/g1/TestPeriodicLogMessages.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,73 @@
+/*
+ * 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 TestPeriodicLogMessages
+ * @bug 8216490
+ * @requires vm.gc.G1
+ * @summary Verify that log messages are printed as expected
+ * @library /test/lib /
+ * @modules java.base/jdk.internal.misc
+ * @modules java.management/sun.management
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.Platform;
+
+public class TestPeriodicLogMessages {
+
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                                                  "-XX:G1PeriodicGCInterval=0",
+                                                                  "-Xlog:gc,gc+periodic=debug",
+                                                                  "-Xmx10M",
+                                                                  GCTest.class.getName());
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Periodic GC disabled");
+        output.shouldNotContain("Checking for periodic GC");
+        output.shouldHaveExitValue(0);
+
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                                   "-XX:G1PeriodicGCInterval=100",
+                                                   "-Xlog:gc,gc+periodic=debug",
+                                                   "-Xmx10M",
+                                                   GCTest.class.getName());
+
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Periodic GC enabled with interval 100ms");
+        output.shouldContain("Checking for periodic GC");
+        output.shouldHaveExitValue(0);
+    }
+
+    static class GCTest {
+        public static void main(String [] args) throws Exception {
+            System.out.println("Waiting for messages...");
+            Thread.sleep(1000);
+            System.out.println("Done");
+        }
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/shenandoah/options/TestCriticalControlThreadPriority.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ *
+ */
+
+/*
+ * @test TestCriticalControlThreadPriority
+ * @summary Check that ShenandoahCriticalControlThreadPriority works
+ * @bug 8217343
+ * @key gc
+ * @requires vm.gc.Shenandoah
+ *
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:-ShenandoahCriticalControlThreadPriority -Xmx1g TestCriticalControlThreadPriority
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+ShenandoahCriticalControlThreadPriority -Xmx1g TestCriticalControlThreadPriority
+ */
+
+public class TestCriticalControlThreadPriority {
+
+    public static void main(String[] args) throws Exception {
+        // checking the initialization before entering main()
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 ConstantPoolDependsTest
+ * @bug 8210094
+ * @summary Create ClassLoader dependency from initiating loader to class loader through constant pool reference
+ * @requires vm.opt.final.ClassUnloading
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ * @library /runtime/testlibrary /test/lib
+ * @build sun.hotspot.WhiteBox
+ * @compile p2/c2.java MyDiffClassLoader.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -Xlog:class+unload -XX:+WhiteBoxAPI ConstantPoolDependsTest
+ */
+
+import sun.hotspot.WhiteBox;
+
+
+public class ConstantPoolDependsTest {
+    public static WhiteBox wb = WhiteBox.getWhiteBox();
+    public static final String MY_TEST = "ConstantPoolDependsTest$c1c";
+
+    public static class c1c {
+        private void test() throws Exception {
+            // ConstantPool.klass_at_impl loads through constant pool and creates dependency
+            p2.c2 c2_obj = new p2.c2();
+            c2_obj.method2();
+        }
+
+        public c1c () throws Exception {
+            test();
+            ClassUnloadCommon.triggerUnloading();  // should not unload anything
+            test();
+            ClassUnloadCommon.triggerUnloading();  // should not unload anything
+        }
+    }
+
+    static void test() throws Throwable {
+
+        // now use the same loader to load class MyTest
+        Class MyTest_class = new MyDiffClassLoader(MY_TEST).loadClass(MY_TEST);
+
+        try {
+            // Call MyTest to load p2.c2 twice and call p2.c2.method2
+            MyTest_class.newInstance();
+        } catch (Exception e) {
+            throw new RuntimeException("Test FAILED if NoSuchMethodException is thrown");
+        }
+        ClassUnloadCommon.triggerUnloading();  // should not unload anything
+        ClassUnloadCommon.failIf(!wb.isClassAlive(MY_TEST), "should not be unloaded");
+        ClassUnloadCommon.failIf(!wb.isClassAlive("p2.c2"), "should not be unloaded");
+        // Unless MyTest_class is referenced here, the compiler can unload it.
+        System.out.println("Should not unload anything before here because " + MyTest_class + " is still alive.");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        test();
+        ClassUnloadCommon.triggerUnloading();  // should unload
+        System.gc();
+        System.out.println("Should unload p2.c2 just now");
+        ClassUnloadCommon.failIf(wb.isClassAlive(MY_TEST), "should be unloaded");
+        ClassUnloadCommon.failIf(wb.isClassAlive("p2.c2"), "should be unloaded");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/ClassUnload/DictionaryDependsTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 DictionaryDependsTest
+ * @bug 8210094
+ * @summary Create ClassLoader dependency from initiating loader to class loader through reflection
+ * @requires vm.opt.final.ClassUnloading
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ * @library /runtime/testlibrary /test/lib
+ * @build sun.hotspot.WhiteBox
+ * @compile p2/c2.java MyDiffClassLoader.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -Xlog:class+unload -XX:+WhiteBoxAPI DictionaryDependsTest
+ */
+import sun.hotspot.WhiteBox;
+import java.lang.reflect.Method;
+
+public class DictionaryDependsTest {
+    public static WhiteBox wb = WhiteBox.getWhiteBox();
+    public static final String MY_TEST = "DictionaryDependsTest$c1r";
+
+    static public class c1r {
+
+        private void test() throws Exception {
+            // forName loads through reflection and doesn't create dependency
+            Class<?> x = Class.forName("p2.c2", true, c1r.class.getClassLoader());
+            Method m = x.getMethod("method2");
+            java.lang.Object t = x.newInstance();
+            m.invoke(t);
+        }
+
+        public c1r () throws Exception {
+            test();
+            ClassUnloadCommon.triggerUnloading();  // should unload p2.c2
+            test();
+            ClassUnloadCommon.triggerUnloading();  // should unload p2.c2
+        }
+    }
+
+    public void test() throws Throwable {
+
+        // now use the same loader to load class MyTest
+        Class MyTest_class = new MyDiffClassLoader(MY_TEST).loadClass(MY_TEST);
+
+        try {
+            // Call MyTest to load p2.c2 twice and call p2.c2.method2
+            MyTest_class.newInstance();
+        } catch (Exception e) {
+            System.out.println("Not expected NSME");
+            throw new RuntimeException("Not expecting NSME");
+        }
+        ClassUnloadCommon.triggerUnloading();  // should not unload anything
+        ClassUnloadCommon.failIf(!wb.isClassAlive(MY_TEST), "should not be unloaded");
+        ClassUnloadCommon.failIf(!wb.isClassAlive("p2.c2"), "should not be unloaded");
+        // Unless MyTest_class is referenced here, the compiler can unload it.
+        System.out.println("Should not unload anything before here because " + MyTest_class + " is still alive.");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        DictionaryDependsTest d = new DictionaryDependsTest();
+        d.test();
+        ClassUnloadCommon.triggerUnloading();  // should not unload anything
+        System.out.println("Should unload MyTest and p2.c2 just now");
+        ClassUnloadCommon.failIf(wb.isClassAlive(MY_TEST), "should be unloaded");
+        ClassUnloadCommon.failIf(wb.isClassAlive("p2.c2"), "should be unloaded");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/ClassUnload/MyDiffClassLoader.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.*;
+import jdk.test.lib.compiler.InMemoryJavaCompiler;
+
+public class MyDiffClassLoader extends ClassLoader {
+
+    public String loaderName;
+    public static boolean switchClassData = false;
+
+    MyDiffClassLoader(String name) {
+        this.loaderName = name;
+    }
+
+    public Class loadClass(String name) throws ClassNotFoundException {
+        if (!name.contains("c1r") &&
+            !name.contains("c1c") &&
+            !name.contains("c1s") &&
+            !name.equals("p2.c2")) {
+                return super.loadClass(name);
+        }
+
+        // new loader loads p2.c2
+        if  (name.equals("p2.c2") && !loaderName.equals("C2Loader")) {
+            Class<?> c = new MyDiffClassLoader("C2Loader").loadClass(name);
+            switchClassData = true;
+            return c;
+        }
+
+        byte[] data = switchClassData ? getNewClassData(name) : getClassData(name);
+        System.out.println("name is " + name);
+        return defineClass(name, data, 0, data.length);
+    }
+    byte[] getClassData(String name) {
+        try {
+           String TempName = name.replaceAll("\\.", "/");
+           String currentDir = System.getProperty("test.classes");
+           String filename = currentDir + File.separator + TempName + ".class";
+           FileInputStream fis = new FileInputStream(filename);
+           byte[] b = new byte[5000];
+           int cnt = fis.read(b, 0, 5000);
+           byte[] c = new byte[cnt];
+           for (int i=0; i<cnt; i++) c[i] = b[i];
+             return c;
+        } catch (IOException e) {
+           return null;
+        }
+    }
+
+    // Return p2.c2 with everything removed
+    byte[] getNewClassData(String name) {
+        return InMemoryJavaCompiler.compile("p2.c2", "package p2; public class c2 { }");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/ClassUnload/SuperDependsTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 SuperDependsTest
+ * @bug 8210094
+ * @summary Create ClassLoader dependency from initiating loader to class loader through subclassing
+ * @requires vm.opt.final.ClassUnloading
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ * @library /runtime/testlibrary /test/lib
+ * @build sun.hotspot.WhiteBox
+ * @compile p2/c2.java MyDiffClassLoader.java
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -Xlog:class+unload -XX:+WhiteBoxAPI SuperDependsTest
+ */
+import sun.hotspot.WhiteBox;
+import p2.*;
+
+public class SuperDependsTest {
+    public static WhiteBox wb = WhiteBox.getWhiteBox();
+    public static final String MY_TEST = "SuperDependsTest$c1s";
+
+
+    // p2.c2 loads through super class and creates dependency
+    public static class c1s extends p2.c2 {
+
+        private void test() throws Exception {
+            method2();
+        }
+
+        public c1s () throws Exception {
+            test();
+            ClassUnloadCommon.triggerUnloading();  // should not unload anything
+            test();
+        }
+    }
+
+    public void test() throws Throwable {
+
+        // now use the same loader to load class MyTest
+        Class MyTest_class = new MyDiffClassLoader(MY_TEST).loadClass(MY_TEST);
+
+        // Call MyTest to load p2.c2 twice and call p2.c2.method2
+        MyTest_class.newInstance();
+        ClassUnloadCommon.triggerUnloading();  // should not unload anything
+        ClassUnloadCommon.failIf(!wb.isClassAlive(MY_TEST), "should not be unloaded");
+        ClassUnloadCommon.failIf(!wb.isClassAlive("p2.c2"), "should not be unloaded");
+        // Unless MyTest_class is referenced here, the compiler can unload it.
+        System.out.println("Should not unload anything before here because " + MyTest_class + " is still alive.");
+    }
+
+    public static void main(String args[]) throws Throwable {
+        SuperDependsTest d = new SuperDependsTest();
+        d.test();
+        ClassUnloadCommon.triggerUnloading();  // should not unload anything
+        System.out.println("Should unload MyTest and p2.c2 just now");
+        ClassUnloadCommon.failIf(wb.isClassAlive(MY_TEST), "should be unloaded");
+        ClassUnloadCommon.failIf(wb.isClassAlive("p2.c2"), "should be unloaded");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/ClassUnload/p2/c2.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package p2;
+
+public class c2 {
+    int i;
+    public void method2() { i = 5; System.out.println("c2 method2 called"); }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/StackTrace/StackTraceClassCache.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. 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 8216302
+ * @summary Check that stack trace contains proper strings even with class caching
+ * @modules java.base/java.lang:open
+ * @compile StackTraceClassCache.java
+ * @run main StackTraceClassCache
+ */
+
+import java.lang.reflect.*;
+
+public class StackTraceClassCache  {
+    public static void main(String... args) throws Exception {
+        Outer.Inner o = new Outer().new Inner();
+        Class cl = o.getClass();
+
+        // Check out of the box class name
+        try {
+            o.work();
+        } catch (Exception e) {
+            checkException(e, 42);
+        }
+
+        // Clear and populate class caches via getName
+        clearNameCache(cl);
+        cl.getName();
+        try {
+            o.work();
+        } catch (Exception e) {
+            checkException(e, 51);
+        }
+
+        // Clear and populate class caches via stack trace
+        clearNameCache(cl);
+        try {
+            o.work();
+        } catch (Exception e) {
+            checkException(e, 59);
+        }
+    }
+
+    static void checkException(Exception e, int line) throws Exception {
+        StackTraceElement[] fs = e.getStackTrace();
+
+        if (fs.length < 2) {
+            throw new IllegalStateException("Exception should have at least two frames", e);
+        }
+
+        assertCorrect("StackTraceClassCache$Outer$Inner.work(StackTraceClassCache.java:95)", fs[0].toString(), e);
+        assertCorrect("StackTraceClassCache.main(StackTraceClassCache.java:" + line + ")",   fs[1].toString(), e);
+    }
+
+    static void assertCorrect(String expected, String actual, Exception e) throws Exception {
+        if (!expected.equals(actual)) {
+            throw new IllegalStateException("Expected: " + expected + "; Actual: " + actual, e);
+        }
+    }
+
+    static void clearNameCache(Class cl) {
+        try {
+            Field f = Class.class.getDeclaredField("name");
+            f.setAccessible(true);
+            f.set(cl, null);
+        } catch (Exception e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    static class Outer {
+       class Inner {
+           void work() throws Exception {
+               throw new Exception("Sample exception");
+           }
+       }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/Thread/TestThreadDumpClassInitMonitor.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,202 @@
+/*
+ * 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     8213397 8217337
+ * @summary Check that the thread dump shows when a thread is blocked
+ *          on a class initialization monitor
+ *
+ * @library /test/lib
+ * @run main/othervm TestThreadDumpClassInitMonitor
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Platform;
+
+import java.io.IOException;
+import java.util.List;
+
+public class TestThreadDumpClassInitMonitor {
+    // jstack tends to be closely bound to the VM that we are running
+    // so use getTestJDKTool() instead of getCompileJDKTool() or even
+    // getJDKTool() which can fall back to "compile.jdk".
+    final static String JSTACK = JDKToolFinder.getTestJDKTool("jstack");
+    final static String PID = "" + ProcessHandle.current().pid();
+
+    final static Thread current = Thread.currentThread();
+
+    /*
+     * This is the output we're looking for:
+     *
+     * "TestThread" #22 prio=5 os_prio=0 cpu=1.19ms elapsed=0.80s tid=0x00007f8f9405d800 nid=0x568b in Object.wait()  [0x00007f8fd94d0000]
+     *   java.lang.Thread.State: RUNNABLE
+     * Thread: 0x00007f8f9405d800  [0x568b] State: _at_safepoint _has_called_back 0 _at_poll_safepoint 0  // DEBUG ONLY
+     *   JavaThread state: _thread_blocked                                                                // DEBUG ONLY
+     *         at TestThreadDumpClassInitMonitor$Target$1.run(TestThreadDumpClassInitMonitor.java:69)
+     *         - waiting on the Class initialization monitor for TestThreadDumpClassInitMonitor$Target
+     *
+     */
+    final static String TEST_THREAD = "TestThread";
+    final static String TEST_THREAD_ENTRY = "\"" + TEST_THREAD;
+    final static String IN_OBJECT_WAIT = "in Object.wait()";
+    final static String THREAD_STATE = "java.lang.Thread.State: RUNNABLE";
+    final static String THREAD_INFO = "Thread:"; // the details are not important
+    final static String JAVATHREAD_STATE = "JavaThread state: _thread_blocked";
+    final static String CURRENT_METHOD = "at TestThreadDumpClassInitMonitor$Target$1.run";
+    final static String WAIT_INFO = "- waiting on the Class initialization monitor for TestThreadDumpClassInitMonitor$Target";
+
+    volatile static boolean ready = false;
+
+    static List<String> stackDump;  // jstack output as lines
+
+    static class Target {
+
+        static int field;
+
+        // The main thread will initialize this class and so
+        // execute the actual test logic here.
+        static {
+            if (Thread.currentThread() != current) {
+                throw new Error("Initialization logic error");
+            }
+            System.out.println("Initializing Target class in main thread");
+
+            Thread t  = new Thread() {
+                    public void run() {
+                        System.out.println("Test thread about to access Target");
+                        ready = true; // tell main thread we're close
+                        // This will block until the main thread completes
+                        // static initialization of target
+                        Target.field = 42;
+                        System.out.println("Test thread done");
+                    }
+                };
+            t.setName(TEST_THREAD);
+            t.start();
+
+            // We want to run jstack once the test thread is blocked but
+            // there's no programmatic way to detect that. So we check the flag
+            // that will be set just before it should block, then by the time
+            // we can exec jstack it should be ready.
+            try {
+                while (!ready) {
+                    Thread.sleep(200);
+                }
+            }
+            catch (InterruptedException ie) {
+                throw new Error("Shouldn't happen");
+            }
+
+            // Now run jstack
+            try {
+                ProcessBuilder pb = new ProcessBuilder(JSTACK, PID);
+                OutputAnalyzer output = new OutputAnalyzer(pb.start());
+                output.shouldHaveExitValue(0);
+                stackDump = output.asLines();
+            }
+            catch (IOException ioe) {
+                throw new Error("Launching jstack failed", ioe);
+            }
+        }
+    }
+
+
+    public static void main(String[] args) throws Throwable {
+        // Implicitly run the main test logic
+        Target.field = 21;
+
+        // Now check the output of jstack
+        try {
+            // product builds miss 2 lines of information in the stack
+            boolean isProduct = !Platform.isDebugBuild();
+            int foundLines = 0;
+            parseStack: for (String line : stackDump) {
+                switch(foundLines) {
+                case 0: {
+                    if (!line.startsWith(TEST_THREAD_ENTRY)) {
+                        continue;
+                    }
+                    foundLines++;
+                    if (!line.contains(IN_OBJECT_WAIT)) {
+                        throw new Error("Unexpected initial stack line: " + line);
+                    }
+                    continue;
+                }
+                case 1: {
+                    if (!line.trim().equals(THREAD_STATE)) {
+                        throw new Error("Unexpected thread state line: " + line);
+                    }
+                    if (isProduct) {
+                        foundLines += 3;
+                    } else {
+                        foundLines++;
+                    }
+                    continue;
+                }
+                case 2: { // Debug build
+                    if (!line.startsWith(THREAD_INFO)) {
+                        throw new Error("Unexpected thread info line: " + line);
+                    }
+                    foundLines++;
+                    continue;
+                }
+                case 3: { // Debug build
+                    if (!line.trim().equals(JAVATHREAD_STATE)) {
+                        throw new Error("Unexpected JavaThread state line: " + line);
+                    }
+                    foundLines++;
+                    continue;
+                }
+                case 4: {
+                    if (!line.trim().startsWith(CURRENT_METHOD)) {
+                        throw new Error("Unexpected current method line: " + line);
+                    }
+                    foundLines++;
+                    continue;
+                }
+                case 5: {
+                    if (!line.trim().equals(WAIT_INFO)) {
+                        throw new Error("Unexpected monitor information line: " + line);
+                    }
+                    break parseStack;
+                }
+                default: throw new Error("Logic error in case statement");
+                }
+            }
+
+            if (foundLines == 0) {
+                throw new Error("Unexpected stack content - did not find line starting with "
+                                + TEST_THREAD_ENTRY);
+            }
+        }
+        catch (Error e) {
+            // Dump the full stack trace on error so we can check the content
+            for (String line : stackDump) {
+                System.out.println(line);
+            }
+            throw e;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/appcds/LongClassListPath.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,76 @@
+/*
+ * 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 Test the handling of long path to the classlist file.
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *          jdk.jartool/sun.tools.jar
+ * @compile test-classes/Hello.java
+ * @run driver LongClassListPath
+ */
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.Arrays;
+import jdk.test.lib.cds.CDSOptions;
+import jdk.test.lib.cds.CDSTestUtils;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class LongClassListPath {
+    private static final int MAX_PATH = 260;
+    public static void main(String[] args) throws Exception {
+        String[] classes = {"hello"};
+        String classList =
+            CDSTestUtils.makeClassList(classes).getPath();
+        String archiveName = "LongClassListPath.jsa";
+
+        // Create a directory with long path and copy the classlist file to
+        // the directory.
+        Path classDir = Paths.get(System.getProperty("test.classes"));
+        Path destDir = classDir;
+        int subDirLen = MAX_PATH - classDir.toString().length() - 2;
+        if (subDirLen > 0) {
+            char[] chars = new char[subDirLen];
+            Arrays.fill(chars, 'x');
+            String subPath = new String(chars);
+            destDir = Paths.get(System.getProperty("test.classes"), subPath);
+        }
+        File longDir = destDir.toFile();
+        longDir.mkdir();
+        String destClassList = longDir.getPath() + File.separator + "LongClassListPath.classlist";
+        Files.copy(Paths.get(classList), Paths.get(destClassList), StandardCopyOption.REPLACE_EXISTING);
+
+        CDSOptions opts = (new CDSOptions())
+            .addPrefix("-XX:ExtraSharedClassListFile=" + destClassList, "-cp", JarBuilder.getOrCreateHelloJar())
+            .setArchiveName(archiveName);
+        CDSTestUtils.createArchiveAndCheck(opts);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+package catalog;
+
+import java.net.URI;
+import java.nio.file.Paths;
+import javax.xml.catalog.CatalogFeatures;
+import javax.xml.catalog.CatalogManager;
+import javax.xml.catalog.CatalogResolver;
+import javax.xml.transform.Source;
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8215330
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng catalog.GroupTest
+ * @summary Tests catalog with Group entries.
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class GroupTest extends CatalogSupportBase {
+
+    String catalogGroup;
+    /*
+     * Initializing fields
+     */
+    @BeforeClass
+    public void setUpClass() throws Exception {
+        super.setUp();
+        catalogGroup = Paths.get(filepath + "GroupTest.xml").toUri().toASCIIString();
+    }
+
+    /**
+     * Tests catalog resolution with entries in a group.
+     *
+     * @param catalog the catalog to be used
+     * @param uri an URI to be resolved by the catalog
+     * @param expected the expected result string
+     * @throws Exception
+     */
+    @Test(dataProvider = "data_group")
+    public void testGroup(String catalog, String uri, String expected) throws Exception {
+        CatalogResolver resolver = CatalogManager.catalogResolver(
+                CatalogFeatures.defaults(), URI.create(catalog));
+
+        Source src = resolver.resolve(uri, null);
+        Assert.assertTrue(src.getSystemId().endsWith(expected), "uriSuffix match");
+    }
+
+
+    /*
+       DataProvider: for testing catalogs with group entries
+       Data: catalog file, uri, expected result string
+     */
+    @DataProvider(name = "data_group")
+    public Object[][] getDataDOM() {
+        return new Object[][]{
+            {catalogGroup, "http://openjdk_java_net/xml/catalog/A/CommonFileA1.xml", "LocalFileA1.xml"},
+            {catalogGroup, "http://openjdk_java_net/xml/catalog/B/CommonFileB1.xml", "LocalFileB1.xml"},
+            {catalogGroup, "http://openjdk_java_net/xml/catalog/C/CommonFileC1.xml", "LocalFileC1.xml"},
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jaxp/javax/xml/jaxp/unittest/catalog/GroupTest.xml	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
+         prefer="system" resolve="strict">
+
+    <uriSuffix uriSuffix="/A/CommonFileA1.xml" uri="localMirrorA/LocalFileA1.xml"/>
+
+    <group>
+        <uriSuffix uriSuffix="/B/CommonFileB1.xml" uri="localMirrorB/LocalFileB1.xml"/>
+        <uriSuffix uriSuffix="/B/CommonFileB2.xml" uri="localMirrorB/LocalFileB2.xml"/>
+    </group>
+
+    <group baseURI="localMirrorC">
+        <uriSuffix uriSuffix="/C/CommonFileC1.xml" uri="LocalFileC1.xml"/>
+        <uriSuffix uriSuffix="/C/CommonFileC2.xml" uri="LocalFileC2.xml"/>
+    </group>
+
+</catalog> 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/FontClass/FontSize1Test.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,56 @@
+/*
+ * 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 8216965
+ * @summary verify no crash when rendering size 1 fonts
+ */
+
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.GraphicsEnvironment;
+import java.awt.image.BufferedImage;
+
+public class FontSize1Test {
+
+    static final String text = "abcdefghijklmnopqrstuvwxyz";
+
+    public static void main(String[] args) {
+
+        BufferedImage bi =
+            new BufferedImage(100, 20, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g2d = bi.createGraphics();
+        Font af[] =
+            GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
+
+        for (Font f : af) {
+            System.out.println("Looking at font " + f);
+            g2d.setFont(f);
+            g2d.getFontMetrics().getWidths();
+            g2d.drawString(text, 50, 10);
+        }
+        g2d.dispose();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/Modal/MultipleDialogs/MixOfModalAndNonModalDialogs.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Dialog;
+import java.awt.Frame;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @test
+ * @key headful
+ * @bug 8215200
+ * @summary tests mixing of modal and non-modal dialogs
+ */
+public final class MixOfModalAndNonModalDialogs {
+
+    public static void main(final String[] args) throws Exception {
+        final Frame frame = new Frame();
+        try {
+            frame.setSize(300, 300);
+            frame.setLocationRelativeTo(null);
+            frame.setVisible(true);
+
+            // mix of modal, non-modal and invisible dialogs, all combinations
+            for (int step = 0; step < 3; ++step) {
+                for (int i = 0; i < 10; ++i) {
+                    showDialog(frame, i);
+                }
+                showModalDialog(frame);
+                for (int i = 0; i < 10; ++i) {
+                    showDialog(frame, i);
+                }
+            }
+        } finally {
+            frame.dispose();
+        }
+    }
+
+    private static void showDialog(final Frame frame, final int i) {
+        final  Dialog visible = new Dialog(frame);
+        visible.setLocationRelativeTo(null);
+        visible.setVisible(true);
+        if (i % 2 == 0) {
+            new Dialog(frame);
+        }
+    }
+
+    private static void showModalDialog(final Frame frame) throws Exception {
+        final CountDownLatch go = new CountDownLatch(1);
+        final Thread thread = new Thread(() -> {
+            final Dialog modal = new Dialog(frame, "Modal Dialog", true);
+            modal.pack();
+            go.countDown();
+            modal.setLocationRelativeTo(null);
+            modal.setVisible(true);
+        });
+        thread.start();
+        go.await();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/awt/TextField/FontChangeTest/FontChangeTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+ * @key headful
+ * @bug 8211267
+ * @summary verifies TextField.setFont()
+ */
+
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Panel;
+import java.awt.TextField;
+import java.awt.BorderLayout;
+import java.awt.FlowLayout;
+
+public class FontChangeTest {
+    static Frame frame;
+    static Panel p1;
+    static TextField tf1;
+    static boolean failed = false;
+
+    public static void main(String[] args) throws Exception {
+        EventQueue.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                 try {
+                     testFont1();
+                 } catch (StackOverflowError soe) {
+                     failed = true;
+                 }
+            }
+        });
+        frame.dispose();
+        if (failed) {
+            throw new Exception("Test failed");
+        }
+    }
+
+    private static void testFont1() {
+        frame = new Frame();
+        frame.setLayout(new BorderLayout());
+        p1 = new Panel();
+        p1.setLayout(new FlowLayout());
+        tf1 = new TextField("ABC");
+        tf1.setFont(new Font("Dialog", Font.PLAIN, 12));
+        p1.add(tf1);
+        frame.add(p1, BorderLayout.CENTER);
+        frame.pack();
+        frame.setVisible(true);
+        p1.setVisible(false);
+        tf1.setText("xyz");
+        tf1.setFont(new Font("Dialog", Font.PLAIN, 24));
+        p1.setVisible(true);
+        frame.pack();
+    }
+}
--- a/test/jdk/java/lang/String/AlignIndent.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 Unit tests for String#align and String#indent
- * @run main AlignIndent
- */
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-public class AlignIndent {
-    static final List<String> ENDS = List.of("", "\n", "   \n", "\n\n", "\n\n\n");
-    static final List<String> MIDDLES = List.of(
-            "",
-            "xyz",
-            "   xyz",
-            "      xyz",
-            "xyz   ",
-            "   xyz   ",
-            "      xyz   ",
-            "xyz\u2022",
-            "   xyz\u2022",
-            "xyz\u2022   ",
-            "   xyz\u2022   ",
-            "   // comment"
-    );
-
-    public static void main(String[] args) {
-        test1();
-        test2();
-        test3();
-        test4();
-    }
-
-    /*
-     * Test String#align() functionality.
-     */
-    static void test1() {
-        for (String prefix : ENDS) {
-            for (String suffix : ENDS) {
-                for (String middle : MIDDLES) {
-                    {
-                        String input = prefix + "   abc   \n" + middle + "\n   def   \n" + suffix;
-                        String output = input.align();
-
-                        String[] inLines = input.split("\\R");
-                        String[] outLines = output.split("\\R");
-
-                        String[] inLinesBody = getBody(inLines);
-
-                        if (inLinesBody.length < outLines.length) {
-                            report("String::align()", "Result has more lines than expected", input, output);
-                        } else if (inLinesBody.length > outLines.length) {
-                            report("String::align()", "Result has fewer lines than expected", input, output);
-                        }
-
-                        int indent = -1;
-                        for (int i = 0; i < inLinesBody.length; i++) {
-                            String in = inLinesBody[i];
-                            String out = outLines[i];
-                            if (!out.isBlank()) {
-                                int offset = in.indexOf(out);
-                                if (offset == -1) {
-                                    report("String::align()", "Portions of line are missing", input, output);
-                                }
-                                if (indent == -1) {
-                                    indent = offset;
-                                } else if (offset != indent) {
-                                    report("String::align()",
-                                            "Inconsistent indentation in result", input, output);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /*
-     * Test String#align(int n) functionality.
-     */
-    static void test2() {
-        for (int adjust : new int[] {-8, -7, -4, -3, -2, -1, 0, 1, 2, 3, 4, 7, 8}) {
-            for (String prefix : ENDS) {
-                for (String suffix : ENDS) {
-                    for (String middle : MIDDLES) {
-                        {
-                            String input = prefix + "   abc   \n" + middle + "\n   def   \n" + suffix;
-                            String output = input.align(adjust);
-                            String expected = input.align().indent(adjust);
-
-                            if (!output.equals(expected)) {
-                                report("String::align(int n)",
-                                        "Result inconsistent with align().indent(n)", expected, output);
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /*
-     * Test String#indent(int n) functionality.
-     */
-    static void test3() {
-        for (int adjust : new int[] {-8, -7, -4, -3, -2, -1, 0, 1, 2, 3, 4, 7, 8}) {
-            for (String prefix : ENDS) {
-                for (String suffix : ENDS) {
-                    for (String middle : MIDDLES) {
-                        String input = prefix + "   abc   \n" + middle + "\n   def   \n" + suffix;
-                        String output = input.indent(adjust);
-
-                        Stream<String> stream = input.lines();
-                        if (adjust > 0) {
-                            final String spaces = " ".repeat(adjust);
-                            stream = stream.map(s -> s.isBlank() ? s : spaces + s);
-                        } else if (adjust < 0) {
-                            stream = stream.map(s -> s.substring(Math.min(-adjust, indexOfNonWhitespace(s))));
-                        }
-                        String expected = stream.collect(Collectors.joining("\n", "", "\n"));
-
-                        if (!output.equals(expected)) {
-                            report("String::indent(int n)",
-                                    "Result indentation not as expected", expected, output);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    /*
-     * JDK-8212694: Using Raw String Literals with align() and Integer.MIN_VALUE causes out of memory error
-     */
-    static void test4() {
-        try {
-            String str = "\n    A\n".align(Integer.MIN_VALUE);
-        } catch (OutOfMemoryError ex) {
-            System.err.println("align(Integer.MIN_VALUE) not clipping indentation");
-            throw new RuntimeException();
-        }
-    }
-
-    public static int indexOfNonWhitespace(String s) {
-        int left = 0;
-        while (left < s.length()) {
-            char ch = s.charAt(left);
-            if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
-                break;
-            }
-            left++;
-        }
-        return left;
-    }
-
-
-    private static String[] getBody(String[] inLines) {
-        int from = -1, to = -1;
-        for (int i = 0; i < inLines.length; i++) {
-            String line = inLines[i];
-            if (!line.isBlank()) {
-                if (from == -1) {
-                    from = i;
-                }
-                to = i + 1;
-            }
-        }
-        return Arrays.copyOfRange(inLines, from, to);
-    }
-
-    /*
-     * Report difference in result.
-     */
-    static void report(String test, String message, String input, String output) {
-        System.err.println("Testing " + test + ": " + message);
-        System.err.println();
-        System.err.println("Input: length = " + input.length());
-        System.err.println("_".repeat(40));
-        System.err.print(input.replaceAll(" ", "."));
-        System.err.println("_".repeat(40));
-        System.err.println();
-        System.err.println("Output: length = " + output.length());
-        System.err.println("_".repeat(40));
-        System.err.print(output.replaceAll(" ", "."));
-        System.err.println("_".repeat(40));
-        throw new RuntimeException();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/String/Indent.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 Unit tests for String#indent
+ * @run main Indent
+ */
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class Indent {
+    static final List<String> ENDS = List.of("", "\n", "   \n", "\n\n", "\n\n\n");
+    static final List<String> MIDDLES = List.of(
+            "",
+            "xyz",
+            "   xyz",
+            "      xyz",
+            "xyz   ",
+            "   xyz   ",
+            "      xyz   ",
+            "xyz\u2022",
+            "   xyz\u2022",
+            "xyz\u2022   ",
+            "   xyz\u2022   ",
+            "   // comment"
+    );
+
+    public static void main(String[] args) {
+        test1();
+    }
+
+    /*
+     * Test String#indent(int n) functionality.
+     */
+    static void test1() {
+        for (int adjust : new int[] {-8, -7, -4, -3, -2, -1, 0, 1, 2, 3, 4, 7, 8}) {
+            for (String prefix : ENDS) {
+                for (String suffix : ENDS) {
+                    for (String middle : MIDDLES) {
+                        String input = prefix + "   abc   \n" + middle + "\n   def   \n" + suffix;
+                        String output = input.indent(adjust);
+
+                        Stream<String> stream = input.lines();
+                        if (adjust > 0) {
+                            final String spaces = " ".repeat(adjust);
+                            stream = stream.map(s -> spaces + s);
+                        } else if (adjust < 0) {
+                            stream = stream.map(s -> s.substring(Math.min(-adjust, indexOfNonWhitespace(s))));
+                        }
+                        String expected = stream.collect(Collectors.joining("\n", "", "\n"));
+
+                        if (!output.equals(expected)) {
+                            report("String::indent(int n)",
+                                    "Result indentation not as expected", expected, output);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    public static int indexOfNonWhitespace(String s) {
+        int left = 0;
+        while (left < s.length()) {
+            char ch = s.charAt(left);
+            if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
+                break;
+            }
+            left++;
+        }
+        return left;
+    }
+
+
+    private static String[] getBody(String[] inLines) {
+        int from = -1, to = -1;
+        for (int i = 0; i < inLines.length; i++) {
+            String line = inLines[i];
+            if (!line.isBlank()) {
+                if (from == -1) {
+                    from = i;
+                }
+                to = i + 1;
+            }
+        }
+        return Arrays.copyOfRange(inLines, from, to);
+    }
+
+    /*
+     * Report difference in result.
+     */
+    static void report(String test, String message, String input, String output) {
+        System.err.println("Testing " + test + ": " + message);
+        System.err.println();
+        System.err.println("Input: length = " + input.length());
+        System.err.println("_".repeat(40));
+        System.err.print(input.replaceAll(" ", "."));
+        System.err.println("_".repeat(40));
+        System.err.println();
+        System.err.println("Output: length = " + output.length());
+        System.err.println("_".repeat(40));
+        System.err.print(output.replaceAll(" ", "."));
+        System.err.println("_".repeat(40));
+        throw new RuntimeException();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/math/BigInteger/LargeValueExceptions.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 8200698
+ * @summary Tests that exceptions are thrown for ops which would overflow
+ * @requires os.maxMemory >= 4g
+ * @run testng/othervm -Xmx4g LargeValueExceptions
+ */
+import java.math.BigInteger;
+import static java.math.BigInteger.ONE;
+import org.testng.annotations.Test;
+
+//
+// The intent of this test is to probe the boundaries between overflow and
+// non-overflow, principally for multiplication and squaring, specifically
+// the largest values which should not overflow and the smallest values which
+// should. The transition values used are not necessarily at the exact
+// boundaries but should be "close." Quite a few different values were used
+// experimentally before settling on the ones in this test. For multiplication
+// and squaring all cases are exercised: definite overflow and non-overflow
+// which can be detected "up front," and "indefinite" overflow, i.e., overflow
+// which cannot be detected up front so further calculations are required.
+//
+// Testing negative values is unnecessary. For both multiplication and squaring
+// the paths lead to the Toom-Cook algorithm where the signum is used only to
+// determine the sign of the result and not in the intermediate calculations.
+// This is also true for exponentiation.
+//
+// @Test annotations with optional element "enabled" set to "false" should
+// succeed when "enabled" is set to "true" but they take too to run in the
+// course of the typical regression test execution scenario.
+//
+public class LargeValueExceptions {
+    // BigInteger.MAX_MAG_LENGTH
+    private static final int MAX_INTS = 1 << 26;
+
+    // Number of bits corresponding to MAX_INTS
+    private static final long MAX_BITS = (0xffffffffL & MAX_INTS) << 5L;
+
+    // Half BigInteger.MAX_MAG_LENGTH
+    private static final int MAX_INTS_HALF = MAX_INTS / 2;
+
+    // --- squaring ---
+
+    // Largest no overflow determined by examining data lengths alone.
+    @Test(enabled=false)
+    public void squareNoOverflow() {
+        BigInteger x = ONE.shiftLeft(16*MAX_INTS - 1).subtract(ONE);
+        BigInteger y = x.multiply(x);
+    }
+
+    // Smallest no overflow determined by extra calculations.
+    @Test(enabled=false)
+    public void squareIndefiniteOverflowSuccess() {
+        BigInteger x = ONE.shiftLeft(16*MAX_INTS - 1);
+        BigInteger y = x.multiply(x);
+    }
+
+    // Largest overflow detected by extra calculations.
+    @Test(expectedExceptions=ArithmeticException.class,enabled=false)
+    public void squareIndefiniteOverflowFailure() {
+        BigInteger x = ONE.shiftLeft(16*MAX_INTS).subtract(ONE);
+        BigInteger y = x.multiply(x);
+    }
+
+    // Smallest overflow detected by examining data lengths alone.
+    @Test(expectedExceptions=ArithmeticException.class)
+    public void squareDefiniteOverflow() {
+        BigInteger x = ONE.shiftLeft(16*MAX_INTS);
+        BigInteger y = x.multiply(x);
+    }
+
+    // --- multiplication ---
+
+    // Largest no overflow determined by examining data lengths alone.
+    @Test(enabled=false)
+    public void multiplyNoOverflow() {
+        final int halfMaxBits = MAX_INTS_HALF << 5;
+
+        BigInteger x = ONE.shiftLeft(halfMaxBits).subtract(ONE);
+        BigInteger y = ONE.shiftLeft(halfMaxBits - 1).subtract(ONE);
+        BigInteger z = x.multiply(y);
+    }
+
+    // Smallest no overflow determined by extra calculations.
+    @Test(enabled=false)
+    public void multiplyIndefiniteOverflowSuccess() {
+        BigInteger x = ONE.shiftLeft((int)(MAX_BITS/2) - 1);
+        long m = MAX_BITS - x.bitLength();
+
+        BigInteger y = ONE.shiftLeft((int)(MAX_BITS/2) - 1);
+        long n = MAX_BITS - y.bitLength();
+
+        if (m + n != MAX_BITS) {
+            throw new RuntimeException("Unexpected leading zero sum");
+        }
+
+        BigInteger z = x.multiply(y);
+    }
+
+    // Largest overflow detected by extra calculations.
+    @Test(expectedExceptions=ArithmeticException.class,enabled=false)
+    public void multiplyIndefiniteOverflowFailure() {
+        BigInteger x = ONE.shiftLeft((int)(MAX_BITS/2)).subtract(ONE);
+        long m = MAX_BITS - x.bitLength();
+
+        BigInteger y = ONE.shiftLeft((int)(MAX_BITS/2)).subtract(ONE);
+        long n = MAX_BITS - y.bitLength();
+
+        if (m + n != MAX_BITS) {
+            throw new RuntimeException("Unexpected leading zero sum");
+        }
+
+        BigInteger z = x.multiply(y);
+    }
+
+    // Smallest overflow detected by examining data lengths alone.
+    @Test(expectedExceptions=ArithmeticException.class)
+    public void multiplyDefiniteOverflow() {
+        // multiply by 4 as MAX_INTS_HALF refers to ints
+        byte[] xmag = new byte[4*MAX_INTS_HALF];
+        xmag[0] = (byte)0xff;
+        BigInteger x = new BigInteger(1, xmag);
+
+        byte[] ymag = new byte[4*MAX_INTS_HALF + 1];
+        ymag[0] = (byte)0xff;
+        BigInteger y = new BigInteger(1, ymag);
+
+        BigInteger z = x.multiply(y);
+    }
+
+    // --- exponentiation ---
+
+    @Test(expectedExceptions=ArithmeticException.class)
+    public void powOverflow() {
+        BigInteger.TEN.pow(Integer.MAX_VALUE);
+    }
+
+    @Test(expectedExceptions=ArithmeticException.class)
+    public void powOverflow1() {
+        int shift = 20;
+        int exponent = 1 << shift;
+        BigInteger x = ONE.shiftLeft((int)(MAX_BITS / exponent));
+        BigInteger y = x.pow(exponent);
+    }
+
+    @Test(expectedExceptions=ArithmeticException.class)
+    public void powOverflow2() {
+        int shift = 20;
+        int exponent = 1 << shift;
+        BigInteger x = ONE.shiftLeft((int)(MAX_BITS / exponent)).add(ONE);
+        BigInteger y = x.pow(exponent);
+    }
+
+    @Test(expectedExceptions=ArithmeticException.class,enabled=false)
+    public void powOverflow3() {
+        int shift = 20;
+        int exponent = 1 << shift;
+        BigInteger x = ONE.shiftLeft((int)(MAX_BITS / exponent)).subtract(ONE);
+        BigInteger y = x.pow(exponent);
+    }
+
+    @Test(enabled=false)
+    public void powOverflow4() {
+        int shift = 20;
+        int exponent = 1 << shift;
+        BigInteger x = ONE.shiftLeft((int)(MAX_BITS / exponent - 1)).add(ONE);
+        BigInteger y = x.pow(exponent);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/ALPNFailureTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,197 @@
+/*
+ * 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 This test will timeout if the ALPN CF is not completed
+ *          when a 'Connection reset by peer' exception is raised
+ *          during the handshake.
+ * @bug 8217094
+ * @modules java.net.http
+ *          java.logging
+ * @build ALPNFailureTest
+ * @run main/othervm -Djdk.internal.httpclient.debug=true ALPNFailureTest HTTP_1_1
+ * @run main/othervm ALPNFailureTest HTTP_2
+ */
+import javax.net.ServerSocketFactory;
+import javax.net.ssl.SSLContext;
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.ProxySelector;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.net.StandardSocketOptions;
+import java.net.URI;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.net.http.HttpTimeoutException;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class ALPNFailureTest {
+
+
+    public static void main(String[] args) throws Exception{
+        if (args == null || args.length == 0) {
+            args = new String[] {HttpClient.Version.HTTP_1_1.name()};
+        }
+        ServerSocket socket = ServerSocketFactory.getDefault()
+                .createServerSocket(0, 10, InetAddress.getLoopbackAddress());
+
+        test(socket, null, null, args);
+    }
+
+    public static void test(ServerSocket socket, SSLContext context,
+                            ProxySelector ps, String... args)
+            throws Exception
+    {
+        System.out.println("Tests a race condition in SSLTube/SSLFlowDelegate");
+        System.out.println("This test will timeout if the ALPN CF is not completed" +
+                " when a 'Connection reset by peer' exception is raised" +
+                " during the handshake - see 8217094.");
+
+        URI uri = new URI("https", null,
+                socket.getInetAddress().getHostAddress(), socket.getLocalPort(),
+                "/ReadOnlyServer/https_1_1/", null, null);
+        HttpRequest request1 = HttpRequest.newBuilder(uri)
+                .GET().build();
+        HttpRequest request2 = HttpRequest.newBuilder(uri)
+                .POST(HttpRequest.BodyPublishers.ofString("foo")).build();
+
+        ReadOnlyServer server = new ReadOnlyServer(socket);
+        Thread serverThread = new Thread(server, "ServerThread");
+        serverThread.start();
+        try {
+            for (var arg : args) {
+                var version = HttpClient.Version.valueOf(arg);
+                HttpClient.Builder builder = HttpClient.newBuilder()
+                        .version(version);
+                if (ps != null) builder.proxy(ps);
+                if (context != null) builder.sslContext(context);
+
+                HttpClient client = builder.build();
+                for (var request : List.of(request1, request2)) {
+                    System.out.println("Server is " + socket.getLocalSocketAddress()
+                            + ", Version is " + version + ", Method is " + request.method()
+                            + (ps == null ? ", no proxy"
+                            : (", Proxy is " + ps.select(request.uri()))));
+                    try {
+                        HttpResponse<String> resp =
+                                client.send(request, HttpResponse.BodyHandlers.ofString());
+                        throw new AssertionError(
+                                "Client should not have received any response: " + resp);
+                    } catch (HttpTimeoutException x) {
+                        System.out.println("Unexpected " + x);
+                        x.printStackTrace();
+                        throw new AssertionError("Unexpected exception " + x, x);
+                    } catch (Exception x) {
+                        // We expect IOException("Connection reset by peer"), but
+                        // any exception would do: we just don't want to linger
+                        // forever.
+                        System.err.println("Client got expected exception: " + x);
+                        x.printStackTrace(System.out);
+                    }
+                }
+            }
+        } finally {
+            server.close();
+        }
+    }
+
+    public static class ReadOnlyServer  implements Runnable, Closeable {
+        final ServerSocket socket;
+        final AtomicReference<Throwable> errorRef = new AtomicReference<>();
+        final AtomicBoolean closing = new AtomicBoolean();
+        ReadOnlyServer(ServerSocket socket) {
+            this.socket = socket;
+        }
+
+        @Override
+        public void run() {
+            int count = 0;
+            int all = 0;
+            try {
+                System.out.println("Server starting");
+                while (!closing.get()) {
+                    all += count;
+                    count = 0;
+                    try (Socket client = socket.accept()) {
+                        client.setSoTimeout(1000);
+                        client.setOption(StandardSocketOptions.SO_LINGER, 0);
+                        InputStream is = client.getInputStream();
+                        OutputStream os = client.getOutputStream();
+                        boolean drain = true;
+                        int timeouts = 0;
+                        // now read some byte from the ClientHello
+                        // and abruptly close the socket.
+                        while (drain) {
+                            try {
+                                is.read();
+                                count++;
+                                if (count >= 50) {
+                                    drain = false;
+                                }
+                            } catch (SocketTimeoutException so) {
+                                // make sure we read something
+                                if (count > 0) timeouts++;
+                                if (timeouts == 5) {
+                                    // presumably the client is
+                                    // waiting for us to answer...
+                                    // but we should not reach here.
+                                    drain = false;
+                                }
+                            }
+                        }
+                        System.out.println("Got " + count + " bytes");
+                    }
+                }
+            } catch (Throwable t) {
+                if (!closing.get()) {
+                    errorRef.set(t);
+                    t.printStackTrace();
+                }
+            } finally {
+                System.out.println("Server existing after reading " + (all + count) + " bytes");
+                close();
+            }
+
+        }
+
+        @Override
+        public void close() {
+            if (closing.getAndSet(true))
+                return; // already closed
+            try {
+                socket.close();
+            } catch (IOException x) {
+                System.out.println("Exception while closing: " + x);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/ALPNProxyFailureTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,82 @@
+/*
+ * 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 This test will timeout if the ALPN CF is not completed
+ *          when a 'Connection reset by peer' exception is raised
+ *          during the handshake.
+ * @bug 8217094
+ * @library /test/lib http2/server
+ * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer
+ *        ALPNFailureTest ALPNProxyFailureTest
+ * @modules java.net.http/jdk.internal.net.http.common
+ *          java.net.http/jdk.internal.net.http.frame
+ *          java.net.http/jdk.internal.net.http.hpack
+ *          java.logging
+ *          java.base/sun.net.www.http
+ *          java.base/sun.net.www
+ *          java.base/sun.net
+ * @build ALPNFailureTest
+ * @run main/othervm -Djdk.internal.httpclient.debug=true -Dtest.nolinger=true ALPNProxyFailureTest HTTP_1_1
+ * @run main/othervm -Dtest.nolinger=true ALPNProxyFailureTest HTTP_2
+ */
+import javax.net.ServerSocketFactory;
+import javax.net.ssl.SSLContext;
+import jdk.test.lib.net.SimpleSSLContext;
+import java.net.InetAddress;
+import java.net.ProxySelector;
+import java.net.ServerSocket;
+import java.net.http.HttpClient;
+
+public class ALPNProxyFailureTest extends ALPNFailureTest {
+
+    static final SSLContext context;
+    static {
+        try {
+            context = new SimpleSSLContext().get();
+            SSLContext.setDefault(context);
+        } catch (Exception x) {
+            throw new ExceptionInInitializerError(x);
+        }
+    }
+
+    public static void main(String[] args) throws Exception{
+        if (args == null || args.length == 0) {
+            args = new String[] {HttpClient.Version.HTTP_1_1.name()};
+        }
+        ServerSocket socket = ServerSocketFactory.getDefault()
+                .createServerSocket(0, 10, InetAddress.getLoopbackAddress());
+
+        DigestEchoServer.TunnelingProxy proxy = DigestEchoServer.createHttpsProxyTunnel(
+                DigestEchoServer.HttpAuthSchemeType.NONE);
+        ProxySelector ps = ProxySelector.of(proxy.getProxyAddress());
+
+        try {
+            test(socket, context, ps, args);
+        } finally {
+            proxy.stop();
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/AuthSchemesTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -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
+ * @bug 8217237
+ * @modules java.net.http
+ * @run main/othervm AuthSchemesTest
+ * @summary HttpClient does not deal well with multi-valued WWW-Authenticate challenge headers
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.*;
+import java.net.Authenticator;
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+
+public class AuthSchemesTest {
+    static class BasicServer extends Thread {
+
+        ServerSocket server;
+
+        Socket s;
+        InputStream is;
+        OutputStream os;
+        static final String RESPONSE = "Hello world";
+        static final String respLength = Integer.toString(RESPONSE.length());
+        static final String realm = "wally world";
+
+        String reply1 = "HTTP/1.1 401 Unauthorized\r\n"+
+                "WWW-Authenticate: BarScheme\r\n" +
+                "WWW-Authenticate: FooScheme realm=\""+realm+"\"\r\n" +
+                "WWW-Authenticate: Basic realm=\""+realm+"\"\r\n" +
+                "WWW-Authenticate: WoofScheme\r\n\r\n";
+
+        String reply2 = "HTTP/1.1 200 OK\r\n"+
+                "Date: Mon, 15 Jan 2001 12:18:21 GMT\r\n" +
+                "Server: Apache/1.3.14 (Unix)\r\n" +
+                "Connection: close\r\n" +
+                "Content-Type: text/html; charset=iso-8859-1\r\n" +
+                "Content-Length: " + respLength + "\r\n\r\n";
+
+        BasicServer(ServerSocket s) {
+            server = s;
+        }
+
+        String response() {
+            return RESPONSE;
+        }
+
+        void readAll(Socket s) throws IOException {
+            byte[] buf = new byte [128];
+            InputStream is = s.getInputStream();
+            s.setSoTimeout(1000);
+            try {
+                while (is.read(buf) > 0) ;
+            } catch (SocketTimeoutException x) { }
+        }
+
+        public void run() {
+            try {
+                System.out.println("Server 1: accept");
+                s = server.accept();
+                System.out.println("accepted");
+                os = s.getOutputStream();
+                os.write(reply1.getBytes());
+                readAll(s);
+                s.close();
+
+                System.out.println("Server 2: accept");
+                s = server.accept();
+                System.out.println("accepted");
+                os = s.getOutputStream();
+                os.write((reply2+RESPONSE).getBytes());
+                readAll(s);
+                s.close();
+
+            }
+            catch (Exception e) {
+                System.out.println(e);
+            }
+            finished();
+        }
+
+        boolean isfinished = false;
+
+        public synchronized void finished() {
+            isfinished = true;
+            notifyAll();
+        }
+
+        public synchronized void waitforfinish() {
+            while (!isfinished) {
+                try {
+                    wait();
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    static class Auth extends Authenticator {
+        protected PasswordAuthentication getPasswordAuthentication() {
+            return new PasswordAuthentication("user", new char[] {'a','b','c'});
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        ServerSocket serversocket = null;
+        BasicServer server = null;
+        Auth authenticator = new Auth();
+
+        serversocket = new ServerSocket(0, 10, InetAddress.getLoopbackAddress());
+        int port = serversocket.getLocalPort();
+        server = new BasicServer(serversocket);
+
+        HttpClient client = HttpClient.newBuilder()
+                .authenticator(authenticator)
+                .build();
+        server.start();
+        URI uri = URI.create("http://127.0.0.1:" + port + "/foo");
+        HttpRequest request = HttpRequest.newBuilder(uri)
+                .GET()
+                .build();
+        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+        if (response.statusCode() != 200 || !response.body().equals(server.response())) {
+            System.out.println("Status code = " + response.statusCode());
+            serversocket.close();
+            throw new RuntimeException("Test failed");
+        }
+        serversocket.close();
+        server.waitforfinish();
+        System.out.println("OK");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/jar/Manifest/IncludeInExceptionsTest.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,101 @@
+/*
+ * 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 java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.concurrent.Callable;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.JarOutputStream;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+/**
+ * @test
+ * @bug 8216362
+ * @run main/othervm -Djdk.includeInExceptions=jar IncludeInExceptionsTest yes
+ * @run main/othervm IncludeInExceptionsTest
+ * @summary Verify that the property jdk.net.includeInExceptions works as expected
+ * when an error occurs while reading an invalid Manifest file.
+ */
+/*
+ * @see Manifest#Manifest(JarVerifier,InputStream,String)
+ * @see Manifest#getErrorPosition
+ */
+public class IncludeInExceptionsTest {
+
+    static final String FILENAME = "Unique-Filename-Expected-In_Msg.jar";
+
+    static final byte[] INVALID_MANIFEST = (
+            "Manifest-Version: 1.0\r\n" +
+            "\r\n" +
+            "Illegal\r\n" +
+            "\r\n").getBytes(UTF_8);
+
+    static String createJarInvalidManifest(String jar) throws IOException {
+        try (OutputStream out = Files.newOutputStream(Paths.get(jar));
+            JarOutputStream jos = new JarOutputStream(out)) {
+            JarEntry je = new JarEntry(JarFile.MANIFEST_NAME);
+            jos.putNextEntry(je);
+            jos.write(INVALID_MANIFEST);
+            jos.closeEntry();
+        }
+        return jar;
+    }
+
+    static void test(Callable<?> attempt, boolean includeInExceptions) throws Exception {
+        try {
+            attempt.call();
+            throw new AssertionError("Excpected Exception not thrown");
+        } catch (IOException e) {
+            boolean foundFileName = e.getMessage().contains(FILENAME);
+            if(includeInExceptions && !foundFileName) {
+                throw new AssertionError("JAR file name expected but not found in error message");
+            } else if (foundFileName && !includeInExceptions) {
+                throw new AssertionError("JAR file name found but should not be in error message");
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        boolean includeInExceptions;
+        if(args.length > 0) {
+            includeInExceptions = true;
+            System.out.println("**** Running test WITH -Djdk.includeInExceptions=jar");
+        } else {
+            includeInExceptions = false;
+            System.out.println("**** Running test WITHOUT -Djdk.includeInExceptions=jar");
+        }
+
+        test(() -> new JarFile(createJarInvalidManifest(FILENAME)).getManifest(),
+                includeInExceptions);
+        test(() -> new JarFile(createJarInvalidManifest("Verifying-" + FILENAME),
+                true).getManifest(), includeInExceptions);
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/accessibility/6714324/TabbedPaneMemLeak.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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
+ * @key headful
+ * @bug 6714324
+ * @summary tests if removing a Tab from JTabbedComponent, clears the reference
+ * to the Page (AccessibleContext) object.
+ * @run main TabbedPaneMemLeak
+ */
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.swing.JTabbedPane;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+
+import java.awt.Component;
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+public class TabbedPaneMemLeak
+{
+    private static void checkAccessibleParent(Component component) {
+        //Use reflection to check the value of accessibleContext, since directly calling getAccessibleContext()
+        //creates one, if not already present.
+        try {
+            Field field =
+                    component.getClass().getSuperclass().getSuperclass().getSuperclass().getSuperclass().getDeclaredField(
+                            "accessibleContext");
+            field.setAccessible(true);
+            AccessibleContext ctx = (AccessibleContext)field.get(component);
+            if (ctx != null) {
+                Field accessibleParentField = field.getType().getDeclaredField("accessibleParent");
+                accessibleParentField.setAccessible(true);
+                Accessible parent = (Accessible)accessibleParentField.get(ctx);
+                if (parent != null) {
+                    throw new RuntimeException("Test failed: AccessibleContext added on the wrong codepath.");
+                }
+            }
+        } catch (NoSuchFieldException | IllegalAccessException e) {
+            throw new RuntimeException("Test failed: Unable to fetch AccessibleContext");
+        }
+
+    }
+
+    public static void main(String[] args) throws Exception
+    {
+        SwingUtilities.invokeAndWait(() -> {
+            JTabbedPane tabbedPane = new JTabbedPane();
+            if (tabbedPane.getAccessibleContext() != null) {  // Ensure that the JTabbedPane has an AccessibleContext
+                JComponent component = new JPanel();
+                System.out.println(component.getAccessibleContext().getAccessibleParent()); // null
+                tabbedPane.addTab("Component", component);
+                System.out.println(component.getAccessibleContext().getAccessibleParent()); // JTabbedPane$Page
+
+                JComponent component1 = new JPanel();
+                JComponent component2 = new JPanel();
+
+                tabbedPane.addTab("Component1", component1);
+                tabbedPane.setComponentAt(1, component2);
+
+                if (component1.getAccessibleContext().getAccessibleParent() != null) {
+                    throw new RuntimeException("Test failed: Parent AccessibleContext not cleared from the child component");
+                }
+
+                tabbedPane.removeAll(); // Could also be tabbedPane.remove(component) or tabbedPane.removeTabAt(0)
+                if (component.getAccessibleContext().getAccessibleParent() != null) {
+                    throw new RuntimeException("Test failed: Parent AccessibleContext not cleared from the child " +
+                            "component");
+                }
+
+                JSlider slider = new JSlider(0, 10);
+                Hashtable<Integer, JComponent> labels = slider.createStandardLabels(5, 2);
+
+                JComponent labelComp = labels.get(labels.keys().nextElement());
+
+                tabbedPane.add(labelComp);
+
+                checkAccessibleParent(labelComp);
+
+                tabbedPane.remove(labelComp);
+
+                checkAccessibleParent(labelComp);
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/TLSCommon/KeyAlgorithm.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+/*
+ * Key algorithms.
+ */
+public enum KeyAlgorithm {
+
+    DSA("DSA"),
+    RSA("RSA"),
+    EC("EC"),
+    RSASSAPSS("RSASSA-PSS");
+
+    public final String name;
+
+    private KeyAlgorithm(String name) {
+        this.name = name;
+    }
+}
--- a/test/jdk/javax/net/ssl/compatibility/Parameter.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,252 +0,0 @@
-/*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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.
- */
-
-/*
- * A tagging interface that all TLS communication parameters must implement.
- */
-public interface Parameter { }
-
-/* The followings are TLS communication parameters. */
-
-enum Protocol implements Parameter {
-
-    SSLV3_0(3, "SSLv3"),
-    TLSV1_0(4, "TLSv1"),
-    TLSV1_1(5, "TLSv1.1"),
-    TLSV1_2(6, "TLSv1.2");
-
-    public final int sequence;
-    public final String version;
-
-    private Protocol(int sequence, String version) {
-        this.sequence = sequence;
-        this.version = version;
-    }
-
-    static Protocol getProtocol(String version) {
-        for (Protocol protocol : values()) {
-            if (protocol.version.equals(version)) {
-                return protocol;
-            }
-        }
-
-        return null;
-    }
-
-    static Protocol[] getMandatoryValues() {
-        return new Protocol[] { TLSV1_0, TLSV1_1, TLSV1_2 };
-    }
-}
-
-enum CipherSuite implements Parameter {
-
-    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_RSA_WITH_AES_256_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(),
-    TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(),
-    TLS_RSA_WITH_AES_256_CBC_SHA(),
-    TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA(),
-    TLS_ECDH_RSA_WITH_AES_256_CBC_SHA(),
-    TLS_DHE_RSA_WITH_AES_256_CBC_SHA(),
-    TLS_DHE_DSS_WITH_AES_256_CBC_SHA(),
-    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_RSA_WITH_AES_128_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK7),
-    TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(),
-    TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(),
-    TLS_RSA_WITH_AES_128_CBC_SHA(),
-    TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA(),
-    TLS_ECDH_RSA_WITH_AES_128_CBC_SHA(
-            Protocol.SSLV3_0, JdkRelease.JDK7),
-    TLS_DHE_RSA_WITH_AES_128_CBC_SHA(),
-    TLS_DHE_DSS_WITH_AES_128_CBC_SHA(),
-    TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_RSA_WITH_AES_256_GCM_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_RSA_WITH_AES_128_GCM_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(
-            Protocol.TLSV1_2, JdkRelease.JDK8),
-    TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA(),
-    TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA(),
-    TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA(),
-    TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA(),
-    TLS_ECDHE_ECDSA_WITH_RC4_128_SHA(),
-    TLS_ECDHE_RSA_WITH_RC4_128_SHA(),
-    TLS_ECDH_ECDSA_WITH_RC4_128_SHA(),
-    TLS_ECDH_RSA_WITH_RC4_128_SHA(),
-    SSL_RSA_WITH_RC4_128_SHA(),
-    SSL_RSA_WITH_3DES_EDE_CBC_SHA(),
-    SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA(
-            Protocol.SSLV3_0, JdkRelease.JDK7),
-    SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA(
-            Protocol.SSLV3_0, JdkRelease.JDK7),
-    SSL_RSA_WITH_RC4_128_MD5(
-            Protocol.SSLV3_0, JdkRelease.JDK7);
-
-    private static final boolean FULL_CIPHER_SUITES
-            = Utils.getBoolProperty("fullCipherSuites");
-
-    final Protocol startProtocol;
-    final Protocol endProtocol;
-
-    final JdkRelease startJdk;
-    final JdkRelease endJdk;
-
-    private CipherSuite(
-            Protocol startProtocol, Protocol endProtocol,
-            JdkRelease startJdk, JdkRelease endJdk) {
-        this.startProtocol = startProtocol;
-        this.endProtocol = endProtocol;
-
-        this.startJdk = startJdk;
-        this.endJdk = endJdk;
-    }
-
-    private CipherSuite(Protocol startProtocol, JdkRelease startJdk) {
-        this(startProtocol, null, startJdk, null);
-    }
-
-    private CipherSuite() {
-        this(Protocol.TLSV1_0, null, JdkRelease.JDK7, null);
-    }
-
-    boolean supportedByProtocol(Protocol protocol) {
-        return startProtocol.sequence <= protocol.sequence
-                && (endProtocol == null || endProtocol.sequence >= protocol.sequence);
-    }
-
-    static CipherSuite[] getMandatoryValues() {
-        return FULL_CIPHER_SUITES
-               ? values()
-               : new CipherSuite[] {
-                       TLS_RSA_WITH_AES_128_CBC_SHA,
-                       TLS_DHE_DSS_WITH_AES_128_CBC_SHA,
-                       TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
-                       TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
-                       TLS_RSA_WITH_AES_256_CBC_SHA256,
-                       TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,
-                       TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384,
-                       TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 };
-    }
-
-    static CipherSuite getCipherSuite(String name) {
-        for (CipherSuite cipherSuite : values()) {
-            if (cipherSuite.name().equals(name)) {
-                return cipherSuite;
-            }
-        }
-
-        return null;
-    }
-}
-
-enum ClientAuth implements Parameter {
-
-    FALSE,
-    TRUE;
-
-    static ClientAuth[] getMandatoryValues() {
-        return new ClientAuth[] { TRUE };
-    }
-}
-
-enum ServerName implements Parameter {
-
-    NONE(null),
-    EXAMPLE("www.example.com");
-
-    final String name;
-
-    private ServerName(String name) {
-        this.name = name;
-    }
-
-    static ServerName[] getMandatoryValues() {
-        return new ServerName[] { EXAMPLE };
-    }
-}
-
-enum AppProtocol implements Parameter {
-
-    NONE(null, null),
-    EXAMPLE(new String[] { Utils.HTTP_2, Utils.HTTP_1_1 }, Utils.HTTP_2);
-
-    final String[] appProtocols;
-
-    // Expected negotiated application protocol
-    final String negoAppProtocol;
-
-    private AppProtocol(String[] appProtocols, String negoAppProtocol) {
-        this.appProtocols = appProtocols;
-        this.negoAppProtocol = negoAppProtocol;
-    }
-
-    static AppProtocol[] getMandatoryValues() {
-        return new AppProtocol[] { EXAMPLE };
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/internal/loader/URLClassPath/JarClassPathFileEntry.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,104 @@
+/*
+ * 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 java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import jdk.test.lib.util.JarUtils;
+import jdk.test.lib.compiler.InMemoryJavaCompiler;
+
+/*
+ * @test
+ * @bug 8216401
+ * @summary Test loading of JAR Class-Path entry with file: scheme
+ * @library /test/lib
+ *
+ * @run main/othervm JarClassPathFileEntry
+ * @run main/othervm -Djdk.net.URLClassPath.disableClassPathURLCheck=true JarClassPathFileEntry
+ * @run main/othervm -Djdk.net.URLClassPath.disableClassPathURLCheck=false JarClassPathFileEntry
+ */
+
+public class JarClassPathFileEntry {
+    private final static boolean IS_WINDOWS = System.getProperty("os.name").startsWith("Windows");
+
+    private final static String TEST_CLASSES = System.getProperty("test.classes");
+    private final static String OTHER_DIR = TEST_CLASSES + "/OTHER/";
+
+    private final static Path OTHER_JAR_PATH = Paths.get(OTHER_DIR, "Other.jar");
+    private final static Path CONTEXT_JAR_PATH = Paths.get(TEST_CLASSES, "Context.jar");
+
+    public static void main(String[] args) throws Throwable {
+        // Create Other.class in OTHER_DIR, off the default classpath
+        byte klassbuf[] = InMemoryJavaCompiler.compile("Other",
+                                                       "public class Other {}");
+        ClassFileInstaller.writeClassToDisk("Other", klassbuf, OTHER_DIR);
+
+        // Create Other.jar in OTHER_DIR
+        JarUtils.createJarFile(OTHER_JAR_PATH,
+                               Paths.get(OTHER_DIR),
+                               Paths.get(OTHER_DIR, "Other.class"));
+
+        // Create Context.class
+        klassbuf = InMemoryJavaCompiler.compile("Context",
+                                                "public class Context {}");
+        ClassFileInstaller.writeClassToDisk("Context", klassbuf, TEST_CLASSES);
+
+        // Create Context.jar w/ "file:" entry for Other.jar
+        Manifest mf = new Manifest();
+        Attributes attrs = mf.getMainAttributes();
+        attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
+
+        String classPathEntry = "file:" + (IS_WINDOWS ? toUnixPath(OTHER_JAR_PATH.toString())
+                                                      :            OTHER_JAR_PATH.toString());
+        attrs.put(Attributes.Name.CLASS_PATH, classPathEntry);
+
+        System.out.println("Creating Context.jar with Class-Path: " + classPathEntry);
+        JarUtils.createJarFile(CONTEXT_JAR_PATH, mf,
+                               Paths.get(TEST_CLASSES),
+                               Paths.get(TEST_CLASSES, "Context.class"));
+
+        // Use URLClassLoader w/ Context.jar to load Other.class, which will
+        // load via the Class-Path entry
+        URL url = CONTEXT_JAR_PATH.toUri().toURL();
+        URLClassLoader ucl = new URLClassLoader("TestURLClassLoader",
+                                                new URL[]{ url },
+                                                null); // don't delegate to App CL
+        Class<?> otherClass = Class.forName("Other", true, ucl); // ClassNotFoundException -> fail
+        System.out.println("Loaded: " + otherClass);
+    }
+
+    /* Convert a Windows path to a unix-style path, and remove any drive letter */
+    private static String toUnixPath(String orig) {
+        String retVal = new File(orig).toURI().getPath();
+        int colonAt = retVal.indexOf(':');
+
+        if (colonAt != -1 && colonAt < 3) {
+            retVal = retVal.substring(colonAt + 1); // Start after the drive letter
+        }
+        return retVal;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/jfr/event/runtime/TestShutdownEvent.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,248 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.jfr.event.runtime;
+
+import java.io.IOException;
+import java.lang.reflect.Field;
+import java.nio.file.Paths;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import jdk.jfr.consumer.RecordedEvent;
+import jdk.jfr.consumer.RecordedFrame;
+import jdk.jfr.consumer.RecordedStackTrace;
+import jdk.jfr.consumer.RecordingFile;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Platform;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.jfr.EventNames;
+import jdk.test.lib.jfr.Events;
+import sun.misc.Unsafe;
+
+/**
+ * @test
+ * @summary Test Shutdown event
+ * @key jfr
+ * @requires vm.hasJFR
+ * @library /test/lib
+ * @modules jdk.jfr
+ * @run main jdk.jfr.event.runtime.TestShutdownEvent
+ */
+public class TestShutdownEvent {
+    private static ShutdownEventSubTest subTests[] = {
+             new TestLastNonDaemon(),
+             new TestSystemExit(),
+             new TestVMCrash(),
+             new TestUnhandledException(),
+             new TestRuntimeHalt(),
+             new TestSig("TERM"),
+             new TestSig("HUP"),
+             new TestSig("INT")};
+
+    public static void main(String[] args) throws Throwable {
+        for (int i = 0; i < subTests.length; ++i) {
+            if (subTests[i].isApplicable()) {
+                runSubtest(i);
+            } else {
+                System.out.println("Skipping non-applicable test: " + i);
+            }
+        }
+    }
+
+    private static void runSubtest(int subTestIndex) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true,
+                                "-Xlog:jfr=debug",
+                                "-XX:-CreateCoredumpOnCrash",
+                                "-XX:StartFlightRecording=filename=./dumped.jfr,dumponexit=true,settings=default",
+                                "jdk.jfr.event.runtime.TestShutdownEvent$TestMain",
+                                String.valueOf(subTestIndex));
+        OutputAnalyzer output = ProcessTools.executeProcess(pb);
+        System.out.println(output.getOutput());
+        System.out.println("Exit code: " + output.getExitValue());
+
+        String recordingName = output.firstMatch("emergency jfr file: (.*.jfr)", 1);
+        if (recordingName == null) {
+            recordingName = "./dumped.jfr";
+        }
+
+        List<RecordedEvent> events = RecordingFile.readAllEvents(Paths.get(recordingName));
+        List<RecordedEvent> filteredEvents = events.stream()
+            .filter(e -> e.getEventType().getName().equals(EventNames.Shutdown))
+            .sorted(Comparator.comparing(RecordedEvent::getStartTime))
+            .collect(Collectors.toList());
+
+        Asserts.assertEquals(filteredEvents.size(), 1);
+        RecordedEvent event = filteredEvents.get(0);
+        subTests[subTestIndex].verifyEvents(event);
+    }
+
+    @SuppressWarnings("unused")
+    private static class TestMain {
+        public static void main(String[] args) throws Exception {
+            ShutdownEventSubTest subTest = subTests[Integer.parseInt(args[0])];
+            System.out.println("Running subtest " + args[0] + " (" + subTest.getClass().getName() + ")");
+            subTest.runTest();
+        }
+    }
+
+    private interface ShutdownEventSubTest {
+        default boolean isApplicable() {
+            return true;
+        }
+        void runTest();
+        void verifyEvents(RecordedEvent event);
+    }
+
+    public static Unsafe getUnsafe() {
+        try {
+            Field f = Unsafe.class.getDeclaredField("theUnsafe");
+            f.setAccessible(true);
+            return (Unsafe)f.get(null);
+        } catch (Exception e) {
+            Asserts.fail("Could not access Unsafe");
+        }
+        return null;
+    }
+
+    // Basic stack trace validation, checking that the runTest method is part of the stack
+    static void validateStackTrace(RecordedStackTrace stackTrace) {
+        List<RecordedFrame> frames = stackTrace.getFrames();
+        Asserts.assertFalse(frames.isEmpty());
+        Asserts.assertTrue(frames.stream()
+                           .anyMatch(t -> t.getMethod().getName().equals("runTest")));
+    }
+
+
+    // =========================================================================
+    private static class TestLastNonDaemon implements ShutdownEventSubTest {
+        @Override
+        public void runTest() {
+            // Do nothing - this is the default exit reason
+        }
+
+        @Override
+        public void verifyEvents(RecordedEvent event) {
+            Events.assertField(event, "reason").equal("No remaining non-daemon Java threads");
+        }
+    }
+
+    private static class TestSystemExit implements ShutdownEventSubTest {
+        @Override
+        public void runTest() {
+            System.out.println("Running System.exit");
+            System.exit(42);
+        }
+
+        @Override
+        public void verifyEvents(RecordedEvent event) {
+            Events.assertField(event, "reason").equal("Shutdown requested from Java");
+            validateStackTrace(event.getStackTrace());
+        }
+    }
+
+    private static class TestVMCrash implements ShutdownEventSubTest {
+
+        @Override
+        public void runTest() {
+            System.out.println("Attempting to crash");
+            getUnsafe().putInt(0L, 0);
+        }
+
+        @Override
+        public void verifyEvents(RecordedEvent event) {
+            Events.assertField(event, "reason").equal("VM Error");
+            validateStackTrace(event.getStackTrace());
+        }
+    }
+
+    private static class TestUnhandledException implements ShutdownEventSubTest {
+        @Override
+        public void runTest() {
+            throw new RuntimeException("Unhandled");
+        }
+
+        @Override
+        public void verifyEvents(RecordedEvent event) {
+            Events.assertField(event, "reason").equal("No remaining non-daemon Java threads");
+        }
+    }
+
+    private static class TestRuntimeHalt implements ShutdownEventSubTest {
+        @Override
+        public void runTest() {
+            System.out.println("Running Runtime.getRuntime.halt");
+            Runtime.getRuntime().halt(17);
+        }
+
+        @Override
+        public void verifyEvents(RecordedEvent event) {
+            Events.assertField(event, "reason").equal("Shutdown requested from Java");
+            validateStackTrace(event.getStackTrace());
+        }
+    }
+
+    private static class TestSig implements ShutdownEventSubTest {
+
+        private final String signalName;
+
+        @Override
+        public boolean isApplicable() {
+            if (Platform.isWindows()) {
+                return false;
+            }
+            if (signalName.equals("HUP") && Platform.isSolaris()) {
+                return false;
+            }
+            return true;
+        }
+
+        public TestSig(String signalName) {
+            this.signalName = signalName;
+        }
+
+        @Override
+        public void runTest() {
+            System.out.println("Sending SIG" + signalName + " to process " + ProcessHandle.current().pid());
+            try {
+                Runtime.getRuntime().exec("kill -" + signalName + " " + ProcessHandle.current().pid()).waitFor();
+                Thread.sleep(60_1000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            Asserts.fail("Process survived the SIG" + signalName + " signal!");
+        }
+
+        @Override
+        public void verifyEvents(RecordedEvent event) {
+            Events.assertField(event, "reason").equal("Shutdown requested from Java");
+            Events.assertEventThread(event);
+            Asserts.assertEquals(event.getThread().getJavaName(), "SIG" + signalName + " handler");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/nio/zipfs/DirectoryStreamTests.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,357 @@
+/*
+ * 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 org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.nio.file.*;
+import java.nio.file.spi.FileSystemProvider;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.regex.PatternSyntaxException;
+import java.util.zip.ZipException;
+
+import static org.testng.Assert.*;
+
+/**
+ * @test
+ * @bug 8211385 8211919
+ * @summary ZIP File System tests that leverage DirectoryStream
+ * @modules jdk.zipfs
+ * @compile DirectoryStreamTests.java
+ * @run testng DirectoryStreamTests
+ * @run testng/othervm/java.security.policy=test.policy  DirectoryStreamTests
+ */
+public class DirectoryStreamTests {
+
+    // Map to used for creating a ZIP archive
+    private static final Map<String, String> ZIPFS_MAP = Map.of("create", "true");
+
+    // Map to used for extracting a ZIP archive
+    private static final Map<String, String> UNZIPFS_MAP = Map.of();
+
+    // The ZIP file system provider
+    private static final FileSystemProvider ZIPFS_PROVIDER = getZipFSProvider();
+
+    // Primary jar file used for testing
+    private static Path jarFile;
+
+    // Jar file used to validate the behavior of the navigation of an empty directory
+    private static Path emptyJarFile;
+
+    /**
+     * Create the JAR files used by the tests
+     */
+    @BeforeClass
+    public void setUp()  throws Exception {
+        emptyJarFile = Paths.get("emptyDir.jar");
+        try (FileSystem zipfs = ZIPFS_PROVIDER.newFileSystem(emptyJarFile, ZIPFS_MAP)) {
+
+            jarFile = Utils.createJarFile("basic.jar",
+                    "META-INF/services/java.nio.file.spi.FileSystemProvider");
+
+            Files.createDirectory(zipfs.getPath("emptyDir"));
+        }
+    }
+
+    /**
+     * Remove JAR files used by test as part of clean-up
+     */
+    @AfterClass
+    public void tearDown() throws Exception {
+            Files.deleteIfExists(jarFile);
+            Files.deleteIfExists(emptyJarFile);
+    }
+
+    /**
+     * Validate that you can specify a DirectoryStream filter using the ZIP File
+     * System and that the returned Iterator correctly indicates whether the
+     * filter has been matched
+     */
+    @Test(dataProvider = "filterTestValues")
+    public void test0000(String glob, boolean expectedResult, String errMsg)
+            throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> ds = Files.newDirectoryStream(zipfs.getPath("/"),
+                     new DirectoryStream.Filter<Path>() {
+                         private PathMatcher matcher =
+                                 zipfs.getPathMatcher("glob:" + glob);
+                         public boolean accept(Path file) {
+                             return matcher.matches(file.getFileName());
+                         }
+             }))
+        {
+            assertEquals(ds.iterator().hasNext(), expectedResult, errMsg);
+        }
+    }
+
+    /**
+     * Validate that you can specify a glob using the ZIP File System and that the
+     * returned Iterator correctly indicates whether the glob pattern has been matched
+     */
+    @Test(dataProvider = "filterTestValues")
+    public void test0001(String glob, boolean expectedResult, String errMsg)
+            throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> ds =
+                     Files.newDirectoryStream(zipfs.getPath("/"), glob)) {
+            assertEquals(ds.iterator().hasNext(), expectedResult, errMsg);
+        }
+    }
+
+    /**
+     * Validate a PatternSyntaxException is thrown when specifying an invalid
+     * glob pattern with the ZIP File system
+     */
+    @Test
+    public void test0002() throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP)) {
+            assertThrows(PatternSyntaxException.class, () ->
+                    Files.newDirectoryStream(zipfs.getPath("/"), "*[a-z"));
+        }
+    }
+
+    /**
+     * Validate that the correct type of paths are returned when creating a
+     * DirectoryStream
+     */
+    @Test(dataProvider = "startPaths")
+    public void test0003(String startPath, String expectedPath)
+            throws IOException {
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> stream =
+                     Files.newDirectoryStream(zipfs.getPath(startPath))) {
+
+            for (Path entry : stream) {
+                assertTrue(entry.toString().equals(expectedPath),
+                        String.format("Error: Expected path %s not found when"
+                                + " starting at %s%n", expectedPath, entry));
+            }
+        }
+    }
+
+    /**
+     * Validate a NotDirectoryException is thrown when specifying a file for the
+     * starting path for creating a DirectoryStream with the ZIP File System
+     */
+    @Test
+    public void test0004() throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP)) {
+            assertThrows(NotDirectoryException.class,
+                    () -> Files.newDirectoryStream(
+                            zipfs.getPath("META-INF/services/java.nio.file.spi."
+                                    + "FileSystemProvider")));
+        }
+    }
+
+    /**
+     * Validate an IllegalStateException is thrown when accessing the Iterator
+     * more than once with the ZIP File System
+     */
+    @Test
+    public void test0005() throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> ds =
+                     Files.newDirectoryStream(zipfs.getPath("/"))) {
+            ds.iterator();
+            assertThrows(IllegalStateException.class, () -> ds.iterator());
+
+        }
+    }
+
+    /**
+     * Validate an IllegalStateException is thrown when accessing the Iterator
+     * after the DirectoryStream has been closed with the ZIP File System
+     */
+    @Test
+    public void test0006() throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> ds =
+                     Files.newDirectoryStream(zipfs.getPath("/"))) {
+            ds.close();
+            assertThrows(IllegalStateException.class, () -> ds.iterator());
+
+            // ZipDirectoryStream.iterator() throws ClosedDirectoryStream when
+            // obtaining an Iterator when the DirectoryStream is closed
+            assertThrows(ClosedDirectoryStreamException.class, () -> ds.iterator());
+
+        }
+    }
+
+    /**
+     * Validate an UnsupportedOperationException is thrown when invoking an
+     * Iterator operation that is not supported with the ZIP File System
+     */
+    @Test
+    public void test0007() throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> ds =
+                     Files.newDirectoryStream(zipfs.getPath("/"))) {
+            Iterator<Path> i = ds.iterator();
+
+            assertThrows(UnsupportedOperationException.class, () -> i.remove());
+        }
+    }
+
+    /**
+     * Validate an NoSuchElementException is thrown when invoking an
+     * Iterator.next() on a closed DirectoryStream with the ZIP File System
+     */
+    @Test
+    public void test0008() throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> ds =
+                     Files.newDirectoryStream(zipfs.getPath("/"))) {
+            Iterator<Path> i = ds.iterator();
+            ds.close();
+            assertThrows(NoSuchElementException.class, () -> i.next());
+        }
+    }
+
+    /**
+     * Validate Iterator.hasNext() returns false when the directory is empty with
+     * the ZIP File System
+     */
+    @Test
+    public void test0009() throws Exception {
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(emptyJarFile, UNZIPFS_MAP);
+             DirectoryStream<Path> ds =
+                     Files.newDirectoryStream(zipfs.getPath("emptyDir"))) {
+            assertFalse(ds.iterator().hasNext(), "Error: directory was not empty!");
+
+        }
+    }
+
+    /**
+     * Validate Iterator.hasNext() returns false when the DirectoryStream is closed
+     * with the ZIP File System
+     */
+    @Test
+    public void test0010() throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> ds =
+                     Files.newDirectoryStream(zipfs.getPath("/"))) {
+            Iterator<Path> i = ds.iterator();
+            ds.close();
+            assertFalse(i.hasNext(),
+                    "Error: false should be returned as DirectoryStream is closed!");
+        }
+    }
+
+    /**
+     * Validate that an IOException thrown by a filter is returned as the cause
+     * via a DirectoryIteratorException
+     */
+    @Test
+    public void test0011() throws Exception {
+
+        try (FileSystem zipfs =
+                ZIPFS_PROVIDER.newFileSystem(Paths.get("basic.jar"), UNZIPFS_MAP);
+             DirectoryStream<Path> ds = Files.newDirectoryStream(zipfs.getPath("/"),
+                     new DirectoryStream.Filter<Path>() {
+                         public boolean accept(Path file) throws IOException {
+                             throw new java.util.zip.ZipException();
+                         }
+                     }))
+        {
+            ds.iterator().hasNext();
+            throw new RuntimeException("Expected DirectoryIteratorException not thrown");
+
+        } catch (DirectoryIteratorException x) {
+            IOException cause = x.getCause();
+            if (!(cause instanceof ZipException))
+                throw new RuntimeException("Expected IOException not propagated");
+        }
+    }
+
+    /**
+     * Glob values to use to validate filtering
+     */
+    @DataProvider(name = "filterTestValues")
+    public static Object[][] filterValues() {
+
+        String expectedMsg = "Error: Matching entries were expected but not found!!!";
+        String notExpectedMsg = "Error: No matching entries expected but were found!!!";
+        return new Object[][]{
+
+                {"M*", true, expectedMsg},
+                {"I*", false, notExpectedMsg}
+        };
+    }
+
+    /**
+     * Starting Path for the DirectoryStream and the expected path to be returned
+     * when traversing the stream
+     */
+    @DataProvider(name = "startPaths")
+    public static Object[][] Name() {
+        return new Object[][]{
+
+                {"META-INF", "META-INF/services"},
+                {"/META-INF", "/META-INF/services"},
+                {"/META-INF/../META-INF","/META-INF/../META-INF/services" },
+                {"./META-INF", "./META-INF/services"},
+                {"", "META-INF"},
+                {"/", "/META-INF"},
+                {".", "./META-INF"},
+                {"./", "./META-INF"}
+        };
+    }
+
+    /**
+     * Returns the Zip FileSystem Provider
+     */
+    private static FileSystemProvider getZipFSProvider() {
+        for (FileSystemProvider fsProvider : FileSystemProvider.installedProviders()) {
+            if ("jar".equals(fsProvider.getScheme())) {
+                return fsProvider;
+            }
+        }
+        return null;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/nio/cs/TestUnicodeReversedBOM.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,75 @@
+/*
+ * 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 8216140
+ * @summary Test reversed BOM (U+FFFE) in the middle of a byte buffer
+ *      passes through during decoding with UnicodeDecoder.
+ * @run testng TestUnicodeReversedBOM
+ */
+import java.nio.charset.*;
+import java.nio.*;
+import java.util.*;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+@Test
+public class TestUnicodeReversedBOM {
+    private static byte[] A_REVERSED_BE =
+        {(byte)0x0, (byte)'A', (byte)0xff, (byte)0xfe};
+    private static byte[] A_REVERSED_LE =
+        {(byte)'A', (byte)0x0, (byte)0xfe, (byte)0xff};
+    private static byte[] BOM_REVERSED_BE =
+        {(byte)0xfe, (byte)0xff, (byte)0xff, (byte)0xfe};
+    private static byte[] BOM_REVERSED_LE =
+        {(byte)0xff, (byte)0xfe, (byte)0xfe, (byte)0xff};
+
+    @DataProvider
+    // [(byte[])byte array, (Charset)cs]
+    public static Object[][] ReversedBOM() {
+        return new Object[][] {
+            {A_REVERSED_BE, StandardCharsets.UTF_16},
+            {A_REVERSED_LE, StandardCharsets.UTF_16},
+            {A_REVERSED_BE, StandardCharsets.UTF_16BE},
+            {A_REVERSED_LE, StandardCharsets.UTF_16BE},
+            {A_REVERSED_BE, StandardCharsets.UTF_16LE},
+            {A_REVERSED_LE, StandardCharsets.UTF_16LE},
+            {BOM_REVERSED_BE, StandardCharsets.UTF_16},
+            {BOM_REVERSED_LE, StandardCharsets.UTF_16},
+            {BOM_REVERSED_BE, StandardCharsets.UTF_16BE},
+            {BOM_REVERSED_LE, StandardCharsets.UTF_16BE},
+            {BOM_REVERSED_BE, StandardCharsets.UTF_16LE},
+            {BOM_REVERSED_LE, StandardCharsets.UTF_16LE},
+        };
+    }
+
+    @Test(dataProvider = "ReversedBOM")
+    public void testReversedBOM(byte[] ba, Charset cs) throws CharacterCodingException {
+        cs.newDecoder()
+            .onMalformedInput(CodingErrorAction.REPORT)
+            .onUnmappableCharacter(CodingErrorAction.REPORT)
+            .decode(ByteBuffer.wrap(ba));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/pkcs12/SameDN.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,70 @@
+/*
+ * 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 static jdk.test.lib.SecurityTools.keytool;
+
+import java.io.File;
+import java.security.KeyStore;
+
+/*
+ * @test
+ * @bug 8215776
+ * @library /test/lib
+ * @summary Keytool importkeystore may mix up certificate chain entries when DNs conflict
+ */
+public class SameDN {
+
+    private static final String COMMON = "-keystore ks -storepass changeit ";
+
+    public static final void main(String[] args) throws Exception {
+        genkeypair("ca1", "CN=CA");
+        genkeypair("ca2", "CN=CA");
+        genkeypair("user1", "CN=user");
+        genkeypair("user2", "CN=user");
+        gencert("ca1", "user1");
+        gencert("ca2", "user2");
+
+        KeyStore ks = KeyStore.getInstance(
+                new File("ks"), "changeit".toCharArray());
+        if (!ks.getCertificate("ca1").equals(ks.getCertificateChain("user1")[1])) {
+            throw new Exception("user1 not signed by ca1");
+        }
+        if (!ks.getCertificate("ca2").equals(ks.getCertificateChain("user2")[1])) {
+            throw new Exception("user2 not signed by ca2");
+        }
+    }
+
+    static void genkeypair(String alias, String dn) throws Exception {
+        keytool(COMMON + "-genkeypair -alias " + alias + " -dname " + dn)
+                .shouldHaveExitValue(0);
+    }
+
+    static void gencert(String issuer, String subject) throws Exception {
+        keytool(COMMON + "-certreq -alias " + subject + " -file req")
+                .shouldHaveExitValue(0);
+        keytool(COMMON + "-gencert -alias " + issuer + " -infile req -outfile cert")
+                .shouldHaveExitValue(0);
+        keytool(COMMON + "-importcert -alias " + subject + " -file cert")
+                .shouldHaveExitValue(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/Symantec/appleistca2g1-chain.pem	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,80 @@
+-----BEGIN CERTIFICATE-----
+MIIGGzCCBQOgAwIBAgIITJltLCqcD0gwDQYJKoZIhvcNAQELBQAwYjEcMBoGA1UE
+AxMTQXBwbGUgSVNUIENBIDIgLSBHMTEgMB4GA1UECxMXQ2VydGlmaWNhdGlvbiBB
+dXRob3JpdHkxEzARBgNVBAoTCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE5
+MDEwODIxMTcxNFoXDTIwMDgwODIxMjcwMFowgaoxSjBIBgNVBAMMQWFjdGl2ZS5n
+ZW90cnVzdC1nbG9iYWwtY2EudGVzdC1wYWdlcy5jZXJ0aWZpY2F0ZW1hbmFnZXIu
+YXBwbGUuY29tMSUwIwYDVQQLDBxtYW5hZ2VtZW50OmlkbXMuZ3JvdXAuODY0ODU5
+MRMwEQYDVQQKDApBcHBsZSBJbmMuMRMwEQYDVQQIDApDYWxpZm9ybmlhMQswCQYD
+VQQGEwJVUzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMCjFUrVHTEX
+0aVU6x9LiGa6oVr9blaCsMFrLicPQguc43Vs/pN+g4jzRXsTSMe9XefezBQb6tzZ
+SMRXVB4kWMr4K1BVgQDkXeyoh4KrXRkdEF9ZIJPNxwTmmYUOc5M6NOYwkLelYz+t
+7n1iNIGylbjwU4qwauElk2alFVqYTEPDLzwvqVDb9jMAJ8MPSDjfUlXW0XD9oXZM
+hC+8LU9JBgJ3YBdzRHa4WnrudUbWjspqaNfAYpVIX0cfCJKnMsKqaSKjS4pIRtWm
+L6NlCTCoIMyOh+wmbWPPX24H2D3+ump5FA35fRYbVznmosl5n1AK34S9tD4XZ7lO
+WZKfaFi1liMCAwEAAaOCAoowggKGMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAU
+2HqURHyQcJAWnt0XnAFEA4bWKikwfgYIKwYBBQUHAQEEcjBwMDQGCCsGAQUFBzAC
+hihodHRwOi8vY2VydHMuYXBwbGUuY29tL2FwcGxlaXN0Y2EyZzEuZGVyMDgGCCsG
+AQUFBzABhixodHRwOi8vb2NzcC5hcHBsZS5jb20vb2NzcDAzLWFwcGxlaXN0Y2Ey
+ZzEwMTBMBgNVHREERTBDgkFhY3RpdmUuZ2VvdHJ1c3QtZ2xvYmFsLWNhLnRlc3Qt
+cGFnZXMuY2VydGlmaWNhdGVtYW5hZ2VyLmFwcGxlLmNvbTCB/wYDVR0gBIH3MIH0
+MIHxBgoqhkiG92NkBQsEMIHiMIGkBggrBgEFBQcCAjCBlwyBlFJlbGlhbmNlIG9u
+IHRoaXMgY2VydGlmaWNhdGUgYnkgYW55IHBhcnR5IGFzc3VtZXMgYWNjZXB0YW5j
+ZSBvZiBhbnkgYXBwbGljYWJsZSB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2Ug
+YW5kL29yIGNlcnRpZmljYXRpb24gcHJhY3RpY2Ugc3RhdGVtZW50cy4wOQYIKwYB
+BQUHAgEWLWh0dHA6Ly93d3cuYXBwbGUuY29tL2NlcnRpZmljYXRlYXV0aG9yaXR5
+L3JwYTAdBgNVHSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwNwYDVR0fBDAwLjAs
+oCqgKIYmaHR0cDovL2NybC5hcHBsZS5jb20vYXBwbGVpc3RjYTJnMS5jcmwwHQYD
+VR0OBBYEFP0qkmFJhArI0MsfW0V+/wY9x4GSMA4GA1UdDwEB/wQEAwIFoDANBgkq
+hkiG9w0BAQsFAAOCAQEATjT8M0bIq+mFc8k5cd4KDjCMBjYl/l3/8zKlWYGP+nl1
+KRogXcGRa3LcfpdJcqgMrx8e9Xohduvl8MBzwv671rYkppzZdsmZdLVorAdbL5GL
+suhTjAS5yL3NBWNMRpeOgFsVr7YtPDEvo3CFsnzjg7THe0S6Y35oYukJtUzGUvSY
+kC3ApBTdjj0vAeow+dbt+AHKnQiEnon4ToSFmtnkru08Uxe7uyHCQ2sLUg0EPYc9
+t9I8lviaHfK/mQoCzlme2O/H5Rher8dXCv8hVT1NKbsi28EpgpqcTLS+hn/Edc/q
+4dPDoO1Ozs+ixRzFeMpA+JrnAyARb6qbSrAPBgtIbQ==
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIEQDCCAyigAwIBAgIDAjp0MA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNVBAYTAlVT
+MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
+YWwgQ0EwHhcNMTQwNjE2MTU0MjAyWhcNMjIwNTIwMTU0MjAyWjBiMRwwGgYDVQQD
+ExNBcHBsZSBJU1QgQ0EgMiAtIEcxMSAwHgYDVQQLExdDZXJ0aWZpY2F0aW9uIEF1
+dGhvcml0eTETMBEGA1UEChMKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwggEiMA0G
+CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDQk6EdR0MgFrILa+vD1bTox5jN896/
+6E3p4zaAB/xFG2p8RYauVtOkCX9hDWtdflJrfbTIOcT0Zzr3g84Zb4YvfkV+Rxxn
+UsqVBV3iNlGFwNRngDVvFd0+/R3S/Y80UNjsdiq+49Pa5P3I6ygClhGXF2Ec6cRZ
+O0LcMtEJHdqm0UOG/16yvIzPZtsBiwKulEjzOI/96jKoCOyGl1GUJD5JSZZT6Hmh
+QIHpBbuTlVH84/18EUv3ngizFUkVB/nRN6CbSzL2tcTcatH8Cu324MUpoKiLcf4N
+krz+VHAYCm3H7Qz7yS0Gw4yF/MuGXNY2jhKLCX/7GRo41fCUMHoPpozzAgMBAAGj
+ggEdMIIBGTAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1luMrMTjAdBgNVHQ4E
+FgQU2HqURHyQcJAWnt0XnAFEA4bWKikwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNV
+HQ8BAf8EBAMCAQYwNQYDVR0fBC4wLDAqoCigJoYkaHR0cDovL2cuc3ltY2IuY29t
+L2NybHMvZ3RnbG9iYWwuY3JsMC4GCCsGAQUFBwEBBCIwIDAeBggrBgEFBQcwAYYS
+aHR0cDovL2cuc3ltY2QuY29tMEwGA1UdIARFMEMwQQYKYIZIAYb4RQEHNjAzMDEG
+CCsGAQUFBwIBFiVodHRwOi8vd3d3Lmdlb3RydXN0LmNvbS9yZXNvdXJjZXMvY3Bz
+MA0GCSqGSIb3DQEBCwUAA4IBAQAWR3NvhaJi4ecqdruJlUIml7xKrKxwUzo/MYM9
+PByrmuKxXRx2GqA8DHJXvtOeUODImdZY1wLqzg0pVHzN9cLGkClVo28UqAtCDTqY
+bQZ4nvBqox0CCqIopI3CgUY+bWfa3j/+hQ5CKhLetbf7uBunlux3n+zUU5V6/wf0
+8goUwFFSsdaOUAsamVy8C8m97e34XsFW201+I6QRoSzUGwWa5BtS9nw4mQVLunKN
+QolgBGYq9P1o12v3mUEo1mwkq+YlUy7Igpnioo8jvjCDsSeL+mh/AUnoxphrEC6Y
+XorXykuxx8lYmtA225aV7LaB5PLNbxt5h0wQPInkTfpU3Kqm
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
+MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
+YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG
+EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg
+R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9
+9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq
+fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv
+iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU
+1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+
+bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW
+MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA
+ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l
+uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn
+Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS
+tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF
+PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un
+hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV
+5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw==
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/Symantec/appleistca8g1-chain.pem	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,64 @@
+-----BEGIN CERTIFICATE-----
+MIIElDCCBDqgAwIBAgIIWax3IY1ByGIwCgYIKoZIzj0EAwIwYjEcMBoGA1UEAwwT
+QXBwbGUgSVNUIENBIDggLSBHMTEgMB4GA1UECwwXQ2VydGlmaWNhdGlvbiBBdXRo
+b3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE5MDEw
+ODIxMTAyNFoXDTIwMDgwODIxMjAwMFowga0xTTBLBgNVBAMMRGFjdGl2ZS5nZW90
+cnVzdC1nbG9iYWwtY2EtZzIudGVzdC1wYWdlcy5jZXJ0aWZpY2F0ZW1hbmFnZXIu
+YXBwbGUuY29tMSUwIwYDVQQLDBxtYW5hZ2VtZW50OmlkbXMuZ3JvdXAuODY0ODU5
+MRMwEQYDVQQKDApBcHBsZSBJbmMuMRMwEQYDVQQIDApDYWxpZm9ybmlhMQswCQYD
+VQQGEwJVUzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABN4oxNLGzmOIfgFRxDaU
+SaOYTQVZCc7a7MXlK1L4/KgN22stgSkrg47aOWviMuzb9Q9hDA/Tn19o9Zr8G5ON
+pYijggKMMIICiDAMBgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFMPEpFgFY9eDBrqW
+jdyyjzL2u7dBMH4GCCsGAQUFBwEBBHIwcDA0BggrBgEFBQcwAoYoaHR0cDovL2Nl
+cnRzLmFwcGxlLmNvbS9hcHBsZWlzdGNhOGcxLmRlcjA4BggrBgEFBQcwAYYsaHR0
+cDovL29jc3AuYXBwbGUuY29tL29jc3AwMy1hcHBsZWlzdGNhOGcxMDEwTwYDVR0R
+BEgwRoJEYWN0aXZlLmdlb3RydXN0LWdsb2JhbC1jYS1nMi50ZXN0LXBhZ2VzLmNl
+cnRpZmljYXRlbWFuYWdlci5hcHBsZS5jb20wgf4GA1UdIASB9jCB8zCB8AYKKoZI
+hvdjZAULBDCB4TCBpAYIKwYBBQUHAgIwgZcMgZRSZWxpYW5jZSBvbiB0aGlzIGNl
+cnRpZmljYXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgYW55
+IGFwcGxpY2FibGUgdGVybXMgYW5kIGNvbmRpdGlvbnMgb2YgdXNlIGFuZC9vciBj
+ZXJ0aWZpY2F0aW9uIHByYWN0aWNlIHN0YXRlbWVudHMuMDgGCCsGAQUFBwICMCwM
+Kmh0dHA6Ly93d3cuYXBwbGUuY29tL2NlcnRpZmljYXRlYXV0aG9yaXR5LzAdBgNV
+HSUEFjAUBggrBgEFBQcDAgYIKwYBBQUHAwEwNwYDVR0fBDAwLjAsoCqgKIYmaHR0
+cDovL2NybC5hcHBsZS5jb20vYXBwbGVpc3RjYThnMS5jcmwwHQYDVR0OBBYEFCQy
+hU8U00tcIz6L0MCT6EGVho0EMA4GA1UdDwEB/wQEAwIDiDAKBggqhkjOPQQDAgNI
+ADBFAiAl5nGHi2u8V0aJSp4o1i3TlK7ao8WvxwBuHKfuKibSLAIhAN8PZqhESS9u
+V7Dr6qzs88yn/1z6oeqPwDsntFpUFtWG
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIDVDCCAtugAwIBAgIQE1Iuv8HdXOEe8nZAdR/n3zAKBggqhkjOPQQDAzCBmDEL
+MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj
+KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2
+MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
+eSAtIEcyMB4XDTE2MDYwOTAwMDAwMFoXDTMxMDYwODIzNTk1OVowYjEcMBoGA1UE
+AwwTQXBwbGUgSVNUIENBIDggLSBHMTEgMB4GA1UECwwXQ2VydGlmaWNhdGlvbiBB
+dXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYH
+KoZIzj0CAQYIKoZIzj0DAQcDQgAELVSOaLAQE+/0LdvYCbJD6J1lmW40uNSXyY7J
+1qgiNzLIcWDusPHyxWT2ukdf/OYHeDIt9sqAIMn9cPhykyGIRaOCATowggE2MBIG
+A1UdEwEB/wQIMAYBAf8CAQAwNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2cuc3lt
+Y2IuY29tL0dlb1RydXN0UENBLUcyLmNybDAOBgNVHQ8BAf8EBAMCAQYwLgYIKwYB
+BQUHAQEEIjAgMB4GCCsGAQUFBzABhhJodHRwOi8vZy5zeW1jZC5jb20wSQYDVR0g
+BEIwQDA+BgZngQwBAgIwNDAyBggrBgEFBQcCARYmaHR0cHM6Ly93d3cuZ2VvdHJ1
+c3QuY29tL3Jlc291cmNlcy9jcHMwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUF
+BwMCMB0GA1UdDgQWBBTDxKRYBWPXgwa6lo3cso8y9ru3QTAfBgNVHSMEGDAWgBQV
+XzVXUVX7JbKtA2n8AaP6vhFV1TAKBggqhkjOPQQDAwNnADBkAjBH2jMNybjCk3Ts
+OidXxJX9YDPMd5S3KDCv8vyTdJGhtoly7fQJRNv5rnVz+6YGfsMCMEp6wyheL7NK
+mqavsduix2R+j1B3wRjelzJYgXzgM3nwhQKKlJWxpF7IGHuva1taxg==
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDEL
+MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj
+KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2
+MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
+eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1OVowgZgxCzAJBgNV
+BAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykgMjAw
+NyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNV
+BAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH
+MjB2MBAGByqGSM49AgEGBSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcL
+So17VDs6bl8VAsBQps8lL33KSLjHUGMcKiEIfJo22Av+0SbFWDEwKCXzXV2juLal
+tJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO
+BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+EVXVMAoG
+CCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGT
+qQ7mndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBucz
+rD6ogRLQy7rQkgu2npaqBA+K
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/jarsigner/SignedAgain.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,92 @@
+/*
+ * 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 8215922
+ * @summary jar spec is not precise when describing jar file re-signing
+ * @library /test/lib
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.util.JarUtils;
+
+import java.io.InputStream;
+import java.security.MessageDigest;
+import java.util.Base64;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+import static jdk.test.lib.SecurityTools.*;
+
+public class SignedAgain {
+    public static void main(String[] args) throws Exception {
+
+        String opt = "-storepass changeit -keystore ks";
+
+        keytool(opt + " -genkeypair -alias a -dname CN=A -keyalg RSA");
+        keytool(opt + " -genkeypair -alias b -dname CN=B -keyalg RSA");
+
+        JarUtils.createJar("a.jar", "f1");
+
+        // as.jar: signed by a
+        jarsigner(opt + " -signedjar as.jar a.jar a");
+
+        JarUtils.updateJar("as.jar", "b.jar", "f2");
+
+        // bs.jar: signed again by b
+        jarsigner(opt + " -signedjar bs.jar b.jar b");
+
+        // verified
+        jarsigner(opt + " -verify -strict -verbose -certs bs.jar")
+                .shouldHaveExitValue(0);
+
+        try (JarFile ja = new JarFile("as.jar");
+             JarFile jb = new JarFile("bs.jar");
+             InputStream ma = ja.getInputStream(
+                     new JarEntry("META-INF/MANIFEST.MF"));
+             InputStream sa = jb.getInputStream(new JarEntry("META-INF/A.SF"));
+             InputStream mb = jb.getInputStream(
+                     new JarEntry("META-INF/MANIFEST.MF"));
+             InputStream sb = jb.getInputStream(new JarEntry("META-INF/B.SF"))) {
+
+            // Hash of manifest for 2 signed JAR files
+            String da = Base64.getEncoder().encodeToString(MessageDigest
+                    .getInstance("SHA-256").digest(ma.readAllBytes()));
+            String db = Base64.getEncoder().encodeToString(MessageDigest
+                    .getInstance("SHA-256").digest(mb.readAllBytes()));
+
+            // They are not the same
+            Asserts.assertNotEquals(da, db);
+
+            // Digest-Manifest in A.SF matches da
+            Asserts.assertEQ(new Manifest(sa).getMainAttributes()
+                    .getValue("SHA-256-Digest-Manifest"), da);
+
+            // Digest-Manifest in B.SF matches db
+            Asserts.assertEQ(new Manifest(sb).getMainAttributes()
+                    .getValue("SHA-256-Digest-Manifest"), db);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/keytool/PSS.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,108 @@
+/*
+ * 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 8215694
+ * @summary keytool cannot generate RSASSA-PSS certificates
+ * @library /test/lib
+ * @modules java.base/sun.security.util
+ *          java.base/sun.security.x509
+ * @run main PSS
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.security.DerUtils;
+import sun.security.util.ObjectIdentifier;
+import sun.security.x509.AlgorithmId;
+
+import java.io.File;
+import java.security.KeyStore;
+import java.security.cert.X509Certificate;
+
+public class PSS {
+
+    public static void main(String[] args) throws Exception {
+
+        genkeypair("p", "-keyalg RSASSA-PSS -sigalg RSASSA-PSS")
+                .shouldHaveExitValue(0);
+
+        genkeypair("a", "-keyalg RSA -sigalg RSASSA-PSS -keysize 2048")
+                .shouldHaveExitValue(0);
+
+        genkeypair("b", "-keyalg RSA -sigalg RSASSA-PSS -keysize 4096")
+                .shouldHaveExitValue(0);
+
+        genkeypair("c", "-keyalg RSA -sigalg RSASSA-PSS -keysize 8192")
+                .shouldHaveExitValue(0);
+
+        KeyStore ks = KeyStore.getInstance(
+                new File("ks"), "changeit".toCharArray());
+
+        check((X509Certificate)ks.getCertificate("p"), "RSASSA-PSS",
+                AlgorithmId.SHA256_oid);
+
+        check((X509Certificate)ks.getCertificate("a"), "RSA",
+                AlgorithmId.SHA256_oid);
+
+        check((X509Certificate)ks.getCertificate("b"), "RSA",
+                AlgorithmId.SHA384_oid);
+
+        check((X509Certificate)ks.getCertificate("c"), "RSA",
+                AlgorithmId.SHA512_oid);
+
+        // More commands
+        kt("-certreq -alias p -sigalg RSASSA-PSS -file p.req")
+                .shouldHaveExitValue(0);
+
+        kt("-gencert -alias a -sigalg RSASSA-PSS -infile p.req -outfile p.cert")
+                .shouldHaveExitValue(0);
+
+        kt("-importcert -alias p -file p.cert")
+                .shouldHaveExitValue(0);
+
+        kt("-selfcert -alias p -sigalg RSASSA-PSS")
+                .shouldHaveExitValue(0);
+    }
+
+    static OutputAnalyzer genkeypair(String alias, String options)
+            throws Exception {
+        return kt("-genkeypair -alias " + alias
+                + " -dname CN=" + alias + " " + options);
+    }
+
+    static OutputAnalyzer kt(String cmd)
+            throws Exception {
+        return SecurityTools.keytool("-storepass changeit -keypass changeit "
+                + "-keystore ks " + cmd);
+    }
+
+    static void check(X509Certificate cert, String expectedKeyAlg,
+            ObjectIdentifier expectedMdAlg) throws Exception {
+        Asserts.assertEQ(cert.getPublicKey().getAlgorithm(), expectedKeyAlg);
+        Asserts.assertEQ(cert.getSigAlgName(), "RSASSA-PSS");
+        DerUtils.checkAlg(cert.getSigAlgParams(), "000", expectedMdAlg);
+    }
+}
--- a/test/jdk/sun/security/util/Resources/NewNamesFormat.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, 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 6987827
- * @modules java.base/sun.security.util
- *          java.base/sun.security.tools.keytool
- *          jdk.jartool/sun.security.tools.jarsigner
- * @summary security/util/Resources.java needs improvement
- */
-
-
-import java.lang.reflect.Method;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * This test makes sure that the keys in resources files are using the new
- * format and there is no duplication.
- */
-public class NewNamesFormat {
-    public static void main(String[] args) throws Exception {
-        checkRes("sun.security.util.Resources");
-        checkRes("sun.security.util.AuthResources");
-        checkRes("sun.security.tools.jarsigner.Resources");
-        checkRes("sun.security.tools.keytool.Resources");
-    }
-
-    private static void checkRes(String resName) throws Exception {
-        System.out.println("Checking " + resName + "...");
-        Class clazz = Class.forName(resName);
-        Method m = clazz.getMethod("getContents");
-        Object[][] contents = (Object[][])m.invoke(clazz.newInstance());
-        Set<String> keys = new HashSet<String>();
-        for (Object[] pair: contents) {
-            String key = (String)pair[0];
-            if (keys.contains(key)) {
-                System.out.println("Found dup: " + key);
-                throw new Exception();
-            }
-            checkKey(key);
-            keys.add(key);
-        }
-    }
-
-    private static void checkKey(String key) throws Exception {
-        for (char c: key.toCharArray()) {
-            if (Character.isLetter(c) || Character.isDigit(c) ||
-                    c == '{' || c == '}' || c == '.') {
-                // OK
-            } else {
-                System.out.println("Illegal char [" + c + "] in key: " + key);
-                throw new Exception();
-            }
-        }
-    }
-}
--- a/test/jdk/sun/security/util/Resources/NewResourcesNames.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,441 +0,0 @@
-/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.ListResourceBundle;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Prepares new key names for Resources.java.
- * 6987827: security/util/Resources.java needs improvement
- *
- * Run inside jdk/src/share/classes:
- *
- *      java NewResourcesNames $(
- *          for a in $(find com/sun/security sun/security javax/security -type f); do
- *              egrep -q '(ResourcesMgr.getString|rb.getString)' $a && echo $a
- *          done)
- *
- * Before running this tool, run the following two commands to make sure there
- * are only these 2 types of calls into the resources:
- *      for a in `find com/sun/security sun/security javax/security -type f`; do
- *          cat $a | perl -ne 'print if /\bResourcesMgr\b/'; done |
- *          grep -v ResourcesMgr.getString
- *      for a in `find com/sun/security sun/security -type f`; do
- *          cat $a | perl -ne 'print if /\brb\b/'; done |
- *          grep -v rb.getString
- */
-class NewResourcesNames {
-
-    // Max length of normalized names
-    static int MAXLEN = 127;
-
-    static String[] resources = {
-        "sun/security/tools/jarsigner/Resources.java",
-        "sun/security/tools/keytool/Resources.java",
-        "sun/security/tools/policytool/Resources.java",
-        "sun/security/util/Resources.java",
-        "sun/security/util/AuthResources.java",
-    };
-
-    public static void main(String[] args) throws Exception {
-
-        // Load all names inside resources files
-        Map<String,String> allnames = loadResources();
-
-        // Modify the callers. There are two patterns:
-        // 1. ResourcesMgr.getString("
-        //    used by most JAAS codes
-        // 2. rb.getString("
-        //    used by tools
-        Set<String> allfound = new HashSet<String>();
-        for (String arg: args) {
-            allfound.addAll(rewriteFile(arg, "ResourcesMgr.getString(\""));
-            allfound.addAll(rewriteFile(arg, "rb.getString(\""));
-        }
-
-        // Special case 1: KeyTool's enum definition of commands and options
-        allfound.addAll(keyToolEnums());
-
-        // Special case 2: PolicyFile called this 4 times
-        allfound.addAll(rewriteFile("sun/security/provider/PolicyFile.java",
-                "ResourcesMgr.getString(POLICY+\""));
-
-        // During the calls above, you can read sth like:
-        //
-        //      Working on com/sun/security/auth/PolicyParser.java
-        //          GOOD  match is 17
-        //
-        // This means a " exists right after getString(. Sometimes you see
-        //
-        //      Working on sun/security/tools/keytool/Main.java
-        //          BAD!! pmatch != match: 212 != 209
-        //      Working on sun/security/provider/PolicyFile.java
-        //          BAD!! pmatch != match: 14 != 10
-        //
-        // which is mismatch. There are only two such special cases list above.
-        // For KeyTool, there are 3 calls for showing help. For PolicyTool, 3
-        // for name prefixed with POLICY. They are covered in the two special
-        // cases above.
-
-        // Names used but not defined. This is mostly error, except for
-        // special case 2 above. So it's OK to see 3 entries red here
-        if (!allnames.keySet().containsAll(allfound)) {
-            err("FATAL: Undefined names");
-            for (String name: allfound) {
-                if (!allnames.keySet().contains(name)) {
-                    err("   " + name);
-                }
-            }
-        }
-
-        // Names defined but not used. Mostly this is old entries not removed.
-        // When soemone remove a line of code, he dares not remove the entry
-        // in case it's also used somewhere else.
-        if (!allfound.containsAll(allnames.keySet())) {
-            System.err.println("WARNING: Unused names");
-            for (String name: allnames.keySet()) {
-                if (!allfound.contains(name)) {
-                    System.err.println(allnames.get(name));
-                    System.err.println("  " + normalize(name));
-                    System.err.println("  [" + name + "]");
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Loads the three resources files. Saves names into a Map.
-     */
-    private static Map<String,String> loadResources() throws Exception {
-
-        // Name vs Resource
-        Map<String,String> allnames = new HashMap<String,String>();
-
-        for (String f: resources) {
-            String clazz =
-                    f.replace('/', '.').substring(0, f.length()-5);
-
-            Set<String> expected = loadClass(clazz);
-            Set<String> found = rewriteFile(f, "{\"");
-
-            // This is to check that word parsing is identical to Java thinks
-            if (!expected.equals(found)) {
-                throw new Exception("Expected and found do not match");
-            }
-
-            for (String name: found) {
-                allnames.put(name, f);
-            }
-        }
-        return allnames;
-    }
-
-    /**
-     * Special case treat for enums description in KeyTool
-     */
-    private static Set<String> keyToolEnums() throws Exception {
-
-        Set<String> names = new HashSet<String>();
-
-        String file = "sun/security/tools/keytool/Main.java";
-        System.err.println("Working on " + file);
-        File origFile = new File(file);
-        File tmpFile = new File(file + ".tmp");
-        origFile.renameTo(tmpFile);
-        tmpFile.deleteOnExit();
-
-        BufferedReader br = new BufferedReader(
-                new InputStreamReader(new FileInputStream(tmpFile)));
-        PrintWriter out = new PrintWriter(new FileOutputStream(origFile));
-
-        int stage = 0;  // 1. commands, 2. options, 3. finished
-        int match = 0;
-
-        while (true) {
-            String s = br.readLine();
-            if (s == null) {
-                break;
-            }
-            if (s.indexOf("enum Command") >= 0) stage = 1;
-            else if (s.indexOf("enum Option") >= 0) stage = 2;
-            else if (s.indexOf("private static final String JKS") >= 0) stage = 3;
-
-            if (stage == 1 || stage == 2) {
-                if (s.indexOf("(\"") >= 0) {
-                    match++;
-                    int p1, p2;
-                    if (stage == 1) {
-                        p1 = s.indexOf("\"");
-                        p2 = s.indexOf("\"", p1+1);
-                    } else {
-                        p2 = s.lastIndexOf("\"");
-                        p1 = s.lastIndexOf("\"", p2-1);
-                    }
-                    String name = s.substring(p1+1, p2);
-                    names.add(name);
-                    out.println(s.substring(0, p1+1) +
-                            normalize(name) +
-                            s.substring(p2));
-                } else {
-                    out.println(s);
-                }
-            } else {
-                out.println(s);
-            }
-        }
-        br.close();
-        out.close();
-        System.err.println("    GOOD  match is " + match);
-        return names;
-    }
-
-    /**
-     * Loads a resources using JRE and returns the names
-     */
-    private static Set<String> loadClass(String clazz) throws Exception {
-        ListResourceBundle lrb =
-                (ListResourceBundle)Class.forName(clazz).newInstance();
-        Set<String> keys = lrb.keySet();
-        Map<String,String> newold = new HashMap<String,String>();
-        boolean dup = false;
-        // Check if normalize() creates dup entries. This is crucial.
-        for (String k: keys) {
-            String key = normalize(k);
-            if (newold.containsKey(key)) {
-                err("Dup found for " + key + ":");
-                err("["+newold.get(key)+"]");
-                err("["+k+"]");
-                dup = true;
-            }
-            newold.put(key, k);
-        }
-        if (dup) throw new Exception();
-        return keys;
-    }
-
-    /**
-     * Rewrites a file using a pattern. The name string should be right after
-     * the pattern. Note: pattern ignores whitespaces. Returns names found.
-     */
-    private static Set<String> rewriteFile(String file, String pattern)
-            throws Exception {
-
-        System.err.println("Working on " + file);
-        Set<String> names = new HashSet<String>();
-
-        int plen = pattern.length();
-        int match = 0;
-
-        // The bare XXX.getString is also matched. Sometimes getString is
-        // called but does not use literal strings. This is harder to solve.
-
-        int pmatch = 0;
-        int pheadlen = plen - 2;
-        String phead = pattern.substring(0, plen-2);
-
-        // The non-whitespace chars read since, used to check for pattern
-        StringBuilder history = new StringBuilder();
-        int hlen = 0;
-
-        File origFile = new File(file);
-        File tmpFile = new File(file + ".tmp");
-        origFile.renameTo(tmpFile);
-        tmpFile.deleteOnExit();
-
-        FileInputStream fis = new FileInputStream(tmpFile);
-        FileOutputStream fos = new FileOutputStream(origFile);
-
-        while (true) {
-            int ch = fis.read();
-            if (ch < 0) break;
-            if (!Character.isWhitespace(ch)) {
-                history.append((char)ch);
-                hlen++;
-                if (pheadlen > 0 && hlen >= pheadlen &&
-                        history.substring(hlen-pheadlen, hlen).equals(phead)) {
-                    pmatch++;
-                }
-            }
-
-            if (hlen >= plen &&
-                    history.substring(hlen-plen, hlen).equals(pattern)) {
-                match++;
-                history = new StringBuilder();
-                hlen = 0;
-
-                fos.write(ch);
-
-                // Save a name
-                StringBuilder sb = new StringBuilder();
-                // Save things after the second ". Maybe it's an end, maybe
-                // it's just literal string concatenation.
-                StringBuilder tail = new StringBuilder();
-
-                boolean in = true;  // inside name string
-                while (true) {
-                    int n = fis.read();
-                    if (in) {
-                        if (n == '\\') {
-                            int second = fis.read();
-                            switch (second) {
-                                case 'n': sb.append('\n'); break;
-                                case 'r': sb.append('\r'); break;
-                                case 't': sb.append('\t'); break;
-                                case '"': sb.append('"'); break;
-                                default: throw new Exception(String.format(
-                                        "I don't know this escape: %s%c",
-                                        sb.toString(), second));
-                            }
-                        } else if (n == '"') {
-                            in = false;
-                            // Maybe string concat? say bytes until clear
-                            tail = new StringBuilder();
-                            tail.append('"');
-                        } else {
-                            sb.append((char)n);
-                        }
-                    } else {
-                        tail.append((char)n);
-                        if (n == '"') { // string concat, in again
-                            in = true;
-                        } else if (n == ',' || n == ')') {  // real end
-                            break;
-                        } else if (Character.isWhitespace(n) || n == '+') {
-                            // string concat
-                        } else {
-                            throw new Exception("Not a correct concat");
-                        }
-                    }
-                }
-                String s = sb.toString();
-                names.add(s);
-                fos.write(normalize(s).getBytes());
-                fos.write(tail.toString().getBytes());
-            } else {
-                fos.write(ch);
-            }
-        }
-
-        // Check pheadlen > 0. Don't want to mess with rewrite for resources
-        if (pheadlen > 0 && pmatch != match) {
-            err("    BAD!! pmatch != match: " + pmatch + " != " + match);
-        } else {
-            System.err.println("    GOOD  match is " + match);
-        }
-
-        fis.close();
-        fos.close();
-        return names;
-    }
-
-    /**
-     * Normalize a string. Rules:
-     *
-     * 1. If all spacebar return "nSPACE", n is count
-     * 2. If consisting at least one alphanumeric:
-     *   a. All alphanumeric remain
-     *   b. All others in a row goes to a single ".", even if at head or tail
-     * 3. Otherwise:
-     *   a. "****\n\n" to "STARNN", special case
-     *   b. the English name if first char in *,.\n():'"
-     *
-     * Current observations show there's no dup, Hurray! Otherwise, add more
-     * special cases.
-     */
-    private static String normalize(String s) throws Exception {
-        boolean needDot = false;
-
-        // All spacebar case
-        int n = 0;
-        for (char c: s.toCharArray()) {
-            if (c == ' ') n++;
-            else n = -10000;
-        }
-        if (n == 1) return "SPACE";
-        else if (n > 1) return "" + n + "SPACE";
-
-        StringBuilder sb = new StringBuilder();
-        int dotpos = -1;
-        for (int i=0; i<s.length(); i++) {
-            char c = s.charAt(i);
-            if (Character.isLetter(c) || Character.isDigit(c) ||
-                    c == '{' || c == '}') {
-                if (needDot) {
-                    // Rememeber the last dot, we want shorter form nice
-                    if (sb.length() <= MAXLEN) dotpos = sb.length();
-                    // "." only added when an alphanumeric is seen. This makes
-                    // sure sb is empty when there's no alphanumerics at all
-                    sb.append(".");
-                }
-                sb.append(c);
-                needDot = false;
-            } else {
-                needDot = true;
-            }
-        }
-
-        // No alphanemeric?
-        if (sb.length() == 0) {
-            if (s.contains("*") && s.contains("\n")) {
-                return "STARNN";
-            }
-            for (char c: s.toCharArray()) {
-                switch (c) {
-                    case '*': return "STAR";
-                    case ',': return "COMMA";
-                    case '.': return "PERIOD";
-                    case '\n': return "NEWLINE";
-                    case '(': return "LPARAM";
-                    case ')': return "RPARAM";
-                    case ':': return "COLON";
-                    case '\'': case '"': return "QUOTE";
-                }
-            }
-            throw new Exception("Unnamed char: [" + s + "]");
-        }
-
-        // tail "." only added when there are alphanumerics
-        if (needDot) sb.append('.');
-        String res = sb.toString();
-        if (res.length() > MAXLEN) {
-            if (dotpos < 0) throw new Exception("No dot all over? " + s);
-            return res.substring(0, dotpos);
-        } else {
-            return res;
-        }
-    }
-
-    private static void err(String string) {
-        System.out.println("\u001b[1;37;41m" + string + "\u001b[m");
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/util/Resources/Usages.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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 8215937
+ * @modules java.base/sun.security.util
+ *          java.base/sun.security.tools.keytool
+ *          jdk.jartool/sun.security.tools.jarsigner
+ * @summary Check usages of security-related Resources files
+ */
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.ListResourceBundle;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * This test checks if the strings in various Resources files are used
+ * properly. Each string must be used somewhere, and each getString() call
+ * must use an existing string.
+ * <p>
+ * For each Resources file, the test maintains a list of where the strings are
+ * used (a file or a directory) and how they are used (one or more patterns).
+ * <p>
+ * If this test fails, there can be several reasons:
+ * <p>
+ * 1. If a string is not found, it has not been added to a Resources file.
+ * <p>
+ * 2. If a string is not used, maybe the call was removed earlier but the
+ * Resources file was not updated. Or, the file is not listed or the
+ * pattern is not correct and the usage is not found.
+ * <p>
+ * Because of #2 above, this test might not be complete. If a getString()
+ * is called but either the file and calling pattern is not listed here,
+ * we cannot guarantee it exists in a Resources file.
+ */
+public class Usages {
+
+    // src folder
+    static Path SRC = Path.of(
+            System.getProperty("test.src"), "../../../../../../src/")
+            .normalize();
+
+    // rb.getString(). Used by keytool, jarsigner, and KeyStoreUtil.
+    static Pattern RB_GETSTRING = Pattern.compile(
+            "(?m)rb[ \\n]*\\.getString[ \\n]*\\([ \\n]*\"(.*?)\"\\)");
+
+    // Command and Option enums in keytool
+    static Pattern KT_ENUM = Pattern.compile("\\n +[A-Z]+\\(.*\"(.*)\"");
+
+    // ResourceMgr.getAuthResourceString
+    static Pattern GETAUTHSTRING = Pattern.compile(
+            "getAuthResourceString[ \\n]*\\([ \\n]*\"(.*?)\"\\)");
+
+    // ResourceMgr.getString
+    static Pattern MGR_GETSTRING = Pattern.compile(
+            "ResourcesMgr\\.getString[ \\n]*\\([ \\n]*\"(.*?)\"\\)");
+
+    // LocalizedMessage.getNonlocalized("...")
+    static Pattern LOC_GETNONLOC = Pattern.compile(
+            "LocalizedMessage\\.getNonlocalized[ \\n]*\\([ \\n]*\"(.*?)\"");
+
+    // LocalizedMessage.getNonlocalized(POLICY + "...")
+    static Pattern LOC_GETNONLOC_POLICY = Pattern.compile(
+            "LocalizedMessage\\.getNonlocalized[ \\n]*\\([ \\n]*(POLICY \\+ \".*?)\"");
+
+    // new LocalizedMessage("...")
+    static Pattern NEW_LOC = Pattern.compile(
+            "new LocalizedMessage[ \\n]*\\([ \\n]*\"(.*?)\"");
+
+    // ioException in ConfigFile.java
+    static Pattern IOEXCEPTION = Pattern.compile(
+            "ioException[ \\n]*\\([ \\n]*\"(.*?)\",");
+
+    // For each Resources file, where and how the strings are used.
+    static Map<ListResourceBundle, List<Pair>> MAP = Map.of(
+            new sun.security.tools.keytool.Resources(), List.of(
+                    new Pair("java.base/share/classes/sun/security/tools/keytool/Main.java",
+                            List.of(RB_GETSTRING, KT_ENUM)),
+                    new Pair("java.base/share/classes/sun/security/tools/KeyStoreUtil.java",
+                            List.of(RB_GETSTRING))),
+            new sun.security.util.AuthResources(), List.of(
+                    new Pair("java.base/share/classes/sun/security/provider/ConfigFile.java",
+                            List.of(GETAUTHSTRING, IOEXCEPTION)),
+                    new Pair("jdk.security.auth/share/classes/com/sun/security/auth/",
+                            List.of(GETAUTHSTRING))),
+            new sun.security.tools.jarsigner.Resources(), List.of(
+                    new Pair("jdk.jartool/share/classes/sun/security/tools/jarsigner/Main.java",
+                            List.of(RB_GETSTRING)),
+                    new Pair("java.base/share/classes/sun/security/tools/KeyStoreUtil.java",
+                            List.of(RB_GETSTRING))),
+            new sun.security.util.Resources(), List.of(
+                    new Pair("jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java",
+                            List.of(MGR_GETSTRING)),
+                    new Pair("java.base/share/classes/sun/security/provider/PolicyParser.java",
+                            List.of(LOC_GETNONLOC, NEW_LOC)),
+                    new Pair("java.base/share/classes/sun/security/provider/PolicyFile.java",
+                            List.of(MGR_GETSTRING, LOC_GETNONLOC, LOC_GETNONLOC_POLICY)),
+                    new Pair("java.base/share/classes/javax/security/auth/",
+                            List.of(MGR_GETSTRING)))
+    );
+
+    public static void main(String[] args) {
+        if (Files.exists(SRC)) {
+            MAP.forEach(Usages::check);
+        } else {
+            System.out.println("No src directory. Test skipped.");
+        }
+    }
+
+    private static void check(ListResourceBundle res, List<Pair> fnps) {
+        try {
+            System.out.println(">>>> Checking " + res.getClass().getName());
+
+            List<String> keys = Collections.list(res.getKeys());
+
+            // Initialize unused to be all keys. Each time a key is used it
+            // is removed. We cannot reuse keys because a key might be used
+            // multiple times. Make it a Set so we can check duplicates.
+            Set<String> unused = new HashSet<>(keys);
+
+            keys.forEach(Usages::checkKeyFormat);
+            if (keys.size() != unused.size()) {
+                throw new RuntimeException("Duplicates found");
+            }
+
+            for (Pair fnp : fnps) {
+                Files.find(SRC.resolve(fnp.path), Integer.MAX_VALUE,
+                        (p, attr) -> p.toString().endsWith(".java"))
+                        .forEach(pa -> {
+                            try {
+                                String content = Files.readString(pa);
+                                for (Pattern p : fnp.patterns) {
+                                    Matcher m = p.matcher(content);
+                                    while (m.find()) {
+                                        String arg = m.group(1);
+                                        // Special case in PolicyFile.java:
+                                        if (arg.startsWith("POLICY + \"")) {
+                                            arg = "java.security.policy"
+                                                    + arg.substring(10);
+                                        }
+                                        if (!keys.contains(arg)) {
+                                            throw new RuntimeException(
+                                                    "Not found: " + arg);
+                                        }
+                                        unused.remove(arg);
+                                    }
+                                }
+                            } catch (IOException e) {
+                                throw new UncheckedIOException(e);
+                            }
+                        });
+            }
+            if (!unused.isEmpty()) {
+                throw new RuntimeException("Unused keys: " + unused);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static void checkKeyFormat(String key) {
+        for (char c : key.toCharArray()) {
+            if (Character.isLetter(c) || Character.isDigit(c) ||
+                    c == '{' || c == '}' || c == '.') {
+                // OK
+            } else {
+                throw new RuntimeException(
+                        "Illegal char [" + c + "] in key: " + key);
+            }
+        }
+    }
+
+    static class Pair {
+
+        public final String path;
+        public final List<Pattern> patterns;
+
+        public Pair(String path, List<Pattern> patterns) {
+            this.path = path;
+            this.patterns = patterns;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,257 @@
+/*
+ * 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
+ * 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 8210047 8199892
+ * @summary some pages contains content outside of landmark region
+ * @library /tools/lib ../../lib
+ * @modules
+ *      jdk.javadoc/jdk.javadoc.internal.tool
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.main
+ * @build javadoc.tester.*
+ * @run main TestHtmlLandmarkRegions
+ */
+
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import builder.ClassBuilder;
+import toolbox.ModuleBuilder;
+import toolbox.ToolBox;
+
+import javadoc.tester.JavadocTester;
+
+public class TestHtmlLandmarkRegions extends JavadocTester {
+
+    final ToolBox tb;
+
+    public static void main(String... args) throws Exception {
+        TestHtmlLandmarkRegions tester = new TestHtmlLandmarkRegions();
+        tester.runTests(m -> new Object[]{Paths.get(m.getName())});
+    }
+
+    TestHtmlLandmarkRegions() {
+        tb = new ToolBox();
+        setAutomaticCheckLinks(false); // @ignore 8217013
+    }
+
+    @Test
+    public void testModules(Path base) throws Exception {
+        Path srcDir = base.resolve("src");
+        createModules(srcDir);
+
+        Path outDir = base.resolve("out");
+        javadoc("-d", outDir.toString(),
+                "-doctitle", "Document Title",
+                "-header", "Test Header",
+                "--frames",
+                "--module-source-path", srcDir.toString(),
+                "--module", "m1,m2");
+
+        checkExit(Exit.OK);
+
+        checkOrder("module-overview-frame.html",
+                "<header role=\"banner\">\n"
+                + "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
+                + "<nav role=\"navigation\" class=\"indexNav\">",
+                "<main role=\"main\">\n"
+                + "<div class=\"indexContainer\">\n"
+                + "<h2 title=\"Modules\">Modules</h2>\n"
+                + "<ul title=\"Modules\">",
+                "<footer role=\"contentinfo\">");
+
+        checkOrder("m1/module-frame.html",
+                "<header role=\"banner\">\n"
+                + "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
+                + "<nav role=\"navigation\" class=\"indexNav\">",
+                "<main role=\"main\">\n"
+                + "<div class=\"indexContainer\">\n"
+                + "<h2 title=\"m1\"><a href=\"module-summary.html\" target=\"classFrame\">m1</a>&nbsp;Packages</h2>",
+                "<footer role=\"contentinfo\">");
+
+        checkOrder("overview-summary.html",
+                "<header role=\"banner\">\n"
+                + "<nav role=\"navigation\">",
+                "<main role=\"main\">\n"
+                + "<div class=\"header\">\n"
+                + "<h1 class=\"title\">Document Title</h1>",
+                "<footer role=\"contentinfo\">\n"
+                + "<nav role=\"navigation\">");
+    }
+
+    @Test
+    public void testModulesHtml4(Path base) throws Exception {
+        Path srcDir = base.resolve("src");
+        createModules(srcDir);
+
+        Path outDir = base.resolve("out2");
+        javadoc("-d", outDir.toString(),
+                "-doctitle", "Document Title",
+                "-header", "Test Header",
+                "--frames",
+                "--module-source-path", srcDir.toString(),
+                "--module", "m1,m2",
+                "-html4");
+
+        checkExit(Exit.OK);
+
+        checkOrder("module-overview-frame.html",
+                "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
+                + "<div class=\"indexNav\">",
+                "<div class=\"indexContainer\">\n"
+                + "<h2 title=\"Modules\">Modules</h2>\n"
+                + "<ul title=\"Modules\">");
+
+        checkOrder("m1/module-frame.html",
+                "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
+                + "<div class=\"indexNav\">",
+                "<div class=\"indexContainer\">\n"
+                + "<h2 title=\"m1\"><a href=\"module-summary.html\" target=\"classFrame\">m1</a>&nbsp;Packages</h2>");
+
+        checkOrder("overview-summary.html",
+                "<div class=\"fixedNav\">",
+                "<div class=\"header\">\n"
+                + "<h1 class=\"title\">Document Title</h1>",
+                "<div class=\"bottomNav\"><a name=\"navbar.bottom\">");
+    }
+
+    @Test
+    public void testPackages(Path base) throws Exception {
+        Path srcDir = base.resolve("src");
+        createPackages(srcDir);
+
+        Path outDir = base.resolve("out3");
+        javadoc("-d", outDir.toString(),
+                "-doctitle", "Document Title",
+                "-header", "Test Header",
+                "--frames",
+                "-sourcepath", srcDir.toString(),
+                "pkg1", "pkg2");
+
+        checkExit(Exit.OK);
+
+        checkOrder("overview-summary.html",
+                "<header role=\"banner\">\n"
+                + "<nav role=\"navigation\">",
+                "<main role=\"main\">\n"
+                + "<div class=\"header\">\n"
+                + "<h1 class=\"title\">Document Title</h1>",
+                "<footer role=\"contentinfo\">\n" +
+                        "<nav role=\"navigation\">");
+
+        checkOrder("overview-frame.html",
+                "<header role=\"banner\">\n"
+                + "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
+                + "<nav role=\"navigation\" class=\"indexNav\">",
+                "<main role=\"main\">\n"
+                + "<div class=\"indexContainer\">\n"
+                + "<h2 title=\"Packages\">Packages</h2>",
+                "<footer role=\"contentinfo\">");
+    }
+
+    @Test
+    public void testPackagesHtml4(Path base) throws Exception {
+        Path srcDir = base.resolve("src");
+        createPackages(srcDir);
+
+        Path outDir = base.resolve("out4");
+        javadoc("-d", outDir.toString(),
+                "-doctitle", "Document Title",
+                "-header", "Test Header",
+                "--frames",
+                "-sourcepath", srcDir.toString(),
+                "pkg1", "pkg2",
+                "-html4");
+
+        checkExit(Exit.OK);
+
+        checkOrder("overview-summary.html",
+                "<div class=\"fixedNav\">",
+                "<div class=\"header\">\n"
+                + "<h1 class=\"title\">Document Title</h1>",
+                "<div class=\"bottomNav\"><a name=\"navbar.bottom\">");
+
+        checkOrder("overview-frame.html",
+                "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
+                + "<div class=\"indexNav\">",
+                "<div class=\"indexContainer\">\n"
+                + "<h2 title=\"Packages\">Packages</h2>"
+        );
+    }
+
+    @Test
+    public void testDocFiles(Path base) throws Exception {
+        Path srcDir = base.resolve("src");
+        createPackages(srcDir);
+        Path docFiles = Files.createDirectory(srcDir.resolve("pkg1").resolve("doc-files"));
+        Files.write(docFiles.resolve("s.html"), List.of(
+                "<html>\n"
+                + "  <head>\n"
+                + "    <title>\"Hello World\"</title>\n"
+                + "  </head>\n"
+                + "  <body>\n"
+                + "     A sample doc file.\n"
+                + "  </body>\n"
+                + "</html>"));
+
+        Path outDir = base.resolve("out5");
+        javadoc("-d", outDir.toString(),
+                "-sourcepath", srcDir.toString(),
+                "pkg1", "pkg2");
+
+        checkExit(Exit.OK);
+
+        checkOrder("pkg1/doc-files/s.html",
+                "<header role=\"banner\">\n"
+                + "<nav role=\"navigation\">\n",
+                "<main role=\"main\">A sample doc file",
+                "<footer role=\"contentinfo\">\n"
+                + "<nav role=\"navigation\">"
+                );
+    }
+
+    void createModules(Path srcDir) throws Exception {
+        new ModuleBuilder(tb, "m1")
+                .classes("package p1; public class a{}")
+                .classes("package p2; public class b{}")
+                .write(srcDir);
+        new ModuleBuilder(tb, "m2")
+                .classes("package p3; public class c{}")
+                .classes("package p4; public class d{}")
+                .write(srcDir);
+    }
+
+    void createPackages(Path srcDir) throws Exception {
+        new ClassBuilder(tb, "pkg1.A")
+                .setModifiers("public", "class")
+                .write(srcDir);
+        new ClassBuilder(tb, "pkg2.B")
+                .setModifiers("public", "class")
+                .write(srcDir);
+    }
+}
--- a/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLankmarkRegions.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,223 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 8210047
- * @summary some pages contains content outside of landmark region
- * @library /tools/lib ../../lib
- * @modules
- *      jdk.javadoc/jdk.javadoc.internal.tool
- *      jdk.compiler/com.sun.tools.javac.api
- *      jdk.compiler/com.sun.tools.javac.main
- * @build javadoc.tester.*
- * @run main TestHtmlLankmarkRegions
- */
-
-
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import builder.ClassBuilder;
-import toolbox.ModuleBuilder;
-import toolbox.ToolBox;
-
-import javadoc.tester.JavadocTester;
-
-public class TestHtmlLankmarkRegions extends JavadocTester {
-
-    final ToolBox tb;
-
-    public static void main(String... args) throws Exception {
-        TestHtmlLankmarkRegions tester = new TestHtmlLankmarkRegions();
-        tester.runTests(m -> new Object[]{Paths.get(m.getName())});
-    }
-
-    TestHtmlLankmarkRegions() {
-        tb = new ToolBox();
-    }
-
-    @Test
-    public void testModules(Path base) throws Exception {
-        Path srcDir = base.resolve("src");
-        createModules(srcDir);
-
-        Path outDir = base.resolve("out");
-        javadoc("-d", outDir.toString(),
-                "-doctitle", "Document Title",
-                "-header", "Test Header",
-                "--frames",
-                "--module-source-path", srcDir.toString(),
-                "--module", "m1,m2");
-
-        checkExit(Exit.OK);
-
-        checkOrder("module-overview-frame.html",
-                "<header role=\"banner\">\n"
-                + "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
-                + "<nav role=\"navigation\" class=\"indexNav\">",
-                "<main role=\"main\">\n"
-                + "<div class=\"indexContainer\">\n"
-                + "<h2 title=\"Modules\">Modules</h2>\n"
-                + "<ul title=\"Modules\">",
-                "<footer role=\"contentinfo\">");
-
-        checkOrder("m1/module-frame.html",
-                "<header role=\"banner\">\n"
-                + "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
-                + "<nav role=\"navigation\" class=\"indexNav\">",
-                "<main role=\"main\">\n"
-                + "<div class=\"indexContainer\">\n"
-                + "<h2 title=\"m1\"><a href=\"module-summary.html\" target=\"classFrame\">m1</a>&nbsp;Packages</h2>",
-                "<footer role=\"contentinfo\">");
-
-        checkOrder("overview-summary.html",
-                "<header role=\"banner\">\n"
-                + "<nav role=\"navigation\">",
-                "<main role=\"main\">\n"
-                + "<div class=\"header\">\n"
-                + "<h1 class=\"title\">Document Title</h1>",
-                "<footer role=\"contentinfo\">\n"
-                + "<nav role=\"navigation\">");
-    }
-
-    @Test
-    public void testModulesHtml4(Path base) throws Exception {
-        Path srcDir = base.resolve("src");
-        createModules(srcDir);
-
-        Path outDir = base.resolve("out2");
-        javadoc("-d", outDir.toString(),
-                "-doctitle", "Document Title",
-                "-header", "Test Header",
-                "--frames",
-                "--module-source-path", srcDir.toString(),
-                "--module", "m1,m2",
-                "-html4");
-
-        checkExit(Exit.OK);
-
-        checkOrder("module-overview-frame.html",
-                "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
-                + "<div class=\"indexNav\">",
-                "<div class=\"indexContainer\">\n"
-                + "<h2 title=\"Modules\">Modules</h2>\n"
-                + "<ul title=\"Modules\">");
-
-        checkOrder("m1/module-frame.html",
-                "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
-                + "<div class=\"indexNav\">",
-                "<div class=\"indexContainer\">\n"
-                + "<h2 title=\"m1\"><a href=\"module-summary.html\" target=\"classFrame\">m1</a>&nbsp;Packages</h2>");
-
-        checkOrder("overview-summary.html",
-                "<div class=\"fixedNav\">",
-                "<div class=\"header\">\n"
-                + "<h1 class=\"title\">Document Title</h1>",
-                "<div class=\"bottomNav\"><a name=\"navbar.bottom\">");
-    }
-
-    @Test
-    public void testPackages(Path base) throws Exception {
-        Path srcDir = base.resolve("src");
-        createPackages(srcDir);
-
-        Path outDir = base.resolve("out3");
-        javadoc("-d", outDir.toString(),
-                "-doctitle", "Document Title",
-                "-header", "Test Header",
-                "--frames",
-                "-sourcepath", srcDir.toString(),
-                "pkg1", "pkg2");
-
-        checkExit(Exit.OK);
-
-        checkOrder("overview-summary.html",
-                "<header role=\"banner\">\n"
-                + "<nav role=\"navigation\">",
-                "<main role=\"main\">\n"
-                + "<div class=\"header\">\n"
-                + "<h1 class=\"title\">Document Title</h1>",
-                "<footer role=\"contentinfo\">\n" +
-                        "<nav role=\"navigation\">");
-
-        checkOrder("overview-frame.html",
-                "<header role=\"banner\">\n"
-                + "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
-                + "<nav role=\"navigation\" class=\"indexNav\">",
-                "<main role=\"main\">\n"
-                + "<div class=\"indexContainer\">\n"
-                + "<h2 title=\"Packages\">Packages</h2>",
-                "<footer role=\"contentinfo\">");
-    }
-
-    @Test
-    public void testPackagesHtml4(Path base) throws Exception {
-        Path srcDir = base.resolve("src");
-        createPackages(srcDir);
-
-        Path outDir = base.resolve("out4");
-        javadoc("-d", outDir.toString(),
-                "-doctitle", "Document Title",
-                "-header", "Test Header",
-                "--frames",
-                "-sourcepath", srcDir.toString(),
-                "pkg1", "pkg2",
-                "-html4");
-
-        checkExit(Exit.OK);
-
-        checkOrder("overview-summary.html",
-                "<div class=\"fixedNav\">",
-                "<div class=\"header\">\n"
-                + "<h1 class=\"title\">Document Title</h1>",
-                "<div class=\"bottomNav\"><a name=\"navbar.bottom\">");
-
-        checkOrder("overview-frame.html",
-                "<h1 title=\"Test Header\" class=\"bar\">Test Header</h1>\n"
-                + "<div class=\"indexNav\">",
-                "<div class=\"indexContainer\">\n"
-                + "<h2 title=\"Packages\">Packages</h2>"
-        );
-    }
-
-    void createModules(Path srcDir) throws Exception {
-        new ModuleBuilder(tb, "m1")
-                .classes("package p1; public class a{}")
-                .classes("package p2; public class b{}")
-                .write(srcDir);
-        new ModuleBuilder(tb, "m2")
-                .classes("package p3; public class c{}")
-                .classes("package p4; public class d{}")
-                .write(srcDir);
-    }
-
-    void createPackages(Path srcDir) throws Exception {
-        new ClassBuilder(tb, "pkg1.A")
-                .setModifiers("public", "class")
-                .write(srcDir);
-        new ClassBuilder(tb, "pkg2.B")
-                .setModifiers("public", "class")
-                .write(srcDir);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOptionWithAutomaticModule.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,157 @@
+/*
+ * 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 8212233
+ * @summary The code being documented uses modules but the packages defined in $URL are in the unnamed module.
+ * @library /tools/lib ../../lib
+ * @modules
+ *      jdk.javadoc/jdk.javadoc.internal.tool
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.main
+ * @build javadoc.tester.* toolbox.JarTask toolbox.JavacTask toolbox.ModuleBuilder toolbox.ToolBox
+ * @run main TestLinkOptionWithAutomaticModule
+ */
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import toolbox.JarTask;
+import toolbox.JavacTask;
+import toolbox.ModuleBuilder;
+import toolbox.ToolBox;
+
+import javadoc.tester.JavadocTester;
+
+public class TestLinkOptionWithAutomaticModule extends JavadocTester {
+
+    public static void main(String... args) throws Exception {
+        TestLinkOptionWithAutomaticModule tester = new TestLinkOptionWithAutomaticModule();
+        tester.runTests(m -> new Object[]{ Path.of(m.getName()) });
+    }
+
+    final ToolBox tb = new ToolBox();
+    private Path libJar;
+    private Path libAPI;
+
+    TestLinkOptionWithAutomaticModule() throws IOException {
+        initLib();
+    }
+
+    private void initLib() throws IOException {
+        // create library: write source, compile it, jar it
+        Path lib = Path.of("lib");
+        Path libSrc = lib.resolve("src");
+        tb.writeJavaFiles(libSrc, "package lib; public class LibClass { }");
+        Path libClasses = Files.createDirectories(lib.resolve("classes"));
+
+        new JavacTask(tb)
+                .outdir(libClasses)
+                .files(tb.findJavaFiles(libSrc))
+                .run()
+                .writeAll();
+
+        libJar = lib.resolve("MyLib.jar");
+        new JarTask(tb, libJar)
+                .baseDir(libClasses)
+                .files(".")
+                .run();
+
+        libAPI = lib.resolve("api");
+        javadoc("-d", libAPI.toString(),
+                "-sourcepath", libSrc.toString(),
+                "lib");
+        checkExit(Exit.OK);
+    }
+
+    @Test
+    public void testLinkUnnamedToAutomaticModule(Path base) throws IOException {
+
+        // create API referring to library
+        Path src = base.resolve("src");
+        tb.writeJavaFiles(src, "package p; public class MyClass extends lib.LibClass { }");
+
+        // run javadoc with library as automatic module
+        Path api = base.resolve("api");
+        javadoc("-d", api.toString(),
+                "-sourcepath", src.toString(),
+                "--add-modules", "MyLib",
+                "--module-path", libJar.toString(),
+                "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(),
+                "p");
+        checkExit(Exit.OK);
+        checkOutput("p/MyClass.html", true,
+                "extends <a href=\"http://myWebsite/lib/LibClass.html?is-external=true\" "
+                + "title=\"class or interface in lib\" class=\"externalLink\">LibClass</a>");
+    }
+
+    @Test
+    public void testLinkNamedToAutomaticModule(Path base) throws IOException {
+
+        // create API referring to library
+        Path src = base.resolve("src");
+        new ModuleBuilder(tb, "my.module")
+                .exports("p")
+                .requires("MyLib")
+                .classes("package p; public class MyClass extends lib.LibClass { }")
+                .write(src);
+
+        // run javadoc with library as automatic module
+        Path api = base.resolve("api");
+        javadoc("-d", api.toString(),
+                "--module-source-path", src.toString(),
+                "--module-path", libJar.toString(),
+                "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(),
+                "--module", "my.module");
+        checkExit(Exit.OK);
+        checkOutput("my.module/p/MyClass.html", true,
+                "extends <a href=\"http://myWebsite/lib/LibClass.html?is-external=true\" "
+                + "title=\"class or interface in lib\" class=\"externalLink\">LibClass</a>");
+    }
+
+    @Test
+    public void testLinkNamedToUnnamedModule(Path base) throws IOException {
+
+        // create API referring to library
+        Path src = base.resolve("src");
+        new ModuleBuilder(tb, "my.module")
+                .exports("p")
+                .classes("package p; public class MyClass extends lib.LibClass { }")
+                .write(src);
+
+        // run javadoc with library as unnamed module
+        Path api = base.resolve("api");
+        javadoc("-d", api.toString(),
+                "--module-source-path", src.toString(),
+                "--add-reads", "my.module=ALL-UNNAMED",
+                "--class-path", libJar.toString(),
+                "-linkoffline", "http://myWebsite", libAPI.toAbsolutePath().toString(),
+                "--module", "my.module");
+        checkExit(Exit.OK);
+        checkOutput("my.module/p/MyClass.html", true,
+                "extends <a href=\"http://myWebsite/lib/LibClass.html?is-external=true\" "
+                + "title=\"class or interface in lib\" class=\"externalLink\">LibClass</a>");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/A11yChecker.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,149 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javadoc.tester;
+
+import java.io.PrintStream;
+import java.nio.file.Path;
+import java.util.Map;
+import java.util.Stack;
+import java.util.function.Function;
+
+/**
+ * A class to check various aspects of accessibility in a set of HTML files.
+ */
+public class A11yChecker extends HtmlChecker {
+
+    private boolean html5;
+
+    private int currLevel;
+    private int headingErrors;
+
+    private boolean inBody;
+    private boolean inNoScript;
+    private Stack<String> regions = new Stack<>();
+    private int regionErrors;
+
+    A11yChecker(PrintStream out, Function<Path,String> fileReader) {
+        super(out, fileReader);
+    }
+
+    int getErrorCount() {
+        return errors;
+    }
+
+    @Override
+    public void report() {
+        if (headingErrors == 0) {
+            out.println("All headings OK");
+        } else {
+            out.println(headingErrors + " bad headings");
+        }
+
+        if (regionErrors == 0) {
+            out.println("All regions OK");
+        } else {
+            out.println(regionErrors + " errors in regions");
+        }
+    }
+
+    @Override
+    public void startFile(Path path) {
+        html5 = false;
+    }
+
+    @Override
+    public void endFile() {
+    }
+
+    @Override
+    public void docType(String doctype) {
+        html5 = doctype.matches("(?i)<\\?doctype\\s+html>");
+    }
+
+    @Override
+    public void startElement(String name, Map<String,String> attrs, boolean selfClosing) {
+        switch (name) {
+            case "body":
+                inBody = true;
+                break;
+
+            case "h1": case "h2": case "h3": case "h4": case "h5": case "h6":
+                checkHeading(name);
+                break;
+
+            case "header": case "footer": case "main": case "nav": case "aside":
+                regions.push(name);
+                break;
+
+            case "noscript":
+                inNoScript = true;
+                break;
+        }
+    }
+
+    @Override
+    public void endElement(String name) {
+        switch (name) {
+            case "body":
+                inBody = false;
+                break;
+
+            case "header": case "footer": case "main": case "nav": case "aside":
+                if (regions.size() > 0 && regions.peek().equals(name)) {
+                    regions.pop();
+                } else {
+                    error(currFile, getLineNumber(), "unmatched tag: " + name);
+                    regionErrors++;
+                }
+                break;
+
+            case "noscript":
+                inNoScript = false;
+                break;
+        }
+
+    }
+
+    private void checkHeading(String h) {
+        int level = Character.digit(h.charAt(1), 10);
+        if (level > currLevel + 1) {
+            headingErrors++;
+            StringBuilder sb = new StringBuilder();
+            String sep = "";
+            for (int i = currLevel + 1; i < level; i++) {
+                sb.append(sep).append("h").append(i);
+                sep = ", ";
+            }
+            error(currFile, getLineNumber(), "missing headings: " + sb);
+        }
+        currLevel = level;
+    }
+
+    @Override
+    public void content(String s) {
+        if (html5 && inBody && !inNoScript && !s.isBlank() && regions.isEmpty()) {
+            error(currFile, getLineNumber(), "content outside of any region");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/HtmlChecker.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,120 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javadoc.tester;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Function;
+
+public abstract class HtmlChecker extends HtmlParser {
+    static final Path currDir = Paths.get(".").toAbsolutePath().normalize();
+
+    protected Path currFile;
+    protected int files;
+    protected int errors;
+
+    HtmlChecker(PrintStream out, Function<Path,String> fileReader) {
+        super(out, fileReader);
+    }
+
+    void checkDirectory(Path dir) throws IOException {
+        checkFiles(List.of(dir), false, Collections.emptySet());
+    }
+
+    void checkFiles(List<Path> files, boolean skipSubdirs, Set<Path> excludeFiles) throws IOException {
+        for (Path file : files) {
+            Files.walkFileTree(file, new SimpleFileVisitor<Path>() {
+                int depth = 0;
+
+                @Override
+                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
+                    if ((skipSubdirs && depth > 0) || excludeFiles.contains(dir)) {
+                        return FileVisitResult.SKIP_SUBTREE;
+                    }
+                    depth++;
+                    return FileVisitResult.CONTINUE;
+                }
+
+                @Override
+                public FileVisitResult visitFile(Path p, BasicFileAttributes attrs) {
+                    if (excludeFiles.contains(p)) {
+                        return FileVisitResult.CONTINUE;
+                    }
+
+                    if (Files.isRegularFile(p) && p.getFileName().toString().endsWith(".html")) {
+                        checkFile(p);
+                    }
+                    return FileVisitResult.CONTINUE;
+                }
+
+                @Override
+                public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException {
+                    depth--;
+                    return super.postVisitDirectory(dir, e);
+                }
+            });
+        }
+    }
+
+    void checkFile(Path file) {
+        try {
+            currFile = file.toAbsolutePath().normalize();
+            read(file);
+            files++;
+        } catch (IOException e) {
+            error(file, 0, e);
+        }
+    }
+
+    abstract void report();
+
+    int getErrorCount() {
+        return errors;
+    }
+
+    @Override
+    protected void error(Path file, int lineNumber, String message) {
+        super.error(relativePath(file), lineNumber, message);
+        errors++;
+    }
+
+    @Override
+    protected void error(Path file, int lineNumber, Throwable t) {
+        super.error(relativePath(file), lineNumber, t);
+        errors++;
+    }
+
+    protected Path relativePath(Path path) {
+        return path.startsWith(currDir) ? currDir.relativize(path) : path;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/HtmlParser.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,411 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javadoc.tester;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.StringReader;
+import java.nio.file.Path;
+import java.util.LinkedHashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.regex.Pattern;
+
+/**
+ * A basic HTML parser. Override the protected methods as needed to get notified
+ * of significant items in any file that is read.
+ */
+public abstract class HtmlParser {
+
+    protected final PrintStream out;
+    protected final Function<Path,String> fileReader;
+
+    private Path file;
+    private StringReader in;
+    private int ch;
+    private int lineNumber;
+    private boolean inScript;
+    private boolean xml;
+
+    HtmlParser(PrintStream out, Function<Path,String> fileReader) {
+        this.out = out;
+        this.fileReader = fileReader;
+    }
+
+    /**
+     * Read a file.
+     * @param file the file to be read
+     * @throws IOException if an error occurs while reading the file
+     */
+    void read(Path file) throws IOException {
+        try (StringReader r = new StringReader(fileReader.apply(file))) {
+            this.file = file;
+            this.in = r;
+            StringBuilder content = new StringBuilder();
+
+            startFile(file);
+            try {
+                lineNumber = 1;
+                xml = false;
+                nextChar();
+
+                while (ch != -1) {
+                    switch (ch) {
+
+                        case '<':
+                            content(content.toString());
+                            content.setLength(0);
+                            html();
+                            break;
+
+                        default:
+                            content.append((char) ch);
+                            if (ch == '\n') {
+                                content(content.toString());
+                                content.setLength(0);
+                            }
+                            nextChar();
+                    }
+                }
+            } finally {
+                endFile();
+            }
+        } catch (IOException e) {
+            error(file, lineNumber, e);
+        } catch (Throwable t) {
+            error(file, lineNumber, t);
+            t.printStackTrace(out);
+        }
+    }
+
+
+    int getLineNumber() {
+        return lineNumber;
+    }
+
+    /**
+     * Called when a file has been opened, before parsing begins.
+     * This is always the first notification when reading a file.
+     * This implementation does nothing.
+     *
+     * @param file the file
+     */
+    protected void startFile(Path file) { }
+
+    /**
+     * Called when the parser has finished reading a file.
+     * This is always the last notification when reading a file,
+     * unless any errors occur while closing the file.
+     * This implementation does nothing.
+     */
+    protected void endFile() { }
+
+    /**
+     * Called when a doctype declaration is found, at the beginning of the file.
+     * This implementation does nothing.
+     * @param s the doctype declaration
+     */
+    protected void docType(String s) { }
+
+    /**
+     * Called when the opening tag of an HTML element is encountered.
+     * This implementation does nothing.
+     * @param name the name of the tag
+     * @param attrs the attribute
+     * @param selfClosing whether or not this is a self-closing tag
+     */
+    protected void startElement(String name, Map<String,String> attrs, boolean selfClosing) { }
+
+    /**
+     * Called when the closing tag of an HTML tag is encountered.
+     * This implementation does nothing.
+     * @param name the name of the tag
+     */
+    protected void endElement(String name) { }
+
+    /**
+     * Called for sequences of character content.
+     * @param content the character content
+     */
+    protected void content(String content) { }
+
+    /**
+     * Called when an error has been encountered.
+     * @param file the file being read
+     * @param lineNumber the line number of line containing the error
+     * @param message a description of the error
+     */
+    protected void error(Path file, int lineNumber, String message) {
+        out.println(file + ":" + lineNumber + ": " + message);
+    }
+
+    /**
+     * Called when an exception has been encountered.
+     * @param file the file being read
+     * @param lineNumber the line number of the line being read when the exception was found
+     * @param t the exception
+     */
+    protected void error(Path file, int lineNumber, Throwable t) {
+        out.println(file + ":" + lineNumber + ": " + t);
+    }
+
+    private void nextChar() throws IOException {
+        ch = in.read();
+        if (ch == '\n')
+            lineNumber++;
+    }
+
+    /**
+     * Read the start or end of an HTML tag, or an HTML comment
+     * {@literal <identifier attrs> } or {@literal </identifier> }
+     * @throws java.io.IOException if there is a problem reading the file
+     */
+    private void html() throws IOException {
+        nextChar();
+        if (isIdentifierStart((char) ch)) {
+            String name = readIdentifier().toLowerCase(Locale.US);
+            Map<String,String> attrs = htmlAttrs();
+            if (attrs != null) {
+                boolean selfClosing = false;
+                if (ch == '/') {
+                    nextChar();
+                    selfClosing = true;
+                }
+                if (ch == '>') {
+                    nextChar();
+                    startElement(name, attrs, selfClosing);
+                    if (name.equals("script")) {
+                        inScript = true;
+                    }
+                    return;
+                }
+            }
+        } else if (ch == '/') {
+            nextChar();
+            if (isIdentifierStart((char) ch)) {
+                String name = readIdentifier().toLowerCase(Locale.US);
+                skipWhitespace();
+                if (ch == '>') {
+                    nextChar();
+                    endElement(name);
+                    if (name.equals("script")) {
+                        inScript = false;
+                    }
+                    return;
+                }
+            }
+        } else if (ch == '!') {
+            nextChar();
+            if (ch == '-') {
+                nextChar();
+                if (ch == '-') {
+                    nextChar();
+                    while (ch != -1) {
+                        int dash = 0;
+                        while (ch == '-') {
+                            dash++;
+                            nextChar();
+                        }
+                        // Strictly speaking, a comment should not contain "--"
+                        // so dash > 2 is an error, dash == 2 implies ch == '>'
+                        // See http://www.w3.org/TR/html-markup/syntax.html#syntax-comments
+                        // for more details.
+                        if (dash >= 2 && ch == '>') {
+                            nextChar();
+                            return;
+                        }
+
+                        nextChar();
+                    }
+                }
+            } else if (ch == '[') {
+                nextChar();
+                if (ch == 'C') {
+                    nextChar();
+                    if (ch == 'D') {
+                        nextChar();
+                        if (ch == 'A') {
+                            nextChar();
+                            if (ch == 'T') {
+                                nextChar();
+                                if (ch == 'A') {
+                                    nextChar();
+                                    if (ch == '[') {
+                                        while (true) {
+                                            nextChar();
+                                            if (ch == ']') {
+                                                nextChar();
+                                                if (ch == ']') {
+                                                    nextChar();
+                                                    if (ch == '>') {
+                                                        nextChar();
+                                                        return;
+                                                    }
+                                                }
+                                            }
+                                        }
+
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            } else {
+                StringBuilder sb = new StringBuilder();
+                while (ch != -1 && ch != '>') {
+                    sb.append((char) ch);
+                    nextChar();
+                }
+                Pattern p = Pattern.compile("(?is)doctype\\s+html\\s?.*");
+                String s = sb.toString();
+                if (p.matcher(s).matches()) {
+                    docType(s);
+                    return;
+                }
+            }
+        } else if (ch == '?') {
+            nextChar();
+            if (ch == 'x') {
+                nextChar();
+                if (ch == 'm') {
+                    nextChar();
+                    if (ch == 'l') {
+                        Map<String,String> attrs = htmlAttrs();
+                        if (ch == '?') {
+                            nextChar();
+                            if (ch == '>') {
+                                nextChar();
+                                xml = true;
+                                return;
+                            }
+                        }
+                    }
+                }
+
+            }
+        }
+
+        if (!inScript) {
+            error(file, lineNumber, "bad html");
+        }
+    }
+
+    /**
+     * Read a series of HTML attributes, terminated by {@literal > }.
+     * Each attribute is of the form {@literal identifier[=value] }.
+     * "value" may be unquoted, single-quoted, or double-quoted.
+     */
+    private Map<String,String> htmlAttrs() throws IOException {
+        Map<String, String> map = new LinkedHashMap<>();
+        skipWhitespace();
+
+        loop:
+        while (isIdentifierStart((char) ch)) {
+            String name = readAttributeName().toLowerCase(Locale.US);
+            skipWhitespace();
+            String value = null;
+            if (ch == '=') {
+                nextChar();
+                skipWhitespace();
+                if (ch == '\'' || ch == '"') {
+                    char quote = (char) ch;
+                    nextChar();
+                    StringBuilder sb = new StringBuilder();
+                    while (ch != -1 && ch != quote) {
+                        sb.append((char) ch);
+                        nextChar();
+                    }
+                    value = sb.toString() // hack to replace common entities
+                            .replace("&lt;", "<")
+                            .replace("&gt;", ">")
+                            .replace("&amp;", "&");
+                    nextChar();
+                } else {
+                    StringBuilder sb = new StringBuilder();
+                    while (ch != -1 && !isUnquotedAttrValueTerminator((char) ch)) {
+                        sb.append((char) ch);
+                        nextChar();
+                    }
+                    value = sb.toString();
+                }
+                skipWhitespace();
+            }
+            map.put(name, value);
+        }
+
+        return map;
+    }
+
+    private boolean isIdentifierStart(char ch) {
+        return Character.isUnicodeIdentifierStart(ch);
+    }
+
+    private String readIdentifier() throws IOException {
+        StringBuilder sb = new StringBuilder();
+        sb.append((char) ch);
+        nextChar();
+        while (ch != -1 && Character.isUnicodeIdentifierPart(ch)) {
+            sb.append((char) ch);
+            nextChar();
+        }
+        return sb.toString();
+    }
+
+    private String readAttributeName() throws IOException {
+        StringBuilder sb = new StringBuilder();
+        sb.append((char) ch);
+        nextChar();
+        while (ch != -1 && Character.isUnicodeIdentifierPart(ch)
+                || ch == '-'
+                || xml && ch == ':') {
+            sb.append((char) ch);
+            nextChar();
+        }
+        return sb.toString();
+    }
+
+    private boolean isWhitespace(char ch) {
+        return Character.isWhitespace(ch);
+    }
+
+    private void skipWhitespace() throws IOException {
+        while (isWhitespace((char) ch)) {
+            nextChar();
+        }
+    }
+
+    private boolean isUnquotedAttrValueTerminator(char ch) {
+        switch (ch) {
+            case '\f': case '\n': case '\r': case '\t':
+            case ' ':
+            case '"': case '\'': case '`':
+            case '=': case '<': case '>':
+                return true;
+            default:
+                return false;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/LinkChecker.java	Wed Jan 23 21:11:23 2019 +0100
@@ -0,0 +1,424 @@
+/*
+ * 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javadoc.tester;
+
+import java.io.PrintStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * A class to check the links in a set of HTML files.
+ */
+public class LinkChecker extends HtmlChecker {
+
+    private final Map<Path, IDTable> allFiles;
+    private final Map<URI, IDTable> allURIs;
+
+    private int links;
+    private int duplicateIds;
+    private int missingIds;
+
+    private IDTable currTable;
+    private boolean html5;
+
+    LinkChecker(PrintStream out, Function<Path,String> fileReader) {
+        super(out, fileReader);
+        allFiles = new HashMap<>();
+        allURIs = new HashMap<>();
+    }
+
+    @Override
+    public void report() {
+        List<Path> missingFiles = getMissingFiles();
+        if (!missingFiles.isEmpty()) {
+            report("Missing files: (" + missingFiles.size() + ")");
+            missingFiles.stream()
+                    .sorted()
+                    .forEach(this::reportMissingFile);
+            errors += missingFiles.size();
+        }
+
+        if (!allURIs.isEmpty()) {
+            report(false, "External URLs:");
+            allURIs.keySet().stream()
+                    .sorted(new URIComparator())
+                    .forEach(uri -> report(false, "  %s", uri.toString()));
+        }
+
+        int anchors = 0;
+        for (IDTable t : allFiles.values()) {
+            anchors += t.map.values().stream()
+                    .filter(e -> !e.getReferences().isEmpty())
+                    .count();
+        }
+        for (IDTable t : allURIs.values()) {
+            anchors += t.map.values().stream()
+                    .filter(e -> !e.references.isEmpty())
+                    .count();
+        }
+
+        report(false, "Checked " + files + " files.");
+        report(false, "Found " + links + " references to " + anchors + " anchors "
+                + "in " + allFiles.size() + " files and " + allURIs.size() + " other URIs.");
+        report(!missingFiles.isEmpty(),   "%6d missing files", missingFiles.size());
+        report(duplicateIds > 0, "%6d duplicate ids", duplicateIds);
+        report(missingIds > 0,   "%6d missing ids", missingIds);
+
+        Map<String, Integer> schemeCounts = new TreeMap<>();
+        Map<String, Integer> hostCounts = new TreeMap<>(new HostComparator());
+        for (URI uri : allURIs.keySet()) {
+            String scheme = uri.getScheme();
+            if (scheme != null) {
+                schemeCounts.put(scheme, schemeCounts.computeIfAbsent(scheme, s -> 0) + 1);
+            }
+            String host = uri.getHost();
+            if (host != null) {
+                hostCounts.put(host, hostCounts.computeIfAbsent(host, h -> 0) + 1);
+            }
+        }
+
+        if (schemeCounts.size() > 0) {
+            report(false, "Schemes");
+            schemeCounts.forEach((s, n) -> report(!isSchemeOK(s), "%6d %s", n, s));
+        }
+
+        if (hostCounts.size() > 0) {
+            report(false, "Hosts");
+            hostCounts.forEach((h, n) -> report(false, "%6d %s", n, h));
+        }
+    }
+
+    private void report(String message, Object... args) {
+        out.println(String.format(message, args));
+    }
+
+    private void report(boolean highlight, String message, Object... args) {
+        out.print(highlight ? "* " : "  ");
+        out.println(String.format(message, args));
+    }
+
+    private void reportMissingFile(Path file) {
+        report("%s", relativePath(file));
+        IDTable table = allFiles.get(file);
+        Set<Path> refs = new TreeSet<>();
+        for (ID id : table.map.values()) {
+            if (id.references != null) {
+                for (Position p : id.references) {
+                    refs.add(p.path);
+                }
+            }
+        }
+        int n = 0;
+        int MAX_REFS = 10;
+        for (Path ref : refs) {
+            report("    in " + relativePath(ref));
+            if (++n == MAX_REFS) {
+                report("    ... and %d more", refs.size() - n);
+                break;
+            }
+        }
+    }
+
+    @Override
+    public void startFile(Path path) {
+        currTable = allFiles.computeIfAbsent(currFile, p -> new IDTable(p));
+        html5 = false;
+    }
+
+    @Override
+    public void endFile() {
+        currTable.check();
+    }
+
+    @Override
+    public void docType(String doctype) {
+        html5 = doctype.matches("(?i)<\\?doctype\\s+html>");
+    }
+
+    @Override @SuppressWarnings("fallthrough")
+    public void startElement(String name, Map<String, String> attrs, boolean selfClosing) {
+        int line = getLineNumber();
+        switch (name) {
+            case "a":
+                String nameAttr = html5 ? null : attrs.get("name");
+                if (nameAttr != null) {
+                    foundAnchor(line, nameAttr);
+                }
+                // fallthrough
+            case "link":
+                String href = attrs.get("href");
+                if (href != null) {
+                    foundReference(line, href);
+                }
+                break;
+        }
+
+        String idAttr = attrs.get("id");
+        if (idAttr != null) {
+            foundAnchor(line, idAttr);
+        }
+    }
+
+    @Override
+    public void endElement(String name) { }
+
+    private void foundAnchor(int line, String name) {
+        currTable.addID(line, name);
+    }
+
+    private void foundReference(int line, String ref) {
+        links++;
+        try {
+            URI uri = new URI(ref);
+            if (uri.isAbsolute()) {
+                foundReference(line, uri);
+            } else {
+                Path p;
+                String uriPath = uri.getPath();
+                if (uriPath == null || uriPath.isEmpty()) {
+                    p = currFile;
+                } else {
+                    p = currFile.getParent().resolve(uriPath).normalize();
+                }
+                foundReference(line, p, uri.getFragment());
+            }
+        } catch (URISyntaxException e) {
+            error(currFile, line, "invalid URI: " + e);
+        }
+    }
+
+    private void foundReference(int line, Path p, String fragment) {
+        IDTable t = allFiles.computeIfAbsent(p, key -> new IDTable(key));
+        t.addReference(fragment, currFile, line);
+    }
+
+    private void foundReference(int line, URI uri) {
+        if (!isSchemeOK(uri.getScheme())) {
+            error(currFile, line, "bad scheme in URI");
+        }
+
+        String fragment = uri.getFragment();
+        try {
+            URI noFrag = new URI(uri.toString().replaceAll("#\\Q" + fragment + "\\E$", ""));
+            IDTable t = allURIs.computeIfAbsent(noFrag, key -> new IDTable(key.toString()));
+            t.addReference(fragment, currFile, line);
+        } catch (URISyntaxException e) {
+            throw new Error(e);
+        }
+    }
+
+    private boolean isSchemeOK(String uriScheme) {
+        if (uriScheme == null) {
+            return true;
+        }
+
+        switch (uriScheme) {
+            case "file":
+            case "ftp":
+            case "http":
+            case "https":
+            case "javascript":
+            case "mailto":
+                return true;
+
+            default:
+                return false;
+        }
+    }
+
+    private List<Path> getMissingFiles() {
+        return allFiles.entrySet().stream()
+                .filter(e -> !Files.exists(e.getKey()))
+                .map(e -> e.getKey())
+                .collect(Collectors.toList());
+    }
+
+    /**
+     * A position in a file, as identified by a file name and line number.
+     */
+    static class Position implements Comparable<Position> {
+        Path path;
+        int line;
+
+        Position(Path path, int line) {
+            this.path = path;
+            this.line = line;
+        }
+
+        @Override
+        public int compareTo(Position o) {
+            int v = path.compareTo(o.path);
+            return v != 0 ? v : Integer.compare(line, o.line);
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            } else if (obj == null || getClass() != obj.getClass()) {
+                return false;
+            } else {
+                final Position other = (Position) obj;
+                return Objects.equals(this.path, other.path)
+                        && this.line == other.line;
+            }
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hashCode(path) * 37 + line;
+        }
+    }
+
+    /**
+     * Infor for an ID within an HTML file, and a set of positions that reference it.
+     */
+    static class ID {
+        boolean declared;
+        Set<Position> references;
+
+        Set<Position> getReferences() {
+            return (references) == null ? Collections.emptySet() : references;
+        }
+    }
+
+    /**
+     * A table for the set of IDs in an HTML file.
+     */
+    class IDTable {
+        private String name;
+        private boolean checked;
+        private final Map<String, ID> map = new HashMap<>();
+
+        IDTable(Path p) {
+            this(relativePath(p).toString());
+        }
+
+        IDTable(String name) {
+            this.name = name;
+        }
+
+        void addID(int line, String name) {
+            if (checked) {
+                throw new IllegalStateException("Adding ID after file has been read");
+            }
+            Objects.requireNonNull(name);
+            ID id = map.computeIfAbsent(name, x -> new ID());
+            if (id.declared) {
+                error(currFile, line, "name already declared: " + name);
+                duplicateIds++;
+            } else {
+                id.declared = true;
+            }
+        }
+
+        void addReference(String name, Path from, int line) {
+            if (checked) {
+                if (name != null) {
+                    ID id = map.get(name);
+                    if (id == null || !id.declared) {
+                        error(from, line, "id not found: " + this.name + "#" + name);
+                    }
+                }
+            } else {
+                ID id = map.computeIfAbsent(name, x -> new ID());
+                if (id.references == null) {
+                    id.references = new TreeSet<>();
+                }
+                id.references.add(new Position(from, line));
+            }
+        }
+
+        void check() {
+            map.forEach((name, id) -> {
+                if (name != null && !id.declared) {
+                    //log.error(currFile, 0, "id not declared: " + name);
+                    for (Position ref : id.references) {
+                        error(ref.path, ref.line, "id not found: " + this.name + "#" + name);
+                    }
+                    missingIds++;
+                }
+            });
+            checked = true;
+        }
+    }
+
+    static class URIComparator implements Comparator<URI> {
+        final HostComparator hostComparator = new HostComparator();
+
+        @Override
+        public int compare(URI o1, URI o2) {
+            if (o1.isOpaque() || o2.isOpaque()) {
+                return o1.compareTo(o2);
+            }
+            String h1 = o1.getHost();
+            String h2 = o2.getHost();
+            String s1 = o1.getScheme();
+            String s2 = o2.getScheme();
+            if (h1 == null || h1.isEmpty() || s1 == null || s1.isEmpty()
+                    || h2 == null || h2.isEmpty() || s2 == null || s2.isEmpty()) {
+                return o1.compareTo(o2);
+            }
+            int v = hostComparator.compare(h1, h2);
+            if (v != 0) {
+                return v;
+            }
+            v = s1.compareTo(s2);
+            if (v != 0) {
+                return v;
+            }
+            return o1.compareTo(o2);
+        }
+    }
+
+    static class HostComparator implements Comparator<String> {
+        @Override
+        public int compare(String h1, String h2) {
+            List<String> l1 = new ArrayList<>(Arrays.asList(h1.split("\\.")));
+            Collections.reverse(l1);
+            String r1 = String.join(".", l1);
+            List<String> l2 = new ArrayList<>(Arrays.asList(h2.split("\\.")));
+            Collections.reverse(l2);
+            String r2 = String.join(".", l2);
+            return r1.compareTo(r2);
+        }
+    }
+
+}
--- a/test/langtools/tools/javac/RawStringLiteralLang.java	Wed Jan 23 16:09:20 2019 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 Unit tests for Raw String Literal language changes
- * @compile --enable-preview -source 13 -encoding utf8 RawStringLiteralLang.java
- * @run main/othervm --enable-preview RawStringLiteralLang
- */
-
-public class RawStringLiteralLang {
-    public static void main(String... args) {
-        test1();
-        test2();
-    }
-
-    /*
-     * Test raw string functionality.
-     */
-    static void test1() {
-        EQ(`abc`, "abc");
-        EQ(`can't`, "can\'t");
-        EQ(``can`t``, "can`t");
-        EQ(`can\\'t`, "can\\\\'t");
-        EQ(``can\\`t``, "can\\\\`t");
-        EQ(`\t`, "\\t");
-        EQ(`•`, "\u2022");
-
-        LENGTH("abc``def", 8);
-        EQ("abc`\u0020`def", "abc` `def");
-    }
-
-    /*
-     * Test multi-line string functionality.
-     */