Merge JDK-8200758-branch
authorherrick
Fri, 21 Dec 2018 07:46:58 -0500
branchJDK-8200758-branch
changeset 57092 3c5666ad2181
parent 57091 06bc4bd64599 (current diff)
parent 53093 587a1d480ca6 (diff)
child 57095 1e18c850b591
Merge
src/hotspot/share/runtime/arguments_ext.hpp
src/hotspot/share/services/diagnosticCommand_ext.hpp
test/jdk/java/net/MulticastSocket/PromiscuousIPv6.java
test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java
--- a/.hgtags	Fri Dec 21 07:40:47 2018 -0500
+++ b/.hgtags	Fri Dec 21 07:46:58 2018 -0500
@@ -527,3 +527,6 @@
 732bec44c89e8b93a38296bf690f97b7230c5b6d jdk-12+22
 eef755718cb24813031a842bbfc716a6cea18e9a jdk-12+23
 cc4098b3bc10d1c390384289025fea7b0d4b9e93 jdk-13+0
+7d4397b43fa305806160785a4c7210600d59581a jdk-12+24
+11033c4ada542f9c9a873314b6ecf60af19e8256 jdk-13+1
+7496df94b3b79f3da53925d2d137317715f11d97 jdk-12+25
--- a/make/Docs.gmk	Fri Dec 21 07:40:47 2018 -0500
+++ b/make/Docs.gmk	Fri Dec 21 07:46:58 2018 -0500
@@ -517,7 +517,7 @@
   ) \
 )
 
-ifneq ($(PANDOC), )
+ifeq ($(ENABLE_PANDOC), true)
   # For all markdown files in $module/share/specs directories, convert them to
   # html, if we have pandoc (otherwise we'll just skip this).
 
--- a/make/autoconf/basics.m4	Fri Dec 21 07:40:47 2018 -0500
+++ b/make/autoconf/basics.m4	Fri Dec 21 07:46:58 2018 -0500
@@ -610,7 +610,14 @@
   BASIC_PATH_PROGS(DF, df)
   BASIC_PATH_PROGS(CPIO, [cpio bsdcpio])
   BASIC_PATH_PROGS(NICE, nice)
+
   BASIC_PATH_PROGS(PANDOC, pandoc)
+  if test -n "$PANDOC"; then
+    ENABLE_PANDOC="true"
+  else
+    ENABLE_PANDOC="false"
+  fi
+  AC_SUBST(ENABLE_PANDOC)
 ])
 
 ###############################################################################
--- a/make/autoconf/flags-cflags.m4	Fri Dec 21 07:40:47 2018 -0500
+++ b/make/autoconf/flags-cflags.m4	Fri Dec 21 07:46:58 2018 -0500
@@ -559,7 +559,7 @@
     TOOLCHAIN_CFLAGS="-errshort=tags"
 
     TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS"
-    TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
+    TOOLCHAIN_CFLAGS_JDK_CONLY="-xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
     TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
     TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
         -library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
--- a/make/autoconf/spec.gmk.in	Fri Dec 21 07:40:47 2018 -0500
+++ b/make/autoconf/spec.gmk.in	Fri Dec 21 07:46:58 2018 -0500
@@ -761,6 +761,7 @@
 MSVCP_DLL:=@MSVCP_DLL@
 UCRT_DLL_DIR:=@UCRT_DLL_DIR@
 STLPORT_LIB:=@STLPORT_LIB@
+ENABLE_PANDOC:=@ENABLE_PANDOC@
 
 ####################################################
 #
--- a/make/launcher/LauncherCommon.gmk	Fri Dec 21 07:40:47 2018 -0500
+++ b/make/launcher/LauncherCommon.gmk	Fri Dec 21 07:46:58 2018 -0500
@@ -203,7 +203,7 @@
 
   ifneq ($(MAN_FILES_MD), )
     # If we got markdown files, ignore the troff files
-    ifeq ($(PANDOC), )
+    ifeq ($(ENABLE_PANDOC), false)
       $(info Warning: pandoc not found. Not generating man pages)
     else
       # Create dynamic man pages from markdown using pandoc. We need
--- a/make/nb_native/nbproject/configurations.xml	Fri Dec 21 07:40:47 2018 -0500
+++ b/make/nb_native/nbproject/configurations.xml	Fri Dec 21 07:46:58 2018 -0500
@@ -2538,7 +2538,6 @@
               <in>arguments.cpp</in>
               <in>arguments.hpp</in>
               <in>arguments_ext.cpp</in>
-              <in>arguments_ext.hpp</in>
               <in>atomic.hpp</in>
               <in>basicLock.cpp</in>
               <in>basicLock.hpp</in>
@@ -2702,7 +2701,6 @@
               <in>diagnosticArgument.hpp</in>
               <in>diagnosticCommand.cpp</in>
               <in>diagnosticCommand.hpp</in>
-              <in>diagnosticCommand_ext.hpp</in>
               <in>diagnosticFramework.cpp</in>
               <in>diagnosticFramework.hpp</in>
               <in>dtraceAttacher.cpp</in>
@@ -13687,11 +13685,6 @@
             tool="1"
             flavor2="0">
       </item>
-      <item path="../../src/hotspot/share/runtime/arguments_ext.hpp"
-            ex="false"
-            tool="3"
-            flavor2="0">
-      </item>
       <item path="../../src/hotspot/share/runtime/atomic.hpp"
             ex="false"
             tool="3"
@@ -14497,11 +14490,6 @@
             tool="3"
             flavor2="0">
       </item>
-      <item path="../../src/hotspot/share/services/diagnosticCommand_ext.hpp"
-            ex="false"
-            tool="3"
-            flavor2="0">
-      </item>
       <item path="../../src/hotspot/share/services/diagnosticFramework.cpp"
             ex="false"
             tool="1"
@@ -27454,11 +27442,6 @@
             tool="1"
             flavor2="0">
       </item>
-      <item path="../../src/hotspot/share/runtime/arguments_ext.hpp"
-            ex="false"
-            tool="3"
-            flavor2="0">
-      </item>
       <item path="../../src/hotspot/share/runtime/atomic.hpp"
             ex="false"
             tool="3"
@@ -28264,11 +28247,6 @@
             tool="3"
             flavor2="0">
       </item>
-      <item path="../../src/hotspot/share/services/diagnosticCommand_ext.hpp"
-            ex="false"
-            tool="3"
-            flavor2="0">
-      </item>
       <item path="../../src/hotspot/share/services/diagnosticFramework.cpp"
             ex="false"
             tool="1"
--- a/src/hotspot/cpu/aarch64/aarch64.ad	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/aarch64/aarch64.ad	Fri Dec 21 07:46:58 2018 -0500
@@ -2133,7 +2133,12 @@
 }
 
 const uint Matcher::vector_shift_count_ideal_reg(int size) {
-  return Op_VecX;
+  switch(size) {
+    case  8: return Op_VecD;
+    case 16: return Op_VecX;
+  }
+  ShouldNotReachHere();
+  return 0;
 }
 
 // AES support not yet implemented
@@ -12601,6 +12606,63 @@
 %}
 
 
+// Math.max(FF)F
+instruct maxF_reg_reg(vRegF dst, vRegF src1, vRegF src2) %{
+  match(Set dst (MaxF src1 src2));
+
+  format %{ "fmaxs   $dst, $src1, $src2" %}
+  ins_encode %{
+    __ fmaxs(as_FloatRegister($dst$$reg),
+             as_FloatRegister($src1$$reg),
+             as_FloatRegister($src2$$reg));
+  %}
+
+  ins_pipe(fp_dop_reg_reg_s);
+%}
+
+// Math.min(FF)F
+instruct minF_reg_reg(vRegF dst, vRegF src1, vRegF src2) %{
+  match(Set dst (MinF src1 src2));
+
+  format %{ "fmins   $dst, $src1, $src2" %}
+  ins_encode %{
+    __ fmins(as_FloatRegister($dst$$reg),
+             as_FloatRegister($src1$$reg),
+             as_FloatRegister($src2$$reg));
+  %}
+
+  ins_pipe(fp_dop_reg_reg_s);
+%}
+
+// Math.max(DD)D
+instruct maxD_reg_reg(vRegD dst, vRegD src1, vRegD src2) %{
+  match(Set dst (MaxD src1 src2));
+
+  format %{ "fmaxd   $dst, $src1, $src2" %}
+  ins_encode %{
+    __ fmaxd(as_FloatRegister($dst$$reg),
+             as_FloatRegister($src1$$reg),
+             as_FloatRegister($src2$$reg));
+  %}
+
+  ins_pipe(fp_dop_reg_reg_d);
+%}
+
+// Math.min(DD)D
+instruct minD_reg_reg(vRegD dst, vRegD src1, vRegD src2) %{
+  match(Set dst (MinD src1 src2));
+
+  format %{ "fmind   $dst, $src1, $src2" %}
+  ins_encode %{
+    __ fmind(as_FloatRegister($dst$$reg),
+             as_FloatRegister($src1$$reg),
+             as_FloatRegister($src2$$reg));
+  %}
+
+  ins_pipe(fp_dop_reg_reg_d);
+%}
+
+
 instruct divF_reg_reg(vRegF dst, vRegF src1, vRegF src2) %{
   match(Set dst (DivF src1  src2));
 
@@ -16524,32 +16586,32 @@
 %}
 
 // ------------------------------ Shift ---------------------------------------
-
-instruct vshiftcntL(vecX dst, iRegIorL2I cnt) %{
+instruct vshiftcnt8B(vecD dst, iRegIorL2I cnt) %{
+  predicate(n->as_Vector()->length_in_bytes() == 8);
   match(Set dst (LShiftCntV cnt));
-  format %{ "dup  $dst, $cnt\t# shift count (vecX)" %}
+  match(Set dst (RShiftCntV cnt));
+  format %{ "dup  $dst, $cnt\t# shift count vector (8B)" %}
+  ins_encode %{
+    __ dup(as_FloatRegister($dst$$reg), __ T8B, as_Register($cnt$$reg));
+  %}
+  ins_pipe(vdup_reg_reg64);
+%}
+
+instruct vshiftcnt16B(vecX dst, iRegIorL2I cnt) %{
+  predicate(n->as_Vector()->length_in_bytes() == 16);
+  match(Set dst (LShiftCntV cnt));
+  match(Set dst (RShiftCntV cnt));
+  format %{ "dup  $dst, $cnt\t# shift count vector (16B)" %}
   ins_encode %{
     __ dup(as_FloatRegister($dst$$reg), __ T16B, as_Register($cnt$$reg));
   %}
   ins_pipe(vdup_reg_reg128);
 %}
 
-// Right shifts on aarch64 SIMD are implemented as left shift by -ve amount
-instruct vshiftcntR(vecX dst, iRegIorL2I cnt) %{
-  match(Set dst (RShiftCntV cnt));
-  format %{ "dup  $dst, $cnt\t# shift count (vecX)\n\tneg  $dst, $dst\t T16B" %}
-  ins_encode %{
-    __ dup(as_FloatRegister($dst$$reg), __ T16B, as_Register($cnt$$reg));
-    __ negr(as_FloatRegister($dst$$reg), __ T16B, as_FloatRegister($dst$$reg));
-  %}
-  ins_pipe(vdup_reg_reg128);
-%}
-
-instruct vsll8B(vecD dst, vecD src, vecX shift) %{
+instruct vsll8B(vecD dst, vecD src, vecD shift) %{
   predicate(n->as_Vector()->length() == 4 ||
             n->as_Vector()->length() == 8);
   match(Set dst (LShiftVB src shift));
-  match(Set dst (RShiftVB src shift));
   ins_cost(INSN_COST);
   format %{ "sshl  $dst,$src,$shift\t# vector (8B)" %}
   ins_encode %{
@@ -16563,7 +16625,6 @@
 instruct vsll16B(vecX dst, vecX src, vecX shift) %{
   predicate(n->as_Vector()->length() == 16);
   match(Set dst (LShiftVB src shift));
-  match(Set dst (RShiftVB src shift));
   ins_cost(INSN_COST);
   format %{ "sshl  $dst,$src,$shift\t# vector (16B)" %}
   ins_encode %{
@@ -16574,29 +16635,93 @@
   ins_pipe(vshift128);
 %}
 
-instruct vsrl8B(vecD dst, vecD src, vecX shift) %{
+// Right shifts with vector shift count on aarch64 SIMD are implemented
+// as left shift by negative shift count.
+// There are two cases for vector shift count.
+//
+// Case 1: The vector shift count is from replication.
+//        |            |
+//    LoadVector  RShiftCntV
+//        |       /
+//     RShiftVI
+// Note: In inner loop, multiple neg instructions are used, which can be
+// moved to outer loop and merge into one neg instruction.
+//
+// Case 2: The vector shift count is from loading.
+// This case isn't supported by middle-end now. But it's supported by
+// panama/vectorIntrinsics(JEP 338: Vector API).
+//        |            |
+//    LoadVector  LoadVector
+//        |       /
+//     RShiftVI
+//
+
+instruct vsra8B(vecD dst, vecD src, vecD shift, vecD tmp) %{
+  predicate(n->as_Vector()->length() == 4 ||
+            n->as_Vector()->length() == 8);
+  match(Set dst (RShiftVB src shift));
+  ins_cost(INSN_COST);
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "sshl  $dst,$src,$tmp\t# vector (8B)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T8B,
+            as_FloatRegister($shift$$reg));
+    __ sshl(as_FloatRegister($dst$$reg), __ T8B,
+            as_FloatRegister($src$$reg),
+            as_FloatRegister($tmp$$reg));
+  %}
+  ins_pipe(vshift64);
+%}
+
+instruct vsra16B(vecX dst, vecX src, vecX shift, vecX tmp) %{
+  predicate(n->as_Vector()->length() == 16);
+  match(Set dst (RShiftVB src shift));
+  ins_cost(INSN_COST);
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "sshl  $dst,$src,$tmp\t# vector (16B)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T16B,
+            as_FloatRegister($shift$$reg));
+    __ sshl(as_FloatRegister($dst$$reg), __ T16B,
+            as_FloatRegister($src$$reg),
+            as_FloatRegister($tmp$$reg));
+  %}
+  ins_pipe(vshift128);
+%}
+
+instruct vsrl8B(vecD dst, vecD src, vecD shift, vecD tmp) %{
   predicate(n->as_Vector()->length() == 4 ||
             n->as_Vector()->length() == 8);
   match(Set dst (URShiftVB src shift));
   ins_cost(INSN_COST);
-  format %{ "ushl  $dst,$src,$shift\t# vector (8B)" %}
-  ins_encode %{
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "ushl  $dst,$src,$tmp\t# vector (8B)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T8B,
+            as_FloatRegister($shift$$reg));
     __ ushl(as_FloatRegister($dst$$reg), __ T8B,
             as_FloatRegister($src$$reg),
-            as_FloatRegister($shift$$reg));
+            as_FloatRegister($tmp$$reg));
   %}
   ins_pipe(vshift64);
 %}
 
-instruct vsrl16B(vecX dst, vecX src, vecX shift) %{
+instruct vsrl16B(vecX dst, vecX src, vecX shift, vecX tmp) %{
   predicate(n->as_Vector()->length() == 16);
   match(Set dst (URShiftVB src shift));
   ins_cost(INSN_COST);
-  format %{ "ushl  $dst,$src,$shift\t# vector (16B)" %}
-  ins_encode %{
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "ushl  $dst,$src,$tmp\t# vector (16B)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T16B,
+            as_FloatRegister($shift$$reg));
     __ ushl(as_FloatRegister($dst$$reg), __ T16B,
             as_FloatRegister($src$$reg),
-            as_FloatRegister($shift$$reg));
+            as_FloatRegister($tmp$$reg));
   %}
   ins_pipe(vshift128);
 %}
@@ -16708,11 +16833,10 @@
   ins_pipe(vshift128_imm);
 %}
 
-instruct vsll4S(vecD dst, vecD src, vecX shift) %{
+instruct vsll4S(vecD dst, vecD src, vecD shift) %{
   predicate(n->as_Vector()->length() == 2 ||
             n->as_Vector()->length() == 4);
   match(Set dst (LShiftVS src shift));
-  match(Set dst (RShiftVS src shift));
   ins_cost(INSN_COST);
   format %{ "sshl  $dst,$src,$shift\t# vector (4H)" %}
   ins_encode %{
@@ -16726,7 +16850,6 @@
 instruct vsll8S(vecX dst, vecX src, vecX shift) %{
   predicate(n->as_Vector()->length() == 8);
   match(Set dst (LShiftVS src shift));
-  match(Set dst (RShiftVS src shift));
   ins_cost(INSN_COST);
   format %{ "sshl  $dst,$src,$shift\t# vector (8H)" %}
   ins_encode %{
@@ -16737,29 +16860,72 @@
   ins_pipe(vshift128);
 %}
 
-instruct vsrl4S(vecD dst, vecD src, vecX shift) %{
+instruct vsra4S(vecD dst, vecD src, vecD shift, vecD tmp) %{
+  predicate(n->as_Vector()->length() == 2 ||
+            n->as_Vector()->length() == 4);
+  match(Set dst (RShiftVS src shift));
+  ins_cost(INSN_COST);
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "sshl  $dst,$src,$tmp\t# vector (4H)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T8B,
+            as_FloatRegister($shift$$reg));
+    __ sshl(as_FloatRegister($dst$$reg), __ T4H,
+            as_FloatRegister($src$$reg),
+            as_FloatRegister($tmp$$reg));
+  %}
+  ins_pipe(vshift64);
+%}
+
+instruct vsra8S(vecX dst, vecX src, vecX shift, vecX tmp) %{
+  predicate(n->as_Vector()->length() == 8);
+  match(Set dst (RShiftVS src shift));
+  ins_cost(INSN_COST);
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "sshl  $dst,$src,$tmp\t# vector (8H)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T16B,
+            as_FloatRegister($shift$$reg));
+    __ sshl(as_FloatRegister($dst$$reg), __ T8H,
+            as_FloatRegister($src$$reg),
+            as_FloatRegister($tmp$$reg));
+  %}
+  ins_pipe(vshift128);
+%}
+
+instruct vsrl4S(vecD dst, vecD src, vecD shift, vecD tmp) %{
   predicate(n->as_Vector()->length() == 2 ||
             n->as_Vector()->length() == 4);
   match(Set dst (URShiftVS src shift));
   ins_cost(INSN_COST);
-  format %{ "ushl  $dst,$src,$shift\t# vector (4H)" %}
-  ins_encode %{
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "ushl  $dst,$src,$tmp\t# vector (4H)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T8B,
+            as_FloatRegister($shift$$reg));
     __ ushl(as_FloatRegister($dst$$reg), __ T4H,
             as_FloatRegister($src$$reg),
-            as_FloatRegister($shift$$reg));
+            as_FloatRegister($tmp$$reg));
   %}
   ins_pipe(vshift64);
 %}
 
-instruct vsrl8S(vecX dst, vecX src, vecX shift) %{
+instruct vsrl8S(vecX dst, vecX src, vecX shift, vecX tmp) %{
   predicate(n->as_Vector()->length() == 8);
   match(Set dst (URShiftVS src shift));
   ins_cost(INSN_COST);
-  format %{ "ushl  $dst,$src,$shift\t# vector (8H)" %}
-  ins_encode %{
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "ushl  $dst,$src,$tmp\t# vector (8H)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T16B,
+            as_FloatRegister($shift$$reg));
     __ ushl(as_FloatRegister($dst$$reg), __ T8H,
             as_FloatRegister($src$$reg),
-            as_FloatRegister($shift$$reg));
+            as_FloatRegister($tmp$$reg));
   %}
   ins_pipe(vshift128);
 %}
@@ -16871,10 +17037,9 @@
   ins_pipe(vshift128_imm);
 %}
 
-instruct vsll2I(vecD dst, vecD src, vecX shift) %{
+instruct vsll2I(vecD dst, vecD src, vecD shift) %{
   predicate(n->as_Vector()->length() == 2);
   match(Set dst (LShiftVI src shift));
-  match(Set dst (RShiftVI src shift));
   ins_cost(INSN_COST);
   format %{ "sshl  $dst,$src,$shift\t# vector (2S)" %}
   ins_encode %{
@@ -16888,7 +17053,6 @@
 instruct vsll4I(vecX dst, vecX src, vecX shift) %{
   predicate(n->as_Vector()->length() == 4);
   match(Set dst (LShiftVI src shift));
-  match(Set dst (RShiftVI src shift));
   ins_cost(INSN_COST);
   format %{ "sshl  $dst,$src,$shift\t# vector (4S)" %}
   ins_encode %{
@@ -16899,28 +17063,70 @@
   ins_pipe(vshift128);
 %}
 
-instruct vsrl2I(vecD dst, vecD src, vecX shift) %{
+instruct vsra2I(vecD dst, vecD src, vecD shift, vecD tmp) %{
   predicate(n->as_Vector()->length() == 2);
-  match(Set dst (URShiftVI src shift));
-  ins_cost(INSN_COST);
-  format %{ "ushl  $dst,$src,$shift\t# vector (2S)" %}
-  ins_encode %{
-    __ ushl(as_FloatRegister($dst$$reg), __ T2S,
+  match(Set dst (RShiftVI src shift));
+  ins_cost(INSN_COST);
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "sshl  $dst,$src,$tmp\t# vector (2S)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T8B,
+            as_FloatRegister($shift$$reg));
+    __ sshl(as_FloatRegister($dst$$reg), __ T2S,
             as_FloatRegister($src$$reg),
-            as_FloatRegister($shift$$reg));
+            as_FloatRegister($tmp$$reg));
   %}
   ins_pipe(vshift64);
 %}
 
-instruct vsrl4I(vecX dst, vecX src, vecX shift) %{
+instruct vsra4I(vecX dst, vecX src, vecX shift, vecX tmp) %{
+  predicate(n->as_Vector()->length() == 4);
+  match(Set dst (RShiftVI src shift));
+  ins_cost(INSN_COST);
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "sshl  $dst,$src,$tmp\t# vector (4S)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T16B,
+            as_FloatRegister($shift$$reg));
+    __ sshl(as_FloatRegister($dst$$reg), __ T4S,
+            as_FloatRegister($src$$reg),
+            as_FloatRegister($tmp$$reg));
+  %}
+  ins_pipe(vshift128);
+%}
+
+instruct vsrl2I(vecD dst, vecD src, vecD shift, vecD tmp) %{
+  predicate(n->as_Vector()->length() == 2);
+  match(Set dst (URShiftVI src shift));
+  ins_cost(INSN_COST);
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "ushl  $dst,$src,$tmp\t# vector (2S)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T8B,
+            as_FloatRegister($shift$$reg));
+    __ ushl(as_FloatRegister($dst$$reg), __ T2S,
+            as_FloatRegister($src$$reg),
+            as_FloatRegister($tmp$$reg));
+  %}
+  ins_pipe(vshift64);
+%}
+
+instruct vsrl4I(vecX dst, vecX src, vecX shift, vecX tmp) %{
   predicate(n->as_Vector()->length() == 4);
   match(Set dst (URShiftVI src shift));
   ins_cost(INSN_COST);
-  format %{ "ushl  $dst,$src,$shift\t# vector (4S)" %}
-  ins_encode %{
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "ushl  $dst,$src,$tmp\t# vector (4S)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T16B,
+            as_FloatRegister($shift$$reg));
     __ ushl(as_FloatRegister($dst$$reg), __ T4S,
             as_FloatRegister($src$$reg),
-            as_FloatRegister($shift$$reg));
+            as_FloatRegister($tmp$$reg));
   %}
   ins_pipe(vshift128);
 %}
@@ -17006,7 +17212,6 @@
 instruct vsll2L(vecX dst, vecX src, vecX shift) %{
   predicate(n->as_Vector()->length() == 2);
   match(Set dst (LShiftVL src shift));
-  match(Set dst (RShiftVL src shift));
   ins_cost(INSN_COST);
   format %{ "sshl  $dst,$src,$shift\t# vector (2D)" %}
   ins_encode %{
@@ -17017,15 +17222,36 @@
   ins_pipe(vshift128);
 %}
 
-instruct vsrl2L(vecX dst, vecX src, vecX shift) %{
+instruct vsra2L(vecX dst, vecX src, vecX shift, vecX tmp) %{
+  predicate(n->as_Vector()->length() == 2);
+  match(Set dst (RShiftVL src shift));
+  ins_cost(INSN_COST);
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "sshl  $dst,$src,$tmp\t# vector (2D)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T16B,
+            as_FloatRegister($shift$$reg));
+    __ sshl(as_FloatRegister($dst$$reg), __ T2D,
+            as_FloatRegister($src$$reg),
+            as_FloatRegister($tmp$$reg));
+  %}
+  ins_pipe(vshift128);
+%}
+
+instruct vsrl2L(vecX dst, vecX src, vecX shift, vecX tmp) %{
   predicate(n->as_Vector()->length() == 2);
   match(Set dst (URShiftVL src shift));
   ins_cost(INSN_COST);
-  format %{ "ushl  $dst,$src,$shift\t# vector (2D)" %}
-  ins_encode %{
+  effect(TEMP tmp);
+  format %{ "negr  $tmp,$shift\t"
+            "ushl  $dst,$src,$tmp\t# vector (2D)" %}
+  ins_encode %{
+    __ negr(as_FloatRegister($tmp$$reg), __ T16B,
+            as_FloatRegister($shift$$reg));
     __ ushl(as_FloatRegister($dst$$reg), __ T2D,
             as_FloatRegister($src$$reg),
-            as_FloatRegister($shift$$reg));
+            as_FloatRegister($tmp$$reg));
   %}
   ins_pipe(vshift128);
 %}
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -1826,12 +1826,16 @@
   INSN(fdivs, 0b000, 0b00, 0b0001);
   INSN(fadds, 0b000, 0b00, 0b0010);
   INSN(fsubs, 0b000, 0b00, 0b0011);
+  INSN(fmaxs, 0b000, 0b00, 0b0100);
+  INSN(fmins, 0b000, 0b00, 0b0101);
   INSN(fnmuls, 0b000, 0b00, 0b1000);
 
   INSN(fmuld, 0b000, 0b01, 0b0000);
   INSN(fdivd, 0b000, 0b01, 0b0001);
   INSN(faddd, 0b000, 0b01, 0b0010);
   INSN(fsubd, 0b000, 0b01, 0b0011);
+  INSN(fmaxd, 0b000, 0b01, 0b0100);
+  INSN(fmind, 0b000, 0b01, 0b0101);
   INSN(fnmuld, 0b000, 0b01, 0b1000);
 
 #undef INSN
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -4896,7 +4896,7 @@
 
   // A very short string
   cmpw(cnt2, minCharsInWord);
-  br(Assembler::LT, SHORT_STRING);
+  br(Assembler::LE, SHORT_STRING);
 
   // Compare longwords
   // load first parts of strings and finish initialization while loading
@@ -4920,8 +4920,7 @@
       ldr(tmp2, Address(str2));
       cmp(cnt2, STUB_THRESHOLD);
       br(GE, STUB);
-      subsw(cnt2, cnt2, 4);
-      br(EQ, TAIL_CHECK);
+      subw(cnt2, cnt2, 4);
       eor(vtmpZ, T16B, vtmpZ, vtmpZ);
       lea(str1, Address(str1, cnt2, Address::uxtw(str1_chr_shift)));
       lea(str2, Address(str2, cnt2, Address::uxtw(str2_chr_shift)));
@@ -4937,8 +4936,7 @@
       ldrs(vtmp, Address(str2));
       cmp(cnt2, STUB_THRESHOLD);
       br(GE, STUB);
-      subsw(cnt2, cnt2, 4);
-      br(EQ, TAIL_CHECK);
+      subw(cnt2, cnt2, 4);
       lea(str1, Address(str1, cnt2, Address::uxtw(str1_chr_shift)));
       eor(vtmpZ, T16B, vtmpZ, vtmpZ);
       lea(str2, Address(str2, cnt2, Address::uxtw(str2_chr_shift)));
--- a/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/aarch64/methodHandles_aarch64.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -105,8 +105,8 @@
     // compiled code in threads for which the event is enabled.  Check here for
     // interp_only_mode if these events CAN be enabled.
 
-    __ ldrb(rscratch1, Address(rthread, JavaThread::interp_only_mode_offset()));
-    __ cbnz(rscratch1, run_compiled_code);
+    __ ldrw(rscratch1, Address(rthread, JavaThread::interp_only_mode_offset()));
+    __ cbzw(rscratch1, run_compiled_code);
     __ ldr(rscratch1, Address(method, Method::interpreter_entry_offset()));
     __ br(rscratch1);
     __ BIND(run_compiled_code);
--- a/src/hotspot/cpu/arm/arm.ad	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/arm/arm.ad	Fri Dec 21 07:46:58 2018 -0500
@@ -8945,9 +8945,10 @@
 instruct cmpFastLock(flagsRegP pcc, iRegP object, iRegP box, iRegP scratch2, iRegP scratch )
 %{
   match(Set pcc (FastLock object box));
+  predicate(!(UseBiasedLocking && !UseOptoBiasInlining));
 
   effect(TEMP scratch, TEMP scratch2);
-  ins_cost(100);
+  ins_cost(DEFAULT_COST*3);
 
   format %{ "FASTLOCK  $object, $box; KILL $scratch, $scratch2" %}
   ins_encode %{
@@ -8956,6 +8957,21 @@
   ins_pipe(long_memory_op);
 %}
 
+instruct cmpFastLock_noBiasInline(flagsRegP pcc, iRegP object, iRegP box, iRegP scratch2,
+                                  iRegP scratch, iRegP scratch3) %{
+  match(Set pcc (FastLock object box));
+  predicate(UseBiasedLocking && !UseOptoBiasInlining);
+
+  effect(TEMP scratch, TEMP scratch2, TEMP scratch3);
+  ins_cost(DEFAULT_COST*5);
+
+  format %{ "FASTLOCK  $object, $box; KILL $scratch, $scratch2, $scratch3" %}
+  ins_encode %{
+    __ fast_lock($object$$Register, $box$$Register, $scratch$$Register, $scratch2$$Register, $scratch3$$Register);
+  %}
+  ins_pipe(long_memory_op);
+%}
+
 
 instruct cmpFastUnlock(flagsRegP pcc, iRegP object, iRegP box, iRegP scratch2, iRegP scratch ) %{
   match(Set pcc (FastUnlock object box));
--- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -1971,7 +1971,7 @@
 
 
 #ifdef COMPILER2
-void MacroAssembler::fast_lock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2)
+void MacroAssembler::fast_lock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2, Register scratch3)
 {
   assert(VM_Version::supports_ldrex(), "unsupported, yet?");
 
@@ -1985,11 +1985,13 @@
   Label fast_lock, done;
 
   if (UseBiasedLocking && !UseOptoBiasInlining) {
-    Label failed;
-    biased_locking_enter(Roop, Rmark, Rscratch, false, noreg, done, failed);
-    bind(failed);
+    assert(scratch3 != noreg, "need extra temporary for -XX:-UseOptoBiasInlining");
+    biased_locking_enter(Roop, Rmark, Rscratch, false, scratch3, done, done);
+    // Fall through if lock not biased otherwise branch to done
   }
 
+  // Invariant: Rmark loaded below does not contain biased lock pattern
+
   ldr(Rmark, Address(Roop, oopDesc::mark_offset_in_bytes()));
   tst(Rmark, markOopDesc::unlocked_value);
   b(fast_lock, ne);
@@ -2016,6 +2018,9 @@
 
   bind(done);
 
+  // At this point flags are set as follows:
+  //  EQ -> Success
+  //  NE -> Failure, branch to slow path
 }
 
 void MacroAssembler::fast_unlock(Register Roop, Register Rbox, Register Rscratch, Register Rscratch2)
--- a/src/hotspot/cpu/arm/macroAssembler_arm.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -371,10 +371,10 @@
   // lock_reg and obj_reg must be loaded up with the appropriate values.
   // swap_reg must be supplied.
   // tmp_reg must be supplied.
-  // Optional slow case is for implementations (interpreter and C1) which branch to
-  // slow case directly. If slow_case is NULL, then leaves condition
-  // codes set (for C2's Fast_Lock node) and jumps to done label.
-  // Falls through for the fast locking attempt.
+  // Done label is branched to with condition code EQ set if the lock is
+  // biased and we acquired it. Slow case label is branched to with
+  // condition code NE set if the lock is biased but we failed to acquire
+  // it. Otherwise fall through.
   // Returns offset of first potentially-faulting instruction for null
   // check info (currently consumed only by C1). If
   // swap_reg_contains_mark is true then returns -1 as it is assumed
@@ -1073,7 +1073,7 @@
   void restore_default_fp_mode();
 
 #ifdef COMPILER2
-  void fast_lock(Register obj, Register box, Register scratch, Register scratch2);
+  void fast_lock(Register obj, Register box, Register scratch, Register scratch2, Register scratch3 = noreg);
   void fast_unlock(Register obj, Register box, Register scratch, Register scratch2);
 #endif
 
--- a/src/hotspot/cpu/x86/x86_32.ad	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/x86/x86_32.ad	Fri Dec 21 07:46:58 2018 -0500
@@ -7760,9 +7760,9 @@
   match(Set dst (MulAddS2I (Binary dst src1) (Binary src2 src3)));
   effect(KILL cr, KILL src2);
 
-  expand %{ mulI_rReg(dst, src1, cr);
-           mulI_rReg(src2, src3, cr);
-           addI_rReg(dst, src2, cr); %}
+  expand %{ mulI_eReg(dst, src1, cr);
+           mulI_eReg(src2, src3, cr);
+           addI_eReg(dst, src2, cr); %}
 %}
 
 // Multiply Register Int to Long
--- a/src/hotspot/cpu/x86/x86_64.ad	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/cpu/x86/x86_64.ad	Fri Dec 21 07:46:58 2018 -0500
@@ -4265,132 +4265,196 @@
 
 // Operands for bound floating pointer register arguments
 operand rxmm0() %{
-  constraint(ALLOC_IN_RC(xmm0_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX<= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm0_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm1() %{
-  constraint(ALLOC_IN_RC(xmm1_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm1_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm2() %{
-  constraint(ALLOC_IN_RC(xmm2_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm2_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm3() %{
-  constraint(ALLOC_IN_RC(xmm3_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm3_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm4() %{
-  constraint(ALLOC_IN_RC(xmm4_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm4_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm5() %{
-  constraint(ALLOC_IN_RC(xmm5_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm5_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm6() %{
-  constraint(ALLOC_IN_RC(xmm6_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm6_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm7() %{
-  constraint(ALLOC_IN_RC(xmm7_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm7_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm8() %{
-  constraint(ALLOC_IN_RC(xmm8_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm8_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm9() %{
-  constraint(ALLOC_IN_RC(xmm9_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm9_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm10() %{
-  constraint(ALLOC_IN_RC(xmm10_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm10_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm11() %{
-  constraint(ALLOC_IN_RC(xmm11_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm11_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm12() %{
-  constraint(ALLOC_IN_RC(xmm12_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm12_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm13() %{
-  constraint(ALLOC_IN_RC(xmm13_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm13_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm14() %{
-  constraint(ALLOC_IN_RC(xmm14_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm14_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm15() %{
-  constraint(ALLOC_IN_RC(xmm15_reg));  match(VecX);
-  predicate((UseSSE > 0) && (UseAVX <= 2));  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm15_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm16() %{
-  constraint(ALLOC_IN_RC(xmm16_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm16_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm17() %{
-  constraint(ALLOC_IN_RC(xmm17_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm17_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm18() %{
-  constraint(ALLOC_IN_RC(xmm18_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm18_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm19() %{
-  constraint(ALLOC_IN_RC(xmm19_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm19_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm20() %{
-  constraint(ALLOC_IN_RC(xmm20_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm20_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm21() %{
-  constraint(ALLOC_IN_RC(xmm21_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm21_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm22() %{
-  constraint(ALLOC_IN_RC(xmm22_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm22_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm23() %{
-  constraint(ALLOC_IN_RC(xmm23_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm23_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm24() %{
-  constraint(ALLOC_IN_RC(xmm24_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm24_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm25() %{
-  constraint(ALLOC_IN_RC(xmm25_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm25_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm26() %{
-  constraint(ALLOC_IN_RC(xmm26_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm26_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm27() %{
-  constraint(ALLOC_IN_RC(xmm27_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm27_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm28() %{
-  constraint(ALLOC_IN_RC(xmm28_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm28_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm29() %{
-  constraint(ALLOC_IN_RC(xmm29_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm29_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm30() %{
-  constraint(ALLOC_IN_RC(xmm30_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm30_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 operand rxmm31() %{
-  constraint(ALLOC_IN_RC(xmm31_reg));  match(VecX);
-  predicate(UseAVX == 3);  format%{%}  interface(REG_INTER);
+  constraint(ALLOC_IN_RC(xmm31_reg));
+  match(VecX);
+  format%{%}
+  interface(REG_INTER);
 %}
 
 //----------OPERAND CLASSES----------------------------------------------------
@@ -12651,33 +12715,6 @@
 // Execute ZGC load barrier (strong) slow path
 //
 
-// When running without XMM regs
-instruct loadBarrierSlowRegNoVec(rRegP dst, memory mem, rFlagsReg cr) %{
-
-  match(Set dst (LoadBarrierSlowReg mem));
-  predicate(MaxVectorSize < 16);
-
-  effect(DEF dst, KILL cr);
-
-  format %{"LoadBarrierSlowRegNoVec $dst, $mem" %}
-  ins_encode %{
-#if INCLUDE_ZGC
-    Register d = $dst$$Register;
-    ZBarrierSetAssembler* bs = (ZBarrierSetAssembler*)BarrierSet::barrier_set()->barrier_set_assembler();
-
-    assert(d != r12, "Can't be R12!");
-    assert(d != r15, "Can't be R15!");
-    assert(d != rsp, "Can't be RSP!");
-
-    __ lea(d, $mem$$Address);
-    __ call(RuntimeAddress(bs->load_barrier_slow_stub(d)));
-#else
-    ShouldNotReachHere();
-#endif
-  %}
-  ins_pipe(pipe_slow);
-%}
-
 // For XMM and YMM enabled processors
 instruct loadBarrierSlowRegXmmAndYmm(rRegP dst, memory mem, rFlagsReg cr,
                                      rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
@@ -12686,7 +12723,7 @@
                                      rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15) %{
 
   match(Set dst (LoadBarrierSlowReg mem));
-  predicate((UseSSE > 0) && (UseAVX <= 2) && (MaxVectorSize >= 16));
+  predicate(UseAVX <= 2);
 
   effect(DEF dst, KILL cr,
          KILL x0, KILL x1, KILL x2, KILL x3,
@@ -12694,7 +12731,7 @@
          KILL x8, KILL x9, KILL x10, KILL x11,
          KILL x12, KILL x13, KILL x14, KILL x15);
 
-  format %{"LoadBarrierSlowRegXmm $dst, $mem" %}
+  format %{"LoadBarrierSlowRegXmmAndYmm $dst, $mem" %}
   ins_encode %{
 #if INCLUDE_ZGC
     Register d = $dst$$Register;
@@ -12725,7 +12762,7 @@
                                rxmm28 x28, rxmm29 x29, rxmm30 x30, rxmm31 x31) %{
 
   match(Set dst (LoadBarrierSlowReg mem));
-  predicate((UseAVX == 3) && (MaxVectorSize >= 16));
+  predicate(UseAVX == 3);
 
   effect(DEF dst, KILL cr,
          KILL x0, KILL x1, KILL x2, KILL x3,
@@ -12760,33 +12797,6 @@
 // Execute ZGC load barrier (weak) slow path
 //
 
-// When running without XMM regs
-instruct loadBarrierWeakSlowRegNoVec(rRegP dst, memory mem, rFlagsReg cr) %{
-
-  match(Set dst (LoadBarrierSlowReg mem));
-  predicate(MaxVectorSize < 16);
-
-  effect(DEF dst, KILL cr);
-
-  format %{"LoadBarrierSlowRegNoVec $dst, $mem" %}
-  ins_encode %{
-#if INCLUDE_ZGC
-    Register d = $dst$$Register;
-    ZBarrierSetAssembler* bs = (ZBarrierSetAssembler*)BarrierSet::barrier_set()->barrier_set_assembler();
-
-    assert(d != r12, "Can't be R12!");
-    assert(d != r15, "Can't be R15!");
-    assert(d != rsp, "Can't be RSP!");
-
-    __ lea(d, $mem$$Address);
-    __ call(RuntimeAddress(bs->load_barrier_weak_slow_stub(d)));
-#else
-    ShouldNotReachHere();
-#endif
-  %}
-  ins_pipe(pipe_slow);
-%}
-
 // For XMM and YMM enabled processors
 instruct loadBarrierWeakSlowRegXmmAndYmm(rRegP dst, memory mem, rFlagsReg cr,
                                          rxmm0 x0, rxmm1 x1, rxmm2 x2,rxmm3 x3,
@@ -12795,7 +12805,7 @@
                                          rxmm12 x12, rxmm13 x13, rxmm14 x14, rxmm15 x15) %{
 
   match(Set dst (LoadBarrierWeakSlowReg mem));
-  predicate((UseSSE > 0) && (UseAVX <= 2) && (MaxVectorSize >= 16));
+  predicate(UseAVX <= 2);
 
   effect(DEF dst, KILL cr,
          KILL x0, KILL x1, KILL x2, KILL x3,
@@ -12803,7 +12813,7 @@
          KILL x8, KILL x9, KILL x10, KILL x11,
          KILL x12, KILL x13, KILL x14, KILL x15);
 
-  format %{"LoadBarrierWeakSlowRegXmm $dst, $mem" %}
+  format %{"LoadBarrierWeakSlowRegXmmAndYmm $dst, $mem" %}
   ins_encode %{
 #if INCLUDE_ZGC
     Register d = $dst$$Register;
@@ -12834,7 +12844,7 @@
                                    rxmm28 x28, rxmm29 x29, rxmm30 x30, rxmm31 x31) %{
 
   match(Set dst (LoadBarrierWeakSlowReg mem));
-  predicate((UseAVX == 3) && (MaxVectorSize >= 16));
+  predicate(UseAVX == 3);
 
   effect(DEF dst, KILL cr,
          KILL x0, KILL x1, KILL x2, KILL x3,
--- a/src/hotspot/os/aix/os_aix.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/os/aix/os_aix.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -2602,23 +2602,6 @@
   return ::pread(fd, buf, nBytes, offset);
 }
 
-void os::naked_short_sleep(jlong ms) {
-  struct timespec req;
-
-  assert(ms < 1000, "Un-interruptable sleep, short time use only");
-  req.tv_sec = 0;
-  if (ms > 0) {
-    req.tv_nsec = (ms % 1000) * 1000000;
-  }
-  else {
-    req.tv_nsec = 1;
-  }
-
-  nanosleep(&req, NULL);
-
-  return;
-}
-
 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
 void os::infinite_sleep() {
   while (true) {    // sleep forever ...
--- a/src/hotspot/os/bsd/os_bsd.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -2225,22 +2225,6 @@
   RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
 }
 
-void os::naked_short_sleep(jlong ms) {
-  struct timespec req;
-
-  assert(ms < 1000, "Un-interruptable sleep, short time use only");
-  req.tv_sec = 0;
-  if (ms > 0) {
-    req.tv_nsec = (ms % 1000) * 1000000;
-  } else {
-    req.tv_nsec = 1;
-  }
-
-  nanosleep(&req, NULL);
-
-  return;
-}
-
 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
 void os::infinite_sleep() {
   while (true) {    // sleep forever ...
--- a/src/hotspot/os/linux/os_linux.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/os/linux/os_linux.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -4033,33 +4033,6 @@
   return ::pread(fd, buf, nBytes, offset);
 }
 
-// Short sleep, direct OS call.
-//
-// Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee
-// sched_yield(2) will actually give up the CPU:
-//
-//   * Alone on this pariticular CPU, keeps running.
-//   * Before the introduction of "skip_buddy" with "compat_yield" disabled
-//     (pre 2.6.39).
-//
-// So calling this with 0 is an alternative.
-//
-void os::naked_short_sleep(jlong ms) {
-  struct timespec req;
-
-  assert(ms < 1000, "Un-interruptable sleep, short time use only");
-  req.tv_sec = 0;
-  if (ms > 0) {
-    req.tv_nsec = (ms % 1000) * 1000000;
-  } else {
-    req.tv_nsec = 1;
-  }
-
-  nanosleep(&req, NULL);
-
-  return;
-}
-
 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
 void os::infinite_sleep() {
   while (true) {    // sleep forever ...
@@ -4072,6 +4045,16 @@
   return DontYieldALot;
 }
 
+// Linux CFS scheduler (since 2.6.23) does not guarantee sched_yield(2) will
+// actually give up the CPU. Since skip buddy (v2.6.28):
+//
+// * Sets the yielding task as skip buddy for current CPU's run queue.
+// * Picks next from run queue, if empty, picks a skip buddy (can be the yielding task).
+// * Clears skip buddies for this run queue (yielding task no longer a skip buddy).
+//
+// An alternative is calling os::naked_short_nanosleep with a small number to avoid
+// getting re-scheduled immediately.
+//
 void os::naked_yield() {
   sched_yield();
 }
--- a/src/hotspot/os/posix/os_posix.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/os/posix/os_posix.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -695,6 +695,21 @@
   }
 }
 
+void os::naked_short_nanosleep(jlong ns) {
+  struct timespec req;
+  assert(ns > -1 && ns < NANOUNITS, "Un-interruptable sleep, short time use only");
+  req.tv_sec = 0;
+  req.tv_nsec = ns;
+  ::nanosleep(&req, NULL);
+  return;
+}
+
+void os::naked_short_sleep(jlong ms) {
+  assert(ms < MILLIUNITS, "Un-interruptable sleep, short time use only");
+  os::naked_short_nanosleep(ms * (NANOUNITS / MILLIUNITS));
+  return;
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // interrupt support
 
--- a/src/hotspot/os/solaris/os_solaris.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -2871,16 +2871,6 @@
   return res;
 }
 
-void os::naked_short_sleep(jlong ms) {
-  assert(ms < 1000, "Un-interruptable sleep, short time use only");
-
-  // usleep is deprecated and removed from POSIX, in favour of nanosleep, but
-  // Solaris requires -lrt for this.
-  usleep((ms * 1000));
-
-  return;
-}
-
 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
 void os::infinite_sleep() {
   while (true) {    // sleep forever ...
--- a/src/hotspot/os/windows/os_windows.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/os/windows/os_windows.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -3512,6 +3512,43 @@
   Sleep(ms);
 }
 
+void os::naked_short_nanosleep(jlong ns) {
+  assert(ns > -1 && ns < NANOUNITS, "Un-interruptable sleep, short time use only");
+  LARGE_INTEGER hundreds_nanos = { 0 };
+  HANDLE wait_timer = ::CreateWaitableTimer(NULL /* attributes*/,
+                                            true /* manual reset */,
+                                            NULL /* name */ );
+  if (wait_timer == NULL) {
+    log_warning(os)("Failed to CreateWaitableTimer: %u", GetLastError());
+    return;
+  }
+
+  // We need a minimum of one hundred nanos.
+  ns = ns > 100 ? ns : 100;
+
+  // Round ns to the nearst hundred of nanos.
+  // Negative values indicate relative time.
+  hundreds_nanos.QuadPart = -((ns + 50) / 100);
+
+  if (::SetWaitableTimer(wait_timer /* handle */,
+                         &hundreds_nanos /* due time */,
+                         0 /* period */,
+                         NULL /* comp func */,
+                         NULL /* comp func args */,
+                         FALSE /* resume */)) {
+    DWORD res = ::WaitForSingleObject(wait_timer /* handle */, INFINITE /* timeout */);
+    if (res != WAIT_OBJECT_0) {
+      if (res == WAIT_FAILED) {
+        log_warning(os)("Failed to WaitForSingleObject: %u", GetLastError());
+      } else {
+        log_warning(os)("Unexpected return from WaitForSingleObject: %s",
+                        res == WAIT_ABANDONED ? "WAIT_ABANDONED" : "WAIT_TIMEOUT");
+      }
+    }
+  }
+  ::CloseHandle(wait_timer /* handle */);
+}
+
 // Sleep forever; naked call to OS-specific sleep; use with CAUTION
 void os::infinite_sleep() {
   while (true) {    // sleep forever ...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/linux_x86/gc/z/zArguments_linux_x86.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+#include "precompiled.hpp"
+#include "gc/z/zArguments.hpp"
+#include "runtime/globals.hpp"
+#include "runtime/globals_extension.hpp"
+#include "utilities/debug.hpp"
+
+void ZArguments::initialize_platform() {
+  // The C2 barrier slow path expects vector registers to be least
+  // 16 bytes wide, which is the minimum width available on all
+  // x86-64 systems. However, the user could have speficied a lower
+  // number on the command-line, in which case we print a warning
+  // and raise it to 16.
+  if (MaxVectorSize < 16) {
+    warning("ZGC requires MaxVectorSize to be at least 16");
+    FLAG_SET_DEFAULT(MaxVectorSize, 16);
+  }
+}
--- a/src/hotspot/share/adlc/formssel.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/adlc/formssel.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -3801,7 +3801,7 @@
     "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
     "AndI","AndL",
     "AndV",
-    "MaxI","MinI",
+    "MaxI","MinI","MaxF","MinF","MaxD","MinD",
     "MulI","MulL","MulF","MulD",
     "MulVS","MulVI","MulVL","MulVF","MulVD",
     "OrI","OrL",
--- a/src/hotspot/share/classfile/dictionary.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/classfile/dictionary.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -173,7 +173,7 @@
     for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint
                                 current != NULL;
                                 current = current->_next) {
-      guarantee(oopDesc::is_oop(current->_pd_cache->object_no_keepalive()), "Invalid oop");
+      guarantee(oopDesc::is_oop_or_null(current->_pd_cache->object_no_keepalive()), "Invalid oop");
     }
   }
 
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -71,7 +71,6 @@
 #include "prims/resolvedMethodTable.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/arguments_ext.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/fieldType.hpp"
 #include "runtime/handles.inline.hpp"
--- a/src/hotspot/share/classfile/vmSymbols.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/classfile/vmSymbols.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -580,6 +580,10 @@
   case vmIntrinsics::_max:
   case vmIntrinsics::_floatToIntBits:
   case vmIntrinsics::_doubleToLongBits:
+  case vmIntrinsics::_maxF:
+  case vmIntrinsics::_minF:
+  case vmIntrinsics::_maxD:
+  case vmIntrinsics::_minD:
     if (!InlineMathNatives) return true;
     break;
   case vmIntrinsics::_fmaD:
--- a/src/hotspot/share/classfile/vmSymbols.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/classfile/vmSymbols.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -748,6 +748,7 @@
   do_class(java_lang_StrictMath,          "java/lang/StrictMath")                                                       \
   do_signature(double2_double_signature,  "(DD)D")                                                                      \
   do_signature(double3_double_signature,  "(DDD)D")                                                                     \
+  do_signature(float2_float_signature,    "(FF)F")                                                                      \
   do_signature(float3_float_signature,    "(FFF)F")                                                                     \
   do_signature(int2_int_signature,        "(II)I")                                                                      \
   do_signature(long2_long_signature,      "(JJ)J")                                                                      \
@@ -794,6 +795,10 @@
   do_intrinsic(_subtractExactL,           java_lang_Math,         subtractExact_name, long2_long_signature,      F_S)   \
   do_intrinsic(_fmaD,                     java_lang_Math,         fma_name,           double3_double_signature,  F_S)   \
   do_intrinsic(_fmaF,                     java_lang_Math,         fma_name,           float3_float_signature,    F_S)   \
+  do_intrinsic(_maxF,                     java_lang_Math,         max_name,           float2_float_signature,    F_S)   \
+  do_intrinsic(_minF,                     java_lang_Math,         min_name,           float2_float_signature,    F_S)   \
+  do_intrinsic(_maxD,                     java_lang_Math,         max_name,           double2_double_signature,  F_S)   \
+  do_intrinsic(_minD,                     java_lang_Math,         min_name,           double2_double_signature,  F_S)   \
                                                                                                                         \
   do_intrinsic(_floatToRawIntBits,        java_lang_Float,        floatToRawIntBits_name,   float_int_signature, F_S)   \
    do_name(     floatToRawIntBits_name,                          "floatToRawIntBits")                                   \
--- a/src/hotspot/share/code/icBuffer.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/code/icBuffer.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -53,29 +53,29 @@
     _refill_remembered(false)
 {
   Thread* thread = Thread::current();
-  assert(thread->missed_ic_stub_refill_mark() == NULL, "nesting not supported");
-  thread->set_missed_ic_stub_refill_mark(this);
+  assert(thread->missed_ic_stub_refill_verifier() == NULL, "nesting not supported");
+  thread->set_missed_ic_stub_refill_verifier(this);
 }
 
 ICRefillVerifier::~ICRefillVerifier() {
   assert(!_refill_requested || _refill_remembered,
          "Forgot to refill IC stubs after failed IC transition");
-  Thread::current()->set_missed_ic_stub_refill_mark(NULL);
+  Thread::current()->set_missed_ic_stub_refill_verifier(NULL);
 }
 
 ICRefillVerifierMark::ICRefillVerifierMark(ICRefillVerifier* verifier) {
   Thread* thread = Thread::current();
-  assert(thread->missed_ic_stub_refill_mark() == NULL, "nesting not supported");
-  thread->set_missed_ic_stub_refill_mark(this);
+  assert(thread->missed_ic_stub_refill_verifier() == NULL, "nesting not supported");
+  thread->set_missed_ic_stub_refill_verifier(verifier);
 }
 
 ICRefillVerifierMark::~ICRefillVerifierMark() {
-  Thread::current()->set_missed_ic_stub_refill_mark(NULL);
+  Thread::current()->set_missed_ic_stub_refill_verifier(NULL);
 }
 
 static ICRefillVerifier* current_ic_refill_verifier() {
   Thread* current = Thread::current();
-  ICRefillVerifier* verifier = reinterpret_cast<ICRefillVerifier*>(current->missed_ic_stub_refill_mark());
+  ICRefillVerifier* verifier = current->missed_ic_stub_refill_verifier();
   assert(verifier != NULL, "need a verifier for safety");
   return verifier;
 }
--- a/src/hotspot/share/code/nmethod.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/code/nmethod.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -1283,6 +1283,13 @@
       flush_dependencies(/*delete_immediately*/true);
     }
 
+    // Clear ICStubs to prevent back patching stubs of zombie or flushed
+    // nmethods during the next safepoint (see ICStub::finalize).
+    {
+      CompiledICLocker ml(this);
+      clear_ic_stubs();
+    }
+
     // zombie only - if a JVMTI agent has enabled the CompiledMethodUnload
     // event and it hasn't already been reported for this nmethod then
     // report it now. The event may have been reported earlier if the GC
@@ -2533,6 +2540,7 @@
         case relocInfo::section_word_type:     return "section_word";
         case relocInfo::poll_type:             return "poll";
         case relocInfo::poll_return_type:      return "poll_return";
+        case relocInfo::trampoline_stub_type:  return "trampoline_stub";
         case relocInfo::type_mask:             return "type_bit_mask";
 
         default:
--- a/src/hotspot/share/code/scopeDesc.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/code/scopeDesc.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -51,9 +51,9 @@
 }
 
 
-ScopeDesc::ScopeDesc(const ScopeDesc* parent) {
+void ScopeDesc::initialize(const ScopeDesc* parent, int decode_offset) {
   _code          = parent->_code;
-  _decode_offset = parent->_sender_decode_offset;
+  _decode_offset = decode_offset;
   _objects       = parent->_objects;
   _reexecute     = false; //reexecute only applies to the first scope
   _rethrow_exception = false;
@@ -61,6 +61,14 @@
   decode_body();
 }
 
+ScopeDesc::ScopeDesc(const ScopeDesc* parent) {
+  initialize(parent, parent->_sender_decode_offset);
+}
+
+ScopeDesc::ScopeDesc(const ScopeDesc* parent, int decode_offset) {
+  initialize(parent, decode_offset);
+}
+
 
 void ScopeDesc::decode_body() {
   if (decode_offset() == DebugInformationRecorder::serialized_null) {
--- a/src/hotspot/share/code/scopeDesc.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/code/scopeDesc.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -67,6 +67,9 @@
   // avoid a .hpp-.hpp dependency.)
   ScopeDesc(const CompiledMethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop);
 
+  // Direct access to scope
+  ScopeDesc* at_offset(int decode_offset) { return new ScopeDesc(this, decode_offset); }
+
   // JVM state
   Method* method()      const { return _method; }
   int          bci()      const { return _bci;    }
@@ -85,12 +88,16 @@
   // Returns where the scope was decoded
   int decode_offset() const { return _decode_offset; }
 
+  int sender_decode_offset() const { return _sender_decode_offset; }
+
   // Tells whether sender() returns NULL
   bool is_top() const;
 
  private:
-  // Alternative constructor
+  void initialize(const ScopeDesc* parent, int decode_offset);
+  // Alternative constructors
   ScopeDesc(const ScopeDesc* parent);
+  ScopeDesc(const ScopeDesc* parent, int decode_offset);
 
   // JVM state
   Method*       _method;
--- a/src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -72,9 +72,9 @@
 
   // Check if load is lower than max.
   double recent_load;
-  if ((G1PeriodicGCSystemLoadThreshold > 0) &&
+  if ((G1PeriodicGCSystemLoadThreshold > 0.0f) &&
       (os::loadavg(&recent_load, 1) == -1 || recent_load > G1PeriodicGCSystemLoadThreshold)) {
-    log_debug(gc, periodic)("Load %1.2f is higher than threshold " UINTX_FORMAT ". Skipping.",
+    log_debug(gc, periodic)("Load %1.2f is higher than threshold %1.2f. Skipping.",
                             recent_load, G1PeriodicGCSystemLoadThreshold);
     return false;
   }
--- a/src/hotspot/share/gc/g1/g1_globals.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/g1/g1_globals.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -311,10 +311,11 @@
           "perform a concurrent GC as periodic GC, otherwise use a STW "    \
           "Full GC.")                                                       \
                                                                             \
-  manageable(uintx, G1PeriodicGCSystemLoadThreshold, 0,                     \
-          "Maximum recent system wide system load as returned by the 1m "   \
-          "value of getloadavg() at which G1 triggers a periodic GC. A "    \
-          "load above this value cancels a given periodic GC. A value of "  \
-          "zero disables this check.")                                      \
+  manageable(double, G1PeriodicGCSystemLoadThreshold, 0.0,                  \
+          "Maximum recent system wide load as returned by the 1m value "    \
+          "of getloadavg() at which G1 triggers a periodic GC. A load "     \
+          "above this value cancels a given periodic GC. A value of zero "  \
+          "disables this check.")                                           \
+          range(0.0, (double)max_uintx)                                     \
 
 #endif // SHARE_VM_GC_G1_G1_GLOBALS_HPP
--- a/src/hotspot/share/gc/shared/barrierSetConfig.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/shared/barrierSetConfig.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -48,11 +48,11 @@
 #ifdef SUPPORT_BARRIER_ON_PRIMITIVES
 #define ACCESS_PRIMITIVE_SUPPORT INTERNAL_BT_BARRIER_ON_PRIMITIVES
 #else
-#define ACCESS_PRIMITIVE_SUPPORT INTERNAL_EMPTY
+#define ACCESS_PRIMITIVE_SUPPORT DECORATORS_NONE
 #endif
 
 #ifdef SUPPORT_NOT_TO_SPACE_INVARIANT
-#define ACCESS_TO_SPACE_INVARIANT_SUPPORT INTERNAL_EMPTY
+#define ACCESS_TO_SPACE_INVARIANT_SUPPORT DECORATORS_NONE
 #else
 #define ACCESS_TO_SPACE_INVARIANT_SUPPORT INTERNAL_BT_TO_SPACE_INVARIANT
 #endif
--- a/src/hotspot/share/gc/z/zArguments.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/z/zArguments.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -19,7 +19,6 @@
  * 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"
@@ -91,6 +90,9 @@
   // Verification of stacks not (yet) supported, for the same reason
   // we need fixup_partial_loads
   DEBUG_ONLY(FLAG_SET_DEFAULT(VerifyStack, false));
+
+  // Initialize platform specific arguments
+  initialize_platform();
 }
 
 CollectedHeap* ZArguments::create_heap() {
--- a/src/hotspot/share/gc/z/zArguments.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/z/zArguments.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -29,6 +29,9 @@
 class CollectedHeap;
 
 class ZArguments : public GCArguments {
+private:
+  void initialize_platform();
+
 public:
   virtual void initialize();
   virtual size_t conservative_max_heap_alignment();
--- a/src/hotspot/share/gc/z/zObjectAllocator.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/z/zObjectAllocator.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -128,7 +128,8 @@
 }
 
 uintptr_t ZObjectAllocator::alloc_small_object_from_nonworker(size_t size, ZAllocationFlags flags) {
-  assert(ZThread::is_java() || ZThread::is_vm(), "Should be a Java or VM thread");
+  assert(ZThread::is_java() || ZThread::is_vm() || ZThread::is_runtime_worker(),
+         "Should be a Java, VM or Runtime worker thread");
 
   // Non-worker small page allocation can never use the reserve
   flags.set_no_reserve();
@@ -193,7 +194,8 @@
 }
 
 uintptr_t ZObjectAllocator::alloc_object_for_relocation(size_t size) {
-  assert(ZThread::is_java() || ZThread::is_worker() || ZThread::is_vm(), "Unknown thread");
+  assert(ZThread::is_java() || ZThread::is_vm() || ZThread::is_worker() || ZThread::is_runtime_worker(),
+         "Unknown thread");
 
   ZAllocationFlags flags;
   flags.set_relocation();
--- a/src/hotspot/share/gc/z/zRuntimeWorkers.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/z/zRuntimeWorkers.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -22,7 +22,43 @@
  */
 
 #include "precompiled.hpp"
+#include "gc/shared/workgroup.hpp"
 #include "gc/z/zRuntimeWorkers.hpp"
+#include "gc/z/zThread.hpp"
+#include "runtime/mutexLocker.hpp"
+
+class ZRuntimeWorkersInitializeTask : public AbstractGangTask {
+private:
+  const uint _nworkers;
+  uint       _started;
+  Monitor    _monitor;
+
+public:
+  ZRuntimeWorkersInitializeTask(uint nworkers) :
+      AbstractGangTask("ZRuntimeWorkersInitializeTask"),
+      _nworkers(nworkers),
+      _started(0),
+      _monitor(Monitor::leaf,
+               "ZRuntimeWorkersInitialize",
+               false /* allow_vm_block */,
+               Monitor::_safepoint_check_never) {}
+
+  virtual void work(uint worker_id) {
+    // Register as runtime worker
+    ZThread::set_runtime_worker();
+
+    // Wait for all threads to start
+    MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
+    if (++_started == _nworkers) {
+      // All threads started
+      ml.notify_all();
+    } else {
+      while (_started != _nworkers) {
+        ml.wait(Monitor::_no_safepoint_check_flag);
+      }
+    }
+  }
+};
 
 ZRuntimeWorkers::ZRuntimeWorkers() :
     _workers("RuntimeWorker",
@@ -35,6 +71,15 @@
   // Initialize worker threads
   _workers.initialize_workers();
   _workers.update_active_workers(nworkers());
+  if (_workers.active_workers() != nworkers()) {
+    vm_exit_during_initialization("Failed to create ZRuntimeWorkers");
+  }
+
+  // Execute task to register threads as runtime workers. This also
+  // helps reduce latency in early safepoints, which otherwise would
+  // have to take on any warmup costs.
+  ZRuntimeWorkersInitializeTask task(nworkers());
+  _workers.run_task(&task);
 }
 
 uint ZRuntimeWorkers::nworkers() const {
--- a/src/hotspot/share/gc/z/zThread.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/z/zThread.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -31,6 +31,7 @@
 __thread bool      ZThread::_is_vm;
 __thread bool      ZThread::_is_java;
 __thread bool      ZThread::_is_worker;
+__thread bool      ZThread::_is_runtime_worker;
 __thread uint      ZThread::_worker_id;
 
 void ZThread::initialize() {
@@ -40,7 +41,8 @@
   _id = (uintptr_t)thread;
   _is_vm = thread->is_VM_thread();
   _is_java = thread->is_Java_thread();
-  _is_worker = thread->is_Worker_thread();
+  _is_worker = false;
+  _is_runtime_worker = false;
   _worker_id = (uint)-1;
 }
 
@@ -56,6 +58,16 @@
   return "Unknown";
 }
 
+void ZThread::set_worker() {
+  ensure_initialized();
+  _is_worker = true;
+}
+
+void ZThread::set_runtime_worker() {
+  ensure_initialized();
+  _is_runtime_worker = true;
+}
+
 bool ZThread::has_worker_id() {
   return _initialized &&
          _is_worker &&
--- a/src/hotspot/share/gc/z/zThread.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/z/zThread.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -29,6 +29,8 @@
 
 class ZThread : public AllStatic {
   friend class ZTask;
+  friend class ZWorkersInitializeTask;
+  friend class ZRuntimeWorkersInitializeTask;
 
 private:
   static __thread bool      _initialized;
@@ -36,6 +38,7 @@
   static __thread bool      _is_vm;
   static __thread bool      _is_java;
   static __thread bool      _is_worker;
+  static __thread bool      _is_runtime_worker;
   static __thread uint      _worker_id;
 
   static void initialize();
@@ -46,6 +49,9 @@
     }
   }
 
+  static void set_worker();
+  static void set_runtime_worker();
+
   static bool has_worker_id();
   static void set_worker_id(uint worker_id);
   static void clear_worker_id();
@@ -73,6 +79,11 @@
     return _is_worker;
   }
 
+  static bool is_runtime_worker() {
+    ensure_initialized();
+    return _is_runtime_worker;
+  }
+
   static uint worker_id() {
     assert(has_worker_id(), "Worker id not initialized");
     return _worker_id;
--- a/src/hotspot/share/gc/z/zWorkers.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/gc/z/zWorkers.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -24,6 +24,7 @@
 #include "precompiled.hpp"
 #include "gc/z/zGlobals.hpp"
 #include "gc/z/zTask.hpp"
+#include "gc/z/zThread.hpp"
 #include "gc/z/zWorkers.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/mutexLocker.hpp"
@@ -64,20 +65,26 @@
   return calculate_nworkers(12.5);
 }
 
-class ZWorkersWarmupTask : public ZTask {
+class ZWorkersInitializeTask : public ZTask {
 private:
   const uint _nworkers;
   uint       _started;
   Monitor    _monitor;
 
 public:
-  ZWorkersWarmupTask(uint nworkers) :
-      ZTask("ZWorkersWarmupTask"),
+  ZWorkersInitializeTask(uint nworkers) :
+      ZTask("ZWorkersInitializeTask"),
       _nworkers(nworkers),
       _started(0),
-      _monitor(Monitor::leaf, "ZWorkersWarmup", false, Monitor::_safepoint_check_never) {}
+      _monitor(Monitor::leaf,
+               "ZWorkersInitialize",
+               false /* allow_vm_block */,
+               Monitor::_safepoint_check_never) {}
 
   virtual void work() {
+    // Register as worker
+    ZThread::set_worker();
+
     // Wait for all threads to start
     MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
     if (++_started == _nworkers) {
@@ -107,10 +114,10 @@
     vm_exit_during_initialization("Failed to create ZWorkers");
   }
 
-  // Warm up worker threads by having them execute a dummy task.
-  // This helps reduce latency in early GC pauses, which otherwise
-  // would have to take on any warmup costs.
-  ZWorkersWarmupTask task(nworkers());
+  // Execute task to register threads as workers. This also helps
+  // reduce latency in early GC pauses, which otherwise would have
+  // to take on any warmup costs.
+  ZWorkersInitializeTask task(nworkers());
   run(&task, nworkers());
 }
 
--- a/src/hotspot/share/include/jvm.h	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/include/jvm.h	Fri Dec 21 07:46:58 2018 -0500
@@ -625,6 +625,15 @@
 JNIEXPORT jobject JNICALL
 JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls);
 
+/*
+ * Ensure that code doing a stackwalk and using javaVFrame::locals() to
+ * get the value will see a materialized value and not a scalar-replaced
+ * null value.
+ */
+#define JVM_EnsureMaterializedForStackWalk(env, value) \
+    do {} while(0) // Nothing to do.  The fact that the value escaped
+                   // through a native method is enough.
+
 JNIEXPORT jobject JNICALL
 JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls);
 
--- a/src/hotspot/share/oops/access.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/oops/access.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -32,5 +32,5 @@
   template struct RuntimeDispatch<DecoratorFixup<decorators>::value, T, barrier_type>
 
 namespace AccessInternal {
-  INSTANTIATE_HPP_ACCESS(INTERNAL_EMPTY, oop, BARRIER_EQUALS);
+  INSTANTIATE_HPP_ACCESS(DECORATORS_NONE, oop, BARRIER_EQUALS);
 }
--- a/src/hotspot/share/oops/access.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/oops/access.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -92,7 +92,7 @@
 // access.inline.hpp. The accesses that are allowed through the access.hpp file
 // must be instantiated in access.cpp using the INSTANTIATE_HPP_ACCESS macro.
 
-template <DecoratorSet decorators = INTERNAL_EMPTY>
+template <DecoratorSet decorators = DECORATORS_NONE>
 class Access: public AllStatic {
   // This function asserts that if an access gets passed in a decorator outside
   // of the expected_decorators, then something is wrong. It additionally checks
@@ -272,7 +272,7 @@
   }
 
   static oop resolve(oop obj) {
-    verify_decorators<INTERNAL_EMPTY>();
+    verify_decorators<DECORATORS_NONE>();
     return AccessInternal::resolve<decorators>(obj);
   }
 
@@ -284,21 +284,21 @@
 
 // Helper for performing raw accesses (knows only of memory ordering
 // atomicity decorators as well as compressed oops)
-template <DecoratorSet decorators = INTERNAL_EMPTY>
+template <DecoratorSet decorators = DECORATORS_NONE>
 class RawAccess: public Access<AS_RAW | decorators> {};
 
 // Helper for performing normal accesses on the heap. These accesses
 // may resolve an accessor on a GC barrier set
-template <DecoratorSet decorators = INTERNAL_EMPTY>
+template <DecoratorSet decorators = DECORATORS_NONE>
 class HeapAccess: public Access<IN_HEAP | decorators> {};
 
 // Helper for performing normal accesses in roots. These accesses
 // may resolve an accessor on a GC barrier set
-template <DecoratorSet decorators = INTERNAL_EMPTY>
+template <DecoratorSet decorators = DECORATORS_NONE>
 class NativeAccess: public Access<IN_NATIVE | decorators> {};
 
 // Helper for array access.
-template <DecoratorSet decorators = INTERNAL_EMPTY>
+template <DecoratorSet decorators = DECORATORS_NONE>
 class ArrayAccess: public HeapAccess<IS_ARRAY | decorators> {
   typedef HeapAccess<IS_ARRAY | decorators> AccessT;
 public:
--- a/src/hotspot/share/oops/accessBackend.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/oops/accessBackend.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -1192,7 +1192,7 @@
     DecayedT decayed_value = value;
     const DecoratorSet expanded_decorators = DecoratorFixup<decorators |
                                              (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ?
-                                              INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY)>::value;
+                                              INTERNAL_CONVERT_COMPRESSED_OOP : DECORATORS_NONE)>::value;
     PreRuntimeDispatch::store_at<expanded_decorators>(base, offset, decayed_value);
   }
 
@@ -1221,7 +1221,7 @@
     // Potentially remember if we need compressed oop awareness
     const DecoratorSet expanded_decorators = DecoratorFixup<decorators |
                                              (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ?
-                                              INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY)>::value;
+                                              INTERNAL_CONVERT_COMPRESSED_OOP : DECORATORS_NONE)>::value;
     return PreRuntimeDispatch::load_at<expanded_decorators, DecayedT>(base, offset);
   }
 
@@ -1253,7 +1253,7 @@
     // Potentially remember that we need compressed oop awareness
     const DecoratorSet final_decorators = expanded_decorators |
                                           (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ?
-                                           INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY);
+                                           INTERNAL_CONVERT_COMPRESSED_OOP : DECORATORS_NONE);
     return PreRuntimeDispatch::atomic_cmpxchg_at<final_decorators>(new_decayed_value, base,
                                                                    offset, compare_decayed_value);
   }
@@ -1278,7 +1278,7 @@
     // atomic_xchg is only available in SEQ_CST flavour.
     const DecoratorSet expanded_decorators = DecoratorFixup<decorators | MO_SEQ_CST |
                                              (HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value ?
-                                              INTERNAL_CONVERT_COMPRESSED_OOP : INTERNAL_EMPTY)>::value;
+                                              INTERNAL_CONVERT_COMPRESSED_OOP : DECORATORS_NONE)>::value;
     return PreRuntimeDispatch::atomic_xchg_at<expanded_decorators>(new_decayed_value, base, offset);
   }
 
--- a/src/hotspot/share/oops/accessDecorators.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/oops/accessDecorators.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -43,12 +43,14 @@
 template <DecoratorSet decorators, DecoratorSet decorator>
 struct HasDecorator: public IntegralConstant<bool, (decorators & decorator) != 0> {};
 
+// == General Decorators ==
+// * DECORATORS_NONE: This is the name for the empty decorator set (in absence of other decorators).
+const DecoratorSet DECORATORS_NONE                   = UCONST64(0);
+
 // == Internal Decorators - do not use ==
-// * INTERNAL_EMPTY: This is the name for the empty decorator set (in absence of other decorators).
 // * INTERNAL_CONVERT_COMPRESSED_OOPS: This is an oop access that will require converting an oop
 //   to a narrowOop or vice versa, if UseCompressedOops is known to be set.
 // * INTERNAL_VALUE_IS_OOP: Remember that the involved access is on oop rather than primitive.
-const DecoratorSet INTERNAL_EMPTY                    = UCONST64(0);
 const DecoratorSet INTERNAL_CONVERT_COMPRESSED_OOP   = UCONST64(1) << 1;
 const DecoratorSet INTERNAL_VALUE_IS_OOP             = UCONST64(1) << 2;
 
@@ -231,13 +233,13 @@
     // If no reference strength has been picked, then strong will be picked
     static const DecoratorSet ref_strength_default = input_decorators |
       (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
-       ON_STRONG_OOP_REF : INTERNAL_EMPTY);
+       ON_STRONG_OOP_REF : DECORATORS_NONE);
     // If no memory ordering has been picked, unordered will be picked
     static const DecoratorSet memory_ordering_default = ref_strength_default |
-      ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY);
+      ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : DECORATORS_NONE);
     // If no barrier strength has been picked, normal will be used
     static const DecoratorSet barrier_strength_default = memory_ordering_default |
-      ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
+      ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : DECORATORS_NONE);
     static const DecoratorSet value = barrier_strength_default | BT_BUILDTIME_DECORATORS;
   };
 
@@ -247,13 +249,13 @@
     // If no reference strength has been picked, then strong will be picked
     DecoratorSet ref_strength_default = input_decorators |
       (((ON_DECORATOR_MASK & input_decorators) == 0 && (INTERNAL_VALUE_IS_OOP & input_decorators) != 0) ?
-       ON_STRONG_OOP_REF : INTERNAL_EMPTY);
+       ON_STRONG_OOP_REF : DECORATORS_NONE);
     // If no memory ordering has been picked, unordered will be picked
     DecoratorSet memory_ordering_default = ref_strength_default |
-      ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : INTERNAL_EMPTY);
+      ((MO_DECORATOR_MASK & ref_strength_default) == 0 ? MO_UNORDERED : DECORATORS_NONE);
     // If no barrier strength has been picked, normal will be used
     DecoratorSet barrier_strength_default = memory_ordering_default |
-      ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : INTERNAL_EMPTY);
+      ((AS_DECORATOR_MASK & memory_ordering_default) == 0 ? AS_NORMAL : DECORATORS_NONE);
     DecoratorSet value = barrier_strength_default | BT_BUILDTIME_DECORATORS;
     return value;
   }
--- a/src/hotspot/share/opto/addnode.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/addnode.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -249,4 +249,52 @@
   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 };
 
+//------------------------------MaxFNode---------------------------------------
+// Maximum of 2 floats.
+class MaxFNode : public MaxNode {
+public:
+  MaxFNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
+  virtual int Opcode() const;
+  virtual const Type *add_ring(const Type*, const Type*) const { return Type::FLOAT; }
+  virtual const Type *add_id() const { return TypeF::NEG_INF; }
+  virtual const Type *bottom_type() const { return Type::FLOAT; }
+  virtual uint ideal_reg() const { return Op_RegF; }
+};
+
+//------------------------------MinFNode---------------------------------------
+// Minimum of 2 floats.
+class MinFNode : public MaxNode {
+public:
+  MinFNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
+  virtual int Opcode() const;
+  virtual const Type *add_ring(const Type*, const Type*) const { return Type::FLOAT; }
+  virtual const Type *add_id() const { return TypeF::POS_INF; }
+  virtual const Type *bottom_type() const { return Type::FLOAT; }
+  virtual uint ideal_reg() const { return Op_RegF; }
+};
+
+//------------------------------MaxDNode---------------------------------------
+// Maximum of 2 doubles.
+class MaxDNode : public MaxNode {
+public:
+  MaxDNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
+  virtual int Opcode() const;
+  virtual const Type *add_ring(const Type*, const Type*) const { return Type::DOUBLE; }
+  virtual const Type *add_id() const { return TypeD::NEG_INF; }
+  virtual const Type *bottom_type() const { return Type::DOUBLE; }
+  virtual uint ideal_reg() const { return Op_RegD; }
+};
+
+//------------------------------MinDNode---------------------------------------
+// Minimum of 2 doubles.
+class MinDNode : public MaxNode {
+public:
+  MinDNode(Node *in1, Node *in2) : MaxNode(in1, in2) {}
+  virtual int Opcode() const;
+  virtual const Type *add_ring(const Type*, const Type*) const { return Type::DOUBLE; }
+  virtual const Type *add_id() const { return TypeD::POS_INF; }
+  virtual const Type *bottom_type() const { return Type::DOUBLE; }
+  virtual uint ideal_reg() const { return Op_RegD; }
+};
+
 #endif // SHARE_VM_OPTO_ADDNODE_HPP
--- a/src/hotspot/share/opto/c2compiler.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/c2compiler.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -440,6 +440,18 @@
   case vmIntrinsics::_isWhitespace:
     if (!Matcher::match_rule_supported(Op_Whitespace)) return false;
     break;
+  case vmIntrinsics::_maxF:
+    if (!Matcher::match_rule_supported(Op_MaxF)) return false;
+    break;
+  case vmIntrinsics::_minF:
+    if (!Matcher::match_rule_supported(Op_MinF)) return false;
+    break;
+  case vmIntrinsics::_maxD:
+    if (!Matcher::match_rule_supported(Op_MaxD)) return false;
+    break;
+  case vmIntrinsics::_minD:
+    if (!Matcher::match_rule_supported(Op_MinD)) return false;
+    break;
   case vmIntrinsics::_hashCode:
   case vmIntrinsics::_identityHashCode:
   case vmIntrinsics::_getClass:
--- a/src/hotspot/share/opto/classes.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/classes.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -202,6 +202,8 @@
 macro(Mach)
 macro(MachProj)
 macro(MulAddS2I)
+macro(MaxD)
+macro(MaxF)
 macro(MaxI)
 macro(MemBarAcquire)
 macro(LoadFence)
@@ -214,6 +216,8 @@
 macro(MemBarVolatile)
 macro(MemBarStoreStore)
 macro(MergeMem)
+macro(MinD)
+macro(MinF)
 macro(MinI)
 macro(ModD)
 macro(ModF)
--- a/src/hotspot/share/opto/compile.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/compile.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -3469,8 +3469,7 @@
   }
   case Op_CmpUL: {
     if (!Matcher::has_match_rule(Op_CmpUL)) {
-      // We don't support unsigned long comparisons. Set 'max_idx_expr'
-      // to max_julong if < 0 to make the signed comparison fail.
+      // No support for unsigned long comparisons
       ConINode* sign_pos = new ConINode(TypeInt::make(BitsPerLong - 1));
       Node* sign_bit_mask = new RShiftLNode(n->in(1), sign_pos);
       Node* orl = new OrLNode(n->in(1), sign_bit_mask);
--- a/src/hotspot/share/opto/library_call.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/library_call.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -325,6 +325,7 @@
   bool inline_vectorizedMismatch();
   bool inline_fma(vmIntrinsics::ID id);
   bool inline_character_compare(vmIntrinsics::ID id);
+  bool inline_fp_min_max(vmIntrinsics::ID id);
 
   bool inline_profileBoolean();
   bool inline_isCompileConstant();
@@ -874,6 +875,12 @@
   case vmIntrinsics::_isWhitespace:
     return inline_character_compare(intrinsic_id());
 
+  case vmIntrinsics::_maxF:
+  case vmIntrinsics::_minF:
+  case vmIntrinsics::_maxD:
+  case vmIntrinsics::_minD:
+    return inline_fp_min_max(intrinsic_id());
+
   default:
     // If you get here, it may be that someone has added a new intrinsic
     // to the list in vmSymbols.hpp without implementing it here.
@@ -6588,6 +6595,42 @@
   return true;
 }
 
+//------------------------------inline_fp_min_max------------------------------
+bool LibraryCallKit::inline_fp_min_max(vmIntrinsics::ID id) {
+  Node *a = NULL;
+  Node *b = NULL;
+  Node *n = NULL;
+  switch (id) {
+  case vmIntrinsics::_maxF:
+  case vmIntrinsics::_minF:
+    assert(callee()->signature()->size() == 2, "minF/maxF has 2 parameters of size 1 each.");
+    a = argument(0);
+    b = argument(1);
+    break;
+  case vmIntrinsics::_maxD:
+  case vmIntrinsics::_minD:
+    assert(callee()->signature()->size() == 4, "minD/maxD has 2 parameters of size 2 each.");
+    a = round_double_node(argument(0));
+    b = round_double_node(argument(2));
+    break;
+  default:
+    fatal_unexpected_iid(id);
+    break;
+  }
+  if (a->is_Con() || b->is_Con()) {
+    return false;
+  }
+  switch (id) {
+  case vmIntrinsics::_maxF:  n = new MaxFNode(a, b);  break;
+  case vmIntrinsics::_minF:  n = new MinFNode(a, b);  break;
+  case vmIntrinsics::_maxD:  n = new MaxDNode(a, b);  break;
+  case vmIntrinsics::_minD:  n = new MinDNode(a, b);  break;
+  default:  fatal_unexpected_iid(id);  break;
+  }
+  set_result(_gvn.transform(n));
+  return true;
+}
+
 bool LibraryCallKit::inline_profileBoolean() {
   Node* counts = argument(1);
   const TypeAryPtr* ary = NULL;
--- a/src/hotspot/share/opto/loopTransform.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/loopTransform.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -2289,9 +2289,9 @@
   register_new_node(opaque_bol, predicate_proj);
   IfNode* new_iff = NULL;
   if (overflow) {
-    new_iff = new IfNode(predicate_proj, bol, PROB_MAX, COUNT_UNKNOWN);
+    new_iff = new IfNode(predicate_proj, opaque_bol, PROB_MAX, COUNT_UNKNOWN);
   } else {
-    new_iff = new RangeCheckNode(predicate_proj, bol, PROB_MAX, COUNT_UNKNOWN);
+    new_iff = new RangeCheckNode(predicate_proj, opaque_bol, PROB_MAX, COUNT_UNKNOWN);
   }
   register_control(new_iff, loop->_parent, predicate_proj);
   Node* iffalse = new IfFalseNode(new_iff);
--- a/src/hotspot/share/opto/loopnode.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/loopnode.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -302,7 +302,7 @@
   void set_slp_max_unroll(int unroll_factor) { _slp_maximum_unroll_factor = unroll_factor; }
   int  slp_max_unroll() const                { return _slp_maximum_unroll_factor; }
 
-  virtual LoopNode* skip_strip_mined(int expect_opaq = 1);
+  virtual LoopNode* skip_strip_mined(int expect_skeleton = 1);
   OuterStripMinedLoopNode* outer_loop() const;
   virtual IfTrueNode* outer_loop_tail() const;
   virtual OuterStripMinedLoopEndNode* outer_loop_end() const;
--- a/src/hotspot/share/opto/node.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/node.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -1367,7 +1367,7 @@
         igvn->C->remove_range_check_cast(cast);
       }
       if (dead->Opcode() == Op_Opaque4) {
-        igvn->C->remove_range_check_cast(dead);
+        igvn->C->remove_opaque4_node(dead);
       }
       BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
       bs->unregister_potential_barrier_node(dead);
--- a/src/hotspot/share/opto/type.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/type.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -416,6 +416,18 @@
 
 #define SMALLINT ((juint)3)  // a value too insignificant to consider widening
 
+static double pos_dinf() {
+  union { int64_t i; double d; } v;
+  v.i = CONST64(0x7ff0000000000000);
+  return v.d;
+}
+
+static float pos_finf() {
+  union { int32_t i; float f; } v;
+  v.i = 0x7f800000;
+  return v.f;
+}
+
 //--------------------------Initialize_shared----------------------------------
 void Type::Initialize_shared(Compile* current) {
   // This method does not need to be locked because the first system
@@ -445,9 +457,13 @@
 
   TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero)
   TypeF::ONE  = TypeF::make(1.0); // Float 1
+  TypeF::POS_INF = TypeF::make(pos_finf());
+  TypeF::NEG_INF = TypeF::make(-pos_finf());
 
   TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero)
   TypeD::ONE  = TypeD::make(1.0); // Double 1
+  TypeD::POS_INF = TypeD::make(pos_dinf());
+  TypeD::NEG_INF = TypeD::make(-pos_dinf());
 
   TypeInt::MINUS_1 = TypeInt::make(-1);  // -1
   TypeInt::ZERO    = TypeInt::make( 0);  //  0
@@ -1087,6 +1103,8 @@
 // Convenience common pre-built types.
 const TypeF *TypeF::ZERO;       // Floating point zero
 const TypeF *TypeF::ONE;        // Floating point one
+const TypeF *TypeF::POS_INF;    // Floating point positive infinity
+const TypeF *TypeF::NEG_INF;    // Floating point negative infinity
 
 //------------------------------make-------------------------------------------
 // Create a float constant
@@ -1195,6 +1213,8 @@
 // Convenience common pre-built types.
 const TypeD *TypeD::ZERO;       // Floating point zero
 const TypeD *TypeD::ONE;        // Floating point one
+const TypeD *TypeD::POS_INF;    // Floating point positive infinity
+const TypeD *TypeD::NEG_INF;    // Floating point negative infinity
 
 //------------------------------make-------------------------------------------
 const TypeD *TypeD::make(double d) {
--- a/src/hotspot/share/opto/type.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/opto/type.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -483,6 +483,8 @@
   // Convenience common pre-built types.
   static const TypeF *ZERO; // positive zero only
   static const TypeF *ONE;
+  static const TypeF *POS_INF;
+  static const TypeF *NEG_INF;
 #ifndef PRODUCT
   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
 #endif
@@ -510,6 +512,8 @@
   // Convenience common pre-built types.
   static const TypeD *ZERO; // positive zero only
   static const TypeD *ONE;
+  static const TypeD *POS_INF;
+  static const TypeD *NEG_INF;
 #ifndef PRODUCT
   virtual void dump2( Dict &d, uint depth, outputStream *st ) const;
 #endif
--- a/src/hotspot/share/prims/jni.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/prims/jni.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -823,9 +823,7 @@
 
   HOTSPOT_JNI_ISSAMEOBJECT_ENTRY(env, r1, r2);
 
-  oop a = JNIHandles::resolve(r1);
-  oop b = JNIHandles::resolve(r2);
-  jboolean ret = oopDesc::equals(a, b) ? JNI_TRUE : JNI_FALSE;
+  jboolean ret = JNIHandles::is_same_object(r1, r2) ? JNI_TRUE : JNI_FALSE;
 
   HOTSPOT_JNI_ISSAMEOBJECT_RETURN(ret);
   return ret;
--- a/src/hotspot/share/prims/jvm.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/prims/jvm.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -61,6 +61,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/jfieldIDWorkaround.hpp"
@@ -1230,11 +1231,10 @@
   oop protection_domain = NULL;
 
   // Iterate through Java frames
-  RegisterMap reg_map(thread);
-  javaVFrame *vf = thread->last_java_vframe(&reg_map);
-  for (; vf != NULL; vf = vf->java_sender()) {
+  vframeStream vfst(thread);
+  for(; !vfst.at_end(); vfst.next()) {
     // get method of frame
-    Method* method = vf->method();
+    Method* method = vfst.method();
 
     // stop at the first privileged frame
     if (method->method_holder() == SystemDictionary::AccessController_klass() &&
@@ -1243,13 +1243,15 @@
       // this frame is privileged
       is_privileged = true;
 
-      javaVFrame *priv = vf;                        // executePrivileged
-      javaVFrame *caller_fr = priv->java_sender();  // doPrivileged
-      caller_fr = caller_fr->java_sender();         // caller
+      javaVFrame *priv = vfst.asJavaVFrame();       // executePrivileged
 
       StackValueCollection* locals = priv->locals();
-      privileged_context = locals->obj_at(1);
-      Handle caller      = locals->obj_at(2);
+      StackValue* ctx_sv = locals->at(1); // AccessControlContext context
+      StackValue* clr_sv = locals->at(2); // Class<?> caller
+      assert(!ctx_sv->obj_is_scalar_replaced(), "found scalar-replaced object");
+      assert(!clr_sv->obj_is_scalar_replaced(), "found scalar-replaced object");
+      privileged_context    = ctx_sv->get_obj();
+      Handle caller         = clr_sv->get_obj();
 
       Klass *caller_klass = java_lang_Class::as_Klass(caller());
       protection_domain  = caller_klass->protection_domain();
--- a/src/hotspot/share/runtime/arguments.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/arguments.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -41,7 +41,6 @@
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/arguments.hpp"
-#include "runtime/arguments_ext.hpp"
 #include "runtime/flags/jvmFlag.hpp"
 #include "runtime/flags/jvmFlagConstraintList.hpp"
 #include "runtime/flags/jvmFlagWriteableList.hpp"
@@ -3544,9 +3543,6 @@
 
   for (int index = 0; index < args->nOptions; index++) {
     const JavaVMOption* option = args->options + index;
-    if (ArgumentsExt::process_options(option)) {
-      continue;
-    }
     if (match_option(option, "-XX:Flags=", &tail)) {
       Arguments::set_jvm_flags_file(tail);
       continue;
@@ -3813,8 +3809,6 @@
   UNSUPPORTED_OPTION(AllocateHeapAt);
 #endif
 
-  ArgumentsExt::report_unsupported_options();
-
 #ifndef PRODUCT
   if (TraceBytecodesAt != 0) {
     TraceBytecodes = true;
--- a/src/hotspot/share/runtime/arguments_ext.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2014, 2017, 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_RUNTIME_ARGUMENTS_EXT_HPP
-#define SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP
-
-#include "memory/allocation.hpp"
-#include "runtime/arguments.hpp"
-
-class ArgumentsExt: AllStatic {
-public:
-  // The argument processing extension. Returns true if there is
-  // no additional parsing needed in Arguments::parse() for the option.
-  // Otherwise returns false.
-  static inline bool process_options(const JavaVMOption *option) { return false; }
-  static inline void report_unsupported_options() { }
-};
-
-#endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP
--- a/src/hotspot/share/runtime/jniHandles.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/jniHandles.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -152,17 +152,11 @@
 oop JNIHandles::resolve_external_guard(jobject handle) {
   oop result = NULL;
   if (handle != NULL) {
-    result = resolve_impl<true /* external_guard */ >(handle);
+    result = resolve_impl<DECORATORS_NONE, true /* external_guard */>(handle);
   }
   return result;
 }
 
-oop JNIHandles::resolve_jweak(jweak handle) {
-  assert(handle != NULL, "precondition");
-  assert(is_jweak(handle), "precondition");
-  return NativeAccess<ON_PHANTOM_OOP_REF>::oop_load(jweak_ptr(handle));
-}
-
 bool JNIHandles::is_global_weak_cleared(jweak handle) {
   assert(handle != NULL, "precondition");
   assert(is_jweak(handle), "not a weak handle");
@@ -318,7 +312,7 @@
 class VerifyJNIHandles: public OopClosure {
 public:
   virtual void do_oop(oop* root) {
-    guarantee(oopDesc::is_oop(RawAccess<>::oop_load(root)), "Invalid oop");
+    guarantee(oopDesc::is_oop_or_null(RawAccess<>::oop_load(root)), "Invalid oop");
   }
   virtual void do_oop(narrowOop* root) { ShouldNotReachHere(); }
 };
--- a/src/hotspot/share/runtime/jniHandles.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/jniHandles.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -42,8 +42,10 @@
   inline static oop* jobject_ptr(jobject handle); // NOT jweak!
   inline static oop* jweak_ptr(jobject handle);
 
-  template<bool external_guard> inline static oop resolve_impl(jobject handle);
-  static oop resolve_jweak(jweak handle);
+  template <DecoratorSet decorators, bool external_guard> inline static oop resolve_impl(jobject handle);
+
+  // Resolve handle into oop, without keeping the object alive
+  inline static oop resolve_no_keepalive(jobject handle);
 
   // This method is not inlined in order to avoid circular includes between
   // this header file and thread.hpp.
@@ -70,6 +72,9 @@
   // Resolve externally provided handle into oop with some guards
   static oop resolve_external_guard(jobject handle);
 
+  // Check for equality without keeping objects alive
+  static bool is_same_object(jobject handle1, jobject handle2);
+
   // Local handles
   static jobject make_local(oop obj);
   static jobject make_local(JNIEnv* env, oop obj);    // Fast version when env is known
--- a/src/hotspot/share/runtime/jniHandles.inline.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/jniHandles.inline.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -49,15 +49,15 @@
 }
 
 // external_guard is true if called from resolve_external_guard.
-template<bool external_guard>
+template <DecoratorSet decorators, bool external_guard>
 inline oop JNIHandles::resolve_impl(jobject handle) {
   assert(handle != NULL, "precondition");
   assert(!current_thread_in_native(), "must not be in native");
   oop result;
   if (is_jweak(handle)) {       // Unlikely
-    result = resolve_jweak(handle);
+    result = NativeAccess<ON_PHANTOM_OOP_REF|decorators>::oop_load(jweak_ptr(handle));
   } else {
-    result = NativeAccess<>::oop_load(jobject_ptr(handle));
+    result = NativeAccess<decorators>::oop_load(jobject_ptr(handle));
     // Construction of jobjects canonicalize a null value into a null
     // jobject, so for non-jweak the pointee should never be null.
     assert(external_guard || result != NULL, "Invalid JNI handle");
@@ -68,14 +68,28 @@
 inline oop JNIHandles::resolve(jobject handle) {
   oop result = NULL;
   if (handle != NULL) {
-    result = resolve_impl<false /* external_guard */ >(handle);
+    result = resolve_impl<DECORATORS_NONE, false /* external_guard */>(handle);
   }
   return result;
 }
 
+inline oop JNIHandles::resolve_no_keepalive(jobject handle) {
+  oop result = NULL;
+  if (handle != NULL) {
+    result = resolve_impl<AS_NO_KEEPALIVE, false /* external_guard */>(handle);
+  }
+  return result;
+}
+
+inline bool JNIHandles::is_same_object(jobject handle1, jobject handle2) {
+  oop obj1 = resolve_no_keepalive(handle1);
+  oop obj2 = resolve_no_keepalive(handle2);
+  return oopDesc::equals(obj1, obj2);
+}
+
 inline oop JNIHandles::resolve_non_null(jobject handle) {
   assert(handle != NULL, "JNI handle should not be null");
-  oop result = resolve_impl<false /* external_guard */ >(handle);
+  oop result = resolve_impl<DECORATORS_NONE, false /* external_guard */>(handle);
   assert(result != NULL, "NULL read from jni handle");
   return result;
 }
--- a/src/hotspot/share/runtime/os.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/os.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -474,6 +474,7 @@
   // Ignores Thread.interrupt() (so keep it short).
   // ms = 0, will sleep for the least amount of time allowed by the OS.
   static void naked_short_sleep(jlong ms);
+  static void naked_short_nanosleep(jlong ns);
   static void infinite_sleep(); // never returns, use with CAUTION
   static void naked_yield () ;
   static OSReturn set_priority(Thread* thread, ThreadPriority priority);
--- a/src/hotspot/share/runtime/sweeper.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/sweeper.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -149,7 +149,7 @@
 long     NMethodSweeper::_last_sweep                   = 0;    // Value of _time_counter when the last sweep happened
 int      NMethodSweeper::_seen                         = 0;    // Nof. nmethod we have currently processed in current pass of CodeCache
 
-volatile bool NMethodSweeper::_should_sweep            = true; // Indicates if we should invoke the sweeper
+volatile bool NMethodSweeper::_should_sweep            = false;// Indicates if we should invoke the sweeper
 volatile bool NMethodSweeper::_force_sweep             = false;// Indicates if we should force a sweep
 volatile int  NMethodSweeper::_bytes_changed           = 0;    // Counts the total nmethod size if the nmethod changed from:
                                                                //   1) alive       -> not_entrant
@@ -717,12 +717,6 @@
     // stack we can safely convert it to a zombie method
     OrderAccess::loadload(); // _stack_traversal_mark and _state
     if (cm->can_convert_to_zombie()) {
-      // Clear ICStubs to prevent back patching stubs of zombie or flushed
-      // nmethods during the next safepoint (see ICStub::finalize).
-      {
-        CompiledICLocker ml(cm);
-        cm->clear_ic_stubs();
-      }
       // Code cache state change is tracked in make_zombie()
       cm->make_zombie();
       SWEEP(cm);
--- a/src/hotspot/share/runtime/thread.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/thread.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -231,7 +231,7 @@
   set_active_handles(NULL);
   set_free_handle_block(NULL);
   set_last_handle_mark(NULL);
-  DEBUG_ONLY(_missed_ic_stub_refill_mark = NULL);
+  DEBUG_ONLY(_missed_ic_stub_refill_verifier = NULL);
 
   // This initial value ==> never claimed.
   _oops_do_parity = 0;
--- a/src/hotspot/share/runtime/thread.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/thread.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -81,6 +81,7 @@
 
 class GCTaskQueue;
 class ThreadClosure;
+class ICRefillVerifier;
 class IdealGraphPrinter;
 
 class Metadata;
@@ -329,15 +330,15 @@
  private:
 
 #ifdef ASSERT
-  void* _missed_ic_stub_refill_mark;
+  ICRefillVerifier* _missed_ic_stub_refill_verifier;
 
  public:
-  void* missed_ic_stub_refill_mark() {
-    return _missed_ic_stub_refill_mark;
+  ICRefillVerifier* missed_ic_stub_refill_verifier() {
+    return _missed_ic_stub_refill_verifier;
   }
 
-  void set_missed_ic_stub_refill_mark(void* mark) {
-    _missed_ic_stub_refill_mark = mark;
+  void set_missed_ic_stub_refill_verifier(ICRefillVerifier* verifier) {
+    _missed_ic_stub_refill_verifier = verifier;
   }
 #endif
 
--- a/src/hotspot/share/runtime/vframe.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/vframe.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -452,8 +452,10 @@
   _stop_at_java_call_stub = stop_at_java_call_stub;
 
   // skip top frame, as it may not be at safepoint
+  _prev_frame = top_frame;
   _frame  = top_frame.sender(&_reg_map);
   while (!fill_from_frame()) {
+    _prev_frame = _frame;
     _frame = _frame.sender(&_reg_map);
   }
 }
@@ -534,6 +536,37 @@
   }
 }
 
+javaVFrame* vframeStreamCommon::asJavaVFrame() {
+  javaVFrame* result = NULL;
+  if (_mode == compiled_mode) {
+    guarantee(_frame.is_compiled_frame(), "expected compiled Java frame");
+
+    // lazy update to register map
+    bool update_map = true;
+    RegisterMap map(_thread, update_map);
+    frame f = _prev_frame.sender(&map);
+
+    guarantee(f.is_compiled_frame(), "expected compiled Java frame");
+
+    compiledVFrame* cvf = compiledVFrame::cast(vframe::new_vframe(&f, &map, _thread));
+
+    guarantee(cvf->cb() == cb(), "wrong code blob");
+
+    // get the same scope as this stream
+    cvf = cvf->at_scope(_decode_offset, _vframe_id);
+
+    guarantee(cvf->scope()->decode_offset() == _decode_offset, "wrong scope");
+    guarantee(cvf->scope()->sender_decode_offset() == _sender_decode_offset, "wrong scope");
+    guarantee(cvf->vframe_id() == _vframe_id, "wrong vframe");
+
+    result = cvf;
+  } else {
+    result = javaVFrame::cast(vframe::new_vframe(&_frame, &_reg_map, _thread));
+  }
+  guarantee(result->method() == method(), "wrong method");
+  return result;
+}
+
 
 #ifndef PRODUCT
 void vframe::print() {
--- a/src/hotspot/share/runtime/vframe.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/vframe.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -278,12 +278,16 @@
 class vframeStreamCommon : StackObj {
  protected:
   // common
+  frame        _prev_frame;
   frame        _frame;
   JavaThread*  _thread;
   RegisterMap  _reg_map;
   enum { interpreted_mode, compiled_mode, at_end_mode } _mode;
 
+  // For compiled_mode
+  int _decode_offset;
   int _sender_decode_offset;
+  int _vframe_id;
 
   // Cached information
   Method* _method;
@@ -320,6 +324,8 @@
       return (CompiledMethod*) cb();
   }
 
+  javaVFrame* asJavaVFrame();
+
   // Frame type
   inline bool is_interpreted_frame() const;
   inline bool is_entry_frame() const;
--- a/src/hotspot/share/runtime/vframe.inline.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/vframe.inline.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -44,6 +44,7 @@
 
   // handle general case
   do {
+    _prev_frame = _frame;
     _frame = _frame.sender(&_reg_map);
   } while (!fill_from_frame());
 }
@@ -59,6 +60,7 @@
 
   _frame = _thread->last_frame();
   while (!fill_from_frame()) {
+    _prev_frame = _frame;
     _frame = _frame.sender(&_reg_map);
   }
 }
@@ -68,12 +70,14 @@
     return false;
   }
   fill_from_compiled_frame(_sender_decode_offset);
+  ++_vframe_id;
   return true;
 }
 
 
 inline void vframeStreamCommon::fill_from_compiled_frame(int decode_offset) {
   _mode = compiled_mode;
+  _decode_offset = decode_offset;
 
   // Range check to detect ridiculous offsets.
   if (decode_offset == DebugInformationRecorder::serialized_null ||
@@ -118,6 +122,8 @@
 inline void vframeStreamCommon::fill_from_compiled_native_frame() {
   _mode = compiled_mode;
   _sender_decode_offset = DebugInformationRecorder::serialized_null;
+  _decode_offset = DebugInformationRecorder::serialized_null;
+  _vframe_id = 0;
   _method = nm()->method();
   _bci = 0;
 }
@@ -187,6 +193,7 @@
         decode_offset = pc_desc->scope_decode_offset();
       }
       fill_from_compiled_frame(decode_offset);
+      _vframe_id = 0;
     }
     return true;
   }
--- a/src/hotspot/share/runtime/vframe_hp.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/vframe_hp.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -252,6 +252,14 @@
   guarantee(_scope != NULL, "scope must be present");
 }
 
+compiledVFrame* compiledVFrame::at_scope(int decode_offset, int vframe_id) {
+  if (scope()->decode_offset() != decode_offset) {
+    ScopeDesc* scope = this->scope()->at_offset(decode_offset);
+    return new compiledVFrame(frame_pointer(), register_map(), thread(), scope, vframe_id);
+  }
+  assert(_vframe_id == vframe_id, "wrong frame id");
+  return this;
+}
 
 bool compiledVFrame::is_top() const {
   // FIX IT: Remove this when new native stubs are in place
--- a/src/hotspot/share/runtime/vframe_hp.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/vframe_hp.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -72,6 +72,9 @@
   // Returns the scopeDesc
   ScopeDesc* scope() const { return _scope; }
 
+  // Return the compiledVFrame for the desired scope
+  compiledVFrame* at_scope(int decode_offset, int vframe_id);
+
   // Returns SynchronizationEntryBCI or bci() (used for synchronization)
   int raw_bci() const;
 
--- a/src/hotspot/share/runtime/vmStructs.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -1516,6 +1516,10 @@
   declare_c2_type(MaxNode, AddNode)                                       \
   declare_c2_type(MaxINode, MaxNode)                                      \
   declare_c2_type(MinINode, MaxNode)                                      \
+  declare_c2_type(MaxFNode, MaxNode)                                      \
+  declare_c2_type(MinFNode, MaxNode)                                      \
+  declare_c2_type(MaxDNode, MaxNode)                                      \
+  declare_c2_type(MinDNode, MaxNode)                                      \
   declare_c2_type(StartNode, MultiNode)                                   \
   declare_c2_type(StartOSRNode, StartNode)                                \
   declare_c2_type(ParmNode, ProjNode)                                     \
--- a/src/hotspot/share/runtime/vmThread.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/runtime/vmThread.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -206,7 +206,7 @@
   if (is_armed()) {
     jlong delay = (os::javaTimeMillis() - _arm_time);
     if (delay > AbortVMOnVMOperationTimeoutDelay) {
-      fatal("VM operation took too long: " SIZE_FORMAT " ms (timeout: " SIZE_FORMAT " ms)",
+      fatal("VM operation took too long: " JLONG_FORMAT " ms (timeout: " INTX_FORMAT " ms)",
             delay, AbortVMOnVMOperationTimeoutDelay);
     }
   }
--- a/src/hotspot/share/services/diagnosticCommand.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/services/diagnosticCommand.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -34,7 +34,6 @@
 #include "runtime/vmThread.hpp"
 #include "services/diagnosticArgument.hpp"
 #include "services/diagnosticCommand.hpp"
-#include "services/diagnosticCommand_ext.hpp"
 #include "services/diagnosticFramework.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ostream.hpp"
--- a/src/hotspot/share/services/diagnosticCommand_ext.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 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.
- *
- */
-
-#ifndef SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_EXT_HPP
-#define SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_EXT_HPP
-
-#undef HAVE_EXTRA_DCMD
-
-#endif // SHARE_VM_SERVICES_DIAGNOSTICCOMMAND_HPP
--- a/src/hotspot/share/utilities/spinYield.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/utilities/spinYield.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -27,12 +27,13 @@
 #include "utilities/ostream.hpp"
 #include "utilities/spinYield.hpp"
 
-SpinYield::SpinYield(uint spin_limit, uint yield_limit) :
+SpinYield::SpinYield(uint spin_limit, uint yield_limit, uint sleep_ns) :
   _sleep_time(),
   _spins(0),
   _yields(0),
   _spin_limit(os::is_MP() ? spin_limit : 0),
-  _yield_limit(yield_limit)
+  _yield_limit(yield_limit),
+  _sleep_ns(sleep_ns)
 {}
 
 void SpinYield::yield_or_sleep() {
@@ -41,7 +42,7 @@
     os::naked_yield();
   } else {
     Ticks sleep_start = Ticks::now();
-    os::naked_short_sleep(1);
+    os::naked_short_nanosleep(_sleep_ns);
     _sleep_time += Ticks::now() - sleep_start;
   }
 }
--- a/src/hotspot/share/utilities/spinYield.hpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/hotspot/share/utilities/spinYield.hpp	Fri Dec 21 07:46:58 2018 -0500
@@ -39,16 +39,19 @@
   uint _yields;
   uint _spin_limit;
   uint _yield_limit;
+  uint _sleep_ns;
 
   void yield_or_sleep();
 
 public:
   static const uint default_spin_limit = 4096;
   static const uint default_yield_limit = 64;
+  static const uint default_sleep_ns = 1000;
 
   // spin_limit is ignored (treated as zero) when !os::is_MP().
   explicit SpinYield(uint spin_limit = default_spin_limit,
-                     uint yield_limit = default_yield_limit);
+                     uint yield_limit = default_yield_limit,
+                     uint sleep_ns = default_sleep_ns);
 
   // Perform next round of delay.
   void wait() {
--- a/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -578,13 +578,15 @@
         cssmPerror("_addItemToKeychain: SecKeychainItemImport", err);
     }
 
-    (*env)->ReleaseByteArrayElements(env, rawDataObj, rawData, JNI_ABORT);
-
     if (createdItems != NULL) {
         CFRelease(createdItems);
     }
 
 errOut:
+    if (rawData) {
+        (*env)->ReleaseByteArrayElements(env, rawDataObj, rawData, JNI_ABORT);
+    }
+
     if (passwordStrRef) CFRelease(passwordStrRef);
     if (passwordChars) {
         // clear the password and release
--- a/src/java.base/share/classes/java/lang/Math.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/java/lang/Math.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1460,6 +1460,7 @@
      * @param   b   another argument.
      * @return  the larger of {@code a} and {@code b}.
      */
+    @HotSpotIntrinsicCandidate
     public static float max(float a, float b) {
         if (a != a)
             return a;   // a is NaN
@@ -1486,6 +1487,7 @@
      * @param   b   another argument.
      * @return  the larger of {@code a} and {@code b}.
      */
+    @HotSpotIntrinsicCandidate
     public static double max(double a, double b) {
         if (a != a)
             return a;   // a is NaN
@@ -1541,6 +1543,7 @@
      * @param   b   another argument.
      * @return  the smaller of {@code a} and {@code b}.
      */
+    @HotSpotIntrinsicCandidate
     public static float min(float a, float b) {
         if (a != a)
             return a;   // a is NaN
@@ -1567,6 +1570,7 @@
      * @param   b   another argument.
      * @return  the smaller of {@code a} and {@code b}.
      */
+    @HotSpotIntrinsicCandidate
     public static double min(double a, double b) {
         if (a != a)
             return a;   // a is NaN
--- a/src/java.base/share/classes/java/lang/StrictMath.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/java/lang/StrictMath.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1154,6 +1154,7 @@
      * @param   b   another argument.
      * @return  the larger of {@code a} and {@code b}.
      */
+    @HotSpotIntrinsicCandidate
     public static float max(float a, float b) {
         return Math.max(a, b);
     }
@@ -1172,6 +1173,7 @@
      * @param   b   another argument.
      * @return  the larger of {@code a} and {@code b}.
      */
+    @HotSpotIntrinsicCandidate
     public static double max(double a, double b) {
         return Math.max(a, b);
     }
@@ -1219,6 +1221,7 @@
      * @param   b   another argument.
      * @return  the smaller of {@code a} and {@code b.}
      */
+    @HotSpotIntrinsicCandidate
     public static float min(float a, float b) {
         return Math.min(a, b);
     }
@@ -1237,6 +1240,7 @@
      * @param   b   another argument.
      * @return  the smaller of {@code a} and {@code b}.
      */
+    @HotSpotIntrinsicCandidate
     public static double min(double a, double b) {
         return Math.min(a, b);
     }
--- a/src/java.base/share/classes/java/lang/String.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/java/lang/String.java	Fri Dec 21 07:46:58 2018 -0500
@@ -664,7 +664,7 @@
      *          object.
      */
     public int length() {
-        return isLatin1() ? value.length : value.length >> UTF16;
+        return value.length >> coder();
     }
 
     /**
--- a/src/java.base/share/classes/java/math/BigDecimal.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/java/math/BigDecimal.java	Fri Dec 21 07:46:58 2018 -0500
@@ -2871,6 +2871,8 @@
      * @throws ArithmeticException if scale overflows.
      */
     public BigDecimal movePointLeft(int n) {
+        if (n == 0) return this;
+
         // Cannot use movePointRight(-n) in case of n==Integer.MIN_VALUE
         int newScale = checkScale((long)scale + n);
         BigDecimal num = new BigDecimal(intVal, intCompact, newScale, 0);
@@ -2893,6 +2895,8 @@
      * @throws ArithmeticException if scale overflows.
      */
     public BigDecimal movePointRight(int n) {
+        if (n == 0) return this;
+
         // Cannot use movePointLeft(-n) in case of n==Integer.MIN_VALUE
         int newScale = checkScale((long)scale - n);
         BigDecimal num = new BigDecimal(intVal, intCompact, newScale, 0);
--- a/src/java.base/share/classes/java/security/AccessController.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/java/security/AccessController.java	Fri Dec 21 07:46:58 2018 -0500
@@ -710,6 +710,13 @@
     }
 
     /**
+     * The value needs to be physically located in the frame, so that it
+     * can be found by a stack walk.
+     */
+    @Hidden
+    private static native void ensureMaterializedForStackWalk(Object o);
+
+    /**
      * Sanity check that the caller context is indeed privileged.
      *
      * Used by executePrivileged to make sure the frame is properly
@@ -734,6 +741,11 @@
                           AccessControlContext context,
                           Class<?> caller)
     {
+        // Ensure context has a physical value in the frame
+        if (context != null) {
+            ensureMaterializedForStackWalk(context);
+        }
+
         assert isPrivileged(); // sanity check invariant
         T result = action.run();
         assert isPrivileged(); // sanity check invariant
@@ -742,7 +754,6 @@
         // retrieved by getStackAccessControlContext().
         Reference.reachabilityFence(context);
         Reference.reachabilityFence(caller);
-        Reference.reachabilityFence(action);
         return result;
     }
 
@@ -761,6 +772,11 @@
                           Class<?> caller)
         throws Exception
     {
+        // Ensure context has a physical value in the frame
+        if (context != null) {
+            ensureMaterializedForStackWalk(context);
+        }
+
         assert isPrivileged(); // sanity check invariant
         T result = action.run();
         assert isPrivileged(); // sanity check invariant
@@ -769,7 +785,6 @@
         // retrieved by getStackAccessControlContext().
         Reference.reachabilityFence(context);
         Reference.reachabilityFence(caller);
-        Reference.reachabilityFence(action);
         return result;
     }
 
--- a/src/java.base/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/reflect/annotation/AnnotatedTypeFactory.java	Fri Dec 21 07:46:58 2018 -0500
@@ -100,12 +100,15 @@
             if (clz.getEnclosingClass() == null)
                 return addTo;
             if (Modifier.isStatic(clz.getModifiers()))
-                return nestingForType(clz.getEnclosingClass(), addTo);
+                return addTo;
             return nestingForType(clz.getEnclosingClass(), addTo.pushInner());
         } else if (type instanceof ParameterizedType) {
             ParameterizedType t = (ParameterizedType)type;
             if (t.getOwnerType() == null)
                 return addTo;
+            if (t.getRawType() instanceof Class
+                    && Modifier.isStatic(((Class) t.getRawType()).getModifiers()))
+                return addTo;
             return nestingForType(t.getOwnerType(), addTo.pushInner());
         }
         return addTo;
@@ -193,14 +196,18 @@
             if (!(type instanceof Class<?>))
                 throw new IllegalStateException("Can't compute owner");
 
-            Class<?> inner = (Class<?>)type;
-            Class<?> owner = inner.getDeclaringClass();
+            Class<?> nested = (Class<?>)type;
+            Class<?> owner = nested.getDeclaringClass();
             if (owner == null) // top-level, local or anonymous
                 return null;
-            if (inner.isPrimitive() || inner == Void.TYPE)
+            if (nested.isPrimitive() || nested == Void.TYPE)
                 return null;
 
-            LocationInfo outerLoc = nestingForType(owner, getLocation().popAllLocations((byte)1));
+            LocationInfo outerLoc = getLocation().popLocation((byte)1);
+            if (outerLoc == null) {
+              return buildAnnotatedType(owner, LocationInfo.BASE_LOCATION,
+                      EMPTY_TYPE_ANNOTATION_ARRAY, EMPTY_TYPE_ANNOTATION_ARRAY, getDecl());
+            }
             TypeAnnotation[]all = getTypeAnnotations();
             List<TypeAnnotation> l = new ArrayList<>(all.length);
 
@@ -445,7 +452,12 @@
             Type owner = getParameterizedType().getOwnerType();
             if (owner == null)
                 return null;
-            LocationInfo outerLoc = nestingForType(owner, getLocation().popAllLocations((byte)1));
+
+            LocationInfo outerLoc = getLocation().popLocation((byte)1);
+            if (outerLoc == null) {
+              return buildAnnotatedType(owner, LocationInfo.BASE_LOCATION,
+                      EMPTY_TYPE_ANNOTATION_ARRAY, EMPTY_TYPE_ANNOTATION_ARRAY, getDecl());
+            }
             TypeAnnotation[]all = getTypeAnnotations();
             List<TypeAnnotation> l = new ArrayList<>(all.length);
 
--- a/src/java.base/share/classes/sun/reflect/annotation/TypeAnnotation.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/reflect/annotation/TypeAnnotation.java	Fri Dec 21 07:46:58 2018 -0500
@@ -187,19 +187,17 @@
             return new LocationInfo(newDepth, res);
         }
 
-        /** Pop a series of locations matching {@code tag}. Stop poping as soon as a non-matching tag is found. */
-        public LocationInfo popAllLocations(byte tag) {
-            LocationInfo l = this;
-            int newDepth = l.depth;
-            while(newDepth > 0 && l.locations[newDepth - 1].tag == tag) {
-                newDepth--;
+        /**
+         * Pops a location matching {@code tag}, or returns {@code null}
+         * if no matching location was found.
+         */
+        public LocationInfo popLocation(byte tag) {
+            if (depth == 0 || locations[depth - 1].tag != tag) {
+                return null;
             }
-            if (newDepth != l.depth) {
-                Location[] res = new Location[newDepth];
-                System.arraycopy(this.locations, 0, res, 0, newDepth);
-                return new LocationInfo(newDepth, res);
-            } else
-                return l;
+            Location[] res = new Location[depth - 1];
+            System.arraycopy(locations, 0, res, 0, depth - 1);
+            return new LocationInfo(depth - 1, res);
         }
 
         public TypeAnnotation[] filter(TypeAnnotation[] ta) {
--- a/src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -770,7 +770,7 @@
          *
          * In practice, conforming CAs MUST use the key identifier method,
          * and MUST include authority key identifier extension in all CRLs
-         * issued. [section 5.2.1, RFC 2459]
+         * issued. [section 5.2.1, RFC 5280]
          */
         AuthorityKeyIdentifierExtension crlAKID = crl.getAuthKeyIdExtension();
         issuerSelector.setSkiAndSerialNumber(crlAKID);
--- a/src/java.base/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/provider/certpath/ForwardBuilder.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -668,7 +668,7 @@
      * Verifies a matching certificate.
      *
      * This method executes the validation steps in the PKIX path
-     * validation algorithm <draft-ietf-pkix-new-part1-08.txt> which were
+     * validation algorithm, RFC 5280, which were
      * not satisfied by the selection criteria used by getCertificates()
      * to find the certs and only the steps that can be executed in a
      * forward direction (target to trust anchor). Those steps that can
--- a/src/java.base/share/classes/sun/security/ssl/Alert.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/Alert.java	Fri Dec 21 07:46:58 2018 -0500
@@ -122,11 +122,17 @@
             reason = (cause != null) ? cause.getMessage() : "";
         }
 
-        SSLException ssle = (this == UNEXPECTED_MESSAGE) ?
-                new SSLProtocolException(reason) :
-                (handshakeOnly ?
-                        new SSLHandshakeException(reason) :
-                        new SSLException(reason));
+        SSLException ssle;
+        if ((cause != null) && (cause instanceof IOException)) {
+            ssle = new SSLException(reason);
+        } else if ((this == UNEXPECTED_MESSAGE)) {
+            ssle = new SSLProtocolException(reason);
+        } else if (handshakeOnly) {
+            ssle = new SSLHandshakeException(reason);
+        } else {
+            ssle = new SSLException(reason);
+        }
+
         if (cause != null) {
             ssle.initCause(cause);
         }
@@ -187,7 +193,7 @@
             //      AlertDescription description;
             //  } Alert;
             if (m.remaining() != 2) {
-                context.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid Alert message: no sufficient data");
             }
 
@@ -241,14 +247,14 @@
                 if (tc.peerUserCanceled) {
                     tc.closeOutbound();
                 } else if (tc.handshakeContext != null) {
-                    tc.fatal(Alert.UNEXPECTED_MESSAGE,
+                    throw tc.fatal(Alert.UNEXPECTED_MESSAGE,
                             "Received close_notify during handshake");
                 }
             } else if (alert == Alert.USER_CANCELED) {
                 if (level == Level.WARNING) {
                     tc.peerUserCanceled = true;
                 } else {
-                    tc.fatal(alert,
+                    throw tc.fatal(alert,
                             "Received fatal close_notify alert", true, null);
                 }
             } else if ((level == Level.WARNING) && (alert != null)) {
@@ -263,7 +269,7 @@
                             alert != Alert.NO_CERTIFICATE ||
                             (tc.sslConfig.clientAuthType !=
                                     ClientAuthType.CLIENT_AUTH_REQUESTED)) {
-                        tc.fatal(Alert.HANDSHAKE_FAILURE,
+                        throw tc.fatal(Alert.HANDSHAKE_FAILURE,
                             "received handshake warning: " + alert.description);
                     }  // Otherwise, ignore the warning
                 }   // Otherwise, ignore the warning.
@@ -276,7 +282,7 @@
                     diagnostic = "Received fatal alert: " + alert.description;
                 }
 
-                tc.fatal(alert, diagnostic, true, null);
+                throw tc.fatal(alert, diagnostic, true, null);
             }
         }
     }
--- a/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/AlpnExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -174,7 +174,8 @@
                         SSLLogger.severe(
                                 "Application protocol name cannot be empty");
                     }
-                    chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+
+                    throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                             "Application protocol name cannot be empty");
                 }
 
@@ -189,7 +190,8 @@
                                 ") exceeds the size limit (" +
                                 MAX_AP_LENGTH + " bytes)");
                     }
-                    chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+
+                    throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                                 "Application protocol name (" + ap +
                                 ") exceeds the size limit (" +
                                 MAX_AP_LENGTH + " bytes)");
@@ -204,7 +206,8 @@
                                 ") exceed the size limit (" +
                                 MAX_AP_LIST_LENGTH + " bytes)");
                     }
-                    chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+
+                    throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                                 "The configured application protocols (" +
                                 Arrays.toString(laps) +
                                 ") exceed the size limit (" +
@@ -283,8 +286,7 @@
             try {
                 spec = new AlpnSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -302,7 +304,7 @@
                 }
 
                 if (!matched) {
-                    shc.conContext.fatal(Alert.NO_APPLICATION_PROTOCOL,
+                    throw shc.conContext.fatal(Alert.NO_APPLICATION_PROTOCOL,
                             "No matching application layer protocol values");
                 }
             }   // Otherwise, applicationProtocol will be set by the
@@ -379,7 +381,8 @@
                     if ((shc.applicationProtocol == null) ||
                             (!shc.applicationProtocol.isEmpty() &&
                             !alps.contains(shc.applicationProtocol))) {
-                        shc.conContext.fatal(Alert.NO_APPLICATION_PROTOCOL,
+                        throw shc.conContext.fatal(
+                            Alert.NO_APPLICATION_PROTOCOL,
                             "No matching application layer protocol values");
                     }
                 }
@@ -391,7 +394,8 @@
                     if ((shc.applicationProtocol == null) ||
                             (!shc.applicationProtocol.isEmpty() &&
                             !alps.contains(shc.applicationProtocol))) {
-                        shc.conContext.fatal(Alert.NO_APPLICATION_PROTOCOL,
+                        throw shc.conContext.fatal(
+                            Alert.NO_APPLICATION_PROTOCOL,
                             "No matching application layer protocol values");
                     }
                 }
@@ -454,7 +458,7 @@
             if (requestedAlps == null ||
                     requestedAlps.applicationProtocols == null ||
                     requestedAlps.applicationProtocols.isEmpty()) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected " + SSLExtension.CH_ALPN.name + " extension");
             }
 
@@ -463,13 +467,12 @@
             try {
                 spec = new AlpnSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Only one application protocol is allowed.
             if (spec.applicationProtocols.size() != 1) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Invalid " + SSLExtension.CH_ALPN.name + " extension: " +
                     "Only one application protocol name " +
                     "is allowed in ServerHello message");
@@ -478,7 +481,7 @@
             // The respond application protocol must be one of the requested.
             if (!requestedAlps.applicationProtocols.containsAll(
                     spec.applicationProtocols)) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Invalid " + SSLExtension.CH_ALPN.name + " extension: " +
                     "Only client specified application protocol " +
                     "is allowed in ServerHello message");
--- a/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -153,8 +153,7 @@
             try {
                 spec = new SignatureSchemesSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -297,8 +296,7 @@
             try {
                 spec = new SignatureSchemesSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
--- a/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/CertStatusExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -606,8 +606,7 @@
             try {
                 spec = new CertStatusRequestSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -711,13 +710,13 @@
             CertStatusRequestSpec requestedCsr = (CertStatusRequestSpec)
                     chc.handshakeExtensions.get(CH_STATUS_REQUEST);
             if (requestedCsr == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected status_request extension in ServerHello");
             }
 
             // Parse the extension.
             if (buffer.hasRemaining()) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                   "Invalid status_request extension in ServerHello message: " +
                   "the extension data must be empty");
             }
@@ -964,8 +963,7 @@
             try {
                 spec = new CertStatusRequestV2Spec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -1067,13 +1065,13 @@
             CertStatusRequestV2Spec requestedCsr = (CertStatusRequestV2Spec)
                     chc.handshakeExtensions.get(CH_STATUS_REQUEST_V2);
             if (requestedCsr == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected status_request_v2 extension in ServerHello");
             }
 
             // Parse the extension.
             if (buffer.hasRemaining()) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                   "Invalid status_request_v2 extension in ServerHello: " +
                   "the extension data must be empty");
             }
@@ -1157,10 +1155,10 @@
                                 respBytes);
                 producedData = certResp.toByteArray();
             } catch (CertificateException ce) {
-                shc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
                         "Failed to parse server certificates", ce);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.BAD_CERT_STATUS_RESPONSE,
+                throw shc.conContext.fatal(Alert.BAD_CERT_STATUS_RESPONSE,
                         "Failed to parse certificate status response", ioe);
             }
 
@@ -1188,8 +1186,7 @@
             try {
                 spec = new CertStatusResponseSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.DECODE_ERROR, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.DECODE_ERROR, ioe);
             }
 
             if (chc.sslContext.isStaplingEnabled(true)) {
--- a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java	Fri Dec 21 07:46:58 2018 -0500
@@ -111,10 +111,10 @@
                     encodedCerts.add(cert.getEncoded());
                 } catch (CertificateEncodingException cee) {
                     // unlikely
-                    handshakeContext.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw handshakeContext.conContext.fatal(
+                            Alert.INTERNAL_ERROR,
                             "Could not encode certificate (" +
                             cert.getSubjectX500Principal() + ")", cee);
-                    break;
                 }
             }
 
@@ -127,7 +127,8 @@
 
             int listLen = Record.getInt24(m);
             if (listLen > m.remaining()) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(
+                    Alert.ILLEGAL_PARAMETER,
                     "Error parsing certificate message:no sufficient data");
             }
             if (listLen > 0) {
@@ -248,10 +249,8 @@
             }
 
             if (x509Possession == null) {       // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "No expected X.509 certificate for server authentication");
-
-                return null;        // make the compiler happy
             }
 
             shc.handshakeSession.setLocalPrivateKey(
@@ -375,7 +374,7 @@
                 if (shc.sslConfig.clientAuthType !=
                         ClientAuthType.CLIENT_AUTH_REQUESTED) {
                     // unexpected or require client authentication
-                    shc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                    throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
                         "Empty server certificate chain");
                 } else {
                     return;
@@ -392,7 +391,7 @@
                                     new ByteArrayInputStream(encodedCert));
                 }
             } catch (CertificateException ce) {
-                shc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
                     "Failed to parse server certificates", ce);
             }
 
@@ -410,7 +409,7 @@
                 T12CertificateMessage certificateMessage) throws IOException {
             List<byte[]> encodedCerts = certificateMessage.encodedCertChain;
             if (encodedCerts == null || encodedCerts.isEmpty()) {
-                chc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                throw chc.conContext.fatal(Alert.BAD_CERTIFICATE,
                     "Empty server certificate chain");
             }
 
@@ -424,7 +423,7 @@
                                     new ByteArrayInputStream(encodedCert));
                 }
             } catch (CertificateException ce) {
-                chc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                throw chc.conContext.fatal(Alert.BAD_CERTIFICATE,
                     "Failed to parse server certificates", ce);
             }
 
@@ -443,7 +442,7 @@
                 if ((identityAlg == null || identityAlg.isEmpty()) &&
                         !isIdentityEquivalent(x509Certs[0],
                                 chc.reservedServerCerts[0])) {
-                    chc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                    throw chc.conContext.fatal(Alert.BAD_CERTIFICATE,
                             "server certificate change is restricted " +
                             "during renegotiation");
                 }
@@ -639,7 +638,7 @@
                 // the certificate chain in the TLS session.
                 chc.handshakeSession.setPeerCertificates(certs);
             } catch (CertificateException ce) {
-                chc.conContext.fatal(getCertificateAlert(chc, ce), ce);
+                throw chc.conContext.fatal(getCertificateAlert(chc, ce), ce);
             }
         }
 
@@ -685,7 +684,7 @@
                             "Improper X509TrustManager implementation");
                 }
             } catch (CertificateException ce) {
-                shc.conContext.fatal(Alert.CERTIFICATE_UNKNOWN, ce);
+                throw shc.conContext.fatal(Alert.CERTIFICATE_UNKNOWN, ce);
             }
         }
 
@@ -942,22 +941,20 @@
 
             SSLPossession pos = choosePossession(shc, clientHello);
             if (pos == null) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "No available authentication scheme");
-                return null;    // make the complier happy
             }
 
             if (!(pos instanceof X509Possession)) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "No X.509 certificate for server authentication");
             }
 
             X509Possession x509Possession = (X509Possession)pos;
             X509Certificate[] localCerts = x509Possession.popCerts;
             if (localCerts == null || localCerts.length == 0) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "No X.509 certificate for server authentication");
-                return null;    // make the complier happy
             }
 
             // update the context
@@ -969,9 +966,8 @@
             try {
                 cm = new T13CertificateMessage(shc, (new byte[0]), localCerts);
             } catch (SSLException | CertificateException ce) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Failed to produce server Certificate message", ce);
-                return null;    // make the complier happy
             }
 
             // Check the OCSP stapling extensions and attempt
@@ -1108,9 +1104,8 @@
                 cm = new T13CertificateMessage(
                         chc, chc.certRequestContext, localCerts);
             } catch (SSLException | CertificateException ce) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Failed to produce client Certificate message", ce);
-                return null;
             }
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                 SSLLogger.fine("Produced client Certificate message", cm);
@@ -1163,7 +1158,7 @@
             if (certificateMessage.certEntries == null ||
                     certificateMessage.certEntries.isEmpty()) {
                 if (shc.sslConfig.clientAuthType == CLIENT_AUTH_REQUIRED) {
-                    shc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                    throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
                         "Empty client certificate chain");
                 } else {
                     // optional client authentication
@@ -1187,7 +1182,7 @@
                 T13CertificateMessage certificateMessage )throws IOException {
             if (certificateMessage.certEntries == null ||
                     certificateMessage.certEntries.isEmpty()) {
-                chc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                throw chc.conContext.fatal(Alert.BAD_CERTIFICATE,
                     "Empty server certificate chain");
             }
 
@@ -1224,7 +1219,7 @@
                                     new ByteArrayInputStream(entry.encoded));
                 }
             } catch (CertificateException ce) {
-                shc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                throw shc.conContext.fatal(Alert.BAD_CERTIFICATE,
                     "Failed to parse server certificates", ce);
             }
 
@@ -1270,7 +1265,7 @@
                 // the certificate chain in the TLS session.
                 shc.handshakeSession.setPeerCertificates(certs);
             } catch (CertificateException ce) {
-                shc.conContext.fatal(Alert.CERTIFICATE_UNKNOWN, ce);
+                throw shc.conContext.fatal(Alert.CERTIFICATE_UNKNOWN, ce);
             }
 
             return certs;
@@ -1289,7 +1284,7 @@
                                     new ByteArrayInputStream(entry.encoded));
                 }
             } catch (CertificateException ce) {
-                chc.conContext.fatal(Alert.BAD_CERTIFICATE,
+                throw chc.conContext.fatal(Alert.BAD_CERTIFICATE,
                     "Failed to parse server certificates", ce);
             }
 
@@ -1326,7 +1321,7 @@
                 // the certificate chain in the TLS session.
                 chc.handshakeSession.setPeerCertificates(certs);
             } catch (CertificateException ce) {
-                chc.conContext.fatal(getCertificateAlert(chc, ce), ce);
+                throw chc.conContext.fatal(getCertificateAlert(chc, ce), ce);
             }
 
             return certs;
--- a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -171,14 +171,14 @@
             //     DistinguishedName certificate_authorities<0..2^16-1>;
             // } CertificateRequest;
             if (m.remaining() < 4) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Incorrect CertificateRequest message: no sufficient data");
             }
             this.types = Record.getBytes8(m);
 
             int listLen = Record.getInt16(m);
             if (listLen > m.remaining()) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Incorrect CertificateRequest message:no sufficient data");
             }
 
@@ -407,7 +407,7 @@
             this.types = ClientCertificateType.CERT_TYPES;
 
             if (signatureSchemes == null || signatureSchemes.isEmpty()) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "No signature algorithms specified for " +
                         "CertificateRequest hanshake message");
             }
@@ -437,7 +437,7 @@
 
             // certificate_authorities
             if (m.remaining() < 8) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid CertificateRequest handshake message: " +
                         "no sufficient data");
             }
@@ -445,14 +445,14 @@
 
             // supported_signature_algorithms
             if (m.remaining() < 6) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid CertificateRequest handshake message: " +
                         "no sufficient data");
             }
 
             byte[] algs = Record.getBytes16(m);
             if (algs == null || algs.length == 0 || (algs.length & 0x01) != 0) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid CertificateRequest handshake message: " +
                         "incomplete signature algorithms");
             }
@@ -466,14 +466,14 @@
 
             // certificate_authorities
             if (m.remaining() < 2) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid CertificateRequest handshake message: " +
                         "no sufficient data");
             }
 
             int listLen = Record.getInt16(m);
             if (listLen > m.remaining()) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid CertificateRequest message: no sufficient data");
             }
 
@@ -597,7 +597,7 @@
 
             if (shc.localSupportedSignAlgs == null ||
                     shc.localSupportedSignAlgs.isEmpty()) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No supported signature algorithm");
             }
 
@@ -783,14 +783,14 @@
             //      Extension extensions<2..2^16-1>;
             //  } CertificateRequest;
             if (m.remaining() < 5) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid CertificateRequest handshake message: " +
                         "no sufficient data");
             }
             this.requestContext = Record.getBytes8(m);
 
             if (m.remaining() < 4) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid CertificateRequest handshake message: " +
                         "no sufficient extensions data");
             }
--- a/src/java.base/share/classes/sun/security/ssl/CertificateStatus.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateStatus.java	Fri Dec 21 07:46:58 2018 -0500
@@ -154,7 +154,8 @@
                     encodedResponses.add(respDER);
                     encodedResponsesLen = 3 + respDER.length;
                 } else {
-                    handshakeContext.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw handshakeContext.conContext.fatal(
+                            Alert.HANDSHAKE_FAILURE,
                             "Zero-length OCSP Response");
                 }
             } else if (statusType == CertStatusRequestType.OCSP_MULTI) {
@@ -172,11 +173,13 @@
                 }
 
                 if (respListLen != 0) {
-                    handshakeContext.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw handshakeContext.conContext.fatal(
+                            Alert.INTERNAL_ERROR,
                             "Bad OCSP response list length");
                 }
             } else {
-                handshakeContext.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw handshakeContext.conContext.fatal(
+                        Alert.HANDSHAKE_FAILURE,
                         "Unsupported StatusResponseType: " + statusType);
             }
             messageLength = messageLength();
--- a/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java	Fri Dec 21 07:46:58 2018 -0500
@@ -83,11 +83,11 @@
                 signer.update(hashes);
                 temproary = signer.sign();
             } catch (NoSuchAlgorithmException nsae) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm (" + algorithm +
                         ") used in CertificateVerify handshake message", nsae);
             } catch (GeneralSecurityException gse) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot produce CertificateVerify signature", gse);
             }
 
@@ -112,7 +112,7 @@
             //    };
             //  } Signature;
             if (m.remaining() < 2) {
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid CertificateVerify message: no sufficient data");
             }
 
@@ -128,7 +128,7 @@
 
             if (x509Credentials == null ||
                     x509Credentials.popPublicKey == null) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No X509 credentials negotiated for CertificateVerify");
             }
 
@@ -140,15 +140,15 @@
                         shc.handshakeSession.getMasterSecret());
                 signer.update(hashes);
                 if (!signer.verify(signature)) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid CertificateVerify message: invalid signature");
                 }
             } catch (NoSuchAlgorithmException nsae) {
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm (" + algorithm +
                         ") used in CertificateVerify handshake message", nsae);
             } catch (GeneralSecurityException gse) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot verify CertificateVerify signature", gse);
             }
         }
@@ -327,11 +327,11 @@
                 signer.update(hashes);
                 temproary = signer.sign();
             } catch (NoSuchAlgorithmException nsae) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm (" + algorithm +
                         ") used in CertificateVerify handshake message", nsae);
             } catch (GeneralSecurityException gse) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Cannot produce CertificateVerify signature", gse);
             }
 
@@ -356,7 +356,7 @@
             //    };
             //  } Signature;
             if (m.remaining() < 2) {
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid CertificateVerify message: no sufficient data");
             }
 
@@ -372,7 +372,7 @@
 
             if (x509Credentials == null ||
                     x509Credentials.popPublicKey == null) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No X509 credentials negotiated for CertificateVerify");
             }
 
@@ -383,15 +383,15 @@
                 byte[] hashes = shc.handshakeHash.digest(algorithm);
                 signer.update(hashes);
                 if (!signer.verify(signature)) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid CertificateVerify message: invalid signature");
                 }
             } catch (NoSuchAlgorithmException nsae) {
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm (" + algorithm +
                         ") used in CertificateVerify handshake message", nsae);
             } catch (GeneralSecurityException gse) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot verify CertificateVerify signature", gse);
             }
         }
@@ -570,7 +570,7 @@
             if (signatureScheme == null) {
                 // Unlikely, the credentials generator should have
                 // selected the preferable signature algorithm properly.
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "No preferred signature algorithm for CertificateVerify");
             }
 
@@ -582,12 +582,12 @@
                 temproary = signer.sign();
             } catch (NoSuchAlgorithmException |
                     InvalidAlgorithmParameterException nsae) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm (" +
                         signatureScheme.name +
                         ") used in CertificateVerify handshake message", nsae);
             } catch (InvalidKeyException | SignatureException ikse) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot produce CertificateVerify signature", ikse);
             }
 
@@ -607,7 +607,7 @@
             //     opaque signature<0..2^16-1>;
             // } DigitallySigned;
             if (m.remaining() < 4) {
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid CertificateVerify message: no sufficient data");
             }
 
@@ -615,13 +615,13 @@
             int ssid = Record.getInt16(m);
             this.signatureScheme = SignatureScheme.valueOf(ssid);
             if (signatureScheme == null) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid signature algorithm (" + ssid +
                         ") used in CertificateVerify handshake message");
             }
 
             if (!shc.localSupportedSignAlgs.contains(signatureScheme)) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Unsupported signature algorithm (" +
                         signatureScheme.name +
                         ") used in CertificateVerify handshake message");
@@ -638,7 +638,7 @@
 
             if (x509Credentials == null ||
                     x509Credentials.popPublicKey == null) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No X509 credentials negotiated for CertificateVerify");
             }
 
@@ -649,17 +649,17 @@
                     signatureScheme.getSignature(x509Credentials.popPublicKey);
                 signer.update(shc.handshakeHash.archived());
                 if (!signer.verify(signature)) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid CertificateVerify signature");
                 }
             } catch (NoSuchAlgorithmException |
                     InvalidAlgorithmParameterException nsae) {
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm (" +
                         signatureScheme.name +
                         ") used in CertificateVerify handshake message", nsae);
             } catch (InvalidKeyException | SignatureException ikse) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot verify CertificateVerify signature", ikse);
             }
         }
@@ -871,7 +871,7 @@
             if (signatureScheme == null) {
                 // Unlikely, the credentials generator should have
                 // selected the preferable signature algorithm properly.
-                context.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw context.conContext.fatal(Alert.INTERNAL_ERROR,
                     "No preferred signature algorithm for CertificateVerify");
             }
 
@@ -897,12 +897,12 @@
                 temproary = signer.sign();
             } catch (NoSuchAlgorithmException |
                     InvalidAlgorithmParameterException nsae) {
-                context.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw context.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm (" +
                         signatureScheme.name +
                         ") used in CertificateVerify handshake message", nsae);
             } catch (InvalidKeyException | SignatureException ikse) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot produce CertificateVerify signature", ikse);
             }
 
@@ -918,7 +918,7 @@
             //     opaque signature<0..2^16-1>;
             // } DigitallySigned;
             if (m.remaining() < 4) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid CertificateVerify message: no sufficient data");
             }
 
@@ -926,13 +926,13 @@
             int ssid = Record.getInt16(m);
             this.signatureScheme = SignatureScheme.valueOf(ssid);
             if (signatureScheme == null) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid signature algorithm (" + ssid +
                         ") used in CertificateVerify handshake message");
             }
 
             if (!context.localSupportedSignAlgs.contains(signatureScheme)) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Unsupported signature algorithm (" +
                         signatureScheme.name +
                         ") used in CertificateVerify handshake message");
@@ -949,7 +949,7 @@
 
             if (x509Credentials == null ||
                     x509Credentials.popPublicKey == null) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No X509 credentials negotiated for CertificateVerify");
             }
 
@@ -975,17 +975,17 @@
                     signatureScheme.getSignature(x509Credentials.popPublicKey);
                 signer.update(contentCovered);
                 if (!signer.verify(signature)) {
-                    context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid CertificateVerify signature");
                 }
             } catch (NoSuchAlgorithmException |
                     InvalidAlgorithmParameterException nsae) {
-                context.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw context.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm (" +
                         signatureScheme.name +
                         ") used in CertificateVerify handshake message", nsae);
             } catch (InvalidKeyException | SignatureException ikse) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot verify CertificateVerify signature", ikse);
             }
         }
--- a/src/java.base/share/classes/sun/security/ssl/ChangeCipherSpec.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ChangeCipherSpec.java	Fri Dec 21 07:46:58 2018 -0500
@@ -105,6 +105,12 @@
                 throw new SSLException("Algorithm missing:  ", gse);
             }
 
+            if (writeCipher == null) {
+                throw hc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    "Illegal cipher suite (" + ncs +
+                    ") and protocol version (" + hc.negotiatedProtocol + ")");
+            }
+
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                 SSLLogger.fine("Produced ChangeCipherSpec message");
             }
@@ -136,7 +142,7 @@
 
             // parse
             if (message.remaining() != 1 || message.get() != 1) {
-                tc.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw tc.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Malformed or unexpected ChangeCipherSpec message");
             }
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
@@ -145,7 +151,7 @@
 
             // validate
             if (tc.handshakeContext == null) {
-                tc.fatal(Alert.HANDSHAKE_FAILURE,
+                throw tc.fatal(Alert.HANDSHAKE_FAILURE,
                         "Unexpected ChangeCipherSpec message");
             }
 
@@ -153,7 +159,7 @@
             HandshakeContext hc = tc.handshakeContext;
 
             if (hc.handshakeKeyDerivation == null) {
-                tc.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw tc.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected ChangeCipherSpec message");
             }
 
@@ -195,6 +201,14 @@
                     // unlikely
                     throw new SSLException("Algorithm missing:  ", gse);
                 }
+
+                if (readCipher == null) {
+                    throw hc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                        "Illegal cipher suite (" + hc.negotiatedCipherSuite +
+                        ") and protocol version (" + hc.negotiatedProtocol +
+                        ")");
+                }
+
                 tc.inputRecord.changeReadCiphers(readCipher);
             } else {
                 throw new UnsupportedOperationException("Not supported.");
@@ -225,7 +239,7 @@
 
             // parse
             if (message.remaining() != 1 || message.get() != 1) {
-                tc.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw tc.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Malformed or unexpected ChangeCipherSpec message");
             }
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Fri Dec 21 07:46:58 2018 -0500
@@ -144,8 +144,8 @@
                     if (id == SSLExtension.CH_PRE_SHARED_KEY.id) {
                         // ensure pre_shared_key is the last extension
                         if (remaining > 0) {
-                            tc.fatal(Alert.ILLEGAL_PARAMETER,
-                            "pre_shared_key extension is not last");
+                            throw tc.fatal(Alert.ILLEGAL_PARAMETER,
+                                    "pre_shared_key extension is not last");
                         }
                         // read only up to the IDs
                         Record.getBytes16(m);
@@ -169,7 +169,8 @@
             try {
                 sessionId.checkLength(clientVersion);
             } catch (SSLProtocolException ex) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER, ex);
+                throw handshakeContext.conContext.fatal(
+                        Alert.ILLEGAL_PARAMETER, ex);
             }
             if (isDTLS) {
                 this.cookie = Record.getBytes8(m);
@@ -179,8 +180,9 @@
 
             byte[] encodedIds = Record.getBytes16(m);
             if (encodedIds.length == 0 || (encodedIds.length & 0x01) != 0) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
-                    "Invalid ClientHello message");
+                throw handshakeContext.conContext.fatal(
+                        Alert.ILLEGAL_PARAMETER,
+                        "Invalid ClientHello message");
             }
 
             this.cipherSuiteIds = new int[encodedIds.length >> 1];
@@ -702,7 +704,8 @@
                     try {
                         chc.kickstart();
                     } catch (IOException ioe) {
-                        chc.conContext.fatal(Alert.HANDSHAKE_FAILURE, ioe);
+                        throw chc.conContext.fatal(
+                                Alert.HANDSHAKE_FAILURE, ioe);
                     }
 
                     // The handshake message has been delivered.
@@ -790,7 +793,7 @@
             // clean up this consumer
             shc.handshakeConsumers.remove(SSLHandshake.CLIENT_HELLO.id);
             if (!shc.handshakeConsumers.isEmpty()) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "No more handshake message allowed " +
                         "in a ClientHello flight");
             }
@@ -877,7 +880,7 @@
                     context.activeProtocols, chv);
             if (pv == null || pv == ProtocolVersion.NONE ||
                     pv == ProtocolVersion.SSL20Hello) {
-                context.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw context.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "Client requested protocol " +
                     ProtocolVersion.nameOf(clientHelloVersion) +
                     " is not enabled or supported in server context");
@@ -910,13 +913,11 @@
             }
 
             // No protocol version can be negotiated.
-            context.conContext.fatal(Alert.PROTOCOL_VERSION,
+            throw context.conContext.fatal(Alert.PROTOCOL_VERSION,
                 "The client supported protocol versions " + Arrays.toString(
                     ProtocolVersion.toStringArray(clientSupportedVersions)) +
                 " are not accepted by server preferences " +
                 context.activeProtocols);
-
-            return null;        // make the compiler happy
         }
     }
 
@@ -957,13 +958,13 @@
             if (shc.conContext.isNegotiated) {
                 if (!shc.conContext.secureRenegotiation &&
                         !HandshakeContext.allowUnsafeRenegotiation) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Unsafe renegotiation is not allowed");
                 }
 
                 if (ServerHandshakeContext.rejectClientInitiatedRenego &&
                         !shc.kickstartMessageDelivered) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Client initiated renegotiation is not allowed");
                 }
             }
@@ -1170,13 +1171,13 @@
                     handshakeProducer.produce(shc, clientHello);
             } else {
                 // unlikely
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No HelloRetryRequest producer: " + shc.handshakeProducers);
             }
 
             if (!shc.handshakeProducers.isEmpty()) {
                 // unlikely, but please double check.
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "unknown handshake producers: " + shc.handshakeProducers);
             }
         }
@@ -1264,13 +1265,13 @@
             if (shc.conContext.isNegotiated) {
                 if (!shc.conContext.secureRenegotiation &&
                         !HandshakeContext.allowUnsafeRenegotiation) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Unsafe renegotiation is not allowed");
                 }
 
                 if (ServerHandshakeContext.rejectClientInitiatedRenego &&
                         !shc.kickstartMessageDelivered) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Client initiated renegotiation is not allowed");
                 }
             }
--- a/src/java.base/share/classes/sun/security/ssl/ClientKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ClientKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -68,9 +68,8 @@
             }
 
             // not consumer defined.
-            chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected ClientKeyExchange handshake message.");
-            return null;    // make the compiler happe
         }
     }
 
@@ -105,7 +104,7 @@
             }
 
             // not consumer defined.
-            shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected ClientKeyExchange handshake message.");
         }
     }
--- a/src/java.base/share/classes/sun/security/ssl/CookieExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/CookieExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -163,8 +163,7 @@
             try {
                 spec = new CookieSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             shc.handshakeExtensions.put(SSLExtension.CH_COOKIE, spec);
@@ -201,9 +200,8 @@
             HelloCookieManager hcm =
                 shc.sslContext.getHelloCookieManager(shc.negotiatedProtocol);
             if (!hcm.isCookieValid(shc, clientHello, spec.cookie)) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "unrecognized cookie");
-                return;     // fatal() always throws, make the compiler happy.
             }
         }
     }
@@ -270,8 +268,7 @@
             try {
                 spec = new CookieSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             chc.handshakeExtensions.put(SSLExtension.HRR_COOKIE, spec);
--- a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -87,7 +87,7 @@
 
             if (dhePossession == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No DHE credentials negotiated for client key exchange");
             }
 
@@ -104,14 +104,14 @@
                     (ServerHandshakeContext)handshakeContext;
 
             if (m.remaining() < 3) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Invalid DH ClientKeyExchange message: insufficient data");
             }
 
             this.y = Record.getBytes16(m);
 
             if (m.hasRemaining()) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Invalid DH ClientKeyExchange message: unknown extra data");
             }
         }
@@ -177,7 +177,7 @@
             }
 
             if (dheCredentials == null) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No DHE credentials negotiated for client key exchange");
             }
 
@@ -202,7 +202,7 @@
                     chc.negotiatedProtocol);
             if (ke == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key exchange type");
             } else {
                 SSLKeyDerivation masterKD = ke.createKeyDerivation(chc);
@@ -214,7 +214,7 @@
                         SSLTrafficKeyDerivation.valueOf(chc.negotiatedProtocol);
                 if (kd == null) {
                     // unlikely
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Not supported key derivation: " +
                             chc.negotiatedProtocol);
                 } else {
@@ -254,7 +254,7 @@
 
             if (dhePossession == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No expected DHE possessions for client key exchange");
             }
 
@@ -263,7 +263,7 @@
                     shc.negotiatedProtocol);
             if (ke == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key exchange type");
             }
 
@@ -310,7 +310,7 @@
                     SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol);
             if (kd == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "Not supported key derivation: " + shc.negotiatedProtocol);
             } else {
                 shc.handshakeKeyDerivation =
--- a/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -438,7 +438,7 @@
             }
 
             if (dhePossession == null || dheCredentials == null) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No sufficient DHE key agreement parameters negotiated");
             }
 
--- a/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -106,7 +106,7 @@
 
             if (dhePossession == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No DHE credentials negotiated for server key exchange");
             }
             DHPublicKey publicKey = dhePossession.publicKey;
@@ -132,7 +132,7 @@
                     if (signatureScheme == null) {
                         // Unlikely, the credentials generator should have
                         // selected the preferable signature algorithm properly.
-                        shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                        throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "No preferred signature algorithm");
                     }
                     try {
@@ -140,7 +140,7 @@
                                 x509Possession.popPrivateKey);
                     } catch (NoSuchAlgorithmException | InvalidKeyException |
                             InvalidAlgorithmParameterException nsae) {
-                        shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                        throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Unsupported signature algorithm: " +
                             signatureScheme.name, nsae);
                     }
@@ -151,7 +151,7 @@
                                 x509Possession.popPrivateKey.getAlgorithm(),
                                 x509Possession.popPrivateKey);
                     } catch (NoSuchAlgorithmException | InvalidKeyException e) {
-                        shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                        throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Unsupported signature algorithm: " +
                             x509Possession.popPrivateKey.getAlgorithm(), e);
                     }
@@ -163,7 +163,7 @@
                             shc.serverHelloRandom.randomBytes);
                     signature = signer.sign();
                 } catch (SignatureException ex) {
-                    shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failed to sign dhe parameters: " +
                         x509Possession.popPrivateKey.getAlgorithm(), ex);
                 }
@@ -189,7 +189,7 @@
                         new BigInteger(1, p),
                         new BigInteger(1, p)));
             } catch (InvalidKeyException ike) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Invalid DH ServerKeyExchange: invalid parameters", ike);
             }
 
@@ -204,7 +204,7 @@
             if (x509Credentials == null) {
                 // anonymous, no authentication, no signature
                 if (m.hasRemaining()) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid DH ServerKeyExchange: unknown extra data");
                 }
 
@@ -221,13 +221,13 @@
                 int ssid = Record.getInt16(m);
                 signatureScheme = SignatureScheme.valueOf(ssid);
                 if (signatureScheme == null) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Invalid signature algorithm (" + ssid +
                             ") used in DH ServerKeyExchange handshake message");
                 }
 
                 if (!chc.localSupportedSignAlgs.contains(signatureScheme)) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Unsupported signature algorithm (" +
                             signatureScheme.name +
                             ") used in DH ServerKeyExchange handshake message");
@@ -245,11 +245,9 @@
                             x509Credentials.popPublicKey);
                 } catch (NoSuchAlgorithmException | InvalidKeyException |
                         InvalidAlgorithmParameterException nsae) {
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Unsupported signature algorithm: " +
                             signatureScheme.name, nsae);
-
-                    return;     // make the compiler happe
                 }
             } else {
                 try {
@@ -257,11 +255,9 @@
                             x509Credentials.popPublicKey.getAlgorithm(),
                             x509Credentials.popPublicKey);
                 } catch (NoSuchAlgorithmException | InvalidKeyException e) {
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Unsupported signature algorithm: " +
                             x509Credentials.popPublicKey.getAlgorithm(), e);
-
-                    return;     // make the compiler happe
                 }
             }
 
@@ -271,11 +267,11 @@
                         chc.serverHelloRandom.randomBytes);
 
                 if (!signer.verify(paramsSignature)) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid signature on DH ServerKeyExchange message");
                 }
             } catch (SignatureException ex) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot verify DH ServerKeyExchange signature", ex);
             }
         }
@@ -535,15 +531,13 @@
                         new BigInteger(1, skem.g));
                 publicKey = (DHPublicKey)kf.generatePublic(spec);
             } catch (GeneralSecurityException gse) {
-                chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
+                throw chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
                     "Could not generate DHPublicKey", gse);
-
-                return;     // make the compiler happy
             }
 
             if (!chc.algorithmConstraints.permits(
                     EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), publicKey)) {
-                chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
+                throw chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
                         "DH ServerKeyExchange does not comply to " +
                         "algorithm constraints");
             }
--- a/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -190,20 +190,20 @@
             }
 
             if (x509Credentials == null) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "No server certificate for ECDH client key exchange");
             }
 
             PublicKey publicKey = x509Credentials.popPublicKey;
             if (!publicKey.getAlgorithm().equals("EC")) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Not EC server certificate for ECDH client key exchange");
             }
 
             ECParameterSpec params = ((ECPublicKey)publicKey).getParams();
             NamedGroup namedGroup = NamedGroup.valueOf(params);
             if (namedGroup == null) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Unsupported EC server cert for ECDH client key exchange");
             }
 
@@ -228,7 +228,7 @@
                     chc.negotiatedProtocol);
             if (ke == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key exchange type");
             } else {
                 SSLKeyDerivation masterKD = ke.createKeyDerivation(chc);
@@ -240,7 +240,7 @@
                         SSLTrafficKeyDerivation.valueOf(chc.negotiatedProtocol);
                 if (kd == null) {
                     // unlikely
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Not supported key derivation: " +
                             chc.negotiatedProtocol);
                 } else {
@@ -280,15 +280,14 @@
 
             if (x509Possession == null) {
                 // unlikely, have been checked during cipher suite negotiation.
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "No expected EC server cert for ECDH client key exchange");
-                return;     // make the compiler happy
             }
 
             PrivateKey privateKey = x509Possession.popPrivateKey;
             if (!privateKey.getAlgorithm().equals("EC")) {
                 // unlikely, have been checked during cipher suite negotiation.
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Not EC server cert for ECDH client key exchange");
             }
 
@@ -296,7 +295,7 @@
             NamedGroup namedGroup = NamedGroup.valueOf(params);
             if (namedGroup == null) {
                 // unlikely, have been checked during cipher suite negotiation.
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Unsupported EC server cert for ECDH client key exchange");
             }
 
@@ -305,9 +304,8 @@
                     shc.negotiatedProtocol);
             if (ke == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key exchange type");
-                return;     // make the compiler happy
             }
 
             // parse the handshake message
@@ -353,7 +351,7 @@
                     SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol);
             if (kd == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "Not supported key derivation: " + shc.negotiatedProtocol);
             } else {
                 shc.handshakeKeyDerivation =
@@ -387,7 +385,7 @@
             }
 
             if (ecdheCredentials == null) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "No ECDHE credentials negotiated for client key exchange");
             }
 
@@ -412,7 +410,7 @@
                     chc.negotiatedProtocol);
             if (ke == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key exchange type");
             } else {
                 SSLKeyDerivation masterKD = ke.createKeyDerivation(chc);
@@ -424,7 +422,7 @@
                         SSLTrafficKeyDerivation.valueOf(chc.negotiatedProtocol);
                 if (kd == null) {
                     // unlikely
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Not supported key derivation: " +
                             chc.negotiatedProtocol);
                 } else {
@@ -463,16 +461,15 @@
             }
             if (ecdhePossession == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "No expected ECDHE possessions for client key exchange");
-                return;     // make the compiler happy
             }
 
             ECParameterSpec params = ecdhePossession.publicKey.getParams();
             NamedGroup namedGroup = NamedGroup.valueOf(params);
             if (namedGroup == null) {
                 // unlikely, have been checked during cipher suite negotiation.
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Unsupported EC server cert for ECDHE client key exchange");
             }
 
@@ -481,9 +478,8 @@
                     shc.negotiatedProtocol);
             if (ke == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key exchange type");
-                return;     // make the compiler happy
             }
 
             // parse the handshake message
@@ -529,7 +525,7 @@
                     SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol);
             if (kd == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "Not supported key derivation: " + shc.negotiatedProtocol);
             } else {
                 shc.handshakeKeyDerivation =
--- a/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -274,7 +274,7 @@
                 NamedGroup ng = NamedGroup.valueOf(params);
                 if (ng == null) {
                     // unlikely, have been checked during cipher suite negotiation.
-                    shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Unsupported EC server cert for ECDH key exchange");
                 }
 
@@ -295,7 +295,7 @@
             }
 
             if (x509Possession == null || ecdheCredentials == null) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No sufficient ECDHE key agreement parameters negotiated");
             }
 
@@ -327,7 +327,7 @@
                     NamedGroup namedGroup = NamedGroup.valueOf(params);
                     if (namedGroup == null) {
                         // unlikely, should have been checked previously
-                        chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                        throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                             "Unsupported EC server cert for ECDH key exchange");
                     }
 
@@ -344,7 +344,7 @@
             }
 
             if (ecdhePossession == null || x509Credentials == null) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No sufficient ECDH key agreement parameters negotiated");
             }
 
@@ -388,7 +388,7 @@
             }
 
             if (ecdhePossession == null || ecdheCredentials == null) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No sufficient ECDHE key agreement parameters negotiated");
             }
 
--- a/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -113,7 +113,7 @@
 
             if (ecdhePossession == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No ECDHE credentials negotiated for server key exchange");
             }
 
@@ -125,7 +125,7 @@
             this.namedGroup = NamedGroup.valueOf(params);
             if ((namedGroup == null) || (namedGroup.oid == null) ) {
                 // unlikely
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Unnamed EC parameter spec: " + params);
             }
 
@@ -146,7 +146,7 @@
                     if (signatureScheme == null) {
                         // Unlikely, the credentials generator should have
                         // selected the preferable signature algorithm properly.
-                        shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                        throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                                 "No preferred signature algorithm for " +
                                 x509Possession.popPrivateKey.getAlgorithm() +
                                 "  key");
@@ -156,7 +156,7 @@
                                 x509Possession.popPrivateKey);
                     } catch (NoSuchAlgorithmException | InvalidKeyException |
                             InvalidAlgorithmParameterException nsae) {
-                        shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                        throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Unsupported signature algorithm: " +
                             signatureScheme.name, nsae);
                     }
@@ -167,7 +167,7 @@
                                 x509Possession.popPrivateKey.getAlgorithm(),
                                 x509Possession.popPrivateKey);
                     } catch (NoSuchAlgorithmException | InvalidKeyException e) {
-                        shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                        throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Unsupported signature algorithm: " +
                             x509Possession.popPrivateKey.getAlgorithm(), e);
                     }
@@ -180,7 +180,7 @@
                             namedGroup.id, publicPoint);
                     signature = signer.sign();
                 } catch (SignatureException ex) {
-                    shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failed to sign ecdhe parameters: " +
                         x509Possession.popPrivateKey.getAlgorithm(), ex);
                 }
@@ -199,37 +199,37 @@
             byte curveType = (byte)Record.getInt8(m);
             if (curveType != CURVE_NAMED_CURVE) {
                 // Unlikely as only the named curves should be negotiated.
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Unsupported ECCurveType: " + curveType);
             }
 
             int namedGroupId = Record.getInt16(m);
             this.namedGroup = NamedGroup.valueOf(namedGroupId);
             if (namedGroup == null) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Unknown named group ID: " + namedGroupId);
             }
 
             if (!SupportedGroups.isSupported(namedGroup)) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Unsupported named group: " + namedGroup);
             }
 
             if (namedGroup.oid == null) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Unknown named EC curve: " + namedGroup);
             }
 
             ECParameterSpec parameters =
                     JsseJce.getECParameterSpec(namedGroup.oid);
             if (parameters == null) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No supported EC parameter: " + namedGroup);
             }
 
             publicPoint = Record.getBytes8(m);
             if (publicPoint.length == 0) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Insufficient ECPoint data: " + namedGroup);
             }
 
@@ -242,7 +242,7 @@
                     new ECPublicKeySpec(point, parameters));
             } catch (NoSuchAlgorithmException |
                     InvalidKeySpecException | IOException ex) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid ECPoint: " + namedGroup, ex);
             }
 
@@ -259,7 +259,7 @@
             if (x509Credentials == null) {
                 // anonymous, no authentication, no signature
                 if (m.hasRemaining()) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid DH ServerKeyExchange: unknown extra data");
                 }
                 this.signatureScheme = null;
@@ -275,13 +275,13 @@
                 int ssid = Record.getInt16(m);
                 signatureScheme = SignatureScheme.valueOf(ssid);
                 if (signatureScheme == null) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid signature algorithm (" + ssid +
                         ") used in ECDH ServerKeyExchange handshake message");
                 }
 
                 if (!chc.localSupportedSignAlgs.contains(signatureScheme)) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Unsupported signature algorithm (" +
                         signatureScheme.name +
                         ") used in ECDH ServerKeyExchange handshake message");
@@ -299,11 +299,9 @@
                             x509Credentials.popPublicKey);
                 } catch (NoSuchAlgorithmException | InvalidKeyException |
                         InvalidAlgorithmParameterException nsae) {
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm: " +
                         signatureScheme.name, nsae);
-
-                    return;     // make the compiler happe
                 }
             } else {
                 try {
@@ -311,11 +309,9 @@
                             x509Credentials.popPublicKey.getAlgorithm(),
                             x509Credentials.popPublicKey);
                 } catch (NoSuchAlgorithmException | InvalidKeyException e) {
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Unsupported signature algorithm: " +
                         x509Credentials.popPublicKey.getAlgorithm(), e);
-
-                    return;     // make the compiler happe
                 }
             }
 
@@ -326,11 +322,11 @@
                         namedGroup.id, publicPoint);
 
                 if (!signer.verify(paramsSignature)) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid ECDH ServerKeyExchange signature");
                 }
             } catch (SignatureException ex) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Cannot verify ECDH ServerKeyExchange signature", ex);
             }
         }
@@ -546,7 +542,7 @@
             if (!chc.algorithmConstraints.permits(
                     EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                     skem.publicKey)) {
-                chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
+                throw chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
                         "ECDH ServerKeyExchange does not comply " +
                         "to algorithm constraints");
             }
--- a/src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ECPointFormatsExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -231,13 +231,12 @@
             try {
                 spec = new ECPointFormatsSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // per RFC 4492, uncompressed points must always be supported.
             if (!spec.hasUncompressedFormat()) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Invalid ec_point_formats extension data: " +
                     "peer does not support uncompressed points");
             }
@@ -272,7 +271,7 @@
             ECPointFormatsSpec requestedSpec = (ECPointFormatsSpec)
                     chc.handshakeExtensions.get(CH_EC_POINT_FORMATS);
             if (requestedSpec == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected ec_point_formats extension in ServerHello");
             }
 
@@ -281,13 +280,12 @@
             try {
                 spec = new ECPointFormatsSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // per RFC 4492, uncompressed points must always be supported.
             if (!spec.hasUncompressedFormat()) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Invalid ec_point_formats extension data: " +
                         "peer does not support uncompressed points");
             }
--- a/src/java.base/share/classes/sun/security/ssl/EncryptedExtensions.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/EncryptedExtensions.java	Fri Dec 21 07:46:58 2018 -0500
@@ -60,7 +60,7 @@
             //     Extension extensions<0..2^16-1>;
             // } EncryptedExtensions;
             if (m.remaining() < 2) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid EncryptedExtensions handshake message: " +
                         "no sufficient data");
             }
--- a/src/java.base/share/classes/sun/security/ssl/ExtendedMasterSecretExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ExtendedMasterSecretExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -172,8 +172,7 @@
             try {
                 spec = new ExtendedMasterSecretSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             if (shc.isResumption && shc.resumingSession != null &&
@@ -232,7 +231,7 @@
                 //
                 // As if extended master extension is required for full
                 // handshake, it MUST be used in abbreviated handshake too.
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Extended Master Secret extension is required");
             }
 
@@ -242,7 +241,7 @@
                     // session used the "extended_master_secret" extension
                     // but the new ClientHello does not contain it, the
                     // server MUST abort the abbreviated handshake.
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Missing Extended Master Secret extension " +
                             "on session resumption");
                 } else {
@@ -250,7 +249,7 @@
                     // original session nor the new ClientHello uses the
                     // extension, the server SHOULD abort the handshake.
                     if (!SSLConfiguration.allowLegacyResumption) {
-                        shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                        throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Missing Extended Master Secret extension " +
                             "on session resumption");
                     } else {  // Otherwise, continue with a full handshake.
@@ -318,7 +317,7 @@
             ExtendedMasterSecretSpec requstedSpec = (ExtendedMasterSecretSpec)
                     chc.handshakeExtensions.get(CH_EXTENDED_MASTER_SECRET);
             if (requstedSpec == null) {
-                chc.conContext.fatal(Alert.UNSUPPORTED_EXTENSION,
+                throw chc.conContext.fatal(Alert.UNSUPPORTED_EXTENSION,
                         "Server sent the extended_master_secret " +
                         "extension improperly");
             }
@@ -328,13 +327,12 @@
             try {
                 spec = new ExtendedMasterSecretSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             if (chc.isResumption && chc.resumingSession != null &&
                     !chc.resumingSession.useExtendedMasterSecret) {
-                chc.conContext.fatal(Alert.UNSUPPORTED_EXTENSION,
+                throw chc.conContext.fatal(Alert.UNSUPPORTED_EXTENSION,
                         "Server sent an unexpected extended_master_secret " +
                         "extension on session resumption");
             }
@@ -364,7 +362,7 @@
                 // For full handshake, if a client receives a ServerHello
                 // without the extension, it SHOULD abort the handshake if
                 // it does not wish to interoperate with legacy servers.
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Extended Master Secret extension is required");
             }
 
@@ -374,14 +372,14 @@
                     // the "extended_master_secret" extension but the new
                     // ServerHello does not contain the extension, the client
                     // MUST abort the handshake.
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Missing Extended Master Secret extension " +
                             "on session resumption");
                 } else if (SSLConfiguration.useExtendedMasterSecret &&
                         !SSLConfiguration.allowLegacyResumption &&
                         chc.negotiatedProtocol.useTLS10PlusSpec()) {
                     // Unlikely, abbreviated handshake should be discarded.
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Extended Master Secret extension is required");
                 }
             }
--- a/src/java.base/share/classes/sun/security/ssl/Finished.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/Finished.java	Fri Dec 21 07:46:58 2018 -0500
@@ -83,7 +83,7 @@
             try {
                 vd = vds.createVerifyData(context, false);
             } catch (IOException ioe) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Failed to generate verify_data", ioe);
             }
 
@@ -102,7 +102,7 @@
             }
 
             if (m.remaining() != verifyDataLen) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Inappropriate finished message: need " + verifyDataLen +
                     " but remaining " + m.remaining() + " bytes verify_data");
             }
@@ -116,12 +116,11 @@
             try {
                 myVerifyData = vd.createVerifyData(context, true);
             } catch (IOException ioe) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Failed to generate verify_data", ioe);
-                return;     // make the compiler happy
             }
             if (!MessageDigest.isEqual(myVerifyData, verifyData)) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "The Finished message cannot be verified.");
             }
         }
@@ -518,7 +517,7 @@
             // we have received ChangeCipherSpec
             if (hc.conContext.consumers.containsKey(
                     ContentType.CHANGE_CIPHER_SPEC.id)) {
-                hc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw hc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Missing ChangeCipherSpec message");
             }
 
@@ -679,19 +678,17 @@
             SSLKeyDerivation kd = chc.handshakeKeyDerivation;
             if (kd == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "no key derivation");
-                return null;    // make the compiler happy
             }
 
             SSLTrafficKeyDerivation kdg =
                     SSLTrafficKeyDerivation.valueOf(chc.negotiatedProtocol);
             if (kdg == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key derivation: " +
                         chc.negotiatedProtocol);
-                return null;    // make the compiler happy
             }
 
             try {
@@ -713,22 +710,29 @@
                                 chc.negotiatedProtocol, writeKey, writeIv,
                                 chc.sslContext.getSecureRandom());
 
+                if (writeCipher == null) {
+                    throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                        "Illegal cipher suite (" + chc.negotiatedCipherSuite +
+                        ") and protocol version (" + chc.negotiatedProtocol +
+                        ")");
+                }
+
                 chc.baseWriteSecret = writeSecret;
                 chc.conContext.outputRecord.changeWriteCiphers(
                         writeCipher, false);
 
             } catch (GeneralSecurityException gse) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failure to derive application secrets", gse);
-                return null;    // make the compiler happy
             }
 
             // The resumption master secret is stored in the session so
             // it can be used after the handshake is completed.
             SSLSecretDerivation sd = ((SSLSecretDerivation) kd).forContext(chc);
             SecretKey resumptionMasterSecret = sd.deriveKey(
-            "TlsResumptionMasterSecret", null);
-            chc.handshakeSession.setResumptionMasterSecret(resumptionMasterSecret);
+                    "TlsResumptionMasterSecret", null);
+            chc.handshakeSession.setResumptionMasterSecret(
+                    resumptionMasterSecret);
 
             chc.conContext.conSession = chc.handshakeSession.finish();
             chc.conContext.protocolVersion = chc.negotiatedProtocol;
@@ -762,19 +766,17 @@
             SSLKeyDerivation kd = shc.handshakeKeyDerivation;
             if (kd == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "no key derivation");
-                return null;    // make the compiler happy
             }
 
             SSLTrafficKeyDerivation kdg =
                     SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol);
             if (kdg == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key derivation: " +
                         shc.negotiatedProtocol);
-                return null;    // make the compiler happy
             }
 
             // derive salt secret
@@ -810,6 +812,13 @@
                                 shc.negotiatedProtocol, writeKey, writeIv,
                                 shc.sslContext.getSecureRandom());
 
+                if (writeCipher == null) {
+                    throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                        "Illegal cipher suite (" + shc.negotiatedCipherSuite +
+                        ") and protocol version (" + shc.negotiatedProtocol +
+                        ")");
+                }
+
                 shc.baseWriteSecret = writeSecret;
                 shc.conContext.outputRecord.changeWriteCiphers(
                         writeCipher, false);
@@ -817,9 +826,8 @@
                 // update the context for the following key derivation
                 shc.handshakeKeyDerivation = secretKD;
             } catch (GeneralSecurityException gse) {
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failure to derive application secrets", gse);
-                return null;    // make the compiler happy
             }
 
             /*
@@ -892,19 +900,17 @@
             SSLKeyDerivation kd = chc.handshakeKeyDerivation;
             if (kd == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "no key derivation");
-                return;    // make the compiler happy
             }
 
             SSLTrafficKeyDerivation kdg =
                     SSLTrafficKeyDerivation.valueOf(chc.negotiatedProtocol);
             if (kdg == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key derivation: " +
                         chc.negotiatedProtocol);
-                return;    // make the compiler happy
             }
 
             // save the session
@@ -947,15 +953,21 @@
                                 chc.negotiatedProtocol, readKey, readIv,
                                 chc.sslContext.getSecureRandom());
 
+                if (readCipher == null) {
+                    throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                        "Illegal cipher suite (" + chc.negotiatedCipherSuite +
+                        ") and protocol version (" + chc.negotiatedProtocol +
+                        ")");
+                }
+
                 chc.baseReadSecret = readSecret;
                 chc.conContext.inputRecord.changeReadCiphers(readCipher);
 
                 // update the context for the following key derivation
                 chc.handshakeKeyDerivation = secretKD;
             } catch (GeneralSecurityException gse) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failure to derive application secrets", gse);
-                return;    // make the compiler happy
             }
 
             //
@@ -1003,19 +1015,17 @@
             SSLKeyDerivation kd = shc.handshakeKeyDerivation;
             if (kd == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "no key derivation");
-                return;    // make the compiler happy
             }
 
             SSLTrafficKeyDerivation kdg =
                     SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol);
             if (kdg == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key derivation: " +
                         shc.negotiatedProtocol);
-                return;    // make the compiler happy
             }
 
             // save the session
@@ -1044,20 +1054,28 @@
                                 shc.negotiatedProtocol, readKey, readIv,
                                 shc.sslContext.getSecureRandom());
 
+                if (readCipher == null) {
+                    throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                        "Illegal cipher suite (" + shc.negotiatedCipherSuite +
+                        ") and protocol version (" + shc.negotiatedProtocol +
+                        ")");
+                }
+
                 shc.baseReadSecret = readSecret;
                 shc.conContext.inputRecord.changeReadCiphers(readCipher);
 
                 // The resumption master secret is stored in the session so
                 // it can be used after the handshake is completed.
                 shc.handshakeHash.update();
-                SSLSecretDerivation sd = ((SSLSecretDerivation)kd).forContext(shc);
+                SSLSecretDerivation sd =
+                        ((SSLSecretDerivation)kd).forContext(shc);
                 SecretKey resumptionMasterSecret = sd.deriveKey(
                 "TlsResumptionMasterSecret", null);
-                shc.handshakeSession.setResumptionMasterSecret(resumptionMasterSecret);
+                shc.handshakeSession.setResumptionMasterSecret(
+                        resumptionMasterSecret);
             } catch (GeneralSecurityException gse) {
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failure to derive application secrets", gse);
-                return;    // make the compiler happy
             }
 
             //  update connection context
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java	Fri Dec 21 07:46:58 2018 -0500
@@ -365,26 +365,20 @@
         //     } Handshake;
 
         if (plaintext.contentType != ContentType.HANDSHAKE.id) {
-            conContext.fatal(Alert.INTERNAL_ERROR,
+            throw conContext.fatal(Alert.INTERNAL_ERROR,
                 "Unexpected operation for record: " + plaintext.contentType);
-
-            return 0;
         }
 
         if (plaintext.fragment == null || plaintext.fragment.remaining() < 4) {
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Invalid handshake message: insufficient data");
-
-            return 0;
         }
 
         byte handshakeType = (byte)Record.getInt8(plaintext.fragment);
         int handshakeLen = Record.getInt24(plaintext.fragment);
         if (handshakeLen != plaintext.fragment.remaining()) {
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Invalid handshake message: insufficient handshake body");
-
-            return 0;
         }
 
         return handshakeType;
@@ -438,16 +432,15 @@
         }
 
         if (consumer == null) {
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected handshake message: " +
                     SSLHandshake.nameOf(handshakeType));
-            return;
         }
 
         try {
             consumer.consume(this, fragment);
         } catch (UnsupportedOperationException unsoe) {
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unsupported handshake message: " +
                     SSLHandshake.nameOf(handshakeType), unsoe);
         }
--- a/src/java.base/share/classes/sun/security/ssl/HelloRequest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/HelloRequest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -59,7 +59,7 @@
                 ByteBuffer m) throws IOException {
             super(handshakeContext);
             if (m.hasRemaining()) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Error parsing HelloRequest message: not empty");
             }
         }
@@ -185,7 +185,7 @@
             if (!chc.kickstartMessageDelivered) {
                 if (!chc.conContext.secureRenegotiation &&
                         !HandshakeContext.allowUnsafeRenegotiation) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "Unsafe renegotiation is not allowed");
                 }
 
--- a/src/java.base/share/classes/sun/security/ssl/HelloVerifyRequest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/HelloVerifyRequest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -73,7 +73,7 @@
             //      opaque cookie<0..2^8-1>;
             //  } HelloVerifyRequest;
             if (m.remaining() < 3) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid HelloVerifyRequest: no sufficient data");
             }
 
@@ -186,7 +186,7 @@
                 chc.handshakeConsumers.remove(SSLHandshake.SERVER_HELLO.id);
             }
             if (!chc.handshakeConsumers.isEmpty()) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "No more message expected before " +
                         "HelloVerifyRequest is processed");
             }
--- a/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -337,8 +337,7 @@
             try {
                 spec = new CHKeyShareSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             List<SSLCredentials> credentials = new LinkedList<>();
@@ -610,16 +609,14 @@
             if (chc.clientRequestedNamedGroups == null ||
                     chc.clientRequestedNamedGroups.isEmpty()) {
                 // No supported groups.
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected key_share extension in ServerHello");
-                return;     // fatal() always throws, make the compiler happy.
             }
 
             // Is it a supported and enabled extension?
             if (!chc.sslConfig.isAvailable(SSLExtension.SH_KEY_SHARE)) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unsupported key_share extension in ServerHello");
-                return;     // fatal() always throws, make the compiler happy.
             }
 
             // Parse the extension
@@ -627,25 +624,22 @@
             try {
                 spec = new SHKeyShareSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             KeyShareEntry keyShare = spec.serverShare;
             NamedGroup ng = NamedGroup.valueOf(keyShare.namedGroupId);
             if (ng == null || !SupportedGroups.isActivatable(
                     chc.sslConfig.algorithmConstraints, ng)) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unsupported named group: " +
                         NamedGroup.nameOf(keyShare.namedGroupId));
-                return;     // fatal() always throws, make the compiler happy.
             }
 
             SSLKeyExchange ke = SSLKeyExchange.valueOf(ng);
             if (ke == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "No key exchange for named group " + ng.name);
-                return;     // fatal() always throws, make the compiler happy.
             }
 
             SSLCredentials credentials = null;
@@ -657,7 +651,7 @@
                         if (!chc.algorithmConstraints.permits(
                                 EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                                 ecdhec.popPublicKey)) {
-                            chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                            throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                                     "ECDHE key share entry does not " +
                                     "comply to algorithm constraints");
                         } else {
@@ -665,7 +659,7 @@
                         }
                     }
                 } catch (IOException | GeneralSecurityException ex) {
-                    chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                    throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                             "Cannot decode named group: " +
                             NamedGroup.nameOf(keyShare.namedGroupId));
                 }
@@ -677,7 +671,7 @@
                         if (!chc.algorithmConstraints.permits(
                                 EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                                 dhec.popPublicKey)) {
-                            chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                            throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                                     "DHE key share entry does not " +
                                     "comply to algorithm constraints");
                         } else {
@@ -685,18 +679,18 @@
                         }
                     }
                 } catch (IOException | GeneralSecurityException ex) {
-                    chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                    throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                             "Cannot decode named group: " +
                             NamedGroup.nameOf(keyShare.namedGroupId));
                 }
             } else {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unsupported named group: " +
                         NamedGroup.nameOf(keyShare.namedGroupId));
             }
 
             if (credentials == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unsupported named group: " + ng.name);
             }
 
@@ -794,17 +788,15 @@
 
             // Is it a supported and enabled extension?
             if (!shc.sslConfig.isAvailable(SSLExtension.HRR_KEY_SHARE)) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unsupported key_share extension in HelloRetryRequest");
-                return null;    // make the compiler happy.
             }
 
             if (shc.clientRequestedNamedGroups == null ||
                     shc.clientRequestedNamedGroups.isEmpty()) {
                 // No supported groups.
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected key_share extension in HelloRetryRequest");
-                return null;    // make the compiler happy.
             }
 
             NamedGroup selectedGroup = null;
@@ -823,9 +815,8 @@
             }
 
             if (selectedGroup == null) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
-                        new IOException("No common named group"));
-                return null;    // make the complier happy
+                throw shc.conContext.fatal(
+                        Alert.UNEXPECTED_MESSAGE, "No common named group");
             }
 
             byte[] extdata = new byte[] {
@@ -861,9 +852,8 @@
 
             // Is it a supported and enabled extension?
             if (!shc.sslConfig.isAvailable(SSLExtension.HRR_KEY_SHARE)) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unsupported key_share extension in HelloRetryRequest");
-                return null;    // make the compiler happy.
             }
 
             CHKeyShareSpec spec = (CHKeyShareSpec)shc.handshakeExtensions.get(
@@ -903,17 +893,15 @@
 
             // Is it a supported and enabled extension?
             if (!chc.sslConfig.isAvailable(SSLExtension.HRR_KEY_SHARE)) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unsupported key_share extension in HelloRetryRequest");
-                return;     // make the compiler happy.
             }
 
             if (chc.clientRequestedNamedGroups == null ||
                     chc.clientRequestedNamedGroups.isEmpty()) {
                 // No supported groups.
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected key_share extension in HelloRetryRequest");
-                return;     // make the compiler happy.
             }
 
             // Parse the extension
@@ -921,23 +909,20 @@
             try {
                 spec = new HRRKeyShareSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             NamedGroup serverGroup = NamedGroup.valueOf(spec.selectedGroup);
             if (serverGroup == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unsupported HelloRetryRequest selected group: " +
                                 NamedGroup.nameOf(spec.selectedGroup));
-                return;     // fatal() always throws, make the compiler happy.
             }
 
             if (!chc.clientRequestedNamedGroups.contains(serverGroup)) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected HelloRetryRequest selected group: " +
                                 serverGroup.name);
-                return;     // fatal() always throws, make the compiler happy.
             }
 
             // update the context
--- a/src/java.base/share/classes/sun/security/ssl/KeyUpdate.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/KeyUpdate.java	Fri Dec 21 07:46:58 2018 -0500
@@ -78,7 +78,7 @@
             super(context);
 
             if (m.remaining() != 1) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "KeyUpdate has an unexpected length of "+
                         m.remaining());
             }
@@ -86,7 +86,7 @@
             byte request = m.get();
             this.status = KeyUpdateRequest.valueOf(request);
             if (status == null) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid KeyUpdate message value: " +
                         KeyUpdateRequest.nameOf(request));
             }
@@ -198,18 +198,17 @@
                 SSLTrafficKeyDerivation.valueOf(hc.conContext.protocolVersion);
             if (kdg == null) {
                 // unlikely
-                hc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw hc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key derivation: " +
                                 hc.conContext.protocolVersion);
-                return;
             }
 
             SSLKeyDerivation skd = kdg.createKeyDerivation(hc,
                     hc.conContext.inputRecord.readCipher.baseSecret);
             if (skd == null) {
                 // unlikely
-                hc.conContext.fatal(Alert.INTERNAL_ERROR, "no key derivation");
-                return;
+                throw hc.conContext.fatal(
+                        Alert.INTERNAL_ERROR, "no key derivation");
             }
 
             SecretKey nplus1 = skd.deriveKey("TlsUpdateNplus1", null);
@@ -223,15 +222,22 @@
                         Authenticator.valueOf(hc.conContext.protocolVersion),
                         hc.conContext.protocolVersion, key, ivSpec,
                         hc.sslContext.getSecureRandom());
+
+                if (rc == null) {
+                    throw hc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                        "Illegal cipher suite (" + hc.negotiatedCipherSuite +
+                        ") and protocol version (" + hc.negotiatedProtocol +
+                        ")");
+                }
+
                 rc.baseSecret = nplus1;
                 hc.conContext.inputRecord.changeReadCiphers(rc);
                 if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
                     SSLLogger.fine("KeyUpdate: read key updated");
                 }
             } catch (GeneralSecurityException gse) {
-                hc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw hc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failure to derive read secrets", gse);
-                return;
             }
 
             if (km.status == KeyUpdateRequest.REQUESTED) {
@@ -271,18 +277,17 @@
                 SSLTrafficKeyDerivation.valueOf(hc.conContext.protocolVersion);
             if (kdg == null) {
                 // unlikely
-                hc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw hc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key derivation: " +
                                 hc.conContext.protocolVersion);
-                return null;
             }
 
             SSLKeyDerivation skd = kdg.createKeyDerivation(hc,
                     hc.conContext.outputRecord.writeCipher.baseSecret);
             if (skd == null) {
                 // unlikely
-                hc.conContext.fatal(Alert.INTERNAL_ERROR, "no key derivation");
-                return null;
+                throw hc.conContext.fatal(
+                        Alert.INTERNAL_ERROR, "no key derivation");
             }
 
             SecretKey nplus1 = skd.deriveKey("TlsUpdateNplus1", null);
@@ -298,9 +303,14 @@
                         hc.conContext.protocolVersion, key, ivSpec,
                         hc.sslContext.getSecureRandom());
             } catch (GeneralSecurityException gse) {
-                hc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw hc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failure to derive write secrets", gse);
-                return null;
+            }
+
+            if (wc == null) {
+                throw hc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    "Illegal cipher suite (" + hc.negotiatedCipherSuite +
+                    ") and protocol version (" + hc.negotiatedProtocol + ")");
             }
 
             // Output the handshake message and change the write cipher.
--- a/src/java.base/share/classes/sun/security/ssl/MaxFragExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/MaxFragExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -253,13 +253,12 @@
             try {
                 spec = new MaxFragLenSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             MaxFragLenEnum mfle = MaxFragLenEnum.valueOf(spec.id);
             if (mfle == null) {
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "the requested maximum fragment length is other " +
                     "than the allowed values");
             }
@@ -359,7 +358,7 @@
             MaxFragLenSpec requestedSpec = (MaxFragLenSpec)
                     chc.handshakeExtensions.get(CH_MAX_FRAGMENT_LENGTH);
             if (requestedSpec == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected max_fragment_length extension in ServerHello");
             }
 
@@ -368,18 +367,17 @@
             try {
                 spec = new MaxFragLenSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             if (spec.id != requestedSpec.id) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "The maximum fragment length response is not requested");
             }
 
             MaxFragLenEnum mfle = MaxFragLenEnum.valueOf(spec.id);
             if (mfle == null) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "the requested maximum fragment length is other " +
                     "than the allowed values");
             }
@@ -532,7 +530,7 @@
             MaxFragLenSpec requestedSpec = (MaxFragLenSpec)
                     chc.handshakeExtensions.get(CH_MAX_FRAGMENT_LENGTH);
             if (requestedSpec == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected max_fragment_length extension in ServerHello");
             }
 
@@ -541,18 +539,17 @@
             try {
                 spec = new MaxFragLenSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             if (spec.id != requestedSpec.id) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "The maximum fragment length response is not requested");
             }
 
             MaxFragLenEnum mfle = MaxFragLenEnum.valueOf(spec.id);
             if (mfle == null) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "the requested maximum fragment length is other " +
                     "than the allowed values");
             }
--- a/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/NewSessionTicket.java	Fri Dec 21 07:46:58 2018 -0500
@@ -86,7 +86,7 @@
             //     Extension extensions<0..2^16-2>;
             // } NewSessionTicket;
             if (m.remaining() < 14) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid NewSessionTicket message: no sufficient data");
             }
 
@@ -95,18 +95,18 @@
             this.ticketNonce = Record.getBytes8(m);
 
             if (m.remaining() < 5) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid NewSessionTicket message: no sufficient data");
             }
 
             this.ticket = Record.getBytes16(m);
             if (ticket.length == 0) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No ticket in the NewSessionTicket handshake message");
             }
 
             if (m.remaining() < 2) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid NewSessionTicket message: no sufficient data");
             }
 
--- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java	Fri Dec 21 07:46:58 2018 -0500
@@ -43,7 +43,7 @@
         super(context);
 
         if (!negotiatedProtocol.useTLS13PlusSpec()) {
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                 "Post-handshake not supported in " + negotiatedProtocol.name);
         }
 
@@ -63,16 +63,15 @@
     void dispatch(byte handshakeType, ByteBuffer fragment) throws IOException {
         SSLConsumer consumer = handshakeConsumers.get(handshakeType);
         if (consumer == null) {
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected post-handshake message: " +
                             SSLHandshake.nameOf(handshakeType));
-            return;
         }
 
         try {
             consumer.consume(this, fragment);
         } catch (UnsupportedOperationException unsoe) {
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unsupported post-handshake message: " +
                             SSLHandshake.nameOf(handshakeType), unsoe);
         }
--- a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -111,14 +111,14 @@
             //     PskBinderEntry binders<33..2^16-1>;
             // } OfferedPsks;
             if (m.remaining() < 44) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid pre_shared_key extension: " +
                     "insufficient data (length=" + m.remaining() + ")");
             }
 
             int idEncodedLength = Record.getInt16(m);
             if (idEncodedLength < 7) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Invalid pre_shared_key extension: " +
                     "insufficient identities (length=" + idEncodedLength + ")");
             }
@@ -128,7 +128,7 @@
             while (idReadLength < idEncodedLength) {
                 byte[] id = Record.getBytes16(m);
                 if (id.length < 1) {
-                    context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid pre_shared_key extension: " +
                         "insufficient identity (length=" + id.length + ")");
                 }
@@ -140,7 +140,7 @@
             }
 
             if (m.remaining() < 35) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid pre_shared_key extension: " +
                         "insufficient binders data (length=" +
                         m.remaining() + ")");
@@ -148,7 +148,7 @@
 
             int bindersEncodedLen = Record.getInt16(m);
             if (bindersEncodedLen < 33) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid pre_shared_key extension: " +
                         "insufficient binders (length=" +
                         bindersEncodedLen + ")");
@@ -159,7 +159,7 @@
             while (bindersReadLength < bindersEncodedLen) {
                 byte[] binder = Record.getBytes8(m);
                 if (binder.length < 32) {
-                    context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                             "Invalid pre_shared_key extension: " +
                             "insufficient binder entry (length=" +
                             binder.length + ")");
@@ -171,7 +171,7 @@
 
         int getIdsEncodedLength() {
             int idEncodedLength = 0;
-            for(PskIdentity curId : identities) {
+            for (PskIdentity curId : identities) {
                 idEncodedLength += curId.getEncodedLength();
             }
 
@@ -194,7 +194,7 @@
             byte[] buffer = new byte[encodedLength];
             ByteBuffer m = ByteBuffer.wrap(buffer);
             Record.putInt16(m, idsEncodedLength);
-            for(PskIdentity curId : identities) {
+            for (PskIdentity curId : identities) {
                 curId.writeEncoded(m);
             }
             Record.putInt16(m, bindersEncodedLength);
@@ -271,7 +271,7 @@
         SHPreSharedKeySpec(HandshakeContext context,
                 ByteBuffer m) throws IOException {
             if (m.remaining() < 2) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Invalid pre_shared_key extension: " +
                         "insufficient selected_identity (length=" +
                         m.remaining() + ")");
@@ -348,21 +348,20 @@
             try {
                 pskSpec = new CHPreSharedKeySpec(shc, buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // The "psk_key_exchange_modes" extension should have been loaded.
             if (!shc.handshakeExtensions.containsKey(
                     SSLExtension.PSK_KEY_EXCHANGE_MODES)) {
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Client sent PSK but not PSK modes, or the PSK " +
                         "extension is not the last extension");
             }
 
             // error if id and binder lists are not the same length
             if (pskSpec.identities.size() != pskSpec.binders.size()) {
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "PSK extension has incorrect number of binders");
             }
 
@@ -506,7 +505,7 @@
             SHPreSharedKeySpec shPsk = (SHPreSharedKeySpec)
                     shc.handshakeExtensions.get(SSLExtension.SH_PRE_SHARED_KEY);
             if (chPsk == null || shPsk == null) {
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Required extensions are unavailable");
             }
 
@@ -533,17 +532,17 @@
             HandshakeHash pskBinderHash, byte[] binder) throws IOException {
         Optional<SecretKey> pskOpt = session.getPreSharedKey();
         if (!pskOpt.isPresent()) {
-            shc.conContext.fatal(Alert.INTERNAL_ERROR,
+            throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "Session has no PSK");
         }
         SecretKey psk = pskOpt.get();
 
-        SecretKey binderKey = deriveBinderKey(psk, session);
+        SecretKey binderKey = deriveBinderKey(shc, psk, session);
         byte[] computedBinder =
-                computeBinder(binderKey, session, pskBinderHash);
+                computeBinder(shc, binderKey, session, pskBinderHash);
         if (!Arrays.equals(binder, computedBinder)) {
-            shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
-            "Incorect PSK binder value");
+            throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    "Incorect PSK binder value");
         }
     }
 
@@ -687,13 +686,14 @@
                     ageMillis + chc.resumingSession.getTicketAgeAdd();
             identities.add(new PskIdentity(chc.pskIdentity, obfuscatedAge));
 
-            SecretKey binderKey = deriveBinderKey(psk, chc.resumingSession);
+            SecretKey binderKey =
+                    deriveBinderKey(chc, psk, chc.resumingSession);
             ClientHelloMessage clientHello = (ClientHelloMessage)message;
             CHPreSharedKeySpec pskPrototype = createPskPrototype(
                 chc.resumingSession.getSuite().hashAlg.hashLength, identities);
             HandshakeHash pskBinderHash = chc.handshakeHash.copy();
 
-            byte[] binder = computeBinder(binderKey, pskBinderHash,
+            byte[] binder = computeBinder(chc, binderKey, pskBinderHash,
                     chc.resumingSession, chc, clientHello, pskPrototype);
 
             List<byte[]> binders = new ArrayList<>();
@@ -717,7 +717,8 @@
         }
     }
 
-    private static byte[] computeBinder(SecretKey binderKey,
+    private static byte[] computeBinder(
+            HandshakeContext context, SecretKey binderKey,
             SSLSessionImpl session,
             HandshakeHash pskBinderHash) throws IOException {
 
@@ -726,10 +727,11 @@
         pskBinderHash.update();
         byte[] digest = pskBinderHash.digest();
 
-        return computeBinder(binderKey, session, digest);
+        return computeBinder(context, binderKey, session, digest);
     }
 
-    private static byte[] computeBinder(SecretKey binderKey,
+    private static byte[] computeBinder(
+            HandshakeContext context, SecretKey binderKey,
             HandshakeHash hash, SSLSessionImpl session,
             HandshakeContext ctx, ClientHello.ClientHelloMessage hello,
             CHPreSharedKeySpec pskPrototype) throws IOException {
@@ -745,10 +747,11 @@
         hash.update();
         byte[] digest = hash.digest();
 
-        return computeBinder(binderKey, session, digest);
+        return computeBinder(context, binderKey, session, digest);
     }
 
-    private static byte[] computeBinder(SecretKey binderKey,
+    private static byte[] computeBinder(HandshakeContext context,
+            SecretKey binderKey,
             SSLSessionImpl session, byte[] digest) throws IOException {
         try {
             CipherSuite.HashAlg hashAlg = session.getSuite().hashAlg;
@@ -766,15 +769,15 @@
                 hmac.init(finishedKey);
                 return hmac.doFinal(digest);
             } catch (NoSuchAlgorithmException | InvalidKeyException ex) {
-                throw new IOException(ex);
+                throw context.conContext.fatal(Alert.INTERNAL_ERROR, ex);
             }
         } catch (GeneralSecurityException ex) {
-            throw new IOException(ex);
+            throw context.conContext.fatal(Alert.INTERNAL_ERROR, ex);
         }
     }
 
-    private static SecretKey deriveBinderKey(SecretKey psk,
-            SSLSessionImpl session) throws IOException {
+    private static SecretKey deriveBinderKey(HandshakeContext context,
+            SecretKey psk, SSLSessionImpl session) throws IOException {
         try {
             CipherSuite.HashAlg hashAlg = session.getSuite().hashAlg;
             HKDF hkdf = new HKDF(hashAlg.name);
@@ -788,7 +791,7 @@
             return hkdf.expand(earlySecret,
                     hkdfInfo, hashAlg.hashLength, "TlsBinderKey");
         } catch (GeneralSecurityException ex) {
-            throw new IOException(ex);
+            throw context.conContext.fatal(Alert.INTERNAL_ERROR, ex);
         }
     }
 
@@ -827,7 +830,7 @@
             // Is it a response of the specific request?
             if (!chc.handshakeExtensions.containsKey(
                     SSLExtension.CH_PRE_SHARED_KEY)) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Server sent unexpected pre_shared_key extension");
             }
 
@@ -838,13 +841,13 @@
             }
 
             if (shPsk.selectedIdentity != 0) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Selected identity index is not in correct range.");
             }
 
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                 SSLLogger.fine(
-                "Resuming session: ", chc.resumingSession);
+                        "Resuming session: ", chc.resumingSession);
             }
         }
     }
--- a/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/PskKeyExchangeModesExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -201,8 +201,7 @@
             try {
                 spec = new PskKeyExchangeModesSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -324,7 +323,7 @@
             SSLExtensionSpec spec =
                 shc.handshakeExtensions.get(SSLExtension.CH_PRE_SHARED_KEY);
             if (spec != null) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "pre_shared_key key extension is offered " +
                         "without a psk_key_exchange_modes extension");
             }
--- a/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -75,7 +75,7 @@
             super(context);
 
             if (m.remaining() < 2) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Invalid RSA ClientKeyExchange message: insufficient data");
             }
 
@@ -167,14 +167,14 @@
             }
 
             if (rsaCredentials == null && x509Credentials == null) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No RSA credentials negotiated for client key exchange");
             }
 
             PublicKey publicKey = (rsaCredentials != null) ?
                     rsaCredentials.popPublicKey : x509Credentials.popPublicKey;
             if (!publicKey.getAlgorithm().equals("RSA")) {      // unlikely
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Not RSA public key for client key exchange");
             }
 
@@ -186,10 +186,8 @@
                 ckem = new RSAClientKeyExchangeMessage(
                         chc, premaster, publicKey);
             } catch (GeneralSecurityException gse) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "Cannot generate RSA premaster secret", gse);
-
-                return null;    // make the compiler happy
             }
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                 SSLLogger.fine(
@@ -205,7 +203,7 @@
                     chc.negotiatedCipherSuite.keyExchange,
                     chc.negotiatedProtocol);
             if (ke == null) {   // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key exchange type");
             } else {
                 SSLKeyDerivation masterKD = ke.createKeyDerivation(chc);
@@ -217,7 +215,7 @@
                 SSLTrafficKeyDerivation kd =
                         SSLTrafficKeyDerivation.valueOf(chc.negotiatedProtocol);
                 if (kd == null) {   // unlikely
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Not supported key derivation: " +
                             chc.negotiatedProtocol);
                 } else {
@@ -262,14 +260,14 @@
             }
 
             if (rsaPossession == null && x509Possession == null) {  // unlikely
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No RSA possessions negotiated for client key exchange");
             }
 
             PrivateKey privateKey = (rsaPossession != null) ?
                     rsaPossession.popPrivateKey : x509Possession.popPrivateKey;
             if (!privateKey.getAlgorithm().equals("RSA")) {     // unlikely
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Not RSA private key for client key exchange");
             }
 
@@ -287,7 +285,7 @@
                     RSAPremasterSecret.decode(shc, privateKey, ckem.encrypted);
                 shc.handshakeCredentials.add(premaster);
             } catch (GeneralSecurityException gse) {
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Cannot decode RSA premaster secret", gse);
             }
 
@@ -296,7 +294,7 @@
                     shc.negotiatedCipherSuite.keyExchange,
                     shc.negotiatedProtocol);
             if (ke == null) {   // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key exchange type");
             } else {
                 SSLKeyDerivation masterKD = ke.createKeyDerivation(shc);
@@ -308,7 +306,7 @@
                 SSLTrafficKeyDerivation kd =
                         SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol);
                 if (kd == null) {       // unlikely
-                    shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Not supported key derivation: " +
                             shc.negotiatedProtocol);
                 } else {
--- a/src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -274,7 +274,7 @@
             }
 
             if (premaster == null) {
-                context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw context.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No sufficient RSA key agreement parameters negotiated");
             }
 
--- a/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -94,7 +94,7 @@
                 signature = signer.sign();
             } catch (NoSuchAlgorithmException |
                     InvalidKeyException | SignatureException ex) {
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Failed to sign ephemeral RSA parameters", ex);
             }
 
@@ -122,7 +122,7 @@
             }
 
             if (x509Credentials == null) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No RSA credentials negotiated for server key exchange");
             }
 
@@ -133,12 +133,12 @@
                           chc.clientHelloRandom.randomBytes,
                           chc.serverHelloRandom.randomBytes);
                 if (!signer.verify(paramsSignature)) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid signature of RSA ServerKeyExchange message");
                 }
             } catch (NoSuchAlgorithmException |
                     InvalidKeyException | SignatureException ex) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "Failed to sign ephemeral RSA parameters", ex);
             }
         }
@@ -250,12 +250,12 @@
                 return null;
             } else if (x509Possession == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No RSA certificate negotiated for server key exchange");
             } else if (!"RSA".equals(
                     x509Possession.popPrivateKey.getAlgorithm())) {
                 // unlikely
-                shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                         "No X.509 possession can be used for " +
                         "ephemeral RSA ServerKeyExchange");
             }
@@ -312,15 +312,13 @@
                     new BigInteger(1, skem.exponent));
                 publicKey = (RSAPublicKey)kf.generatePublic(spec);
             } catch (GeneralSecurityException gse) {
-                chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
+                throw chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
                         "Could not generate RSAPublicKey", gse);
-
-                return;     // make the compiler happy
             }
 
             if (!chc.algorithmConstraints.permits(
                     EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), publicKey)) {
-                chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
+                throw chc.conContext.fatal(Alert.INSUFFICIENT_SECURITY,
                         "RSA ServerKeyExchange does not comply to " +
                         "algorithm constraints");
             }
@@ -328,7 +326,8 @@
             //
             // update
             //
-            chc.handshakeCredentials.add(new EphemeralRSACredentials(publicKey));
+            chc.handshakeCredentials.add(
+                    new EphemeralRSACredentials(publicKey));
 
             //
             // produce
--- a/src/java.base/share/classes/sun/security/ssl/RenegoInfoExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/RenegoInfoExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -185,12 +185,10 @@
                     return null;
                 } else {
                     // terminate the session.
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "insecure renegotiation is not allowed");
                 }
             }
-
-            return null;
         }
     }
 
@@ -226,14 +224,13 @@
             try {
                 spec = new RenegotiationInfoSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             if (!shc.conContext.isNegotiated) {
                 // initial handshaking.
                 if (spec.renegotiatedConnection.length != 0) {
-                    shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                    throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Invalid renegotiation_info extension data: not empty");
                 }
                 shc.conContext.secureRenegotiation = true;
@@ -241,14 +238,14 @@
                 if (!shc.conContext.secureRenegotiation) {
                     // Unexpected RI extension for insecure renegotiation,
                     // abort the handshake with a fatal handshake_failure alert.
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "The renegotiation_info is present in a insecure " +
                             "renegotiation");
                 } else {
                     // verify the client_verify_data value
                     if (!Arrays.equals(shc.conContext.clientVerifyData,
                             spec.renegotiatedConnection)) {
-                        shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                        throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                             "Invalid renegotiation_info extension data: " +
                             "incorrect verify data in ClientHello");
                     }
@@ -295,7 +292,7 @@
                 }
 
                 if (!HandshakeContext.allowLegacyHelloMessages) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Failed to negotiate the use of secure renegotiation");
                 }   // otherwise, allow legacy hello message
 
@@ -307,7 +304,7 @@
                 shc.conContext.secureRenegotiation = false;
             } else if (shc.conContext.secureRenegotiation) {
                 // Require secure renegotiation, terminate the connection.
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Inconsistent secure renegotiation indication");
             } else {    // renegotiation, not secure
                 if (HandshakeContext.allowUnsafeRenegotiation) {
@@ -320,7 +317,7 @@
                     if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                         SSLLogger.fine("Terminate insecure renegotiation");
                     }
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Unsafe renegotiation is not allowed");
                 }
             }
@@ -430,7 +427,7 @@
             if (requestedSpec == null &&
                     !chc.activeCipherSuites.contains(
                             CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV)) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "Missing renegotiation_info and SCSV detected in " +
                     "ClientHello");
             }
@@ -440,8 +437,7 @@
             try {
                 spec = new RenegotiationInfoSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
 
@@ -452,7 +448,7 @@
                 // and if it is not, MUST abort the handshake (by sending
                 // a fatal handshake_failure alert). [RFC 5746]
                 if (spec.renegotiatedConnection.length != 0) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid renegotiation_info in ServerHello: " +
                         "not empty renegotiated_connection");
                 }
@@ -467,7 +463,7 @@
                 int infoLen = chc.conContext.clientVerifyData.length +
                               chc.conContext.serverVerifyData.length;
                 if (spec.renegotiatedConnection.length != infoLen) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid renegotiation_info in ServerHello: " +
                         "invalid renegotiated_connection length (" +
                         spec.renegotiatedConnection.length + ")");
@@ -476,14 +472,14 @@
                 byte[] cvd = chc.conContext.clientVerifyData;
                 if (!Arrays.equals(spec.renegotiatedConnection,
                         0, cvd.length, cvd, 0, cvd.length)) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid renegotiation_info in ServerHello: " +
                         "unmatched client_verify_data value");
                 }
                 byte[] svd = chc.conContext.serverVerifyData;
                 if (!Arrays.equals(spec.renegotiatedConnection,
                         cvd.length, infoLen, svd, 0, svd.length)) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Invalid renegotiation_info in ServerHello: " +
                         "unmatched server_verify_data value");
                 }
@@ -516,7 +512,7 @@
             if (requestedSpec == null &&
                     !chc.activeCipherSuites.contains(
                             CipherSuite.TLS_EMPTY_RENEGOTIATION_INFO_SCSV)) {
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "Missing renegotiation_info and SCSV detected in " +
                     "ClientHello");
             }
@@ -524,7 +520,7 @@
             if (!chc.conContext.isNegotiated) {
                 // initial handshaking.
                 if (!HandshakeContext.allowLegacyHelloMessages) {
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Failed to negotiate the use of secure renegotiation");
                 }   // otherwise, allow legacy hello message
 
@@ -536,7 +532,7 @@
                 chc.conContext.secureRenegotiation = false;
             } else if (chc.conContext.secureRenegotiation) {
                 // Require secure renegotiation, terminate the connection.
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Inconsistent secure renegotiation indication");
             } else {    // renegotiation, not secure
                 if (HandshakeContext.allowUnsafeRenegotiation) {
@@ -549,7 +545,7 @@
                     if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                         SSLLogger.fine("Terminate insecure renegotiation");
                     }
-                    chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Unsafe renegotiation is not allowed");
                 }
             }
--- a/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java	Fri Dec 21 07:46:58 2018 -0500
@@ -29,8 +29,6 @@
 import java.security.AccessController;
 import java.security.AlgorithmConstraints;
 import java.security.NoSuchAlgorithmException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
--- a/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java	Fri Dec 21 07:46:58 2018 -0500
@@ -102,10 +102,10 @@
         try {
             conContext.kickstart();
         } catch (IOException ioe) {
-            conContext.fatal(Alert.HANDSHAKE_FAILURE,
+            throw conContext.fatal(Alert.HANDSHAKE_FAILURE,
                 "Couldn't kickstart handshaking", ioe);
         } catch (Exception ex) {     // including RuntimeException
-            conContext.fatal(Alert.INTERNAL_ERROR,
+            throw conContext.fatal(Alert.INTERNAL_ERROR,
                 "Fail to begin handshake", ex);
         }
     }
@@ -137,16 +137,14 @@
                 srcs, srcsOffset, srcsLength, dsts, dstsOffset, dstsLength);
         } catch (SSLProtocolException spe) {
             // may be an unexpected handshake message
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE, spe);
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE, spe);
         } catch (IOException ioe) {
-            conContext.fatal(Alert.INTERNAL_ERROR,
+            throw conContext.fatal(Alert.INTERNAL_ERROR,
                 "problem wrapping app data", ioe);
         } catch (Exception ex) {     // including RuntimeException
-            conContext.fatal(Alert.INTERNAL_ERROR,
+            throw conContext.fatal(Alert.INTERNAL_ERROR,
                 "Fail to wrap application data", ex);
         }
-
-        return null;    // make compiler happy
     }
 
     private SSLEngineResult writeRecord(
@@ -275,9 +273,9 @@
                 srcs, srcsOffset, srcsLength, dsts, dstsOffset, dstsLength);
         } catch (SSLHandshakeException she) {
             // may be record sequence number overflow
-            conContext.fatal(Alert.HANDSHAKE_FAILURE, she);
+            throw conContext.fatal(Alert.HANDSHAKE_FAILURE, she);
         } catch (IOException e) {
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE, e);
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE, e);
         }
 
         if (ciphertext == null) {
@@ -444,7 +442,7 @@
                 srcs, srcsOffset, srcsLength, dsts, dstsOffset, dstsLength);
         } catch (SSLProtocolException spe) {
             // may be an unexpected handshake message
-            conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     spe.getMessage(), spe);
         } catch (IOException ioe) {
             /*
@@ -453,14 +451,12 @@
              * got us into this situation, so report that much back.
              * Our days of consuming are now over anyway.
              */
-            conContext.fatal(Alert.INTERNAL_ERROR,
+            throw conContext.fatal(Alert.INTERNAL_ERROR,
                     "problem unwrapping net record", ioe);
         } catch (Exception ex) {     // including RuntimeException
-            conContext.fatal(Alert.INTERNAL_ERROR,
+            throw conContext.fatal(Alert.INTERNAL_ERROR,
                 "Fail to unwrap network record", ex);
         }
-
-        return null;    // make compiler happy
     }
 
     private SSLEngineResult readRecord(
@@ -721,7 +717,7 @@
         if (!conContext.isInputCloseNotified &&
             (conContext.isNegotiated || conContext.handshakeContext != null)) {
 
-            conContext.fatal(Alert.INTERNAL_ERROR,
+            throw conContext.fatal(Alert.INTERNAL_ERROR,
                     "closing inbound before receiving peer's close_notify");
         }
 
--- a/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLExtensions.java	Fri Dec 21 07:46:58 2018 -0500
@@ -60,7 +60,8 @@
             int extId = Record.getInt16(m);
             int extLen = Record.getInt16(m);
             if (extLen > m.remaining()) {
-                hm.handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw hm.handshakeContext.conContext.fatal(
+                        Alert.ILLEGAL_PARAMETER,
                         "Error parsing extension (" + extId +
                         "): no sufficient data");
             }
@@ -86,7 +87,7 @@
                                 "in the ServerHello handshake message");
                     }
                 } else {
-                    hm.handshakeContext.conContext.fatal(
+                    throw hm.handshakeContext.conContext.fatal(
                         Alert.UNSUPPORTED_EXTENSION,
                         "extension (" + extId +
                         ") should not be presented in " + handshakeType.name);
@@ -102,7 +103,7 @@
                     }
 
                     if (extension.handshakeType != handshakeType) {
-                        hm.handshakeContext.conContext.fatal(
+                        throw hm.handshakeContext.conContext.fatal(
                                 Alert.UNSUPPORTED_EXTENSION,
                                 "extension (" + extId + ") should not be " +
                                 "presented in " + handshakeType.name);
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java	Fri Dec 21 07:46:58 2018 -0500
@@ -402,7 +402,7 @@
                     readHandshakeRecord();
                 }
             } catch (IOException ioe) {
-                conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Couldn't kickstart handshaking", ioe);
             } catch (Exception oe) {    // including RuntimeException
                 handleException(oe);
@@ -608,7 +608,12 @@
             }
         } else {
             if (!conContext.isInboundClosed()) {
-                conContext.inputRecord.close();
+                try (conContext.inputRecord) {
+                    // Try the best to use up the input records and close the
+                    // socket gracefully, without impact the performance too
+                    // much.
+                    appInput.deplete();
+                }
             }
 
             if ((autoClose || !isLayered()) && !super.isInputShutdown()) {
@@ -642,7 +647,7 @@
         if (checkCloseNotify && !conContext.isInputCloseNotified &&
             (conContext.isNegotiated || conContext.handshakeContext != null)) {
 
-            conContext.fatal(Alert.INTERNAL_ERROR,
+            throw conContext.fatal(Alert.INTERNAL_ERROR,
                     "closing inbound before receiving peer's close_notify");
         }
 
@@ -907,6 +912,30 @@
 
             return false;
         }
+
+        /**
+         * Try the best to use up the input records so as to close the
+         * socket gracefully, without impact the performance too much.
+         */
+        private synchronized void deplete() {
+            if (!conContext.isInboundClosed()) {
+                if (!(conContext.inputRecord instanceof SSLSocketInputRecord)) {
+                    return;
+                }
+
+                SSLSocketInputRecord socketInputRecord =
+                        (SSLSocketInputRecord)conContext.inputRecord;
+                try {
+                    socketInputRecord.deplete(
+                        conContext.isNegotiated && (getSoTimeout() > 0));
+                } catch (IOException ioe) {
+                    if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
+                        SSLLogger.warning(
+                            "input stream close depletion failed", ioe);
+                    }
+                }
+            }
+        }
     }
 
     @Override
@@ -982,9 +1011,9 @@
                 conContext.outputRecord.deliver(b, off, len);
             } catch (SSLHandshakeException she) {
                 // may be record sequence number overflow
-                conContext.fatal(Alert.HANDSHAKE_FAILURE, she);
+                throw conContext.fatal(Alert.HANDSHAKE_FAILURE, she);
             } catch (IOException e) {
-                conContext.fatal(Alert.UNEXPECTED_MESSAGE, e);
+                throw conContext.fatal(Alert.UNEXPECTED_MESSAGE, e);
             }
 
             // Is the sequence number is nearly overflow, or has the key usage
@@ -1309,7 +1338,8 @@
                 alert = Alert.INTERNAL_ERROR;
             }
         }
-        conContext.fatal(alert, cause);
+
+        throw conContext.fatal(alert, cause);
     }
 
     private Plaintext handleEOF(EOFException eofe) throws IOException {
--- a/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketInputRecord.java	Fri Dec 21 07:46:58 2018 -0500
@@ -463,4 +463,17 @@
 
         return n;
     }
+
+    // Try to use up the input stream without impact the performance too much.
+    void deplete(boolean tryToRead) throws IOException {
+        int remaining = is.available();
+        if (tryToRead && (remaining == 0)) {
+            // try to wait and read one byte if no buffered input
+            is.read();
+        }
+
+        while ((remaining = is.available()) != 0) {
+            is.skip(remaining);
+        }
+    }
 }
--- a/src/java.base/share/classes/sun/security/ssl/SSLTransport.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLTransport.java	Fri Dec 21 07:46:58 2018 -0500
@@ -115,7 +115,7 @@
                 }
             }
 
-            context.fatal(Alert.UNEXPECTED_MESSAGE, unsoe);
+            throw context.fatal(Alert.UNEXPECTED_MESSAGE, unsoe);
         } catch (BadPaddingException bpe) {
             /*
              * The basic SSLv3 record protection involves (optional)
@@ -126,15 +126,15 @@
             Alert alert = (context.handshakeContext != null) ?
                     Alert.HANDSHAKE_FAILURE :
                     Alert.BAD_RECORD_MAC;
-            context.fatal(alert, bpe);
+            throw context.fatal(alert, bpe);
         } catch (SSLHandshakeException she) {
             // may be record sequence number overflow
-            context.fatal(Alert.HANDSHAKE_FAILURE, she);
+            throw context.fatal(Alert.HANDSHAKE_FAILURE, she);
         } catch (EOFException eofe) {
             // rethrow EOFException, the call will handle it if neede.
             throw eofe;
         } catch (IOException ioe) {
-            context.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
+            throw context.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
         }
 
         if (plaintexts == null || plaintexts.length == 0) {
@@ -191,7 +191,7 @@
                     }
 
                     if (remains > 0) {
-                        context.fatal(Alert.INTERNAL_ERROR,
+                        throw context.fatal(Alert.INTERNAL_ERROR,
                             "no sufficient room in the destination buffers");
                     }
                 }
--- a/src/java.base/share/classes/sun/security/ssl/ServerHello.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ServerHello.java	Fri Dec 21 07:46:58 2018 -0500
@@ -133,7 +133,7 @@
             this.serverVersion = ProtocolVersion.valueOf(major, minor);
             if (this.serverVersion == null) {
                 // The client should only request for known protocol versions.
-                context.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw context.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "Unsupported protocol version: " +
                     ProtocolVersion.nameOf(major, minor));
             }
@@ -143,20 +143,21 @@
             try {
                 sessionId.checkLength(serverVersion.id);
             } catch (SSLProtocolException ex) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER, ex);
+                throw handshakeContext.conContext.fatal(
+                        Alert.ILLEGAL_PARAMETER, ex);
             }
 
             int cipherSuiteId = Record.getInt16(m);
             this.cipherSuite = CipherSuite.valueOf(cipherSuiteId);
             if (cipherSuite == null || !context.isNegotiable(cipherSuite)) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Server selected improper ciphersuite " +
                     CipherSuite.nameOf(cipherSuiteId));
             }
 
             this.compressionMethod = m.get();
             if (compressionMethod != 0) {
-                context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw context.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "compression type not supported, " + compressionMethod);
             }
 
@@ -293,10 +294,8 @@
                 KeyExchangeProperties credentials =
                         chooseCipherSuite(shc, clientHello);
                 if (credentials == null) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "no cipher suites in common");
-
-                    return null;    // make the compiler happy
                 }
                 shc.negotiatedCipherSuite = credentials.cipherSuite;
                 shc.handshakeKeyExchange = credentials.keyExchange;
@@ -374,7 +373,7 @@
                     SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol);
                 if (kdg == null) {
                     // unlikely
-                    shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Not supported key derivation: " +
                             shc.negotiatedProtocol);
                 } else {
@@ -458,10 +457,8 @@
                 }
             }
 
-            shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+            throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "no cipher suites in common");
-
-            return null;    // make the compiler happy.
         }
 
         private static final class KeyExchangeProperties {
@@ -524,9 +521,8 @@
                 // negotiate the cipher suite.
                 CipherSuite cipherSuite = chooseCipherSuite(shc, clientHello);
                 if (cipherSuite == null) {
-                    shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                    throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                             "no cipher suites in common");
-                    return null;    // make the compiler happy
                 }
                 shc.negotiatedCipherSuite = cipherSuite;
                 shc.handshakeSession.setSuite(cipherSuite);
@@ -592,9 +588,8 @@
             SSLKeyExchange ke = shc.handshakeKeyExchange;
             if (ke == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not negotiated key shares");
-                return null;    // make the compiler happy
             }
 
             SSLKeyDerivation handshakeKD = ke.createKeyDerivation(shc);
@@ -605,10 +600,9 @@
                 SSLTrafficKeyDerivation.valueOf(shc.negotiatedProtocol);
             if (kdg == null) {
                 // unlikely
-                shc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw shc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key derivation: " +
                         shc.negotiatedProtocol);
-                return null;    // make the compiler happy
             }
 
             SSLKeyDerivation kd =
@@ -634,9 +628,15 @@
                         shc.sslContext.getSecureRandom());
             } catch (GeneralSecurityException gse) {
                 // unlikely
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Missing cipher algorithm", gse);
-                return null;    // make the compiler happy
+            }
+
+            if (readCipher == null) {
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    "Illegal cipher suite (" + shc.negotiatedCipherSuite +
+                    ") and protocol version (" + shc.negotiatedProtocol +
+                    ")");
             }
 
             shc.baseReadSecret = readSecret;
@@ -662,9 +662,15 @@
                         shc.sslContext.getSecureRandom());
             } catch (GeneralSecurityException gse) {
                 // unlikely
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Missing cipher algorithm", gse);
-                return null;    //  make the compiler happy
+            }
+
+            if (writeCipher == null) {
+                throw shc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    "Illegal cipher suite (" + shc.negotiatedCipherSuite +
+                    ") and protocol version (" + shc.negotiatedProtocol +
+                    ")");
             }
 
             shc.baseWriteSecret = writeSecret;
@@ -746,9 +752,8 @@
             CipherSuite cipherSuite =
                     T13ServerHelloProducer.chooseCipherSuite(shc, clientHello);
             if (cipherSuite == null) {
-                shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "no cipher suites in common for hello retry request");
-                return null;    // make the compiler happy
             }
 
             ServerHelloMessage hhrm = new ServerHelloMessage(shc,
@@ -857,7 +862,7 @@
                         SSLHandshake.HELLO_VERIFY_REQUEST.id);
             }
             if (!chc.handshakeConsumers.isEmpty()) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "No more message expected before ServerHello is processed");
             }
 
@@ -895,14 +900,14 @@
             }
 
             if (!chc.activeProtocols.contains(serverVersion)) {
-                chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "The server selected protocol version " + serverVersion +
                     " is not accepted by client preferences " +
                     chc.activeProtocols);
             }
 
             if (!serverVersion.useTLS13PlusSpec()) {
-                chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "Unexpected HelloRetryRequest for " + serverVersion.name);
             }
 
@@ -947,7 +952,7 @@
             }
 
             if (!chc.activeProtocols.contains(serverVersion)) {
-                chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "The server selected protocol version " + serverVersion +
                     " is not accepted by client preferences " +
                     chc.activeProtocols);
@@ -964,7 +969,7 @@
             }
 
             if (serverHello.serverRandom.isVersionDowngrade(chc)) {
-                chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "A potential protocol version downgrade attack");
             }
 
@@ -1007,7 +1012,7 @@
             ClientHandshakeContext chc = (ClientHandshakeContext)context;
             ServerHelloMessage serverHello = (ServerHelloMessage)message;
             if (!chc.isNegotiable(serverHello.serverVersion)) {
-                chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "Server chose " + serverHello.serverVersion +
                     ", but that protocol version is not enabled or " +
                     "not supported by the client.");
@@ -1019,7 +1024,7 @@
                     chc.negotiatedProtocol, chc.negotiatedCipherSuite);
             chc.serverHelloRandom = serverHello.serverRandom;
             if (chc.negotiatedCipherSuite.keyExchange == null) {
-                chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "TLS 1.2 or prior version does not support the " +
                     "server cipher suite: " + chc.negotiatedCipherSuite.name);
             }
@@ -1045,7 +1050,7 @@
                     // Verify that the session ciphers are unchanged.
                     CipherSuite sessionSuite = chc.resumingSession.getSuite();
                     if (chc.negotiatedCipherSuite != sessionSuite) {
-                        chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                        throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                             "Server returned wrong cipher suite for session");
                     }
 
@@ -1053,7 +1058,7 @@
                     ProtocolVersion sessionVersion =
                             chc.resumingSession.getProtocolVersion();
                     if (chc.negotiatedProtocol != sessionVersion) {
-                        chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                        throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                             "Server resumed with wrong protocol version");
                     }
 
@@ -1072,7 +1077,7 @@
                     }
                     chc.isResumption = false;
                     if (!chc.sslConfig.enableSessionCreation) {
-                        chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                        throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                             "New session creation is disabled");
                     }
                 }
@@ -1091,7 +1096,7 @@
                 }
 
                 if (!chc.sslConfig.enableSessionCreation) {
-                    chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                    throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                         "New session creation is disabled");
                 }
                 chc.handshakeSession = new SSLSessionImpl(chc,
@@ -1112,7 +1117,7 @@
                         SSLTrafficKeyDerivation.valueOf(chc.negotiatedProtocol);
                 if (kdg == null) {
                     // unlikely
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                             "Not supported key derivation: " +
                             chc.negotiatedProtocol);
                 } else {
@@ -1183,7 +1188,7 @@
             ClientHandshakeContext chc = (ClientHandshakeContext)context;
             ServerHelloMessage serverHello = (ServerHelloMessage)message;
             if (serverHello.serverVersion != ProtocolVersion.TLS12) {
-                chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "The ServerHello.legacy_version field is not TLS 1.2");
             }
 
@@ -1208,7 +1213,7 @@
                 }
 
                 if (!chc.sslConfig.enableSessionCreation) {
-                    chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                    throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                         "New session creation is disabled");
                 }
                 chc.handshakeSession = new SSLSessionImpl(chc,
@@ -1221,7 +1226,7 @@
                 Optional<SecretKey> psk =
                         chc.resumingSession.consumePreSharedKey();
                 if(!psk.isPresent()) {
-                    chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                    throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                     "No PSK available. Unable to resume.");
                 }
 
@@ -1242,9 +1247,8 @@
             SSLKeyExchange ke = chc.handshakeKeyExchange;
             if (ke == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not negotiated key shares");
-                return;     // make the compiler happy
             }
 
             SSLKeyDerivation handshakeKD = ke.createKeyDerivation(chc);
@@ -1254,10 +1258,9 @@
                 SSLTrafficKeyDerivation.valueOf(chc.negotiatedProtocol);
             if (kdg == null) {
                 // unlikely
-                chc.conContext.fatal(Alert.INTERNAL_ERROR,
+                throw chc.conContext.fatal(Alert.INTERNAL_ERROR,
                         "Not supported key derivation: " +
                         chc.negotiatedProtocol);
-                return;     // make the compiler happy
             }
 
             SSLKeyDerivation secretKD =
@@ -1284,9 +1287,15 @@
                         chc.sslContext.getSecureRandom());
             } catch (GeneralSecurityException gse) {
                 // unlikely
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Missing cipher algorithm", gse);
-                return;     // make the compiler happy
+            }
+
+            if (readCipher == null) {
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    "Illegal cipher suite (" + chc.negotiatedCipherSuite +
+                    ") and protocol version (" + chc.negotiatedProtocol +
+                    ")");
             }
 
             chc.baseReadSecret = readSecret;
@@ -1312,9 +1321,15 @@
                         chc.sslContext.getSecureRandom());
             } catch (GeneralSecurityException gse) {
                 // unlikely
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "Missing cipher algorithm", gse);
-                return;     //  make the compiler happy
+            }
+
+            if (writeCipher == null) {
+                throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                    "Illegal cipher suite (" + chc.negotiatedCipherSuite +
+                    ") and protocol version (" + chc.negotiatedProtocol +
+                    ")");
             }
 
             chc.baseWriteSecret = writeSecret;
@@ -1376,7 +1391,7 @@
             ClientHandshakeContext chc = (ClientHandshakeContext)context;
             ServerHelloMessage helloRetryRequest = (ServerHelloMessage)message;
             if (helloRetryRequest.serverVersion != ProtocolVersion.TLS12) {
-                chc.conContext.fatal(Alert.PROTOCOL_VERSION,
+                throw chc.conContext.fatal(Alert.PROTOCOL_VERSION,
                     "The HelloRetryRequest.legacy_version is not TLS 1.2");
             }
 
@@ -1406,7 +1421,7 @@
                 chc.initialClientHelloMsg.write(hos);
             } catch (IOException ioe) {
                 // unlikely
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "Failed to construct message hash", ioe);
             }
             chc.handshakeHash.deliver(hos.toByteArray());
--- a/src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ServerHelloDone.java	Fri Dec 21 07:46:58 2018 -0500
@@ -50,7 +50,7 @@
                 ByteBuffer m) throws IOException {
             super(handshakeContext);
             if (m.hasRemaining()) {
-                handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
+                throw handshakeContext.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "Error parsing ServerHelloDone message: not empty");
             }
         }
--- a/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java	Fri Dec 21 07:46:58 2018 -0500
@@ -68,9 +68,8 @@
             }
 
             // not producer defined.
-            shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+            throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                     "No ServerKeyExchange handshake message can be produced.");
-            return null;    // make the compiler happe
         }
     }
 
@@ -107,7 +106,7 @@
             }
 
             // no consumer defined.
-            chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+            throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected ServerKeyExchange handshake message.");
         }
     }
--- a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -295,8 +295,7 @@
             try {
                 spec = new CHServerNamesSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -314,7 +313,7 @@
                     }
                 } else {
                     // We do not reject client without SNI extension currently.
-                    shc.conContext.fatal(Alert.UNRECOGNIZED_NAME,
+                    throw shc.conContext.fatal(Alert.UNRECOGNIZED_NAME,
                             "Unrecognized server name indication");
                 }
             } else {
@@ -483,13 +482,13 @@
             CHServerNamesSpec spec = (CHServerNamesSpec)
                     chc.handshakeExtensions.get(CH_SERVER_NAME);
             if (spec == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected ServerHello server_name extension");
             }
 
             // Parse the extension.
             if (buffer.remaining() != 0) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Invalid ServerHello server_name extension");
             }
 
@@ -570,13 +569,13 @@
             CHServerNamesSpec spec = (CHServerNamesSpec)
                     chc.handshakeExtensions.get(CH_SERVER_NAME);
             if (spec == null) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Unexpected EncryptedExtensions server_name extension");
             }
 
             // Parse the extension.
             if (buffer.remaining() != 0) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                     "Invalid EncryptedExtensions server_name extension");
             }
 
--- a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -238,8 +238,7 @@
             try {
                 spec = new SignatureSchemesSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -329,7 +328,7 @@
             // We may support the server authentication other than X.509
             // certificate later.
             if (shc.negotiatedProtocol.useTLS13PlusSpec()) {
-                shc.conContext.fatal(Alert.MISSING_EXTENSION,
+                throw shc.conContext.fatal(Alert.MISSING_EXTENSION,
                     "No mandatory signature_algorithms extension in the " +
                     "received CertificateRequest handshake message");
             }
@@ -403,10 +402,9 @@
             // handshake message in TLS 1.3.
             if (!shc.sslConfig.isAvailable(
                     SSLExtension.CR_SIGNATURE_ALGORITHMS)) {
-                shc.conContext.fatal(Alert.MISSING_EXTENSION,
+                throw shc.conContext.fatal(Alert.MISSING_EXTENSION,
                         "No available signature_algorithms extension " +
                         "for client certificate authentication");
-                return null;    // make the compiler happy
             }
 
             // Produce the extension.
@@ -454,10 +452,9 @@
             // handshake message in TLS 1.3.
             if (!chc.sslConfig.isAvailable(
                     SSLExtension.CR_SIGNATURE_ALGORITHMS)) {
-                chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
                         "No available signature_algorithms extension " +
                         "for client certificate authentication");
-                return;     // make the compiler happy
             }
 
             // Parse the extension.
@@ -465,8 +462,7 @@
             try {
                 spec = new SignatureSchemesSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             List<SignatureScheme> knownSignatureSchemes = new LinkedList<>();
@@ -545,7 +541,7 @@
 
             // This is a mandatory extension for CertificateRequest handshake
             // message in TLS 1.3.
-            chc.conContext.fatal(Alert.MISSING_EXTENSION,
+            throw chc.conContext.fatal(Alert.MISSING_EXTENSION,
                     "No mandatory signature_algorithms extension in the " +
                     "received CertificateRequest handshake message");
         }
--- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -900,8 +900,7 @@
             try {
                 spec = new SupportedGroupsSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -1024,8 +1023,7 @@
             try {
                 spec = new SupportedGroupsSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
--- a/src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedVersionsExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -225,8 +225,7 @@
             try {
                 spec = new CHSupportedVersionsSpec(buffer);
             } catch (IOException ioe) {
-                shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -368,8 +367,7 @@
             try {
                 spec = new SHSupportedVersionsSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
@@ -458,8 +456,7 @@
             try {
                 spec = new SHSupportedVersionsSpec(buffer);
             } catch (IOException ioe) {
-                chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
-                return;     // fatal() always throws, make the compiler happy.
+                throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe);
             }
 
             // Update the context.
--- a/src/java.base/share/classes/sun/security/ssl/TransportContext.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/TransportContext.java	Fri Dec 21 07:46:58 2018 -0500
@@ -148,9 +148,8 @@
 
         ContentType ct = ContentType.valueOf(plaintext.contentType);
         if (ct == null) {
-            fatal(Alert.UNEXPECTED_MESSAGE,
+            throw fatal(Alert.UNEXPECTED_MESSAGE,
                 "Unknown content type: " + plaintext.contentType);
-            return;
         }
 
         switch (ct) {
@@ -164,7 +163,7 @@
                                 protocolVersion.useTLS13PlusSpec()) {
                             handshakeContext = new PostHandshakeContext(this);
                         } else {
-                            fatal(Alert.UNEXPECTED_MESSAGE,
+                            throw fatal(Alert.UNEXPECTED_MESSAGE,
                                     "Unexpected post-handshake message: " +
                                     SSLHandshake.nameOf(type));
                         }
@@ -185,7 +184,7 @@
                 if (consumer != null) {
                     consumer.consume(this, plaintext.fragment);
                 } else {
-                    fatal(Alert.UNEXPECTED_MESSAGE,
+                    throw fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected content: " + plaintext.contentType);
                 }
         }
@@ -250,22 +249,22 @@
         }
     }
 
-    void fatal(Alert alert,
+    SSLException fatal(Alert alert,
             String diagnostic) throws SSLException {
-        fatal(alert, diagnostic, null);
+        return fatal(alert, diagnostic, null);
     }
 
-    void fatal(Alert alert, Throwable cause) throws SSLException {
-        fatal(alert, null, cause);
+    SSLException fatal(Alert alert, Throwable cause) throws SSLException {
+        return fatal(alert, null, cause);
     }
 
-    void fatal(Alert alert,
+    SSLException fatal(Alert alert,
             String diagnostic, Throwable cause) throws SSLException {
-        fatal(alert, diagnostic, false, cause);
+        return fatal(alert, diagnostic, false, cause);
     }
 
     // Note: close_notify is not delivered via fatal() methods.
-    void fatal(Alert alert, String diagnostic,
+    SSLException fatal(Alert alert, String diagnostic,
             boolean recvFatalAlert, Throwable cause) throws SSLException {
         // If we've already shutdown because of an error, there is nothing we
         // can do except rethrow the exception.
@@ -328,6 +327,8 @@
             if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
                 SSLLogger.warning("Fatal: input record closure failed", ioe);
             }
+
+            closeReason.addSuppressed(ioe);
         }
 
         // invalidate the session
@@ -353,6 +354,8 @@
                     SSLLogger.warning(
                         "Fatal: failed to send fatal alert " + alert, ioe);
                 }
+
+                closeReason.addSuppressed(ioe);
             }
         }
 
@@ -363,6 +366,8 @@
             if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
                 SSLLogger.warning("Fatal: output record closure failed", ioe);
             }
+
+            closeReason.addSuppressed(ioe);
         }
 
         // terminate the handshake context
@@ -377,6 +382,8 @@
             if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
                 SSLLogger.warning("Fatal: transport closure failed", ioe);
             }
+
+            closeReason.addSuppressed(ioe);
         } finally {
             isBroken = true;
         }
--- a/src/java.base/share/classes/sun/security/util/SignatureUtil.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/util/SignatureUtil.java	Fri Dec 21 07:46:58 2018 -0500
@@ -28,8 +28,6 @@
 import java.io.IOException;
 import java.security.*;
 import java.security.spec.*;
-import sun.security.util.ObjectIdentifier;
-import sun.security.x509.AlgorithmId;
 import sun.security.rsa.RSAUtil;
 
 /**
@@ -86,13 +84,12 @@
     // specified Signature object as signature parameters.
     public static void specialSetParameter(Signature sig, byte[] paramBytes)
             throws InvalidAlgorithmParameterException, ProviderException {
-
-        AlgorithmParameters params = null;
         if (paramBytes != null) {
             String sigName = sig.getAlgorithm();
-            params = createAlgorithmParameters(sigName, paramBytes);
+            AlgorithmParameters params =
+                createAlgorithmParameters(sigName, paramBytes);
+            specialSetParameter(sig, params);
         }
-        specialSetParameter(sig, params);
     }
 
     // Special method for setting the specified AlgorithmParameter object
@@ -100,16 +97,9 @@
     public static void specialSetParameter(Signature sig,
             AlgorithmParameters params)
             throws InvalidAlgorithmParameterException, ProviderException {
-
-        String sigName = sig.getAlgorithm();
         if (params != null) {
+            String sigName = sig.getAlgorithm();
             sig.setParameter(getParamSpec(sigName, params));
-        } else {
-            try {
-                sig.setParameter(null);
-            } catch (UnsupportedOperationException e) {
-                // ignore for maintaining backward compatibility
-            }
         }
     }
 }
--- a/src/java.base/share/classes/sun/security/x509/AVA.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/AVA.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1045,7 +1045,7 @@
 
             if (valStr == null) {
 
-                // rfc1779 specifies that attribute values associated
+                // RFC 1779 specifies that attribute values associated
                 // with non-standard keyword attributes may be represented
                 // using the hex format below.  This will be used only
                 // when the value is not a string type
--- a/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/AlgorithmId.java	Fri Dec 21 07:46:58 2018 -0500
@@ -166,15 +166,15 @@
 
             // Several AlgorithmId should omit the whole parameter part when
             // it's NULL. They are ---
-            // rfc3370 2.1: Implementations SHOULD generate SHA-1
+            // RFC 3370 2.1: Implementations SHOULD generate SHA-1
             // AlgorithmIdentifiers with absent parameters.
-            // rfc3447 C1: When id-sha1, id-sha224, id-sha256, id-sha384 and
+            // RFC 3447 C1: When id-sha1, id-sha224, id-sha256, id-sha384 and
             // id-sha512 are used in an AlgorithmIdentifier the parameters
             // (which are optional) SHOULD be omitted.
-            // rfc3279 2.3.2: The id-dsa algorithm syntax includes optional
+            // RFC 3279 2.3.2: The id-dsa algorithm syntax includes optional
             // domain parameters... When omitted, the parameters component
             // MUST be omitted entirely
-            // rfc3370 3.1: When the id-dsa-with-sha1 algorithm identifier
+            // RFC 3370 3.1: When the id-dsa-with-sha1 algorithm identifier
             // is used, the AlgorithmIdentifier parameters field MUST be absent.
             /*if (
                 algid.equals((Object)SHA_oid) ||
--- a/src/java.base/share/classes/sun/security/x509/CertificatePoliciesExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/CertificatePoliciesExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -45,7 +45,7 @@
  * certificate.
  * <p>
  * Optional qualifiers are not supported in this implementation, as they are
- * not recommended by RFC2459.
+ * not recommended by RFC 5280.
  *
  * The ASN.1 syntax for this is (IMPLICIT tagging is defined in the
  * module definition):
--- a/src/java.base/share/classes/sun/security/x509/DNSName.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/DNSName.java	Fri Dec 21 07:46:58 2018 -0500
@@ -181,7 +181,7 @@
      * For example, www.host.example.com would satisfy the constraint but
      * host1.example.com would not.
      * <p>
-     * draft-ietf-pkix-new-part1-00.txt:  DNSName restrictions are expressed as foo.bar.com.
+     * RFC 5280:  DNSName restrictions are expressed as foo.bar.com.
      * Any DNSName that
      * can be constructed by simply adding to the left hand side of the name
      * satisfies the name constraint. For example, www.foo.bar.com would
--- a/src/java.base/share/classes/sun/security/x509/IPAddressName.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/IPAddressName.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -37,27 +37,27 @@
 /**
  * This class implements the IPAddressName as required by the GeneralNames
  * ASN.1 object.  Both IPv4 and IPv6 addresses are supported using the
- * formats specified in IETF PKIX RFC2459.
+ * formats specified in IETF PKIX RFC 5280.
  * <p>
- * [RFC2459 4.2.1.7 Subject Alternative Name]
- * When the subjectAltName extension contains a iPAddress, the address
- * MUST be stored in the octet string in "network byte order," as
- * specified in RFC 791. The least significant bit (LSB) of
- * each octet is the LSB of the corresponding byte in the network
- * address. For IP Version 4, as specified in RFC 791, the octet string
- * MUST contain exactly four octets.  For IP Version 6, as specified in
- * RFC 1883, the octet string MUST contain exactly sixteen octets.
+ * [RFC 5280 4.2.1.6 Subject Alternative Name]
+ * When the subjectAltName extension contains an iPAddress, the address
+ * MUST be stored in the octet string in "network byte order", as
+ * specified in [RFC791].  The least significant bit (LSB) of each octet
+ * is the LSB of the corresponding byte in the network address.  For IP
+ * version 4, as specified in [RFC791], the octet string MUST contain
+ * exactly four octets.  For IP version 6, as specified in
+ * [RFC 2460], the octet string MUST contain exactly sixteen octets.
  * <p>
- * [RFC2459 4.2.1.11 Name Constraints]
- * The syntax of iPAddress MUST be as described in section 4.2.1.7 with
- * the following additions specifically for Name Constraints.  For IPv4
- * addresses, the ipAddress field of generalName MUST contain eight (8)
- * octets, encoded in the style of RFC 1519 (CIDR) to represent an
- * address range.[RFC 1519]  For IPv6 addresses, the ipAddress field
+ * [RFC 5280 4.2.1.10 Name Constraints]
+ * The syntax of iPAddress MUST be as described in Section 4.2.1.6 with
+ * the following additions specifically for name constraints.  For IPv4
+ * addresses, the iPAddress field of GeneralName MUST contain eight (8)
+ * octets, encoded in the style of RFC 4632 (CIDR) to represent an
+ * address range [RFC 4632].  For IPv6 addresses, the iPAddress field
  * MUST contain 32 octets similarly encoded.  For example, a name
- * constraint for "class C" subnet 10.9.8.0 shall be represented as the
- * octets 0A 09 08 00 FF FF FF 00, representing the CIDR notation
- * 10.9.8.0/255.255.255.0.
+ * constraint for "class C" subnet 192.0.2.0 is represented as the
+ * octets C0 00 02 00 FF FF FF 00, representing the CIDR notation
+ * 192.0.2.0/24 (mask 255.255.255.0).
  * <p>
  * @see GeneralName
  * @see GeneralNameInterface
@@ -376,15 +376,16 @@
      * </ul>.  These results are used in checking NameConstraints during
      * certification path verification.
      * <p>
-     * [RFC2459] The syntax of iPAddress MUST be as described in section
-     * 4.2.1.7 with the following additions specifically for Name Constraints.
-     * For IPv4 addresses, the ipAddress field of generalName MUST contain
-     * eight (8) octets, encoded in the style of RFC 1519 (CIDR) to represent an
-     * address range.[RFC 1519]  For IPv6 addresses, the ipAddress field
+     * [RFC 5280 4.2.1.10 Name Constraints]
+     * The syntax of iPAddress MUST be as described in Section 4.2.1.6 with
+     * the following additions specifically for name constraints.  For IPv4
+     * addresses, the iPAddress field of GeneralName MUST contain eight (8)
+     * octets, encoded in the style of RFC 4632 (CIDR) to represent an
+     * address range [RFC 4632].  For IPv6 addresses, the iPAddress field
      * MUST contain 32 octets similarly encoded.  For example, a name
-     * constraint for "class C" subnet 10.9.8.0 shall be represented as the
-     * octets 0A 09 08 00 FF FF FF 00, representing the CIDR notation
-     * 10.9.8.0/255.255.255.0.
+     * constraint for "class C" subnet 192.0.2.0 is represented as the
+     * octets C0 00 02 00 FF FF FF 00, representing the CIDR notation
+     * 192.0.2.0/24 (mask 255.255.255.0).
      *
      * @param inputName to be checked for being constrained
      * @return constraint type above
--- a/src/java.base/share/classes/sun/security/x509/KeyIdentifier.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/KeyIdentifier.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -63,7 +63,7 @@
     /**
      * Creates a KeyIdentifier from a public-key value.
      *
-     * <p>From RFC2459: Two common methods for generating key identifiers from
+     * <p>From RFC 5280: Two common methods for generating key identifiers from
      * the public key are:
      * <ol>
      * <li>The keyIdentifier is composed of the 160-bit SHA-1 hash of the
--- a/src/java.base/share/classes/sun/security/x509/NameConstraintsExtension.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/NameConstraintsExtension.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -326,7 +326,7 @@
      * expanded by a merge, just remain constant or become more
      * limiting.
      * <p>
-     * IETF RFC2459 specifies the processing of Name Constraints as
+     * IETF RFC 5280 specifies the processing of Name Constraints as
      * follows:
      * <p>
      * (j)  If permittedSubtrees is present in the certificate, set the
--- a/src/java.base/share/classes/sun/security/x509/OIDName.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/OIDName.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -156,7 +156,7 @@
         else if (this.equals((OIDName)inputName))
             constraintType = NAME_MATCH;
         else
-            //widens and narrows not defined in RFC2459 for OIDName (aka registeredID)
+            //widens and narrows not defined in RFC 5280 for OIDName (aka registeredID)
             throw new UnsupportedOperationException("Narrowing and widening are not supported for OIDNames");
         return constraintType;
     }
--- a/src/java.base/share/classes/sun/security/x509/RFC822Name.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/RFC822Name.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -68,7 +68,7 @@
 
     /**
      * Parse an RFC822Name string to see if it is a valid
-     * addr-spec according to IETF RFC822 and RFC2459:
+     * addr-spec according to IETF RFC 822 and RFC 5280:
      * [local-part@]domain
      * <p>
      * local-part@ could be empty for an RFC822Name NameConstraint,
@@ -131,7 +131,7 @@
      * Compares this name with another, for equality.
      *
      * @return true iff the names are equivalent
-     * according to RFC2459.
+     * according to RFC 5280.
      */
     public boolean equals(Object obj) {
         if (this == obj)
@@ -142,7 +142,7 @@
 
         RFC822Name other = (RFC822Name)obj;
 
-        // RFC2459 mandates that these names are
+        // RFC 5280 mandates that these names are
         // not case-sensitive
         return name.equalsIgnoreCase(other.name);
     }
@@ -166,14 +166,15 @@
      * </ul>.  These results are used in checking NameConstraints during
      * certification path verification.
      * <p>
-     * [RFC2459]    When the subjectAltName extension contains an Internet mail address,
-     * the address MUST be included as an rfc822Name. The format of an
-     * rfc822Name is an "addr-spec" as defined in RFC 822 [RFC 822]. An
-     * addr-spec has the form "local-part@domain". Note that an addr-spec
-     * has no phrase (such as a common name) before it, has no comment (text
+     *
+     * [RFC 5280]:
+     * When the subjectAltName extension contains an Internet mail address,
+     * the address MUST be stored in the rfc822Name.  The format of an
+     * rfc822Name is a "Mailbox" as defined in Section 4.1.2 of [RFC2821].
+     * A Mailbox has the form "Local-part@Domain".  Note that a Mailbox has
+     * no phrase (such as a common name) before it, has no comment (text
      * surrounded in parentheses) after it, and is not surrounded by "&lt;" and
-     * "&gt;". Note that while upper and lower case letters are allowed in an
-     * RFC 822 addr-spec, no significance is attached to the case.
+     * "&gt;".
      *
      * @param inputName to be checked for being constrained
      * @return constraint type above
@@ -187,7 +188,7 @@
         else if (inputName.getType() != (GeneralNameInterface.NAME_RFC822)) {
             constraintType = NAME_DIFF_TYPE;
         } else {
-            //RFC2459 specifies that case is not significant in RFC822Names
+            //RFC 5280 specifies that case is not significant in RFC822Names
             String inName =
                 (((RFC822Name)inputName).getName()).toLowerCase(Locale.ENGLISH);
             String thisName = name.toLowerCase(Locale.ENGLISH);
--- a/src/java.base/share/classes/sun/security/x509/URIName.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/URIName.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -213,7 +213,7 @@
     /**
      * Compares this name with another, for equality.
      *
-     * @return true iff the names are equivalent according to RFC2459.
+     * @return true iff the names are equivalent according to RFC 5280.
      */
     public boolean equals(Object obj) {
         if (this == obj) {
--- a/src/java.base/share/classes/sun/security/x509/X400Address.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/X400Address.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -403,7 +403,7 @@
         else if (inputName.getType() != NAME_X400)
             constraintType = NAME_DIFF_TYPE;
         else
-            //Narrowing, widening, and match constraints not defined in rfc2459 for X400Address
+            //Narrowing, widening, and match constraints not defined in RFC 5280 for X400Address
             throw new UnsupportedOperationException("Narrowing, widening, and match are not supported for X400Address.");
         return constraintType;
     }
--- a/src/java.base/share/classes/sun/security/x509/X509CertImpl.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/classes/sun/security/x509/X509CertImpl.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -63,14 +63,8 @@
  * direct knowledge of each other.  CA certificates are either signed by
  * themselves, or by some other CA such as a "root" CA.
  *
- * <P>RFC 1422 is very informative, though it does not describe much
- * of the recent work being done with X.509 certificates.  That includes
- * a 1996 version (X.509v3) and a variety of enhancements being made to
- * facilitate an explosion of personal certificates used as "Internet
- * Drivers' Licences", or with SET for credit card transactions.
- *
- * <P>More recent work includes the IETF PKIX Working Group efforts,
- * especially RFC2459.
+ * <P> Standards relating to X.509 Public Key Infrastructure for the Internet
+ * can be referenced in RFC 5280.
  *
  * @author Dave Brownell
  * @author Amit Kapoor
--- a/src/java.base/share/native/libjava/AccessController.c	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/share/native/libjava/AccessController.c	Fri Dec 21 07:46:58 2018 -0500
@@ -59,3 +59,12 @@
 {
     return JVM_GetInheritedAccessControlContext(env, this);
 }
+
+JNIEXPORT void JNICALL
+Java_java_security_AccessController_ensureMaterializedForStackWalk(
+                                                              JNIEnv *env,
+                                                              jclass cls,
+                                                              jobject value)
+{
+    JVM_EnsureMaterializedForStackWalk(env, value);
+}
--- a/src/java.base/unix/native/libjsig/jsig.c	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/unix/native/libjsig/jsig.c	Fri Dec 21 07:46:58 2018 -0500
@@ -5,7 +5,9 @@
  *
  * 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.
+ * 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
--- a/src/java.base/unix/native/libnet/net_util_md.c	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.base/unix/native/libnet/net_util_md.c	Fri Dec 21 07:46:58 2018 -0500
@@ -803,12 +803,8 @@
 
 #ifdef __linux__
         /*
-         * On Linux if we are connecting to a
-         *
-         *   - link-local address
-         *   - multicast interface-local or link-local address
-         *
-         * we need to specify the interface in the scope_id.
+         * On Linux if we are connecting to a link-local address
+         * we need to specify the interface in the scope_id (2.4 kernel only)
          *
          * If the scope was cached then we use the cached value. If not cached but
          * specified in the Inet6Address we use that, but we first check if the
@@ -818,9 +814,7 @@
          * we try to determine a value from the routing table. In all these
          * cases the used value is cached for further use.
          */
-        if (IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr)
-            || IN6_IS_ADDR_MC_NODELOCAL(&sa->sa6.sin6_addr)
-            || IN6_IS_ADDR_MC_LINKLOCAL(&sa->sa6.sin6_addr)) {
+        if (IN6_IS_ADDR_LINKLOCAL(&sa->sa6.sin6_addr)) {
             unsigned int cached_scope_id = 0, scope_id = 0;
 
             if (ia6_cachedscopeidID) {
--- a/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/java.smartcardio/share/classes/javax/smartcardio/TerminalFactory.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -182,7 +182,7 @@
      * <p>It is determined as follows:
      *
      * when this class is initialized, the system property
-     * <code>javax.smartcardio.TerminalFactory.DefaultType</code>
+     * {@systemProperty javax.smartcardio.TerminalFactory.DefaultType}
      * is examined. If it is set, a TerminalFactory of this type is
      * instantiated by calling the {@linkplain #getInstance
      * getInstance(String,Object)} method passing
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/Main.java	Fri Dec 21 07:46:58 2018 -0500
@@ -29,11 +29,18 @@
 import static org.graalvm.compiler.core.common.GraalOptions.ImmutableCode;
 import static org.graalvm.compiler.hotspot.meta.HotSpotAOTProfilingPlugin.Options.TieredAOT;
 
+import java.io.IOException;
 import java.io.PrintWriter;
 import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.stream.Stream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 
 import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
 import org.graalvm.compiler.api.runtime.GraalJVMCICompiler;
@@ -78,10 +85,33 @@
 
     public static void main(String[] args) throws Exception {
         Main t = new Main();
-        final int exitCode = t.run(args);
+        final int exitCode = t.run(parse(args));
         System.exit(exitCode);
     }
 
+    /**
+     * Expands '@file' in command line arguments by replacing '@file' with the content of 'file'
+     * parsed by StringTokenizer. '@' character can be quoted as '@@'.
+     */
+    private static String[] parse(String[] args) throws IOException {
+        List<String> result = new ArrayList<>();
+        for (String arg : args) {
+            if (arg.length() > 1 && arg.charAt(0) == '@') {
+                String v = arg.substring(1);
+                if (v.charAt(0) == '@') {
+                    result.add(v);
+                } else {
+                    try (Stream<String> file = Files.lines(Paths.get(v))) {
+                        file.map(StringTokenizer::new).map(Collections::list).flatMap(l -> l.stream().map(o -> (String) o)).forEachOrdered(result::add);
+                    }
+                }
+            } else {
+                result.add(arg);
+            }
+        }
+        return result.toArray(String[]::new);
+    }
+
     private int run(String[] args) {
         log = new PrintWriter(System.out);
         printer = new LogPrinter(this, log);
--- a/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c	Fri Dec 21 07:46:58 2018 -0500
@@ -457,12 +457,11 @@
     if (pCode == NULL) {
         JNU_ThrowIOExceptionWithLastError(env, "VirtualAllocEx failed");
         VirtualFreeEx(hProcess, pData, 0, MEM_RELEASE);
+        (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
         return;
     }
     WriteProcessMemory( hProcess, (LPVOID)pCode, (LPCVOID)stubCode, (SIZE_T)stubLen, NULL );
-    if (isCopy) {
-        (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
-    }
+    (*env)->ReleaseByteArrayElements(env, stub, stubCode, JNI_ABORT);
 
     /*
      * Create thread in target process to execute code
--- a/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.hotspot.agent/windows/native/libsaproc/sawindbg.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -722,19 +722,25 @@
 
   IDebugDataSpaces* ptrIDebugDataSpaces = (IDebugDataSpaces*) env->GetLongField(obj,
                                                        ptrIDebugDataSpaces_ID);
-  CHECK_EXCEPTION_(0);
+  if (env->ExceptionOccurred()) {
+     env->ReleaseByteArrayElements(byteArray, bytePtr, JNI_ABORT);
+     return 0;
+  }
 
   ULONG bytesRead;
   if (ptrIDebugDataSpaces->ReadVirtual((ULONG64) address, (PVOID) bytePtr,
                                   (ULONG)numBytes, &bytesRead) != S_OK) {
-     THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: ReadVirtual failed!", 0);
+     env->ReleaseByteArrayElements(byteArray, bytePtr, JNI_ABORT);
+     throwNewDebuggerException(env, "Windbg Error: ReadVirtual failed!");
+     return 0;
   }
 
   if (bytesRead != numBytes) {
+     env->ReleaseByteArrayElements(byteArray, bytePtr, JNI_ABORT);
      return 0;
   }
+  env->ReleaseByteArrayElements(byteArray, bytePtr, 0);
 
-  env->ReleaseByteArrayElements(byteArray, bytePtr, 0);
   CHECK_EXCEPTION_(0);
 
   return byteArray;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java	Fri Dec 21 07:46:58 2018 -0500
@@ -382,6 +382,14 @@
                             "java/lang/CharacterDataLatin1.isWhitespace(I)Z");
         }
 
+        if (isJDK13OrHigher()) {
+            add(toBeInvestigated,
+                            "java/lang/Math.max(DD)D",
+                            "java/lang/Math.max(FF)F",
+                            "java/lang/Math.min(DD)D",
+                            "java/lang/Math.min(FF)F");
+        }
+
         if (!config.inlineNotify()) {
             add(ignore, "java/lang/Object.notify()V");
         }
@@ -542,6 +550,10 @@
         return GraalServices.JAVA_SPECIFICATION_VERSION >= 12;
     }
 
+    private static boolean isJDK13OrHigher() {
+        return GraalServices.JAVA_SPECIFICATION_VERSION >= 13;
+    }
+
     public interface Refiner {
         void refine(CheckGraalIntrinsics checker);
     }
--- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Fri Dec 21 07:46:58 2018 -0500
@@ -187,12 +187,12 @@
 jshell.console.resolvable = \nThe identifier is resolvable in this context.
 jshell.console.no.candidate = \nNo candidate fully qualified names found to import.
 jshell.console.incomplete = \nResults may be incomplete; try again later for complete results.
-jshell.console.erroneous = \nIncomplete or erroneous. A single valid expression or statement must proceed Shift-<tab> m.
-jshell.console.exprstmt = \nA single valid expression or statement must proceed Shift-<tab> m.
-jshell.console.empty = \nEmpty entry. A single valid expression or statement must proceed Shift-<tab> m..
+jshell.console.erroneous = \nIncomplete or erroneous. A single valid expression or statement must precede Shift+Tab m.
+jshell.console.exprstmt = \nA single valid expression or statement must precede Shift+Tab m.
+jshell.console.empty = \nEmpty entry. A single valid expression or statement must precede Shift+Tab m.
 
 jshell.fix.wrong.shortcut =\
-Unexpected character after Shift-Tab.\n\
+Unexpected character after Shift+Tab.\n\
 Use "i" for auto-import, "v" for variable creation, or "m" for method creation.\n\
 For more information see:\n\
    /help shortcuts
@@ -579,92 +579,92 @@
 This support is similar to readline/editline with simple emacs-like bindings.\n\
 There are also jshell tool specific key sequences.\n\
 \n\
---- Line and history navigation ---\n\
-\n\
-Return\n\t\
-  Enters the current snippet\n\
-Left-arrow or Ctrl+B\n\t\
-  Moves backward one character\n\
-Right-arrow or Ctrl+F\n\t\
-  Moves forward one character\n\
-Up-arrow or Ctrl+P\n\t\
-  Moves up one line, backward through history\n\
-Down arrow or Ctrl+N\n\t\
-  Moves down one line, forward through history\n\
-Ctrl+A\n\t\
-  Moves to the beginning of the line\n\
-Ctrl+E\n\t\
-  Moves to the end of the line\n\
-Meta+B\n\t\
-  Moves backward one word\n\
-Meta+F\n\t\
-  Moves forward one word\n\
-Ctrl+R\n\t\
+Line and history navigation:\n\
+\n\t\
+Return\n\t\t\
+  Enters the current snippet\n\t\
+Left-arrow or Ctrl+B\n\t\t\
+  Moves backward one character\n\t\
+Right-arrow or Ctrl+F\n\t\t\
+  Moves forward one character\n\t\
+Up-arrow or Ctrl+P\n\t\t\
+  Moves up one line, backward through history\n\t\
+Down arrow or Ctrl+N\n\t\t\
+  Moves down one line, forward through history\n\t\
+Ctrl+A\n\t\t\
+  Moves to the beginning of the line\n\t\
+Ctrl+E\n\t\t\
+  Moves to the end of the line\n\t\
+Meta+B\n\t\t\
+  Moves backward one word\n\t\
+Meta+F\n\t\t\
+  Moves forward one word\n\t\
+Ctrl+R\n\t\t\
   Search backward through history\n\
 \n\
 \n\
---- Line and history basic editing ---\n\
-\n\
-Meta+Return or Ctrl+Return (depending on platform)\n\t\
-  Insert a new line in snippet\n\
-Ctrl+_ (underscore may require shift key) or Ctrl+X then Ctrl+U\n\t\
-  Undo edit - repeat to undo more edits\n\
-Delete\n\t\
-  Deletes the character at or after the cursor, depending on the operating system\n\
-Backspace\n\t\
-  Deletes the character before the cursor\n\
-Ctrl+K\n\t\
-  Deletes the text from the cursor to the end of the line\n\
-Meta+D\n\t\
-  Deletes the text from the cursor to the end of the word\n\
-Ctrl+W\n\t\
-  Deletes the text from the cursor to the previous white space\n\
-Ctrl+Y\n\t\
-  Pastes the most recently deleted text into the line\n\
-Meta+Y\n\t\
-  After Ctrl+Y, Meta+Y cycles through previously deleted text\n\
-Ctrl+X then Ctrl+K\n\t\
+Line and history basic editing:\n\
+\n\t\
+Meta+Return or Ctrl+Return (depending on platform)\n\t\t\
+  Insert a new line in snippet\n\t\
+Ctrl+_ (underscore may require the Shift key) or Ctrl+X then Ctrl+U\n\t\t\
+  Undo edit - repeat to undo more edits\n\t\
+Delete\n\t\t\
+  Deletes the character at or after the cursor, depending on the operating system\n\t\
+Backspace\n\t\t\
+  Deletes the character before the cursor\n\t\
+Ctrl+K\n\t\t\
+  Deletes the text from the cursor to the end of the line\n\t\
+Meta+D\n\t\t\
+  Deletes the text from the cursor to the end of the word\n\t\
+Ctrl+W\n\t\t\
+  Deletes the text from the cursor to the previous white space\n\t\
+Ctrl+Y\n\t\t\
+  Pastes the most recently deleted text into the line\n\t\
+Meta+Y\n\t\t\
+  After Ctrl+Y, Meta+Y cycles through previously deleted text\n\t\
+Ctrl+X then Ctrl+K\n\t\t\
   Delete whole snippet\n\
 \n\
 \n\
---- Shortcuts for jshell tool ---\n\
-\n\
+Shortcuts for jshell tool:\n\
+\n\t\
 For details, see: /help shortcuts\n\
-\n\
-Tab\n\t\
-  Complete Java identifier or jshell command\n\
-Shift+Tab then v\n\t\
-  Convert expression to variable declaration\n\
-Shift+Tab then m\n\t\
-  Convert statement to method declaration\n\
-Shift+Tab then i\n\t\
-  Add imports for this identifier\n\
+\n\t\
+Tab\n\t\t\
+  Complete Java identifier or jshell command\n\t\
+Shift+Tab then v\n\t\t\
+  Convert expression to variable declaration\n\t\
+Shift+Tab then m\n\t\t\
+  Convert statement to method declaration\n\t\
+Shift+Tab then i\n\t\t\
+  Add imports for this identifier\n\t\
 \n\
 \n\
---- More line and history editing ---\n\
-\n\
-Ctrl+L\n\t\
-  Clear screen and reprint snippet\n\
-Ctrl+U\n\t\
-  Kill whole line\n\
-Ctrl+T\n\t\
-  Transpose characters\n\
-Ctrl+X then Ctrl+B\n\t\
-  Navigate to matching bracket, parenthesis, ...\n\
-Ctrl+X then =\n\t\
-  Enter show current character position mode\n\
-Ctrl+X then Ctrl+O\n\t\
-  Toggle overwrite characters vs insert characters\n\
-Meta+C\n\t\
-  Capitalize word\n\
-Meta+U\n\t\
-  Convert word to uppercase\n\
-Meta+L\n\t\
-  Convert word to lowercase\n\
-Meta+0 through Meta+9 then key\n\t\
+More line and history editing:\n\
+\n\t\
+Ctrl+L\n\t\t\
+  Clear screen and reprint snippet\n\t\
+Ctrl+U\n\t\t\
+  Kill whole line\n\t\
+Ctrl+T\n\t\t\
+  Transpose characters\n\t\
+Ctrl+X then Ctrl+B\n\t\t\
+  Navigate to matching bracket, parenthesis, ...\n\t\
+Ctrl+X then =\n\t\t\
+  Enter show current character position mode\n\t\
+Ctrl+X then Ctrl+O\n\t\t\
+  Toggle overwrite characters vs insert characters\n\t\
+Meta+C\n\t\t\
+  Capitalize word\n\t\
+Meta+U\n\t\t\
+  Convert word to uppercase\n\t\
+Meta+L\n\t\t\
+  Convert word to lowercase\n\t\
+Meta+0 through Meta+9 then key\n\t\t\
   Repeat the specified number of times\n\
 \n\
-Where, for example, "Ctrl+A" means hold down the control key and press A.\n\
+Where, for example, "Ctrl+A" means hold down the Control key and press A.\n\
 Where "Meta" is "Alt" on many keyboards.\n\
 Line editing support is derived from JLine 3.
 
@@ -672,26 +672,34 @@
 information access, and automatic code generation
 help.shortcuts =\
 Supported shortcuts include:\n\
-\n\
-<tab>\n\t\t\
+\n\t\
+Tab\n\t\t\
         After entering the first few letters of a Java identifier,\n\t\t\
-        a jshell tool command, or, in some cases, a jshell tool command argument,\n\t\t\
-        press the <tab> key to complete the input.\n\t\t\
-        If there is more than one completion, then possible completions will be shown.\n\t\t\
-        Will show documentation if available and appropriate.\n\n\
-Shift-<tab> v\n\t\t\
-        After a complete expression, hold down <shift> while pressing <tab>,\n\t\t\
-        then release and press "v", the expression will be converted to\n\t\t\
-        a variable declaration whose type is based on the type of the expression.\n\n\
-Shift-<tab> m\n\t\t\
-        After a complete expression or statement, hold down <shift> while pressing <tab>,\n\t\t\
-        then release and press "m", the expression or statement will be converted to\n\t\t\
-        a method declaration. If an expression, the return type is based on the type\n\t\t\
-        of the expression.\n\n\
-Shift-<tab> i\n\t\t\
-        After an unresolvable identifier, hold down <shift> while pressing <tab>,\n\t\t\
-        then release and press "i", and the jshell tool will propose possible imports\n\t\t\
-        which will resolve the identifier based on the content of the specified classpath.
+        a jshell tool command, or, in some cases, a jshell tool\n\t\t\
+        command argument, press the Tab key to complete the input.\n\t\t\
+        If there is more than one completion, then possible completions\n\t\t\
+        will be shown.\n\t\t\
+        Another Tab will show documentation if available and appropriate.\n\n\t\
+Shift+Tab then v\n\t\t\
+        After a complete expression, hold down the Shift key while\n\t\t\
+        pressing the Tab key, then release and press the "v" key,\n\t\t\
+        the expression will be converted to a variable declaration \n\t\t\
+        whose type is based on the type of the expression.\n\n\t\
+Shift+Tab then m\n\t\t\
+        After a complete expression or statement, hold down the\n\t\t\
+        Shift key while pressing the Tab key, then release and press\n\t\t\
+        the "m" key, the expression or statement will be converted\n\t\t\
+        to a method declaration. If it is an expression, the method\n\t\t\
+        return type will be based on the type of the expression.\n\n\t\
+Shift+Tab then i\n\t\t\
+        After an unresolvable identifier, hold down the Shift key\n\t\t\
+        while pressing the Tab key, then release and press the "i" key,\n\t\t\
+        and the jshell tool will propose possible imports which will\n\t\t\
+        resolve the identifier based on the content of the specified\n\t\t\
+        classpath. Enter the digit corresponding to the desired import,\n\t\t\
+        or press the "0" key to add no imports.\n\
+\n\
+For information onother special keys see: /help keys
 
 help.context.summary = a description of the evaluation context options for /env /reload and /reset
 help.context =\
@@ -789,7 +797,7 @@
 Any number of IDs or ID ranges may be used, e.g.:  /3-7 s4 14-16 e2\n\
 See also '/help id'.\n\
 \n\
-Finally, you can search backwards through history by entering ctrl-R followed by the string to search for.
+Finally, you can search backwards through history by entering Ctrl+R followed by the string to search for.
 
 help.set._retain = \
 The '-retain' option saves a setting so that it is used in future sessions.\n\
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java	Fri Dec 21 07:46:58 2018 -0500
@@ -48,7 +48,6 @@
  *
  * @author Steve Drach
  */
-
 class JarFileSystem extends ZipFileSystem {
     private Function<byte[],byte[]> lookup;
 
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystemProvider.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystemProvider.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -25,21 +25,13 @@
 
 package jdk.nio.zipfs;
 
-import java.nio.file.*;
-import java.nio.file.spi.*;
-import java.nio.file.attribute.*;
-import java.nio.file.spi.FileSystemProvider;
-
 import java.net.URI;
-import java.io.IOException;
 import java.net.URISyntaxException;
-import java.nio.channels.FileChannel;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
+import java.nio.file.FileSystem;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 
-class JarFileSystemProvider extends ZipFileSystemProvider
-{
+class JarFileSystemProvider extends ZipFileSystemProvider {
 
     @Override
     public String getScheme() {
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipCoder.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -34,15 +34,14 @@
 import java.nio.charset.CodingErrorAction;
 import java.util.Arrays;
 
+import static java.nio.charset.StandardCharsets.ISO_8859_1;
 import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.nio.charset.StandardCharsets.ISO_8859_1;
 
 /**
  * Utility class for zipfile name and comment decoding and encoding
  *
- * @author  Xueming Shen
+ * @author Xueming Shen
  */
-
 class ZipCoder {
 
     static class UTF8 extends ZipCoder {
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -26,10 +26,8 @@
 package jdk.nio.zipfs;
 
 /**
- *
  * @author Xueming Shen
  */
-
 class ZipConstants {
     /*
      * Compression methods
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipDirectoryStream.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipDirectoryStream.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -25,19 +25,18 @@
 
 package jdk.nio.zipfs;
 
+import java.io.IOException;
+import java.nio.file.ClosedDirectoryStreamException;
 import java.nio.file.DirectoryStream;
-import java.nio.file.ClosedDirectoryStreamException;
 import java.nio.file.NotDirectoryException;
 import java.nio.file.Path;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
-import java.io.IOException;
 
 /**
  *
- * @author  Xueming Shen, Rajendra Gutupalli, Jaya Hangal
+ * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
  */
-
 class ZipDirectoryStream implements DirectoryStream<Path> {
 
     private final ZipFileSystem zipfs;
@@ -70,8 +69,8 @@
         } catch (IOException e) {
             throw new IllegalStateException(e);
         }
+
         return new Iterator<Path>() {
-            private Path next;
             @Override
             public boolean hasNext() {
                 if (isClosed)
@@ -97,5 +96,4 @@
     public synchronized void close() throws IOException {
         isClosed = true;
     }
-
 }
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributeView.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributeView.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -25,17 +25,17 @@
 
 package jdk.nio.zipfs;
 
-import java.nio.file.attribute.*;
 import java.io.IOException;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.FileAttributeView;
+import java.nio.file.attribute.FileTime;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-/*
- * @author  Xueming Shen, Rajendra Gutupalli, Jaya Hangal
+/**
+ * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
  */
-
-class ZipFileAttributeView implements BasicFileAttributeView
-{
+class ZipFileAttributeView implements BasicFileAttributeView {
     private static enum AttrID {
         size,
         creationTime,
@@ -85,8 +85,7 @@
         return isZipView ? "zip" : "basic";
     }
 
-    public ZipFileAttributes readAttributes() throws IOException
-    {
+    public ZipFileAttributes readAttributes() throws IOException {
         return path.getAttributes();
     }
 
@@ -104,11 +103,11 @@
     {
         try {
             if (AttrID.valueOf(attribute) == AttrID.lastModifiedTime)
-                setTimes ((FileTime)value, null, null);
+                setTimes((FileTime)value, null, null);
             if (AttrID.valueOf(attribute) == AttrID.lastAccessTime)
-                setTimes (null, (FileTime)value, null);
+                setTimes(null, (FileTime)value, null);
             if (AttrID.valueOf(attribute) == AttrID.creationTime)
-                setTimes (null, null, (FileTime)value);
+                setTimes(null, null, (FileTime)value);
             return;
         } catch (IllegalArgumentException x) {}
         throw new UnsupportedOperationException("'" + attribute +
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributes.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributes.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -28,10 +28,10 @@
 import java.nio.file.attribute.BasicFileAttributes;
 
 /**
+ * The attributes of a file stored in a zip file.
  *
- * @author  Xueming Shen, Rajendra Gutupalli,Jaya Hangal
+ * @author Xueming Shen, Rajendra Gutupalli,Jaya Hangal
  */
-
 interface ZipFileAttributes extends BasicFileAttributes {
     public long compressedSize();
     public long crc();
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileStore.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileStore.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -26,21 +26,17 @@
 package jdk.nio.zipfs;
 
 import java.io.IOException;
-import java.nio.file.Files;
 import java.nio.file.FileStore;
 import java.nio.file.FileSystems;
+import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.BasicFileAttributeView;
 import java.nio.file.attribute.FileAttributeView;
 import java.nio.file.attribute.FileStoreAttributeView;
-import java.nio.file.attribute.BasicFileAttributeView;
-import java.util.Formatter;
 
-/*
- *
- * @author  Xueming Shen, Rajendra Gutupalli, Jaya Hangal
+/**
+ * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
  */
-
 class ZipFileStore extends FileStore {
 
     private final ZipFileSystem zfs;
@@ -76,7 +72,6 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
     public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {
         if (type == null)
             throw new NullPointerException();
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -29,17 +29,22 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.EOFException;
-import java.io.File;
 import java.io.FilterOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
 import java.nio.MappedByteBuffer;
-import java.nio.channels.*;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.channels.WritableByteChannel;
 import java.nio.file.*;
-import java.nio.file.attribute.*;
-import java.nio.file.spi.*;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.attribute.UserPrincipalLookupService;
+import java.nio.file.spi.FileSystemProvider;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
@@ -49,25 +54,30 @@
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.regex.Pattern;
 import java.util.zip.CRC32;
+import java.util.zip.Deflater;
+import java.util.zip.DeflaterOutputStream;
 import java.util.zip.Inflater;
-import java.util.zip.Deflater;
 import java.util.zip.InflaterInputStream;
-import java.util.zip.DeflaterOutputStream;
 import java.util.zip.ZipException;
-import static java.lang.Boolean.*;
+
+import static java.lang.Boolean.TRUE;
+import static java.nio.file.StandardCopyOption.COPY_ATTRIBUTES;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.nio.file.StandardOpenOption.APPEND;
+import static java.nio.file.StandardOpenOption.CREATE;
+import static java.nio.file.StandardOpenOption.CREATE_NEW;
+import static java.nio.file.StandardOpenOption.READ;
+import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
+import static java.nio.file.StandardOpenOption.WRITE;
 import static jdk.nio.zipfs.ZipConstants.*;
 import static jdk.nio.zipfs.ZipUtils.*;
-import static java.nio.file.StandardOpenOption.*;
-import static java.nio.file.StandardCopyOption.*;
 
 /**
  * A FileSystem built on a zip file
  *
  * @author Xueming Shen
  */
-
 class ZipFileSystem extends FileSystem {
-
     private final ZipFileSystemProvider provider;
     private final Path zfpath;
     final ZipCoder zc;
@@ -79,15 +89,15 @@
     private final boolean useTempFile;   // use a temp file for newOS, default
                                          // is to use BAOS for better performance
     private static final boolean isWindows = AccessController.doPrivileged(
-            (PrivilegedAction<Boolean>) () -> System.getProperty("os.name")
-                                                    .startsWith("Windows"));
+            (PrivilegedAction<Boolean>)() -> System.getProperty("os.name")
+                                                   .startsWith("Windows"));
     private final boolean forceEnd64;
     private final int defaultMethod;     // METHOD_STORED if "noCompression=true"
                                          // METHOD_DEFLATED otherwise
 
     ZipFileSystem(ZipFileSystemProvider provider,
                   Path zfpath,
-                  Map<String, ?> env)  throws IOException
+                  Map<String, ?> env) throws IOException
     {
         // default encoding for name/comment
         String nameEncoding = env.containsKey("encoding") ?
@@ -269,12 +279,12 @@
         }
         if (!streams.isEmpty()) {    // unlock and close all remaining streams
             Set<InputStream> copy = new HashSet<>(streams);
-            for (InputStream is: copy)
+            for (InputStream is : copy)
                 is.close();
         }
         beginWrite();                // lock and sync
         try {
-            AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
+            AccessController.doPrivileged((PrivilegedExceptionAction<Void>)() -> {
                 sync(); return null;
             });
             ch.close();              // close the ch just in case no update
@@ -296,7 +306,7 @@
 
         IOException ioe = null;
         synchronized (tmppaths) {
-            for (Path p: tmppaths) {
+            for (Path p : tmppaths) {
                 try {
                     AccessController.doPrivileged(
                         (PrivilegedExceptionAction<Boolean>)() -> Files.deleteIfExists(p));
@@ -521,7 +531,7 @@
         boolean hasCreate = false;
         boolean hasAppend = false;
         boolean hasTruncate = false;
-        for (OpenOption opt: options) {
+        for (OpenOption opt : options) {
             if (opt == READ)
                 throw new IllegalArgumentException("READ not allowed");
             if (opt == CREATE_NEW)
@@ -1455,6 +1465,7 @@
             e.size  = def.getBytesRead();
             e.csize = def.getBytesWritten();
             e.crc = crc.getValue();
+            releaseDeflater(def);
         }
     }
 
@@ -1477,7 +1488,7 @@
             // TBD: wrap to hook close()
             // streams.add(eis);
             return eis;
-        } else {  // untouced  CEN or COPY
+        } else {  // untouched CEN or COPY
             eis = new EntryInputStream(e, ch);
         }
         if (e.method == METHOD_DEFLATED) {
@@ -1539,14 +1550,12 @@
                                           // point to a new channel after sync()
         private   long pos;               // current position within entry data
         protected long rem;               // number of remaining bytes within entry
-        protected final long size;        // uncompressed size of this entry
 
         EntryInputStream(Entry e, SeekableByteChannel zfch)
             throws IOException
         {
             this.zfch = zfch;
             rem = e.csize;
-            size = e.size;
             pos = e.locoff;
             if (pos == -1) {
                 Entry e2 = getEntry(e.name);
@@ -1613,10 +1622,6 @@
             return rem > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) rem;
         }
 
-        public long size() {
-            return size;
-        }
-
         public void close() {
             rem = 0;
             streams.remove(this);
@@ -1672,7 +1677,7 @@
     // List of available Deflater objects for compression
     private final List<Deflater> deflaters = new ArrayList<>();
 
-    // Gets an deflater from the list of available deflaters or allocates
+    // Gets a deflater from the list of available deflaters or allocates
     // a new one.
     private Deflater getDeflater() {
         synchronized (deflaters) {
@@ -1985,9 +1990,7 @@
             return this;
         }
 
-        int writeCEN(OutputStream os) throws IOException
-        {
-            int written  = CENHDR;
+        int writeCEN(OutputStream os) throws IOException {
             int version0 = version();
             long csize0  = csize;
             long size0   = size;
@@ -2101,9 +2104,7 @@
         ///////////////////// LOC //////////////////////
 
         int writeLOC(OutputStream os) throws IOException {
-            writeInt(os, LOCSIG);               // LOC header signature
-            int version = version();
-
+            int version0 = version();
             byte[] zname = isdir ? toDirectoryPath(name) : name;
             int nlen = (zname != null) ? zname.length - 1 : 0; // [0] is slash
             int elen = (extra != null) ? extra.length : 0;
@@ -2112,8 +2113,9 @@
             int elen64 = 0;
             int elenEXTT = 0;
             int elenNTFS = 0;
+            writeInt(os, LOCSIG);               // LOC header signature
             if ((flag & FLAG_DATADESCR) != 0) {
-                writeShort(os, version());      // version needed to extract
+                writeShort(os, version0);       // version needed to extract
                 writeShort(os, flag);           // general purpose bit flag
                 writeShort(os, method);         // compression method
                 // last modification time
@@ -2128,7 +2130,7 @@
                     elen64 = 20;    //headid(2) + size(2) + size(8) + csize(8)
                     writeShort(os, 45);         // ver 4.5 for zip64
                 } else {
-                    writeShort(os, version());  // version needed to extract
+                    writeShort(os, version0);   // version needed to extract
                 }
                 writeShort(os, flag);           // general purpose bit flag
                 writeShort(os, method);         // compression method
@@ -2430,7 +2432,6 @@
     //     structure.
     // A possible solution is to build the node tree ourself as
     // implemented below.
-    private IndexNode root;
 
     // default time stamp for pseudo entries
     private long zfsDefaultTimeStamp = System.currentTimeMillis();
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java	Fri Dec 21 07:46:58 2018 -0500
@@ -25,28 +25,31 @@
 
 package jdk.nio.zipfs;
 
-import java.io.*;
-import java.nio.channels.*;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.channels.AsynchronousFileChannel;
+import java.nio.channels.FileChannel;
+import java.nio.channels.SeekableByteChannel;
 import java.nio.file.*;
 import java.nio.file.DirectoryStream.Filter;
-import java.nio.file.attribute.*;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.FileAttributeView;
 import java.nio.file.spi.FileSystemProvider;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ExecutorService;
 import java.util.zip.ZipException;
-import java.util.concurrent.ExecutorService;
 
-/*
- *
- * @author  Xueming Shen, Rajendra Gutupalli, Jaya Hangal
+/**
+ * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
  */
-
 public class ZipFileSystemProvider extends FileSystemProvider {
 
-
     private final Map<Path, ZipFileSystem> filesystems = new HashMap<>();
 
     public ZipFileSystemProvider() {}
@@ -202,7 +205,6 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
     public <V extends FileAttributeView> V
         getFileAttributeView(Path path, Class<V> type, LinkOption... options)
     {
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipInfo.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipInfo.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -28,15 +28,17 @@
 import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.Map;
+
 import static jdk.nio.zipfs.ZipConstants.*;
-import static jdk.nio.zipfs.ZipUtils.*;
+import static jdk.nio.zipfs.ZipUtils.dosToJavaTime;
+import static jdk.nio.zipfs.ZipUtils.unixToJavaTime;
+import static jdk.nio.zipfs.ZipUtils.winToJavaTime;
 
 /**
  * Print all loc and cen headers of the ZIP file
  *
- * @author  Xueming Shen
+ * @author Xueming Shen
  */
-
 public class ZipInfo {
 
     public static void main(String[] args) throws Throwable {
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -25,22 +25,36 @@
 
 package jdk.nio.zipfs;
 
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
 import java.net.URI;
-import java.nio.channels.*;
+import java.nio.channels.FileChannel;
+import java.nio.channels.SeekableByteChannel;
 import java.nio.file.*;
 import java.nio.file.DirectoryStream.Filter;
-import java.nio.file.attribute.*;
-import java.util.*;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.FileTime;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Objects;
+import java.util.Set;
+
 import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.nio.file.StandardOpenOption.*;
-import static java.nio.file.StandardCopyOption.*;
+import static java.nio.file.StandardCopyOption.COPY_ATTRIBUTES;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.nio.file.StandardOpenOption.CREATE;
+import static java.nio.file.StandardOpenOption.READ;
+import static java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;
+import static java.nio.file.StandardOpenOption.WRITE;
 
 /**
- *
- * @author  Xueming Shen, Rajendra Gutupalli,Jaya Hangal
+ * @author Xueming Shen, Rajendra Gutupalli,Jaya Hangal
  */
-
 final class ZipPath implements Path {
 
     private final ZipFileSystem zfs;
@@ -522,7 +536,6 @@
     private byte[] normalize(String path, int off, int len) {
         StringBuilder to = new StringBuilder(len);
         to.append(path, 0, off);
-        int m = off;
         char prevC = 0;
         while (off < len) {
             char c = path.charAt(off++);
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -33,14 +33,12 @@
 import java.time.ZoneId;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.concurrent.TimeUnit;
 import java.util.regex.PatternSyntaxException;
-import java.util.concurrent.TimeUnit;
 
 /**
- *
  * @author Xueming Shen
  */
-
 class ZipUtils {
 
     /*
@@ -155,7 +153,6 @@
             ldt.getSecond() >> 1) & 0xffffffffL;
     }
 
-
     // used to adjust values between Windows and java epoch
     private static final long WINDOWS_EPOCH_IN_MICROSECONDS = -11644473600000000L;
     public static final long winToJavaTime(long wtime) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/aot/cli/jaotc/AtFileTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,60 @@
+/*
+ * 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 check at-file jaotc support
+ * @comment based on CompileClassTest with arguments wrote in 'jaotc.cmd' file
+ * @requires vm.aot
+ * @bug 8215322
+ * @library / /test/lib /testlibrary
+ * @modules java.base/jdk.internal.misc
+ * @build compiler.aot.cli.jaotc.AtFileTest
+ * @run driver ClassFileInstaller compiler.aot.cli.jaotc.data.HelloWorldOne
+ * @run driver compiler.aot.cli.jaotc.AtFileTest
+ */
+
+package compiler.aot.cli.jaotc;
+
+import compiler.aot.cli.jaotc.data.HelloWorldOne;
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.Files;
+import java.util.List;
+import jdk.test.lib.Asserts;
+import jdk.test.lib.process.OutputAnalyzer;
+
+public class AtFileTest {
+    public static void main(String[] args) throws Exception {
+        Path file = Paths.get("jatoc.cmd");
+        Files.write(file, List.of("--class-name",
+                JaotcTestHelper.getClassAotCompilationName(HelloWorldOne.class)));
+        OutputAnalyzer oa = JaotcTestHelper.compileLibrary("@" + file.toString());
+        oa.shouldHaveExitValue(0);
+        File compiledLibrary = new File(JaotcTestHelper.DEFAULT_LIB_PATH);
+        Asserts.assertTrue(compiledLibrary.exists(), "Compiled library file missing");
+        Asserts.assertGT(compiledLibrary.length(), 0L, "Unexpected compiled library size");
+        JaotcTestHelper.checkLibraryUsage(HelloWorldOne.class.getName());
+    }
+}
--- a/test/hotspot/jtreg/compiler/c2/cr6340864/TestByteVect.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/compiler/c2/cr6340864/TestByteVect.java	Fri Dec 21 07:46:58 2018 -0500
@@ -27,6 +27,9 @@
  * @summary Implement vectorization optimizations in hotspot-server
  *
  * @run main/othervm/timeout=400 -Xbatch -Xmx128m compiler.c2.cr6340864.TestByteVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=8 compiler.c2.cr6340864.TestByteVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=16 compiler.c2.cr6340864.TestByteVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=32 compiler.c2.cr6340864.TestByteVect
  */
 
 package compiler.c2.cr6340864;
--- a/test/hotspot/jtreg/compiler/c2/cr6340864/TestDoubleVect.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/compiler/c2/cr6340864/TestDoubleVect.java	Fri Dec 21 07:46:58 2018 -0500
@@ -27,6 +27,9 @@
  * @summary Implement vectorization optimizations in hotspot-server
  *
  * @run main/othervm/timeout=400 -Xbatch -Xmx128m compiler.c2.cr6340864.TestDoubleVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=8 compiler.c2.cr6340864.TestDoubleVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=16 compiler.c2.cr6340864.TestDoubleVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=32 compiler.c2.cr6340864.TestDoubleVect
  */
 
 package compiler.c2.cr6340864;
--- a/test/hotspot/jtreg/compiler/c2/cr6340864/TestFloatVect.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/compiler/c2/cr6340864/TestFloatVect.java	Fri Dec 21 07:46:58 2018 -0500
@@ -27,6 +27,9 @@
  * @summary Implement vectorization optimizations in hotspot-server
  *
  * @run main/othervm/timeout=400 -Xbatch -Xmx128m compiler.c2.cr6340864.TestFloatVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=8 compiler.c2.cr6340864.TestFloatVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=16 compiler.c2.cr6340864.TestFloatVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=32 compiler.c2.cr6340864.TestFloatVect
  */
 
 package compiler.c2.cr6340864;
--- a/test/hotspot/jtreg/compiler/c2/cr6340864/TestIntVect.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/compiler/c2/cr6340864/TestIntVect.java	Fri Dec 21 07:46:58 2018 -0500
@@ -27,6 +27,9 @@
  * @summary Implement vectorization optimizations in hotspot-server
  *
  * @run main/othervm/timeout=400 -Xbatch -Xmx128m compiler.c2.cr6340864.TestIntVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=8 compiler.c2.cr6340864.TestIntVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=16 compiler.c2.cr6340864.TestIntVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=32 compiler.c2.cr6340864.TestIntVect
  */
 
 package compiler.c2.cr6340864;
--- a/test/hotspot/jtreg/compiler/c2/cr6340864/TestLongVect.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/compiler/c2/cr6340864/TestLongVect.java	Fri Dec 21 07:46:58 2018 -0500
@@ -27,6 +27,9 @@
  * @summary Implement vectorization optimizations in hotspot-server
  *
  * @run main/othervm/timeout=400 -Xbatch -Xmx128m compiler.c2.cr6340864.TestLongVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=8 compiler.c2.cr6340864.TestLongVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=16 compiler.c2.cr6340864.TestLongVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=32 compiler.c2.cr6340864.TestLongVect
  */
 
 package compiler.c2.cr6340864;
--- a/test/hotspot/jtreg/compiler/c2/cr6340864/TestShortVect.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/compiler/c2/cr6340864/TestShortVect.java	Fri Dec 21 07:46:58 2018 -0500
@@ -27,6 +27,9 @@
  * @summary Implement vectorization optimizations in hotspot-server
  *
  * @run main/othervm/timeout=400 -Xbatch -Xmx128m compiler.c2.cr6340864.TestShortVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=8 compiler.c2.cr6340864.TestShortVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=16 compiler.c2.cr6340864.TestShortVect
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=32 compiler.c2.cr6340864.TestShortVect
  */
 
 package compiler.c2.cr6340864;
--- a/test/hotspot/jtreg/compiler/codegen/TestCharVect2.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/compiler/codegen/TestCharVect2.java	Fri Dec 21 07:46:58 2018 -0500
@@ -27,6 +27,9 @@
  * @summary incorrect results of char vectors right shift operaiton
  *
  * @run main/othervm/timeout=400 -Xbatch -Xmx128m compiler.codegen.TestCharVect2
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=8 compiler.codegen.TestCharVect2
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=16 compiler.codegen.TestCharVect2
+ * @run main/othervm/timeout=400 -Xbatch -Xmx128m -XX:MaxVectorSize=32 compiler.codegen.TestCharVect2
  */
 
 package compiler.codegen;
--- a/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics2.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics2.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -642,6 +642,12 @@
             assertEquals(-3, asmStringCompareTo(a2, b2),
                          "TestOther.asmStringCompareTo(very_very_long_strings_2)");
         }
+
+        // See bug 8215100
+        {
+            assertEquals(-20, asmStringCompareTo("e.\u0259.", "y.e."));
+            assertEquals(20, asmStringCompareTo("y.e.", "e.\u0259."));
+        }
     }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/loopopts/Test8211698.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,57 @@
+/*
+ * 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 8211698
+ * @summary Crash in C2 compiled code during execution of double array heavy processing code
+ *
+ * @run main/othervm -XX:CompileOnly=Test8211698.test Test8211698
+ *
+ */
+
+public class Test8211698 {
+
+    public static void main(String[] args) {
+        Test8211698 issue = new Test8211698();
+        for (int i = 0; i < 10000; i++) {
+            issue.test();
+        }
+    }
+
+    public void test() {
+        int[] iarr1 = new int[888];
+        for (int i = 5; i > 0; i--) {
+            for (int j = 0; j <= i - 1; j++) {
+                int istep = 2 * j - i;
+                int iadj = 0;
+                if (istep < 0) {
+                    iadj = iarr1[-istep];
+                } else {
+                    iadj = iarr1[istep];
+                }
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/loopopts/TestSplitIfOpaque1.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,97 @@
+/*
+ * 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 8214994
+ * @summary The split-if optimization fails because an unexpected Opaque1 is encountered.
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseOnStackReplacement -XX:-BackgroundCompilation
+ *                   compiler.loopopts.TestSplitIfOpaque1
+ */
+
+package compiler.loopopts;
+
+public class TestSplitIfOpaque1 {
+
+    static class MyClass {
+        int f;
+        MyClass(int f) {
+            this.f = f;
+        }
+    }
+
+    // The inner loop is found to be a counted loop and a loop limit check
+    // is added by updating the Opaque1 input of the predicate template.
+    // This Opaque1 node is then pushed upwards to before the predicates of
+    // the outer loop and ends up right after the second 'if (b)'.
+    // The split-if optimization kicks in and splits the first predicate of
+    // the outer loop (an "obj != NULL" check) through the 'if (b)' region.
+    // We fail because the region contains an unexpected Opaque1 node.
+    static int test1(boolean b, int limit, MyClass obj) {
+        int res = 0;
+        MyClass notNull = new MyClass(42);
+        if (b) {
+            limit = 100;
+        }
+        if (b) {
+            obj = notNull;
+        }
+        for (int i = 0; i < 1000; ++i) {
+            res += obj.f;
+            for (int j = 0; j <= limit; ++j) {
+                // Empty
+            }
+        }
+        return res;
+    }
+
+    // Same as test1 but triggers slightly different failure mode
+    static int test2(boolean b, int limit, MyClass obj, int[] array) {
+        int res = 0;
+        MyClass notNull = new MyClass(12);
+        if (b) {
+            limit = 100;
+        }
+        if (b) {
+            obj = notNull;
+        }
+        for (int i = 0; i < 1000; ++i) {
+            res += obj.f;
+            for (int j = 0; j <= limit; ++j) {
+                array[j] = j;
+            }
+        }
+        return res;
+    }
+
+    public static void main(String[] args) {
+        MyClass obj = new MyClass(42);
+        int[] array = new int[101];
+        for (int i = 0; i < 20_000; i++) {
+            test1(true, 50, obj);
+            test1(false, 100, obj);
+            test2(true, 50, obj, array);
+            test2(false, 100, obj, array);
+        }
+    }
+}
--- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorThreadTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -30,7 +30,6 @@
  * @summary Verifies the JVMTI Heap Monitor Thread information sanity.
  * @compile HeapMonitorThreadTest.java
  * @run main/othervm/native -Xmx512m -agentlib:HeapMonitorTest MyPackage.HeapMonitorThreadTest
- * @requires vm.gc != "Z"
  */
 
 import java.util.List;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001.java	Fri Dec 21 07:46:58 2018 -0500
@@ -39,7 +39,6 @@
     static final int FAILED = 2;
     static final int JCK_STATUS_BASE = 95;
 
-    static boolean DEBUG_MODE = false;
     static volatile boolean popFdone = false;
     static volatile int totRes = PASSED;
     private PrintStream out;
@@ -58,9 +57,9 @@
         }
     }
 
-    native static int doPopFrame(int vrb, popFrameCls popFrameClsThr);
-    native static int suspThread(int vrb, popFrameCls popFrameClsThr);
-    native static int resThread(int vrb, popFrameCls popFrameClsThr);
+    native static int doPopFrame(popFrameCls popFrameClsThr);
+    native static int suspThread(popFrameCls popFrameClsThr);
+    native static int resThread(popFrameCls popFrameClsThr);
 
     public static void main(String[] argv) {
         argv = nsk.share.jvmti.JVMTITest.commonInit(argv);
@@ -76,10 +75,6 @@
         int retValue = 0;
 
         this.out = out;
-        for (int i = 0; i < argv.length; i++) {
-            if (argv[i].equals("-v")) // verbose mode
-                DEBUG_MODE = true;
-        }
 
         popFrameClsThr = new popFrameCls("Tested Thread");
         startingBarrier = new Wicket();
@@ -90,35 +85,26 @@
         synchronized (barrier) {
         }
 
-        if (DEBUG_MODE) {
-            out.println("Going to suspend the thread...");
-            retValue = suspThread(1, popFrameClsThr);
-        } else
-            retValue = suspThread(0, popFrameClsThr);
+        out.println("Going to suspend the thread...");
+        retValue = suspThread(popFrameClsThr);
         if (retValue != PASSED) {
             out.println("TEST: failed to suspend thread");
             return FAILED;
         }
 
         // pop a frame of the child thread
-        if (DEBUG_MODE) {
-            out.println("Going to pop a frame...");
-            retValue = doPopFrame(1, popFrameClsThr);
-        } else
-            retValue = doPopFrame(0, popFrameClsThr);
+        out.println("Going to pop a frame...");
+        retValue = doPopFrame(popFrameClsThr);
         popFdone = true;
         popFrameClsThr.letItGo();
         if (retValue != PASSED) {
             out.println("TEST: failed to pop frame");
-            resThread(0, popFrameClsThr);
+            resThread(popFrameClsThr);
             return FAILED;
         }
 
-        if (DEBUG_MODE) {
-            out.println("Going to resume the thread...");
-            retValue = resThread(1, popFrameClsThr);
-        } else
-            retValue = resThread(0, popFrameClsThr);
+        out.println("Going to resume the thread...");
+        retValue = resThread(popFrameClsThr);
         if (retValue != PASSED) {
             out.println("TEST: failed to resume thread");
             return FAILED;
@@ -143,30 +129,22 @@
 
         public void run() {
             activeMethod();
-            if (DEBUG_MODE)
-                out.println("popFrameCls (" + this +
-                    "): exiting...");
+            out.println("popFrameCls (" + this + "): exiting...");
         }
 
         public void activeMethod() {
             boolean compl = true; // complain in a finally block
 
             if (popframe001.popFdone) { // popping has been done
-                if (DEBUG_MODE)
-                    out.println("popFrameCls (" + this +
-                        "): enter activeMethod() after popping");
+                out.println("popFrameCls (" + this + "): enter activeMethod() after popping");
                 return;
             }
             try {
                 // notify the main thread
                 synchronized (popframe001.barrier) {
-                    if (DEBUG_MODE)
-                        out.println("popFrameCls (" + this +
-                            "): notifying main thread");
+                    out.println("popFrameCls (" + this + "): notifying main thread");
                     popframe001.startingBarrier.unlock();
-                    if (DEBUG_MODE)
-                        out.println("popFrameCls (" + this +
-                            "): inside activeMethod()");
+                    out.println("popFrameCls (" + this + "): inside activeMethod()");
                 }
                 // loop until the main thread pops us
                 int i = 0;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -77,52 +77,41 @@
 }
 
 JNIEXPORT jint JNICALL
-Java_nsk_jvmti_PopFrame_popframe001_suspThread(JNIEnv *env,
-        jclass cls, jint vrb, jobject susThr) {
-    jvmtiError err;
-
+Java_nsk_jvmti_PopFrame_popframe001_suspThread(JNIEnv *env, jclass cls, jobject susThr) {
     if (!caps.can_pop_frame || !caps.can_suspend) {
         return PASSED;
     }
 
-    if (vrb == 1)
-        printf(">>>>>>>> Invoke SuspendThread()\n");
-    err = jvmti->SuspendThread(susThr);
+    printf(">>>>>>>> Invoke SuspendThread()\n");
+    jvmtiError err = jvmti->SuspendThread(susThr);
     if (err != JVMTI_ERROR_NONE) {
         printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
             __FILE__, err, TranslateError(err));
         return JNI_ERR;
     }
-    if (vrb == 1)
-        printf("<<<<<<<< SuspendThread() is successfully done\n");
+    printf("<<<<<<<< SuspendThread() is successfully done\n");
     return PASSED;
 }
 
 JNIEXPORT jint JNICALL
-Java_nsk_jvmti_PopFrame_popframe001_resThread(JNIEnv *env,
-        jclass cls, jint vrb, jobject susThr) {
-    jvmtiError err;
-
+Java_nsk_jvmti_PopFrame_popframe001_resThread(JNIEnv *env, jclass cls, jobject susThr) {
     if (!caps.can_pop_frame || !caps.can_suspend) {
         return PASSED;
     }
 
-    if (vrb == 1)
-        printf(">>>>>>>> Invoke ResumeThread()\n");
-    err = jvmti->ResumeThread(susThr);
+    printf(">>>>>>>> Invoke ResumeThread()\n");
+    jvmtiError err = jvmti->ResumeThread(susThr);
     if (err != JVMTI_ERROR_NONE) {
         printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
             __FILE__, err, TranslateError(err));
         return JNI_ERR;
     }
-    if (vrb == 1)
-        printf("<<<<<<<< ResumeThread() is successfully done\n");
+    printf("<<<<<<<< ResumeThread() is successfully done\n");
     return PASSED;
 }
 
 JNIEXPORT jint JNICALL
-Java_nsk_jvmti_PopFrame_popframe001_doPopFrame(JNIEnv *env,
-        jclass cls, jint vrb, jobject frameThr) {
+Java_nsk_jvmti_PopFrame_popframe001_doPopFrame(JNIEnv *env, jclass cls, jobject frameThr) {
     jvmtiError err;
 
     if (!caps.can_pop_frame || !caps.can_suspend) {
@@ -145,8 +134,7 @@
         tot_result = STATUS_FAILED;
     }
 
-    if (vrb == 1)
-        printf(">>>>>>>> Invoke PopFrame()\n");
+    printf(">>>>>>>> Invoke PopFrame()\n");
     set_watch_ev(1); /* watch JVMTI events */
 
     err = jvmti->PopFrame(frameThr);
@@ -155,17 +143,18 @@
             err, TranslateError(err));
         printf("\tFor more info about this error see the JVMTI spec.\n");
         tot_result = STATUS_FAILED;
+    } else {
+        printf("Check #1 PASSED: PopFrame() is successfully done\n");
     }
-    else if (vrb == 1)
-        printf("Check #1 PASSED: PopFrame() is successfully done\n");
 
     set_watch_ev(0); /* ignore again JVMTI events */
     if (gen_ev) {
         printf("TEST FAILED: %d JVMTI events were generated by the function PopFrame()\n",
             gen_ev);
         tot_result = STATUS_FAILED;
-    } else if (vrb == 1)
+    } else {
         printf("Check #2 PASSED: No JVMTI events were generated by the function PopFrame()\n");
+    }
 
     return(tot_result);
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002.java	Fri Dec 21 07:46:58 2018 -0500
@@ -46,7 +46,6 @@
     static final int FAILED = 2;
     static final int JCK_STATUS_BASE = 95;
 
-    static boolean DEBUG_MODE = false;
     static volatile boolean popFdone = false;
     static volatile int totRes = PASSED;
     private PrintStream out;
@@ -65,6 +64,10 @@
         }
     }
 
+    // t_case:
+    //   1 - PopFrame for NULL thread
+    //   2 - PopFrame for invalid thread (not Thread object)
+    //   3 - PopFrame for non-suspended thread
     native static int doPopFrame(int t_case, popFrameCls popFrameClsThr);
 
     public static void main(String[] argv) {
@@ -81,16 +84,12 @@
         int retValue = 0;
 
         this.out = out;
-        for (int i = 0; i < argv.length; i++) {
-            if (argv[i].equals("-v")) // verbose mode
-                DEBUG_MODE = true;
-        }
 
         popFrameClsThr = new popFrameCls();
         synchronized (barrier) { // force a child thread to pause
             synchronized(readi) {
                 popFrameClsThr.start(); // start the child thread
-// wait until the thread will enter into a necessary method
+                // wait until the thread will enter into a necessary method
                 try {
                     readi.wait(); // wait for the child readiness
                 } catch (Exception e) {
@@ -100,53 +99,45 @@
                 }
             }
 
-/* check that if PopFrame() would be invoked with NULL pointer to
-   the thread, it will return the error JVMTI_ERROR_NULL_POINTER */
-            if (DEBUG_MODE)
-                totRes = retValue = doPopFrame(1, popFrameClsThr);
-            else
-                totRes = retValue = doPopFrame(0, popFrameClsThr);
-            if (DEBUG_MODE && retValue == PASSED)
+            /* check that if PopFrame() would be invoked with NULL pointer to
+               the thread, it will return the error JVMTI_ERROR_NULL_POINTER */
+            totRes = retValue = doPopFrame(1, popFrameClsThr);
+            if (retValue == PASSED) {
                 out.println("Check #1 PASSED:\n" +
-                    "\tPopFrame(), being invoked with NULL pointer " +
-                    "to the thread,\n" +
-                    "\treturned the appropriate error JVMTI_ERROR_NULL_POINTER");
+                        "\tPopFrame(), being invoked with NULL pointer " +
+                        "to the thread,\n" +
+                        "\treturned the appropriate error JVMTI_ERROR_NULL_POINTER");
+            }
 
-/* check that if the thread, whose top frame is to be popped,
-  is invalid, the PopFrame() will return the error
-  JVMTI_ERROR_INVALID_THREAD */
-            if (DEBUG_MODE)
-                retValue = doPopFrame(3, popFrameClsThr);
-            else
-                retValue = doPopFrame(2, popFrameClsThr);
+            /* check that if the thread, whose top frame is to be popped,
+               is invalid, the PopFrame() will return the error
+               JVMTI_ERROR_INVALID_THREAD */
+            retValue = doPopFrame(2, popFrameClsThr);
             if (retValue == FAILED) {
                 popFdone = true;
                 totRes = FAILED;
-            } else
-                if (DEBUG_MODE && retValue == PASSED)
-                    out.println("Check #3 PASSED:\n" +
+            } else {
+                out.println("Check #2 PASSED:\n" +
                         "\tPopFrame(), being invoked with " +
                         "the invalid thread,\n" +
                         "\treturned the appropriate error " +
                         "JVMTI_ERROR_INVALID_THREAD");
+            }
 
-/* check that if the thread, whose top frame is to be popped,
-  has not been suspended, the PopFrame() will return the error
-  JVMTI_ERROR_THREAD_NOT_SUSPENDED */
-            if (DEBUG_MODE)
-                retValue = doPopFrame(5, popFrameClsThr);
-            else
-                retValue = doPopFrame(4, popFrameClsThr);
+            /* check that if the thread, whose top frame is to be popped,
+               has not been suspended, the PopFrame() will return the error
+               JVMTI_ERROR_THREAD_NOT_SUSPENDED */
+            retValue = doPopFrame(3, popFrameClsThr);
             if (retValue == FAILED) {
                 popFdone = true;
                 totRes = FAILED;
-            } else
-                if (DEBUG_MODE && retValue == PASSED)
-                    out.println("Check #5 PASSED:\n" +
+            } else {
+                out.println("Check #3 PASSED:\n" +
                         "\tPopFrame(), being invoked with " +
                         "the non suspended thread,\n" +
                         "\treturned the appropriate error " +
                         "JVMTI_ERROR_THREAD_NOT_SUSPENDED");
+            }
         }
 
         return totRes;
@@ -159,17 +150,13 @@
             if (popframe002.popFdone) { // popping has been done
                 out.println("TEST FAILED: frame with popFrameCls.run() was popped");
                 popframe002.totRes = FAILED;
-            }
-            else {
+            } else {
                 synchronized(readi) {
                     readi.notify(); // notify the main thread
                 }
             }
-            if (DEBUG_MODE)
-                out.println("popFrameCls (" + this +
-                    "): inside run()");
             try {
-// pause here and get the main thread a chance to run
+                // pause here and get the main thread a chance to run
                 synchronized (popframe002.barrier) {}
                 compl = false;
             } catch (Exception e) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -102,13 +102,10 @@
     }
 
     switch (t_case) {
-/* NULL pointer to the thread in debug mode */
+    /* NULL pointer to the thread*/
     case 1:
         printf("\nInvoke PopFrame() with NULL pointer to a thread...\n");
         fflush(stdout);
-        // fallthrough
-/* NULL pointer to the thread */
-    case 0:
         set_watch_ev(1); /* watch JVMTI events */
         err = (jvmti->PopFrame(NULL)); /* explode the bomb */
         if (err != JVMTI_ERROR_INVALID_THREAD) {
@@ -118,13 +115,10 @@
             tot_result = STATUS_FAILED;
         }
         break;
-/* invalid thread in debug mode */
-    case 3:
+    /* invalid thread */
+    case 2:
         printf("\nInvoke PopFrame() for an invalid thread...\n");
         fflush(stdout);
-        // fallthrough
-/* invalid thread */
-    case 2:
         set_watch_ev(1); /* watch JVMTI events */
         err = (jvmti->PopFrame(cls)); /* explode the bomb */
         set_watch_ev(0); /* ignore again JVMTI events */
@@ -135,13 +129,10 @@
             tot_result = STATUS_FAILED;
         }
         break;
-/* non suspended thread in debug mode */
-    case 5:
+    /* non suspended thread */
+    case 3:
         printf("\nInvoke PopFrame() for a non suspended thread...\n");
         fflush(stdout);
-        // fallthrough
-/* non suspended thread */
-    case 4:
         set_watch_ev(1); /* watch JVMTI events */
         err = (jvmti->PopFrame(frameThr)); /* explode the bomb */
         set_watch_ev(0); /* ignore again JVMTI events */
@@ -152,6 +143,9 @@
             tot_result = STATUS_FAILED;
         }
         break;
+    default:
+        printf("\nTEST ERROR: unexpected case: %lld\n", (long long)t_case);
+
     }
 
     if (gen_ev) {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003.java	Fri Dec 21 07:46:58 2018 -0500
@@ -41,7 +41,6 @@
     public static final int FAILED = 2;
     static final int JCK_STATUS_BASE = 95;
 
-    public static boolean DEBUG_MODE = false;
     private popframe003p popFrameClsThr;
 
     static {
@@ -55,9 +54,9 @@
         }
     }
 
-    native static int doPopFrame(int vrb, popframe003p popFrameClsThr);
-    native static int suspThread(int vrb, popframe003p popFrameClsThr);
-    native static int resThread(int vrb, popframe003p popFrameClsThr);
+    native static int doPopFrame(popframe003p popFrameClsThr);
+    native static int suspThread(popframe003p popFrameClsThr);
+    native static int resThread(popframe003p popFrameClsThr);
 
     public static void main(String[] argv) {
         argv = nsk.share.jvmti.JVMTITest.commonInit(argv);
@@ -72,12 +71,7 @@
     private int runIt(String argv[], PrintStream out) {
         int retValue = 0;
 
-        for (int i = 0; i < argv.length; i++) {
-            if (argv[i].equals("-v")) // verbose mode
-                DEBUG_MODE = true;
-        }
-
-        popFrameClsThr = new popframe003p("Tested Thread", out, DEBUG_MODE);
+        popFrameClsThr = new popframe003p("Tested Thread", out);
         // start the child thread
         popFrameClsThr.start();
         popFrameClsThr.startingBarrier.waitFor();
@@ -85,36 +79,27 @@
         synchronized (popFrameClsThr.barrier) {
         }
 
-        if (DEBUG_MODE) {
-            out.println("Going to suspend the thread...");
-            retValue = suspThread(1, popFrameClsThr);
-        } else
-            retValue = suspThread(0, popFrameClsThr);
+        out.println("Going to suspend the thread...");
+        retValue = suspThread(popFrameClsThr);
         if (retValue != PASSED) {
             out.println("TEST: failed to suspend thread");
             return FAILED;
         }
 
         // pop the frame
-        if (DEBUG_MODE) {
-            out.println("Going to pop a frame...");
-            retValue = doPopFrame(1, popFrameClsThr);
-        } else
-            retValue = doPopFrame(0, popFrameClsThr);
+        out.println("Going to pop a frame...");
+        retValue = doPopFrame(popFrameClsThr);
 
         popFrameClsThr.popFrameHasBeenDone();
 
         if (retValue != PASSED) {
             out.println("TEST: failed to pop frame");
-            resThread(0, popFrameClsThr);
+            resThread(popFrameClsThr);
             return FAILED;
         }
 
-        if (DEBUG_MODE) {
-            out.println("Going to resume the thread...");
-            retValue = resThread(1, popFrameClsThr);
-        } else
-            retValue = resThread(0, popFrameClsThr);
+        out.println("Going to resume the thread...");
+        retValue = resThread(popFrameClsThr);
         if (retValue != PASSED) {
             out.println("TEST: failed to resume thread");
             return FAILED;
@@ -147,10 +132,10 @@
                 "\t\tbooleanPubStatGlFld=" + popframe003p.booleanPubStatGlFld + "\texpected: true\n" +
                 "\t\tstrPubStatGlFld=\"" + popframe003p.strPubStatGlFld + "\"\texpected: \"sttc glbl fld\"");
             return FAILED;
+        } else {
+            out.println("Check #6 PASSED: changes for the static fields of a class,\n" +
+                    "\twhich have been made in the popped frame's method, remained\n");
         }
-        else if (DEBUG_MODE)
-            out.println("Check #6 PASSED: changes for the static fields of a class,\n" +
-                "\twhich have been made in the popped frame's method, remained\n");
 
         return popframe003p.totRes;
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -77,53 +77,42 @@
 }
 
 JNIEXPORT jint JNICALL
-Java_nsk_jvmti_PopFrame_popframe003_suspThread(JNIEnv *env,
-        jclass cls, jint vrb, jobject susThr) {
-    jvmtiError err;
-
+Java_nsk_jvmti_PopFrame_popframe003_suspThread(JNIEnv *env, jclass cls, jobject susThr) {
     if (!caps.can_pop_frame || !caps.can_suspend) {
         return PASSED;
     }
 
-    if (vrb == 1)
-        printf(">>>>>>>> Invoke SuspendThread()\n");
-    err = jvmti->SuspendThread(susThr);
+    printf(">>>>>>>> Invoke SuspendThread()\n");
+    jvmtiError err = jvmti->SuspendThread(susThr);
     if (err != JVMTI_ERROR_NONE) {
         printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
             __FILE__, err, TranslateError(err));
         return JNI_ERR;
     }
-    if (vrb == 1)
-        printf("<<<<<<<< SuspendThread() is successfully done\n");
+    printf("<<<<<<<< SuspendThread() is successfully done\n");
     return PASSED;
 }
 
 JNIEXPORT jint JNICALL
-Java_nsk_jvmti_PopFrame_popframe003_resThread(JNIEnv *env, jclass cls, jint vrb,
-        jobject susThr) {
-    jvmtiError err;
-
+Java_nsk_jvmti_PopFrame_popframe003_resThread(JNIEnv *env, jclass cls, jobject susThr) {
     if (!caps.can_pop_frame || !caps.can_suspend) {
         return PASSED;
     }
 
-    if (vrb == 1)
-        printf(">>>>>>>> Invoke ResumeThread()\n");
-    err = jvmti->ResumeThread(susThr);
+    printf(">>>>>>>> Invoke ResumeThread()\n");
+    jvmtiError err = jvmti->ResumeThread(susThr);
     if (err != JVMTI_ERROR_NONE) {
         printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
             __FILE__, err, TranslateError(err));
         return JNI_ERR;
     }
-    if (vrb == 1)
-        printf("<<<<<<<< ResumeThread() is successfully done\n");
+    printf("<<<<<<<< ResumeThread() is successfully done\n");
     return PASSED;
 }
 
 
 JNIEXPORT jint JNICALL
-Java_nsk_jvmti_PopFrame_popframe003_doPopFrame(JNIEnv *env, jclass cls, jint vrb,
-        jobject frameThr) {
+Java_nsk_jvmti_PopFrame_popframe003_doPopFrame(JNIEnv *env, jclass cls, jobject frameThr) {
     jvmtiError err;
 
     if (!caps.can_pop_frame || !caps.can_suspend) {
@@ -146,8 +135,7 @@
         tot_result = STATUS_FAILED;
     }
 
-    if (vrb == 1)
-        printf(">>>>>>>> Invoke PopFrame()\n");
+    printf(">>>>>>>> Invoke PopFrame()\n");
     set_watch_ev(1); /* watch JVMTI events */
 
     err = jvmti->PopFrame(frameThr);
@@ -157,16 +145,18 @@
         printf("\tFor more info about this error see the JVMTI spec.\n");
         tot_result = STATUS_FAILED;
     }
-    else if (vrb == 1)
+    else {
         printf("Check #1 PASSED: PopFrame() is successfully done\n");
+    }
 
     set_watch_ev(0); /* ignore again JVMTI events */
     if (gen_ev) {
         printf("TEST FAILED: %d JVMTI events were generated by the function PopFrame()\n",
             gen_ev);
         tot_result = STATUS_FAILED;
-    } else if (vrb == 1)
+    } else {
         printf("Check #2 PASSED: No JVMTI events were generated by the function PopFrame()\n");
+    }
 
     return(tot_result);
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003p.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003p.java	Fri Dec 21 07:46:58 2018 -0500
@@ -34,7 +34,6 @@
     static final int FAILED = 2;
 
     private PrintStream out;
-    private boolean DEBUG_MODE;
 
     public static volatile int totRes = PASSED;
     public static Object barrier = new Object();
@@ -76,10 +75,9 @@
 
     private popFrameCls popframeCls;
 
-    popframe003p(String name, PrintStream out, boolean verbose) {
+    popframe003p(String name, PrintStream out) {
         super(name);
         this.out = out;
-        DEBUG_MODE = verbose;
         startingBarrier = new Wicket();
         popframeCls = new popFrameCls();
     }
@@ -124,10 +122,11 @@
                 "\t\tbooleanPubGlFld=" + booleanPubGlFld + "\texpected: true\n" +
                 "\t\tstrPubGlFld=\"" + strPubGlFld + "\"\texpected: null\n");
             totRes = FAILED;
-        } else if (DEBUG_MODE)
+        } else {
             out.println("Check #5 PASSED: changes for the instance fields of a class,\n" +
-                "\twhich have been made in the popped frame's method, remained\n" +
-                "popframe003p (" + this + "): exiting...");
+                    "\twhich have been made in the popped frame's method, remained\n" +
+                    "popframe003p (" + this + "): exiting...");
+        }
     }
 
     class popFrameCls {
@@ -149,9 +148,7 @@
             boolean compl = true;
 
             if (popFrameHasBeenDone) { // popping has been done
-                if (DEBUG_MODE)
-                    out.println("popframe003p (" + this +
-                        "): enter activeMeth() after popping");
+                out.println("popframe003p (" + this + "): enter activeMeth() after popping");
                 /* check that any changes for the arguments,
                  * which occurred in the called method, remain
                  */
@@ -162,9 +159,10 @@
                         "\tcurrent argument values: i=" + i + " l=" + l +
                         " d=" + d + " c='" + c + "'\n");
                     totRes = FAILED;
-                } else if (DEBUG_MODE)
+                } else {
                     out.println("Check #3 PASSED: changes for the arguments of " +
-                        "the popped frame's method, remained\n");
+                            "the popped frame's method, remained\n");
+                }
                 /* check that any changes for the class fields,
                  * which occurred in the called method, remain
                  */
@@ -185,10 +183,11 @@
                         "\t\tbooleanPubFld=" + booleanPubFld + "\texpected: false\n" +
                         "\t\tstrPubFld=\"" + strPubFld + "\"\texpected: \"static fld\"\n");
                     totRes = FAILED;
-                } else if (DEBUG_MODE)
+                } else {
                     out.println("Check #4 PASSED: changes for the fields of an inner class,\n" +
-                        "\twhich have been made in the popped frame's method, remained\n" +
-                        "popframe003p (" + this + "): exiting...\n");
+                            "\twhich have been made in the popped frame's method, remained\n" +
+                            "popframe003p (" + this + "): exiting...\n");
+                }
 
                 return;
             }
@@ -248,13 +247,9 @@
             try {
                 // notify the main thread about readiness
                 synchronized (barrier) {
-                    if (DEBUG_MODE)
-                        out.println("popFrameCls (" + this +
-                            "): notifying main thread");
+                    out.println("popFrameCls (" + this + "): notifying main thread");
                     startingBarrier.unlock();
-                    if (DEBUG_MODE)
-                        out.println("popFrameCls (" + this +
-                            "): inside activeMethod()");
+                    out.println("popFrameCls (" + this + "): inside activeMethod()");
                 }
                 // loop until the main thread pops us
                 int ii = 0;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004.java	Fri Dec 21 07:46:58 2018 -0500
@@ -26,7 +26,7 @@
 import java.io.*;
 
 /**
- * This test checks that a method's frame can be popped by the JVMTI
+ * This test checks that a method's frame can not be popped by the JVMTI
  * function <code>PopFrame()</code>:
  * <li>with intermediate native frames, and a thread, from which
  * the PopFrame() was called, is different than the current thread
@@ -41,7 +41,6 @@
     public static final int FAILED = 2;
     static final int JCK_STATUS_BASE = 95;
 
-    static boolean DEBUG_MODE = false;
     static volatile boolean popFdone = false;
     static volatile boolean popF2done = false;
     static volatile int totRes = PASSED;
@@ -60,8 +59,8 @@
         }
     }
 
-    native void nativeMeth(int vrb, popFrameCls popFrameClsThr);
-    native static int doPopFrame(int t_case, Thread popFrameClsThr);
+    native void nativeMeth(popFrameCls popFrameClsThr);
+    native static int doPopFrame(boolean otherThread, Thread popFrameClsThr);
     native static int getResult();
 
     public static void main(String[] argv) {
@@ -78,29 +77,22 @@
         int retValue = 0;
 
         this.out = out;
-        for (int i = 0; i < argv.length; i++) {
-            if (argv[i].equals("-v")) // verbose mode
-                DEBUG_MODE = true;
-        }
 
         PipedInputStream pipeIn = new PipedInputStream();
         popFrameClsThr = new popFrameCls(pipeIn);
         synchronized (barrier) { // force a child thread to pause
             popFrameClsThr.start(); // start a separate thread
-// wait until the thread will enter into a necessary method
+            // wait until the thread will enter into a necessary method
             try {
                 int _byte = pipeIn.read();
             } catch (IOException e) {
                 out.println("TEST FAILED: reading from a pipe: caught " + e);
                 return FAILED;
             }
-// pop the frame
+            // pop the frame
             if (popFrameClsThr.isAlive()) {
-                if (DEBUG_MODE) {
-                    out.println("Going to pop the frame...");
-                    retValue=doPopFrame(1, popFrameClsThr);
-                } else
-                    retValue=doPopFrame(0, popFrameClsThr);
+                out.println("Going to pop the frame on other thread...");
+                retValue = doPopFrame(true, popFrameClsThr);
                 popFdone = true;
                 if (retValue != PASSED)
                     return FAILED;
@@ -125,23 +117,17 @@
             totRes = FAILED;
         }
 
-        if (DEBUG_MODE) {
-            out.println("Going to pop the native frame...");
-            totRes=doPopFrame(5, Thread.currentThread());
-        } else
-            totRes=doPopFrame(4, Thread.currentThread());
-
+        out.println("Going to pop the native frame on the current thread...");
+        totRes = doPopFrame(false, Thread.currentThread());
         if (totRes != PASSED)
             return FAILED;
         else return getResult();
     }
 
     class popFrameCls extends Thread {
-        private PipedInputStream pipeIn;
         private PipedOutputStream pipeOut;
 
         popFrameCls(PipedInputStream pipeIn) {
-            this.pipeIn = pipeIn;
             try {
                 pipeOut = new PipedOutputStream(pipeIn);
             } catch (IOException e) {
@@ -152,63 +138,31 @@
         }
 
         public void run() {
-            if (DEBUG_MODE)
-                nativeMeth(1, popFrameClsThr);
-            else nativeMeth(0, popFrameClsThr);
-            if (DEBUG_MODE)
-                out.println("popFrameCls (" + this +
-                    "): exiting...");
+            nativeMeth(popFrameClsThr);
+            out.println("popFrameCls (" + this + "): exiting...");
         }
 
         public void activeMethod() {
             int retVal = FAILED;
             boolean compl = true;
 
-            if (popframe004.popFdone) { // popping has been done
-                if (DEBUG_MODE)
-                    out.println("popFrameCls (" + this +
-                        "): enter activeMethod() after popping");
-// test case #2: popping from the current thread
-                if (!popframe004.popF2done) {
-                    popframe004.popF2done = true;
-                    if (DEBUG_MODE) {
-                        out.println("popFrameCls (" + this +
-                        "): going to pop a frame from the current thread...");
-                        retVal = doPopFrame(3, popFrameClsThr);
-                    } else
-                        retVal = doPopFrame(2, popFrameClsThr);
-                    if (retVal != PASSED)
-                        popframe004.totRes = FAILED;
-                }
-                if (DEBUG_MODE)
-                    out.println("popFrameCls (" + this +
-                        "): leaving activeMethod()...");
-                return;
-            }
             try {
+                out.println("popFrameCls (" + this + "): inside activeMethod()");
                 pipeOut.write(123); // notify the main thread
-                if (DEBUG_MODE)
-                    out.println("popFrameCls (" + this +
-                        "): inside activeMethod()");
-// pause here until the main thread suspends us
+                // pause here until the main thread suspends us
                 synchronized (popframe004.barrier) {
                     while (true) {
-                        if (DEBUG_MODE)
-                            out.println("popFrameCls (" + this +
-                                "): looping...");
+                        out.println("popFrameCls (" + this + "): looping...");
                         if (popframe004.popFdone) { // popping has been done
                             // popping has not to be done due to native frame
-                            if (DEBUG_MODE)
-                                out.println("popFrameCls (" + this +
-                                    "): exiting activeMethod()...");
+                            out.println("popFrameCls (" + this + "): exiting activeMethod()...");
                             compl = false;
                             return;
                         }
                     }
                 }
             } catch (Exception e) {
-                out.println("FAILURE: popFrameCls (" + this +
-                "): caught " + e);
+                out.println("FAILURE: popFrameCls (" + this + "): caught " + e);
                 popframe004.totRes = FAILED;
                 compl = false;
             } finally {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/TestDescription.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/TestDescription.java	Fri Dec 21 07:46:58 2018 -0500
@@ -29,7 +29,7 @@
  * VM Testbase keywords: [quick, jpda, jvmti, noras]
  * VM Testbase readme:
  * DESCRIPTION
- *     This test checks that a method's frame can be popped by
+ *     This test checks that a method's frame can not be popped by
  *     the JVMTI function PopFrame():
  *      - with intermediate native frames, and a thread, from which
  *        the PopFrame() was called, is different than the current thread;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp	Fri Dec 21 07:46:58 2018 -0500
@@ -77,68 +77,64 @@
     jvmti->RawMonitorExit(watch_ev_monitor);
 }
 
-int suspThread(jint vrb, jobject susThr) {
-    jvmtiError err;
-
+int suspThread(jobject susThr) {
     if (!caps.can_pop_frame || !caps.can_suspend) {
         return PASSED;
     }
 
-    if (vrb == 1) {
-        printf(">>>>>>>> Invoke SuspendThread()\n");
-        fflush(stdout);
-    }
-    err = jvmti->SuspendThread(susThr);
+    printf(">>>>>>>> Invoke SuspendThread()\n");
+    fflush(stdout);
+
+    jvmtiError err = jvmti->SuspendThread(susThr);
     if (err != JVMTI_ERROR_NONE) {
         printf("%s: Failed to call SuspendThread(): error=%d: %s\n",
             __FILE__, err, TranslateError(err));
         return JNI_ERR;
     }
-    if (vrb == 1) {
-        printf("<<<<<<<< SuspendThread() is successfully done\n");
-        fflush(stdout);
-    }
+    printf("<<<<<<<< SuspendThread() is successfully done\n");
+    fflush(stdout);
+
     return PASSED;
 }
 
-int resThread(jint vrb, jobject susThr) {
+int resThread(jobject susThr) {
+    if (!caps.can_pop_frame || !caps.can_suspend) {
+        return PASSED;
+    }
+
+    printf(">>>>>>>> Invoke ResumeThread()\n");
+    fflush(stdout);
+
+    jvmtiError err = jvmti->ResumeThread(susThr);
+    if (err != JVMTI_ERROR_NONE) {
+        printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
+            __FILE__, err, TranslateError(err));
+        return JNI_ERR;
+    }
+
+    printf("<<<<<<<< ResumeThread() is successfully done\n");
+    fflush(stdout);
+
+    return PASSED;
+}
+
+JNIEXPORT jint JNICALL
+Java_nsk_jvmti_PopFrame_popframe004_doPopFrame(JNIEnv *env, jclass cls, jboolean otherThread,
+        jobject frameThr) {
     jvmtiError err;
 
+    if (popDone) {
+        return PASSED;
+    }
+
     if (!caps.can_pop_frame || !caps.can_suspend) {
         return PASSED;
     }
 
-    if (vrb == 1) {
-        printf(">>>>>>>> Invoke ResumeThread()\n");
-        fflush(stdout);
-    }
-    err = jvmti->ResumeThread(susThr);
-    if (err != JVMTI_ERROR_NONE) {
-        printf("%s: Failed to call ResumeThread(): error=%d: %s\n",
-            __FILE__, err, TranslateError(err));
-        return JNI_ERR;
-    }
-    if (vrb == 1) {
-        printf("<<<<<<<< ResumeThread() is successfully done\n");
-        fflush(stdout);
+    if (otherThread) { /* we are in a different thread */
+        if (suspThread(frameThr) != PASSED)
+            return STATUS_FAILED;
     }
-    return PASSED;
-}
-
-JNIEXPORT jint JNICALL
-Java_nsk_jvmti_PopFrame_popframe004_doPopFrame(JNIEnv *env, jclass cls, jint t_case,
-        jobject frameThr) {
-    jvmtiError err;
-
-    if (popDone) return PASSED;
-
-    if (!caps.can_pop_frame || !caps.can_suspend) {
-        return PASSED;
-    }
-
-    if (t_case <= 1) /* we are in a different thread */
-        if (suspThread(t_case, frameThr) != PASSED)
-            return STATUS_FAILED;
 
     err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
         JVMTI_EVENT_METHOD_EXIT, frameThr);
@@ -156,26 +152,29 @@
         tot_result = STATUS_FAILED;
     }
 
-    if (t_case & 1) {
-        printf(">>>>>>>> Invoke PopFrame()\n");
-        fflush(stdout);
-    }
+    printf(">>>>>>>> Invoke PopFrame()\n");
+    fflush(stdout);
     set_watch_ev(1); /* watch JVMTI events */
 
     err = jvmti->PopFrame(frameThr);
-    if (err == JVMTI_ERROR_NONE) {
-        printf("Check #%d FAILED: PopFrame() was unexpectedly done\n", t_case);
+    switch (err) {
+    case JVMTI_ERROR_NONE:
+        printf("Check FAILED: PopFrame() was unexpectedly done\n");
         tot_result = STATUS_FAILED;
-    } else if (err != JVMTI_ERROR_NO_MORE_FRAMES &&
-               err != JVMTI_ERROR_OPAQUE_FRAME) {
-        printf("Check #%d FAILED: PopFrame() returned unexpected error %d: %s\n",
-            t_case, err, TranslateError(err));
+        break;
+    case JVMTI_ERROR_NO_MORE_FRAMES:
+    case JVMTI_ERROR_OPAQUE_FRAME:
+    case JVMTI_ERROR_THREAD_NOT_SUSPENDED:
+        printf("Check PASSED: PopFrame() failed as expected with %d: %s\n",
+            err, TranslateError(err));
+        fflush(stdout);
+        break;
+    default:
+        printf("Check FAILED: PopFrame() returned unexpected error %d: %s\n",
+            err, TranslateError(err));
         printf("\tFor more info about this error please refer to the JVMTI spec.\n");
         tot_result = STATUS_FAILED;
-    } else if (t_case & 1) {
-        printf("Check #%d PASSED: PopFrame() failed as expected with %d: %s\n",
-            t_case, err, TranslateError(err));
-        fflush(stdout);
+        break;
     }
 
     set_watch_ev(0); /* ignore again JVMTI events */
@@ -183,15 +182,16 @@
         printf("TEST FAILED: %d JVMTI events were generated by the function PopFrame()\n",
             gen_ev);
         tot_result = STATUS_FAILED;
-    } else if (t_case & 1) {
-        printf("Check #%d PASSED: No JVMTI events were generated by the function PopFrame()\n",
-            t_case+1);
+    } else {
+        printf("Check PASSED: No JVMTI events were generated by the function PopFrame()\n");
         fflush(stdout);
     }
 
-    if (t_case <= 1) /* we are in a different thread */
-        return resThread(t_case, frameThr);
-    else popDone = 1; /* stop looping */
+    if (otherThread) { /* we are in a different thread */
+        return resThread(frameThr);
+    } else {
+        popDone = 1; /* stop looping */
+    }
     return PASSED;
 }
 
@@ -276,8 +276,7 @@
     return (tot_result);
 }
 
-void nativeMeth2(JNIEnv *env, jobject obj, jint vrb,
-        jobject frameThr) {
+void nativeMeth2(JNIEnv *env, jobject obj, jobject frameThr) {
     jclass cls = env->GetObjectClass(frameThr);
     jmethodID mid = NULL;
 
@@ -287,21 +286,16 @@
         tot_result = STATUS_FAILED;
         return;
     }
-    if (vrb == 1) {
-        printf("nativeMeth2(): calling the Java activeMethod()\n");
-        fflush(stdout);
-    }
+    printf("nativeMeth2(): calling the Java activeMethod()\n");
+    fflush(stdout);
     env->CallVoidMethod(frameThr, mid);
 }
 
 JNIEXPORT void JNICALL
-Java_nsk_jvmti_PopFrame_popframe004_nativeMeth(JNIEnv *env, jobject obj, jint vrb,
-        jobject frameThr) {
-    if (vrb == 1) {
-        printf("nativeMeth(): calling the native nativeMeth2()\n");
-        fflush(stdout);
-    }
-    nativeMeth2(env, obj, vrb, frameThr);
+Java_nsk_jvmti_PopFrame_popframe004_nativeMeth(JNIEnv *env, jobject obj, jobject frameThr) {
+    printf("nativeMeth(): calling the native nativeMeth2()\n");
+    fflush(stdout);
+    nativeMeth2(env, obj, frameThr);
 }
 
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005.java	Fri Dec 21 07:46:58 2018 -0500
@@ -37,7 +37,6 @@
 public class popframe005 {
     static final int WAIT_TIME = 2000;
 
-    static boolean DEBUG_MODE = false;
     static volatile int testedStep = 0; /* 0- action no yet started
                                            1- a frame is to be popped
                                            2- checking monitors state
@@ -78,19 +77,15 @@
         Object lockObj[] = new Object[2];
 
         this.out = out;
-        for (int i = 0; i < argv.length; i++) {
-            if (argv[i].equals("-v")) // verbose mode
-                DEBUG_MODE = true;
-        }
 
         lockObj[0] = new Object();
         lockObj[1] = new Object();
 
-        startGuarantee = new Wicket("startGuarantee", 1, (DEBUG_MODE ? System.out : null));
-        finishGuarantee = new Wicket("finishGuarantee", 1, (DEBUG_MODE ? System.out : null));
+        startGuarantee = new Wicket("startGuarantee", 1, System.out);
+        finishGuarantee = new Wicket("finishGuarantee", 1, System.out);
 
         allThreadsStoppedGuarantee =
-            new Wicket("allThreadsStoppedGuarantee", 3, (DEBUG_MODE ? System.out : null));
+            new Wicket("allThreadsStoppedGuarantee", 3, System.out);
 
         // start a thread whose top frame is to be popped
         popFrameClsThr = new popFrameCls("Tested Thread", lockObj);
@@ -109,20 +104,16 @@
         // pause until the first thread exit notification-block
         allThreadsStoppedGuarantee.waitFor();
         synchronized (allThreadsStoppedBarrier) {
-            if (DEBUG_MODE) {
-                out.println("Passed barrier in main thread");
-                out.flush();
-            }
+            out.println("Passed barrier in main thread");
+            out.flush();
         }
 
         /////////////////////// popping a frame ////////////////////////
         testedStep = 1;
 
-        if (DEBUG_MODE) {
-            out.println("State transition: testedStep: 0->1");
-            out.println("Going to pop the frame...");
-            out.flush();
-        }
+        out.println("State transition: testedStep: 0->1");
+        out.println("Going to pop the frame...");
+        out.flush();
 
         boolean retValue = doPopFrame(popFrameClsThr);
 
@@ -133,10 +124,8 @@
         ///////////////////// check monitors state /////////////////////
         testedStep = 2;
 
-        if (DEBUG_MODE) {
-            out.println("State transition: testedStep: 1->2");
-            out.flush();
-        }
+        out.println("State transition: testedStep: 1->2");
+        out.flush();
 
         if (!popFrameClsThr.isAlive()) {
             out.println("TEST FAILURE: thread with the method's popped frame is dead");
@@ -146,8 +135,7 @@
         try {
             objWaiterThr2.join(WAIT_TIME);
         } catch (InterruptedException e) {
-            if (DEBUG_MODE)
-                out.println("Joining the objWaiterThr2's thread: caught " + e);
+            out.println("Joining the objWaiterThr2's thread: caught " + e);
         }
 
         if (objWaiterThr2.isAlive()) { // objWaiterThr2 should be dead
@@ -158,10 +146,8 @@
         try {
             objWaiterThr1.join(WAIT_TIME);
         } catch (InterruptedException e) {
-            if (DEBUG_MODE) {
-                out.println("Joining the objWaiterThr1's thread: caught " + e);
-                out.flush();
-            }
+            out.println("Joining the objWaiterThr1's thread: caught " + e);
+            out.flush();
         }
         if (!objWaiterThr1.isAlive()) { // objWaiterThr2 should be alive
             out.println("TEST FAILED: Lock acquired by a frame, different from the popped one,\n"
@@ -172,10 +158,8 @@
         /////////////////////// finish the test ///////////////////////
         testedStep = 3;
 
-        if (DEBUG_MODE) {
-            out.println("State transition: testedStep: 2->3");
-            out.flush();
-        }
+        out.println("State transition: testedStep: 2->3");
+        out.flush();
 
         finishGuarantee.unlock();
 
@@ -209,29 +193,22 @@
             synchronized(lockObj[0]) {
                 activeMethod();
             }
-            if (DEBUG_MODE)
-                out.println("popFrameCls (" + this +
-                    "): exiting..."); out.flush();
+            out.println("popFrameCls (" + this + "): exiting...");
+            out.flush();
         }
 
         public void activeMethod() {
             boolean compl = true;
 
             if (popframe005.testedStep != 0) { // popping has been done
-                if (DEBUG_MODE) {
-                    out.println("popFrameCls (" + this +
-                        "): enter activeMethod() after popping");
-                    out.flush();
-                }
+                out.println("popFrameCls (" + this + "): enter activeMethod() after popping");
+                out.flush();
 
                 // wait for checking monitors state by the main thread
                 finishGuarantee.waitFor();
 
-                if (DEBUG_MODE) {
-                    out.println("popFrameCls (" + this +
-                        "): leaving activeMethod()");
-                    out.flush();
-                }
+                out.println("popFrameCls (" + this + "): leaving activeMethod()");
+                out.flush();
 
                 return;
             }
@@ -239,10 +216,8 @@
             try {
                 synchronized(lockObj[1]) {
                     synchronized(allThreadsStoppedBarrier) {
-                        if (DEBUG_MODE) {
-                            out.println("popFrameCls (" + this + "): inside activeMethod()");
-                            out.flush();
-                        }
+                        out.println("popFrameCls (" + this + "): inside activeMethod()");
+                        out.flush();
 
                         // notify the main thread
                         startGuarantee.unlock();
@@ -301,12 +276,10 @@
         public void run() {
             // notify the main thread
             synchronized(allThreadsStoppedBarrier) {
-                if (DEBUG_MODE) {
-                    out.println("objWaiter(" + this +
-                            "): waiting for a lockObj" + objIdent +
-                            "'s monitor; testedStep=" + testedStep);
-                    out.flush();
-                }
+                out.println("objWaiter(" + this +
+                        "): waiting for a lockObj" + objIdent +
+                        "'s monitor; testedStep=" + testedStep);
+                out.flush();
 
                 allThreadsStoppedGuarantee.unlock();
             }
@@ -317,17 +290,15 @@
                         out.println("TEST FAILED: the lockObj" + objIdent +
                             "'s monitor became free too early");
                         result = Consts.TEST_FAILED;
-                    } else if (DEBUG_MODE) {
+                    } else {
                         out.println("Check PASSED: objWaiter(" + this +
                             "): enter the lockObj" + objIdent + "'s monitor");
                         out.flush();
                     }
                 }
 
-                if (DEBUG_MODE) {
-                    out.println("objWaiter (" + this + "): exiting...");
-                    out.flush();
-                }
+                out.println("objWaiter (" + this + "): exiting...");
+                out.flush();
             } catch (Exception e) {
                 out.println("TEST FAILURE: objWaiter (" + this + "): caught " + e);
             }
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -64,7 +64,7 @@
  *          implementation.
  * @modules java.base/sun.util.logging
  *          java.base/jdk.internal.logger
- * @build AccessSystemLogger BaseDefaultLoggerFinderTest CustomSystemClassLoader
+ * @build AccessSystemLogger BaseDefaultLoggerFinderTest CustomSystemClassLoader BaseLoggerFinder
  * @run  driver AccessSystemLogger
  * @run  main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest NOSECURITY
  * @run  main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader BaseDefaultLoggerFinderTest NOPERMISSIONS
@@ -97,7 +97,7 @@
     static {
         try {
             providerClass = new Class<?>[] {
-                ClassLoader.getSystemClassLoader().loadClass("BaseDefaultLoggerFinderTest$BaseLoggerFinder"),
+                ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder"),
             };
         } catch (ClassNotFoundException ex) {
             throw new ExceptionInInitializerError(ex);
@@ -120,43 +120,6 @@
         PlatformLogger.Bridge asPlatformLoggerBridge(Logger logger);
     }
 
-    public static class BaseLoggerFinder extends DefaultLoggerFinder implements TestLoggerFinder {
-
-        static final RuntimePermission LOGGERFINDER_PERMISSION =
-                    new RuntimePermission("loggerFinder");
-        public BaseLoggerFinder() {
-            if (fails.get()) {
-                throw new RuntimeException("Simulate exception while loading provider");
-            }
-        }
-
-        @Override
-        public void setLevel(Logger logger, Level level, Module caller) {
-            PrivilegedAction<Void> pa = () -> {
-                setLevel(logger, PlatformLogger.toPlatformLevel(level), caller);
-                return null;
-            };
-            AccessController.doPrivileged(pa);
-        }
-
-        @Override
-        public void setLevel(Logger logger, PlatformLogger.Level level, Module caller) {
-            PrivilegedAction<Logger> pa = () -> demandLoggerFor(logger.getName(), caller);
-            Logger impl = AccessController.doPrivileged(pa);
-            SimpleConsoleLogger.class.cast(impl)
-                    .getLoggerConfiguration()
-                    .setPlatformLevel(level);
-        }
-
-        @Override
-        public PlatformLogger.Bridge asPlatformLoggerBridge(Logger logger) {
-            PrivilegedAction<PlatformLogger.Bridge> pa = () ->
-                PlatformLogger.Bridge.convert(logger);
-            return AccessController.doPrivileged(pa);
-        }
-
-    }
-
     public static class MyBundle extends ResourceBundle {
 
         final ConcurrentHashMap<String,String> map = new ConcurrentHashMap<>();
@@ -477,7 +440,7 @@
                     System.out.println("\n*** Without Security Manager\n");
                     System.out.println(TestLoggerFinder.conf.get());
                     provider = getLoggerFinder(expectedClass);
-                    if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+                    if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
                         throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
                     }
                     test(provider, true);
@@ -498,7 +461,7 @@
                         try {
                             allowControl.get().set(true);
                             provider = getLoggerFinder(expectedClass);
-                            if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+                            if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
                                 throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
                             }
                         } finally {
@@ -516,7 +479,7 @@
                     try {
                         allowControl.get().set(true);
                         provider = getLoggerFinder(expectedClass);
-                        if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+                        if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
                             throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
                         }
                         test(provider, true);
@@ -532,7 +495,7 @@
                     try {
                         allowControl.get().set(true);
                         provider = getLoggerFinder(expectedClass);
-                        if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+                        if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
                             throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
                         }
                         test(provider, CustomLoggerWrapper::new, true);
@@ -550,7 +513,7 @@
                     try {
                         allowControl.get().set(true);
                         provider = getLoggerFinder(expectedClass);
-                        if (!provider.getClass().getName().equals("BaseDefaultLoggerFinderTest$BaseLoggerFinder")) {
+                        if (!provider.getClass().getName().equals("BaseLoggerFinder")) {
                             throw new RuntimeException("Unexpected provider: " + provider.getClass().getName());
                         }
                         test(provider, ReflectionLoggerWrapper::new, true);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseLoggerFinder.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015, 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 jdk.internal.logger.DefaultLoggerFinder;
+import jdk.internal.logger.SimpleConsoleLogger;
+import sun.util.logging.PlatformLogger;
+
+import java.lang.System.Logger;
+import java.lang.System.Logger.Level;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public class BaseLoggerFinder extends DefaultLoggerFinder
+        implements BaseDefaultLoggerFinderTest.TestLoggerFinder {
+
+    public BaseLoggerFinder() {
+        if (fails.get()) {
+            throw new RuntimeException("Simulate exception while loading provider");
+        }
+    }
+
+    @Override
+    public void setLevel(Logger logger, Level level, Module caller) {
+        PrivilegedAction<Void> pa = () -> {
+            setLevel(logger, PlatformLogger.toPlatformLevel(level), caller);
+            return null;
+        };
+        AccessController.doPrivileged(pa);
+    }
+
+    @Override
+    public void setLevel(Logger logger, PlatformLogger.Level level, Module caller) {
+        PrivilegedAction<Logger> pa = () -> demandLoggerFor(logger.getName(), caller);
+        Logger impl = AccessController.doPrivileged(pa);
+        SimpleConsoleLogger.class.cast(impl)
+                .getLoggerConfiguration()
+                .setPlatformLevel(level);
+    }
+
+    @Override
+    public PlatformLogger.Bridge asPlatformLoggerBridge(Logger logger) {
+        PrivilegedAction<PlatformLogger.Bridge> pa = () ->
+                PlatformLogger.Bridge.convert(logger);
+        return AccessController.doPrivileged(pa);
+    }
+
+}
+
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/CustomSystemClassLoader.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/CustomSystemClassLoader.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -32,6 +32,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 
 /**
@@ -48,8 +49,8 @@
 
 
     final List<String> finderClassNames =
-            Arrays.asList("BaseDefaultLoggerFinderTest$BaseLoggerFinder");
-    final Map<String, Class<?>> finderClasses = new HashMap<>();
+            Arrays.asList("BaseLoggerFinder");
+    final Map<String, Class<?>> finderClasses = new ConcurrentHashMap<>();
     Class<?> testLoggerFinderClass;
 
     public CustomSystemClassLoader() {
@@ -61,9 +62,14 @@
 
     private Class<?> defineFinderClass(String name)
         throws ClassNotFoundException {
+        Class<?> finderClass =  finderClasses.get(name);
+        if (finderClass != null) return finderClass;
+
         final Object obj = getClassLoadingLock(name);
         synchronized(obj) {
-            if (finderClasses.get(name) != null) return finderClasses.get(name);
+            finderClasses.get(name);
+            if (finderClass != null) return finderClass;
+
             if (testLoggerFinderClass == null) {
                 // Hack: we  load testLoggerFinderClass to get its code source.
                 //       we can't use this.getClass() since we are in the boot.
@@ -76,7 +82,7 @@
                     byte[] b = Files.readAllBytes(file.toPath());
                     Permissions perms = new Permissions();
                     perms.add(new AllPermission());
-                    Class<?> finderClass = defineClass(
+                    finderClass = defineClass(
                             name, b, 0, b.length, new ProtectionDomain(
                             this.getClass().getProtectionDomain().getCodeSource(),
                             perms));
@@ -94,9 +100,13 @@
         }
     }
 
+    private static boolean matches(String prefix, String name) {
+        return prefix.equals(name) || name.startsWith(prefix + "$");
+    }
+
     @Override
     public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        if (finderClassNames.contains(name)) {
+        if (finderClassNames.stream().anyMatch(n -> matches(n, name))) {
             Class<?> c = defineFinderClass(name);
             if (resolve) {
                 resolveClass(c);
@@ -108,7 +118,7 @@
 
     @Override
     protected Class<?> findClass(String name) throws ClassNotFoundException {
-        if (finderClassNames.contains(name)) {
+        if (finderClassNames.stream().anyMatch(n -> matches(n, name))) {
             return defineFinderClass(name);
         }
         return super.findClass(name);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:46:58 2018 -0500
@@ -1,1 +1,1 @@
-BaseDefaultLoggerFinderTest$BaseLoggerFinder
+BaseLoggerFinder
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -55,7 +55,7 @@
  *   Tests a naive implementation of System.Logger, and in particular
  *   the default mapping provided by PlatformLogger.Bridge.
  * @modules java.base/sun.util.logging java.base/jdk.internal.logger
- * @build CustomSystemClassLoader BaseLoggerBridgeTest
+ * @build CustomSystemClassLoader BaseLoggerFinder BaseLoggerBridgeTest
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest NOSECURITY
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest NOPERMISSIONS
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader BaseLoggerBridgeTest WITHPERMISSIONS
@@ -94,7 +94,7 @@
     static final Class<?> providerClass;
     static {
         try {
-            providerClass = ClassLoader.getSystemClassLoader().loadClass("BaseLoggerBridgeTest$BaseLoggerFinder");
+            providerClass = ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder");
         } catch (ClassNotFoundException ex) {
             throw new ExceptionInInitializerError(ex);
         }
@@ -336,33 +336,12 @@
                 log(LogEvent.of(isLoggable(level), name, level, thrown, msgSupplier));
             }
 
-
-
         }
 
         public Logger getLogger(String name, Module caller);
         public Logger getLocalizedLogger(String name, ResourceBundle bundle, Module caller);
     }
 
-    public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
-        static final RuntimePermission LOGGERFINDER_PERMISSION =
-                new RuntimePermission("loggerFinder");
-        @Override
-        public Logger getLogger(String name, Module caller) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(LOGGERFINDER_PERMISSION);
-            }
-            PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
-            ClassLoader callerLoader = AccessController.doPrivileged(pa);
-            if (callerLoader == null) {
-                return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
-            } else {
-                return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
-            }
-        }
-    }
-
     static PlatformLogger.Bridge convert(Logger logger) {
         boolean old = allowAll.get().get();
         allowAccess.get().set(true);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerFinder.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, 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.security.AccessController;
+import java.security.PrivilegedAction;
+import java.lang.System.LoggerFinder;
+import java.lang.System.Logger;
+
+public class BaseLoggerFinder extends LoggerFinder
+        implements BaseLoggerBridgeTest.TestLoggerFinder {
+    static final RuntimePermission LOGGERFINDER_PERMISSION =
+            new RuntimePermission("loggerFinder");
+
+    @Override
+    public Logger getLogger(String name, Module caller) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(LOGGERFINDER_PERMISSION);
+        }
+        PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+        ClassLoader callerLoader = AccessController.doPrivileged(pa);
+        if (callerLoader == null) {
+            return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
+        } else {
+            return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
+        }
+    }
+}
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/CustomSystemClassLoader.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/CustomSystemClassLoader.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -28,7 +28,7 @@
 import java.security.AllPermission;
 import java.security.Permissions;
 import java.security.ProtectionDomain;
-
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * A custom ClassLoader to load the concrete LoggerFinder class
@@ -39,7 +39,7 @@
 public class CustomSystemClassLoader extends ClassLoader {
 
 
-    Class<?> finderClass = null;
+    private final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
 
     public CustomSystemClassLoader() {
         super();
@@ -50,8 +50,13 @@
 
     private Class<?> defineFinderClass(String name)
         throws ClassNotFoundException {
+        Class<?> finderClass = classes.get(name);
+        if (finderClass != null) return finderClass;
+
         final Object obj = getClassLoadingLock(name);
+
         synchronized(obj) {
+            finderClass = classes.get(name);
             if (finderClass != null) return finderClass;
 
             URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
@@ -66,6 +71,7 @@
                             this.getClass().getProtectionDomain().getCodeSource(),
                             perms));
                     System.out.println("Loaded " + name);
+                    classes.put(name, finderClass);
                     return finderClass;
                 } catch (Throwable ex) {
                     ex.printStackTrace();
@@ -80,7 +86,7 @@
 
     @Override
     public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        if (name.endsWith("$BaseLoggerFinder")) {
+        if (name.equals("BaseLoggerFinder") || name.startsWith("BaseLoggerFinder$")) {
             Class<?> c = defineFinderClass(name);
             if (resolve) {
                 resolveClass(c);
@@ -92,7 +98,7 @@
 
     @Override
     protected Class<?> findClass(String name) throws ClassNotFoundException {
-        if (name.endsWith("$BaseLoggerFinder")) {
+        if (name.equals("BaseLoggerFinder") || name.startsWith("BaseLoggerFinder$")) {
             return defineFinderClass(name);
         }
         return super.findClass(name);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:46:58 2018 -0500
@@ -1,1 +1,1 @@
-BaseLoggerBridgeTest$BaseLoggerFinder
+BaseLoggerFinder
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BaseLoggerFinder.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, 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.lang.System.Logger;
+import java.lang.System.LoggerFinder;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public class BaseLoggerFinder extends LoggerFinder
+        implements BasePlatformLoggerTest.TestLoggerFinder {
+
+    public static final RuntimePermission LOGGERFINDER_PERMISSION =
+            new RuntimePermission("loggerFinder");
+
+    @Override
+    public Logger getLogger(String name, Module caller) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(LOGGERFINDER_PERMISSION);
+        }
+        PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+        ClassLoader callerLoader = AccessController.doPrivileged(pa);
+        if (callerLoader == null) {
+            return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
+        } else {
+            return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
+        }
+    }
+}
+
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -55,7 +55,7 @@
  *   Tests a naive implementation of System.Logger, and in particular
  *   the default mapping provided by PlatformLogger.
  * @modules java.base/sun.util.logging
- * @build CustomSystemClassLoader BasePlatformLoggerTest
+ * @build CustomSystemClassLoader BaseLoggerFinder BasePlatformLoggerTest
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOSECURITY
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest NOPERMISSIONS
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader BasePlatformLoggerTest WITHPERMISSIONS
@@ -90,7 +90,7 @@
     static final Class<?> providerClass;
     static {
         try {
-            providerClass = ClassLoader.getSystemClassLoader().loadClass("BasePlatformLoggerTest$BaseLoggerFinder");
+            providerClass = ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder");
         } catch (ClassNotFoundException ex) {
             throw new ExceptionInInitializerError(ex);
         }
@@ -330,23 +330,6 @@
         public Logger getLogger(String name, Module caller);
     }
 
-    public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
-        @Override
-        public Logger getLogger(String name, Module caller) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(LOGGERFINDER_PERMISSION);
-            }
-            PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
-            ClassLoader callerLoader = AccessController.doPrivileged(pa);
-            if (callerLoader == null) {
-                return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
-            } else {
-                return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
-            }
-        }
-    }
-
     static PlatformLogger getPlatformLogger(String name) {
         boolean old = allowAccess.get().get();
         allowAccess.get().set(true);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/CustomSystemClassLoader.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/CustomSystemClassLoader.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -28,6 +28,7 @@
 import java.security.AllPermission;
 import java.security.Permissions;
 import java.security.ProtectionDomain;
+import java.util.concurrent.ConcurrentHashMap;
 
 
 /**
@@ -39,7 +40,7 @@
 public class CustomSystemClassLoader extends ClassLoader {
 
 
-    Class<?> finderClass = null;
+    private final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
 
     public CustomSystemClassLoader() {
         super();
@@ -50,8 +51,12 @@
 
     private Class<?> defineFinderClass(String name)
         throws ClassNotFoundException {
+        Class<?> finderClass = classes.get(name);
+        if (finderClass != null) return finderClass;
+
         final Object obj = getClassLoadingLock(name);
         synchronized(obj) {
+            finderClass = classes.get(name);
             if (finderClass != null) return finderClass;
 
             URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
@@ -66,6 +71,7 @@
                             this.getClass().getProtectionDomain().getCodeSource(),
                             perms));
                     System.out.println("Loaded " + name);
+                    classes.put(name, finderClass);
                     return finderClass;
                 } catch (Throwable ex) {
                     ex.printStackTrace();
@@ -80,7 +86,7 @@
 
     @Override
     public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        if (name.endsWith("$BaseLoggerFinder")) {
+        if (name.endsWith("BaseLoggerFinder") || name.startsWith("BaseLoggerFinder$")) {
             Class<?> c = defineFinderClass(name);
             if (resolve) {
                 resolveClass(c);
@@ -92,7 +98,7 @@
 
     @Override
     protected Class<?> findClass(String name) throws ClassNotFoundException {
-        if (name.endsWith("$BaseLoggerFinder")) {
+        if (name.endsWith("BaseLoggerFinder") || name.startsWith("BaseLoggerFinder$")) {
             return defineFinderClass(name);
         }
         return super.findClass(name);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:46:58 2018 -0500
@@ -1,1 +1,1 @@
-BasePlatformLoggerTest$BaseLoggerFinder
+BaseLoggerFinder
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/CustomSystemClassLoader.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/CustomSystemClassLoader.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -28,6 +28,7 @@
 import java.security.AllPermission;
 import java.security.Permissions;
 import java.security.ProtectionDomain;
+import java.util.concurrent.ConcurrentHashMap;
 
 
 /**
@@ -39,8 +40,7 @@
 public class CustomSystemClassLoader extends ClassLoader {
 
 
-    Class<?> loggerFinderClass = null;
-//    Class<?> loggerImplClass = null;
+    private final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
 
     public CustomSystemClassLoader() {
         super();
@@ -51,8 +51,13 @@
 
     private Class<?> defineFinderClass(String name)
         throws ClassNotFoundException {
+
+        Class<?> loggerFinderClass = classes.get(name);
+        if (loggerFinderClass != null) return loggerFinderClass;
+
         final Object obj = getClassLoadingLock(name);
         synchronized(obj) {
+            loggerFinderClass = classes.get(name);
             if (loggerFinderClass != null) return loggerFinderClass;
 
             URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
@@ -66,6 +71,7 @@
                             name, b, 0, b.length, new ProtectionDomain(
                             this.getClass().getProtectionDomain().getCodeSource(),
                             perms));
+                    classes.put(name, loggerFinderClass);
                     System.out.println("Loaded " + name);
                     return loggerFinderClass;
                 } catch (Throwable ex) {
@@ -78,61 +84,22 @@
             }
         }
     }
-//    private Class<?> defineLoggerImplClass(String name)
-//        throws ClassNotFoundException {
-//        final Object obj = getClassLoadingLock(name);
-//        synchronized(obj) {
-//            if (loggerImplClass != null) return loggerImplClass;
-//
-//            URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
-//            File file = new File(url.getPath(), name+".class");
-//            if (file.canRead()) {
-//                try {
-//                    byte[] b = Files.readAllBytes(file.toPath());
-//                    Permissions perms = new Permissions();
-//                    perms.add(new AllPermission());
-//                    loggerImplClass = defineClass(
-//                            name, b, 0, b.length, new ProtectionDomain(
-//                            this.getClass().getProtectionDomain().getCodeSource(),
-//                            perms));
-//                    System.out.println("Loaded " + name);
-//                    return loggerImplClass;
-//                } catch (Throwable ex) {
-//                    ex.printStackTrace();
-//                    throw new ClassNotFoundException(name, ex);
-//                }
-//            } else {
-//                throw new ClassNotFoundException(name,
-//                        new IOException(file.toPath() + ": can't read"));
-//            }
-//        }
-//    }
-//
+
     @Override
     public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        if (name.endsWith("$LogProducerFinder")) {
+        if (name.equals("LogProducerFinder") || name.startsWith("LogProducerFinder$")) {
             Class<?> c = defineFinderClass(name);
             if (resolve) {
                 resolveClass(c);
             }
             return c;
         }
-//        if (name.endsWith("$LogProducerFinder$LoggerImpl")) {
-//            Class<?> c = defineLoggerImplClass(name);
-//            if (resolve) {
-//                resolveClass(c);
-//            }
-//            return c;
-//        }
         return super.loadClass(name, resolve);
     }
 
     @Override
     protected Class<?> findClass(String name) throws ClassNotFoundException {
-//        if (name.endsWith("$LogProducerFinder$LoggerImpl")) {
-//            return defineLoggerImplClass(name);
-//        }
-        if (name.endsWith("$$LogProducerFinder")) {
+        if (name.equals("LogProducerFinder") || name.startsWith("LogProducerFinder$")) {
             return defineFinderClass(name);
         }
         return super.findClass(name);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LogProducerFinder.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, 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.lang.System.Logger;
+import java.lang.System.LoggerFinder;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class LogProducerFinder  extends LoggerFinder {
+
+    public static final RuntimePermission LOGGERFINDER_PERMISSION =
+            new RuntimePermission("loggerFinder");
+    final ConcurrentHashMap<String, LoggerBridgeTest.LoggerImpl> system = new ConcurrentHashMap<>();
+    final ConcurrentHashMap<String, LoggerBridgeTest.LoggerImpl> user = new ConcurrentHashMap<>();
+
+    @Override
+    public Logger getLogger(String name, Module caller) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(LOGGERFINDER_PERMISSION);
+        }
+        PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+        ClassLoader callerLoader = AccessController.doPrivileged(pa);
+        if (callerLoader == null) {
+            return system.computeIfAbsent(name, (n) -> new LoggerBridgeTest.LoggerImpl(n));
+        } else {
+            return user.computeIfAbsent(name, (n) -> new LoggerBridgeTest.LoggerImpl(n));
+        }
+    }
+}
+
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -23,13 +23,11 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.security.AccessControlException;
-import java.security.AccessController;
 import java.security.CodeSource;
 import java.security.Permission;
 import java.security.PermissionCollection;
 import java.security.Permissions;
 import java.security.Policy;
-import java.security.PrivilegedAction;
 import java.security.ProtectionDomain;
 import java.util.Arrays;
 import java.util.Collections;
@@ -48,7 +46,6 @@
 import java.util.logging.LogRecord;
 import java.lang.System.LoggerFinder;
 import java.lang.System.Logger;
-import java.lang.System.Logger.Level;
 import java.util.stream.Stream;
 import sun.util.logging.PlatformLogger;
 
@@ -61,7 +58,7 @@
  * @modules java.base/sun.util.logging
  *          java.base/jdk.internal.logger
  *          java.logging
- * @build CustomSystemClassLoader LoggerBridgeTest
+ * @build CustomSystemClassLoader LogProducerFinder LoggerBridgeTest
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOSECURITY
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest NOPERMISSIONS
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader LoggerBridgeTest WITHPERMISSIONS
@@ -231,204 +228,188 @@
     static {
         try {
             // Preload classes before the security manager is on.
-            providerClass = ClassLoader.getSystemClassLoader().loadClass("LoggerBridgeTest$LogProducerFinder");
+            providerClass = ClassLoader.getSystemClassLoader().loadClass("LogProducerFinder");
             ((LoggerFinder)providerClass.newInstance()).getLogger("foo", providerClass.getModule());
         } catch (Exception ex) {
             throw new ExceptionInInitializerError(ex);
         }
     }
 
-    public static class LogProducerFinder extends LoggerFinder {
-        final ConcurrentHashMap<String, LoggerImpl> system = new ConcurrentHashMap<>();
-        final ConcurrentHashMap<String, LoggerImpl> user = new ConcurrentHashMap<>();
-
-        public class LoggerImpl implements Logger, PlatformLogger.Bridge {
-            private final String name;
-            private sun.util.logging.PlatformLogger.Level level = sun.util.logging.PlatformLogger.Level.INFO;
-            private sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
-            private sun.util.logging.PlatformLogger.Level FINE = sun.util.logging.PlatformLogger.Level.FINE;
-            private sun.util.logging.PlatformLogger.Level FINER = sun.util.logging.PlatformLogger.Level.FINER;
-            private sun.util.logging.PlatformLogger.Level FINEST = sun.util.logging.PlatformLogger.Level.FINEST;
-            private sun.util.logging.PlatformLogger.Level CONFIG = sun.util.logging.PlatformLogger.Level.CONFIG;
-            private sun.util.logging.PlatformLogger.Level INFO = sun.util.logging.PlatformLogger.Level.INFO;
-            private sun.util.logging.PlatformLogger.Level WARNING = sun.util.logging.PlatformLogger.Level.WARNING;
-            private sun.util.logging.PlatformLogger.Level SEVERE = sun.util.logging.PlatformLogger.Level.SEVERE;
-
-            public LoggerImpl(String name) {
-                this.name = name;
-            }
+    public static class LoggerImpl implements System.Logger, PlatformLogger.Bridge {
+        private final String name;
+        private PlatformLogger.Level level = PlatformLogger.Level.INFO;
+        private PlatformLogger.Level OFF = PlatformLogger.Level.OFF;
+        private PlatformLogger.Level FINE = PlatformLogger.Level.FINE;
+        private PlatformLogger.Level FINER = PlatformLogger.Level.FINER;
+        private PlatformLogger.Level FINEST = PlatformLogger.Level.FINEST;
+        private PlatformLogger.Level CONFIG = PlatformLogger.Level.CONFIG;
+        private PlatformLogger.Level INFO = PlatformLogger.Level.INFO;
+        private PlatformLogger.Level WARNING = PlatformLogger.Level.WARNING;
+        private PlatformLogger.Level SEVERE = PlatformLogger.Level.SEVERE;
 
-            @Override
-            public String getName() {
-                return name;
-            }
-
-            @Override
-            public boolean isLoggable(Level level) {
-                return this.level != OFF && this.level.intValue() <= level.getSeverity();
-            }
-
-            @Override
-            public void log(Level level, ResourceBundle bundle,
-                    String key, Throwable thrown) {
-                throw new UnsupportedOperationException();
-            }
-
-            @Override
-            public void log(Level level, ResourceBundle bundle,
-                    String format, Object... params) {
-                throw new UnsupportedOperationException();
-            }
+        public LoggerImpl(String name) {
+            this.name = name;
+        }
 
-            void log(LogEvent event) {
-                eventQueue.add(event);
-            }
-
-            @Override
-            public void log(Level level, Supplier<String> msgSupplier) {
-                throw new UnsupportedOperationException();
-            }
+        public void configureLevel(PlatformLogger.Level level) {
+            this.level = level;
+        }
 
-            @Override
-            public void log(Level level, Supplier<String> msgSupplier,
-                    Throwable thrown) {
-                throw new UnsupportedOperationException();
-            }
-
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level, String msg) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msg, null, (Object[])null));
-            }
+        @Override
+        public String getName() {
+            return name;
+        }
 
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level,
-                    Supplier<String> msgSupplier) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msgSupplier, null, (Object[])null));
-            }
+        @Override
+        public boolean isLoggable(Level level) {
+            return this.level != OFF && this.level.intValue() <= level.getSeverity();
+        }
 
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level, String msg,
-                    Object... params) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msg, null, params));
-            }
-
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level, String msg,
-                    Throwable thrown) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msg, thrown, (Object[])null));
-            }
+        @Override
+        public void log(Level level, ResourceBundle bundle,
+                        String key, Throwable thrown) {
+            throw new UnsupportedOperationException();
+        }
 
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level, Throwable thrown,
-                    Supplier<String> msgSupplier) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msgSupplier, thrown, (Object[])null));
-            }
+        @Override
+        public void log(Level level, ResourceBundle bundle,
+                        String format, Object... params) {
+            throw new UnsupportedOperationException();
+        }
 
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, String msg) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msg, null, (Object[])null));
-            }
+        void log(LogEvent event) {
+            eventQueue.add(event);
+        }
 
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, Supplier<String> msgSupplier) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msgSupplier, null, (Object[])null));
-            }
+        @Override
+        public void log(Level level, Supplier<String> msgSupplier) {
+            throw new UnsupportedOperationException();
+        }
 
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, String msg, Object... params) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msg, null, params));
-            }
-
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, String msg, Throwable thrown) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msg, thrown, (Object[])null));
-            }
+        @Override
+        public void log(Level level, Supplier<String> msgSupplier,
+                        Throwable thrown) {
+            throw new UnsupportedOperationException();
+        }
 
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, Throwable thrown,
-                    Supplier<String> msgSupplier) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msgSupplier, thrown, (Object[])null));
-            }
+        @Override
+        public void log(PlatformLogger.Level level, String msg) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msg, null, (Object[]) null));
+        }
 
-            @Override
-            public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, ResourceBundle bundle, String msg,
-                    Object... params) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, bundle, msg, null, params));
-            }
-
-            @Override
-            public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
-                    String msg, Object... params) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, bundle, msg, null, params));
-            }
+        @Override
+        public void log(PlatformLogger.Level level,
+                        Supplier<String> msgSupplier) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msgSupplier, null, (Object[]) null));
+        }
 
-            @Override
-            public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, ResourceBundle bundle, String msg,
-                    Throwable thrown) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, bundle, msg, thrown, (Object[])null));
-            }
+        @Override
+        public void log(PlatformLogger.Level level, String msg,
+                        Object... params) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msg, null, params));
+        }
 
-            @Override
-            public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
-                    String msg, Throwable thrown) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, bundle, msg, thrown, (Object[])null));
-            }
-
-            @Override
-            public boolean isLoggable(sun.util.logging.PlatformLogger.Level level) {
-                return this.level != OFF && level.intValue()
-                        >= this.level.intValue();
-            }
-
-            @Override
-            public boolean isEnabled() {
-                return this.level != OFF;
-            }
-
+        @Override
+        public void log(PlatformLogger.Level level, String msg,
+                        Throwable thrown) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msg, thrown, (Object[]) null));
         }
 
         @Override
-        public Logger getLogger(String name, Module caller) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(LOGGERFINDER_PERMISSION);
-            }
-            PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
-            ClassLoader callerLoader = AccessController.doPrivileged(pa);
-            if (callerLoader == null) {
-                return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
-            } else {
-                return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
-            }
+        public void log(PlatformLogger.Level level, Throwable thrown,
+                        Supplier<String> msgSupplier) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msgSupplier, thrown, (Object[]) null));
+        }
+
+        @Override
+        public void logp(PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, String msg) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msg, null, (Object[]) null));
+        }
+
+        @Override
+        public void logp(PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, Supplier<String> msgSupplier) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msgSupplier, null, (Object[]) null));
+        }
+
+        @Override
+        public void logp(PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, String msg, Object... params) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msg, null, params));
+        }
+
+        @Override
+        public void logp(PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, String msg, Throwable thrown) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msg, thrown, (Object[]) null));
         }
+
+        @Override
+        public void logp(PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, Throwable thrown,
+                         Supplier<String> msgSupplier) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msgSupplier, thrown, (Object[]) null));
+        }
+
+        @Override
+        public void logrb(PlatformLogger.Level level, String sourceClass,
+                          String sourceMethod, ResourceBundle bundle, String msg,
+                          Object... params) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, bundle, msg, null, params));
+        }
+
+        @Override
+        public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
+                          String msg, Object... params) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, bundle, msg, null, params));
+        }
+
+        @Override
+        public void logrb(PlatformLogger.Level level, String sourceClass,
+                          String sourceMethod, ResourceBundle bundle, String msg,
+                          Throwable thrown) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, bundle, msg, thrown, (Object[]) null));
+        }
+
+        @Override
+        public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
+                          String msg, Throwable thrown) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, bundle, msg, thrown, (Object[]) null));
+        }
+
+        @Override
+        public boolean isLoggable(PlatformLogger.Level level) {
+            return this.level != OFF && level.intValue()
+                    >= this.level.intValue();
+        }
+
+        @Override
+        public boolean isEnabled() {
+            return this.level != OFF;
+        }
+
     }
 
     static ClassLoader getClassLoader(Module m) {
@@ -675,14 +656,14 @@
         }
 
 
-        final LogProducerFinder.LoggerImpl appSink;
-        final LogProducerFinder.LoggerImpl sysSink;
+        final LoggerImpl appSink;
+        final LoggerImpl sysSink;
         boolean old = allowControl.get().get();
         allowControl.get().set(true);
         try {
-           appSink = LogProducerFinder.LoggerImpl.class.cast(
+           appSink = LoggerImpl.class.cast(
                    provider.getLogger("foo",  LoggerBridgeTest.class.getModule()));
-           sysSink = LogProducerFinder.LoggerImpl.class.cast(
+           sysSink = LoggerImpl.class.cast(
                         provider.getLogger("foo", Thread.class.getModule()));
         } finally {
             allowControl.get().set(old);
@@ -739,20 +720,20 @@
         }
     }
 
-    static void setLevel( LogProducerFinder.LoggerImpl sink,
+    static void setLevel(LoggerImpl sink,
             sun.util.logging.PlatformLogger.Level loggerLevel) {
-        sink.level = loggerLevel;
+        sink.configureLevel(loggerLevel);
     }
 
-    // Calls the methods defined on LogProducer and verify the
-    // parameters received by the underlying LogProducerFinder.LoggerImpl
+    // Calls the methods defined on PlatformLogger.Bridge and verify the
+    // parameters received by the underlying LoggerImpl
     // logger.
     private static void testLogger(LoggerFinder provider,
             Map<Object, String> loggerDescMap,
             String name,
             ResourceBundle loggerBundle,
             PlatformLogger.Bridge logger,
-            LogProducerFinder.LoggerImpl sink) {
+            LoggerImpl sink) {
 
         System.out.println("Testing " + loggerDescMap.get(logger) + "[" + logger + "]");
         final sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:46:58 2018 -0500
@@ -1,1 +1,1 @@
-LoggerBridgeTest$LogProducerFinder
+LogProducerFinder
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/BaseLoggerFinder.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2015, 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 jdk.internal.logger.SimpleConsoleLogger;
+
+import java.lang.System.Logger;
+import java.lang.System.LoggerFinder;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public class BaseLoggerFinder extends LoggerFinder
+        implements LoggerFinderLoaderTest.TestLoggerFinder {
+
+    static final RuntimePermission LOGGERFINDER_PERMISSION =
+            new RuntimePermission("loggerFinder");
+
+    public BaseLoggerFinder() {
+        if (fails.get()) {
+            throw new RuntimeException("Simulate exception while loading provider");
+        }
+    }
+
+    Logger createSimpleLogger(String name) {
+        PrivilegedAction<Logger> pa = () -> SimpleConsoleLogger.makeSimpleLogger(name);
+        return AccessController.doPrivileged(pa);
+    }
+
+    @Override
+    public Logger getLogger(String name, Module caller) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(LOGGERFINDER_PERMISSION);
+        }
+        PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+        ClassLoader callerLoader = AccessController.doPrivileged(pa);
+        if (callerLoader == null) {
+            return system.computeIfAbsent(name, (n) -> new LoggerImpl(n, createSimpleLogger(name)));
+        } else {
+            return user.computeIfAbsent(name, (n) -> new LoggerImpl(n, createSimpleLogger(name)));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/BaseLoggerFinder2.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2015, 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.lang.System.Logger;
+import java.lang.System.LoggerFinder;
+import java.util.ServiceConfigurationError;
+
+public class BaseLoggerFinder2 extends LoggerFinder
+        implements LoggerFinderLoaderTest.TestLoggerFinder {
+
+    public BaseLoggerFinder2() {
+        throw new ServiceConfigurationError("Should not come here");
+    }
+
+    @Override
+    public Logger getLogger(String name, Module caller) {
+        throw new ServiceConfigurationError("Should not come here");
+    }
+}
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/CustomSystemClassLoader.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/CustomSystemClassLoader.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -32,6 +32,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 
 /**
@@ -48,9 +49,8 @@
 
 
     final List<String> finderClassNames =
-            Arrays.asList("LoggerFinderLoaderTest$BaseLoggerFinder",
-                    "LoggerFinderLoaderTest$BaseLoggerFinder2");
-    final Map<String, Class<?>> finderClasses = new HashMap<>();
+            Arrays.asList("BaseLoggerFinder", "BaseLoggerFinder2");
+    final Map<String, Class<?>> finderClasses = new ConcurrentHashMap<>();
     Class<?> testLoggerFinderClass;
 
     public CustomSystemClassLoader() {
@@ -62,9 +62,13 @@
 
     private Class<?> defineFinderClass(String name)
         throws ClassNotFoundException {
+        Class<?> finderClass =  finderClasses.get(name);
+        if (finderClass != null) return finderClass;
+
         final Object obj = getClassLoadingLock(name);
         synchronized(obj) {
-            if (finderClasses.get(name) != null) return finderClasses.get(name);
+            finderClass =  finderClasses.get(name);
+            if (finderClass != null) return finderClass;
             if (testLoggerFinderClass == null) {
                 // Hack: we  load testLoggerFinderClass to get its code source.
                 //       we can't use this.getClass() since we are in the boot.
@@ -77,7 +81,7 @@
                     byte[] b = Files.readAllBytes(file.toPath());
                     Permissions perms = new Permissions();
                     perms.add(new AllPermission());
-                    Class<?> finderClass = defineClass(
+                    finderClass = defineClass(
                             name, b, 0, b.length, new ProtectionDomain(
                             this.getClass().getProtectionDomain().getCodeSource(),
                             perms));
@@ -95,9 +99,13 @@
         }
     }
 
+    private static boolean matches(String prefix, String name) {
+        return prefix.equals(name) || name.startsWith(prefix + "$");
+    }
+
     @Override
     public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        if (finderClassNames.contains(name)) {
+        if (finderClassNames.stream().anyMatch(n -> matches(n, name))) {
             Class<?> c = defineFinderClass(name);
             if (resolve) {
                 resolveClass(c);
@@ -109,7 +117,7 @@
 
     @Override
     protected Class<?> findClass(String name) throws ClassNotFoundException {
-        if (finderClassNames.contains(name)) {
+        if (finderClassNames.stream().anyMatch(n -> matches(n, name))) {
             return defineFinderClass(name);
         }
         return super.findClass(name);
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -63,7 +63,7 @@
  *          DefaultLoggerFinder and SimpleConsoleLogger implementation.
  * @modules java.base/sun.util.logging
  *          java.base/jdk.internal.logger
- * @build AccessSystemLogger LoggerFinderLoaderTest CustomSystemClassLoader
+ * @build AccessSystemLogger LoggerFinderLoaderTest CustomSystemClassLoader BaseLoggerFinder BaseLoggerFinder2
  * @run  driver AccessSystemLogger
  * @run  main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest NOSECURITY
  * @run  main/othervm -Xbootclasspath/a:boot -Djava.system.class.loader=CustomSystemClassLoader LoggerFinderLoaderTest NOPERMISSIONS
@@ -118,8 +118,8 @@
     static {
         try {
             providerClass = new Class<?>[] {
-                ClassLoader.getSystemClassLoader().loadClass("LoggerFinderLoaderTest$BaseLoggerFinder"),
-                ClassLoader.getSystemClassLoader().loadClass("LoggerFinderLoaderTest$BaseLoggerFinder2")
+                ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder"),
+                ClassLoader.getSystemClassLoader().loadClass("BaseLoggerFinder2")
             };
         } catch (ClassNotFoundException ex) {
             throw new ExceptionInInitializerError(ex);
@@ -171,51 +171,6 @@
         public Logger getLocalizedLogger(String name, ResourceBundle bundle, Module caller);
     }
 
-    public static class BaseLoggerFinder extends LoggerFinder implements TestLoggerFinder {
-
-        static final RuntimePermission LOGGERFINDER_PERMISSION =
-                    new RuntimePermission("loggerFinder");
-        public BaseLoggerFinder() {
-            if (fails.get()) {
-                throw new RuntimeException("Simulate exception while loading provider");
-            }
-        }
-
-        System.Logger createSimpleLogger(String name) {
-            PrivilegedAction<System.Logger> pa = () -> SimpleConsoleLogger.makeSimpleLogger(name);
-            return AccessController.doPrivileged(pa);
-        }
-
-
-        @Override
-        public Logger getLogger(String name, Module caller) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(LOGGERFINDER_PERMISSION);
-            }
-            PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
-            ClassLoader callerLoader = AccessController.doPrivileged(pa);
-            if (callerLoader == null) {
-                return system.computeIfAbsent(name, (n) -> new LoggerImpl(n, createSimpleLogger(name)));
-            } else {
-                return user.computeIfAbsent(name, (n) -> new LoggerImpl(n, createSimpleLogger(name)));
-            }
-        }
-    }
-
-    public static class BaseLoggerFinder2 extends LoggerFinder implements TestLoggerFinder {
-
-        static final RuntimePermission LOGGERFINDER_PERMISSION =
-                    new RuntimePermission("loggerFinder");
-        public BaseLoggerFinder2() {
-            throw new ServiceConfigurationError("Should not come here");
-        }
-        @Override
-        public Logger getLogger(String name, Module caller) {
-            throw new ServiceConfigurationError("Should not come here");
-        }
-    }
-
     public static class MyBundle extends ResourceBundle {
 
         final ConcurrentHashMap<String,String> map = new ConcurrentHashMap<>();
@@ -270,7 +225,7 @@
                         throw new RuntimeException("Expected message not found. Error stream contained: " + warning);
                     }
                     if (TestLoggerFinder.fails.get()) {
-                        if (!warning.contains("java.util.ServiceConfigurationError: java.lang.System$LoggerFinder: Provider LoggerFinderLoaderTest$BaseLoggerFinder could not be instantiated")) {
+                        if (!warning.contains("java.util.ServiceConfigurationError: java.lang.System$LoggerFinder: Provider BaseLoggerFinder could not be instantiated")) {
                             throw new RuntimeException("Expected message not found. Error stream contained: " + warning);
                         }
                     } else if (singleton) {
@@ -425,7 +380,7 @@
                 ServiceLoader.load(LoggerFinder.class, ClassLoader.getSystemClassLoader());
             Iterator<LoggerFinder> iterator = serviceLoader.iterator();
             Object firstProvider = iterator.next();
-            if (!firstProvider.getClass().getName().equals("LoggerFinderLoaderTest$BaseLoggerFinder")) {
+            if (!firstProvider.getClass().getName().equals("BaseLoggerFinder")) {
                 throw new RuntimeException("Unexpected provider: " + firstProvider.getClass().getName());
             }
             if (!iterator.hasNext()) {
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:46:58 2018 -0500
@@ -1,3 +1,3 @@
-LoggerFinderLoaderTest$BaseLoggerFinder
-LoggerFinderLoaderTest$BaseLoggerFinder2
+BaseLoggerFinder
+BaseLoggerFinder2
 
--- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/CustomSystemClassLoader.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/CustomSystemClassLoader.java	Fri Dec 21 07:46:58 2018 -0500
@@ -28,6 +28,8 @@
 import java.security.AllPermission;
 import java.security.Permissions;
 import java.security.ProtectionDomain;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 
 /**
@@ -39,7 +41,7 @@
 public class CustomSystemClassLoader extends ClassLoader {
 
 
-    Class<?> loggerFinderClass = null;
+    final ConcurrentHashMap<String, Class<?>> classes = new ConcurrentHashMap<>();
 
     public CustomSystemClassLoader() {
         super();
@@ -50,8 +52,11 @@
 
     private Class<?> defineFinderClass(String name)
         throws ClassNotFoundException {
+        Class<?> loggerFinderClass = classes.get(name);
+        if (loggerFinderClass != null) return loggerFinderClass;
         final Object obj = getClassLoadingLock(name);
         synchronized(obj) {
+            loggerFinderClass = classes.get(name);
             if (loggerFinderClass != null) return loggerFinderClass;
 
             URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation();
@@ -66,6 +71,7 @@
                             this.getClass().getProtectionDomain().getCodeSource(),
                             perms));
                     System.out.println("Loaded " + name);
+                    classes.put(name, loggerFinderClass);
                     return loggerFinderClass;
                 } catch (Throwable ex) {
                     ex.printStackTrace();
@@ -80,7 +86,7 @@
 
     @Override
     public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-        if (name.endsWith("$LogProducerFinder")) {
+        if (name.equals("LogProducerFinder") || name.startsWith("LogProducerFinder$")) {
             Class<?> c = defineFinderClass(name);
             if (resolve) {
                 resolveClass(c);
@@ -92,7 +98,7 @@
 
     @Override
     protected Class<?> findClass(String name) throws ClassNotFoundException {
-        if (name.endsWith("$$LogProducerFinder")) {
+        if (name.equals("LogProducerFinder") || name.startsWith("LogProducerFinder$")) {
             return defineFinderClass(name);
         }
         return super.findClass(name);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/LogProducerFinder.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, 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.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Queue;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Supplier;
+import java.lang.System.LoggerFinder;
+import java.lang.System.Logger;
+
+public class LogProducerFinder extends LoggerFinder {
+
+    static final RuntimePermission LOGGERFINDER_PERMISSION =
+            new RuntimePermission("loggerFinder");
+    final ConcurrentHashMap<String, PlatformLoggerBridgeTest.LoggerImpl>
+            system = new ConcurrentHashMap<>();
+    final ConcurrentHashMap<String, PlatformLoggerBridgeTest.LoggerImpl>
+            user = new ConcurrentHashMap<>();
+
+    private static PlatformLoggerBridgeTest.LoggerImpl newLoggerImpl(String name) {
+        return new PlatformLoggerBridgeTest.LoggerImpl(name);
+    }
+
+    @Override
+    public Logger getLogger(String name, Module caller) {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(LOGGERFINDER_PERMISSION);
+        }
+        PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
+        ClassLoader callerLoader = AccessController.doPrivileged(pa);
+        if (callerLoader == null) {
+            return system.computeIfAbsent(name, (n) -> newLoggerImpl(n));
+        } else {
+            return user.computeIfAbsent(name, (n) -> newLoggerImpl(n));
+        }
+    }
+}
--- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/META-INF/services/java.lang.System$LoggerFinder	Fri Dec 21 07:46:58 2018 -0500
@@ -1,1 +1,1 @@
-PlatformLoggerBridgeTest$LogProducerFinder
+LogProducerFinder
--- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -58,7 +58,7 @@
  *          backend whose loggers implement PlatformLogger.Bridge.
  * @modules java.base/sun.util.logging
  *          java.logging
- * @build CustomSystemClassLoader PlatformLoggerBridgeTest
+ * @build CustomSystemClassLoader LogProducerFinder PlatformLoggerBridgeTest
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOSECURITY
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest NOPERMISSIONS
  * @run  main/othervm -Djava.system.class.loader=CustomSystemClassLoader PlatformLoggerBridgeTest WITHPERMISSIONS
@@ -89,19 +89,19 @@
         }
     };
 
+    public static final Queue<LogEvent> eventQueue = new ArrayBlockingQueue<>(128);
+
     static final Class<?> providerClass;
     static {
         try {
             // Preload classes before the security manager is on.
-            providerClass = ClassLoader.getSystemClassLoader().loadClass("PlatformLoggerBridgeTest$LogProducerFinder");
+            providerClass = ClassLoader.getSystemClassLoader().loadClass("LogProducerFinder");
             ((LoggerFinder)providerClass.newInstance()).getLogger("foo", providerClass.getModule());
         } catch (Exception ex) {
             throw new ExceptionInInitializerError(ex);
         }
     }
 
-    public static final Queue<LogEvent> eventQueue = new ArrayBlockingQueue<>(128);
-
     public static final class LogEvent implements Cloneable {
 
         public LogEvent() {
@@ -234,200 +234,182 @@
 
     }
 
-    public static class LogProducerFinder extends LoggerFinder {
-        static final RuntimePermission LOGGERFINDER_PERMISSION =
-                new RuntimePermission("loggerFinder");
-        final ConcurrentHashMap<String, LoggerImpl> system = new ConcurrentHashMap<>();
-        final ConcurrentHashMap<String, LoggerImpl> user = new ConcurrentHashMap<>();
-
-        public class LoggerImpl implements Logger, PlatformLogger.Bridge {
-            private final String name;
-            private sun.util.logging.PlatformLogger.Level level = sun.util.logging.PlatformLogger.Level.INFO;
-            private sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
-            private sun.util.logging.PlatformLogger.Level FINE = sun.util.logging.PlatformLogger.Level.FINE;
-            private sun.util.logging.PlatformLogger.Level FINER = sun.util.logging.PlatformLogger.Level.FINER;
-            private sun.util.logging.PlatformLogger.Level FINEST = sun.util.logging.PlatformLogger.Level.FINEST;
-            private sun.util.logging.PlatformLogger.Level CONFIG = sun.util.logging.PlatformLogger.Level.CONFIG;
-            private sun.util.logging.PlatformLogger.Level INFO = sun.util.logging.PlatformLogger.Level.INFO;
-            private sun.util.logging.PlatformLogger.Level WARNING = sun.util.logging.PlatformLogger.Level.WARNING;
-            private sun.util.logging.PlatformLogger.Level SEVERE = sun.util.logging.PlatformLogger.Level.SEVERE;
+    public static class LoggerImpl implements System.Logger, PlatformLogger.Bridge {
+        private final String name;
+        private sun.util.logging.PlatformLogger.Level level = sun.util.logging.PlatformLogger.Level.INFO;
+        private sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
+        private sun.util.logging.PlatformLogger.Level FINE = sun.util.logging.PlatformLogger.Level.FINE;
+        private sun.util.logging.PlatformLogger.Level FINER = sun.util.logging.PlatformLogger.Level.FINER;
+        private sun.util.logging.PlatformLogger.Level FINEST = sun.util.logging.PlatformLogger.Level.FINEST;
+        private sun.util.logging.PlatformLogger.Level CONFIG = sun.util.logging.PlatformLogger.Level.CONFIG;
+        private sun.util.logging.PlatformLogger.Level INFO = sun.util.logging.PlatformLogger.Level.INFO;
+        private sun.util.logging.PlatformLogger.Level WARNING = sun.util.logging.PlatformLogger.Level.WARNING;
+        private sun.util.logging.PlatformLogger.Level SEVERE = sun.util.logging.PlatformLogger.Level.SEVERE;
 
-            public LoggerImpl(String name) {
-                this.name = name;
-            }
-
-            @Override
-            public String getName() {
-                return name;
-            }
-
-            @Override
-            public boolean isLoggable(Level level) {
-                return this.level != OFF && this.level.intValue() <= level.getSeverity();
-            }
-
-            @Override
-            public void log(Level level, ResourceBundle bundle,
-                    String key, Throwable thrown) {
-                throw new UnsupportedOperationException();
-            }
+        public LoggerImpl(String name) {
+            this.name = name;
+        }
 
-            @Override
-            public void log(Level level, ResourceBundle bundle,
-                    String format, Object... params) {
-                throw new UnsupportedOperationException();
-            }
-
-            void log(LogEvent event) {
-                eventQueue.add(event);
-            }
+        public void configureLevel(sun.util.logging.PlatformLogger.Level level) {
+            this.level = level;
+        }
 
-            @Override
-            public void log(Level level, Supplier<String> msgSupplier) {
-                throw new UnsupportedOperationException();
-            }
-
-            @Override
-            public void log(Level level, Supplier<String> msgSupplier,
-                            Throwable thrown) {
-                throw new UnsupportedOperationException();
-            }
+        @Override
+        public String getName() {
+            return name;
+        }
 
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level, String msg) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msg, null, (Object[])null));
-            }
-
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level,
-                    Supplier<String> msgSupplier) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msgSupplier, null, (Object[])null));
-            }
+        @Override
+        public boolean isLoggable(Level level) {
+            return this.level != OFF && this.level.intValue() <= level.getSeverity();
+        }
 
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level, String msg,
-                    Object... params) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msg, null, params));
-            }
-
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level, String msg,
-                    Throwable thrown) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msg, thrown, (Object[])null));
-            }
+        @Override
+        public void log(Level level, ResourceBundle bundle,
+                        String key, Throwable thrown) {
+            throw new UnsupportedOperationException();
+        }
 
-            @Override
-            public void log(sun.util.logging.PlatformLogger.Level level, Throwable thrown,
-                    Supplier<String> msgSupplier) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, null, msgSupplier, thrown, (Object[])null));
-            }
+        @Override
+        public void log(Level level, ResourceBundle bundle,
+                        String format, Object... params) {
+            throw new UnsupportedOperationException();
+        }
 
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, String msg) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msg, null, (Object[])null));
-            }
+        void log(PlatformLoggerBridgeTest.LogEvent event) {
+            eventQueue.add(event);
+        }
 
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, Supplier<String> msgSupplier) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msgSupplier, null, (Object[])null));
-            }
+        @Override
+        public void log(Level level, Supplier<String> msgSupplier) {
+            throw new UnsupportedOperationException();
+        }
 
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, String msg, Object... params) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msg, null, params));
-            }
-
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, String msg, Throwable thrown) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msg, thrown, (Object[])null));
-            }
+        @Override
+        public void log(Level level, Supplier<String> msgSupplier,
+                        Throwable thrown) {
+            throw new UnsupportedOperationException();
+        }
 
-            @Override
-            public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, Throwable thrown,
-                    Supplier<String> msgSupplier) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, null, msgSupplier, thrown, (Object[])null));
-            }
+        @Override
+        public void log(sun.util.logging.PlatformLogger.Level level, String msg) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msg, null, (Object[]) null));
+        }
 
-            @Override
-            public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, ResourceBundle bundle, String msg,
-                    Object... params) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, bundle, msg, null, params));
-            }
-
-            @Override
-            public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
-                    String msg, Object... params) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, bundle, msg, null, params));
-            }
+        @Override
+        public void log(sun.util.logging.PlatformLogger.Level level,
+                        Supplier<String> msgSupplier) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msgSupplier, null, (Object[]) null));
+        }
 
-            @Override
-            public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
-                    String sourceMethod, ResourceBundle bundle, String msg,
-                    Throwable thrown) {
-                log(LogEvent.of(isLoggable(level), name,
-                        sourceClass, sourceMethod,
-                        level, bundle, msg, thrown, (Object[])null));
-            }
+        @Override
+        public void log(sun.util.logging.PlatformLogger.Level level, String msg,
+                        Object... params) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msg, null, params));
+        }
 
-            @Override
-            public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
-                    String msg, Throwable thrown) {
-                log(LogEvent.of(isLoggable(level), name, null, null,
-                        level, bundle, msg, thrown, (Object[])null));
-            }
-
-            @Override
-            public boolean isLoggable(sun.util.logging.PlatformLogger.Level level) {
-                return this.level != OFF && level.intValue()
-                        >= this.level.intValue();
-            }
-
-            @Override
-            public boolean isEnabled() {
-                return this.level != OFF;
-            }
-
-
+        @Override
+        public void log(sun.util.logging.PlatformLogger.Level level, String msg,
+                        Throwable thrown) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msg, thrown, (Object[]) null));
         }
 
         @Override
-        public Logger getLogger(String name, Module caller) {
-            SecurityManager sm = System.getSecurityManager();
-            if (sm != null) {
-                sm.checkPermission(LOGGERFINDER_PERMISSION);
-            }
-            PrivilegedAction<ClassLoader> pa = () -> caller.getClassLoader();
-            ClassLoader callerLoader = AccessController.doPrivileged(pa);
-            if (callerLoader == null) {
-                return system.computeIfAbsent(name, (n) -> new LoggerImpl(n));
-            } else {
-                return user.computeIfAbsent(name, (n) -> new LoggerImpl(n));
-            }
+        public void log(sun.util.logging.PlatformLogger.Level level, Throwable thrown,
+                        Supplier<String> msgSupplier) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, null, msgSupplier, thrown, (Object[]) null));
+        }
+
+        @Override
+        public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, String msg) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msg, null, (Object[]) null));
+        }
+
+        @Override
+        public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, Supplier<String> msgSupplier) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msgSupplier, null, (Object[]) null));
+        }
+
+        @Override
+        public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, String msg, Object... params) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msg, null, params));
+        }
+
+        @Override
+        public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, String msg, Throwable thrown) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msg, thrown, (Object[]) null));
+        }
+
+        @Override
+        public void logp(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+                         String sourceMethod, Throwable thrown,
+                         Supplier<String> msgSupplier) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, null, msgSupplier, thrown, (Object[]) null));
         }
+
+        @Override
+        public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+                          String sourceMethod, ResourceBundle bundle, String msg,
+                          Object... params) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, bundle, msg, null, params));
+        }
+
+        @Override
+        public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
+                          String msg, Object... params) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, bundle, msg, null, params));
+        }
+
+        @Override
+        public void logrb(sun.util.logging.PlatformLogger.Level level, String sourceClass,
+                          String sourceMethod, ResourceBundle bundle, String msg,
+                          Throwable thrown) {
+            log(LogEvent.of(isLoggable(level), name,
+                    sourceClass, sourceMethod,
+                    level, bundle, msg, thrown, (Object[]) null));
+        }
+
+        @Override
+        public void logrb(sun.util.logging.PlatformLogger.Level level, ResourceBundle bundle,
+                          String msg, Throwable thrown) {
+            log(LogEvent.of(isLoggable(level), name, null, null,
+                    level, bundle, msg, thrown, (Object[]) null));
+        }
+
+        @Override
+        public boolean isLoggable(sun.util.logging.PlatformLogger.Level level) {
+            return this.level != OFF && level.intValue()
+                    >= this.level.intValue();
+        }
+
+        @Override
+        public boolean isEnabled() {
+            return this.level != OFF;
+        }
+
+
     }
 
     static final sun.util.logging.PlatformLogger.Level[] julLevels = {
@@ -593,11 +575,11 @@
             System.out.println("Got expected exception for system logger: " + acx);
         }
 
-        final LogProducerFinder.LoggerImpl sysSink;
+        final LoggerImpl sysSink;
         boolean old = allowControl.get().get();
         allowControl.get().set(true);
         try {
-           sysSink = LogProducerFinder.LoggerImpl.class.cast(
+           sysSink = LoggerImpl.class.cast(
                         provider.getLogger("foo", Thread.class.getModule()));
         } finally {
             allowControl.get().set(old);
@@ -647,20 +629,20 @@
         }
     }
 
-    static void setLevel( LogProducerFinder.LoggerImpl sink,
+    static void setLevel(LoggerImpl sink,
             sun.util.logging.PlatformLogger.Level loggerLevel) {
-        sink.level = loggerLevel;
+        sink.configureLevel(loggerLevel);
     }
 
     // Calls the methods defined on LogProducer and verify the
-    // parameters received by the underlying LogProducerFinder.LoggerImpl
+    // parameters received by the underlying LoggerImpl
     // logger.
     private static void testLogger(LoggerFinder provider,
             Map<PlatformLogger, String> loggerDescMap,
             String name,
             ResourceBundle loggerBundle,
             PlatformLogger logger,
-            LogProducerFinder.LoggerImpl sink) {
+            LoggerImpl sink) {
 
         System.out.println("Testing " + loggerDescMap.get(logger) + " [" + logger +"]");
         final sun.util.logging.PlatformLogger.Level OFF = sun.util.logging.PlatformLogger.Level.OFF;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/annotation/typeAnnotations/GetAnnotatedNestedSuperclass.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2018, Google LLC. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8066967 8198526
+ * @summary Class.getAnnotatedSuperclass() does not correctly extract annotations
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.AnnotatedParameterizedType;
+import java.lang.reflect.AnnotatedType;
+import java.util.Arrays;
+import java.util.Objects;
+
+public class GetAnnotatedNestedSuperclass {
+
+    @Target(ElementType.TYPE_USE)
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface A {}
+
+    @Target(ElementType.TYPE_USE)
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface B {}
+
+    @Target(ElementType.TYPE_USE)
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface C {}
+
+    @Target(ElementType.TYPE_USE)
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface D {}
+
+    @Target(ElementType.TYPE_USE)
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface E {}
+
+    static class X<P1, P2, P3> {}
+
+    static class Y<P1, P2> extends @A X<@B P1, @C P2, @D Class<@E P1>> {}
+
+    public static void main(String[] args) throws Exception {
+        AnnotatedType x = Y.class.getAnnotatedSuperclass();
+        assertEquals(Arrays.toString(x.getAnnotations()), "[@GetAnnotatedNestedSuperclass$A()]");
+        AnnotatedParameterizedType xpt = (AnnotatedParameterizedType) x;
+        {
+            AnnotatedType arg = xpt.getAnnotatedActualTypeArguments()[0];
+            assertEquals(
+                    Arrays.toString(arg.getAnnotations()), "[@GetAnnotatedNestedSuperclass$B()]");
+        }
+        {
+            AnnotatedType arg = xpt.getAnnotatedActualTypeArguments()[1];
+            assertEquals(
+                    Arrays.toString(arg.getAnnotations()), "[@GetAnnotatedNestedSuperclass$C()]");
+        }
+        {
+            AnnotatedType arg = xpt.getAnnotatedActualTypeArguments()[2];
+            assertEquals(
+                    Arrays.toString(arg.getAnnotations()), "[@GetAnnotatedNestedSuperclass$D()]");
+            AnnotatedType nestedArg =
+                    ((AnnotatedParameterizedType) arg).getAnnotatedActualTypeArguments()[0];
+            assertEquals(
+                    Arrays.toString(nestedArg.getAnnotations()),
+                    "[@GetAnnotatedNestedSuperclass$E()]");
+        }
+    }
+
+    private static void assertEquals(Object expected, Object actual) {
+        if (!Objects.equals(expected, actual)) {
+            throw new AssertionError("expected: " + expected + "; actual=" + actual);
+        }
+    }
+}
--- a/test/jdk/java/lang/annotation/typeAnnotations/GetAnnotatedOwnerType.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/lang/annotation/typeAnnotations/GetAnnotatedOwnerType.java	Fri Dec 21 07:46:58 2018 -0500
@@ -42,6 +42,9 @@
     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("non-generic") Inner nonGeneric;
     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("generic") InnerGeneric<String> innerGeneric;
     public @TA("non-generic") GetAnnotatedOwnerTypeAuxilliary . @TB("raw") InnerGeneric innerRaw;
+    public GetAnnotatedOwnerTypeAuxilliary . @TB("non-generic") Nested nestedNonGeneric;
+    public GetAnnotatedOwnerTypeAuxilliary . @TB("generic") NestedGeneric<String> nestedGeneric;
+    public GetAnnotatedOwnerTypeAuxilliary . @TB("raw") NestedGeneric nestedRaw;
     public Object anonymous = new Object() {};
     public @TA("array") Dummy[] dummy;
     public @TA("wildcard") GetAnnotatedOwnerType<?> wildcard;
@@ -58,6 +61,9 @@
         testNonGeneric();
         testInnerGeneric();
         testInnerRaw();
+        testNestedNonGeneric();
+        testNestedGeneric();
+        testNestedRaw();
 
         testLocalClass();
         testAnonymousClass();
@@ -155,6 +161,54 @@
                 + outer.getAnnotations().length);
     }
 
+    public static void testNestedNonGeneric() throws Exception {
+        Field f = GetAnnotatedOwnerType.class.getField("nestedNonGeneric");
+
+        // make sure inner is correctly annotated
+        AnnotatedType inner = f.getAnnotatedType();
+        Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "non-generic");
+        Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: "
+                + inner.getAnnotations().length);
+
+        // make sure owner is correctly annotated, on the correct type
+        AnnotatedType outer = inner.getAnnotatedOwnerType();
+        Asserts.assertEquals(outer.getType(), ((Class<?>)f.getGenericType()).getEnclosingClass());
+        Asserts.assertTrue(outer.getAnnotations().length == 0, "expecting no annotations, got: "
+                + outer.getAnnotations().length);
+    }
+
+    public static void testNestedGeneric() throws Exception {
+        Field f = GetAnnotatedOwnerType.class.getField("nestedGeneric");
+
+        // make sure inner is correctly annotated
+        AnnotatedType inner = f.getAnnotatedType();
+        Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "generic");
+        Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: "
+                + inner.getAnnotations().length);
+
+        // make sure owner is correctly annotated, on the correct type
+        AnnotatedType outer = inner.getAnnotatedOwnerType();
+        Asserts.assertEquals(outer.getType(), ((ParameterizedType) f.getGenericType()).getOwnerType());
+        Asserts.assertTrue(outer.getAnnotations().length == 0, "expecting no annotations, got: "
+                + outer.getAnnotations().length);
+    }
+
+    public static void testNestedRaw() throws Exception {
+        Field f = GetAnnotatedOwnerType.class.getField("nestedRaw");
+
+        // make sure inner is correctly annotated
+        AnnotatedType inner = f.getAnnotatedType();
+        Asserts.assertEquals(inner.getAnnotation(TB.class).value(), "raw");
+        Asserts.assertTrue(inner.getAnnotations().length == 1, "expecting one (1) annotation, got: "
+                + inner.getAnnotations().length);
+
+        // make sure owner is correctly annotated, on the correct type
+        AnnotatedType outer = inner.getAnnotatedOwnerType();
+        Asserts.assertEquals(outer.getType(), ((Class<?>)f.getGenericType()).getEnclosingClass());
+        Asserts.assertTrue(outer.getAnnotations().length == 0, "expecting no annotations, got: "
+                + outer.getAnnotations().length);
+    }
+
     public static void testLocalClass() throws Exception {
         class ALocalClass {}
         class OneMore {
@@ -279,4 +333,8 @@
     class Inner {}
 
     class InnerGeneric<Dummy> {}
+
+    static class Nested {}
+
+    static class NestedGeneric<Dummy> {}
 }
--- a/test/jdk/java/net/MulticastSocket/PromiscuousIPv6.java	Fri Dec 21 07:40:47 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +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 8210493
- * @requires os.family == "linux"
- * @library /test/lib
- * @build jdk.test.lib.NetworkConfiguration
- *        PromiscuousIPv6
- * @run main PromiscuousIPv6
- */
-import jdk.test.lib.NetworkConfiguration;
-import jtreg.SkippedException;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.MulticastSocket;
-import java.net.SocketTimeoutException;
-
-import static java.lang.System.out;
-
-/*
- * This test was created as a copy of the Promiscuous test and adapted for
- * IPv6 node-local and link-local multicast addresses on Linux.
- */
-public class PromiscuousIPv6 {
-
-    static final int TIMEOUT =  5 * 1000; // 5 secs
-    static int id = 1000;
-
-    static void receive(DatagramSocket mc, boolean datagramExpected, int id)
-            throws IOException
-    {
-        byte[] ba = new byte[100];
-        DatagramPacket p = new DatagramPacket(ba, ba.length);
-        try {
-            mc.receive(p);
-            int recvId = Integer.parseInt(
-                    new String(p.getData(), 0, p.getLength(), "UTF-8"));
-            if (datagramExpected) {
-                if (recvId != id)
-                    throw new RuntimeException("Unexpected id, got " + recvId
-                                                       + ", expected: " + id);
-                out.printf("Received message as expected, %s\n", p.getAddress());
-            } else {
-                throw new RuntimeException("Unexpected message received, "
-                                                   + p.getAddress());
-            }
-        } catch (SocketTimeoutException e) {
-            if (datagramExpected)
-                throw new RuntimeException("Expected message not received, "
-                                                   + e.getMessage());
-            else
-                out.printf("Message not received, as expected\n");
-        }
-    }
-
-    static void test(InetAddress group1, InetAddress group2)
-            throws IOException
-    {
-        try (MulticastSocket mc1 = new MulticastSocket(new InetSocketAddress(group1, 0));
-             MulticastSocket mc2 = new MulticastSocket(new InetSocketAddress(group2, mc1.getLocalPort()));
-             DatagramSocket ds = new DatagramSocket()) {
-
-            final int port = mc1.getLocalPort();
-            out.printf("Using port: %d\n", port);
-
-            mc1.setSoTimeout(TIMEOUT);
-            mc2.setSoTimeout(TIMEOUT);
-            int nextId = id;
-            byte[] msg = Integer.toString(nextId).getBytes("UTF-8");
-            DatagramPacket p = new DatagramPacket(msg, msg.length);
-            p.setAddress(group1);
-            p.setPort(port);
-
-            mc1.joinGroup(group1);
-            out.printf("mc1 joined the MC group: %s\n", group1);
-            mc2.joinGroup(group2);
-            out.printf("mc2 joined the MC group: %s\n", group2);
-
-            out.printf("Sending datagram to: %s/%d\n", group1, port);
-            ds.send(p);
-
-            // the packet should be received by mc1 only
-            receive(mc1, true, nextId);
-            receive(mc2, false, 0);
-
-            nextId = ++id;
-            msg = Integer.toString(nextId).getBytes("UTF-8");
-            p = new DatagramPacket(msg, msg.length);
-            p.setAddress(group2);
-            p.setPort(port);
-
-            out.printf("Sending datagram to: %s/%d\n", group2, port);
-            ds.send(p);
-
-            // the packet should be received by mc2 only
-            receive(mc2, true, nextId);
-            receive(mc1, false, 0);
-
-            mc1.leaveGroup(group1);
-            mc2.leaveGroup(group2);
-        }
-    }
-
-    public static void main(String args[]) throws IOException {
-        String os = System.getProperty("os.name");
-
-        if (!os.equals("Linux")) {
-            throw new SkippedException("This test should be run only on Linux");
-        } else {
-            String osVersion = System.getProperty("os.version");
-            String prefix = "3.10.0";
-            if (osVersion.startsWith(prefix)) {
-                throw new SkippedException(
-                        String.format("The behavior under test is known NOT to work on '%s' kernels", prefix));
-            }
-        }
-
-        NetworkConfiguration.printSystemConfiguration(System.out);
-
-        if (NetworkConfiguration.probe()
-                                .ip6MulticastInterfaces()
-                                .findAny()
-                                .isEmpty()) {
-            throw new SkippedException(
-                    "No IPv6 interfaces that support multicast found");
-        }
-
-        InetAddress interfaceLocal1 = InetAddress.getByName("ff11::2.3.4.5");
-        InetAddress interfaceLocal2 = InetAddress.getByName("ff11::6.7.8.9");
-        test(interfaceLocal1, interfaceLocal2);
-
-        InetAddress linkLocal1 = InetAddress.getByName("ff12::2.3.4.5");
-        InetAddress linkLocal2 = InetAddress.getByName("ff12::6.7.8.9");
-        test(linkLocal1, linkLocal2);
-    }
-}
--- a/test/jdk/java/nio/channels/DatagramChannel/PromiscuousIPv6.java	Fri Dec 21 07:40:47 2018 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +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 8210493
- * @requires os.family == "linux"
- * @library /test/lib
- * @build jdk.test.lib.NetworkConfiguration
- *        PromiscuousIPv6
- * @run main PromiscuousIPv6
- * @key randomness
- */
-
-import java.nio.ByteBuffer;
-import java.nio.channels.*;
-import java.net.*;
-import static java.net.StandardProtocolFamily.*;
-import java.util.*;
-import java.io.IOException;
-import java.util.stream.Collectors;
-
-import jdk.test.lib.NetworkConfiguration;
-import jtreg.SkippedException;
-
-/*
- * This test was created as a copy of the Promiscuous test and adapted for
- * IPv6 node-local and link-local multicast addresses on Linux.
- */
-public class PromiscuousIPv6 {
-
-    static final Random rand = new Random();
-
-    static final ProtocolFamily UNSPEC = () -> "UNSPEC";
-
-    /**
-     * Sends a datagram to the given multicast group
-     */
-    static int sendDatagram(NetworkInterface nif,
-                            InetAddress group,
-                            int port)
-            throws IOException
-    {
-        ProtocolFamily family = (group instanceof Inet6Address) ?
-                StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
-        DatagramChannel dc = DatagramChannel.open(family)
-                .setOption(StandardSocketOptions.IP_MULTICAST_IF, nif);
-        int id = rand.nextInt();
-        byte[] msg = Integer.toString(id).getBytes("UTF-8");
-        ByteBuffer buf = ByteBuffer.wrap(msg);
-        System.out.format("Send message -> group %s (id=0x%x)\n",
-                          group.getHostAddress(), id);
-        dc.send(buf, new InetSocketAddress(group, port));
-        dc.close();
-        return id;
-    }
-
-    /**
-     * Wait (with timeout) for datagram. The {@code datagramExpected}
-     * parameter indicates whether a datagram is expected, and if
-     * {@code true} then {@code id} is the identifier in the payload.
-     */
-    static void receiveDatagram(DatagramChannel dc,
-                                String name,
-                                boolean datagramExpected,
-                                int id)
-            throws IOException
-    {
-        System.out.println("Checking if received by " + name);
-
-        Selector sel = Selector.open();
-        dc.configureBlocking(false);
-        dc.register(sel, SelectionKey.OP_READ);
-        ByteBuffer buf = ByteBuffer.allocateDirect(100);
-
-        try {
-            for (;;) {
-                System.out.println("Waiting to receive message");
-                sel.select(5*1000);
-                SocketAddress sa = dc.receive(buf);
-
-                // no datagram received
-                if (sa == null) {
-                    if (datagramExpected) {
-                        throw new RuntimeException("Expected message not received");
-                    }
-                    System.out.println("No message received (correct)");
-                    return;
-                }
-
-                // datagram received
-
-                InetAddress sender = ((InetSocketAddress)sa).getAddress();
-                buf.flip();
-                byte[] bytes = new byte[buf.remaining()];
-                buf.get(bytes);
-                String s = new String(bytes, "UTF-8");
-                int receivedId = -1;
-                try {
-                    receivedId = Integer.parseInt(s);
-                    System.out.format("Received message from %s (id=0x%x)\n",
-                                      sender, receivedId);
-                } catch (NumberFormatException x) {
-                    System.out.format("Received message from %s (msg=%s)\n", sender, s);
-                }
-
-                if (!datagramExpected) {
-                    if (receivedId == id)
-                        throw new RuntimeException("Message not expected");
-                    System.out.println("Message ignored (has wrong id)");
-                } else {
-                    if (receivedId == id) {
-                        System.out.println("Message expected");
-                        return;
-                    }
-                    System.out.println("Message ignored (wrong sender)");
-                }
-
-                sel.selectedKeys().clear();
-                buf.rewind();
-            }
-        } finally {
-            sel.close();
-        }
-    }
-
-    static void test(ProtocolFamily family,
-                     NetworkInterface nif,
-                     InetAddress group1,
-                     InetAddress group2)
-            throws IOException
-    {
-
-        System.out.format("%nTest family=%s%n", family.name());
-
-        DatagramChannel dc1 = (family == UNSPEC) ?
-                DatagramChannel.open() : DatagramChannel.open(family);
-        DatagramChannel dc2 = (family == UNSPEC) ?
-                DatagramChannel.open() : DatagramChannel.open(family);
-
-        try {
-            dc1.setOption(StandardSocketOptions.SO_REUSEADDR, true);
-            dc2.setOption(StandardSocketOptions.SO_REUSEADDR, true);
-
-            dc1.bind(new InetSocketAddress(group1, 0));
-            int port = dc1.socket().getLocalPort();
-            dc2.bind(new InetSocketAddress(group2, port));
-
-            System.out.format("dc1 joining [%s]:%d @ %s\n",
-                              group1.getHostAddress(), port, nif.getName());
-            System.out.format("dc2 joining [%s]:%d @ %s\n",
-                              group2.getHostAddress(), port, nif.getName());
-
-            dc1.join(group1, nif);
-            dc2.join(group2, nif);
-
-            int id = sendDatagram(nif, group1, port);
-
-            receiveDatagram(dc1, "dc1", true, id);
-            receiveDatagram(dc2, "dc2", false, id);
-
-            id = sendDatagram(nif, group2, port);
-
-            receiveDatagram(dc1, "dc1", false, id);
-            receiveDatagram(dc2, "dc2", true, id);
-
-        } finally {
-            dc1.close();
-            dc2.close();
-        }
-    }
-
-    public static void main(String[] args) throws IOException {
-
-        String os = System.getProperty("os.name");
-
-        if (!os.equals("Linux")) {
-            throw new SkippedException("This test should be run only on Linux");
-        } else {
-            String osVersion = System.getProperty("os.version");
-            String prefix = "3.10.0";
-            if (osVersion.startsWith(prefix)) {
-                throw new SkippedException(
-                        String.format("The behavior under test is known NOT to work on '%s' kernels", prefix));
-            }
-        }
-
-        NetworkConfiguration.printSystemConfiguration(System.out);
-
-        InetAddress interfaceLocal1 = InetAddress.getByName("ff11::2.3.4.5");
-        InetAddress interfaceLocal2 = InetAddress.getByName("ff11::6.7.8.9");
-
-        InetAddress linkLocal1 = InetAddress.getByName("ff12::2.3.4.5");
-        InetAddress linkLocal2 = InetAddress.getByName("ff12::6.7.8.9");
-
-        // get local network configuration to use
-        NetworkConfiguration config = NetworkConfiguration.probe();
-        boolean foundAtLeastOne = false;
-        for (NetworkInterface nif: config.ip6MulticastInterfaces()
-                .collect(Collectors.toList())) {
-            foundAtLeastOne = true;
-            test(INET6, nif, interfaceLocal1, interfaceLocal2);
-            test(INET6, nif, linkLocal1, linkLocal2);
-        }
-        if (!foundAtLeastOne) {
-            throw new SkippedException(
-                    "No IPv6 interfaces that support multicast found");
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/security/AccessController/DoPriv.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,68 @@
+/*
+ * 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 8214583
+ * @summary Check that getContext works after JIT compiler escape analysis.
+ */
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.DomainCombiner;
+import java.security.ProtectionDomain;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.net.URL;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+public class DoPriv {
+
+    static void go(final DomainCombiner dc0, final AccessControlContext co, final int index) throws Exception {
+        final AccessControlContext ci = new AccessControlContext(co, dc0);
+        AccessController.doPrivileged((PrivilegedExceptionAction<Integer>)() -> {
+            AccessControlContext c1 = AccessController.getContext();
+            DomainCombiner dc = c1.getDomainCombiner();
+            if (dc != dc0 || dc == null) {
+                throw new AssertionError("iteration " + index + " " + dc + " != " + dc0);
+            }
+            return 0;
+        }, ci);
+    }
+
+    public static void main(String[] args) throws Exception {
+        final DomainCombiner dc0 = new DomainCombiner() {
+            public ProtectionDomain[] combine(ProtectionDomain[] currentDomains,
+                                            ProtectionDomain[] assignedDomains) {
+                return null;
+            }
+        };
+
+        final AccessControlContext co = AccessController.getContext();
+
+        for (int i = 0; i < 500_000; ++i) {
+            go(dc0, co, i);
+        }
+    }
+}
--- a/test/jdk/java/util/zip/zip.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/jdk/java/util/zip/zip.java	Fri Dec 21 07:46:58 2018 -0500
@@ -23,9 +23,14 @@
 
 import java.io.*;
 import java.nio.charset.Charset;
+import java.text.MessageFormat;
 import java.util.*;
-import java.util.zip.*;
-import java.text.MessageFormat;
+import java.util.zip.CRC32;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
 
 /**
  * A stripped-down version of Jar tool with a "-encoding" option to
@@ -39,9 +44,9 @@
     String[] files;
     Charset cs = Charset.forName("UTF-8");
 
-    Map<String, File> entryMap = new HashMap<String, File>();
-    Set<File> entries = new LinkedHashSet<File>();
-    List<String> paths = new ArrayList<String>();
+    Map<String, File> entryMap = new HashMap<>();
+    Set<File> entries = new LinkedHashSet<>();
+    List<String> paths = new ArrayList<>();
 
     CRC32 crc32 = new CRC32();
     /*
@@ -330,15 +335,13 @@
         }
     }
 
-    boolean update(InputStream in, OutputStream out) throws IOException
-    {
+    boolean update(InputStream in, OutputStream out) throws IOException {
         try (ZipInputStream zis = new ZipInputStream(in, cs);
              ZipOutputStream zos = new ZipOutputStream(out, cs))
         {
             ZipEntry e = null;
             byte[] buf = new byte[1024];
             int n = 0;
-            boolean updateOk = true;
 
             // put the old entries first, replace if necessary
             while ((e = zis.getNextEntry()) != null) {
@@ -367,11 +370,11 @@
             }
 
             // add the remaining new files
-            for (File f: entries) {
+            for (File f : entries) {
                 addFile(zos, f);
             }
         }
-        return updateOk;
+        return true;
     }
 
     private String entryName(String name) {
@@ -479,6 +482,8 @@
 
     Set<ZipEntry> newDirSet() {
         return new HashSet<ZipEntry>() {
+            private static final long serialVersionUID = 4547977575248028254L;
+
             public boolean add(ZipEntry e) {
                 return (e == null || super.add(e));
             }};
@@ -520,7 +525,6 @@
             Enumeration<? extends ZipEntry> zes = zf.entries();
             while (zes.hasMoreElements()) {
                 ZipEntry e = zes.nextElement();
-                InputStream is;
                 if (files == null) {
                     dirs.add(extractFile(zf.getInputStream(e), e));
                 } else {
@@ -533,8 +537,8 @@
                     }
                 }
             }
+            updateLastModifiedTime(dirs);
         }
-        updateLastModifiedTime(dirs);
     }
 
     ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
@@ -727,7 +731,7 @@
         st.commentChar('#');
         st.quoteChar('"');
         st.quoteChar('\'');
-        while (st.nextToken() != st.TT_EOF) {
+        while (st.nextToken() != StreamTokenizer.TT_EOF) {
             args.add(st.sval);
         }
         r.close();
@@ -738,4 +742,3 @@
         System.exit(z.run(args) ? 0 : 1);
     }
 }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/templates/SSLContextTemplate.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,518 @@
+/*
+ * 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.
+ */
+
+//
+// Please run in othervm mode.  SunJSSE does not support dynamic system
+// properties, no way to re-use system properties in samevm/agentvm mode.
+//
+
+import java.io.ByteArrayInputStream;
+import java.security.KeyFactory;
+import java.security.KeyStore;
+import java.security.PrivateKey;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.util.Base64;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+
+/**
+ * SSLContext template to speed up JSSE tests.
+ */
+public interface SSLContextTemplate {
+    /*
+     * Create an instance of SSLContext for client use.
+     */
+    default SSLContext createClientSSLContext() throws Exception {
+        return createSSLContext(trustedCertStrs,
+                endEntityCertStrs, endEntityPrivateKeys,
+                endEntityPrivateKeyAlgs,
+                endEntityPrivateKeyNames,
+                getClientContextParameters());
+    }
+
+    /*
+     * Create an instance of SSLContext for server use.
+     */
+    default SSLContext createServerSSLContext() throws Exception {
+        return createSSLContext(trustedCertStrs,
+                endEntityCertStrs, endEntityPrivateKeys,
+                endEntityPrivateKeyAlgs,
+                endEntityPrivateKeyNames,
+                getServerContextParameters());
+    }
+
+    /*
+     * The parameters used to configure SSLContext.
+     */
+    static final class ContextParameters {
+        final String contextProtocol;
+        final String tmAlgorithm;
+        final String kmAlgorithm;
+
+        ContextParameters(String contextProtocol,
+                String tmAlgorithm, String kmAlgorithm) {
+
+            this.contextProtocol = contextProtocol;
+            this.tmAlgorithm = tmAlgorithm;
+            this.kmAlgorithm = kmAlgorithm;
+        }
+    }
+
+    /*
+     * Get the client side parameters of SSLContext.
+     */
+    default ContextParameters getClientContextParameters() {
+        return new ContextParameters("TLS", "PKIX", "NewSunX509");
+    }
+
+    /*
+     * Get the server side parameters of SSLContext.
+     */
+    default ContextParameters getServerContextParameters() {
+        return new ContextParameters("TLS", "PKIX", "NewSunX509");
+    }
+
+    /*
+     * =======================================
+     * Certificates and keys used in the test.
+     */
+    // Trusted certificates.
+    final static String[] trustedCertStrs = {
+        // SHA256withECDSA, curve prime256v1
+        // Validity
+        //     Not Before: May 22 07:18:16 2018 GMT
+        //     Not After : May 17 07:18:16 2038 GMT
+        // Subject Key Identifier:
+        //     60:CF:BD:73:FF:FA:1A:30:D2:A4:EC:D3:49:71:46:EF:1A:35:A0:86
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIBvjCCAWOgAwIBAgIJAIvFG6GbTroCMAoGCCqGSM49BAMCMDsxCzAJBgNVBAYT\n" +
+        "AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" +
+        "ZTAeFw0xODA1MjIwNzE4MTZaFw0zODA1MTcwNzE4MTZaMDsxCzAJBgNVBAYTAlVT\n" +
+        "MQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZjZTBZ\n" +
+        "MBMGByqGSM49AgEGCCqGSM49AwEHA0IABBz1WeVb6gM2mh85z3QlvaB/l11b5h0v\n" +
+        "LIzmkC3DKlVukZT+ltH2Eq1oEkpXuf7QmbM0ibrUgtjsWH3mULfmcWmjUDBOMB0G\n" +
+        "A1UdDgQWBBRgz71z//oaMNKk7NNJcUbvGjWghjAfBgNVHSMEGDAWgBRgz71z//oa\n" +
+        "MNKk7NNJcUbvGjWghjAMBgNVHRMEBTADAQH/MAoGCCqGSM49BAMCA0kAMEYCIQCG\n" +
+        "6wluh1r2/T6L31mZXRKf9JxeSf9pIzoLj+8xQeUChQIhAJ09wAi1kV8yePLh2FD9\n" +
+        "2YEHlSQUAbwwqCDEVB5KxaqP\n" +
+        "-----END CERTIFICATE-----",
+        // -----BEGIN PRIVATE KEY-----
+        // MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQg/HcHdoLJCdq3haVd
+        // XZTSKP00YzM3xX97l98vGL/RI1KhRANCAAQc9VnlW+oDNpofOc90Jb2gf5ddW+Yd
+        // LyyM5pAtwypVbpGU/pbR9hKtaBJKV7n+0JmzNIm61ILY7Fh95lC35nFp
+        // -----END PRIVATE KEY-----
+
+        // SHA256withRSA, 2048 bits
+        // Validity
+        //     Not Before: May 22 07:18:16 2018 GMT
+        //     Not After : May 17 07:18:16 2038 GMT
+        // Subject Key Identifier:
+        //     0D:DD:93:C9:FE:4B:BD:35:B7:E8:99:78:90:FB:DB:5A:3D:DB:15:4C
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIDSTCCAjGgAwIBAgIJAI4ZF3iy8zG+MA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNV\n" +
+        "BAYTAlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2Vy\n" +
+        "aXZjZTAeFw0xODA1MjIwNzE4MTZaFw0zODA1MTcwNzE4MTZaMDsxCzAJBgNVBAYT\n" +
+        "AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" +
+        "ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALpMcY7aWieXDEM1/YJf\n" +
+        "JW27b4nRIFZyEYhEloyGsKTuQiiQjc8cqRZFNXe2vwziDB4IyTEl0Hjl5QF6ZaQE\n" +
+        "huPzzwvQm1pv64KrRXrmj3FisQK8B5OWLty9xp6xDqsaMRoyObLK+oIb20T5fSlE\n" +
+        "evmo1vYjnh8CX0Yzx5Gr5ye6YSEHQvYOWEws8ad17OlyToR2KMeC8w4qo6rs59pW\n" +
+        "g7Mxn9vo22ImDzrtAbTbXbCias3xlE0Bp0h5luyf+5U4UgksoL9B9r2oP4GrLNEV\n" +
+        "oJk57t8lwaR0upiv3CnS8LcJELpegZub5ggqLY8ZPYFQPjlK6IzLOm6rXPgZiZ3m\n" +
+        "RL0CAwEAAaNQME4wHQYDVR0OBBYEFA3dk8n+S701t+iZeJD721o92xVMMB8GA1Ud\n" +
+        "IwQYMBaAFA3dk8n+S701t+iZeJD721o92xVMMAwGA1UdEwQFMAMBAf8wDQYJKoZI\n" +
+        "hvcNAQELBQADggEBAJTRC3rKUUhVH07/1+stUungSYgpM08dY4utJq0BDk36BbmO\n" +
+        "0AnLDMbkwFdHEoqF6hQIfpm7SQTmXk0Fss6Eejm8ynYr6+EXiRAsaXOGOBCzF918\n" +
+        "/RuKOzqABfgSU4UBKECLM5bMfQTL60qx+HdbdVIpnikHZOFfmjCDVxoHsGyXc1LW\n" +
+        "Jhkht8IGOgc4PMGvyzTtRFjz01kvrVQZ75aN2E0GQv6dCxaEY0i3ypSzjUWAKqDh\n" +
+        "3e2OLwUSvumcdaxyCdZAOUsN6pDBQ+8VRG7KxnlRlY1SMEk46QgQYLbPDe/+W/yH\n" +
+        "ca4PejicPeh+9xRAwoTpiE2gulfT7Lm+fVM7Ruc=\n" +
+        "-----END CERTIFICATE-----",
+
+        // -----BEGIN PRIVATE KEY-----
+        // MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC6THGO2lonlwxD
+        // Nf2CXyVtu2+J0SBWchGIRJaMhrCk7kIokI3PHKkWRTV3tr8M4gweCMkxJdB45eUB
+        // emWkBIbj888L0Jtab+uCq0V65o9xYrECvAeTli7cvcaesQ6rGjEaMjmyyvqCG9tE
+        // +X0pRHr5qNb2I54fAl9GM8eRq+cnumEhB0L2DlhMLPGndezpck6EdijHgvMOKqOq
+        // 7OfaVoOzMZ/b6NtiJg867QG0212womrN8ZRNAadIeZbsn/uVOFIJLKC/Qfa9qD+B
+        // qyzRFaCZOe7fJcGkdLqYr9wp0vC3CRC6XoGbm+YIKi2PGT2BUD45SuiMyzpuq1z4
+        // GYmd5kS9AgMBAAECggEAFHSoU2MuWwJ+2jJnb5U66t2V1bAcuOE1g5zkWvG/G5z9
+        // rq6Qo5kmB8f5ovdx6tw3MGUOklLwnRXBG3RxDJ1iokz3AvkY1clMNsDPlDsUrQKF
+        // JSO4QUBQTPSZhnsyfR8XHSU+qJ8Y+ohMfzpVv95BEoCzebtXdVgxVegBlcEmVHo2
+        // kMmkRN+bYNsr8eb2r+b0EpyumS39ZgKYh09+cFb78y3T6IFMGcVJTP6nlGBFkmA/
+        // 25pYeCF2tSki08qtMJZQAvKfw0Kviibk7ZxRbJqmc7B1yfnOEHP6ftjuvKl2+RP/
+        // +5P5f8CfIP6gtA0LwSzAqQX/hfIKrGV5j0pCqrD0kQKBgQDeNR6Xi4sXVq79lihO
+        // a1bSeV7r8yoQrS8x951uO+ox+UIZ1MsAULadl7zB/P0er92p198I9M/0Jth3KBuS
+        // zj45mucvpiiGvmQlMKMEfNq4nN7WHOu55kufPswQB2mR4J3xmwI+4fM/nl1zc82h
+        // De8JSazRldJXNhfx0RGFPmgzbwKBgQDWoVXrXLbCAn41oVnWB8vwY9wjt92ztDqJ
+        // HMFA/SUohjePep9UDq6ooHyAf/Lz6oE5NgeVpPfTDkgvrCFVKnaWdwALbYoKXT2W
+        // 9FlyJox6eQzrtHAacj3HJooXWuXlphKSizntfxj3LtMR9BmrmRJOfK+SxNOVJzW2
+        // +MowT20EkwKBgHmpB8jdZBgxI7o//m2BI5Y1UZ1KE5vx1kc7VXzHXSBjYqeV9FeF
+        // 2ZZLP9POWh/1Fh4pzTmwIDODGT2UPhSQy0zq3O0fwkyT7WzXRknsuiwd53u/dejg
+        // iEL2NPAJvulZ2+AuiHo5Z99LK8tMeidV46xoJDDUIMgTG+UQHNGhK5gNAoGAZn/S
+        // Cn7SgMC0CWSvBHnguULXZO9wH1wZAFYNLL44OqwuaIUFBh2k578M9kkke7woTmwx
+        // HxQTjmWpr6qimIuY6q6WBN8hJ2Xz/d1fwhYKzIp20zHuv5KDUlJjbFfqpsuy3u1C
+        // kts5zwI7pr1ObRbDGVyOdKcu7HI3QtR5qqyjwaUCgYABo7Wq6oHva/9V34+G3Goh
+        // 63bYGUnRw2l5BD11yhQv8XzGGZFqZVincD8gltNThB0Dc/BI+qu3ky4YdgdZJZ7K
+        // z51GQGtaHEbrHS5caV79yQ8QGY5mUVH3E+VXSxuIqb6pZq2DH4sTAEFHyncddmOH
+        // zoXBInYwRG9KE/Bw5elhUw==
+        // -----END PRIVATE KEY-----
+
+
+        // SHA256withDSA, 2048 bits
+        // Validity
+        //     Not Before: May 22 07:18:18 2018 GMT
+        //     Not After : May 17 07:18:18 2038 GMT
+        // Subject Key Identifier:
+        //     76:66:9E:F7:3B:DD:45:E5:3B:D9:72:3C:3F:F0:54:39:86:31:26:53
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIErjCCBFSgAwIBAgIJAOktYLNCbr02MAsGCWCGSAFlAwQDAjA7MQswCQYDVQQG\n" +
+        "EwJVUzENMAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2\n" +
+        "Y2UwHhcNMTgwNTIyMDcxODE4WhcNMzgwNTE3MDcxODE4WjA7MQswCQYDVQQGEwJV\n" +
+        "UzENMAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2Y2Uw\n" +
+        "ggNHMIICOQYHKoZIzjgEATCCAiwCggEBAO5GyPhSm0ze3LSu+gicdULLj05iOfTL\n" +
+        "UvZQ29sYz41zmqrLBQbdKiHqgJu2Re9sgTb5suLNjF047TOLPnU3jhPtWm2X8Xzi\n" +
+        "VGIcHym/Q/MeZxStt/88seqroI3WOKzIML2GcrishT+lcGrtH36Tf1+ue2Snn3PS\n" +
+        "WyxygNqPjllP5uUjYmFLvAf4QLMldkd/D2VxcwsHjB8y5iUZsXezc/LEhRZS/02m\n" +
+        "ivqlRw3AMkq/OVe/ZtxFWsP0nsfxEGdZuaUFpppGfixxFvymrB3+J51cTt+pZBDq\n" +
+        "D2y0DYfc+88iCs4jwHTfcDIpLb538HBjBj2rEgtQESQmB0ooD/+wsPsCIQC1bYch\n" +
+        "gElNtDYL3FgpLgNSUYp7gIWv9ehaC7LO2z7biQKCAQBitvFOnDkUja8NAF7lDpOV\n" +
+        "b5ipQ8SicBLW3kQamxhyuyxgZyy/PojZ/oPorkqW/T/A0rhnG6MssEpAtdiwVB+c\n" +
+        "rBYGo3bcwmExJhdOJ6dYuKFppPWhCwKMHs9npK+lqBMl8l5j58xlcFeC7ZfGf8GY\n" +
+        "GkhFW0c44vEQhMMbac6ZTTP4mw+1t7xJfmDMlLEyIpTXaAAk8uoVLWzQWnR40sHi\n" +
+        "ybvS0u3JxQkb7/y8tOOZu8qlz/YOS7lQ6UxUGX27Ce1E0+agfPphetoRAlS1cezq\n" +
+        "Wa7r64Ga0nkj1kwkcRqjgTiJx0NwnUXr78VAXFhVF95+O3lfqhvdtEGtkhDGPg7N\n" +
+        "A4IBBgACggEBAMmSHQK0w2i+iqUjOPzn0yNEZrzepLlLeQ1tqtn0xnlv5vBAeefD\n" +
+        "Pm9dd3tZOjufVWP7hhEz8xPobb1CS4e3vuQiv5UBfhdPL3f3l9T7JMAKPH6C9Vve\n" +
+        "OQXE5eGqbjsySbcmseHoYUt1WCSnSda1opX8zchX04e7DhGfE2/L9flpYEoSt8lI\n" +
+        "vMNjgOwvKdW3yvPt1/eBBHYNFG5gWPv/Q5KoyCtHS03uqGm4rNc/wZTIEEfd66C+\n" +
+        "QRaUltjOaHmtwOdDHaNqwhYZSVOip+Mo+TfyzHFREcdHLapo7ZXqbdYkRGxRR3d+\n" +
+        "3DfHaraJO0OKoYlPkr3JMvM/MSGR9AnZOcejUDBOMB0GA1UdDgQWBBR2Zp73O91F\n" +
+        "5TvZcjw/8FQ5hjEmUzAfBgNVHSMEGDAWgBR2Zp73O91F5TvZcjw/8FQ5hjEmUzAM\n" +
+        "BgNVHRMEBTADAQH/MAsGCWCGSAFlAwQDAgNHADBEAiBzriYE41M2y9Hy5ppkL0Qn\n" +
+        "dIlNc8JhXT/PHW7GDtViagIgMko8Qoj9gDGPK3+O9E8DC3wGiiF9CObM4LN387ok\n" +
+        "J+g=\n" +
+        "-----END CERTIFICATE-----"
+        // -----BEGIN PRIVATE KEY-----
+        // MIICZQIBADCCAjkGByqGSM44BAEwggIsAoIBAQDuRsj4UptM3ty0rvoInHVCy49O
+        // Yjn0y1L2UNvbGM+Nc5qqywUG3Soh6oCbtkXvbIE2+bLizYxdOO0ziz51N44T7Vpt
+        // l/F84lRiHB8pv0PzHmcUrbf/PLHqq6CN1jisyDC9hnK4rIU/pXBq7R9+k39frntk
+        // p59z0lsscoDaj45ZT+blI2JhS7wH+ECzJXZHfw9lcXMLB4wfMuYlGbF3s3PyxIUW
+        // Uv9Npor6pUcNwDJKvzlXv2bcRVrD9J7H8RBnWbmlBaaaRn4scRb8pqwd/iedXE7f
+        // qWQQ6g9stA2H3PvPIgrOI8B033AyKS2+d/BwYwY9qxILUBEkJgdKKA//sLD7AiEA
+        // tW2HIYBJTbQ2C9xYKS4DUlGKe4CFr/XoWguyzts+24kCggEAYrbxTpw5FI2vDQBe
+        // 5Q6TlW+YqUPEonAS1t5EGpsYcrssYGcsvz6I2f6D6K5Klv0/wNK4ZxujLLBKQLXY
+        // sFQfnKwWBqN23MJhMSYXTienWLihaaT1oQsCjB7PZ6SvpagTJfJeY+fMZXBXgu2X
+        // xn/BmBpIRVtHOOLxEITDG2nOmU0z+JsPtbe8SX5gzJSxMiKU12gAJPLqFS1s0Fp0
+        // eNLB4sm70tLtycUJG+/8vLTjmbvKpc/2Dku5UOlMVBl9uwntRNPmoHz6YXraEQJU
+        // tXHs6lmu6+uBmtJ5I9ZMJHEao4E4icdDcJ1F6+/FQFxYVRfefjt5X6ob3bRBrZIQ
+        // xj4OzQQjAiEAsceWOM8do4etxp2zgnoNXV8PUUyqWhz1+0srcKV7FR4=
+        // -----END PRIVATE KEY-----
+    };
+
+    // End entity certificate.
+    final static String[] endEntityCertStrs = {
+        // SHA256withECDSA, curve prime256v1
+        // Validity
+        //     Not Before: May 22 07:18:16 2018 GMT
+        //     Not After : May 17 07:18:16 2038 GMT
+        // Authority Key Identifier:
+        //     60:CF:BD:73:FF:FA:1A:30:D2:A4:EC:D3:49:71:46:EF:1A:35:A0:86
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIBqjCCAVCgAwIBAgIJAPLY8qZjgNRAMAoGCCqGSM49BAMCMDsxCzAJBgNVBAYT\n" +
+        "AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" +
+        "ZTAeFw0xODA1MjIwNzE4MTZaFw0zODA1MTcwNzE4MTZaMFUxCzAJBgNVBAYTAlVT\n" +
+        "MQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZjZTEY\n" +
+        "MBYGA1UEAwwPUmVncmVzc2lvbiBUZXN0MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD\n" +
+        "QgAEb+9n05qfXnfHUb0xtQJNS4JeSi6IjOfW5NqchvKnfJey9VkJzR7QHLuOESdf\n" +
+        "xlR7q8YIWgih3iWLGfB+wxHiOqMjMCEwHwYDVR0jBBgwFoAUYM+9c//6GjDSpOzT\n" +
+        "SXFG7xo1oIYwCgYIKoZIzj0EAwIDSAAwRQIgWpRegWXMheiD3qFdd8kMdrkLxRbq\n" +
+        "1zj8nQMEwFTUjjQCIQDRIrAjZX+YXHN9b0SoWWLPUq0HmiFIi8RwMnO//wJIGQ==\n" +
+        "-----END CERTIFICATE-----",
+
+        // SHA256withRSA, 2048 bits
+        // Validity
+        //     Not Before: May 22 07:18:16 2018 GMT
+        //     Not After : May 17 07:18:16 2038 GMT
+        // Authority Key Identifier:
+        //     0D:DD:93:C9:FE:4B:BD:35:B7:E8:99:78:90:FB:DB:5A:3D:DB:15:4C
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIDNjCCAh6gAwIBAgIJAO2+yPcFryUTMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNV\n" +
+        "BAYTAlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2Vy\n" +
+        "aXZjZTAeFw0xODA1MjIwNzE4MTZaFw0zODA1MTcwNzE4MTZaMFUxCzAJBgNVBAYT\n" +
+        "AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" +
+        "ZTEYMBYGA1UEAwwPUmVncmVzc2lvbiBUZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOC\n" +
+        "AQ8AMIIBCgKCAQEAszfBobWfZIp8AgC6PiWDDavP65mSvgCXUGxACbxVNAfkLhNR\n" +
+        "QOsHriRB3X1Q3nvO9PetC6wKlvE9jlnDDj7D+1j1r1CHO7ms1fq8rfcQYdkanDtu\n" +
+        "4AlHo8v+SSWX16MIXFRYDj2VVHmyPtgbltcg4zGAuwT746FdLI94uXjJjq1IOr/v\n" +
+        "0VIlwE5ORWH5Xc+5Tj+oFWK0E4a4GHDgtKKhn2m72hN56/GkPKGkguP5NRS1qYYV\n" +
+        "/EFkdyQMOV8J1M7HaicSft4OL6eKjTrgo93+kHk+tv0Dc6cpVBnalX3TorG8QI6B\n" +
+        "cHj1XQd78oAlAC+/jF4pc0mwi0un49kdK9gRfQIDAQABoyMwITAfBgNVHSMEGDAW\n" +
+        "gBQN3ZPJ/ku9NbfomXiQ+9taPdsVTDANBgkqhkiG9w0BAQsFAAOCAQEApXS0nKwm\n" +
+        "Kp8gpmO2yG1rpd1+2wBABiMU4JZaTqmma24DQ3RzyS+V2TeRb29dl5oTUEm98uc0\n" +
+        "GPZvhK8z5RFr4YE17dc04nI/VaNDCw4y1NALXGs+AHkjoPjLyGbWpi1S+gfq2sNB\n" +
+        "Ekkjp6COb/cb9yiFXOGVls7UOIjnVZVd0r7KaPFjZhYh82/f4PA/A1SnIKd1+nfH\n" +
+        "2yk7mSJNC7Z3qIVDL8MM/jBVwiC3uNe5GPB2uwhd7k5LGAVN3j4HQQGB0Sz+VC1h\n" +
+        "92oi6xDa+YBva2fvHuCd8P50DDjxmp9CemC7rnZ5j8egj88w14X44Xjb/Fd/ApG9\n" +
+        "e57NnbT7KM+Grw==\n" +
+        "-----END CERTIFICATE-----",
+
+        // SHA256withRSA, curv prime256v1
+        // Validity
+        //     Not Before: May 22 07:18:16 2018 GMT
+        //     Not After : May 21 07:18:16 2028 GMT
+        // Authority Key Identifier:
+        //     0D:DD:93:C9:FE:4B:BD:35:B7:E8:99:78:90:FB:DB:5A:3D:DB:15:4C
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIICazCCAVOgAwIBAgIJAO2+yPcFryUUMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNV\n" +
+        "BAYTAlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2Vy\n" +
+        "aXZjZTAeFw0xODA1MjIwNzE4MTZaFw0yODA1MjEwNzE4MTZaMFUxCzAJBgNVBAYT\n" +
+        "AlVTMQ0wCwYDVQQKDARKYXZhMR0wGwYDVQQLDBRTdW5KU1NFIFRlc3QgU2VyaXZj\n" +
+        "ZTEYMBYGA1UEAwwPUmVncmVzc2lvbiBUZXN0MFkwEwYHKoZIzj0CAQYIKoZIzj0D\n" +
+        "AQcDQgAE59MERNTlVZ1eeps8Z3Oue5ZkgQdPtD+WIE6tj3PbIKpxGPDxvfNP959A\n" +
+        "yQjEK/ehWQVrCMmNoEkIzY+IIBgB06MjMCEwHwYDVR0jBBgwFoAUDd2Tyf5LvTW3\n" +
+        "6Jl4kPvbWj3bFUwwDQYJKoZIhvcNAQELBQADggEBAFOTVEqs70ykhZiIdrEsF1Ra\n" +
+        "I3B2rLvwXZk52uSltk2/bzVvewA577ZCoxQ1pL7ynkisPfBN1uVYtHjM1VA3RC+4\n" +
+        "+TAK78dnI7otYjWoHp5rvs4l6c/IbOspS290IlNuDUxMErEm5wxIwj+Aukx/1y68\n" +
+        "hOyCvHBLMY2c1LskH1MMBbDuS1aI+lnGpToi+MoYObxGcV458vxuT8+wwV8Fkpvd\n" +
+        "ll8IIFmeNPRv+1E+lXbES6CSNCVaZ/lFhPgdgYKleN7sfspiz50DG4dqafuEAaX5\n" +
+        "xaK1NWXJxTRz0ROH/IUziyuDW6jphrlgit4+3NCzp6vP9hAJQ8Vhcj0n15BKHIQ=\n" +
+        "-----END CERTIFICATE-----",
+
+        // SHA256withDSA, 2048 bits
+        // Validity
+        //     Not Before: May 22 07:18:20 2018 GMT
+        //     Not After : May 17 07:18:20 2038 GMT
+        // Authority Key Identifier:
+        //     76:66:9E:F7:3B:DD:45:E5:3B:D9:72:3C:3F:F0:54:39:86:31:26:53
+        "-----BEGIN CERTIFICATE-----\n" +
+        "MIIEnDCCBEGgAwIBAgIJAP/jh1qVhNVjMAsGCWCGSAFlAwQDAjA7MQswCQYDVQQG\n" +
+        "EwJVUzENMAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2\n" +
+        "Y2UwHhcNMTgwNTIyMDcxODIwWhcNMzgwNTE3MDcxODIwWjBVMQswCQYDVQQGEwJV\n" +
+        "UzENMAsGA1UECgwESmF2YTEdMBsGA1UECwwUU3VuSlNTRSBUZXN0IFNlcml2Y2Ux\n" +
+        "GDAWBgNVBAMMD1JlZ3Jlc3Npb24gVGVzdDCCA0cwggI6BgcqhkjOOAQBMIICLQKC\n" +
+        "AQEAmlavgoJrMcjqWRVcDE2dmWAPREgnzQvneEDef68cprDzjSwvOs5QeFyx75ib\n" +
+        "ado1e6jO/rW1prCGWHDD1oA/Tn4Pk3vu0nUxzvl1qATc+aJbpUU5Op0bvp6LbCsQ\n" +
+        "QslV9FeRh7Eb7bP6gpc/kHCBzEgC1VCK7prccXWy+t6SMOHbND3h+UbckfSaUuaV\n" +
+        "sVJNTD1D6GElfRj4Nmz1BGPfSYvKorwNZEU3gXwFgtDoAcGx7tcyClLpDHfqRfw/\n" +
+        "7yiqLyeiP7D4hl5lMNouJWDlAdMFp0FMgS3s9VDFinIcr6VtBWMTG7+4+czHAB+3\n" +
+        "fvrwlqNzhBn3uFHrekN/w8fNxwIhAJo7Sae1za7IMW0Q6hE5B4b+s2B/FaKPoA4E\n" +
+        "jtZu13B9AoIBAQCOZqLMKfvqZWUgT0PQ3QjR7dAFdd06I9Y3+TOQzZk1+j+vw/6E\n" +
+        "X4vFItX4gihb/u5Q9CdmpwhVGi7bvo+7+/IKeTgoQ6f5+PSug7SrWWUQ5sPwaZui\n" +
+        "zXZJ5nTeZDucFc2yFx0wgnjbPwiUxZklOT7xGiOMtzOTa2koCz5KuIBL+/wPKKxm\n" +
+        "ypo9VoY9xfbdU6LMXZv/lpD5XTM9rYHr/vUTNkukvV6Hpm0YMEWhVZKUJiqCqTqG\n" +
+        "XHaleOxSw6uQWB/+TznifcC7gB48UOQjCqOKf5VuwQneJLhlhU/jhRV3xtr+hLZa\n" +
+        "hW1wYhVi8cjLDrZFKlgEQqhB4crnJU0mJY+tA4IBBQACggEAID0ezl00/X8mv7eb\n" +
+        "bzovum1+DEEP7FM57k6HZEG2N3ve4CW+0m9Cd+cWPz8wkZ+M0j/Eqa6F0IdbkXEc\n" +
+        "Q7CuzvUyJ57xQ3L/WCgXsiS+Bh8O4Mz7GwW22CGmHqafbVv+hKBfr8MkskO6GJUt\n" +
+        "SUF/CVLzB4gMIvZMH26tBP2xK+i7FeEK9kT+nGdzQSZBAhFYpEVCBplHZO24/OYq\n" +
+        "1DNoU327nUuXIhmsfA8N0PjiWbIZIjTPwBGr9H0LpATI7DIDNcvRRvtROP+pBU9y\n" +
+        "fuykPkptg9C0rCM9t06bukpOSaEz/2VIQdLE8fHYFA6pHZ6CIc2+5cfvMgTPhcjz\n" +
+        "W2jCt6MjMCEwHwYDVR0jBBgwFoAUdmae9zvdReU72XI8P/BUOYYxJlMwCwYJYIZI\n" +
+        "AWUDBAMCA0gAMEUCIQCeI5fN08b9BpOaHdc3zQNGjp24FOL/RxlBLeBAorswJgIg\n" +
+        "JEZ8DhYxQy1O7mmZ2UIT7op6epWMB4dENjs0qWPmcKo=\n" +
+        "-----END CERTIFICATE-----"
+    };
+
+    // Private key in the format of PKCS#8.
+    final static String[] endEntityPrivateKeys = {
+        //
+        // EC private key related to cert endEntityCertStrs[0].
+        //
+        "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgn5K03bpTLjEtFQRa\n" +
+        "JUtx22gtmGEvvSUSQdimhGthdtihRANCAARv72fTmp9ed8dRvTG1Ak1Lgl5KLoiM\n" +
+        "59bk2pyG8qd8l7L1WQnNHtAcu44RJ1/GVHurxghaCKHeJYsZ8H7DEeI6",
+
+        //
+        // RSA private key related to cert endEntityCertStrs[1].
+        //
+        "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCzN8GhtZ9kinwC\n" +
+        "ALo+JYMNq8/rmZK+AJdQbEAJvFU0B+QuE1FA6weuJEHdfVDee870960LrAqW8T2O\n" +
+        "WcMOPsP7WPWvUIc7uazV+ryt9xBh2RqcO27gCUejy/5JJZfXowhcVFgOPZVUebI+\n" +
+        "2BuW1yDjMYC7BPvjoV0sj3i5eMmOrUg6v+/RUiXATk5FYfldz7lOP6gVYrQThrgY\n" +
+        "cOC0oqGfabvaE3nr8aQ8oaSC4/k1FLWphhX8QWR3JAw5XwnUzsdqJxJ+3g4vp4qN\n" +
+        "OuCj3f6QeT62/QNzpylUGdqVfdOisbxAjoFwePVdB3vygCUAL7+MXilzSbCLS6fj\n" +
+        "2R0r2BF9AgMBAAECggEASIkPkMCuw4WdTT44IwERus3IOIYOs2IP3BgEDyyvm4B6\n" +
+        "JP/iihDWKfA4zEl1Gqcni1RXMHswSglXra682J4kui02Ov+vzEeJIY37Ibn2YnP5\n" +
+        "ZjRT2s9GtI/S2o4hl8A/mQb2IMViFC+xKehTukhV4j5d6NPKk0XzLR7gcMjnYxwn\n" +
+        "l21fS6D2oM1xRG/di7sL+uLF8EXLRzfiWDNi12uQv4nwtxPKvuKhH6yzHt7YqMH0\n" +
+        "46pmDKDaxV4w1JdycjCb6NrCJOYZygoQobuZqOQ30UZoZsPJrtovkncFr1e+lNcO\n" +
+        "+aWDfOLCtTH046dEQh5oCShyXMybNlry/QHsOtHOwQKBgQDh2iIjs+FPpQy7Z3EX\n" +
+        "DGEvHYqPjrYO9an2KSRr1m9gzRlWYxKY46WmPKwjMerYtra0GP+TBHrgxsfO8tD2\n" +
+        "wUAII6sd1qup0a/Sutgf2JxVilLykd0+Ge4/Cs51tCdJ8EqDV2B6WhTewOY2EGvg\n" +
+        "JiKYkeNwgRX/9M9CFSAMAk0hUQKBgQDLJAartL3DoGUPjYtpJnfgGM23yAGl6G5r\n" +
+        "NSXDn80BiYIC1p0bG3N0xm3yAjqOtJAUj9jZbvDNbCe3GJfLARMr23legX4tRrgZ\n" +
+        "nEdKnAFKAKL01oM+A5/lHdkwaZI9yyv+hgSVdYzUjB8rDmzeVQzo1BT7vXypt2yV\n" +
+        "6O1OnUpCbQKBgA/0rzDChopv6KRcvHqaX0tK1P0rYeVQqb9ATNhpf9jg5Idb3HZ8\n" +
+        "rrk91BNwdVz2G5ZBpdynFl9G69rNAMJOCM4KZw5mmh4XOEq09Ivba8AHU7DbaTv3\n" +
+        "7QL7KnbaUWRB26HHzIMYVh0el6T+KADf8NXCiMTr+bfpfbL3dxoiF3zhAoGAbCJD\n" +
+        "Qse1dBs/cKYCHfkSOsI5T6kx52Tw0jS6Y4X/FOBjyqr/elyEexbdk8PH9Ar931Qr\n" +
+        "NKMvn8oA4iA/PRrXX7M2yi3YQrWwbkGYWYjtzrzEAdzmg+5eARKAeJrZ8/bg9l3U\n" +
+        "ttKaItJsDPlizn8rngy3FsJpR9aSAMK6/+wOiYkCgYEA1tZkI1rD1W9NYZtbI9BE\n" +
+        "qlJVFi2PBOJMKNuWdouPX3HLQ72GJSQff2BFzLTELjweVVJ0SvY4IipzpQOHQOBy\n" +
+        "5qh/p6izXJZh3IHtvwVBjHoEVplg1b2+I5e3jDCfqnwcQw82dW5SxOJMg1h/BD0I\n" +
+        "qAL3go42DYeYhu/WnECMeis=",
+
+        //
+        // EC private key related to cert endEntityCertStrs[2].
+        //
+        "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgGVc7hICpmp91jbYe\n" +
+        "nrr8nYHD37RZP3VENY+szuA7WjuhRANCAATn0wRE1OVVnV56mzxnc657lmSBB0+0\n" +
+        "P5YgTq2Pc9sgqnEY8PG980/3n0DJCMQr96FZBWsIyY2gSQjNj4ggGAHT",
+
+        //
+        // DSA private key related to cert endEntityCertStrs[3].
+        //
+        "MIICZQIBADCCAjoGByqGSM44BAEwggItAoIBAQCaVq+CgmsxyOpZFVwMTZ2ZYA9E\n" +
+        "SCfNC+d4QN5/rxymsPONLC86zlB4XLHvmJtp2jV7qM7+tbWmsIZYcMPWgD9Ofg+T\n" +
+        "e+7SdTHO+XWoBNz5olulRTk6nRu+notsKxBCyVX0V5GHsRvts/qClz+QcIHMSALV\n" +
+        "UIrumtxxdbL63pIw4ds0PeH5RtyR9JpS5pWxUk1MPUPoYSV9GPg2bPUEY99Ji8qi\n" +
+        "vA1kRTeBfAWC0OgBwbHu1zIKUukMd+pF/D/vKKovJ6I/sPiGXmUw2i4lYOUB0wWn\n" +
+        "QUyBLez1UMWKchyvpW0FYxMbv7j5zMcAH7d++vCWo3OEGfe4Uet6Q3/Dx83HAiEA\n" +
+        "mjtJp7XNrsgxbRDqETkHhv6zYH8Voo+gDgSO1m7XcH0CggEBAI5moswp++plZSBP\n" +
+        "Q9DdCNHt0AV13Toj1jf5M5DNmTX6P6/D/oRfi8Ui1fiCKFv+7lD0J2anCFUaLtu+\n" +
+        "j7v78gp5OChDp/n49K6DtKtZZRDmw/Bpm6LNdknmdN5kO5wVzbIXHTCCeNs/CJTF\n" +
+        "mSU5PvEaI4y3M5NraSgLPkq4gEv7/A8orGbKmj1Whj3F9t1Tosxdm/+WkPldMz2t\n" +
+        "gev+9RM2S6S9XoembRgwRaFVkpQmKoKpOoZcdqV47FLDq5BYH/5POeJ9wLuAHjxQ\n" +
+        "5CMKo4p/lW7BCd4kuGWFT+OFFXfG2v6EtlqFbXBiFWLxyMsOtkUqWARCqEHhyucl\n" +
+        "TSYlj60EIgIgLfA75+8KcKxdN8mr6gzGjQe7jPFGG42Ejhd7Q2F4wuw="
+        };
+
+    // Private key algorithm of endEntityPrivateKeys.
+    final static String[] endEntityPrivateKeyAlgs = {
+        "EC",
+        "RSA",
+        "EC",
+        "DSA",
+    };
+
+    // Private key names of endEntityPrivateKeys.
+    static final String[] endEntityPrivateKeyNames = {
+        "ecdsa",
+        "rsa",
+        "ec-rsa",
+        "dsa",
+    };
+
+    /*
+     * Create an instance of SSLContext with the specified trust/key materials.
+     */
+    private SSLContext createSSLContext(
+            String[] trustedMaterials,
+            String[] keyMaterialCerts,
+            String[] keyMaterialKeys,
+            String[] keyMaterialKeyAlgs,
+            String[] keyMaterialKeyNames,
+            ContextParameters params) throws Exception {
+
+        KeyStore ts = null;     // trust store
+        KeyStore ks = null;     // key store
+        char passphrase[] = "passphrase".toCharArray();
+
+        // Generate certificate from cert string.
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+
+        // Import the trused certs.
+        ByteArrayInputStream is;
+        if (trustedMaterials != null && trustedMaterials.length != 0) {
+            ts = KeyStore.getInstance("JKS");
+            ts.load(null, null);
+
+            Certificate[] trustedCert =
+                    new Certificate[trustedMaterials.length];
+            for (int i = 0; i < trustedMaterials.length; i++) {
+                String trustedCertStr = trustedMaterials[i];
+
+                is = new ByteArrayInputStream(trustedCertStr.getBytes());
+                try {
+                    trustedCert[i] = cf.generateCertificate(is);
+                } finally {
+                    is.close();
+                }
+
+                ts.setCertificateEntry("trusted-cert-" + i, trustedCert[i]);
+            }
+        }
+
+        // Import the key materials.
+        //
+        // Note that certification pathes bigger than one are not supported yet.
+        boolean hasKeyMaterials =
+            (keyMaterialCerts != null) && (keyMaterialCerts.length != 0) &&
+            (keyMaterialKeys != null) && (keyMaterialKeys.length != 0) &&
+            (keyMaterialKeyAlgs != null) && (keyMaterialKeyAlgs.length != 0) &&
+            (keyMaterialCerts.length == keyMaterialKeys.length) &&
+            (keyMaterialCerts.length == keyMaterialKeyAlgs.length);
+        if (hasKeyMaterials) {
+            ks = KeyStore.getInstance("JKS");
+            ks.load(null, null);
+
+            for (int i = 0; i < keyMaterialCerts.length; i++) {
+                String keyCertStr = keyMaterialCerts[i];
+
+                // generate the private key.
+                PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec(
+                    Base64.getMimeDecoder().decode(keyMaterialKeys[i]));
+                KeyFactory kf =
+                    KeyFactory.getInstance(keyMaterialKeyAlgs[i]);
+                PrivateKey priKey = kf.generatePrivate(priKeySpec);
+
+                // generate certificate chain
+                is = new ByteArrayInputStream(keyCertStr.getBytes());
+                Certificate keyCert = null;
+                try {
+                    keyCert = cf.generateCertificate(is);
+                } finally {
+                    is.close();
+                }
+
+                Certificate[] chain = new Certificate[] { keyCert };
+
+                // import the key entry.
+                ks.setKeyEntry("cert-" + keyMaterialKeyNames[i],
+                        priKey, passphrase, chain);
+            }
+        }
+
+        // Create an SSLContext object.
+        TrustManagerFactory tmf =
+                TrustManagerFactory.getInstance(params.tmAlgorithm);
+        tmf.init(ts);
+
+        SSLContext context = SSLContext.getInstance(params.contextProtocol);
+        if (hasKeyMaterials && ks != null) {
+            KeyManagerFactory kmf =
+                    KeyManagerFactory.getInstance(params.kmAlgorithm);
+            kmf.init(ks, passphrase);
+
+            context.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+        } else {
+            context.init(null, tmf.getTrustManagers(), null);
+        }
+
+        return context;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/security/auth/Subject/DoAs.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,57 @@
+/*
+ * 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 8214583
+ * @summary Check that getSubject works after JIT compiler escape analysis.
+ */
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import javax.security.auth.Subject;
+
+public class DoAs {
+
+    public static void main(String[] args) throws Exception {
+        final Set<String> outer = new HashSet<>(Arrays.asList("Outer"));
+        final Subject subject = new Subject(true, Collections.EMPTY_SET, outer, Collections.EMPTY_SET);
+
+        for (int i = 0; i < 100_000; ++i) {
+            final int index = i;
+            Subject.doAs(subject, (PrivilegedExceptionAction<Integer>)() -> {
+                AccessControlContext c1 = AccessController.getContext();
+                Subject s = Subject.getSubject(c1);
+                if (s != subject) {
+                    throw new AssertionError("outer Oops! " + "iteration " + index + " " + s + " != " + subject);
+                }
+                return 0;
+            });
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLExceptionForIOIssue.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,162 @@
+/*
+ * 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.
+ */
+
+//
+// Please run in othervm mode.  SunJSSE does not support dynamic system
+// properties, no way to re-use system properties in samevm/agentvm mode.
+//
+
+/*
+ * @test
+ * @bug 8214339
+ * @summary SSLSocketImpl erroneously wraps SocketException
+ * @library /javax/net/ssl/templates
+ * @run main/othervm SSLExceptionForIOIssue
+ */
+
+import javax.net.ssl.*;
+import java.io.*;
+import java.net.InetAddress;
+
+public class SSLExceptionForIOIssue implements SSLContextTemplate {
+
+    public static void main(String[] args) throws Exception {
+        System.err.println("===================================");
+        new SSLExceptionForIOIssue().test();
+    }
+
+    private void test() throws Exception {
+        SSLServerSocket listenSocket = null;
+        SSLSocket serverSocket = null;
+        ClientSocket clientSocket = null;
+        try {
+            SSLServerSocketFactory serversocketfactory =
+                    createServerSSLContext().getServerSocketFactory();
+            listenSocket =
+                    (SSLServerSocket)serversocketfactory.createServerSocket(0);
+            listenSocket.setNeedClientAuth(false);
+            listenSocket.setEnableSessionCreation(true);
+            listenSocket.setUseClientMode(false);
+
+            System.err.println("Starting client");
+            clientSocket = new ClientSocket(listenSocket.getLocalPort());
+            clientSocket.start();
+
+            System.err.println("Accepting client requests");
+            serverSocket = (SSLSocket)listenSocket.accept();
+
+            if (!clientSocket.isDone) {
+                System.err.println("Waiting 3 seconds for client ");
+                Thread.sleep(3000);
+            }
+
+            System.err.println("Sending data to client ...");
+            String serverData = "Hi, I am server";
+            BufferedWriter os = new BufferedWriter(
+                    new OutputStreamWriter(serverSocket.getOutputStream()));
+            os.write(serverData, 0, serverData.length());
+            os.newLine();
+            os.flush();
+        } catch (SSLProtocolException | SSLHandshakeException sslhe) {
+            throw sslhe;
+        } catch (SSLException ssle) {
+            // the expected exception, ignore it
+            System.err.println("server exception: " + ssle);
+        } finally {
+            if (listenSocket != null) {
+                listenSocket.close();
+            }
+
+            if (serverSocket != null) {
+                serverSocket.close();
+            }
+        }
+
+        if (clientSocket != null && clientSocket.clientException != null) {
+            throw clientSocket.clientException;
+        }
+    }
+
+
+
+    private class ClientSocket extends Thread{
+        boolean isDone = false;
+        int serverPort = 0;
+        Exception clientException;
+
+        public ClientSocket(int serverPort) {
+            this.serverPort = serverPort;
+        }
+
+        @Override
+        public void run() {
+            SSLSocket clientSocket = null;
+            String clientData = "Hi, I am client";
+            try {
+                System.err.println(
+                        "Connecting to server at port " + serverPort);
+                SSLSocketFactory sslSocketFactory =
+                        createClientSSLContext().getSocketFactory();
+                clientSocket = (SSLSocket)sslSocketFactory.createSocket(
+                        InetAddress.getLocalHost(), serverPort);
+                clientSocket.setSoLinger(true, 3);
+                clientSocket.setSoTimeout(100);
+
+
+                System.err.println("Sending data to server ...");
+
+                BufferedWriter os = new BufferedWriter(
+                        new OutputStreamWriter(clientSocket.getOutputStream()));
+                os.write(clientData, 0, clientData.length());
+                os.newLine();
+                os.flush();
+
+                System.err.println("Reading data from server");
+                BufferedReader is = new BufferedReader(
+                        new InputStreamReader(clientSocket.getInputStream()));
+                String data = is.readLine();
+                System.err.println("Received Data from server: " + data);
+            } catch (SSLProtocolException | SSLHandshakeException sslhe) {
+                clientException = sslhe;
+                System.err.println("unexpected client exception: " + sslhe);
+            } catch (SSLException ssle) {
+                // the expected exception, ignore it
+                System.err.println("expected client exception: " + ssle);
+            } catch (Exception e) {
+                clientException = e;
+                System.err.println("unexpected client exception: " + e);
+            } finally {
+                if (clientSocket != null) {
+                    try {
+                        clientSocket.close();
+                        System.err.println("client socket closed");
+                    } catch (IOException ioe) {
+                        clientException = ioe;
+                    }
+                }
+
+                isDone = true;
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketBruceForceClose.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+
+//
+// Please run in othervm mode.  SunJSSE does not support dynamic system
+// properties, no way to re-use system properties in samevm/agentvm mode.
+//
+
+/*
+ * @test
+ * @bug 8209333
+ * @summary Socket reset issue for TLS 1.3 socket close
+ * @library /javax/net/ssl/templates
+ * @run main/othervm SSLSocketBruceForceClose
+ */
+
+import javax.net.ssl.*;
+import java.io.*;
+import java.net.InetAddress;
+
+public class SSLSocketBruceForceClose implements SSLContextTemplate {
+
+    public static void main(String[] args) throws Exception {
+        for (int i = 0; i<= 10; i++) {
+            System.err.println("===================================");
+            System.err.println("loop " + i);
+            System.err.println("===================================");
+            new SSLSocketBruceForceClose().test();
+        }
+    }
+
+    private void test() throws Exception {
+        SSLServerSocket listenSocket = null;
+        SSLSocket serverSocket = null;
+        ClientSocket clientSocket = null;
+        try {
+            SSLServerSocketFactory serversocketfactory =
+                    createServerSSLContext().getServerSocketFactory();
+            listenSocket =
+                    (SSLServerSocket)serversocketfactory.createServerSocket(0);
+            listenSocket.setNeedClientAuth(false);
+            listenSocket.setEnableSessionCreation(true);
+            listenSocket.setUseClientMode(false);
+
+
+            System.err.println("Starting client");
+            clientSocket = new ClientSocket(listenSocket.getLocalPort());
+            clientSocket.start();
+
+            System.err.println("Accepting client requests");
+            serverSocket = (SSLSocket) listenSocket.accept();
+
+            System.err.println("Reading data from client");
+            BufferedReader serverReader = new BufferedReader(
+                    new InputStreamReader(serverSocket.getInputStream()));
+            String data = serverReader.readLine();
+            System.err.println("Received data from client: " + data);
+
+            System.err.println("Reading more data from client");
+            data = serverReader.readLine();
+            System.err.println("Received data from client: " + data);
+        } finally {
+            if (listenSocket != null) {
+                listenSocket.close();
+            }
+
+            if (serverSocket != null) {
+                serverSocket.close();
+            }
+        }
+
+        if (clientSocket != null && clientSocket.clientException != null) {
+            throw clientSocket.clientException;
+        }
+    }
+
+    private class ClientSocket extends Thread{
+        int serverPort = 0;
+        Exception clientException;
+
+        public ClientSocket(int serverPort) {
+            this.serverPort = serverPort;
+        }
+
+        @Override
+        public void run() {
+            SSLSocket clientSocket = null;
+            String clientData = "Hi, I am client";
+            try {
+                System.err.println(
+                        "Connecting to server at port " + serverPort);
+                SSLSocketFactory sslSocketFactory =
+                        createClientSSLContext().getSocketFactory();
+                clientSocket = (SSLSocket)sslSocketFactory.createSocket(
+                        InetAddress.getLocalHost(), serverPort);
+                clientSocket.setSoLinger(true, 3);
+                clientSocket.setSoTimeout(1000);
+
+
+                System.err.println("Sending data to server ...");
+
+                BufferedWriter os = new BufferedWriter(
+                        new OutputStreamWriter(clientSocket.getOutputStream()));
+                os.write(clientData, 0, clientData.length());
+                os.newLine();
+                os.flush();
+
+                System.err.println("Sending more data to server ...");
+                os.write(clientData, 0, clientData.length());
+                os.newLine();
+                os.flush();
+            } catch (Exception e) {
+                clientException = e;
+            } finally {
+                if (clientSocket != null) {
+                    try{
+                        clientSocket.close();
+                        System.err.println("client socket closed");
+                    } catch (IOException ioe) {
+                        clientException = ioe;
+                    }
+                }
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketClose.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+
+//
+// Please run in othervm mode.  SunJSSE does not support dynamic system
+// properties, no way to re-use system properties in samevm/agentvm mode.
+//
+
+/*
+ * @test
+ * @bug 8209333
+ * @summary Socket reset issue for TLS 1.3 socket close
+ * @library /javax/net/ssl/templates
+ * @run main/othervm SSLSocketClose
+ */
+
+import javax.net.ssl.*;
+import java.io.*;
+import java.net.InetAddress;
+
+public class SSLSocketClose implements SSLContextTemplate {
+
+    public static void main(String[] args) throws Exception {
+        for (int i = 0; i<= 10; i++) {
+            System.err.println("===================================");
+            System.err.println("loop " + i);
+            System.err.println("===================================");
+            new SSLSocketClose().test();
+        }
+    }
+
+    private void test() throws Exception {
+        SSLServerSocket listenSocket = null;
+        SSLSocket serverSocket = null;
+        ClientSocket clientSocket = null;
+        try {
+            SSLServerSocketFactory serversocketfactory =
+                    createServerSSLContext().getServerSocketFactory();
+            listenSocket =
+                    (SSLServerSocket)serversocketfactory.createServerSocket(0);
+            listenSocket.setNeedClientAuth(false);
+            listenSocket.setEnableSessionCreation(true);
+            listenSocket.setUseClientMode(false);
+
+
+            System.err.println("Starting client");
+            clientSocket = new ClientSocket(listenSocket.getLocalPort());
+            clientSocket.start();
+
+            System.err.println("Accepting client requests");
+            serverSocket = (SSLSocket) listenSocket.accept();
+
+            System.err.println("Reading data from client");
+            BufferedReader serverReader = new BufferedReader(
+                    new InputStreamReader(serverSocket.getInputStream()));
+            String data = serverReader.readLine();
+            System.err.println("Received data from client: " + data);
+
+            System.err.println("Sending data to client ...");
+            String serverData = "Hi, I am server";
+            BufferedWriter os = new BufferedWriter(
+                    new OutputStreamWriter(serverSocket.getOutputStream()));
+            os.write(serverData, 0, serverData.length());
+            os.newLine();
+            os.flush();
+
+            System.err.println("Reading more data from client");
+            data = serverReader.readLine();
+            System.err.println("Received data from client: " + data);
+        } finally {
+            if (listenSocket != null) {
+                listenSocket.close();
+            }
+
+            if (serverSocket != null) {
+                serverSocket.close();
+            }
+        }
+
+        if (clientSocket != null && clientSocket.clientException != null) {
+            throw clientSocket.clientException;
+        }
+    }
+
+    private class ClientSocket extends Thread{
+        int serverPort = 0;
+        Exception clientException;
+
+        public ClientSocket(int serverPort) {
+            this.serverPort = serverPort;
+        }
+
+        @Override
+        public void run() {
+            SSLSocket clientSocket = null;
+            String clientData = "Hi, I am client";
+            try {
+                System.err.println(
+                        "Connecting to server at port " + serverPort);
+                SSLSocketFactory sslSocketFactory =
+                        createClientSSLContext().getSocketFactory();
+                clientSocket = (SSLSocket)sslSocketFactory.createSocket(
+                        InetAddress.getLocalHost(), serverPort);
+                clientSocket.setSoLinger(true, 3);
+
+                System.err.println("Sending data to server ...");
+
+                BufferedWriter os = new BufferedWriter(
+                        new OutputStreamWriter(clientSocket.getOutputStream()));
+                os.write(clientData, 0, clientData.length());
+                os.newLine();
+                os.flush();
+
+                System.err.println("Reading data from server");
+                BufferedReader is = new BufferedReader(
+                        new InputStreamReader(clientSocket.getInputStream()));
+                String data = is.readLine();
+                System.err.println("Received Data from server: " + data);
+
+                System.err.println("Sending more data to server ...");
+                os.write(clientData, 0, clientData.length());
+                os.newLine();
+                os.flush();
+            } catch (Exception e) {
+                clientException = e;
+            } finally {
+                if (clientSocket != null) {
+                    try{
+                        clientSocket.close();
+                        System.err.println("client socket closed");
+                    } catch (IOException ioe) {
+                        clientException = ioe;
+                    }
+                }
+            }
+        }
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/util/misc/SetNullSigParams.java	Fri Dec 21 07:46:58 2018 -0500
@@ -0,0 +1,78 @@
+/*
+ * 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 8214096
+ * @summary Make sure SignatureUtil can accept null algorithm parameters
+ * @modules java.base/sun.security.util
+ */
+import java.security.*;
+import java.security.spec.AlgorithmParameterSpec;
+import sun.security.util.SignatureUtil;
+
+public class SetNullSigParams {
+
+    public static void main(String[] args) throws Exception {
+        Signature sig = new SpecialSigImpl();
+        SignatureUtil.specialSetParameter(sig, (byte[]) null);
+        SignatureUtil.specialSetParameter(sig, (AlgorithmParameters) null);
+    }
+
+    // Sample Signature impl class which simulates 3rd party provider behavior
+    // and throws NPE when given null algorithm parameters
+    // For max backward-compatibility, sun.security.util.SignatureUtil class
+    // now calls setParameter() only when algorithm parameters is non-null
+    private static class SpecialSigImpl extends Signature {
+        SpecialSigImpl() {
+            super("ANY");
+        }
+        @Override
+        protected void engineInitVerify(PublicKey publicKey)
+                throws InvalidKeyException {}
+        @Override
+        protected void engineInitSign(PrivateKey privateKey)
+                throws InvalidKeyException {}
+        @Override
+        protected void engineUpdate(byte b) throws SignatureException {}
+        @Override
+        protected void engineUpdate(byte[] b, int off, int len)
+                throws SignatureException {}
+        @Override
+        protected byte[] engineSign() throws SignatureException { return null; }
+        @Override
+        protected boolean engineVerify(byte[] sigBytes)
+                throws SignatureException { return false; }
+        @Override
+        protected void engineSetParameter(String param, Object value)
+                throws InvalidParameterException {}
+        @Override
+        protected void engineSetParameter(AlgorithmParameterSpec params)
+                throws InvalidAlgorithmParameterException {
+            if (params == null) throw new NullPointerException("Test Failed");
+        }
+        @Override
+        protected Object engineGetParameter(String param)
+                throws InvalidParameterException { return null; }
+    }
+}
--- a/test/langtools/jdk/jshell/ToolShiftTabTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/langtools/jdk/jshell/ToolShiftTabTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -126,7 +126,7 @@
         doRunTest((inputSink, out) -> {
             inputSink.write("123");
             inputSink.write(FIX + "z");
-            waitOutput(out, "Unexpected character after Shift-Tab");
+            waitOutput(out, "Unexpected character after Shift\\+Tab");
         });
     }
 }
--- a/test/langtools/jdk/jshell/ToolSimpleTest.java	Fri Dec 21 07:40:47 2018 -0500
+++ b/test/langtools/jdk/jshell/ToolSimpleTest.java	Fri Dec 21 07:46:58 2018 -0500
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8210596 8210959
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8210596 8210959 8215099
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -448,7 +448,8 @@
         test(
                 (a) -> assertHelp(a, "/?", "/list", "/help", "/exit", "intro"),
                 (a) -> assertHelp(a, "/help", "/list", "/help", "/exit", "intro"),
-                (a) -> assertHelp(a, "/help short", "shortcuts", "<tab>"),
+                (a) -> assertHelp(a, "/help short", "shortcuts", "Tab"),
+                (a) -> assertHelp(a, "/help keys", "line", "Shift", "imports", "history"),
                 (a) -> assertHelp(a, "/? /li", "/list -all", "snippets"),
                 (a) -> assertHelp(a, "/help /set prompt", "optionally contain '%s'", "quoted"),
                 (a) -> assertHelp(a, "/help /help", "/help <command>"),