changeset 54917:24cfd5fd72e8 intrinsics-project

Automatic merge with default
author mcimadamore
date Thu, 14 Feb 2019 22:08:36 +0100
parents a9c30ec2b4ea e31f39e088b7
children 1ecccc7748df
files .hgtags make/conf/jib-profiles.js src/hotspot/share/classfile/classFileParser.cpp src/hotspot/share/classfile/systemDictionary.cpp src/hotspot/share/gc/g1/dirtyCardQueue.cpp src/hotspot/share/gc/g1/dirtyCardQueue.hpp src/hotspot/share/gc/g1/g1CollectedHeap.hpp src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp src/hotspot/share/oops/instanceKlass.cpp src/hotspot/share/oops/symbol.hpp src/hotspot/share/runtime/arguments.cpp src/hotspot/share/runtime/globals.hpp src/hotspot/share/runtime/java.cpp src/hotspot/share/utilities/constantTag.hpp src/java.base/share/classes/sun/security/tools/keytool/Main.java src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/output_html.properties src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/output_text.properties src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/output_unknown.properties src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/output_xml.properties src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties test/hotspot/jtreg/ProblemList.txt test/jdk/sun/security/krb5/auto/rcache_usemd5.sh test/jdk/sun/security/krb5/tools/ktarg.sh test/jdk/sun/security/krb5/tools/ktcheck.sh test/jdk/sun/security/krb5/tools/ktmissing.sh test/jdk/sun/security/krb5/tools/ktzero.sh test/jdk/sun/security/pkcs11/fips/CipherTest.java test/jdk/sun/security/pkcs11/fips/ClientJSSEServerJSSE.java test/jdk/sun/security/pkcs11/fips/ImportKeyStore.java test/jdk/sun/security/pkcs11/fips/JSSEClient.java test/jdk/sun/security/pkcs11/fips/JSSEServer.java test/jdk/sun/security/pkcs11/fips/TestTLS12.java test/jdk/sun/security/pkcs11/fips/TrustManagerTest.java test/jdk/sun/security/pkcs11/fips/TrustManagerTest.policy test/jdk/sun/security/pkcs11/fips/cert8.db test/jdk/sun/security/pkcs11/fips/certs/anchor.cer test/jdk/sun/security/pkcs11/fips/certs/ca.cer test/jdk/sun/security/pkcs11/fips/certs/server.cer test/jdk/sun/security/pkcs11/fips/fips.cfg test/jdk/sun/security/pkcs11/fips/key3.db test/jdk/sun/security/pkcs11/fips/keystore test/jdk/sun/security/pkcs11/fips/secmod.db test/jdk/sun/security/pkcs11/fips/truststore
diffstat 203 files changed, 3267 insertions(+), 4493 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Feb 13 16:43:41 2019 -0500
+++ b/.hgtags	Thu Feb 14 22:08:36 2019 +0100
@@ -542,3 +542,4 @@
 6c377af36a5c4203f16aed8a5e4c2ecc08fcd8bd jdk-12+30
 021917019cda1c0c5853255322274f37693a2431 jdk-13+7
 b5f7bb57de2f797be34f6c75d45c3245ad37ab97 jdk-12+31
+a535ba736cabc6886acdff36de3a096c46e5ddc5 jdk-13+8
--- a/make/Init.gmk	Wed Feb 13 16:43:41 2019 -0500
+++ b/make/Init.gmk	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -277,7 +277,7 @@
         else
 	  $(ECHO) "Re-running configure using default settings"
         endif
-	( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" \
+	( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" AUTOCONF="$(AUTOCONF)" \
 	    CUSTOM_ROOT="$(CUSTOM_ROOT)" \
 	    CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
 	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
--- a/make/Main.gmk	Wed Feb 13 16:43:41 2019 -0500
+++ b/make/Main.gmk	Thu Feb 14 22:08:36 2019 +0100
@@ -766,6 +766,8 @@
   $(foreach m, $(GENSRC_MODULES), $(eval $m-libs-compile-commands: $m-gensrc))
   $(foreach m, $(filter $(JAVA_MODULES), $(LIBS_MODULES)), $(eval $m-libs-compile-commands: $m-java))
 
+  $(COMPILE_COMMANDS_TARGETS_HOTSPOT): clean-compile-commands
+  $(COMPILE_COMMANDS_TARGETS_JDK): clean-compile-commands
   compile-commands-hotspot: $(COMPILE_COMMANDS_TARGETS_HOTSPOT)
   compile-commands: $(COMPILE_COMMANDS_TARGETS_HOTSPOT) $(COMPILE_COMMANDS_TARGETS_JDK)
 
@@ -1139,6 +1141,9 @@
 clean-docs:
 	$(call CleanDocs)
 
+clean-compile-commands:
+	$(call CleanMakeSupportDir,compile-commands)
+
 $(CLEAN_DIR_TARGETS):
 	$(call CleanDir,$(patsubst clean-%, %, $@))
 
@@ -1181,9 +1186,9 @@
 	)
 	$(ECHO) Cleaned everything, you will have to re-run configure.
 
-ALL_TARGETS += clean clean-docs dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_SUPPORT_DIR_TARGETS) \
-    $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) \
-    $(CLEAN_MODULE_PHASE_TARGETS)
+ALL_TARGETS += clean clean-docs clean-compile-commands dist-clean $(CLEAN_DIR_TARGETS) \
+    $(CLEAN_SUPPORT_DIR_TARGETS) $(CLEAN_TEST_TARGETS) $(CLEAN_PHASE_TARGETS) \
+    $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
 
 ################################################################################
 # Declare *-only targets for each normal target
--- a/make/MainSupport.gmk	Wed Feb 13 16:43:41 2019 -0500
+++ b/make/MainSupport.gmk	Thu Feb 14 22:08:36 2019 +0100
@@ -54,6 +54,13 @@
 	@$(PRINTF) " done\n"
 endef
 
+define CleanMakeSupportDir
+	@$(PRINTF) "Cleaning $(strip $1) make support artifacts ..."
+	@$(PRINTF) "\n" $(LOG_DEBUG)
+	$(RM) -r $(MAKESUPPORT_OUTPUTDIR)/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
 define CleanTest
 	@$(PRINTF) "Cleaning test $(strip $1) ..."
 	@$(PRINTF) "\n" $(LOG_DEBUG)
--- a/make/autoconf/basics.m4	Wed Feb 13 16:43:41 2019 -0500
+++ b/make/autoconf/basics.m4	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -406,6 +406,8 @@
 [
   # Save the original command line. This is passed to us by the wrapper configure script.
   AC_SUBST(CONFIGURE_COMMAND_LINE)
+  # AUTOCONF might be set in the environment by the user. Preserve for "make reconfigure".
+  AC_SUBST(AUTOCONF)
   # Save the path variable before it gets changed
   ORIGINAL_PATH="$PATH"
   AC_SUBST(ORIGINAL_PATH)
--- a/make/autoconf/spec.gmk.in	Wed Feb 13 16:43:41 2019 -0500
+++ b/make/autoconf/spec.gmk.in	Thu Feb 14 22:08:36 2019 +0100
@@ -36,6 +36,9 @@
 # A self-referential reference to this file.
 SPEC:=@SPEC@
 
+# Path to autoconf if overriden by the user, to be used by "make reconfigure"
+AUTOCONF := @AUTOCONF@
+
 # SPACE and COMMA are defined in MakeBase.gmk, but they are also used in
 # some definitions here, and are needed if MakeBase.gmk is not included before
 # this file.
--- a/make/conf/jib-profiles.js	Wed Feb 13 16:43:41 2019 -0500
+++ b/make/conf/jib-profiles.js	Thu Feb 14 22:08:36 2019 +0100
@@ -944,11 +944,17 @@
         },
 
         jcov: {
-            server: "jpg",
-            product: "jcov",
-            version: "3.0",
-            build_number: "b07",
-            file: "bundles/jcov-3_0.zip",
+            // Until an official build of JCov is available, use custom
+            // build to support classfile version 57.
+            // See CODETOOLS-7902358 for more info.
+            // server: "jpg",
+            // product: "jcov",
+            // version: "3.0",
+            // build_number: "b07",
+            // file: "bundles/jcov-3_0.zip",
+            organization: common.organization,
+            revision: "3.0-57-support+1.0",
+            ext: "zip",
             environment_name: "JCOV_HOME",
         },
 
--- a/make/hotspot/lib/JvmFlags.gmk	Wed Feb 13 16:43:41 2019 -0500
+++ b/make/hotspot/lib/JvmFlags.gmk	Thu Feb 14 22:08:36 2019 +0100
@@ -74,7 +74,7 @@
   endif
 else ifeq ($(DEBUG_LEVEL), fastdebug)
   JVM_CFLAGS_DEBUGLEVEL := -DASSERT
-  ifeq ($call isTargetOs, windows aix), false)
+  ifeq ($(call isTargetOs, windows aix), false)
     # NOTE: Old build did not define CHECK_UNHANDLED_OOPS on Windows and AIX.
     JVM_CFLAGS_DEBUGLEVEL += -DCHECK_UNHANDLED_OOPS
   endif
--- a/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/cpu/aarch64/gc/shenandoah/shenandoahBarrierSetAssembler_aarch64.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -425,54 +425,56 @@
 void ShenandoahBarrierSetAssembler::cmpxchg_oop(MacroAssembler* masm, Register addr, Register expected, Register new_val,
                                                 bool acquire, bool release, bool weak, bool is_cae,
                                                 Register result) {
-
-  Register tmp = rscratch2;
+  Register tmp1 = rscratch1;
+  Register tmp2 = rscratch2;
   bool is_narrow = UseCompressedOops;
   Assembler::operand_size size = is_narrow ? Assembler::word : Assembler::xword;
 
-  assert_different_registers(addr, expected, new_val, result, tmp);
+  assert_different_registers(addr, expected, new_val, tmp1, tmp2);
 
   Label retry, done, fail;
 
   // CAS, using LL/SC pair.
   __ bind(retry);
-  __ load_exclusive(result, addr, size, acquire);
+  __ load_exclusive(tmp1, addr, size, acquire);
   if (is_narrow) {
-    __ cmpw(result, expected);
+    __ cmpw(tmp1, expected);
   } else {
-    __ cmp(result, expected);
+    __ cmp(tmp1, expected);
   }
   __ br(Assembler::NE, fail);
-  __ store_exclusive(tmp, new_val, addr, size, release);
+  __ store_exclusive(tmp2, new_val, addr, size, release);
   if (weak) {
-    __ cmpw(tmp, 0u); // If the store fails, return NE to our caller
+    __ cmpw(tmp2, 0u); // If the store fails, return NE to our caller
   } else {
-    __ cbnzw(tmp, retry);
+    __ cbnzw(tmp2, retry);
   }
   __ b(done);
 
  __  bind(fail);
-  // Check if rb(expected)==rb(result)
+  // Check if rb(expected)==rb(tmp1)
   // Shuffle registers so that we have memory value ready for next expected.
-  __ mov(tmp, expected);
-  __ mov(expected, result);
+  __ mov(tmp2, expected);
+  __ mov(expected, tmp1);
   if (is_narrow) {
-    __ decode_heap_oop(result, result);
-    __ decode_heap_oop(tmp, tmp);
+    __ decode_heap_oop(tmp1, tmp1);
+    __ decode_heap_oop(tmp2, tmp2);
   }
-  read_barrier_impl(masm, result);
-  read_barrier_impl(masm, tmp);
-  __ cmp(result, tmp);
+  read_barrier_impl(masm, tmp1);
+  read_barrier_impl(masm, tmp2);
+  __ cmp(tmp1, tmp2);
   // Retry with expected now being the value we just loaded from addr.
   __ br(Assembler::EQ, retry);
   if (is_cae && is_narrow) {
     // For cmp-and-exchange and narrow oops, we need to restore
     // the compressed old-value. We moved it to 'expected' a few lines up.
-    __ mov(result, expected);
+    __ mov(tmp1, expected);
   }
   __ bind(done);
 
-  if (!is_cae) {
+  if (is_cae) {
+    __ mov(result, tmp1);
+  } else {
     __ cset(result, Assembler::EQ);
   }
 }
--- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -3230,7 +3230,6 @@
     // since the parameter_size includes it.
     __ push(r19);
     __ mov(r19, index);
-    assert(ConstantPoolCacheEntry::_indy_resolved_references_appendix_offset == 0, "appendix expected at index+0");
     __ load_resolved_reference_at_index(index, r19);
     __ pop(r19);
     __ push(index);  // push appendix (MethodType, CallSite, etc.)
--- a/src/hotspot/cpu/arm/templateTable_arm.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/cpu/arm/templateTable_arm.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3645,7 +3645,6 @@
     Label L_no_push;
     __ tbz(flags, ConstantPoolCacheEntry::has_appendix_shift, L_no_push);
     __ mov(temp, index);
-    assert(ConstantPoolCacheEntry::_indy_resolved_references_appendix_offset == 0, "appendix expected at index+0");
     __ load_resolved_reference_at_index(index, temp);
     __ verify_oop(index);
     __ push_ptr(index);  // push appendix (MethodType, CallSite, etc.)
--- a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -29,6 +29,7 @@
 #include "gc/g1/g1BarrierSetAssembler.hpp"
 #include "gc/g1/g1BarrierSetRuntime.hpp"
 #include "gc/g1/g1CardTable.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1SATBMarkQueueSet.hpp"
 #include "gc/g1/g1ThreadLocalData.hpp"
 #include "gc/g1/heapRegion.hpp"
@@ -512,7 +513,7 @@
 
   __ bind(restart);
 
-  // Get the index into the update buffer. DirtyCardQueue::_index is
+  // Get the index into the update buffer. G1DirtyCardQueue::_index is
   // a size_t so ld_ptr is appropriate here.
   __ ld(tmp2, dirty_card_q_index_byte_offset, R16_thread);
 
@@ -539,7 +540,7 @@
   __ mflr(R0);
   __ std(R0, _abi(lr), R1_SP);
   __ push_frame_reg_args(nbytes_save, R0); // dummy frame for C call
-  __ call_VM_leaf(CAST_FROM_FN_PTR(address, DirtyCardQueueSet::handle_zero_index_for_thread), R16_thread);
+  __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1DirtyCardQueueSet::handle_zero_index_for_thread), R16_thread);
   __ pop_frame();
   __ ld(R0, _abi(lr), R1_SP);
   __ mtlr(R0);
--- a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2018, SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -30,6 +30,7 @@
 #include "gc/g1/g1BarrierSet.hpp"
 #include "gc/g1/g1BarrierSetAssembler.hpp"
 #include "gc/g1/g1BarrierSetRuntime.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1SATBMarkQueueSet.hpp"
 #include "gc/g1/g1ThreadLocalData.hpp"
 #include "gc/g1/heapRegion.hpp"
@@ -587,7 +588,7 @@
 
   __ bind(restart);
 
-  // Get the index into the update buffer. DirtyCardQueue::_index is
+  // Get the index into the update buffer. G1DirtyCardQueue::_index is
   // a size_t so z_ltg is appropriate here.
   __ z_ltg(idx, Address(Z_thread, dirty_card_q_index_byte_offset));
 
@@ -607,7 +608,7 @@
   __ bind(refill);
   save_volatile_registers(sasm);
   __ z_lgr(idx, addr_card); // Save addr_card, tmp3 must be non-volatile.
-  __ call_VM_leaf(CAST_FROM_FN_PTR(address, DirtyCardQueueSet::handle_zero_index_for_thread),
+  __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1DirtyCardQueueSet::handle_zero_index_for_thread),
                                    Z_thread);
   __ z_lgr(addr_card, idx);
   restore_volatile_registers(sasm); // Restore addr_card.
--- a/src/hotspot/cpu/sparc/gc/g1/g1BarrierSetAssembler_sparc.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/cpu/sparc/gc/g1/g1BarrierSetAssembler_sparc.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 #include "gc/g1/g1BarrierSetAssembler.hpp"
 #include "gc/g1/g1BarrierSetRuntime.hpp"
 #include "gc/g1/g1CardTable.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1SATBMarkQueueSet.hpp"
 #include "gc/g1/g1ThreadLocalData.hpp"
 #include "gc/g1/heapRegion.hpp"
@@ -315,7 +316,7 @@
   int dirty_card_q_buf_byte_offset = in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset());
   __ bind(restart);
 
-  // Load the index into the update buffer. DirtyCardQueue::_index is
+  // Load the index into the update buffer. G1DirtyCardQueue::_index is
   // a size_t so ld_ptr is appropriate here.
   __ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, L0);
 
@@ -333,7 +334,7 @@
   __ bind(refill);
   address handle_zero =
     CAST_FROM_FN_PTR(address,
-                     &DirtyCardQueueSet::handle_zero_index_for_thread);
+                     &G1DirtyCardQueueSet::handle_zero_index_for_thread);
   // This should be rare enough that we can afford to save all the
   // scratch registers that the calling context might be using.
   __ mov(G1_scratch, L3);
@@ -673,7 +674,7 @@
 
   __ bind(restart);
 
-  // Get the index into the update buffer. DirtyCardQueue::_index is
+  // Get the index into the update buffer. G1DirtyCardQueue::_index is
   // a size_t so ld_ptr is appropriate here.
   __ ld_ptr(G2_thread, dirty_card_q_index_byte_offset, tmp3);
 
@@ -694,7 +695,7 @@
 
   __ call_VM_leaf(L7_thread_cache,
                   CAST_FROM_FN_PTR(address,
-                                   DirtyCardQueueSet::handle_zero_index_for_thread),
+                                   G1DirtyCardQueueSet::handle_zero_index_for_thread),
                   G2_thread);
 
   __ restore_live_registers(true);
--- a/src/hotspot/cpu/sparc/templateTable_sparc.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/cpu/sparc/templateTable_sparc.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2992,7 +2992,6 @@
     // Push the appendix as a trailing parameter.
     // This must be done before we get the receiver,
     // since the parameter_size includes it.
-    assert(ConstantPoolCacheEntry::_indy_resolved_references_appendix_offset == 0, "appendix expected at index+0");
     __ load_resolved_reference_at_index(temp, index, /*tmp*/recv);
     __ verify_oop(temp);
     __ push_ptr(temp);  // push appendix (MethodType, CallSite, etc.)
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3643,7 +3643,6 @@
     // since the parameter_size includes it.
     __ push(rbx);
     __ mov(rbx, index);
-    assert(ConstantPoolCacheEntry::_indy_resolved_references_appendix_offset == 0, "appendix expected at index+0");
     __ load_resolved_reference_at_index(index, rbx);
     __ pop(rbx);
     __ push(index);  // push appendix (MethodType, CallSite, etc.)
--- a/src/hotspot/os/aix/porting_aix.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/os/aix/porting_aix.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 2019 SAP SE. 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,7 +34,15 @@
 #include "utilities/align.hpp"
 #include "utilities/debug.hpp"
 
+// distinguish old xlc and xlclang++, where
+// <ibmdemangle.h> is suggested but not found in GA release (might come with a fix)
+#if defined(__clang__)
+#define DISABLE_DEMANGLE
+// #include <ibmdemangle.h>
+#else
 #include <demangle.h>
+#endif
+
 #include <sys/debug.h>
 #include <pthread.h>
 #include <ucontext.h>
@@ -237,6 +245,7 @@
       p_name[i] = '\0';
 
       // If it is a C++ name, try and demangle it using the Demangle interface (see demangle.h).
+#ifndef DISABLE_DEMANGLE
       if (demangle) {
         char* rest;
         Name* const name = Demangle(p_name, rest);
@@ -249,6 +258,7 @@
           delete name;
         }
       }
+#endif
     } else {
       strncpy(p_name, "<nameless function>", namelen-1);
       p_name[namelen-1] = '\0';
--- a/src/hotspot/os_cpu/aix_ppc/prefetch_aix_ppc.inline.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/os_cpu/aix_ppc/prefetch_aix_ppc.inline.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -43,7 +43,7 @@
 }
 
 inline void Prefetch::write(void *loc, intx interval) {
-#if !defined(USE_XLC_PREFETCH_WRITE_BUILTIN)
+#if !defined(USE_XLC_BUILTINS)
   __asm__ __volatile__ (
     "   dcbtst 0, %0       \n"
     :
--- a/src/hotspot/share/ci/ciStreams.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/ci/ciStreams.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -334,15 +334,91 @@
   ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder);
   will_link = m->is_loaded();
 
-  // Use the MethodType stored in the CP cache to create a signature
+  // Use the signature stored in the CP cache to create a signature
   // with correct types (in respect to class loaders).
-  if (has_method_type()) {
-    ciSymbol*     sig_sym     = env->get_symbol(cpool->symbol_at(get_method_signature_index(cpool)));
-    ciKlass*      pool_holder = env->get_klass(cpool->pool_holder());
-    ciMethodType* method_type = get_method_type();
-    ciSignature* declared_signature = new (env->arena()) ciSignature(pool_holder, sig_sym, method_type);
-    (*declared_signature_result) = declared_signature;
+  //
+  // In classic Java (before Java 7) there is never the slightest
+  // difference between the signature at the call site and that of the
+  // method.  Such a difference would have been a type error in the
+  // JVM.
+  //
+  // Now there are a few circumstances where the signature of a call
+  // site (which controls the outgoing stacked arguments) can differ
+  // from the signature of the method (which controls the receipt of
+  // those arguments at the method entry point).
+  //
+  // A. The signatures can differ if the callee is a static method and
+  // the caller thinks it is calling a non-static method (VH.get).
+  // This requires the method signature to have an explicit leading
+  // argument for the implicit 'this', not present at the call site.
+  //
+  // B. The call site can have less specific parameter types than the
+  // method, allowing loosely-typed code to handle strongly-typed
+  // methods.  This happens with linkToStatic and related linker
+  // commands.  Obviously the loosely-typed code has to ensure that
+  // the strongly typed method's invariants are respected, and this is
+  // done by issuing dynamic casts.
+  //
+  // C. The call site can have more specific parameter types than the
+  // method, allowing loosely-typed methods to handle strongly-typed
+  // requests.
+  //
+  // D. There are corresponding effects with return values, such as
+  // boolean method returning an int to an int-receiving call site,
+  // even though the method thought it returned just a boolean.
+  //
+  // E. The calling sequence at a particular call site may add an
+  // "appendix" argument not mentioned in the call site signature.  It
+  // is expected by the method signature, though, and this adds to the
+  // method's arity, even after 'this' parameter effects (A) are
+  // discounted.  Appendixes are used by invokehandle and
+  // invokedynamic instructions.
+  //
+  // F. A linker method (linkToStatic, etc.) can also take an extra
+  // argument, a MemberName which routes the call to a concrete
+  // strongly-typed method.  In this case the linker method may also
+  // differ in any of the ways A-D.  The eventual method will ignore
+  // the presence of the extra argument.
+  //
+  // None of these changes to calling sequences requires an argument
+  // to be moved or reformatted in any way.  This works because all
+  // references look alike to the JVM, as do all primitives (except
+  // float/long/double).  Another required property of the JVM is
+  // that, if a trailing argument is added or dropped, the placement
+  // of other arguments does not change.  This allows cases E and F to
+  // work smoothly, against without any moving or reformatting,
+  // despite the arity change.
+  //
+  if (has_local_signature()) {
+    Symbol* local_signature = cpool->symbol_at(get_method_signature_index(cpool));
+    ciSymbol* sig_sym  = env->get_symbol(local_signature);
+    ciKlass* pool_holder = env->get_klass(cpool->pool_holder());
+    ciSignature* call_site_sig = new (env->arena()) ciSignature(pool_holder, cpool, sig_sym);
+    // Examples of how the call site signature can differ from the method's own signature:
+    //
+    //  meth = static jboolean java.lang.invoke.VarHandleGuards.guard_LII_Z(jobject, jobject, jint, jint, jobject)
+    //  msig = (Ljava/lang/invoke/VarHandle;Ljava/lang/Object;IILjava/lang/invoke/VarHandle$AccessDescriptor;)Z
+    //  call = (Ljava/util/concurrent/locks/AbstractQueuedSynchronizer;II)Z
+    //
+    //  meth = static jobject java.lang.invoke.LambdaForm$MH/0x0000000800066840.linkToTargetMethod(jobject, jobject)
+    //  msig = (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
+    //  call = (Ljava/lang/String;)Ljava/util/function/Predicate;
+    //
+    (*declared_signature_result) = call_site_sig;
+
   } else {
+    // We can just use the method's own signature.  It may differ from the call site, but not by much.
+    //
+    // Examples of how the call site signature can differ from the method's signature:
+    //
+    // meth = static final native jint java.lang.invoke.MethodHandle.linkToStatic(jobject, jobject, jint, jint, jobject)
+    // msig = (Ljava/lang/Object;Ljava/lang/Object;IILjava/lang/invoke/MemberName;)I
+    // call = (Ljava/lang/invoke/VarHandle;Ljava/lang/Object;IILjava/lang/invoke/MemberName;)Z
+    //
+    // meth = final native jint java.lang.invoke.MethodHandle.invokeBasic(jobject, jobject, jint, jint)
+    // msig = (Ljava/lang/Object;Ljava/lang/Object;II)I
+    // call = (Ljava/lang/invoke/VarHandle;Ljava/lang/Object;II)Z
+    //
     (*declared_signature_result) = m->signature();
   }
   return m;
@@ -372,27 +448,14 @@
 }
 
 // ------------------------------------------------------------------
-// ciBytecodeStream::has_method_type
+// ciBytecodeStream::has_local_signature
 //
-// Returns true if there is a MethodType argument stored in the
-// constant pool cache at the current bci.
-bool ciBytecodeStream::has_method_type() {
+// Returns true if the method stored in the constant
+// pool cache at the current bci has a local signature.
+bool ciBytecodeStream::has_local_signature() {
   GUARDED_VM_ENTRY(
     constantPoolHandle cpool(_method->get_Method()->constants());
-    return ConstantPool::has_method_type_at_if_loaded(cpool, get_method_index());
-  )
-}
-
-// ------------------------------------------------------------------
-// ciBytecodeStream::get_method_type
-//
-// Return the MethodType stored in the constant pool cache at
-// the current bci.
-ciMethodType* ciBytecodeStream::get_method_type() {
-  GUARDED_VM_ENTRY(
-    constantPoolHandle cpool(_method->get_Method()->constants());
-    oop method_type_oop = ConstantPool::method_type_at_if_loaded(cpool, get_method_index());
-    return CURRENT_ENV->get_object(method_type_oop)->as_method_type();
+    return ConstantPool::has_local_signature_at_if_loaded(cpool, get_method_index());
   )
 }
 
--- a/src/hotspot/share/ci/ciStreams.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/ci/ciStreams.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -245,8 +245,7 @@
   ciMethod*     get_method(bool& will_link, ciSignature* *declared_signature_result);
   bool          has_appendix();
   ciObject*     get_appendix();
-  bool          has_method_type();
-  ciMethodType* get_method_type();
+  bool          has_local_signature();
   ciKlass*      get_declared_method_holder();
   int           get_method_holder_index();
   int           get_method_signature_index(const constantPoolHandle& cpool);
--- a/src/hotspot/share/classfile/classFileParser.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -564,7 +564,7 @@
       }
       case JVM_CONSTANT_Dynamic: {
         const int name_and_type_ref_index =
-          cp->invoke_dynamic_name_and_type_ref_index_at(index);
+          cp->bootstrap_name_and_type_ref_index_at(index);
 
         check_property(valid_cp_range(name_and_type_ref_index, length) &&
           cp->tag_at(name_and_type_ref_index).is_name_and_type(),
@@ -579,7 +579,7 @@
       }
       case JVM_CONSTANT_InvokeDynamic: {
         const int name_and_type_ref_index =
-          cp->invoke_dynamic_name_and_type_ref_index_at(index);
+          cp->bootstrap_name_and_type_ref_index_at(index);
 
         check_property(valid_cp_range(name_and_type_ref_index, length) &&
           cp->tag_at(name_and_type_ref_index).is_name_and_type(),
@@ -4991,30 +4991,30 @@
 bool ClassFileParser::verify_unqualified_name(const char* name,
                                               unsigned int length,
                                               int type) {
-  for (const char* p = name; p != name + length;) {
-    jchar ch = *p;
-    if (ch < 128) {
-      if (ch == '.' || ch == ';' || ch == '[' ) {
-        return false;   // do not permit '.', ';', or '['
-      }
-      if (ch == '/') {
+  for (const char* p = name; p != name + length; p++) {
+    switch(*p) {
+      case '.':
+      case ';':
+      case '[':
+        // do not permit '.', ';', or '['
+        return false;
+      case '/':
         // check for '//' or leading or trailing '/' which are not legal
         // unqualified name must not be empty
         if (type == ClassFileParser::LegalClass) {
           if (p == name || p+1 >= name+length || *(p+1) == '/') {
-           return false;
+            return false;
           }
         } else {
           return false;   // do not permit '/' unless it's class name
         }
-      }
-      if (type == ClassFileParser::LegalMethod && (ch == '<' || ch == '>')) {
-        return false;   // do not permit '<' or '>' in method names
-      }
-      p++;
-    } else {
-      char* tmp_p = UTF8::next(p, &ch);
-      p = tmp_p;
+        break;
+      case '<':
+      case '>':
+        // do not permit '<' or '>' in method names
+        if (type == ClassFileParser::LegalMethod) {
+          return false;
+        }
     }
   }
   return true;
@@ -5026,7 +5026,7 @@
 // Return NULL if no fieldname at all was found, or in the case of slash_ok
 // being true, we saw consecutive slashes (meaning we were looking for a
 // qualified path but found something that was badly-formed).
-static const char* skip_over_field_name(const char* name,
+static const char* skip_over_field_name(const char* const name,
                                         bool slash_ok,
                                         unsigned int length) {
   const char* p;
@@ -5062,29 +5062,12 @@
       // Check if ch is Java identifier start or is Java identifier part
       // 4672820: call java.lang.Character methods directly without generating separate tables.
       EXCEPTION_MARK;
-
       // return value
       JavaValue result(T_BOOLEAN);
-      // Set up the arguments to isJavaIdentifierStart and isJavaIdentifierPart
+      // Set up the arguments to isJavaIdentifierStart or isJavaIdentifierPart
       JavaCallArguments args;
       args.push_int(unicode_ch);
 
-      // public static boolean isJavaIdentifierStart(char ch);
-      JavaCalls::call_static(&result,
-        SystemDictionary::Character_klass(),
-        vmSymbols::isJavaIdentifierStart_name(),
-        vmSymbols::int_bool_signature(),
-        &args,
-        THREAD);
-
-      if (HAS_PENDING_EXCEPTION) {
-        CLEAR_PENDING_EXCEPTION;
-        return 0;
-      }
-      if (result.get_jboolean()) {
-        continue;
-      }
-
       if (not_first_ch) {
         // public static boolean isJavaIdentifierPart(char ch);
         JavaCalls::call_static(&result,
@@ -5093,15 +5076,21 @@
           vmSymbols::int_bool_signature(),
           &args,
           THREAD);
-
-        if (HAS_PENDING_EXCEPTION) {
-          CLEAR_PENDING_EXCEPTION;
-          return 0;
-        }
-
-        if (result.get_jboolean()) {
-          continue;
-        }
+      } else {
+        // public static boolean isJavaIdentifierStart(char ch);
+        JavaCalls::call_static(&result,
+          SystemDictionary::Character_klass(),
+          vmSymbols::isJavaIdentifierStart_name(),
+          vmSymbols::int_bool_signature(),
+          &args,
+          THREAD);
+      }
+      if (HAS_PENDING_EXCEPTION) {
+        CLEAR_PENDING_EXCEPTION;
+        return NULL;
+      }
+      if(result.get_jboolean()) {
+        continue;
       }
     }
     return (not_first_ch) ? old_p : NULL;
@@ -5142,18 +5131,12 @@
       }
       else {
         // Skip leading 'L' and ignore first appearance of ';'
-        length--;
         signature++;
         char* c = strchr((char*) signature, ';');
         // Format check signature
         if (c != NULL) {
-          ResourceMark rm(THREAD);
           int newlen = c - (char*) signature;
-          char* sig = NEW_RESOURCE_ARRAY(char, newlen + 1);
-          strncpy(sig, signature, newlen);
-          sig[newlen] = '\0';
-
-          bool legal = verify_unqualified_name(sig, newlen, LegalClass);
+          bool legal = verify_unqualified_name(signature, newlen, LegalClass);
           if (!legal) {
             classfile_parse_error("Class name contains illegal character "
                                   "in descriptor in class file %s",
@@ -5187,8 +5170,8 @@
 void ClassFileParser::verify_legal_class_name(const Symbol* name, TRAPS) const {
   if (!_need_verify || _relax_verify) { return; }
 
-  char buf[fixed_buffer_size];
-  char* bytes = name->as_utf8_flexible_buffer(THREAD, buf, fixed_buffer_size);
+  assert(name->refcount() > 0, "symbol must be kept alive");
+  char* bytes = (char*)name->bytes();
   unsigned int length = name->utf8_length();
   bool legal = false;
 
@@ -5227,8 +5210,7 @@
 void ClassFileParser::verify_legal_field_name(const Symbol* name, TRAPS) const {
   if (!_need_verify || _relax_verify) { return; }
 
-  char buf[fixed_buffer_size];
-  char* bytes = name->as_utf8_flexible_buffer(THREAD, buf, fixed_buffer_size);
+  char* bytes = (char*)name->bytes();
   unsigned int length = name->utf8_length();
   bool legal = false;
 
@@ -5262,8 +5244,7 @@
   if (!_need_verify || _relax_verify) { return; }
 
   assert(name != NULL, "method name is null");
-  char buf[fixed_buffer_size];
-  char* bytes = name->as_utf8_flexible_buffer(THREAD, buf, fixed_buffer_size);
+  char* bytes = (char*)name->bytes();
   unsigned int length = name->utf8_length();
   bool legal = false;
 
@@ -5302,8 +5283,7 @@
                                                    TRAPS) const {
   if (!_need_verify) { return; }
 
-  char buf[fixed_buffer_size];
-  const char* const bytes = signature->as_utf8_flexible_buffer(THREAD, buf, fixed_buffer_size);
+  const char* const bytes = (const char* const)signature->bytes();
   const unsigned int length = signature->utf8_length();
   const char* const p = skip_over_field_signature(bytes, false, length, CHECK);
 
@@ -5332,8 +5312,7 @@
   }
 
   unsigned int args_size = 0;
-  char buf[fixed_buffer_size];
-  const char* p = signature->as_utf8_flexible_buffer(THREAD, buf, fixed_buffer_size);
+  const char* p = (const char*)signature->bytes();
   unsigned int length = signature->utf8_length();
   const char* nextp;
 
@@ -5741,9 +5720,8 @@
 
 void ClassFileParser::update_class_name(Symbol* new_class_name) {
   // Decrement the refcount in the old name, since we're clobbering it.
-  if (_class_name != NULL) {
-    _class_name->decrement_refcount();
-  }
+  _class_name->decrement_refcount();
+
   _class_name = new_class_name;
   // Increment the refcount of the new name.
   // Now the ClassFileParser owns this name and will decrement in
@@ -5774,11 +5752,16 @@
     // characters.  So, do a strncpy instead of using sprintf("%s...").
     strncpy(new_anon_name + host_pkg_len + 1, (char *)_class_name->base(), class_name_len);
 
+    // Decrement old _class_name to avoid leaking.
+    _class_name->decrement_refcount();
+
     // Create a symbol and update the anonymous class name.
-    Symbol* new_name = SymbolTable::new_symbol(new_anon_name,
+    // The new class name is created with a refcount of one. When installed into the InstanceKlass,
+    // it'll be two and when the ClassFileParser destructor runs, it'll go back to one and get deleted
+    // when the class is unloaded.
+    _class_name = SymbolTable::new_symbol(new_anon_name,
                                           (int)host_pkg_len + 1 + class_name_len,
                                           CHECK);
-    update_class_name(new_name);
   }
 }
 
@@ -5882,7 +5865,8 @@
   _has_vanilla_constructor(false),
   _max_bootstrap_specifier_index(-1) {
 
-  update_class_name(name != NULL ? name : vmSymbols::unknown_class_name());
+  _class_name = name != NULL ? name : vmSymbols::unknown_class_name();
+  _class_name->increment_refcount();
 
   assert(THREAD->is_Java_thread(), "invariant");
   assert(_loader_data != NULL, "invariant");
@@ -6107,8 +6091,7 @@
   Symbol* const class_name_in_cp = cp->klass_name_at(_this_class_index);
   assert(class_name_in_cp != NULL, "class_name can't be null");
 
-  // Update _class_name which could be null previously
-  // to reflect the name in the constant pool
+  // Update _class_name to reflect the name in the constant pool
   update_class_name(class_name_in_cp);
 
   // Don't need to check whether this class name is legal or not.
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -2459,7 +2459,6 @@
                                                           Symbol* signature,
                                                           Klass* accessing_klass,
                                                           Handle *appendix_result,
-                                                          Handle *method_type_result,
                                                           TRAPS) {
   methodHandle empty;
   assert(THREAD->can_call_java() ,"");
@@ -2492,7 +2491,6 @@
                          vmSymbols::linkMethod_signature(),
                          &args, CHECK_(empty));
   Handle mname(THREAD, (oop) result.get_jobject());
-  (*method_type_result) = method_type;
   return unpack_method_and_appendix(mname, accessing_klass, appendix_box, appendix_result, THREAD);
 }
 
@@ -2811,7 +2809,6 @@
                                                               Symbol* name,
                                                               Symbol* type,
                                                               Handle *appendix_result,
-                                                              Handle *method_type_result,
                                                               TRAPS) {
   methodHandle empty;
   Handle bsm, info;
@@ -2853,7 +2850,6 @@
                          vmSymbols::linkCallSite_signature(),
                          &args, CHECK_(empty));
   Handle mname(THREAD, (oop) result.get_jobject());
-  (*method_type_result) = method_type;
   return unpack_method_and_appendix(mname, caller, appendix_box, appendix_result, THREAD);
 }
 
--- a/src/hotspot/share/classfile/systemDictionary.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -481,7 +481,6 @@
                                                  Symbol* signature,
                                                  Klass* accessing_klass,
                                                  Handle *appendix_result,
-                                                 Handle *method_type_result,
                                                  TRAPS);
   // for a given signature, find the internal MethodHandle method (linkTo* or invokeBasic)
   // (does not ask Java, since this is a low-level intrinsic defined by the JVM)
@@ -544,7 +543,6 @@
                                                      Symbol* name,
                                                      Symbol* type,
                                                      Handle *appendix_result,
-                                                     Handle *method_type_result,
                                                      TRAPS);
 
   // Record the error when the first attempt to resolve a reference from a constant
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -636,8 +636,8 @@
   }
 
   NOT_PRODUCT(_overflow_counter = CMSMarkStackOverflowInterval;)
-  _gc_counters = new CollectorCounters("CMS", 1);
-  _cgc_counters = new CollectorCounters("CMS stop-the-world phases", 2);
+  _gc_counters = new CollectorCounters("CMS full collection pauses", 1);
+  _cgc_counters = new CollectorCounters("CMS concurrent cycle pauses", 2);
   _completed_initialization = true;
   _inter_sweep_timer.start();  // start of time
 }
--- a/src/hotspot/share/gc/cms/parNewGeneration.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/cms/parNewGeneration.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -624,7 +624,7 @@
 }
 
 ParNewGeneration::ParNewGeneration(ReservedSpace rs, size_t initial_byte_size)
-  : DefNewGeneration(rs, initial_byte_size, "PCopy"),
+  : DefNewGeneration(rs, initial_byte_size, "CMS young collection pauses"),
   _plab_stats("Young", YoungPLABSize, PLABWeight),
   _overflow_list(NULL),
   _is_alive_closure(this)
--- a/src/hotspot/share/gc/g1/dirtyCardQueue.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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/g1/dirtyCardQueue.hpp"
-#include "gc/g1/g1CollectedHeap.inline.hpp"
-#include "gc/g1/g1FreeIdSet.hpp"
-#include "gc/g1/g1RemSet.hpp"
-#include "gc/g1/g1ThreadLocalData.hpp"
-#include "gc/g1/heapRegionRemSet.hpp"
-#include "gc/shared/suspendibleThreadSet.hpp"
-#include "gc/shared/workgroup.hpp"
-#include "runtime/atomic.hpp"
-#include "runtime/flags/flagSetting.hpp"
-#include "runtime/mutexLocker.hpp"
-#include "runtime/safepoint.hpp"
-#include "runtime/thread.inline.hpp"
-#include "runtime/threadSMR.hpp"
-
-// Closure used for updating remembered sets and recording references that
-// point into the collection set while the mutator is running.
-// Assumed to be only executed concurrently with the mutator. Yields via
-// SuspendibleThreadSet after every card.
-class G1RefineCardConcurrentlyClosure: public CardTableEntryClosure {
-public:
-  bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
-    G1CollectedHeap::heap()->g1_rem_set()->refine_card_concurrently(card_ptr, worker_i);
-
-    if (SuspendibleThreadSet::should_yield()) {
-      // Caller will actually yield.
-      return false;
-    }
-    // Otherwise, we finished successfully; return true.
-    return true;
-  }
-};
-
-DirtyCardQueue::DirtyCardQueue(DirtyCardQueueSet* qset, bool permanent) :
-  // Dirty card queues are always active, so we create them with their
-  // active field set to true.
-  PtrQueue(qset, permanent, true /* active */)
-{ }
-
-DirtyCardQueue::~DirtyCardQueue() {
-  if (!is_permanent()) {
-    flush();
-  }
-}
-
-DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) :
-  PtrQueueSet(notify_when_complete),
-  _shared_dirty_card_queue(this, true /* permanent */),
-  _free_ids(NULL),
-  _processed_buffers_mut(0),
-  _processed_buffers_rs_thread(0),
-  _cur_par_buffer_node(NULL)
-{
-  _all_active = true;
-}
-
-DirtyCardQueueSet::~DirtyCardQueueSet() {
-  delete _free_ids;
-}
-
-// Determines how many mutator threads can process the buffers in parallel.
-uint DirtyCardQueueSet::num_par_ids() {
-  return (uint)os::initial_active_processor_count();
-}
-
-void DirtyCardQueueSet::initialize(Monitor* cbl_mon,
-                                   BufferNode::Allocator* allocator,
-                                   Mutex* lock,
-                                   bool init_free_ids) {
-  PtrQueueSet::initialize(cbl_mon, allocator);
-  _shared_dirty_card_queue.set_lock(lock);
-  if (init_free_ids) {
-    _free_ids = new G1FreeIdSet(0, num_par_ids());
-  }
-}
-
-void DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) {
-  G1ThreadLocalData::dirty_card_queue(t).handle_zero_index();
-}
-
-bool DirtyCardQueueSet::apply_closure_to_buffer(CardTableEntryClosure* cl,
-                                                BufferNode* node,
-                                                bool consume,
-                                                uint worker_i) {
-  if (cl == NULL) return true;
-  bool result = true;
-  void** buf = BufferNode::make_buffer_from_node(node);
-  size_t i = node->index();
-  size_t limit = buffer_size();
-  for ( ; i < limit; ++i) {
-    jbyte* card_ptr = static_cast<jbyte*>(buf[i]);
-    assert(card_ptr != NULL, "invariant");
-    if (!cl->do_card_ptr(card_ptr, worker_i)) {
-      result = false;           // Incomplete processing.
-      break;
-    }
-  }
-  if (consume) {
-    assert(i <= buffer_size(), "invariant");
-    node->set_index(i);
-  }
-  return result;
-}
-
-#ifndef ASSERT
-#define assert_fully_consumed(node, buffer_size)
-#else
-#define assert_fully_consumed(node, buffer_size)                \
-  do {                                                          \
-    size_t _afc_index = (node)->index();                        \
-    size_t _afc_size = (buffer_size);                           \
-    assert(_afc_index == _afc_size,                             \
-           "Buffer was not fully consumed as claimed: index: "  \
-           SIZE_FORMAT ", size: " SIZE_FORMAT,                  \
-            _afc_index, _afc_size);                             \
-  } while (0)
-#endif // ASSERT
-
-bool DirtyCardQueueSet::mut_process_buffer(BufferNode* node) {
-  guarantee(_free_ids != NULL, "must be");
-
-  uint worker_i = _free_ids->claim_par_id(); // temporarily claim an id
-  G1RefineCardConcurrentlyClosure cl;
-  bool result = apply_closure_to_buffer(&cl, node, true, worker_i);
-  _free_ids->release_par_id(worker_i); // release the id
-
-  if (result) {
-    assert_fully_consumed(node, buffer_size());
-    Atomic::inc(&_processed_buffers_mut);
-  }
-  return result;
-}
-
-bool DirtyCardQueueSet::refine_completed_buffer_concurrently(uint worker_i, size_t stop_at) {
-  G1RefineCardConcurrentlyClosure cl;
-  return apply_closure_to_completed_buffer(&cl, worker_i, stop_at, false);
-}
-
-bool DirtyCardQueueSet::apply_closure_during_gc(CardTableEntryClosure* cl, uint worker_i) {
-  assert_at_safepoint();
-  return apply_closure_to_completed_buffer(cl, worker_i, 0, true);
-}
-
-bool DirtyCardQueueSet::apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
-                                                          uint worker_i,
-                                                          size_t stop_at,
-                                                          bool during_pause) {
-  assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause");
-  BufferNode* nd = get_completed_buffer(stop_at);
-  if (nd == NULL) {
-    return false;
-  } else {
-    if (apply_closure_to_buffer(cl, nd, true, worker_i)) {
-      assert_fully_consumed(nd, buffer_size());
-      // Done with fully processed buffer.
-      deallocate_buffer(nd);
-      Atomic::inc(&_processed_buffers_rs_thread);
-    } else {
-      // Return partially processed buffer to the queue.
-      guarantee(!during_pause, "Should never stop early");
-      enqueue_completed_buffer(nd);
-    }
-    return true;
-  }
-}
-
-void DirtyCardQueueSet::par_apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl) {
-  BufferNode* nd = _cur_par_buffer_node;
-  while (nd != NULL) {
-    BufferNode* next = nd->next();
-    BufferNode* actual = Atomic::cmpxchg(next, &_cur_par_buffer_node, nd);
-    if (actual == nd) {
-      bool b = apply_closure_to_buffer(cl, nd, false);
-      guarantee(b, "Should not stop early.");
-      nd = next;
-    } else {
-      nd = actual;
-    }
-  }
-}
-
-void DirtyCardQueueSet::abandon_logs() {
-  assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
-  abandon_completed_buffers();
-  // Since abandon is done only at safepoints, we can safely manipulate
-  // these queues.
-  for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
-    G1ThreadLocalData::dirty_card_queue(t).reset();
-  }
-  shared_dirty_card_queue()->reset();
-}
-
-void DirtyCardQueueSet::concatenate_log(DirtyCardQueue& dcq) {
-  if (!dcq.is_empty()) {
-    dcq.flush();
-  }
-}
-
-void DirtyCardQueueSet::concatenate_logs() {
-  // Iterate over all the threads, if we find a partial log add it to
-  // the global list of logs.  Temporarily turn off the limit on the number
-  // of outstanding buffers.
-  assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
-  size_t old_limit = max_completed_buffers();
-  set_max_completed_buffers(MaxCompletedBuffersUnlimited);
-  for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
-    concatenate_log(G1ThreadLocalData::dirty_card_queue(t));
-  }
-  concatenate_log(_shared_dirty_card_queue);
-  set_max_completed_buffers(old_limit);
-}
--- a/src/hotspot/share/gc/g1/dirtyCardQueue.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-/*
- * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_GC_G1_DIRTYCARDQUEUE_HPP
-#define SHARE_GC_G1_DIRTYCARDQUEUE_HPP
-
-#include "gc/shared/ptrQueue.hpp"
-#include "memory/allocation.hpp"
-
-class DirtyCardQueueSet;
-class G1FreeIdSet;
-class JavaThread;
-class Monitor;
-
-// A closure class for processing card table entries.  Note that we don't
-// require these closure objects to be stack-allocated.
-class CardTableEntryClosure: public CHeapObj<mtGC> {
-public:
-  // Process the card whose card table entry is "card_ptr".  If returns
-  // "false", terminate the iteration early.
-  virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i) = 0;
-};
-
-// A ptrQueue whose elements are "oops", pointers to object heads.
-class DirtyCardQueue: public PtrQueue {
-public:
-  DirtyCardQueue(DirtyCardQueueSet* qset, bool permanent = false);
-
-  // Flush before destroying; queue may be used to capture pending work while
-  // doing something else, with auto-flush on completion.
-  ~DirtyCardQueue();
-
-  // Process queue entries and release resources.
-  void flush() { flush_impl(); }
-
-  // Compiler support.
-  static ByteSize byte_offset_of_index() {
-    return PtrQueue::byte_offset_of_index<DirtyCardQueue>();
-  }
-  using PtrQueue::byte_width_of_index;
-
-  static ByteSize byte_offset_of_buf() {
-    return PtrQueue::byte_offset_of_buf<DirtyCardQueue>();
-  }
-  using PtrQueue::byte_width_of_buf;
-
-};
-
-
-
-class DirtyCardQueueSet: public PtrQueueSet {
-  DirtyCardQueue _shared_dirty_card_queue;
-
-  // Apply the closure to the elements of "node" from it's index to
-  // buffer_size.  If all closure applications return true, then
-  // returns true.  Stops processing after the first closure
-  // application that returns false, and returns false from this
-  // function.  If "consume" is true, the node's index is updated to
-  // exclude the processed elements, e.g. up to the element for which
-  // the closure returned false.
-  bool apply_closure_to_buffer(CardTableEntryClosure* cl,
-                               BufferNode* node,
-                               bool consume,
-                               uint worker_i = 0);
-
-  // If there are more than stop_at completed buffers, pop one, apply
-  // the specified closure to its active elements, and return true.
-  // Otherwise return false.
-  //
-  // A completely processed buffer is freed.  However, if a closure
-  // invocation returns false, processing is stopped and the partially
-  // processed buffer (with its index updated to exclude the processed
-  // elements, e.g. up to the element for which the closure returned
-  // false) is returned to the completed buffer set.
-  //
-  // If during_pause is true, stop_at must be zero, and the closure
-  // must never return false.
-  bool apply_closure_to_completed_buffer(CardTableEntryClosure* cl,
-                                         uint worker_i,
-                                         size_t stop_at,
-                                         bool during_pause);
-
-  bool mut_process_buffer(BufferNode* node);
-
-  G1FreeIdSet* _free_ids;
-
-  // The number of completed buffers processed by mutator and rs thread,
-  // respectively.
-  jint _processed_buffers_mut;
-  jint _processed_buffers_rs_thread;
-
-  // Current buffer node used for parallel iteration.
-  BufferNode* volatile _cur_par_buffer_node;
-
-  void concatenate_log(DirtyCardQueue& dcq);
-
-public:
-  DirtyCardQueueSet(bool notify_when_complete = true);
-  ~DirtyCardQueueSet();
-
-  void initialize(Monitor* cbl_mon,
-                  BufferNode::Allocator* allocator,
-                  Mutex* lock,
-                  bool init_free_ids = false);
-
-  // The number of parallel ids that can be claimed to allow collector or
-  // mutator threads to do card-processing work.
-  static uint num_par_ids();
-
-  static void handle_zero_index_for_thread(JavaThread* t);
-
-  // Apply G1RefineCardConcurrentlyClosure to completed buffers until there are stop_at
-  // completed buffers remaining.
-  bool refine_completed_buffer_concurrently(uint worker_i, size_t stop_at);
-
-  // Apply the given closure to all completed buffers. The given closure's do_card_ptr
-  // must never return false. Must only be called during GC.
-  bool apply_closure_during_gc(CardTableEntryClosure* cl, uint worker_i);
-
-  void reset_for_par_iteration() { _cur_par_buffer_node = completed_buffers_head(); }
-  // Applies the current closure to all completed buffers, non-consumptively.
-  // Can be used in parallel, all callers using the iteration state initialized
-  // by reset_for_par_iteration.
-  void par_apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl);
-
-  DirtyCardQueue* shared_dirty_card_queue() {
-    return &_shared_dirty_card_queue;
-  }
-
-  // If a full collection is happening, reset partial logs, and ignore
-  // completed ones: the full collection will make them all irrelevant.
-  void abandon_logs();
-
-  // If any threads have partial logs, add them to the global list of logs.
-  void concatenate_logs();
-
-  jint processed_buffers_mut() {
-    return _processed_buffers_mut;
-  }
-  jint processed_buffers_rs_thread() {
-    return _processed_buffers_rs_thread;
-  }
-
-};
-
-#endif // SHARE_GC_G1_DIRTYCARDQUEUE_HPP
--- a/src/hotspot/share/gc/g1/g1BarrierSet.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1BarrierSet.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -25,11 +25,10 @@
 #ifndef SHARE_GC_G1_G1BARRIERSET_HPP
 #define SHARE_GC_G1_G1BARRIERSET_HPP
 
-#include "gc/g1/dirtyCardQueue.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1SATBMarkQueueSet.hpp"
 #include "gc/shared/cardTableBarrierSet.hpp"
 
-class DirtyCardQueueSet;
 class CardTable;
 class G1CardTable;
 
@@ -42,7 +41,7 @@
   BufferNode::Allocator _satb_mark_queue_buffer_allocator;
   BufferNode::Allocator _dirty_card_queue_buffer_allocator;
   G1SATBMarkQueueSet _satb_mark_queue_set;
-  DirtyCardQueueSet _dirty_card_queue_set;
+  G1DirtyCardQueueSet _dirty_card_queue_set;
 
   static G1BarrierSet* g1_barrier_set() {
     return barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
@@ -88,7 +87,7 @@
     return g1_barrier_set()->_satb_mark_queue_set;
   }
 
-  static DirtyCardQueueSet& dirty_card_queue_set() {
+  static G1DirtyCardQueueSet& dirty_card_queue_set() {
     return g1_barrier_set()->_dirty_card_queue_set;
   }
 
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -37,6 +37,7 @@
 #include "gc/g1/g1ConcurrentRefine.hpp"
 #include "gc/g1/g1ConcurrentRefineThread.hpp"
 #include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1EvacStats.inline.hpp"
 #include "gc/g1/g1FullCollector.hpp"
 #include "gc/g1/g1GCPhaseTimes.hpp"
@@ -107,7 +108,7 @@
 // apply to TLAB allocation, which is not part of this interface: it
 // is done by clients of this interface.)
 
-class RedirtyLoggedCardTableEntryClosure : public CardTableEntryClosure {
+class RedirtyLoggedCardTableEntryClosure : public G1CardTableEntryClosure {
  private:
   size_t _num_dirtied;
   G1CollectedHeap* _g1h;
@@ -124,7 +125,7 @@
   }
 
  public:
-  RedirtyLoggedCardTableEntryClosure(G1CollectedHeap* g1h) : CardTableEntryClosure(),
+  RedirtyLoggedCardTableEntryClosure(G1CollectedHeap* g1h) : G1CardTableEntryClosure(),
     _num_dirtied(0), _g1h(g1h), _g1_ct(g1h->card_table()) { }
 
   bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
@@ -1811,7 +1812,7 @@
   }
 
   {
-    DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+    G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
     dcqs.set_process_completed_buffers_threshold(concurrent_refine()->yellow_zone());
     dcqs.set_max_completed_buffers(concurrent_refine()->red_zone());
   }
@@ -1954,12 +1955,12 @@
   return _hrm->total_free_bytes();
 }
 
-void G1CollectedHeap::iterate_hcc_closure(CardTableEntryClosure* cl, uint worker_i) {
+void G1CollectedHeap::iterate_hcc_closure(G1CardTableEntryClosure* cl, uint worker_i) {
   _hot_card_cache->drain(cl, worker_i);
 }
 
-void G1CollectedHeap::iterate_dirty_card_closure(CardTableEntryClosure* cl, uint worker_i) {
-  DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+void G1CollectedHeap::iterate_dirty_card_closure(G1CardTableEntryClosure* cl, uint worker_i) {
+  G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
   size_t n_completed_buffers = 0;
   while (dcqs.apply_closure_during_gc(cl, worker_i)) {
     n_completed_buffers++;
@@ -2605,10 +2606,10 @@
 size_t G1CollectedHeap::pending_card_num() {
   size_t extra_cards = 0;
   for (JavaThreadIteratorWithHandle jtiwh; JavaThread *curr = jtiwh.next(); ) {
-    DirtyCardQueue& dcq = G1ThreadLocalData::dirty_card_queue(curr);
+    G1DirtyCardQueue& dcq = G1ThreadLocalData::dirty_card_queue(curr);
     extra_cards += dcq.size();
   }
-  DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+  G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
   size_t buffer_size = dcqs.buffer_size();
   size_t buffer_num = dcqs.completed_buffers_num();
 
@@ -2630,7 +2631,7 @@
   size_t _total_humongous;
   size_t _candidate_humongous;
 
-  DirtyCardQueue _dcq;
+  G1DirtyCardQueue _dcq;
 
   bool humongous_region_is_candidate(G1CollectedHeap* g1h, HeapRegion* region) const {
     assert(region->is_starts_humongous(), "Must start a humongous object");
@@ -3410,10 +3411,10 @@
 
 class G1RedirtyLoggedCardsTask : public AbstractGangTask {
  private:
-  DirtyCardQueueSet* _queue;
+  G1DirtyCardQueueSet* _queue;
   G1CollectedHeap* _g1h;
  public:
-  G1RedirtyLoggedCardsTask(DirtyCardQueueSet* queue, G1CollectedHeap* g1h) : AbstractGangTask("Redirty Cards"),
+  G1RedirtyLoggedCardsTask(G1DirtyCardQueueSet* queue, G1CollectedHeap* g1h) : AbstractGangTask("Redirty Cards"),
     _queue(queue), _g1h(g1h) { }
 
   virtual void work(uint worker_id) {
@@ -3434,7 +3435,7 @@
   dirty_card_queue_set().reset_for_par_iteration();
   workers()->run_task(&redirty_task);
 
-  DirtyCardQueueSet& dcq = G1BarrierSet::dirty_card_queue_set();
+  G1DirtyCardQueueSet& dcq = G1BarrierSet::dirty_card_queue_set();
   dcq.merge_bufferlists(&dirty_card_queue_set());
   assert(dirty_card_queue_set().completed_buffers_num() == 0, "All should be consumed");
 
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -31,6 +31,7 @@
 #include "gc/g1/g1CollectionSet.hpp"
 #include "gc/g1/g1CollectorState.hpp"
 #include "gc/g1/g1ConcurrentMark.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1EdenRegions.hpp"
 #include "gc/g1/g1EvacFailure.hpp"
 #include "gc/g1/g1EvacStats.hpp"
@@ -758,7 +759,7 @@
 
   // A set of cards that cover the objects for which the Rsets should be updated
   // concurrently after the collection.
-  DirtyCardQueueSet _dirty_card_queue_set;
+  G1DirtyCardQueueSet _dirty_card_queue_set;
 
   // After a collection pause, convert the regions in the collection set into free
   // regions.
@@ -918,7 +919,7 @@
   uint num_task_queues() const;
 
   // A set of cards where updates happened during the GC
-  DirtyCardQueueSet& dirty_card_queue_set() { return _dirty_card_queue_set; }
+  G1DirtyCardQueueSet& dirty_card_queue_set() { return _dirty_card_queue_set; }
 
   // Create a G1CollectedHeap with the specified policy.
   // Must call the initialize method afterwards.
@@ -983,10 +984,10 @@
   void scrub_rem_set();
 
   // Apply the given closure on all cards in the Hot Card Cache, emptying it.
-  void iterate_hcc_closure(CardTableEntryClosure* cl, uint worker_i);
+  void iterate_hcc_closure(G1CardTableEntryClosure* cl, uint worker_i);
 
   // Apply the given closure on all cards in the Dirty Card Queue Set, emptying it.
-  void iterate_dirty_card_closure(CardTableEntryClosure* cl, uint worker_i);
+  void iterate_dirty_card_closure(G1CardTableEntryClosure* cl, uint worker_i);
 
   // The shared block offset table array.
   G1BlockOffsetTable* bot() const { return _bot; }
--- a/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1CollectionSetChooser.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -87,7 +87,7 @@
     uint volatile _cur_claim_idx;
 
     // Calculates the maximum array size that will be used.
-    static uint required_array_size(uint num_regions, uint num_workers, uint chunk_size) {
+    static uint required_array_size(uint num_regions, uint chunk_size, uint num_workers) {
       uint const max_waste = num_workers * chunk_size;
       // The array should be aligned with respect to chunk_size.
       uint const aligned_num_regions = ((num_regions + chunk_size - 1) / chunk_size) * chunk_size;
@@ -96,8 +96,8 @@
     }
 
   public:
-    G1BuildCandidateArray(uint max_num_regions, uint num_workers, uint chunk_size) :
-      _max_size(required_array_size(max_num_regions, num_workers, chunk_size)),
+    G1BuildCandidateArray(uint max_num_regions, uint chunk_size, uint num_workers) :
+      _max_size(required_array_size(max_num_regions, chunk_size, num_workers)),
       _chunk_size(chunk_size),
       _data(NEW_C_HEAP_ARRAY(HeapRegion*, _max_size, mtGC)),
       _cur_claim_idx(0) {
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -30,6 +30,7 @@
 #include "gc/g1/g1CollectorState.hpp"
 #include "gc/g1/g1ConcurrentMark.inline.hpp"
 #include "gc/g1/g1ConcurrentMarkThread.inline.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1HeapVerifier.hpp"
 #include "gc/g1/g1OopClosures.inline.hpp"
 #include "gc/g1/g1Policy.hpp"
@@ -372,7 +373,7 @@
 
   // _finger set in set_non_marking_state
 
-  _worker_id_offset(DirtyCardQueueSet::num_par_ids() + G1ConcRefinementThreads),
+  _worker_id_offset(G1DirtyCardQueueSet::num_par_ids() + G1ConcRefinementThreads),
   _max_num_tasks(ParallelGCThreads),
   // _num_active_tasks set in set_non_marking_state()
   // _tasks set inside the constructor
--- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 #include "gc/g1/g1BarrierSet.hpp"
 #include "gc/g1/g1ConcurrentRefine.hpp"
 #include "gc/g1/g1ConcurrentRefineThread.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "runtime/java.hpp"
@@ -378,7 +379,7 @@
 void G1ConcurrentRefine::adjust(double update_rs_time,
                                 size_t update_rs_processed_buffers,
                                 double goal_ms) {
-  DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+  G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
 
   if (G1UseAdaptiveConcRefinement) {
     update_zones(update_rs_time, update_rs_processed_buffers, goal_ms);
@@ -386,7 +387,7 @@
     // Change the barrier params
     if (max_num_threads() == 0) {
       // Disable dcqs notification when there are no threads to notify.
-      dcqs.set_process_completed_buffers_threshold(DirtyCardQueueSet::ProcessCompletedBuffersThresholdNever);
+      dcqs.set_process_completed_buffers_threshold(G1DirtyCardQueueSet::ProcessCompletedBuffersThresholdNever);
     } else {
       // Worker 0 is the primary; wakeup is via dcqs notification.
       STATIC_ASSERT(max_yellow_zone <= INT_MAX);
@@ -417,7 +418,7 @@
 }
 
 uint G1ConcurrentRefine::worker_id_offset() {
-  return DirtyCardQueueSet::num_par_ids();
+  return G1DirtyCardQueueSet::num_par_ids();
 }
 
 void G1ConcurrentRefine::maybe_activate_more_threads(uint worker_id, size_t num_cur_buffers) {
@@ -427,7 +428,7 @@
 }
 
 bool G1ConcurrentRefine::do_refinement_step(uint worker_id) {
-  DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+  G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
 
   size_t curr_buffer_num = dcqs.completed_buffers_num();
   // If the number of the buffers falls down into the yellow zone,
--- a/src/hotspot/share/gc/g1/g1ConcurrentRefine.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentRefine.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -29,7 +29,6 @@
 #include "utilities/globalDefinitions.hpp"
 
 // Forward decl
-class CardTableEntryClosure;
 class G1ConcurrentRefine;
 class G1ConcurrentRefineThread;
 class outputStream;
--- a/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 #include "gc/g1/g1BarrierSet.hpp"
 #include "gc/g1/g1ConcurrentRefine.hpp"
 #include "gc/g1/g1ConcurrentRefineThread.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/shared/suspendibleThreadSet.hpp"
 #include "logging/log.hpp"
 #include "memory/resourceArea.hpp"
@@ -65,7 +66,7 @@
 }
 
 bool G1ConcurrentRefineThread::is_active() {
-  DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+  G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
   return is_primary() ? dcqs.process_completed_buffers() : _active;
 }
 
@@ -74,7 +75,7 @@
   if (!is_primary()) {
     set_active(true);
   } else {
-    DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+    G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
     dcqs.set_process_completed_buffers(true);
   }
   _monitor->notify();
@@ -85,7 +86,7 @@
   if (!is_primary()) {
     set_active(false);
   } else {
-    DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+    G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
     dcqs.set_process_completed_buffers(false);
   }
 }
--- a/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ConcurrentRefineThread.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -25,11 +25,9 @@
 #ifndef SHARE_GC_G1_G1CONCURRENTREFINETHREAD_HPP
 #define SHARE_GC_G1_G1CONCURRENTREFINETHREAD_HPP
 
-#include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/shared/concurrentGCThread.hpp"
 
 // Forward Decl.
-class CardTableEntryClosure;
 class G1ConcurrentRefine;
 
 // One or more G1 Concurrent Refinement Threads may be active if concurrent
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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/g1/g1CollectedHeap.inline.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
+#include "gc/g1/g1FreeIdSet.hpp"
+#include "gc/g1/g1RemSet.hpp"
+#include "gc/g1/g1ThreadLocalData.hpp"
+#include "gc/g1/heapRegionRemSet.hpp"
+#include "gc/shared/suspendibleThreadSet.hpp"
+#include "gc/shared/workgroup.hpp"
+#include "runtime/atomic.hpp"
+#include "runtime/flags/flagSetting.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/safepoint.hpp"
+#include "runtime/thread.inline.hpp"
+#include "runtime/threadSMR.hpp"
+
+// Closure used for updating remembered sets and recording references that
+// point into the collection set while the mutator is running.
+// Assumed to be only executed concurrently with the mutator. Yields via
+// SuspendibleThreadSet after every card.
+class G1RefineCardConcurrentlyClosure: public G1CardTableEntryClosure {
+public:
+  bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
+    G1CollectedHeap::heap()->g1_rem_set()->refine_card_concurrently(card_ptr, worker_i);
+
+    if (SuspendibleThreadSet::should_yield()) {
+      // Caller will actually yield.
+      return false;
+    }
+    // Otherwise, we finished successfully; return true.
+    return true;
+  }
+};
+
+G1DirtyCardQueue::G1DirtyCardQueue(G1DirtyCardQueueSet* qset, bool permanent) :
+  // Dirty card queues are always active, so we create them with their
+  // active field set to true.
+  PtrQueue(qset, permanent, true /* active */)
+{ }
+
+G1DirtyCardQueue::~G1DirtyCardQueue() {
+  if (!is_permanent()) {
+    flush();
+  }
+}
+
+G1DirtyCardQueueSet::G1DirtyCardQueueSet(bool notify_when_complete) :
+  PtrQueueSet(notify_when_complete),
+  _shared_dirty_card_queue(this, true /* permanent */),
+  _free_ids(NULL),
+  _processed_buffers_mut(0),
+  _processed_buffers_rs_thread(0),
+  _cur_par_buffer_node(NULL)
+{
+  _all_active = true;
+}
+
+G1DirtyCardQueueSet::~G1DirtyCardQueueSet() {
+  delete _free_ids;
+}
+
+// Determines how many mutator threads can process the buffers in parallel.
+uint G1DirtyCardQueueSet::num_par_ids() {
+  return (uint)os::initial_active_processor_count();
+}
+
+void G1DirtyCardQueueSet::initialize(Monitor* cbl_mon,
+                                     BufferNode::Allocator* allocator,
+                                     Mutex* lock,
+                                     bool init_free_ids) {
+  PtrQueueSet::initialize(cbl_mon, allocator);
+  _shared_dirty_card_queue.set_lock(lock);
+  if (init_free_ids) {
+    _free_ids = new G1FreeIdSet(0, num_par_ids());
+  }
+}
+
+void G1DirtyCardQueueSet::handle_zero_index_for_thread(JavaThread* t) {
+  G1ThreadLocalData::dirty_card_queue(t).handle_zero_index();
+}
+
+bool G1DirtyCardQueueSet::apply_closure_to_buffer(G1CardTableEntryClosure* cl,
+                                                  BufferNode* node,
+                                                  bool consume,
+                                                  uint worker_i) {
+  if (cl == NULL) return true;
+  bool result = true;
+  void** buf = BufferNode::make_buffer_from_node(node);
+  size_t i = node->index();
+  size_t limit = buffer_size();
+  for ( ; i < limit; ++i) {
+    jbyte* card_ptr = static_cast<jbyte*>(buf[i]);
+    assert(card_ptr != NULL, "invariant");
+    if (!cl->do_card_ptr(card_ptr, worker_i)) {
+      result = false;           // Incomplete processing.
+      break;
+    }
+  }
+  if (consume) {
+    assert(i <= buffer_size(), "invariant");
+    node->set_index(i);
+  }
+  return result;
+}
+
+#ifndef ASSERT
+#define assert_fully_consumed(node, buffer_size)
+#else
+#define assert_fully_consumed(node, buffer_size)                \
+  do {                                                          \
+    size_t _afc_index = (node)->index();                        \
+    size_t _afc_size = (buffer_size);                           \
+    assert(_afc_index == _afc_size,                             \
+           "Buffer was not fully consumed as claimed: index: "  \
+           SIZE_FORMAT ", size: " SIZE_FORMAT,                  \
+            _afc_index, _afc_size);                             \
+  } while (0)
+#endif // ASSERT
+
+bool G1DirtyCardQueueSet::mut_process_buffer(BufferNode* node) {
+  guarantee(_free_ids != NULL, "must be");
+
+  uint worker_i = _free_ids->claim_par_id(); // temporarily claim an id
+  G1RefineCardConcurrentlyClosure cl;
+  bool result = apply_closure_to_buffer(&cl, node, true, worker_i);
+  _free_ids->release_par_id(worker_i); // release the id
+
+  if (result) {
+    assert_fully_consumed(node, buffer_size());
+    Atomic::inc(&_processed_buffers_mut);
+  }
+  return result;
+}
+
+bool G1DirtyCardQueueSet::refine_completed_buffer_concurrently(uint worker_i, size_t stop_at) {
+  G1RefineCardConcurrentlyClosure cl;
+  return apply_closure_to_completed_buffer(&cl, worker_i, stop_at, false);
+}
+
+bool G1DirtyCardQueueSet::apply_closure_during_gc(G1CardTableEntryClosure* cl, uint worker_i) {
+  assert_at_safepoint();
+  return apply_closure_to_completed_buffer(cl, worker_i, 0, true);
+}
+
+bool G1DirtyCardQueueSet::apply_closure_to_completed_buffer(G1CardTableEntryClosure* cl,
+                                                            uint worker_i,
+                                                            size_t stop_at,
+                                                            bool during_pause) {
+  assert(!during_pause || stop_at == 0, "Should not leave any completed buffers during a pause");
+  BufferNode* nd = get_completed_buffer(stop_at);
+  if (nd == NULL) {
+    return false;
+  } else {
+    if (apply_closure_to_buffer(cl, nd, true, worker_i)) {
+      assert_fully_consumed(nd, buffer_size());
+      // Done with fully processed buffer.
+      deallocate_buffer(nd);
+      Atomic::inc(&_processed_buffers_rs_thread);
+    } else {
+      // Return partially processed buffer to the queue.
+      guarantee(!during_pause, "Should never stop early");
+      enqueue_completed_buffer(nd);
+    }
+    return true;
+  }
+}
+
+void G1DirtyCardQueueSet::par_apply_closure_to_all_completed_buffers(G1CardTableEntryClosure* cl) {
+  BufferNode* nd = _cur_par_buffer_node;
+  while (nd != NULL) {
+    BufferNode* next = nd->next();
+    BufferNode* actual = Atomic::cmpxchg(next, &_cur_par_buffer_node, nd);
+    if (actual == nd) {
+      bool b = apply_closure_to_buffer(cl, nd, false);
+      guarantee(b, "Should not stop early.");
+      nd = next;
+    } else {
+      nd = actual;
+    }
+  }
+}
+
+void G1DirtyCardQueueSet::abandon_logs() {
+  assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
+  abandon_completed_buffers();
+  // Since abandon is done only at safepoints, we can safely manipulate
+  // these queues.
+  for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
+    G1ThreadLocalData::dirty_card_queue(t).reset();
+  }
+  shared_dirty_card_queue()->reset();
+}
+
+void G1DirtyCardQueueSet::concatenate_log(G1DirtyCardQueue& dcq) {
+  if (!dcq.is_empty()) {
+    dcq.flush();
+  }
+}
+
+void G1DirtyCardQueueSet::concatenate_logs() {
+  // Iterate over all the threads, if we find a partial log add it to
+  // the global list of logs.  Temporarily turn off the limit on the number
+  // of outstanding buffers.
+  assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
+  size_t old_limit = max_completed_buffers();
+  set_max_completed_buffers(MaxCompletedBuffersUnlimited);
+  for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) {
+    concatenate_log(G1ThreadLocalData::dirty_card_queue(t));
+  }
+  concatenate_log(_shared_dirty_card_queue);
+  set_max_completed_buffers(old_limit);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
+#define SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
+
+#include "gc/shared/ptrQueue.hpp"
+#include "memory/allocation.hpp"
+
+class G1DirtyCardQueueSet;
+class G1FreeIdSet;
+class JavaThread;
+class Monitor;
+
+// A closure class for processing card table entries.  Note that we don't
+// require these closure objects to be stack-allocated.
+class G1CardTableEntryClosure: public CHeapObj<mtGC> {
+public:
+  // Process the card whose card table entry is "card_ptr".  If returns
+  // "false", terminate the iteration early.
+  virtual bool do_card_ptr(jbyte* card_ptr, uint worker_i) = 0;
+};
+
+// A ptrQueue whose elements are "oops", pointers to object heads.
+class G1DirtyCardQueue: public PtrQueue {
+public:
+  G1DirtyCardQueue(G1DirtyCardQueueSet* qset, bool permanent = false);
+
+  // Flush before destroying; queue may be used to capture pending work while
+  // doing something else, with auto-flush on completion.
+  ~G1DirtyCardQueue();
+
+  // Process queue entries and release resources.
+  void flush() { flush_impl(); }
+
+  // Compiler support.
+  static ByteSize byte_offset_of_index() {
+    return PtrQueue::byte_offset_of_index<G1DirtyCardQueue>();
+  }
+  using PtrQueue::byte_width_of_index;
+
+  static ByteSize byte_offset_of_buf() {
+    return PtrQueue::byte_offset_of_buf<G1DirtyCardQueue>();
+  }
+  using PtrQueue::byte_width_of_buf;
+
+};
+
+
+
+class G1DirtyCardQueueSet: public PtrQueueSet {
+  G1DirtyCardQueue _shared_dirty_card_queue;
+
+  // Apply the closure to the elements of "node" from it's index to
+  // buffer_size.  If all closure applications return true, then
+  // returns true.  Stops processing after the first closure
+  // application that returns false, and returns false from this
+  // function.  If "consume" is true, the node's index is updated to
+  // exclude the processed elements, e.g. up to the element for which
+  // the closure returned false.
+  bool apply_closure_to_buffer(G1CardTableEntryClosure* cl,
+                               BufferNode* node,
+                               bool consume,
+                               uint worker_i = 0);
+
+  // If there are more than stop_at completed buffers, pop one, apply
+  // the specified closure to its active elements, and return true.
+  // Otherwise return false.
+  //
+  // A completely processed buffer is freed.  However, if a closure
+  // invocation returns false, processing is stopped and the partially
+  // processed buffer (with its index updated to exclude the processed
+  // elements, e.g. up to the element for which the closure returned
+  // false) is returned to the completed buffer set.
+  //
+  // If during_pause is true, stop_at must be zero, and the closure
+  // must never return false.
+  bool apply_closure_to_completed_buffer(G1CardTableEntryClosure* cl,
+                                         uint worker_i,
+                                         size_t stop_at,
+                                         bool during_pause);
+
+  bool mut_process_buffer(BufferNode* node);
+
+  G1FreeIdSet* _free_ids;
+
+  // The number of completed buffers processed by mutator and rs thread,
+  // respectively.
+  jint _processed_buffers_mut;
+  jint _processed_buffers_rs_thread;
+
+  // Current buffer node used for parallel iteration.
+  BufferNode* volatile _cur_par_buffer_node;
+
+  void concatenate_log(G1DirtyCardQueue& dcq);
+
+public:
+  G1DirtyCardQueueSet(bool notify_when_complete = true);
+  ~G1DirtyCardQueueSet();
+
+  void initialize(Monitor* cbl_mon,
+                  BufferNode::Allocator* allocator,
+                  Mutex* lock,
+                  bool init_free_ids = false);
+
+  // The number of parallel ids that can be claimed to allow collector or
+  // mutator threads to do card-processing work.
+  static uint num_par_ids();
+
+  static void handle_zero_index_for_thread(JavaThread* t);
+
+  // Apply G1RefineCardConcurrentlyClosure to completed buffers until there are stop_at
+  // completed buffers remaining.
+  bool refine_completed_buffer_concurrently(uint worker_i, size_t stop_at);
+
+  // Apply the given closure to all completed buffers. The given closure's do_card_ptr
+  // must never return false. Must only be called during GC.
+  bool apply_closure_during_gc(G1CardTableEntryClosure* cl, uint worker_i);
+
+  void reset_for_par_iteration() { _cur_par_buffer_node = completed_buffers_head(); }
+  // Applies the current closure to all completed buffers, non-consumptively.
+  // Can be used in parallel, all callers using the iteration state initialized
+  // by reset_for_par_iteration.
+  void par_apply_closure_to_all_completed_buffers(G1CardTableEntryClosure* cl);
+
+  G1DirtyCardQueue* shared_dirty_card_queue() {
+    return &_shared_dirty_card_queue;
+  }
+
+  // If a full collection is happening, reset partial logs, and ignore
+  // completed ones: the full collection will make them all irrelevant.
+  void abandon_logs();
+
+  // If any threads have partial logs, add them to the global list of logs.
+  void concatenate_logs();
+
+  jint processed_buffers_mut() {
+    return _processed_buffers_mut;
+  }
+  jint processed_buffers_rs_thread() {
+    return _processed_buffers_rs_thread;
+  }
+
+};
+
+#endif // SHARE_GC_G1_G1DIRTYCARDQUEUE_HPP
--- a/src/hotspot/share/gc/g1/g1EvacFailure.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1EvacFailure.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,10 @@
  */
 
 #include "precompiled.hpp"
-#include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1CollectorState.hpp"
 #include "gc/g1/g1ConcurrentMark.inline.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1EvacFailure.hpp"
 #include "gc/g1/g1HeapVerifier.hpp"
 #include "gc/g1/g1OopClosures.inline.hpp"
@@ -41,11 +41,11 @@
 class UpdateRSetDeferred : public BasicOopIterateClosure {
 private:
   G1CollectedHeap* _g1h;
-  DirtyCardQueue* _dcq;
+  G1DirtyCardQueue* _dcq;
   G1CardTable*    _ct;
 
 public:
-  UpdateRSetDeferred(DirtyCardQueue* dcq) :
+  UpdateRSetDeferred(G1DirtyCardQueue* dcq) :
     _g1h(G1CollectedHeap::heap()), _dcq(dcq), _ct(_g1h->card_table()) {}
 
   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
@@ -196,7 +196,7 @@
   uint _worker_id;
   HeapRegionClaimer* _hrclaimer;
 
-  DirtyCardQueue _dcq;
+  G1DirtyCardQueue _dcq;
   UpdateRSetDeferred _update_rset_cl;
 
 public:
--- a/src/hotspot/share/gc/g1/g1HotCardCache.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1HotCardCache.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
-#include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1HotCardCache.hpp"
 #include "runtime/atomic.hpp"
 
@@ -83,7 +83,7 @@
   return (previous_ptr == current_ptr) ? previous_ptr : card_ptr;
 }
 
-void G1HotCardCache::drain(CardTableEntryClosure* cl, uint worker_i) {
+void G1HotCardCache::drain(G1CardTableEntryClosure* cl, uint worker_i) {
   assert(default_use_cache(), "Drain only necessary if we use the hot card cache.");
 
   assert(_hot_cache != NULL, "Logic");
--- a/src/hotspot/share/gc/g1/g1HotCardCache.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1HotCardCache.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -32,8 +32,7 @@
 #include "runtime/thread.hpp"
 #include "utilities/globalDefinitions.hpp"
 
-class CardTableEntryClosure;
-class DirtyCardQueue;
+class G1CardTableEntryClosure;
 class G1CollectedHeap;
 class HeapRegion;
 
@@ -112,7 +111,7 @@
 
   // Refine the cards that have delayed as a result of
   // being in the cache.
-  void drain(CardTableEntryClosure* cl, uint worker_i);
+  void drain(G1CardTableEntryClosure* cl, uint worker_i);
 
   // Set up for parallel processing of the cards in the hot cache
   void reset_hot_cache_claimed_index() {
--- a/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,15 +119,15 @@
   //  name "collector.0".  In a generational collector this would be the
   // young generation collection.
   _incremental_collection_counters =
-    new CollectorCounters("G1 incremental collections", 0);
+    new CollectorCounters("G1 young collection pauses", 0);
   //   name "collector.1".  In a generational collector this would be the
   // old generation collection.
   _full_collection_counters =
-    new CollectorCounters("G1 stop-the-world full collections", 1);
+    new CollectorCounters("G1 full collection pauses", 1);
   //   name "collector.2".  In a generational collector this would be the
   // STW phases in concurrent collection.
   _conc_collection_counters =
-    new CollectorCounters("G1 stop-the-world phases", 2);
+    new CollectorCounters("G1 concurrent cycle pauses", 2);
 
   // "Generation" and "Space" counters.
   //
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -25,9 +25,9 @@
 #ifndef SHARE_GC_G1_G1PARSCANTHREADSTATE_HPP
 #define SHARE_GC_G1_G1PARSCANTHREADSTATE_HPP
 
-#include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/g1/g1CardTable.hpp"
 #include "gc/g1/g1CollectedHeap.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1OopClosures.hpp"
 #include "gc/g1/g1Policy.hpp"
 #include "gc/g1/g1RemSet.hpp"
@@ -46,7 +46,7 @@
 class G1ParScanThreadState : public CHeapObj<mtGC> {
   G1CollectedHeap* _g1h;
   RefToScanQueue*  _refs;
-  DirtyCardQueue   _dcq;
+  G1DirtyCardQueue _dcq;
   G1CardTable*     _ct;
   G1EvacuationRootClosures* _closures;
 
@@ -77,7 +77,7 @@
 
 #define PADDING_ELEM_NUM (DEFAULT_CACHE_LINE_SIZE / sizeof(size_t))
 
-  DirtyCardQueue& dirty_card_queue()             { return _dcq;  }
+  G1DirtyCardQueue& dirty_card_queue()           { return _dcq; }
   G1CardTable* ct()                              { return _ct; }
 
   InCSetState dest(InCSetState original) const {
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,12 @@
  */
 
 #include "precompiled.hpp"
-#include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/g1/g1BarrierSet.hpp"
 #include "gc/g1/g1BlockOffsetTable.inline.hpp"
 #include "gc/g1/g1CardTable.inline.hpp"
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1ConcurrentRefine.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1FromCardCache.hpp"
 #include "gc/g1/g1GCPhaseTimes.hpp"
 #include "gc/g1/g1HotCardCache.hpp"
@@ -300,7 +300,7 @@
 }
 
 uint G1RemSet::num_par_rem_sets() {
-  return DirtyCardQueueSet::num_par_ids() + G1ConcurrentRefine::max_num_threads() + MAX2(ConcGCThreads, ParallelGCThreads);
+  return G1DirtyCardQueueSet::num_par_ids() + G1ConcurrentRefine::max_num_threads() + MAX2(ConcGCThreads, ParallelGCThreads);
 }
 
 void G1RemSet::initialize(size_t capacity, uint max_regions) {
@@ -456,7 +456,7 @@
 }
 
 // Closure used for updating rem sets. Only called during an evacuation pause.
-class G1RefineCardClosure: public CardTableEntryClosure {
+class G1RefineCardClosure: public G1CardTableEntryClosure {
   G1RemSet* _g1rs;
   G1ScanObjsDuringUpdateRSClosure* _update_rs_cl;
 
@@ -520,7 +520,7 @@
 }
 
 void G1RemSet::prepare_for_oops_into_collection_set_do() {
-  DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+  G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
   dcqs.concatenate_logs();
 
   _scan_state->reset();
@@ -677,7 +677,7 @@
       *card_ptr = G1CardTable::dirty_card_val();
       MutexLockerEx x(Shared_DirtyCardQ_lock,
                       Mutex::_no_safepoint_check_flag);
-      DirtyCardQueue* sdcq =
+      G1DirtyCardQueue* sdcq =
         G1BarrierSet::dirty_card_queue_set().shared_dirty_card_queue();
       sdcq->enqueue(card_ptr);
     }
--- a/src/hotspot/share/gc/g1/g1RemSet.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1RemSet.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -25,7 +25,6 @@
 #ifndef SHARE_GC_G1_G1REMSET_HPP
 #define SHARE_GC_G1_G1REMSET_HPP
 
-#include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/g1/g1CardTable.hpp"
 #include "gc/g1/g1OopClosures.hpp"
 #include "gc/g1/g1GCPhaseTimes.hpp"
--- a/src/hotspot/share/gc/g1/g1RemSetSummary.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1RemSetSummary.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 #include "gc/g1/g1CollectedHeap.inline.hpp"
 #include "gc/g1/g1ConcurrentRefine.hpp"
 #include "gc/g1/g1ConcurrentRefineThread.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/g1/g1RemSet.hpp"
 #include "gc/g1/g1RemSetSummary.hpp"
 #include "gc/g1/g1YoungRemSetSamplingThread.hpp"
@@ -53,7 +54,7 @@
 
 void G1RemSetSummary::update() {
   _num_conc_refined_cards = _rem_set->num_conc_refined_cards();
-  DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
+  G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
   _num_processed_buf_mutator = dcqs.processed_buffers_mut();
   _num_processed_buf_rs_threads = dcqs.processed_buffers_rs_thread();
 
--- a/src/hotspot/share/gc/g1/g1ThreadLocalData.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/g1ThreadLocalData.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,8 @@
 #ifndef SHARE_GC_G1_G1THREADLOCALDATA_HPP
 #define SHARE_GC_G1_G1THREADLOCALDATA_HPP
 
-#include "gc/g1/dirtyCardQueue.hpp"
 #include "gc/g1/g1BarrierSet.hpp"
+#include "gc/g1/g1DirtyCardQueue.hpp"
 #include "gc/shared/satbMarkQueue.hpp"
 #include "runtime/thread.hpp"
 #include "utilities/debug.hpp"
@@ -33,8 +33,8 @@
 
 class G1ThreadLocalData {
 private:
-  SATBMarkQueue  _satb_mark_queue;
-  DirtyCardQueue _dirty_card_queue;
+  SATBMarkQueue _satb_mark_queue;
+  G1DirtyCardQueue _dirty_card_queue;
 
   G1ThreadLocalData() :
       _satb_mark_queue(&G1BarrierSet::satb_mark_queue_set()),
@@ -66,7 +66,7 @@
     return data(thread)->_satb_mark_queue;
   }
 
-  static DirtyCardQueue& dirty_card_queue(Thread* thread) {
+  static G1DirtyCardQueue& dirty_card_queue(Thread* thread) {
     return data(thread)->_dirty_card_queue;
   }
 
@@ -83,11 +83,11 @@
   }
 
   static ByteSize dirty_card_queue_index_offset() {
-    return dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_index();
+    return dirty_card_queue_offset() + G1DirtyCardQueue::byte_offset_of_index();
   }
 
   static ByteSize dirty_card_queue_buffer_offset() {
-    return dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_buf();
+    return dirty_card_queue_offset() + G1DirtyCardQueue::byte_offset_of_buf();
   }
 };
 
--- a/src/hotspot/share/gc/g1/vmStructs_g1.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/g1/vmStructs_g1.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -102,7 +102,7 @@
   declare_toplevel_type(PtrQueue)                                             \
   declare_toplevel_type(HeapRegionType)                                       \
   declare_toplevel_type(SATBMarkQueue)                                        \
-  declare_toplevel_type(DirtyCardQueue)                                       \
+  declare_toplevel_type(G1DirtyCardQueue)                                     \
                                                                               \
   declare_toplevel_type(G1CollectedHeap*)                                     \
   declare_toplevel_type(HeapRegion*)                                          \
--- a/src/hotspot/share/gc/parallel/psMarkSweep.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/parallel/psMarkSweep.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -72,7 +72,7 @@
 void PSMarkSweep::initialize() {
   _span_based_discoverer.set_span(ParallelScavengeHeap::heap()->reserved_region());
   set_ref_processor(new ReferenceProcessor(&_span_based_discoverer));     // a vanilla ref proc
-  _counters = new CollectorCounters("PSMarkSweep", 1);
+  _counters = new CollectorCounters("Serial full collection pauses", 1);
   MarkSweep::initialize();
 }
 
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -883,7 +883,7 @@
     new PCReferenceProcessor(&_span_based_discoverer,
                              &_is_alive_closure); // non-header is alive closure
 
-  _counters = new CollectorCounters("PSParallelCompact", 1);
+  _counters = new CollectorCounters("Parallel full collection pauses", 1);
 
   // Initialize static fields in ParCompactionManager.
   ParCompactionManager::initialize(mark_bitmap());
--- a/src/hotspot/share/gc/parallel/psScavenge.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/parallel/psScavenge.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -754,5 +754,5 @@
   // Cache the cardtable
   _card_table = heap->card_table();
 
-  _counters = new CollectorCounters("PSScavenge", 0);
+  _counters = new CollectorCounters("Parallel young collection pauses", 0);
 }
--- a/src/hotspot/share/gc/serial/defNewGeneration.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/serial/defNewGeneration.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -192,7 +192,7 @@
 
  public:
   DefNewGeneration(ReservedSpace rs, size_t initial_byte_size,
-                   const char* policy="Copy");
+                   const char* policy="Serial young collection pauses");
 
   virtual void ref_processor_init();
 
--- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
   _gen_counters = new GenerationCounters(gen_name, 1, 1,
       gcp->min_old_size(), gcp->max_old_size(), &_virtual_space);
 
-  _gc_counters = new CollectorCounters("MSC", 1);
+  _gc_counters = new CollectorCounters("Serial full collection pauses", 1);
 
   _space_counters = new CSpaceCounters(gen_name, 0,
                                        _virtual_space.reserved_size(),
--- a/src/hotspot/share/gc/z/zServiceability.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/gc/z/zServiceability.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -72,8 +72,8 @@
                     max_capacity /* max_capacity */,
                     min_capacity /* init_capacity */),
     // gc.collector.2
-    _collector_counters("stop-the-world" /* name */,
-                        2                /* ordinal */) {}
+    _collector_counters("Z concurrent cycle pauses" /* name */,
+                        2                           /* ordinal */) {}
 
 CollectorCounters* ZServiceabilityCounters::collector_counters() {
   return &_collector_counters;
--- a/src/hotspot/share/interpreter/bytecodeTracer.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/interpreter/bytecodeTracer.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -382,7 +382,7 @@
     st->print_cr(" %d <%s.%s%s%s> ", i, klass->as_C_string(), name->as_C_string(), sep, signature->as_C_string());
   } else {
     if (tag.is_dynamic_constant() || tag.is_invoke_dynamic()) {
-      int bsm = constants->invoke_dynamic_bootstrap_method_ref_index_at(i);
+      int bsm = constants->bootstrap_method_ref_index_at(i);
       st->print(" bsm=%d", bsm);
     }
     st->print_cr(" %d <%s%s%s>", i, name->as_C_string(), sep, signature->as_C_string());
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -977,9 +977,6 @@
   LastFrameAccessor last_frame(thread);
   const Bytecodes::Code bytecode = Bytecodes::_invokedynamic;
 
-  //TO DO: consider passing BCI to Java.
-  //  int caller_bci = last_frame.method()->bci_from(last_frame.bcp());
-
   // resolve method
   CallInfo info;
   constantPoolHandle pool(thread, last_frame.method()->constants());
--- a/src/hotspot/share/interpreter/linkResolver.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/interpreter/linkResolver.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -94,26 +94,21 @@
 }
 
 void CallInfo::set_handle(const methodHandle& resolved_method,
-                          Handle resolved_appendix,
-                          Handle resolved_method_type, TRAPS) {
-  set_handle(SystemDictionary::MethodHandle_klass(), resolved_method, resolved_appendix, resolved_method_type, CHECK);
+                          Handle resolved_appendix, TRAPS) {
+  set_handle(SystemDictionary::MethodHandle_klass(), resolved_method, resolved_appendix, CHECK);
 }
 
 void CallInfo::set_handle(Klass* resolved_klass,
                           const methodHandle& resolved_method,
-                          Handle resolved_appendix,
-                          Handle resolved_method_type, TRAPS) {
-  if (resolved_method.is_null()) {
-    THROW_MSG(vmSymbols::java_lang_InternalError(), "resolved method is null");
-  }
+                          Handle resolved_appendix, TRAPS) {
+  guarantee(resolved_method.not_null(), "resolved method is null");
   assert(resolved_method->intrinsic_id() == vmIntrinsics::_invokeBasic ||
          resolved_method->is_compiled_lambda_form(),
          "linkMethod must return one of these");
   int vtable_index = Method::nonvirtual_vtable_index;
   assert(!resolved_method->has_vtable_index(), "");
   set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK);
-  _resolved_appendix    = resolved_appendix;
-  _resolved_method_type = resolved_method_type;
+  _resolved_appendix = resolved_appendix;
 }
 
 void CallInfo::set_common(Klass* resolved_klass,
@@ -452,7 +447,6 @@
 methodHandle LinkResolver::lookup_polymorphic_method(
                                              const LinkInfo& link_info,
                                              Handle *appendix_result_or_null,
-                                             Handle *method_type_result,
                                              TRAPS) {
   Klass* klass = link_info.resolved_klass();
   Symbol* name = link_info.name();
@@ -520,7 +514,6 @@
                                                             full_signature,
                                                             link_info.current_klass(),
                                                             &appendix,
-                                                            &method_type,
                                                             CHECK_NULL);
       if (TraceMethodHandles) {
         ttyLocker ttyl;
@@ -552,7 +545,6 @@
 
         assert(appendix_result_or_null != NULL, "");
         (*appendix_result_or_null) = appendix;
-        (*method_type_result)      = method_type;
       }
       return result;
     }
@@ -760,7 +752,7 @@
 
     if (resolved_method.is_null()) {
       // JSR 292:  see if this is an implicitly generated method MethodHandle.linkToVirtual(*...), etc
-      resolved_method = lookup_polymorphic_method(link_info, (Handle*)NULL, (Handle*)NULL, THREAD);
+      resolved_method = lookup_polymorphic_method(link_info, (Handle*)NULL, THREAD);
       if (HAS_PENDING_EXCEPTION) {
         nested_exception = Handle(THREAD, PENDING_EXCEPTION);
         CLEAR_PENDING_EXCEPTION;
@@ -1697,10 +1689,8 @@
          resolved_klass == SystemDictionary::VarHandle_klass(), "");
   assert(MethodHandles::is_signature_polymorphic_name(link_info.name()), "");
   Handle       resolved_appendix;
-  Handle       resolved_method_type;
-  methodHandle resolved_method = lookup_polymorphic_method(link_info,
-                                       &resolved_appendix, &resolved_method_type, CHECK);
-  result.set_handle(resolved_klass, resolved_method, resolved_appendix, resolved_method_type, CHECK);
+  methodHandle resolved_method = lookup_polymorphic_method(link_info, &resolved_appendix, CHECK);
+  result.set_handle(resolved_klass, resolved_method, resolved_appendix, CHECK);
 }
 
 void LinkResolver::resolve_invokedynamic(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) {
@@ -1737,8 +1727,7 @@
   if (!cpce->is_f1_null()) {
     methodHandle method(     THREAD, cpce->f1_as_method());
     Handle       appendix(   THREAD, cpce->appendix_if_resolved(pool));
-    Handle       method_type(THREAD, cpce->method_type_if_resolved(pool));
-    result.set_handle(method, appendix, method_type, THREAD);
+    result.set_handle(method, appendix, THREAD);
     Exceptions::wrap_dynamic_exception(CHECK);
     return;
   }
@@ -1766,8 +1755,7 @@
       if (!cpce->is_f1_null()) {
         methodHandle method(     THREAD, cpce->f1_as_method());
         Handle       appendix(   THREAD, cpce->appendix_if_resolved(pool));
-        Handle       method_type(THREAD, cpce->method_type_if_resolved(pool));
-        result.set_handle(method, appendix, method_type, THREAD);
+        result.set_handle(method, appendix, THREAD);
         Exceptions::wrap_dynamic_exception(CHECK);
       } else {
         assert(cpce->indy_resolution_failed(), "Resolution failure flag not set");
@@ -1788,17 +1776,15 @@
   // JSR 292:  this must resolve to an implicitly generated method MH.linkToCallSite(*...)
   // The appendix argument is likely to be a freshly-created CallSite.
   Handle       resolved_appendix;
-  Handle       resolved_method_type;
   methodHandle resolved_method =
     SystemDictionary::find_dynamic_call_site_invoker(current_klass,
                                                      pool_index,
                                                      bootstrap_specifier,
                                                      method_name, method_signature,
                                                      &resolved_appendix,
-                                                     &resolved_method_type,
                                                      THREAD);
   Exceptions::wrap_dynamic_exception(CHECK);
-  result.set_handle(resolved_method, resolved_appendix, resolved_method_type, THREAD);
+  result.set_handle(resolved_method, resolved_appendix, THREAD);
   Exceptions::wrap_dynamic_exception(CHECK);
 }
 
--- a/src/hotspot/share/interpreter/linkResolver.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/interpreter/linkResolver.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -55,7 +55,6 @@
                                         //               others inferred), vtable, itable)
   int          _call_index;             // vtable or itable index of selected class method (if any)
   Handle       _resolved_appendix;      // extra argument in constant pool (if CPCE::has_appendix)
-  Handle       _resolved_method_type;   // MethodType (for invokedynamic and invokehandle call sites)
   Handle       _resolved_method_name;   // Object holding the ResolvedMethodName
 
   void set_static(Klass* resolved_klass, const methodHandle& resolved_method, TRAPS);
@@ -68,10 +67,10 @@
                    const methodHandle& selected_method,
                    int vtable_index, TRAPS);
   void set_handle(const methodHandle& resolved_method,
-                  Handle resolved_appendix, Handle resolved_method_type, TRAPS);
+                  Handle resolved_appendix, TRAPS);
   void set_handle(Klass* resolved_klass,
                   const methodHandle& resolved_method,
-                  Handle resolved_appendix, Handle resolved_method_type, TRAPS);
+                  Handle resolved_appendix, TRAPS);
   void set_common(Klass* resolved_klass, Klass* selected_klass,
                   const methodHandle& resolved_method,
                   const methodHandle& selected_method,
@@ -98,7 +97,6 @@
   methodHandle resolved_method() const           { return _resolved_method; }
   methodHandle selected_method() const           { return _selected_method; }
   Handle       resolved_appendix() const         { return _resolved_appendix; }
-  Handle       resolved_method_type() const      { return _resolved_method_type; }
   Handle       resolved_method_name() const      { return _resolved_method_name; }
   // Materialize a java.lang.invoke.ResolvedMethodName for this resolved_method
   void     set_resolved_method_name(TRAPS);
@@ -207,8 +205,7 @@
   static Method* lookup_method_in_interfaces(const LinkInfo& link_info);
 
   static methodHandle lookup_polymorphic_method(const LinkInfo& link_info,
-                                                Handle *appendix_result_or_null,
-                                                Handle *method_type_result, TRAPS);
+                                                Handle *appendix_result_or_null, TRAPS);
  JVMCI_ONLY(public:) // Needed for CompilerToVM.resolveMethod()
   // Not Linktime so doesn't take LinkInfo
   static methodHandle lookup_instance_method_in_klasses (Klass* klass, Symbol* name, Symbol* signature,
--- a/src/hotspot/share/interpreter/rewriter.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/interpreter/rewriter.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -221,13 +221,13 @@
             MethodHandles::is_signature_polymorphic_name(SystemDictionary::MethodHandle_klass(),
                                                          _pool->name_ref_at(cp_index))) {
           // we may need a resolved_refs entry for the appendix
-          add_invokedynamic_resolved_references_entries(cp_index, cache_index);
+          add_invokedynamic_resolved_references_entry(cp_index, cache_index);
           status = +1;
         } else if (_pool->klass_ref_at_noresolve(cp_index) == vmSymbols::java_lang_invoke_VarHandle() &&
                    MethodHandles::is_signature_polymorphic_name(SystemDictionary::VarHandle_klass(),
                                                                 _pool->name_ref_at(cp_index))) {
           // we may need a resolved_refs entry for the appendix
-          add_invokedynamic_resolved_references_entries(cp_index, cache_index);
+          add_invokedynamic_resolved_references_entry(cp_index, cache_index);
           status = +1;
         } else {
           status = -1;
@@ -259,7 +259,7 @@
   if (!reverse) {
     int cp_index = Bytes::get_Java_u2(p);
     int cache_index = add_invokedynamic_cp_cache_entry(cp_index);
-    int resolved_index = add_invokedynamic_resolved_references_entries(cp_index, cache_index);
+    int resolved_index = add_invokedynamic_resolved_references_entry(cp_index, cache_index);
     // Replace the trailing four bytes with a CPC index for the dynamic
     // call site.  Unlike other CPC entries, there is one per bytecode,
     // not just one per distinct CP entry.  In other words, the
@@ -307,12 +307,9 @@
       // invokedynamic resolved references map also points to cp cache and must
       // add delta to each.
       int resolved_index = _patch_invokedynamic_refs->at(i);
-      for (int entry = 0; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
-        assert(_invokedynamic_references_map.at(resolved_index + entry) == cache_index,
+        assert(_invokedynamic_references_map.at(resolved_index) == cache_index,
              "should be the same index");
-        _invokedynamic_references_map.at_put(resolved_index+entry,
-                                             cache_index + delta);
-      }
+        _invokedynamic_references_map.at_put(resolved_index, cache_index + delta);
     }
   }
 }
--- a/src/hotspot/share/interpreter/rewriter.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/interpreter/rewriter.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -159,19 +159,12 @@
     return ref_index;
   }
 
-  // add a new entries to the resolved_references map (for invokedynamic and invokehandle only)
-  int add_invokedynamic_resolved_references_entries(int cp_index, int cache_index) {
+  // add a new entry to the resolved_references map (for invokedynamic and invokehandle only)
+  int add_invokedynamic_resolved_references_entry(int cp_index, int cache_index) {
     assert(_resolved_reference_limit >= 0, "must add indy refs after first iteration");
-    int ref_index = -1;
-    for (int entry = 0; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
-      const int index = _resolved_references_map.append(cp_index);  // many-to-one
-      assert(index >= _resolved_reference_limit, "");
-      if (entry == 0) {
-        ref_index = index;
-      }
-      assert((index - entry) == ref_index, "entries must be consecutive");
-      _invokedynamic_references_map.at_put_grow(index, cache_index, -1);
-    }
+    int ref_index = _resolved_references_map.append(cp_index);  // many-to-one
+    assert(ref_index >= _resolved_reference_limit, "");
+    _invokedynamic_references_map.at_put_grow(ref_index, cache_index, -1);
     return ref_index;
   }
 
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1241,7 +1241,6 @@
       vmassert(MethodHandles::is_signature_polymorphic_method(resolved_method()),"!");
       vmassert(!MethodHandles::is_signature_polymorphic_static(resolved_method->intrinsic_id()), "!");
       vmassert(cp_cache_entry->appendix_if_resolved(cp) == NULL, "!");
-      vmassert(cp_cache_entry->method_type_if_resolved(cp) == NULL, "!");
 
       methodHandle m(LinkResolver::linktime_resolve_virtual_method_or_null(link_info));
       vmassert(m == resolved_method, "!!");
--- a/src/hotspot/share/oops/constantPool.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/oops/constantPool.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -594,21 +594,13 @@
 }
 
 
-bool ConstantPool::has_method_type_at_if_loaded(const constantPoolHandle& cpool, int which) {
+bool ConstantPool::has_local_signature_at_if_loaded(const constantPoolHandle& cpool, int which) {
   if (cpool->cache() == NULL)  return false;  // nothing to load yet
   int cache_index = decode_cpcache_index(which, true);
   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
-  return e->has_method_type();
+  return e->has_local_signature();
 }
 
-oop ConstantPool::method_type_at_if_loaded(const constantPoolHandle& cpool, int which) {
-  if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
-  int cache_index = decode_cpcache_index(which, true);
-  ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
-  return e->method_type_if_resolved(cpool);
-}
-
-
 Symbol* ConstantPool::impl_name_ref_at(int which, bool uncached) {
   int name_index = name_ref_index_at(impl_name_and_type_ref_index_at(which, uncached));
   return symbol_at(name_index);
@@ -625,26 +617,22 @@
   if (!uncached && cache() != NULL) {
     if (ConstantPool::is_invokedynamic_index(which)) {
       // Invokedynamic index is index into the constant pool cache
-      int pool_index = invokedynamic_cp_cache_entry_at(which)->constant_pool_index();
-      pool_index = invoke_dynamic_name_and_type_ref_index_at(pool_index);
+      int pool_index = invokedynamic_bootstrap_ref_index_at(which);
+      pool_index = bootstrap_name_and_type_ref_index_at(pool_index);
       assert(tag_at(pool_index).is_name_and_type(), "");
       return pool_index;
     }
     // change byte-ordering and go via cache
     i = remap_instruction_operand_from_cache(which);
   } else {
-    if (tag_at(which).is_invoke_dynamic() ||
-        tag_at(which).is_dynamic_constant() ||
-        tag_at(which).is_dynamic_constant_in_error()) {
-      int pool_index = invoke_dynamic_name_and_type_ref_index_at(which);
+    if (tag_at(which).has_bootstrap()) {
+      int pool_index = bootstrap_name_and_type_ref_index_at(which);
       assert(tag_at(pool_index).is_name_and_type(), "");
       return pool_index;
     }
   }
   assert(tag_at(i).is_field_or_method(), "Corrupted constant pool");
-  assert(!tag_at(i).is_invoke_dynamic() &&
-         !tag_at(i).is_dynamic_constant() &&
-         !tag_at(i).is_dynamic_constant_in_error(), "Must be handled above");
+  assert(!tag_at(i).has_bootstrap(), "Must be handled above");
   jint ref_index = *int_at_addr(i);
   return extract_high_short_from_int(ref_index);
 }
@@ -654,7 +642,7 @@
   if (!uncached && cache() != NULL) {
     if (ConstantPool::is_invokedynamic_index(which)) {
       // Invokedynamic index is index into resolved_references
-      pool_index = invokedynamic_cp_cache_entry_at(which)->constant_pool_index();
+      pool_index = invokedynamic_bootstrap_ref_index_at(which);
     } else {
       // change byte-ordering and go via cache
       pool_index = remap_instruction_operand_from_cache(which);
@@ -1128,14 +1116,14 @@
     // JVM_CONSTANT_Dynamic is an ordered pair of [bootm, name&ftype], plus optional arguments
     // In both cases, the bootm, being a JVM_CONSTANT_MethodHandle, has its own cache entry.
     // It is accompanied by the optional arguments.
-    int bsm_index = this_cp->invoke_dynamic_bootstrap_method_ref_index_at(index);
+    int bsm_index = this_cp->bootstrap_method_ref_index_at(index);
     oop bsm_oop = this_cp->resolve_possibly_cached_constant_at(bsm_index, CHECK_NULL);
     if (!java_lang_invoke_MethodHandle::is_instance(bsm_oop)) {
       THROW_MSG_NULL(vmSymbols::java_lang_LinkageError(), "BSM not an MethodHandle");
     }
 
     // Extract the optional static arguments.
-    argc = this_cp->invoke_dynamic_argument_count_at(index);
+    argc = this_cp->bootstrap_argument_count_at(index);
 
     // if there are no static arguments, return the bsm by itself:
     if (argc == 0 && UseBootstrapCallInfo < 2)  return bsm_oop;
@@ -1177,7 +1165,7 @@
   if (!use_BSCI && this_cp->tag_at(index).is_dynamic_constant()) {
     bool found_unresolved_condy = false;
     for (int i = 0; i < argc; i++) {
-      int arg_index = this_cp->invoke_dynamic_argument_index_at(index, i);
+      int arg_index = this_cp->bootstrap_argument_index_at(index, i);
       if (this_cp->tag_at(arg_index).is_dynamic_constant()) {
         // potential recursion point condy -> condy
         bool found_it = false;
@@ -1197,7 +1185,7 @@
     bool all_resolved = true;
     for (int i = 0; i < argc; i++) {
       bool found_it = false;
-      int arg_index = this_cp->invoke_dynamic_argument_index_at(index, i);
+      int arg_index = this_cp->bootstrap_argument_index_at(index, i);
       this_cp->find_cached_constant_at(arg_index, found_it, CHECK_NULL);
       if (!found_it) { all_resolved = false; break; }
     }
@@ -1244,7 +1232,7 @@
       !(this_cp->tag_at(index).is_invoke_dynamic()    ||
         this_cp->tag_at(index).is_dynamic_constant()) ||
       (0 > start_arg || start_arg > end_arg) ||
-      (end_arg > (argc = this_cp->invoke_dynamic_argument_count_at(index))) ||
+      (end_arg > (argc = this_cp->bootstrap_argument_count_at(index))) ||
       (0 > pos       || pos > limit)         ||
       (info.is_null() || limit > info->length())) {
     // An index or something else went wrong; throw an error.
@@ -1255,7 +1243,7 @@
   // now we can loop safely
   int info_i = pos;
   for (int i = start_arg; i < end_arg; i++) {
-    int arg_index = this_cp->invoke_dynamic_argument_index_at(index, i);
+    int arg_index = this_cp->bootstrap_argument_index_at(index, i);
     oop arg_oop;
     if (must_resolve) {
       arg_oop = this_cp->resolve_possibly_cached_constant_at(arg_index, CHECK);
@@ -1454,10 +1442,10 @@
 
   case JVM_CONSTANT_Dynamic:
   {
-    int k1 = invoke_dynamic_name_and_type_ref_index_at(index1);
-    int k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2);
-    int i1 = invoke_dynamic_bootstrap_specifier_index(index1);
-    int i2 = cp2->invoke_dynamic_bootstrap_specifier_index(index2);
+    int k1 = bootstrap_name_and_type_ref_index_at(index1);
+    int k2 = cp2->bootstrap_name_and_type_ref_index_at(index2);
+    int i1 = bootstrap_methods_attribute_index(index1);
+    int i2 = cp2->bootstrap_methods_attribute_index(index2);
     // separate statements and variables because CHECK_false is used
     bool match_entry = compare_entry_to(k1, cp2, k2, CHECK_false);
     bool match_operand = compare_operand_to(i1, cp2, i2, CHECK_false);
@@ -1466,10 +1454,10 @@
 
   case JVM_CONSTANT_InvokeDynamic:
   {
-    int k1 = invoke_dynamic_name_and_type_ref_index_at(index1);
-    int k2 = cp2->invoke_dynamic_name_and_type_ref_index_at(index2);
-    int i1 = invoke_dynamic_bootstrap_specifier_index(index1);
-    int i2 = cp2->invoke_dynamic_bootstrap_specifier_index(index2);
+    int k1 = bootstrap_name_and_type_ref_index_at(index1);
+    int k2 = cp2->bootstrap_name_and_type_ref_index_at(index2);
+    int i1 = bootstrap_methods_attribute_index(index1);
+    int i2 = cp2->bootstrap_methods_attribute_index(index2);
     // separate statements and variables because CHECK_false is used
     bool match_entry = compare_entry_to(k1, cp2, k2, CHECK_false);
     bool match_operand = compare_operand_to(i1, cp2, i2, CHECK_false);
@@ -1793,16 +1781,16 @@
   case JVM_CONSTANT_Dynamic:
   case JVM_CONSTANT_DynamicInError:
   {
-    int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i);
-    int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i);
+    int k1 = from_cp->bootstrap_methods_attribute_index(from_i);
+    int k2 = from_cp->bootstrap_name_and_type_ref_index_at(from_i);
     k1 += operand_array_length(to_cp->operands());  // to_cp might already have operands
     to_cp->dynamic_constant_at_put(to_i, k1, k2);
   } break;
 
   case JVM_CONSTANT_InvokeDynamic:
   {
-    int k1 = from_cp->invoke_dynamic_bootstrap_specifier_index(from_i);
-    int k2 = from_cp->invoke_dynamic_name_and_type_ref_index_at(from_i);
+    int k1 = from_cp->bootstrap_methods_attribute_index(from_i);
+    int k2 = from_cp->bootstrap_name_and_type_ref_index_at(from_i);
     k1 += operand_array_length(to_cp->operands());  // to_cp might already have operands
     to_cp->invoke_dynamic_at_put(to_i, k1, k2);
   } break;
@@ -2252,7 +2240,7 @@
         *bytes = tag;
         idx1 = extract_low_short_from_int(*int_at_addr(idx));
         idx2 = extract_high_short_from_int(*int_at_addr(idx));
-        assert(idx2 == invoke_dynamic_name_and_type_ref_index_at(idx), "correct half of u4");
+        assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4");
         Bytes::put_Java_u2((address) (bytes+1), idx1);
         Bytes::put_Java_u2((address) (bytes+3), idx2);
         DBG(printf("JVM_CONSTANT_Dynamic: %hd %hd", idx1, idx2));
@@ -2262,7 +2250,7 @@
         *bytes = tag;
         idx1 = extract_low_short_from_int(*int_at_addr(idx));
         idx2 = extract_high_short_from_int(*int_at_addr(idx));
-        assert(idx2 == invoke_dynamic_name_and_type_ref_index_at(idx), "correct half of u4");
+        assert(idx2 == bootstrap_name_and_type_ref_index_at(idx), "correct half of u4");
         Bytes::put_Java_u2((address) (bytes+1), idx1);
         Bytes::put_Java_u2((address) (bytes+3), idx2);
         DBG(printf("JVM_CONSTANT_InvokeDynamic: %hd %hd", idx1, idx2));
@@ -2443,12 +2431,12 @@
     case JVM_CONSTANT_Dynamic :
     case JVM_CONSTANT_DynamicInError :
       {
-        st->print("bootstrap_method_index=%d", invoke_dynamic_bootstrap_method_ref_index_at(index));
-        st->print(" type_index=%d", invoke_dynamic_name_and_type_ref_index_at(index));
-        int argc = invoke_dynamic_argument_count_at(index);
+        st->print("bootstrap_method_index=%d", bootstrap_method_ref_index_at(index));
+        st->print(" type_index=%d", bootstrap_name_and_type_ref_index_at(index));
+        int argc = bootstrap_argument_count_at(index);
         if (argc > 0) {
           for (int arg_i = 0; arg_i < argc; arg_i++) {
-            int arg = invoke_dynamic_argument_index_at(index, arg_i);
+            int arg = bootstrap_argument_index_at(index, arg_i);
             st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg);
           }
           st->print("}");
@@ -2457,12 +2445,12 @@
       break;
     case JVM_CONSTANT_InvokeDynamic :
       {
-        st->print("bootstrap_method_index=%d", invoke_dynamic_bootstrap_method_ref_index_at(index));
-        st->print(" name_and_type_index=%d", invoke_dynamic_name_and_type_ref_index_at(index));
-        int argc = invoke_dynamic_argument_count_at(index);
+        st->print("bootstrap_method_index=%d", bootstrap_method_ref_index_at(index));
+        st->print(" name_and_type_index=%d", bootstrap_name_and_type_ref_index_at(index));
+        int argc = bootstrap_argument_count_at(index);
         if (argc > 0) {
           for (int arg_i = 0; arg_i < argc; arg_i++) {
-            int arg = invoke_dynamic_argument_index_at(index, arg_i);
+            int arg = bootstrap_argument_index_at(index, arg_i);
             st->print((arg_i == 0 ? " arguments={%d" : ", %d"), arg);
           }
           st->print("}");
--- a/src/hotspot/share/oops/constantPool.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/oops/constantPool.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -246,16 +246,22 @@
   // The invokedynamic points at a CP cache entry.  This entry points back
   // at the original CP entry (CONSTANT_InvokeDynamic) and also (via f2) at an entry
   // in the resolved_references array (which provides the appendix argument).
-  int invokedynamic_cp_cache_index(int index) const {
-    assert (is_invokedynamic_index(index), "should be a invokedynamic index");
-    int cache_index = decode_invokedynamic_index(index);
+  int invokedynamic_cp_cache_index(int indy_index) const {
+    assert(is_invokedynamic_index(indy_index), "should be a invokedynamic index");
+    int cache_index = decode_invokedynamic_index(indy_index);
     return cache_index;
   }
-  ConstantPoolCacheEntry* invokedynamic_cp_cache_entry_at(int index) const {
+  ConstantPoolCacheEntry* invokedynamic_cp_cache_entry_at(int indy_index) const {
     // decode index that invokedynamic points to.
-    int cp_cache_index = invokedynamic_cp_cache_index(index);
+    int cp_cache_index = invokedynamic_cp_cache_index(indy_index);
     return cache()->entry_at(cp_cache_index);
   }
+  // Given the per-instruction index of an indy instruction, report the
+  // main constant pool entry for its bootstrap specifier.
+  // From there, uncached_name/signature_ref_at will get the name/type.
+  int invokedynamic_bootstrap_ref_index_at(int indy_index) const {
+    return invokedynamic_cp_cache_entry_at(indy_index)->constant_pool_index();
+  }
 
   // Assembly code support
   static int tags_offset_in_bytes()         { return offset_of(ConstantPool, _tags); }
@@ -294,14 +300,14 @@
     *int_at_addr(which) = ref_index;
   }
 
-  void dynamic_constant_at_put(int which, int bootstrap_specifier_index, int name_and_type_index) {
+  void dynamic_constant_at_put(int which, int bsms_attribute_index, int name_and_type_index) {
     tag_at_put(which, JVM_CONSTANT_Dynamic);
-    *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_specifier_index;
+    *int_at_addr(which) = ((jint) name_and_type_index<<16) | bsms_attribute_index;
   }
 
-  void invoke_dynamic_at_put(int which, int bootstrap_specifier_index, int name_and_type_index) {
+  void invoke_dynamic_at_put(int which, int bsms_attribute_index, int name_and_type_index) {
     tag_at_put(which, JVM_CONSTANT_InvokeDynamic);
-    *int_at_addr(which) = ((jint) name_and_type_index<<16) | bootstrap_specifier_index;
+    *int_at_addr(which) = ((jint) name_and_type_index<<16) | bsms_attribute_index;
   }
 
   void unresolved_string_at_put(int which, Symbol* s) {
@@ -534,26 +540,22 @@
     return symbol_at(sym);
   }
 
-  int invoke_dynamic_name_and_type_ref_index_at(int which) {
-    assert(tag_at(which).is_invoke_dynamic() ||
-           tag_at(which).is_dynamic_constant() ||
-           tag_at(which).is_dynamic_constant_in_error(), "Corrupted constant pool");
+  int bootstrap_name_and_type_ref_index_at(int which) {
+    assert(tag_at(which).has_bootstrap(), "Corrupted constant pool");
     return extract_high_short_from_int(*int_at_addr(which));
   }
-  int invoke_dynamic_bootstrap_specifier_index(int which) {
-    assert(tag_at(which).is_invoke_dynamic() ||
-           tag_at(which).is_dynamic_constant() ||
-           tag_at(which).is_dynamic_constant_in_error(), "Corrupted constant pool");
+  int bootstrap_methods_attribute_index(int which) {
+    assert(tag_at(which).has_bootstrap(), "Corrupted constant pool");
     return extract_low_short_from_int(*int_at_addr(which));
   }
-  int invoke_dynamic_operand_base(int which) {
-    int bootstrap_specifier_index = invoke_dynamic_bootstrap_specifier_index(which);
-    return operand_offset_at(operands(), bootstrap_specifier_index);
+  int bootstrap_operand_base(int which) {
+    int bsms_attribute_index = bootstrap_methods_attribute_index(which);
+    return operand_offset_at(operands(), bsms_attribute_index);
   }
   // The first part of the operands array consists of an index into the second part.
   // Extract a 32-bit index value from the first part.
-  static int operand_offset_at(Array<u2>* operands, int bootstrap_specifier_index) {
-    int n = (bootstrap_specifier_index * 2);
+  static int operand_offset_at(Array<u2>* operands, int bsms_attribute_index) {
+    int n = (bsms_attribute_index * 2);
     assert(n >= 0 && n+2 <= operands->length(), "oob");
     // The first 32-bit index points to the beginning of the second part
     // of the operands array.  Make sure this index is in the first part.
@@ -566,8 +568,8 @@
     assert(offset == 0 || offset >= second_part && offset <= operands->length(), "oob (3)");
     return offset;
   }
-  static void operand_offset_at_put(Array<u2>* operands, int bootstrap_specifier_index, int offset) {
-    int n = bootstrap_specifier_index * 2;
+  static void operand_offset_at_put(Array<u2>* operands, int bsms_attribute_index, int offset) {
+    int n = bsms_attribute_index * 2;
     assert(n >= 0 && n+2 <= operands->length(), "oob");
     operands->at_put(n+0, extract_low_short_from_int(offset));
     operands->at_put(n+1, extract_high_short_from_int(offset));
@@ -580,20 +582,23 @@
 
 #ifdef ASSERT
   // operand tuples fit together exactly, end to end
-  static int operand_limit_at(Array<u2>* operands, int bootstrap_specifier_index) {
-    int nextidx = bootstrap_specifier_index + 1;
+  static int operand_limit_at(Array<u2>* operands, int bsms_attribute_index) {
+    int nextidx = bsms_attribute_index + 1;
     if (nextidx == operand_array_length(operands))
       return operands->length();
     else
       return operand_offset_at(operands, nextidx);
   }
-  int invoke_dynamic_operand_limit(int which) {
-    int bootstrap_specifier_index = invoke_dynamic_bootstrap_specifier_index(which);
-    return operand_limit_at(operands(), bootstrap_specifier_index);
+  int bootstrap_operand_limit(int which) {
+    int bsms_attribute_index = bootstrap_methods_attribute_index(which);
+    return operand_limit_at(operands(), bsms_attribute_index);
   }
 #endif //ASSERT
 
-  // layout of InvokeDynamic and Dynamic bootstrap method specifier (in second part of operands array):
+  // Layout of InvokeDynamic and Dynamic bootstrap method specifier
+  // data in second part of operands array.  This encodes one record in
+  // the BootstrapMethods attribute.  The whole specifier also includes
+  // the name and type information from the main constant pool entry.
   enum {
          _indy_bsm_offset  = 0,  // CONSTANT_MethodHandle bsm
          _indy_argc_offset = 1,  // u2 argc
@@ -602,35 +607,35 @@
 
   // These functions are used in RedefineClasses for CP merge
 
-  int operand_offset_at(int bootstrap_specifier_index) {
-    assert(0 <= bootstrap_specifier_index &&
-           bootstrap_specifier_index < operand_array_length(operands()),
+  int operand_offset_at(int bsms_attribute_index) {
+    assert(0 <= bsms_attribute_index &&
+           bsms_attribute_index < operand_array_length(operands()),
            "Corrupted CP operands");
-    return operand_offset_at(operands(), bootstrap_specifier_index);
+    return operand_offset_at(operands(), bsms_attribute_index);
   }
-  int operand_bootstrap_method_ref_index_at(int bootstrap_specifier_index) {
-    int offset = operand_offset_at(bootstrap_specifier_index);
+  int operand_bootstrap_method_ref_index_at(int bsms_attribute_index) {
+    int offset = operand_offset_at(bsms_attribute_index);
     return operands()->at(offset + _indy_bsm_offset);
   }
-  int operand_argument_count_at(int bootstrap_specifier_index) {
-    int offset = operand_offset_at(bootstrap_specifier_index);
+  int operand_argument_count_at(int bsms_attribute_index) {
+    int offset = operand_offset_at(bsms_attribute_index);
     int argc = operands()->at(offset + _indy_argc_offset);
     return argc;
   }
-  int operand_argument_index_at(int bootstrap_specifier_index, int j) {
-    int offset = operand_offset_at(bootstrap_specifier_index);
+  int operand_argument_index_at(int bsms_attribute_index, int j) {
+    int offset = operand_offset_at(bsms_attribute_index);
     return operands()->at(offset + _indy_argv_offset + j);
   }
-  int operand_next_offset_at(int bootstrap_specifier_index) {
-    int offset = operand_offset_at(bootstrap_specifier_index) + _indy_argv_offset
-                   + operand_argument_count_at(bootstrap_specifier_index);
+  int operand_next_offset_at(int bsms_attribute_index) {
+    int offset = operand_offset_at(bsms_attribute_index) + _indy_argv_offset
+                   + operand_argument_count_at(bsms_attribute_index);
     return offset;
   }
-  // Compare a bootsrap specifier in the operands arrays
-  bool compare_operand_to(int bootstrap_specifier_index1, const constantPoolHandle& cp2,
-                          int bootstrap_specifier_index2, TRAPS);
-  // Find a bootsrap specifier in the operands array
-  int find_matching_operand(int bootstrap_specifier_index, const constantPoolHandle& search_cp,
+  // Compare a bootstrap specifier data in the operands arrays
+  bool compare_operand_to(int bsms_attribute_index1, const constantPoolHandle& cp2,
+                          int bsms_attribute_index2, TRAPS);
+  // Find a bootstrap specifier data in the operands array
+  int find_matching_operand(int bsms_attribute_index, const constantPoolHandle& search_cp,
                             int operands_cur_len, TRAPS);
   // Resize the operands array with delta_len and delta_size
   void resize_operands(int delta_len, int delta_size, TRAPS);
@@ -639,26 +644,22 @@
   // Shrink the operands array to a smaller array with new_len length
   void shrink_operands(int new_len, TRAPS);
 
-  int invoke_dynamic_bootstrap_method_ref_index_at(int which) {
-    assert(tag_at(which).is_invoke_dynamic() ||
-           tag_at(which).is_dynamic_constant() ||
-           tag_at(which).is_dynamic_constant_in_error(), "Corrupted constant pool");
-    int op_base = invoke_dynamic_operand_base(which);
+  int bootstrap_method_ref_index_at(int which) {
+    assert(tag_at(which).has_bootstrap(), "Corrupted constant pool");
+    int op_base = bootstrap_operand_base(which);
     return operands()->at(op_base + _indy_bsm_offset);
   }
-  int invoke_dynamic_argument_count_at(int which) {
-    assert(tag_at(which).is_invoke_dynamic() ||
-           tag_at(which).is_dynamic_constant() ||
-           tag_at(which).is_dynamic_constant_in_error(), "Corrupted constant pool");
-    int op_base = invoke_dynamic_operand_base(which);
+  int bootstrap_argument_count_at(int which) {
+    assert(tag_at(which).has_bootstrap(), "Corrupted constant pool");
+    int op_base = bootstrap_operand_base(which);
     int argc = operands()->at(op_base + _indy_argc_offset);
     DEBUG_ONLY(int end_offset = op_base + _indy_argv_offset + argc;
-               int next_offset = invoke_dynamic_operand_limit(which));
+               int next_offset = bootstrap_operand_limit(which));
     assert(end_offset == next_offset, "matched ending");
     return argc;
   }
-  int invoke_dynamic_argument_index_at(int which, int j) {
-    int op_base = invoke_dynamic_operand_base(which);
+  int bootstrap_argument_index_at(int which, int j) {
+    int op_base = bootstrap_operand_base(which);
     DEBUG_ONLY(int argc = operands()->at(op_base + _indy_argc_offset));
     assert((uint)j < (uint)argc, "oob");
     return operands()->at(op_base + _indy_argv_offset + j);
@@ -796,8 +797,7 @@
   static Method*          method_at_if_loaded      (const constantPoolHandle& this_cp, int which);
   static bool       has_appendix_at_if_loaded      (const constantPoolHandle& this_cp, int which);
   static oop            appendix_at_if_loaded      (const constantPoolHandle& this_cp, int which);
-  static bool    has_method_type_at_if_loaded      (const constantPoolHandle& this_cp, int which);
-  static oop         method_type_at_if_loaded      (const constantPoolHandle& this_cp, int which);
+  static bool has_local_signature_at_if_loaded     (const constantPoolHandle& this_cp, int which);
   static Klass*            klass_at_if_loaded      (const constantPoolHandle& this_cp, int which);
 
   // Routines currently used for annotations (only called by jvm.cpp) but which might be used in the
--- a/src/hotspot/share/oops/cpCache.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/oops/cpCache.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -392,23 +392,22 @@
 
   const methodHandle adapter = call_info.resolved_method();
   const Handle appendix      = call_info.resolved_appendix();
-  const Handle method_type   = call_info.resolved_method_type();
   const bool has_appendix    = appendix.not_null();
-  const bool has_method_type = method_type.not_null();
 
   // Write the flags.
+  // MHs and indy are always sig-poly and have a local signature.
   set_method_flags(as_TosState(adapter->result_type()),
-                   ((has_appendix    ? 1 : 0) << has_appendix_shift   ) |
-                   ((has_method_type ? 1 : 0) << has_method_type_shift) |
-                   (                   1      << is_final_shift       ),
+                   ((has_appendix    ? 1 : 0) << has_appendix_shift        ) |
+                   (                   1      << has_local_signature_shift ) |
+                   (                   1      << is_final_shift            ),
                    adapter->size_of_parameters());
 
   if (TraceInvokeDynamic) {
     ttyLocker ttyl;
-    tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method_type=" PTR_FORMAT "%s method=" PTR_FORMAT " ",
+    tty->print_cr("set_method_handle bc=%d appendix=" PTR_FORMAT "%s method=" PTR_FORMAT " (local signature) ",
                   invoke_code,
-                  p2i(appendix()),    (has_appendix    ? "" : " (unused)"),
-                  p2i(method_type()), (has_method_type ? "" : " (unused)"),
+                  p2i(appendix()),
+                  (has_appendix ? "" : " (unused)"),
                   p2i(adapter()));
     adapter->print();
     if (has_appendix)  appendix()->print();
@@ -435,20 +434,12 @@
 
   // Store appendix, if any.
   if (has_appendix) {
-    const int appendix_index = f2_as_index() + _indy_resolved_references_appendix_offset;
+    const int appendix_index = f2_as_index();
     assert(appendix_index >= 0 && appendix_index < resolved_references->length(), "oob");
     assert(resolved_references->obj_at(appendix_index) == NULL, "init just once");
     resolved_references->obj_at_put(appendix_index, appendix());
   }
 
-  // Store MethodType, if any.
-  if (has_method_type) {
-    const int method_type_index = f2_as_index() + _indy_resolved_references_method_type_offset;
-    assert(method_type_index >= 0 && method_type_index < resolved_references->length(), "oob");
-    assert(resolved_references->obj_at(method_type_index) == NULL, "init just once");
-    resolved_references->obj_at_put(method_type_index, method_type());
-  }
-
   release_set_f1(adapter());  // This must be the last one to set (see NOTE above)!
 
   // The interpreter assembly code does not check byte_2,
@@ -459,6 +450,9 @@
     ttyLocker ttyl;
     this->print(tty, 0);
   }
+
+  assert(has_appendix == this->has_appendix(), "proper storage of appendix flag");
+  assert(this->has_local_signature(), "proper storage of signature flag");
 }
 
 bool ConstantPoolCacheEntry::save_and_throw_indy_exc(
@@ -544,16 +538,7 @@
 oop ConstantPoolCacheEntry::appendix_if_resolved(const constantPoolHandle& cpool) {
   if (!has_appendix())
     return NULL;
-  const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset;
-  objArrayOop resolved_references = cpool->resolved_references();
-  return resolved_references->obj_at(ref_index);
-}
-
-
-oop ConstantPoolCacheEntry::method_type_if_resolved(const constantPoolHandle& cpool) {
-  if (!has_method_type())
-    return NULL;
-  const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset;
+  const int ref_index = f2_as_index();
   objArrayOop resolved_references = cpool->resolved_references();
   return resolved_references->obj_at(ref_index);
 }
@@ -701,16 +686,7 @@
   for (int ref = 0; ref < invokedynamic_references_map.length(); ref++) {
     const int cpci = invokedynamic_references_map.at(ref);
     if (cpci >= 0) {
-#ifdef ASSERT
-      // invokedynamic and invokehandle have more entries; check if they
-      // all point to the same constant pool cache entry.
-      for (int entry = 1; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) {
-        const int cpci_next = invokedynamic_references_map.at(ref + entry);
-        assert(cpci == cpci_next, "%d == %d", cpci, cpci_next);
-      }
-#endif
       entry_at(cpci)->initialize_resolved_reference_index(ref);
-      ref += ConstantPoolCacheEntry::_indy_resolved_references_entries - 1;  // skip extra entries
     }
   }
 }
--- a/src/hotspot/share/oops/cpCache.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/oops/cpCache.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -51,7 +51,7 @@
 // _f2        [  entry specific   ]  vtable or res_ref index, or vfinal method ptr
 // _flags     [tos|0|F=1|0|0|0|f|v|0 |0000|field_index] (for field entries)
 // bit length [ 4 |1| 1 |1|1|1|1|1|1 |1     |-3-|----16-----]
-// _flags     [tos|0|F=0|M|A|I|f|0|vf|indy_rf|000|00000|psize] (for method entries)
+// _flags     [tos|0|F=0|S|A|I|f|0|vf|indy_rf|000|00000|psize] (for method entries)
 // bit length [ 4 |1| 1 |1|1|1|1|1|1 |-4--|--8--|--8--]
 
 // --------------------------------
@@ -114,7 +114,7 @@
 // _f2      = vtable/itable index (or final Method*) for virtual calls only,
 //            unused by non-virtual.  The is_vfinal flag indicates this is a
 //            method pointer for a final method, not an index.
-// _flags   = method type info (t section),
+// _flags   = has local signature (MHs and indy),
 //            virtual final bit (vfinal),
 //            parameter size (psize section)
 //
@@ -180,7 +180,7 @@
     tos_state_shift            = BitsPerInt - tos_state_bits,  // see verify_tos_state_shift below
     // misc. option bits; can be any bit position in [16..27]
     is_field_entry_shift       = 26,  // (F) is it a field or a method?
-    has_method_type_shift      = 25,  // (M) does the call site have a MethodType?
+    has_local_signature_shift  = 25,  // (S) does the call site have a per-site signature (sig-poly methods)?
     has_appendix_shift         = 24,  // (A) does the call site have an appendix argument?
     is_forced_virtual_shift    = 23,  // (I) is the interface reference forced to virtual mode?
     is_final_shift             = 22,  // (f) is the field or method final?
@@ -291,19 +291,10 @@
   bool save_and_throw_indy_exc(const constantPoolHandle& cpool, int cpool_index,
                                int index, constantTag tag, TRAPS);
 
-  // invokedynamic and invokehandle call sites have two entries in the
-  // resolved references array:
-  //   appendix   (at index+0)
-  //   MethodType (at index+1)
-  enum {
-    _indy_resolved_references_appendix_offset    = 0,
-    _indy_resolved_references_method_type_offset = 1,
-    _indy_resolved_references_entries
-  };
-
+  // invokedynamic and invokehandle call sites have an "appendix" item in the
+  // resolved references array.
   Method*      method_if_resolved(const constantPoolHandle& cpool);
   oop        appendix_if_resolved(const constantPoolHandle& cpool);
-  oop     method_type_if_resolved(const constantPoolHandle& cpool);
 
   void set_parameter_size(int value);
 
@@ -356,7 +347,7 @@
   bool is_vfinal() const                         { return (_flags & (1 << is_vfinal_shift))         != 0; }
   bool indy_resolution_failed() const;
   bool has_appendix() const;
-  bool has_method_type() const;
+  bool has_local_signature() const;
   bool is_method_entry() const                   { return (_flags & (1 << is_field_entry_shift))    == 0; }
   bool is_field_entry() const                    { return (_flags & (1 << is_field_entry_shift))    != 0; }
   bool is_long() const                           { return flag_state() == ltos; }
--- a/src/hotspot/share/oops/cpCache.inline.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/oops/cpCache.inline.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -71,8 +71,8 @@
   return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0;
 }
 
-inline bool ConstantPoolCacheEntry::has_method_type() const {
-  return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0;
+inline bool ConstantPoolCacheEntry::has_local_signature() const {
+  return (!is_f1_null()) && (_flags & (1 << has_local_signature_shift)) != 0;
 }
 
 inline intx ConstantPoolCacheEntry::flags_ord() const   { return (intx)OrderAccess::load_acquire(&_flags); }
--- a/src/hotspot/share/oops/instanceKlass.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -75,6 +75,7 @@
 #include "services/classLoadingService.hpp"
 #include "services/threadService.hpp"
 #include "utilities/dtrace.hpp"
+#include "utilities/events.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/stringUtils.hpp"
 #ifdef COMPILER1
@@ -2447,6 +2448,13 @@
   // notify ClassLoadingService of class unload
   ClassLoadingService::notify_class_unloaded(ik);
 
+  if (log_is_enabled(Info, class, unload)) {
+    ResourceMark rm;
+    log_info(class, unload)("unloading class %s " INTPTR_FORMAT, ik->external_name(), p2i(ik));
+  }
+
+  Events::log_class_unloading(Thread::current(), ik);
+
 #if INCLUDE_JFR
   assert(ik != NULL, "invariant");
   EventClassUnload event;
--- a/src/hotspot/share/oops/symbol.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/oops/symbol.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -131,19 +131,6 @@
   return as_C_string(str, len + 1);
 }
 
-char* Symbol::as_C_string_flexible_buffer(Thread* t,
-                                                 char* buf, int size) const {
-  char* str;
-  int len = utf8_length();
-  int buf_len = len + 1;
-  if (size < buf_len) {
-    str = NEW_RESOURCE_ARRAY(char, buf_len);
-  } else {
-    str = buf;
-  }
-  return as_C_string(str, buf_len);
-}
-
 void Symbol::print_utf8_on(outputStream* st) const {
   st->print("%s", as_C_string());
 }
--- a/src/hotspot/share/oops/symbol.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/oops/symbol.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -104,7 +104,6 @@
 class Symbol : public MetaspaceObj {
   friend class VMStructs;
   friend class SymbolTable;
-  friend class MoveSymbols;
 
  private:
 
@@ -136,7 +135,6 @@
   Symbol(const u1* name, int length, int refcount);
   void* operator new(size_t size, int len, TRAPS) throw();
   void* operator new(size_t size, int len, Arena* arena, TRAPS) throw();
-  void* operator new(size_t size, int len, ClassLoaderData* loader_data, TRAPS) throw();
 
   void  operator delete(void* p);
 
@@ -207,9 +205,6 @@
 
   // Tests if the symbol starts with the given prefix.
   int index_of_at(int i, const char* str, int len) const;
-  int index_of_at(int i, const char* str) const {
-    return index_of_at(i, str, (int) strlen(str));
-  }
 
   // Three-way compare for sorting; returns -1/0/1 if receiver is </==/> than arg
   // note that the ordering is not alfabetical
@@ -219,17 +214,12 @@
   // allocated in resource area, or in the char buffer provided by caller.
   char* as_C_string() const;
   char* as_C_string(char* buf, int size) const;
-  // Use buf if needed buffer length is <= size.
-  char* as_C_string_flexible_buffer(Thread* t, char* buf, int size) const;
 
   // Returns an escaped form of a Java string.
   char* as_quoted_ascii() const;
 
   // Returns a null terminated utf8 string in a resource array
   char* as_utf8() const { return as_C_string(); }
-  char* as_utf8_flexible_buffer(Thread* t, char* buf, int size) const {
-    return as_C_string_flexible_buffer(t, buf, size);
-  }
 
   jchar* as_unicode(int& length) const;
 
--- a/src/hotspot/share/opto/c2_globals.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/opto/c2_globals.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -509,9 +509,6 @@
   product(bool, EliminateAutoBox, true,                                     \
           "Control optimizations for autobox elimination")                  \
                                                                             \
-  diagnostic(bool, UseImplicitStableValues, true,                           \
-          "Mark well-known stable fields as such (e.g. String.value)")      \
-                                                                            \
   product(intx, AutoBoxCacheMax, 128,                                       \
           "Sets max value cached by the java.lang.Integer autobox cache")   \
           range(0, max_jint)                                                \
--- a/src/hotspot/share/opto/graphKit.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/opto/graphKit.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3886,10 +3886,6 @@
   Node* p = basic_plus_adr(str, str, value_offset);
   Node* load = access_load_at(str, p, value_field_type, value_type, T_OBJECT,
                               IN_HEAP | (set_ctrl ? C2_CONTROL_DEPENDENT_LOAD : 0) | MO_UNORDERED);
-  // String.value field is known to be @Stable.
-  if (UseImplicitStableValues) {
-    load = cast_array_to_stable(load, value_type);
-  }
   return load;
 }
 
@@ -3901,7 +3897,6 @@
   const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
                                                      false, NULL, 0);
   const TypePtr* coder_field_type = string_type->add_offset(coder_offset);
-  int coder_field_idx = C->get_alias_index(coder_field_type);
 
   Node* p = basic_plus_adr(str, str, coder_offset);
   Node* load = access_load_at(str, p, coder_field_type, TypeInt::BYTE, T_BYTE,
@@ -4039,9 +4034,3 @@
   }
   return NULL;
 }
-
-Node* GraphKit::cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type) {
-  // Reify the property as a CastPP node in Ideal graph to comply with monotonicity
-  // assumption of CCP analysis.
-  return _gvn.transform(new CastPPNode(ary, ary_type->cast_to_stable(true)));
-}
--- a/src/hotspot/share/opto/graphKit.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/opto/graphKit.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -884,9 +884,6 @@
   void add_predicate_impl(Deoptimization::DeoptReason reason, int nargs);
 
   Node* make_constant_from_field(ciField* field, Node* obj);
-
-  // Produce new array node of stable type
-  Node* cast_array_to_stable(Node* ary, const TypeAryPtr* ary_type);
 };
 
 // Helper class to support building of control flow branches. Upon
--- a/src/hotspot/share/opto/reg_split.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/opto/reg_split.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1192,9 +1192,8 @@
               (deflrg._direct_conflict || deflrg._must_spill)) ||
              // Check for LRG being up in a register and we are inside a high
              // pressure area.  Spill it down immediately.
-             (defup && is_high_pressure(b,&deflrg,insidx))) ) {
+             (defup && is_high_pressure(b,&deflrg,insidx) && !n->is_SpillCopy())) ) {
           assert( !n->rematerialize(), "" );
-          assert( !n->is_SpillCopy(), "" );
           // Do a split at the def site.
           maxlrg = split_DEF( n, b, insidx, maxlrg, Reachblock, debug_defs, splits, slidx );
           // If it wasn't split bail
--- a/src/hotspot/share/prims/jniCheck.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/prims/jniCheck.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -418,21 +418,20 @@
   size_t sz;
   void* orig_result = check_wrapped_array(thr, fn_name, obj, carray, &sz);
   switch (mode) {
+  // As we never make copies, mode 0 and JNI_COMMIT are the same.
   case 0:
-    memcpy(orig_result, carray, sz);
-    GuardedMemory::free_copy(carray);
-    break;
   case JNI_COMMIT:
     memcpy(orig_result, carray, sz);
     break;
   case JNI_ABORT:
-    GuardedMemory::free_copy(carray);
     break;
   default:
     tty->print_cr("%s: Unrecognized mode %i releasing array "
         PTR_FORMAT " elements " PTR_FORMAT, fn_name, mode, p2i(obj), p2i(carray));
     NativeReportJNIFatalError(thr, "Unrecognized array release mode");
   }
+  // We always need to release the copy we made with GuardedMemory
+  GuardedMemory::free_copy(carray);
   return orig_result;
 }
 
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -512,11 +512,11 @@
     case JVM_CONSTANT_InvokeDynamic:
     {
       // Index of the bootstrap specifier in the operands array
-      int old_bs_i = scratch_cp->invoke_dynamic_bootstrap_specifier_index(scratch_i);
+      int old_bs_i = scratch_cp->bootstrap_methods_attribute_index(scratch_i);
       int new_bs_i = find_or_append_operand(scratch_cp, old_bs_i, merge_cp_p,
                                             merge_cp_length_p, THREAD);
       // The bootstrap method NameAndType_info index
-      int old_ref_i = scratch_cp->invoke_dynamic_name_and_type_ref_index_at(scratch_i);
+      int old_ref_i = scratch_cp->bootstrap_name_and_type_ref_index_at(scratch_i);
       int new_ref_i = find_or_append_indirect_entry(scratch_cp, old_ref_i, merge_cp_p,
                                                     merge_cp_length_p, THREAD);
       if (new_bs_i != old_bs_i) {
--- a/src/hotspot/share/prims/methodComparator.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/prims/methodComparator.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -123,17 +123,17 @@
 
     int cpi_old = _old_cp->cache()->entry_at(cpci_old)->constant_pool_index();
     int cpi_new = _new_cp->cache()->entry_at(cpci_new)->constant_pool_index();
-    int bsm_old = _old_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_old);
-    int bsm_new = _new_cp->invoke_dynamic_bootstrap_method_ref_index_at(cpi_new);
+    int bsm_old = _old_cp->bootstrap_method_ref_index_at(cpi_old);
+    int bsm_new = _new_cp->bootstrap_method_ref_index_at(cpi_new);
     if (!pool_constants_same(bsm_old, bsm_new))
       return false;
-    int cnt_old = _old_cp->invoke_dynamic_argument_count_at(cpi_old);
-    int cnt_new = _new_cp->invoke_dynamic_argument_count_at(cpi_new);
+    int cnt_old = _old_cp->bootstrap_argument_count_at(cpi_old);
+    int cnt_new = _new_cp->bootstrap_argument_count_at(cpi_new);
     if (cnt_old != cnt_new)
       return false;
     for (int arg_i = 0; arg_i < cnt_old; arg_i++) {
-      int idx_old = _old_cp->invoke_dynamic_argument_index_at(cpi_old, arg_i);
-      int idx_new = _new_cp->invoke_dynamic_argument_index_at(cpi_new, arg_i);
+      int idx_old = _old_cp->bootstrap_argument_index_at(cpi_old, arg_i);
+      int idx_new = _new_cp->bootstrap_argument_index_at(cpi_new, arg_i);
       if (!pool_constants_same(idx_old, idx_new))
         return false;
     }
--- a/src/hotspot/share/prims/methodHandles.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/prims/methodHandles.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1427,7 +1427,7 @@
   if (bss_index_in_pool <= 0 ||
       bss_index_in_pool >= caller->constants()->length() ||
       index_info->int_at(0)
-      != caller->constants()->invoke_dynamic_argument_count_at(bss_index_in_pool)) {
+      != caller->constants()->bootstrap_argument_count_at(bss_index_in_pool)) {
       THROW_MSG(vmSymbols::java_lang_InternalError(), "bad index info (1)");
   }
   objArrayHandle buf(THREAD, (objArrayOop) JNIHandles::resolve(buf_jh));
@@ -1439,7 +1439,7 @@
         switch (pseudo_index) {
         case -4:  // bootstrap method
           {
-            int bsm_index = caller->constants()->invoke_dynamic_bootstrap_method_ref_index_at(bss_index_in_pool);
+            int bsm_index = caller->constants()->bootstrap_method_ref_index_at(bss_index_in_pool);
             pseudo_arg = caller->constants()->resolve_possibly_cached_constant_at(bsm_index, CHECK);
             break;
           }
@@ -1464,7 +1464,7 @@
           }
         case -1:  // argument count
           {
-            int argc = caller->constants()->invoke_dynamic_argument_count_at(bss_index_in_pool);
+            int argc = caller->constants()->bootstrap_argument_count_at(bss_index_in_pool);
             jvalue argc_value; argc_value.i = (jint)argc;
             pseudo_arg = java_lang_boxing_object::create(T_INT, &argc_value, CHECK);
             break;
--- a/src/hotspot/share/prims/whitebox.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/prims/whitebox.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -694,6 +694,13 @@
   return (jlong)(uintptr_t)os::malloc(size, mtTest, stack);
 WB_END
 
+// Alloc memory with pseudo call stack and specific memory type.
+WB_ENTRY(jlong, WB_NMTMallocWithPseudoStackAndType(JNIEnv* env, jobject o, jlong size, jint pseudo_stack, jint type))
+  address pc = (address)(size_t)pseudo_stack;
+  NativeCallStack stack(&pc, 1);
+  return (jlong)(uintptr_t)os::malloc(size, (MEMFLAGS)type, stack);
+WB_END
+
 // Free the memory allocated by NMTAllocTest
 WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem))
   os::free((void*)(uintptr_t)mem);
@@ -1537,9 +1544,6 @@
       blobs.append(stub);
     }
   }
-  if (blobs.length() == 0) {
-    return NULL;
-  }
   ThreadToNativeFromVM ttn(thread);
   jobjectArray result = NULL;
   jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
@@ -2161,6 +2165,7 @@
 #if INCLUDE_NMT
   {CC"NMTMalloc",           CC"(J)J",                 (void*)&WB_NMTMalloc          },
   {CC"NMTMallocWithPseudoStack", CC"(JI)J",           (void*)&WB_NMTMallocWithPseudoStack},
+  {CC"NMTMallocWithPseudoStackAndType", CC"(JII)J",   (void*)&WB_NMTMallocWithPseudoStackAndType},
   {CC"NMTFree",             CC"(J)V",                 (void*)&WB_NMTFree            },
   {CC"NMTReserveMemory",    CC"(J)J",                 (void*)&WB_NMTReserveMemory   },
   {CC"NMTAttemptReserveMemoryAt",    CC"(JJ)J",       (void*)&WB_NMTAttemptReserveMemoryAt },
--- a/src/hotspot/share/runtime/arguments.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -528,6 +528,7 @@
   { "MinRAMFraction",               JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "InitialRAMFraction",           JDK_Version::jdk(10),  JDK_Version::undefined(), JDK_Version::undefined() },
   { "UseMembar",                    JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() },
+  { "CompilationPolicyChoice",      JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
 
   // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
   { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
@@ -541,6 +542,17 @@
   { "SharedReadOnlySize",            JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
   { "SharedMiscDataSize",            JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
   { "SharedMiscCodeSize",            JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
+  { "ProfilerPrintByteCodeStatistics", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfilerRecordPC",              JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfileVM",                     JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfileIntervals",              JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfileIntervalsTicks",         JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfilerCheckIntervals",        JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfilerNumberOfInterpretedMethods", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfilerNumberOfCompiledMethods", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfilerNumberOfStubMethods",   JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "ProfilerNumberOfRuntimeStubNodes", JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
+  { "UseImplicitStableValues",       JDK_Version::undefined(), JDK_Version::jdk(13), JDK_Version::jdk(14) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
@@ -3784,8 +3796,8 @@
 #endif
 
 #if defined(AIX)
-  UNSUPPORTED_OPTION(AllocateHeapAt);
-  UNSUPPORTED_OPTION(AllocateOldGenAt);
+  UNSUPPORTED_OPTION_NULL(AllocateHeapAt);
+  UNSUPPORTED_OPTION_NULL(AllocateOldGenAt);
 #endif
 
 #ifndef PRODUCT
--- a/src/hotspot/share/runtime/arguments.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/runtime/arguments.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -663,4 +663,16 @@
   }                                                      \
 } while(0)
 
+// similar to UNSUPPORTED_OPTION but sets flag to NULL
+#define UNSUPPORTED_OPTION_NULL(opt)                     \
+do {                                                     \
+  if (opt) {                                             \
+    if (FLAG_IS_CMDLINE(opt)) {                          \
+      warning("-XX flag " #opt " not supported in this VM"); \
+    }                                                    \
+    FLAG_SET_DEFAULT(opt, NULL);                         \
+  }                                                      \
+} while(0)
+
+
 #endif // SHARE_RUNTIME_ARGUMENTS_HPP
--- a/src/hotspot/share/runtime/globals.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/runtime/globals.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -749,22 +749,6 @@
   product(bool, OmitStackTraceInFastThrow, true,                            \
           "Omit backtraces for some 'hot' exceptions in optimized code")    \
                                                                             \
-  product(bool, ProfilerPrintByteCodeStatistics, false,                     \
-          "Print bytecode statistics when dumping profiler output")         \
-                                                                            \
-  product(bool, ProfilerRecordPC, false,                                    \
-          "Collect ticks for each 16 byte interval of compiled code")       \
-                                                                            \
-  product(bool, ProfileVM, false,                                           \
-          "Profile ticks that fall within VM (either in the VM Thread "     \
-          "or VM code called through stubs)")                               \
-                                                                            \
-  product(bool, ProfileIntervals, false,                                    \
-          "Print profiles for each interval (see ProfileIntervalsTicks)")   \
-                                                                            \
-  notproduct(bool, ProfilerCheckIntervals, false,                           \
-          "Collect and print information on spacing of profiler ticks")     \
-                                                                            \
   product(bool, PrintWarnings, true,                                        \
           "Print JVM warnings to output stream")                            \
                                                                             \
@@ -1650,23 +1634,6 @@
   develop(intx, MethodHistogramCutoff, 100,                                 \
           "The cutoff value for method invocation histogram (+CountCalls)") \
                                                                             \
-  diagnostic(intx, ProfilerNumberOfInterpretedMethods, 25,                  \
-          "Number of interpreted methods to show in profile")               \
-                                                                            \
-  diagnostic(intx, ProfilerNumberOfCompiledMethods, 25,                     \
-          "Number of compiled methods to show in profile")                  \
-                                                                            \
-  diagnostic(intx, ProfilerNumberOfStubMethods, 25,                         \
-          "Number of stub methods to show in profile")                      \
-                                                                            \
-  diagnostic(intx, ProfilerNumberOfRuntimeStubNodes, 25,                    \
-          "Number of runtime stub nodes to show in profile")                \
-                                                                            \
-  product(intx, ProfileIntervalsTicks, 100,                                 \
-          "Number of ticks between printing of interval profile "           \
-          "(+ProfileIntervals)")                                            \
-          range(0, max_intx)                                                \
-                                                                            \
   develop(intx, DontYieldALotInterval,    10,                               \
           "Interval between which yields will be dropped (milliseconds)")   \
                                                                             \
--- a/src/hotspot/share/runtime/java.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/runtime/java.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -291,9 +291,6 @@
   if (TimeOopMap) {
     GenerateOopMap::print_time();
   }
-  if (ProfilerCheckIntervals) {
-    PeriodicTask::print_intervals();
-  }
   if (PrintSymbolTableSizeHistogram) {
     SymbolTable::print_histogram();
   }
--- a/src/hotspot/share/runtime/task.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/runtime/task.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -31,48 +31,20 @@
 
 int PeriodicTask::_num_tasks = 0;
 PeriodicTask* PeriodicTask::_tasks[PeriodicTask::max_tasks];
-#ifndef PRODUCT
-elapsedTimer PeriodicTask::_timer;
-int PeriodicTask::_intervalHistogram[PeriodicTask::max_interval];
-int PeriodicTask::_ticks;
-
-void PeriodicTask::print_intervals() {
-  if (ProfilerCheckIntervals) {
-    for (int i = 0; i < PeriodicTask::max_interval; i++) {
-      int n = _intervalHistogram[i];
-      if (n > 0) tty->print_cr("%3d: %5d (%4.1f%%)", i, n, 100.0 * n / _ticks);
-    }
-  }
-}
-#endif
 
 void PeriodicTask::real_time_tick(int delay_time) {
   assert(Thread::current()->is_Watcher_thread(), "must be WatcherThread");
 
-#ifndef PRODUCT
-  if (ProfilerCheckIntervals) {
-    _ticks++;
-    _timer.stop();
-    int ms = (int)_timer.milliseconds();
-    _timer.reset();
-    _timer.start();
-    if (ms >= PeriodicTask::max_interval) ms = PeriodicTask::max_interval - 1;
-    _intervalHistogram[ms]++;
-  }
-#endif
+  // The WatcherThread does not participate in the safepoint protocol
+  // for the PeriodicTask_lock because it is not a JavaThread.
+  MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
+  int orig_num_tasks = _num_tasks;
 
-  {
-    // The WatcherThread does not participate in the safepoint protocol
-    // for the PeriodicTask_lock because it is not a JavaThread.
-    MutexLockerEx ml(PeriodicTask_lock, Mutex::_no_safepoint_check_flag);
-    int orig_num_tasks = _num_tasks;
-
-    for(int index = 0; index < _num_tasks; index++) {
-      _tasks[index]->execute_if_pending(delay_time);
-      if (_num_tasks < orig_num_tasks) { // task dis-enrolled itself
-        index--;  // re-do current slot as it has changed
-        orig_num_tasks = _num_tasks;
-      }
+  for(int index = 0; index < _num_tasks; index++) {
+    _tasks[index]->execute_if_pending(delay_time);
+    if (_num_tasks < orig_num_tasks) { // task dis-enrolled itself
+      index--;  // re-do current slot as it has changed
+      orig_num_tasks = _num_tasks;
     }
   }
 }
--- a/src/hotspot/share/runtime/task.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/runtime/task.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -58,13 +58,6 @@
   // Can only be called by the WatcherThread
   static void real_time_tick(int delay_time);
 
-#ifndef PRODUCT
-  static elapsedTimer _timer;                      // measures time between ticks
-  static int _ticks;                               // total number of ticks
-  static int _intervalHistogram[max_interval];     // to check spacing of timer interrupts
- public:
-  static void print_intervals();
-#endif
   // Only the WatcherThread can cause us to execute PeriodicTasks
   friend class WatcherThread;
  public:
--- a/src/hotspot/share/runtime/vm_version.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/runtime/vm_version.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -230,13 +230,7 @@
         #define HOTSPOT_BUILD_COMPILER "unknown MS VC++:" XSTR(_MSC_VER)
       #endif
     #elif defined(__SUNPRO_CC)
-      #if   __SUNPRO_CC == 0x420
-        #define HOTSPOT_BUILD_COMPILER "Workshop 4.2"
-      #elif __SUNPRO_CC == 0x500
-        #define HOTSPOT_BUILD_COMPILER "Workshop 5.0 compat=" XSTR(__SUNPRO_CC_COMPAT)
-      #elif __SUNPRO_CC == 0x520
-        #define HOTSPOT_BUILD_COMPILER "Workshop 5.2 compat=" XSTR(__SUNPRO_CC_COMPAT)
-      #elif __SUNPRO_CC == 0x580
+      #if __SUNPRO_CC == 0x580
         #define HOTSPOT_BUILD_COMPILER "Workshop 5.8"
       #elif __SUNPRO_CC == 0x590
         #define HOTSPOT_BUILD_COMPILER "Workshop 5.9"
@@ -249,6 +243,8 @@
       #else
         #define HOTSPOT_BUILD_COMPILER "unknown Workshop:" XSTR(__SUNPRO_CC)
       #endif
+    #elif defined(__clang_version__)
+        #define HOTSPOT_BUILD_COMPILER "clang " __VERSION__
     #elif defined(__GNUC__)
         #define HOTSPOT_BUILD_COMPILER "gcc " __VERSION__
     #elif defined(__IBMCPP__)
--- a/src/hotspot/share/services/classLoadingService.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/services/classLoadingService.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -137,11 +137,6 @@
       _class_methods_size->inc(-methods->at(i)->size());
     }
   }
-
-  if (log_is_enabled(Info, class, unload)) {
-    ResourceMark rm;
-    log_info(class, unload)("unloading class %s " INTPTR_FORMAT , k->external_name(), p2i(k));
-  }
 }
 
 void ClassLoadingService::notify_class_loaded(InstanceKlass* k, bool shared_class) {
--- a/src/hotspot/share/services/memReporter.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/services/memReporter.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -704,9 +704,15 @@
 
 void MemDetailDiffReporter::diff_malloc_site(const MallocSite* early,
   const MallocSite* current)  const {
-  assert(early->flag() == current->flag(), "Must be the same memory type");
-  diff_malloc_site(current->call_stack(), current->size(), current->count(),
-    early->size(), early->count(), early->flag());
+  if (early->flag() != current->flag()) {
+    // If malloc site type changed, treat it as deallocation of old type and
+    // allocation of new type.
+    old_malloc_site(early);
+    new_malloc_site(current);
+  } else {
+    diff_malloc_site(current->call_stack(), current->size(), current->count(),
+      early->size(), early->count(), early->flag());
+  }
 }
 
 void MemDetailDiffReporter::diff_malloc_site(const NativeCallStack* stack, size_t current_size,
--- a/src/hotspot/share/utilities/constantTag.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/constantTag.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -100,6 +100,12 @@
   bool is_dynamic_constant() const  { return _tag == JVM_CONSTANT_Dynamic; }
   bool is_invoke_dynamic() const    { return _tag == JVM_CONSTANT_InvokeDynamic; }
 
+  bool has_bootstrap() const {
+    return (_tag == JVM_CONSTANT_Dynamic ||
+            _tag == JVM_CONSTANT_DynamicInError ||
+            _tag == JVM_CONSTANT_InvokeDynamic);
+  }
+
   bool is_loadable_constant() const {
     return ((_tag >= JVM_CONSTANT_Integer && _tag <= JVM_CONSTANT_String) ||
             is_method_type() || is_method_handle() || is_dynamic_constant() ||
--- a/src/hotspot/share/utilities/debug.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/debug.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -61,6 +61,7 @@
 #include "utilities/vmError.hpp"
 
 #include <stdio.h>
+#include <stdarg.h>
 
 // Support for showing register content on asserts/guarantees.
 #ifdef CAN_SHOW_REGISTERS_ON_ASSERT
@@ -244,6 +245,22 @@
     context = g_assertion_context;
   }
 #endif // CAN_SHOW_REGISTERS_ON_ASSERT
+
+#ifdef ASSERT
+  if (detail_fmt != NULL && ExecutingUnitTests) {
+    // Special handling for the sake of gtest death tests which expect the assert
+    // message to be printed in one short line to stderr (see TEST_VM_ASSERT_MSG) and
+    // cannot be tweaked to accept our normal assert message.
+    va_list detail_args_copy;
+    va_copy(detail_args_copy, detail_args);
+    ::fputs("assert failed: ", stderr);
+    ::vfprintf(stderr, detail_fmt, detail_args_copy);
+    ::fputs("\n", stderr);
+    ::fflush(stderr);
+    va_end(detail_args_copy);
+  }
+#endif
+
   VMError::report_and_die(Thread::current_or_null(), context, file, line, error_msg, detail_fmt, detail_args);
   va_end(detail_args);
 }
@@ -293,21 +310,6 @@
   report_vm_error(file, line, "Unimplemented()");
 }
 
-#ifdef ASSERT
-bool is_executing_unit_tests() {
-  return ExecutingUnitTests;
-}
-
-void report_assert_msg(const char* msg, ...) {
-  va_list ap;
-  va_start(ap, msg);
-
-  fprintf(stderr, "assert failed: %s\n", err_msg(FormatBufferDummy(), msg, ap).buffer());
-
-  va_end(ap);
-}
-#endif // ASSERT
-
 void report_untested(const char* file, int line, const char* message) {
 #ifndef PRODUCT
   warning("Untested: %s in %s: %d\n", message, file, line);
--- a/src/hotspot/share/utilities/debug.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/debug.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -54,9 +54,6 @@
 do {                                                                           \
   if (!(p)) {                                                                  \
     TOUCH_ASSERT_POISON;                                                       \
-    if (is_executing_unit_tests()) {                                           \
-      report_assert_msg(__VA_ARGS__);                                          \
-    }                                                                          \
     report_vm_error(__FILE__, __LINE__, "assert(" #p ") failed", __VA_ARGS__); \
     BREAKPOINT;                                                                \
   }                                                                            \
@@ -157,16 +154,10 @@
 // ATTRIBUTE_PRINTF works with gcc >= 4.8 and any other compiler.
 void report_vm_error(const char* file, int line, const char* error_msg,
                      const char* detail_fmt, ...) ATTRIBUTE_PRINTF(4, 5);
-#ifdef ASSERT
-void report_assert_msg(const char* msg, ...) ATTRIBUTE_PRINTF(1, 2);
-#endif // ASSERT
 #else
 // GCC < 4.8 warns because of empty format string.  Warning can not be switched off selectively.
 void report_vm_error(const char* file, int line, const char* error_msg,
                      const char* detail_fmt, ...);
-#ifdef ASSERT
-void report_assert_msg(const char* msg, ...);
-#endif // ASSERT
 #endif
 void report_vm_status_error(const char* file, int line, const char* error_msg,
                             int status, const char* detail);
@@ -178,11 +169,6 @@
 void report_unimplemented(const char* file, int line);
 void report_untested(const char* file, int line, const char* message);
 
-#ifdef ASSERT
-// unit test support
-bool is_executing_unit_tests();
-#endif // ASSERT
-
 void warning(const char* format, ...) ATTRIBUTE_PRINTF(1, 2);
 
 // Compile-time asserts.  Cond must be a compile-time constant expression that
--- a/src/hotspot/share/utilities/events.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/events.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "memory/allocation.inline.hpp"
+#include "oops/instanceKlass.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/osThread.hpp"
@@ -37,6 +38,7 @@
 StringEventLog* Events::_messages = NULL;
 StringEventLog* Events::_exceptions = NULL;
 StringEventLog* Events::_redefinitions = NULL;
+UnloadingEventLog* Events::_class_unloading = NULL;
 StringEventLog* Events::_deopt_messages = NULL;
 
 EventLog::EventLog() {
@@ -67,6 +69,7 @@
     _messages = new StringEventLog("Events");
     _exceptions = new StringEventLog("Internal exceptions");
     _redefinitions = new StringEventLog("Classes redefined");
+    _class_unloading = new UnloadingEventLog("Classes unloaded");
     _deopt_messages = new StringEventLog("Deoptimization events");
   }
 }
@@ -96,3 +99,16 @@
     Events::log(NULL, "%s", _buffer.buffer());
   }
 }
+
+void UnloadingEventLog::log(Thread* thread, InstanceKlass* ik) {
+  if (!should_log()) return;
+
+  double timestamp = fetch_timestamp();
+  // Unloading events are single threaded.
+  int index = compute_log_index();
+  _records[index].thread = thread;
+  _records[index].timestamp = timestamp;
+  stringStream st = _records[index].data.stream();
+  st.print("Unloading class " INTPTR_FORMAT " ", p2i(ik));
+  ik->name()->print_value_on(&st);
+}
--- a/src/hotspot/share/utilities/events.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/events.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -165,9 +165,17 @@
     logv(thread, format, ap);
     va_end(ap);
   }
-
 };
 
+class InstanceKlass;
+
+// Event log for class unloading events to materialize the class name in place in the log stream.
+class UnloadingEventLog : public EventLogBase<StringLogMessage> {
+ public:
+  UnloadingEventLog(const char* name, int count = LogEventsBufferEntries) : EventLogBase<StringLogMessage>(name, count) {}
+
+  void log(Thread* thread, InstanceKlass* ik);
+};
 
 
 class Events : AllStatic {
@@ -189,6 +197,8 @@
   // Redefinition related messages
   static StringEventLog* _redefinitions;
 
+  // Class unloading events
+  static UnloadingEventLog* _class_unloading;
  public:
   static void print_all(outputStream* out);
 
@@ -203,6 +213,8 @@
 
   static void log_redefinition(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
+  static void log_class_unloading(Thread* thread, InstanceKlass* ik);
+
   static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
 
   // Register default loggers
@@ -236,6 +248,12 @@
   }
 }
 
+inline void Events::log_class_unloading(Thread* thread, InstanceKlass* ik) {
+  if (LogEvents) {
+    _class_unloading->log(thread, ik);
+  }
+}
+
 inline void Events::log_deopt_message(Thread* thread, const char* format, ...) {
   if (LogEvents) {
     va_list ap;
--- a/src/hotspot/share/utilities/exceptions.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/exceptions.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -411,7 +411,7 @@
       // Pass through an Error, including BootstrapMethodError, any other form
       // of linkage error, or say ThreadDeath/OutOfMemoryError
       if (TraceMethodHandles) {
-        tty->print_cr("[constant/invoke]dynamic passes through an Error for " INTPTR_FORMAT, p2i((void *)exception));
+        tty->print_cr("bootstrap method invocation wraps BSME around " INTPTR_FORMAT, p2i((void *)exception));
         exception->print();
       }
       return;
--- a/src/hotspot/share/utilities/globalDefinitions_xlc.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/globalDefinitions_xlc.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 2019 SAP SE. 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
@@ -51,51 +51,43 @@
 
 #include <stdint.h>
 
+// __IBMCPP__ is not defined any more with xlclang++
+#ifdef __IBMCPP__
+#if __IBMCPP__ < 1200
+#error "xlc < 12 not supported"
+#endif
+#endif
+
+#ifndef _AIX
+#error "missing AIX-specific definition _AIX"
+#endif
+
 // Use XLC compiler builtins instead of inline assembler
 #define USE_XLC_BUILTINS
+
 #ifdef USE_XLC_BUILTINS
 #include <builtins.h>
-  #if __IBMCPP__ < 1000
-  // the funtion prototype for __dcbtst(void *) is missing in XLC V8.0
-  // I could compile a little test, where I provided the prototype.
-  // The generated code was correct there. This is the prototype:
-  // extern "builtin" void __dcbtst (void *);
-  // For now we don't make use of it when compiling with XLC V8.0
-  #else
-  // __IBMCPP__ >= 1000
-  // XLC V10 provides the prototype for __dcbtst (void *);
-  #define USE_XLC_PREFETCH_WRITE_BUILTIN
-  #endif
+// XLC V10 and higher provide the prototype for __dcbtst (void *);
 #endif // USE_XLC_BUILTINS
 
 // NULL vs NULL_WORD:
-// On Linux NULL is defined as a special type '__null'. Assigning __null to
-// integer variable will cause gcc warning. Use NULL_WORD in places where a
-// pointer is stored as integer value.  On some platforms, sizeof(intptr_t) >
-// sizeof(void*), so here we want something which is integer type, but has the
-// same size as a pointer.
-#ifdef __GNUC__
-  #error XLC and __GNUC__?
-#else
-  #define NULL_WORD  NULL
-#endif
+// Some platform/tool-chain combinations can't assign NULL to an integer
+// type so we define NULL_WORD to use in those contexts. For xlc they are the same.
+#define NULL_WORD  NULL
 
 // AIX also needs a 64 bit NULL to work as a null address pointer.
 // Most system includes on AIX would define it as an int 0 if not already defined with one
 // exception: /usr/include/dirent.h will unconditionally redefine NULL to int 0 again.
 // In this case you need to copy the following defines to a position after #include <dirent.h>
-// (see jmv_aix.h).
-#ifdef AIX
-  #include <dirent.h>
-  #ifdef _LP64
-    #undef NULL
-    #define NULL 0L
-  #else
-    #ifndef NULL
-      #define NULL 0
-    #endif
+#include <dirent.h>
+#ifdef _LP64
+  #undef NULL
+  #define NULL 0L
+#else
+  #ifndef NULL
+    #define NULL 0
   #endif
-#endif // AIX
+#endif
 
 // Compiler-specific primitive types
 // All defs of int (uint16_6 etc) are defined in AIX' /usr/include/stdint.h
@@ -108,21 +100,14 @@
 typedef uint64_t julong;
 
 // checking for nanness
-#ifdef AIX
 inline int g_isnan(float  f) { return isnan(f); }
 inline int g_isnan(double f) { return isnan(f); }
-#else
-#error "missing platform-specific definition here"
-#endif
 
 // Checking for finiteness
-
 inline int g_isfinite(jfloat  f)                 { return finite(f); }
 inline int g_isfinite(jdouble f)                 { return finite(f); }
 
-
 // Wide characters
-
 inline int wcslen(const jchar* x) { return wcslen((const wchar_t*)x); }
 
 
--- a/src/hotspot/share/utilities/utf8.cpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/utf8.cpp	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -228,7 +228,9 @@
   *p = '\0';
 }
 
-
+#ifndef PRODUCT
+// converts a quoted ascii string back to utf8
+// no longer used, but could be useful to test output of UTF8::as_quoted_ascii
 const char* UTF8::from_quoted_ascii(const char* quoted_ascii_str) {
   const char *ptr = quoted_ascii_str;
   char* result = NULL;
@@ -302,7 +304,7 @@
   }
   return buffer;
 }
-
+#endif // !PRODUCT
 
 // Returns NULL if 'c' it not found. This only works as long
 // as 'c' is an ASCII character
@@ -468,7 +470,6 @@
 
 char* UNICODE::as_utf8(const jbyte* base, int length, char* buf, int buflen) {
   u_char* p = (u_char*)buf;
-  u_char* end = (u_char*)buf + buflen;
   for (int index = 0; index < length; index++) {
     jbyte c = base[index];
     int sz = utf8_size(c);
--- a/src/hotspot/share/utilities/utf8.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/hotspot/share/utilities/utf8.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -54,9 +54,11 @@
   // converts a utf8 string to quoted ascii
   static void as_quoted_ascii(const char* utf8_str, int utf8_length, char* buf, int buflen);
 
+#ifndef PRODUCT
   // converts a quoted ascii string to utf8 string.  returns the original
   // string unchanged if nothing needs to be done.
   static const char* from_quoted_ascii(const char* quoted_ascii_string);
+#endif
 
   // decodes the current utf8 character, stores the result in value,
   // and returns the end of the current utf8 chararacter.
--- a/src/java.base/aix/native/libnet/aix_close.c	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/aix/native/libnet/aix_close.c	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016, 2017, SAP SE and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -429,10 +429,6 @@
     BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) );
 }
 
-int NET_WriteV(int s, const struct iovec * vector, int count) {
-    BLOCKING_IO_RETURN_INT( s, writev(s, vector, count) );
-}
-
 int NET_SendTo(int s, const void *msg, int len,  unsigned  int
        flags, const struct sockaddr *to, int tolen) {
     BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) );
--- a/src/java.base/linux/native/libnet/linux_close.c	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/linux/native/libnet/linux_close.c	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -386,10 +386,6 @@
     BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) );
 }
 
-int NET_WriteV(int s, const struct iovec * vector, int count) {
-    BLOCKING_IO_RETURN_INT( s, writev(s, vector, count) );
-}
-
 int NET_SendTo(int s, const void *msg, int len,  unsigned  int
        flags, const struct sockaddr *to, int tolen) {
     BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) );
--- a/src/java.base/macosx/native/libnet/bsd_close.c	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/macosx/native/libnet/bsd_close.c	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -390,10 +390,6 @@
     BLOCKING_IO_RETURN_INT( s, send(s, msg, len, flags) );
 }
 
-int NET_WriteV(int s, const struct iovec * vector, int count) {
-    BLOCKING_IO_RETURN_INT( s, writev(s, vector, count) );
-}
-
 int NET_SendTo(int s, const void *msg, int len,  unsigned  int
        flags, const struct sockaddr *to, int tolen) {
     BLOCKING_IO_RETURN_INT( s, sendto(s, msg, len, flags, to, tolen) );
--- a/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,6 +61,9 @@
     // can only be returned by the doFinal(...) call.
     private static final int MAX_BUF_SIZE = Integer.MAX_VALUE;
 
+    // data size when buffer is divided up to aid in intrinsics
+    private static final int TRIGGERLEN = 65536;  // 64k
+
     // buffer for AAD data; if null, meaning update has been called
     private ByteArrayOutputStream aadBuffer = new ByteArrayOutputStream();
     private int sizeOfAAD = 0;
@@ -380,12 +383,10 @@
     // Utility to process the last block; used by encryptFinal and decryptFinal
     void doLastBlock(byte[] in, int inOfs, int len, byte[] out, int outOfs,
                      boolean isEncrypt) throws IllegalBlockSizeException {
-        // process data in 'in'
-        gctrPAndC.doFinal(in, inOfs, len, out, outOfs);
-        processed += len;
-
         byte[] ct;
         int ctOfs;
+        int ilen = len;  // internal length
+
         if (isEncrypt) {
             ct = out;
             ctOfs = outOfs;
@@ -393,14 +394,38 @@
             ct = in;
             ctOfs = inOfs;
         }
+
+        // Divide up larger data sizes to trigger CTR & GHASH intrinsic quicker
+        if (len > TRIGGERLEN) {
+            int i = 0;
+            int tlen;  // incremental lengths
+            // 96bit CTR x86 intrinsic
+            final int plen = AES_BLOCK_SIZE * 6;
+            // arbitrary formula to aid intrinsic without reaching buffer end
+            final int count = len / 1024;
+
+            while (count > i) {
+                tlen = gctrPAndC.update(in, inOfs, plen, out, outOfs);
+                ghashAllToS.update(ct, ctOfs, tlen);
+                inOfs += tlen;
+                outOfs += tlen;
+                ctOfs += tlen;
+                i++;
+            }
+            ilen -= count * plen;
+            processed += count * plen;
+        }
+
+        gctrPAndC.doFinal(in, inOfs, ilen, out, outOfs);
+        processed += ilen;
+
         int lastLen = len  % AES_BLOCK_SIZE;
         if (lastLen != 0) {
             ghashAllToS.update(ct, ctOfs, len - lastLen);
-            byte[] padded =
-                expandToOneBlock(ct, (ctOfs + len - lastLen), lastLen);
-            ghashAllToS.update(padded);
+            ghashAllToS.update(
+                    expandToOneBlock(ct, (ctOfs + len - lastLen), lastLen));
         } else {
-            ghashAllToS.update(ct, ctOfs, len);
+            ghashAllToS.update(ct, ctOfs, ilen);
         }
     }
 
@@ -562,16 +587,20 @@
         System.arraycopy(in, inOfs + len - tagLenBytes, tag, 0, tagLenBytes);
         len -= tagLenBytes;
 
-        if (len > 0) {
-            ibuffer.write(in, inOfs, len);
+        // If decryption is in-place or there is buffered "ibuffer" data, copy
+        // the "in" byte array into the ibuffer before proceeding.
+        if (in == out || ibuffer.size() > 0) {
+            if (len > 0) {
+                ibuffer.write(in, inOfs, len);
+            }
+
+            // refresh 'in' to all buffered-up bytes
+            in = ibuffer.toByteArray();
+            inOfs = 0;
+            len = in.length;
+            ibuffer.reset();
         }
 
-        // refresh 'in' to all buffered-up bytes
-        in = ibuffer.toByteArray();
-        inOfs = 0;
-        len = in.length;
-        ibuffer.reset();
-
         if (len > 0) {
             doLastBlock(in, inOfs, len, out, outOfs, false);
         }
--- a/src/java.base/share/classes/com/sun/net/ssl/internal/ssl/Provider.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/com/sun/net/ssl/internal/ssl/Provider.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,21 +42,6 @@
         super();
     }
 
-    // preferred constructor to enable FIPS mode at runtime
-    public Provider(java.security.Provider cryptoProvider) {
-        super(cryptoProvider);
-    }
-
-    // constructor to enable FIPS mode from java.security file
-    public Provider(String cryptoProvider) {
-        super(cryptoProvider);
-    }
-
-    // public for now, but we may want to change it or not document it.
-    public static synchronized boolean isFIPS() {
-        return SunJSSE.isFIPS();
-    }
-
     /**
      * Installs the JSSE provider.
      */
--- a/src/java.base/share/classes/java/util/HashMap.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/java/util/HashMap.java	Thu Feb 14 22:08:36 2019 +0100
@@ -501,9 +501,14 @@
                          (int)ft : MAXIMUM_CAPACITY);
                 if (t > threshold)
                     threshold = tableSizeFor(t);
+            } else {
+                // Because of linked-list bucket constraints, we cannot
+                // expand all at once, but can reduce total resize
+                // effort by repeated doubling now vs later
+                while (s > threshold && table.length < MAXIMUM_CAPACITY)
+                    resize();
             }
-            else if (s > threshold)
-                resize();
+
             for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) {
                 K key = e.getKey();
                 V value = e.getValue();
--- a/src/java.base/share/classes/sun/security/ssl/Authenticator.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/Authenticator.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -484,7 +484,7 @@
                     throw new RuntimeException("Unknown MacAlg " + macAlg);
             }
 
-            Mac m = JsseJce.getMac(algorithm);
+            Mac m = Mac.getInstance(algorithm);
             m.init(key);
             this.macAlg = macAlg;
             this.mac = m;
--- a/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
  /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -196,13 +196,13 @@
             Signature signer = null;
             switch (algorithm) {
                 case "RSA":
-                    signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWRSA);
+                    signer = Signature.getInstance(JsseJce.SIGNATURE_RAWRSA);
                     break;
                 case "DSA":
-                    signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWDSA);
+                    signer = Signature.getInstance(JsseJce.SIGNATURE_RAWDSA);
                     break;
                 case "EC":
-                    signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWECDSA);
+                    signer = Signature.getInstance(JsseJce.SIGNATURE_RAWECDSA);
                     break;
                 default:
                     throw new SignatureException("Unrecognized algorithm: "
@@ -439,13 +439,13 @@
             Signature signer = null;
             switch (algorithm) {
                 case "RSA":
-                    signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWRSA);
+                    signer = Signature.getInstance(JsseJce.SIGNATURE_RAWRSA);
                     break;
                 case "DSA":
-                    signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWDSA);
+                    signer = Signature.getInstance(JsseJce.SIGNATURE_RAWDSA);
                     break;
                 case "EC":
-                    signer = JsseJce.getSignature(JsseJce.SIGNATURE_RAWECDSA);
+                    signer = Signature.getInstance(JsseJce.SIGNATURE_RAWECDSA);
                     break;
                 default:
                     throw new SignatureException("Unrecognized algorithm: "
--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -519,7 +519,7 @@
             if (session != null && identityAlg != null) {
                 String sessionIdentityAlg =
                     session.getIdentificationProtocol();
-                if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+                if (!identityAlg.equalsIgnoreCase(sessionIdentityAlg)) {
                     if (SSLLogger.isOn &&
                     SSLLogger.isOn("ssl,handshake,verbose")) {
                         SSLLogger.finest("Can't resume, endpoint id" +
@@ -803,8 +803,13 @@
                     shc.sslConfig.getEnabledExtensions(
                             SSLHandshake.CLIENT_HELLO);
 
-            ClientHelloMessage chm =
-                    new ClientHelloMessage(shc, message, enabledExtensions);
+            ClientHelloMessage chm;
+            try {
+                chm = new ClientHelloMessage(shc, message, enabledExtensions);
+            } catch (Exception e) {
+                throw shc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
+                        "ClientHelloMessage failure", e);
+            }
             if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
                 SSLLogger.fine("Consuming ClientHello handshake message", chm);
             }
@@ -1036,7 +1041,7 @@
                 if (resumingSession && identityAlg != null) {
                     String sessionIdentityAlg =
                         previous.getIdentificationProtocol();
-                    if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+                    if (!identityAlg.equalsIgnoreCase(sessionIdentityAlg)) {
                         if (SSLLogger.isOn &&
                         SSLLogger.isOn("ssl,handshake,verbose")) {
                             SSLLogger.finest("Can't resume, endpoint id" +
--- a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -280,7 +280,7 @@
                 DHPublicKeySpec spec = new DHPublicKeySpec(
                         new BigInteger(1, ckem.y),
                         params.getP(), params.getG());
-                KeyFactory kf = JsseJce.getKeyFactory("DiffieHellman");
+                KeyFactory kf = KeyFactory.getInstance("DiffieHellman");
                 DHPublicKey peerPublicKey =
                         (DHPublicKey)kf.generatePublic(spec);
 
--- a/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -87,7 +87,7 @@
                 return null;
             }
 
-            KeyFactory kf = JsseJce.getKeyFactory("DiffieHellman");
+            KeyFactory kf = KeyFactory.getInstance("DiffieHellman");
             DHPublicKeySpec spec = new DHPublicKeySpec(
                     new BigInteger(1, encodedPublic),
                     params.getP(), params.getG());
@@ -106,7 +106,7 @@
         DHEPossession(NamedGroup namedGroup, SecureRandom random) {
             try {
                 KeyPairGenerator kpg =
-                        JsseJce.getKeyPairGenerator("DiffieHellman");
+                        KeyPairGenerator.getInstance("DiffieHellman");
                 DHParameterSpec params =
                         (DHParameterSpec)namedGroup.getParameterSpec();
                 kpg.initialize(params, random);
@@ -129,7 +129,7 @@
                     PredefinedDHParameterSpecs.definedParams.get(keyLength);
             try {
                 KeyPairGenerator kpg =
-                    JsseJce.getKeyPairGenerator("DiffieHellman");
+                    KeyPairGenerator.getInstance("DiffieHellman");
                 if (params != null) {
                     kpg.initialize(params, random);
                 } else {
@@ -155,7 +155,7 @@
         DHEPossession(DHECredentials credentials, SecureRandom random) {
             try {
                 KeyPairGenerator kpg =
-                        JsseJce.getKeyPairGenerator("DiffieHellman");
+                        KeyPairGenerator.getInstance("DiffieHellman");
                 kpg.initialize(credentials.popPublicKey.getParams(), random);
                 KeyPair kp = generateDHKeyPair(kpg);
                 if (kp == null) {
@@ -208,7 +208,7 @@
                                         params.getP(), params.getG());
             }
             try {
-                KeyFactory factory = JsseJce.getKeyFactory("DiffieHellman");
+                KeyFactory factory = KeyFactory.getInstance("DiffieHellman");
                 return factory.getKeySpec(key, DHPublicKeySpec.class);
             } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
                 // unlikely
@@ -473,7 +473,7 @@
             private SecretKey t12DeriveKey(String algorithm,
                     AlgorithmParameterSpec params) throws IOException {
                 try {
-                    KeyAgreement ka = JsseJce.getKeyAgreement("DiffieHellman");
+                    KeyAgreement ka = KeyAgreement.getInstance("DiffieHellman");
                     ka.init(localPrivateKey);
                     ka.doPhase(peerPublicKey, true);
                     SecretKey preMasterSecret =
@@ -499,7 +499,7 @@
             private SecretKey t13DeriveKey(String algorithm,
                     AlgorithmParameterSpec params) throws IOException {
                 try {
-                    KeyAgreement ka = JsseJce.getKeyAgreement("DiffieHellman");
+                    KeyAgreement ka = KeyAgreement.getInstance("DiffieHellman");
                     ka.init(localPrivateKey);
                     ka.doPhase(peerPublicKey, true);
                     SecretKey sharedSecret =
--- a/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -420,7 +420,7 @@
             Signature signer = null;
             switch (keyAlgorithm) {
                 case "DSA":
-                    signer = JsseJce.getSignature(JsseJce.SIGNATURE_DSA);
+                    signer = Signature.getInstance(JsseJce.SIGNATURE_DSA);
                     break;
                 case "RSA":
                     signer = RSASignature.getInstance();
@@ -524,7 +524,7 @@
             // check constraints of EC PublicKey
             DHPublicKey publicKey;
             try {
-                KeyFactory kf = JsseJce.getKeyFactory("DiffieHellman");
+                KeyFactory kf = KeyFactory.getInstance("DiffieHellman");
                 DHPublicKeySpec spec = new DHPublicKeySpec(
                         new BigInteger(1, skem.y),
                         new BigInteger(1, skem.p),
--- a/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ECDHClientKeyExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
 import sun.security.ssl.SupportedGroupsExtension.NamedGroup;
 import sun.security.ssl.X509Authentication.X509Credentials;
 import sun.security.ssl.X509Authentication.X509Possession;
+import sun.security.util.ECUtil;
 import sun.security.util.HexDumpEncoder;
 
 /**
@@ -78,7 +79,7 @@
 
             ECPoint point = publicKey.getW();
             ECParameterSpec params = publicKey.getParams();
-            encodedPoint = JsseJce.encodePoint(point, params.getCurve());
+            encodedPoint = ECUtil.encodePoint(point, params.getCurve());
         }
 
         ECDHClientKeyExchangeMessage(HandshakeContext handshakeContext,
@@ -99,10 +100,10 @@
             try {
                 ECParameterSpec params = publicKey.getParams();
                 ECPoint point =
-                        JsseJce.decodePoint(encodedPoint, params.getCurve());
+                        ECUtil.decodePoint(encodedPoint, params.getCurve());
                 ECPublicKeySpec spec = new ECPublicKeySpec(point, params);
 
-                KeyFactory kf = JsseJce.getKeyFactory("EC");
+                KeyFactory kf = KeyFactory.getInstance("EC");
                 ECPublicKey peerPublicKey =
                         (ECPublicKey)kf.generatePublic(spec);
 
@@ -319,10 +320,10 @@
             // create the credentials
             try {
                 ECPoint point =
-                    JsseJce.decodePoint(cke.encodedPoint, params.getCurve());
+                    ECUtil.decodePoint(cke.encodedPoint, params.getCurve());
                 ECPublicKeySpec spec = new ECPublicKeySpec(point, params);
 
-                KeyFactory kf = JsseJce.getKeyFactory("EC");
+                KeyFactory kf = KeyFactory.getInstance("EC");
                 ECPublicKey peerPublicKey =
                         (ECPublicKey)kf.generatePublic(spec);
 
@@ -493,10 +494,10 @@
             // create the credentials
             try {
                 ECPoint point =
-                    JsseJce.decodePoint(cke.encodedPoint, params.getCurve());
+                    ECUtil.decodePoint(cke.encodedPoint, params.getCurve());
                 ECPublicKeySpec spec = new ECPublicKeySpec(point, params);
 
-                KeyFactory kf = JsseJce.getKeyFactory("EC");
+                KeyFactory kf = KeyFactory.getInstance("EC");
                 ECPublicKey peerPublicKey =
                         (ECPublicKey)kf.generatePublic(spec);
 
--- a/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ECDHKeyExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,14 +85,14 @@
             }
 
             ECParameterSpec parameters =
-                    JsseJce.getECParameterSpec(namedGroup.oid);
+                    ECUtil.getECParameterSpec(null, namedGroup.oid);
             if (parameters == null) {
                 return null;
             }
 
-            ECPoint point = JsseJce.decodePoint(
+            ECPoint point = ECUtil.decodePoint(
                     encodedPoint, parameters.getCurve());
-            KeyFactory factory = JsseJce.getKeyFactory("EC");
+            KeyFactory factory = KeyFactory.getInstance("EC");
             ECPublicKey publicKey = (ECPublicKey)factory.generatePublic(
                     new ECPublicKeySpec(point, parameters));
             return new ECDHECredentials(publicKey, namedGroup);
@@ -106,7 +106,7 @@
 
         ECDHEPossession(NamedGroup namedGroup, SecureRandom random) {
             try {
-                KeyPairGenerator kpg = JsseJce.getKeyPairGenerator("EC");
+                KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC");
                 ECGenParameterSpec params =
                         (ECGenParameterSpec)namedGroup.getParameterSpec();
                 kpg.initialize(params, random);
@@ -124,7 +124,7 @@
         ECDHEPossession(ECDHECredentials credentials, SecureRandom random) {
             ECParameterSpec params = credentials.popPublicKey.getParams();
             try {
-                KeyPairGenerator kpg = JsseJce.getKeyPairGenerator("EC");
+                KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC");
                 kpg.initialize(params, random);
                 KeyPair kp = kpg.generateKeyPair();
                 privateKey = kp.getPrivate();
@@ -149,7 +149,7 @@
                 PublicKey peerPublicKey) throws SSLHandshakeException {
 
             try {
-                KeyAgreement ka = JsseJce.getKeyAgreement("ECDH");
+                KeyAgreement ka = KeyAgreement.getInstance("ECDH");
                 ka.init(privateKey);
                 ka.doPhase(peerPublicKey, true);
                 return ka.generateSecret("TlsPremasterSecret");
@@ -165,8 +165,8 @@
             try {
                 ECParameterSpec params = publicKey.getParams();
                 ECPoint point =
-                        JsseJce.decodePoint(encodedPoint, params.getCurve());
-                KeyFactory kf = JsseJce.getKeyFactory("EC");
+                        ECUtil.decodePoint(encodedPoint, params.getCurve());
+                KeyFactory kf = KeyFactory.getInstance("EC");
                 ECPublicKeySpec spec = new ECPublicKeySpec(point, params);
                 PublicKey peerPublicKey = kf.generatePublic(spec);
                 return getAgreedSecret(peerPublicKey);
@@ -183,10 +183,10 @@
 
                 ECParameterSpec params = publicKey.getParams();
                 ECPoint point =
-                        JsseJce.decodePoint(encodedPoint, params.getCurve());
+                        ECUtil.decodePoint(encodedPoint, params.getCurve());
                 ECPublicKeySpec spec = new ECPublicKeySpec(point, params);
 
-                KeyFactory kf = JsseJce.getKeyFactory("EC");
+                KeyFactory kf = KeyFactory.getInstance("EC");
                 ECPublicKey pubKey = (ECPublicKey)kf.generatePublic(spec);
 
                 // check constraints of ECPublicKey
@@ -424,7 +424,7 @@
         private SecretKey t12DeriveKey(String algorithm,
                 AlgorithmParameterSpec params) throws IOException {
             try {
-                KeyAgreement ka = JsseJce.getKeyAgreement("ECDH");
+                KeyAgreement ka = KeyAgreement.getInstance("ECDH");
                 ka.init(localPrivateKey);
                 ka.doPhase(peerPublicKey, true);
                 SecretKey preMasterSecret =
@@ -451,7 +451,7 @@
         private SecretKey t13DeriveKey(String algorithm,
                 AlgorithmParameterSpec params) throws IOException {
             try {
-                KeyAgreement ka = JsseJce.getKeyAgreement("ECDH");
+                KeyAgreement ka = KeyAgreement.getInstance("ECDH");
                 ka.init(localPrivateKey);
                 ka.doPhase(peerPublicKey, true);
                 SecretKey sharedSecret =
--- a/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/ECDHServerKeyExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,7 @@
 import sun.security.ssl.SupportedGroupsExtension.SupportedGroups;
 import sun.security.ssl.X509Authentication.X509Credentials;
 import sun.security.ssl.X509Authentication.X509Possession;
+import sun.security.util.ECUtil;
 import sun.security.util.HexDumpEncoder;
 
 /**
@@ -120,7 +121,7 @@
             publicKey = ecdhePossession.publicKey;
             ECParameterSpec params = publicKey.getParams();
             ECPoint point = publicKey.getW();
-            publicPoint = JsseJce.encodePoint(point, params.getCurve());
+            publicPoint = ECUtil.encodePoint(point, params.getCurve());
 
             this.namedGroup = NamedGroup.valueOf(params);
             if ((namedGroup == null) || (namedGroup.oid == null) ) {
@@ -221,7 +222,7 @@
             }
 
             ECParameterSpec parameters =
-                    JsseJce.getECParameterSpec(namedGroup.oid);
+                    ECUtil.getECParameterSpec(null, namedGroup.oid);
             if (parameters == null) {
                 throw chc.conContext.fatal(Alert.ILLEGAL_PARAMETER,
                     "No supported EC parameter: " + namedGroup);
@@ -236,8 +237,8 @@
             ECPublicKey ecPublicKey = null;
             try {
                 ECPoint point =
-                        JsseJce.decodePoint(publicPoint, parameters.getCurve());
-                KeyFactory factory = JsseJce.getKeyFactory("EC");
+                        ECUtil.decodePoint(publicPoint, parameters.getCurve());
+                KeyFactory factory = KeyFactory.getInstance("EC");
                 ecPublicKey = (ECPublicKey)factory.generatePublic(
                     new ECPublicKeySpec(point, parameters));
             } catch (NoSuchAlgorithmException |
@@ -446,7 +447,7 @@
             Signature signer = null;
             switch (keyAlgorithm) {
                 case "EC":
-                    signer = JsseJce.getSignature(JsseJce.SIGNATURE_ECDSA);
+                    signer = Signature.getInstance(JsseJce.SIGNATURE_ECDSA);
                     break;
                 case "RSA":
                     signer = RSASignature.getInstance();
--- a/src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
             KeyPair kp = keys[index].getKeyPair();
             if (kp == null) {
                 try {
-                    KeyPairGenerator kgen = JsseJce.getKeyPairGenerator("RSA");
+                    KeyPairGenerator kgen = KeyPairGenerator.getInstance("RSA");
                     kgen.initialize(length, random);
                     keys[index] = new EphemeralKeyPair(kgen.genKeyPair());
                     kp = keys[index].getKeyPair();
--- a/src/java.base/share/classes/sun/security/ssl/Finished.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/Finished.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -257,7 +257,7 @@
                 TlsPrfParameterSpec spec = new TlsPrfParameterSpec(
                     masterSecretKey, tlsLabel, seed, 12,
                     hashAlg.name, hashAlg.hashLength, hashAlg.blockSize);
-                KeyGenerator kg = JsseJce.getKeyGenerator(prfAlg);
+                KeyGenerator kg = KeyGenerator.getInstance(prfAlg);
                 kg.init(spec);
                 SecretKey prfKey = kg.generateKey();
                 if (!"RAW".equals(prfKey.getFormat())) {
@@ -309,7 +309,7 @@
                 TlsPrfParameterSpec spec = new TlsPrfParameterSpec(
                     masterSecretKey, tlsLabel, seed, 12,
                     hashAlg.name, hashAlg.hashLength, hashAlg.blockSize);
-                KeyGenerator kg = JsseJce.getKeyGenerator(prfAlg);
+                KeyGenerator kg = KeyGenerator.getInstance(prfAlg);
                 kg.init(spec);
                 SecretKey prfKey = kg.generateKey();
                 if (!"RAW".equals(prfKey.getFormat())) {
@@ -350,7 +350,7 @@
             String hmacAlg =
                 "Hmac" + hashAlg.name.replace("-", "");
             try {
-                Mac hmac = JsseJce.getMac(hmacAlg);
+                Mac hmac = Mac.getInstance(hmacAlg);
                 hmac.init(finishedSecret);
                 return hmac.doFinal(context.handshakeHash.digest());
             } catch (NoSuchAlgorithmException |InvalidKeyException ex) {
--- a/src/java.base/share/classes/sun/security/ssl/HKDF.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/HKDF.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -62,7 +62,7 @@
         Objects.requireNonNull(hashAlg,
                 "Must provide underlying HKDF Digest algorithm.");
         hmacAlg = "Hmac" + hashAlg.replace("-", "");
-        hmacObj = JsseJce.getMac(hmacAlg);
+        hmacObj = Mac.getInstance(hmacAlg);
         hmacLen = hmacObj.getMacLength();
     }
 
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeHash.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeHash.java	Thu Feb 14 22:08:36 2019 +0100
@@ -29,6 +29,7 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
 import java.util.LinkedList;
 import javax.crypto.SecretKey;
@@ -269,8 +270,13 @@
         private final ByteArrayOutputStream baos;
 
         S30HandshakeHash(CipherSuite cipherSuite) {
-            this.mdMD5 = JsseJce.getMessageDigest("MD5");
-            this.mdSHA = JsseJce.getMessageDigest("SHA");
+            try {
+                this.mdMD5 = MessageDigest.getInstance("MD5");
+                this.mdSHA = MessageDigest.getInstance("SHA");
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new RuntimeException(
+                    "Hash algorithm MD5 or SHA is not available", nsae);
+            }
 
             boolean hasArchived = false;
             if (mdMD5 instanceof Cloneable) {
@@ -379,7 +385,12 @@
                             "MessageDigest does no support clone operation");
                 }
             } else {
-                md5Clone = JsseJce.getMessageDigest("MD5");
+                try {
+                    md5Clone = MessageDigest.getInstance("MD5");
+                } catch (NoSuchAlgorithmException nsae) {
+                    throw new RuntimeException(
+                        "Hash algorithm MD5 is not available", nsae);
+                }
                 md5Clone.update(md5.archived());
             }
 
@@ -396,7 +407,12 @@
                             "MessageDigest does no support clone operation");
                 }
             } else {
-                shaClone = JsseJce.getMessageDigest("SHA");
+                try {
+                    shaClone = MessageDigest.getInstance("SHA");
+                } catch (NoSuchAlgorithmException nsae) {
+                    throw new RuntimeException(
+                        "Hash algorithm SHA is not available", nsae);
+                }
                 shaClone.update(sha.archived());
             }
 
@@ -447,8 +463,15 @@
         private final ByteArrayOutputStream baos;
 
         T10HandshakeHash(CipherSuite cipherSuite) {
-            MessageDigest mdMD5 = JsseJce.getMessageDigest("MD5");
-            MessageDigest mdSHA = JsseJce.getMessageDigest("SHA");
+            MessageDigest mdMD5;
+            MessageDigest mdSHA;
+            try {
+                mdMD5 = MessageDigest.getInstance("MD5");
+                mdSHA = MessageDigest.getInstance("SHA");
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new RuntimeException(
+                    "Hash algorithm MD5 or SHA is not available", nsae);
+            }
 
             boolean hasArchived = false;
             if (mdMD5 instanceof Cloneable) {
@@ -514,8 +537,15 @@
         private final ByteArrayOutputStream baos;
 
         T12HandshakeHash(CipherSuite cipherSuite) {
-            MessageDigest md =
-                    JsseJce.getMessageDigest(cipherSuite.hashAlg.name);
+            MessageDigest md;
+            try {
+                md = MessageDigest.getInstance(cipherSuite.hashAlg.name);
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new RuntimeException(
+                        "Hash algorithm " +
+                        cipherSuite.hashAlg.name + " is not available", nsae);
+            }
+
             if (md instanceof Cloneable) {
                 transcriptHash = new CloneableHash(md);
                 this.baos = new ByteArrayOutputStream();
@@ -552,8 +582,15 @@
         private final TranscriptHash transcriptHash;
 
         T13HandshakeHash(CipherSuite cipherSuite) {
-            MessageDigest md =
-                    JsseJce.getMessageDigest(cipherSuite.hashAlg.name);
+            MessageDigest md;
+            try {
+                md = MessageDigest.getInstance(cipherSuite.hashAlg.name);
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new RuntimeException(
+                        "Hash algorithm " +
+                        cipherSuite.hashAlg.name + " is not available", nsae);
+            }
+
             if (md instanceof Cloneable) {
                 transcriptHash = new CloneableHash(md);
             } else {
--- a/src/java.base/share/classes/sun/security/ssl/HelloCookieManager.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/HelloCookieManager.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 import java.io.IOException;
 import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
 import java.util.Arrays;
 import static sun.security.ssl.ClientHello.ClientHelloMessage;
@@ -143,7 +144,13 @@
                 cookieVersion++;
             }
 
-            MessageDigest md = JsseJce.getMessageDigest("SHA-256");
+            MessageDigest md;
+            try {
+                md = MessageDigest.getInstance("SHA-256");
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new RuntimeException(
+                    "MessageDigest algorithm SHA-256 is not available", nsae);
+            }
             byte[] helloBytes = clientHello.getHelloCookieBytes();
             md.update(helloBytes);
             byte[] cookie = md.digest(secret);      // 32 bytes
@@ -169,7 +176,13 @@
                 }
             }
 
-            MessageDigest md = JsseJce.getMessageDigest("SHA-256");
+            MessageDigest md;
+            try {
+                md = MessageDigest.getInstance("SHA-256");
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new RuntimeException(
+                    "MessageDigest algorithm SHA-256 is not available", nsae);
+            }
             byte[] helloBytes = clientHello.getHelloCookieBytes();
             md.update(helloBytes);
             byte[] target = md.digest(secret);      // 32 bytes
@@ -234,8 +247,16 @@
                 cookieVersion++;        // allow wrapped version number
             }
 
-            MessageDigest md = JsseJce.getMessageDigest(
+            MessageDigest md;
+            try {
+                md = MessageDigest.getInstance(
                     context.negotiatedCipherSuite.hashAlg.name);
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new RuntimeException(
+                        "MessageDigest algorithm " +
+                        context.negotiatedCipherSuite.hashAlg.name +
+                        " is not available", nsae);
+            }
             byte[] headerBytes = clientHello.getHeaderBytes();
             md.update(headerBytes);
             byte[] headerCookie = md.digest(secret);
@@ -300,7 +321,14 @@
                 }
             }
 
-            MessageDigest md = JsseJce.getMessageDigest(cs.hashAlg.name);
+            MessageDigest md;
+            try {
+                md = MessageDigest.getInstance(cs.hashAlg.name);
+            } catch (NoSuchAlgorithmException nsae) {
+                throw new RuntimeException(
+                        "MessageDigest algorithm " +
+                        cs.hashAlg.name + " is not available", nsae);
+            }
             byte[] headerBytes = clientHello.getHeaderBytes();
             md.update(headerBytes);
             byte[] headerCookie = md.digest(secret);
--- a/src/java.base/share/classes/sun/security/ssl/JsseJce.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/JsseJce.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,13 +29,7 @@
 import java.security.*;
 import java.security.interfaces.RSAPublicKey;
 import java.security.spec.*;
-import java.util.*;
 import javax.crypto.*;
-import sun.security.jca.ProviderList;
-import sun.security.jca.Providers;
-import static sun.security.ssl.SunJSSE.cryptoProvider;
-import sun.security.util.ECUtil;
-import static sun.security.util.SecurityConstants.PROVIDER_VER;
 
 /**
  * This class contains a few static methods for interaction with the JCA/JCE
@@ -47,54 +41,6 @@
     static final boolean ALLOW_ECC =
             Utilities.getBooleanProperty("com.sun.net.ssl.enableECC", true);
 
-    private static final ProviderList fipsProviderList;
-
-    static {
-        // force FIPS flag initialization
-        // Because isFIPS() is synchronized and cryptoProvider is not modified
-        // after it completes, this also eliminates the need for any further
-        // synchronization when accessing cryptoProvider
-        if (SunJSSE.isFIPS() == false) {
-            fipsProviderList = null;
-        } else {
-            // Setup a ProviderList that can be used by the trust manager
-            // during certificate chain validation. All the crypto must be
-            // from the FIPS provider, but we also allow the required
-            // certificate related services from the SUN provider.
-            Provider sun = Security.getProvider("SUN");
-            if (sun == null) {
-                throw new RuntimeException
-                    ("FIPS mode: SUN provider must be installed");
-            }
-            Provider sunCerts = new SunCertificates(sun);
-            fipsProviderList = ProviderList.newList(cryptoProvider, sunCerts);
-        }
-    }
-
-    private static final class SunCertificates extends Provider {
-        private static final long serialVersionUID = -3284138292032213752L;
-
-        SunCertificates(final Provider p) {
-            super("SunCertificates", PROVIDER_VER, "SunJSSE internal");
-            AccessController.doPrivileged(new PrivilegedAction<Object>() {
-                @Override
-                public Object run() {
-                    // copy certificate related services from the Sun provider
-                    for (Map.Entry<Object,Object> entry : p.entrySet()) {
-                        String key = (String)entry.getKey();
-                        if (key.startsWith("CertPathValidator.")
-                                || key.startsWith("CertPathBuilder.")
-                                || key.startsWith("CertStore.")
-                                || key.startsWith("CertificateFactory.")) {
-                            put(key, entry.getValue());
-                        }
-                    }
-                    return null;
-                }
-            });
-        }
-    }
-
     /**
      * JCE transformation string for RSA with PKCS#1 v1.5 padding.
      * Can be used for encryption, decryption, signing, verifying.
@@ -180,153 +126,6 @@
         return EcAvailability.isAvailable;
     }
 
-    /**
-     * Return an JCE cipher implementation for the specified algorithm.
-     */
-    static Cipher getCipher(String transformation)
-            throws NoSuchAlgorithmException {
-        try {
-            if (cryptoProvider == null) {
-                return Cipher.getInstance(transformation);
-            } else {
-                return Cipher.getInstance(transformation, cryptoProvider);
-            }
-        } catch (NoSuchPaddingException e) {
-            throw new NoSuchAlgorithmException(e);
-        }
-    }
-
-    /**
-     * Return an JCA signature implementation for the specified algorithm.
-     * The algorithm string should be one of the constants defined
-     * in this class.
-     */
-    static Signature getSignature(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (cryptoProvider == null) {
-            return Signature.getInstance(algorithm);
-        } else {
-            // reference equality
-            if (algorithm == SIGNATURE_SSLRSA) {
-                // The SunPKCS11 provider currently does not support this
-                // special algorithm. We allow a fallback in this case because
-                // the SunJSSE implementation does the actual crypto using
-                // a NONEwithRSA signature obtained from the cryptoProvider.
-                if (cryptoProvider.getService("Signature", algorithm) == null) {
-                    // Calling Signature.getInstance() and catching the
-                    // exception would be cleaner, but exceptions are a little
-                    // expensive. So we check directly via getService().
-                    try {
-                        return Signature.getInstance(algorithm, "SunJSSE");
-                    } catch (NoSuchProviderException e) {
-                        throw new NoSuchAlgorithmException(e);
-                    }
-                }
-            }
-            return Signature.getInstance(algorithm, cryptoProvider);
-        }
-    }
-
-    static KeyGenerator getKeyGenerator(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (cryptoProvider == null) {
-            return KeyGenerator.getInstance(algorithm);
-        } else {
-            return KeyGenerator.getInstance(algorithm, cryptoProvider);
-        }
-    }
-
-    static KeyPairGenerator getKeyPairGenerator(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (cryptoProvider == null) {
-            return KeyPairGenerator.getInstance(algorithm);
-        } else {
-            return KeyPairGenerator.getInstance(algorithm, cryptoProvider);
-        }
-    }
-
-    static KeyAgreement getKeyAgreement(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (cryptoProvider == null) {
-            return KeyAgreement.getInstance(algorithm);
-        } else {
-            return KeyAgreement.getInstance(algorithm, cryptoProvider);
-        }
-    }
-
-    static Mac getMac(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (cryptoProvider == null) {
-            return Mac.getInstance(algorithm);
-        } else {
-            return Mac.getInstance(algorithm, cryptoProvider);
-        }
-    }
-
-    static KeyFactory getKeyFactory(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (cryptoProvider == null) {
-            return KeyFactory.getInstance(algorithm);
-        } else {
-            return KeyFactory.getInstance(algorithm, cryptoProvider);
-        }
-    }
-
-    static AlgorithmParameters getAlgorithmParameters(String algorithm)
-            throws NoSuchAlgorithmException {
-        if (cryptoProvider == null) {
-            return AlgorithmParameters.getInstance(algorithm);
-        } else {
-            return AlgorithmParameters.getInstance(algorithm, cryptoProvider);
-        }
-    }
-
-    static SecureRandom getSecureRandom() throws KeyManagementException {
-        if (cryptoProvider == null) {
-            return new SecureRandom();
-        }
-        // Try "PKCS11" first. If that is not supported, iterate through
-        // the provider and return the first working implementation.
-        try {
-            return SecureRandom.getInstance("PKCS11", cryptoProvider);
-        } catch (NoSuchAlgorithmException e) {
-            // ignore
-        }
-        for (Provider.Service s : cryptoProvider.getServices()) {
-            if (s.getType().equals("SecureRandom")) {
-                try {
-                    return SecureRandom.getInstance(
-                            s.getAlgorithm(), cryptoProvider);
-                } catch (NoSuchAlgorithmException ee) {
-                    // ignore
-                }
-            }
-        }
-        throw new KeyManagementException("FIPS mode: no SecureRandom "
-            + " implementation found in provider " + cryptoProvider.getName());
-    }
-
-    static MessageDigest getMD5() {
-        return getMessageDigest("MD5");
-    }
-
-    static MessageDigest getSHA() {
-        return getMessageDigest("SHA");
-    }
-
-    static MessageDigest getMessageDigest(String algorithm) {
-        try {
-            if (cryptoProvider == null) {
-                return MessageDigest.getInstance(algorithm);
-            } else {
-                return MessageDigest.getInstance(algorithm, cryptoProvider);
-            }
-        } catch (NoSuchAlgorithmException e) {
-            throw new RuntimeException
-                        ("Algorithm " + algorithm + " not available", e);
-        }
-    }
-
     static int getRSAKeyLength(PublicKey key) {
         BigInteger modulus;
         if (key instanceof RSAPublicKey) {
@@ -345,47 +144,13 @@
                                         rsaKey.getPublicExponent());
         }
         try {
-            KeyFactory factory = JsseJce.getKeyFactory("RSA");
+            KeyFactory factory = KeyFactory.getInstance("RSA");
             return factory.getKeySpec(key, RSAPublicKeySpec.class);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
 
-    static ECParameterSpec getECParameterSpec(String namedCurveOid) {
-        return ECUtil.getECParameterSpec(cryptoProvider, namedCurveOid);
-    }
-
-    static String getNamedCurveOid(ECParameterSpec params) {
-        return ECUtil.getCurveName(cryptoProvider, params);
-    }
-
-    static ECPoint decodePoint(byte[] encoded, EllipticCurve curve)
-            throws java.io.IOException {
-        return ECUtil.decodePoint(encoded, curve);
-    }
-
-    static byte[] encodePoint(ECPoint point, EllipticCurve curve) {
-        return ECUtil.encodePoint(point, curve);
-    }
-
-    // In FIPS mode, set thread local providers; otherwise a no-op.
-    // Must be paired with endFipsProvider.
-    static Object beginFipsProvider() {
-        if (fipsProviderList == null) {
-            return null;
-        } else {
-            return Providers.beginThreadProviderList(fipsProviderList);
-        }
-    }
-
-    static void endFipsProvider(Object o) {
-        if (fipsProviderList != null) {
-            Providers.endThreadProviderList((ProviderList)o);
-        }
-    }
-
-
     // lazy initialization holder class idiom for static default parameters
     //
     // See Effective Java Second Edition: Item 71.
@@ -396,12 +161,12 @@
         static {
             boolean mediator = true;
             try {
-                JsseJce.getSignature(SIGNATURE_ECDSA);
-                JsseJce.getSignature(SIGNATURE_RAWECDSA);
-                JsseJce.getKeyAgreement("ECDH");
-                JsseJce.getKeyFactory("EC");
-                JsseJce.getKeyPairGenerator("EC");
-                JsseJce.getAlgorithmParameters("EC");
+                Signature.getInstance(SIGNATURE_ECDSA);
+                Signature.getInstance(SIGNATURE_RAWECDSA);
+                KeyAgreement.getInstance("ECDH");
+                KeyFactory.getInstance("EC");
+                KeyPairGenerator.getInstance("EC");
+                AlgorithmParameters.getInstance("EC");
             } catch (Exception e) {
                 mediator = false;
             }
--- a/src/java.base/share/classes/sun/security/ssl/KeyManagerFactoryImpl.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/KeyManagerFactoryImpl.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,12 +61,6 @@
         protected void engineInit(KeyStore ks, char[] password) throws
                 KeyStoreException, NoSuchAlgorithmException,
                 UnrecoverableKeyException {
-            if ((ks != null) && SunJSSE.isFIPS()) {
-                if (ks.getProvider() != SunJSSE.cryptoProvider) {
-                    throw new KeyStoreException("FIPS mode: KeyStore must be "
-                        + "from provider " + SunJSSE.cryptoProvider.getName());
-                }
-            }
             keyManager = new SunX509KeyManagerImpl(ks, password);
             isInitialized = true;
         }
@@ -91,12 +85,6 @@
                 keyManager = new X509KeyManagerImpl(
                         Collections.<Builder>emptyList());
             } else {
-                if (SunJSSE.isFIPS() &&
-                        (ks.getProvider() != SunJSSE.cryptoProvider)) {
-                    throw new KeyStoreException(
-                        "FIPS mode: KeyStore must be " +
-                        "from provider " + SunJSSE.cryptoProvider.getName());
-                }
                 try {
                     Builder builder = Builder.newInstance(ks,
                         new PasswordProtection(password));
@@ -115,10 +103,7 @@
                 throw new InvalidAlgorithmParameterException(
                 "Parameters must be instance of KeyStoreBuilderParameters");
             }
-            if (SunJSSE.isFIPS()) {
-                throw new InvalidAlgorithmParameterException
-                    ("FIPS mode: KeyStoreBuilderParameters not supported");
-            }
+
             List<Builder> builders =
                 ((KeyStoreBuilderParameters)params).getParameters();
             keyManager = new X509KeyManagerImpl(builders);
--- a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -458,7 +458,7 @@
         String identityAlg = shc.sslConfig.identificationProtocol;
         if (result && identityAlg != null) {
             String sessionIdentityAlg = s.getIdentificationProtocol();
-            if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+            if (!identityAlg.equalsIgnoreCase(sessionIdentityAlg)) {
                 if (SSLLogger.isOn &&
                     SSLLogger.isOn("ssl,handshake,verbose")) {
 
@@ -765,7 +765,7 @@
             String hmacAlg =
                 "Hmac" + hashAlg.name.replace("-", "");
             try {
-                Mac hmac = JsseJce.getMac(hmacAlg);
+                Mac hmac = Mac.getInstance(hmacAlg);
                 hmac.init(finishedKey);
                 return hmac.doFinal(digest);
             } catch (NoSuchAlgorithmException | InvalidKeyException ex) {
--- a/src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/RSAKeyExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -109,7 +109,7 @@
 
         byte[] getEncoded(PublicKey publicKey,
                 SecureRandom secureRandom) throws GeneralSecurityException {
-            Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
+            Cipher cipher = Cipher.getInstance(JsseJce.CIPHER_RSA_PKCS1);
             cipher.init(Cipher.WRAP_MODE, publicKey, secureRandom);
             return cipher.wrap(premasterSecret);
         }
@@ -119,7 +119,7 @@
                 ClientHandshakeContext chc) throws GeneralSecurityException {
             String algorithm = chc.negotiatedProtocol.useTLS12PlusSpec() ?
                     "SunTls12RsaPremasterSecret" : "SunTlsRsaPremasterSecret";
-            KeyGenerator kg = JsseJce.getKeyGenerator(algorithm);
+            KeyGenerator kg = KeyGenerator.getInstance(algorithm);
             TlsRsaPremasterSecretParameterSpec spec =
                     new TlsRsaPremasterSecretParameterSpec(
                             chc.clientHelloVersion,
@@ -136,7 +136,7 @@
 
             byte[] encoded = null;
             boolean needFailover = false;
-            Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
+            Cipher cipher = Cipher.getInstance(JsseJce.CIPHER_RSA_PKCS1);
             try {
                 // Try UNWRAP_MODE mode firstly.
                 cipher.init(Cipher.UNWRAP_MODE, privateKey,
@@ -163,7 +163,7 @@
             if (needFailover) {
                 // The cipher might be spoiled by unsuccessful call to init(),
                 // so request a fresh instance
-                cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
+                cipher = Cipher.getInstance(JsseJce.CIPHER_RSA_PKCS1);
 
                 // Use DECRYPT_MODE and dispose the previous initialization.
                 cipher.init(Cipher.DECRYPT_MODE, privateKey);
@@ -227,7 +227,7 @@
             try {
                 String s = ((clientVersion >= ProtocolVersion.TLS12.id) ?
                     "SunTls12RsaPremasterSecret" : "SunTlsRsaPremasterSecret");
-                KeyGenerator kg = JsseJce.getKeyGenerator(s);
+                KeyGenerator kg = KeyGenerator.getInstance(s);
                 kg.init(new TlsRsaPremasterSecretParameterSpec(
                         clientVersion, serverVersion, encodedSecret),
                         generator);
--- a/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -306,7 +306,7 @@
             // check constraints of RSA PublicKey
             RSAPublicKey publicKey;
             try {
-                KeyFactory kf = JsseJce.getKeyFactory("RSA");
+                KeyFactory kf = KeyFactory.getInstance("RSA");
                 RSAPublicKeySpec spec = new RSAPublicKeySpec(
                     new BigInteger(1, skem.modulus),
                     new BigInteger(1, skem.exponent));
--- a/src/java.base/share/classes/sun/security/ssl/RSASignature.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/RSASignature.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,9 +53,9 @@
 
     public RSASignature() throws NoSuchAlgorithmException {
         super();
-        rawRsa = JsseJce.getSignature(JsseJce.SIGNATURE_RAWRSA);
-        this.mdMD5 = JsseJce.getMessageDigest("MD5");
-        this.mdSHA = JsseJce.getMessageDigest("SHA");
+        rawRsa = Signature.getInstance(JsseJce.SIGNATURE_RAWRSA);
+        this.mdMD5 = MessageDigest.getInstance("MD5");
+        this.mdSHA = MessageDigest.getInstance("SHA");
     }
 
     /**
@@ -66,7 +66,7 @@
      * which may be this class.
      */
     static Signature getInstance() throws NoSuchAlgorithmException {
-        return JsseJce.getSignature(JsseJce.SIGNATURE_SSLRSA);
+        return Signature.getInstance(JsseJce.SIGNATURE_SSLRSA);
     }
 
     @Override
--- a/src/java.base/share/classes/sun/security/ssl/SSLCipher.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLCipher.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -851,7 +851,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 cipher.init(Cipher.DECRYPT_MODE, key, params, random);
             }
 
@@ -933,7 +933,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 cipher.init(Cipher.ENCRYPT_MODE, key, params, random);
             }
 
@@ -1023,7 +1023,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 cipher.init(Cipher.DECRYPT_MODE, key, params, random);
             }
 
@@ -1175,7 +1175,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 cipher.init(Cipher.ENCRYPT_MODE, key, params, random);
             }
 
@@ -1291,7 +1291,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 if (params == null) {
                     params = new IvParameterSpec(new byte[sslCipher.ivSize]);
                 }
@@ -1455,7 +1455,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.random = random;
                 if (params == null) {
                     params = new IvParameterSpec(new byte[sslCipher.ivSize]);
@@ -1590,7 +1590,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.tagSize = sslCipher.tagSize;
                 this.key = key;
                 this.fixedIv = ((IvParameterSpec)params).getIV();
@@ -1705,7 +1705,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.tagSize = sslCipher.tagSize;
                 this.key = key;
                 this.fixedIv = ((IvParameterSpec)params).getIV();
@@ -1838,7 +1838,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.tagSize = sslCipher.tagSize;
                 this.key = key;
                 this.iv = ((IvParameterSpec)params).getIV();
@@ -1992,7 +1992,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.tagSize = sslCipher.tagSize;
                 this.key = key;
                 this.iv = ((IvParameterSpec)params).getIV();
@@ -2133,7 +2133,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.tagSize = sslCipher.tagSize;
                 this.key = key;
                 this.iv = ((IvParameterSpec)params).getIV();
@@ -2252,7 +2252,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.tagSize = sslCipher.tagSize;
                 this.key = key;
                 this.iv = ((IvParameterSpec)params).getIV();
@@ -2392,7 +2392,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.tagSize = sslCipher.tagSize;
                 this.key = key;
                 this.iv = ((IvParameterSpec)params).getIV();
@@ -2534,7 +2534,7 @@
                     Key key, AlgorithmParameterSpec params,
                     SecureRandom random) throws GeneralSecurityException {
                 super(authenticator, protocolVersion);
-                this.cipher = JsseJce.getCipher(algorithm);
+                this.cipher = Cipher.getInstance(algorithm);
                 this.tagSize = sslCipher.tagSize;
                 this.key = key;
                 this.iv = ((IvParameterSpec)params).getIV();
--- a/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLConfiguration.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.function.BiFunction;
+import javax.crypto.KeyGenerator;
 import javax.net.ssl.HandshakeCompletedListener;
 import javax.net.ssl.SNIMatcher;
 import javax.net.ssl.SNIServerName;
@@ -104,7 +105,7 @@
                     "jdk.tls.useExtendedMasterSecret", true);
         if (supportExtendedMasterSecret) {
             try {
-                JsseJce.getKeyGenerator("SunTlsExtendedMasterSecret");
+                KeyGenerator.getInstance("SunTlsExtendedMasterSecret");
             } catch (NoSuchAlgorithmException nae) {
                 supportExtendedMasterSecret = false;
             }
--- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,14 +94,8 @@
         trustManager = chooseTrustManager(tm);
 
         if (sr == null) {
-            secureRandom = JsseJce.getSecureRandom();
+            secureRandom = new SecureRandom();
         } else {
-            if (SunJSSE.isFIPS() &&
-                        (sr.getProvider() != SunJSSE.cryptoProvider)) {
-                throw new KeyManagementException
-                    ("FIPS mode: SecureRandom must be from provider "
-                    + SunJSSE.cryptoProvider.getName());
-            }
             secureRandom = sr;
         }
 
@@ -127,12 +121,6 @@
         // We only use the first instance of X509TrustManager passed to us.
         for (int i = 0; tm != null && i < tm.length; i++) {
             if (tm[i] instanceof X509TrustManager) {
-                if (SunJSSE.isFIPS() &&
-                        !(tm[i] instanceof X509TrustManagerImpl)) {
-                    throw new KeyManagementException
-                        ("FIPS mode: only SunJSSE TrustManagers may be used");
-                }
-
                 if (tm[i] instanceof X509ExtendedTrustManager) {
                     return (X509TrustManager)tm[i];
                 } else {
@@ -153,20 +141,7 @@
             if (!(km instanceof X509KeyManager)) {
                 continue;
             }
-            if (SunJSSE.isFIPS()) {
-                // In FIPS mode, require that one of SunJSSE's own keymanagers
-                // is used. Otherwise, we cannot be sure that only keys from
-                // the FIPS token are used.
-                if ((km instanceof X509KeyManagerImpl)
-                            || (km instanceof SunX509KeyManagerImpl)) {
-                    return (X509ExtendedKeyManager)km;
-                } else {
-                    // throw exception, we don't want to silently use the
-                    // dummy keymanager without telling the user.
-                    throw new KeyManagementException
-                        ("FIPS mode: only SunJSSE KeyManagers may be used");
-                }
-            }
+
             if (km instanceof X509ExtendedKeyManager) {
                 return (X509ExtendedKeyManager)km;
             }
@@ -548,41 +523,24 @@
         private static final List<CipherSuite> serverDefaultCipherSuites;
 
         static {
-            if (SunJSSE.isFIPS()) {
-                supportedProtocols = Arrays.asList(
-                    ProtocolVersion.TLS13,
-                    ProtocolVersion.TLS12,
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10
-                );
+            supportedProtocols = Arrays.asList(
+                ProtocolVersion.TLS13,
+                ProtocolVersion.TLS12,
+                ProtocolVersion.TLS11,
+                ProtocolVersion.TLS10,
+                ProtocolVersion.SSL30,
+                ProtocolVersion.SSL20Hello
+            );
 
-                serverDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS13,
-                    ProtocolVersion.TLS12,
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10
-                });
-            } else {
-                supportedProtocols = Arrays.asList(
-                    ProtocolVersion.TLS13,
-                    ProtocolVersion.TLS12,
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10,
-                    ProtocolVersion.SSL30,
-                    ProtocolVersion.SSL20Hello
-                );
-
-                serverDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS13,
-                    ProtocolVersion.TLS12,
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10,
-                    ProtocolVersion.SSL30,
-                    ProtocolVersion.SSL20Hello
-                });
-            }
+            serverDefaultProtocols = getAvailableProtocols(
+                    new ProtocolVersion[] {
+                ProtocolVersion.TLS13,
+                ProtocolVersion.TLS12,
+                ProtocolVersion.TLS11,
+                ProtocolVersion.TLS10,
+                ProtocolVersion.SSL30,
+                ProtocolVersion.SSL20Hello
+            });
 
             supportedCipherSuites = getApplicableSupportedCipherSuites(
                     supportedProtocols);
@@ -626,23 +584,14 @@
         }
 
         static ProtocolVersion[] getSupportedProtocols() {
-            if (SunJSSE.isFIPS()) {
-                return new ProtocolVersion[] {
-                        ProtocolVersion.TLS13,
-                        ProtocolVersion.TLS12,
-                        ProtocolVersion.TLS11,
-                        ProtocolVersion.TLS10
-                };
-            } else {
-                return new ProtocolVersion[]{
-                        ProtocolVersion.TLS13,
-                        ProtocolVersion.TLS12,
-                        ProtocolVersion.TLS11,
-                        ProtocolVersion.TLS10,
-                        ProtocolVersion.SSL30,
-                        ProtocolVersion.SSL20Hello
-                };
-            }
+            return new ProtocolVersion[]{
+                    ProtocolVersion.TLS13,
+                    ProtocolVersion.TLS12,
+                    ProtocolVersion.TLS11,
+                    ProtocolVersion.TLS10,
+                    ProtocolVersion.SSL30,
+                    ProtocolVersion.SSL20Hello
+            };
         }
     }
 
@@ -656,18 +605,11 @@
         private static final List<CipherSuite> clientDefaultCipherSuites;
 
         static {
-            if (SunJSSE.isFIPS()) {
-                clientDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS10
-                });
-            } else {
-                clientDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS10,
-                    ProtocolVersion.SSL30
-                });
-            }
+            clientDefaultProtocols = getAvailableProtocols(
+                    new ProtocolVersion[] {
+                ProtocolVersion.TLS10,
+                ProtocolVersion.SSL30
+            });
 
             clientDefaultCipherSuites = getApplicableEnabledCipherSuites(
                     clientDefaultProtocols, true);
@@ -694,20 +636,12 @@
         private static final List<CipherSuite> clientDefaultCipherSuites;
 
         static {
-            if (SunJSSE.isFIPS()) {
-                clientDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10
-                });
-            } else {
-                clientDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10,
-                    ProtocolVersion.SSL30
-                });
-            }
+            clientDefaultProtocols = getAvailableProtocols(
+                    new ProtocolVersion[] {
+                ProtocolVersion.TLS11,
+                ProtocolVersion.TLS10,
+                ProtocolVersion.SSL30
+            });
 
             clientDefaultCipherSuites = getApplicableEnabledCipherSuites(
                     clientDefaultProtocols, true);
@@ -735,22 +669,13 @@
         private static final List<CipherSuite> clientDefaultCipherSuites;
 
         static {
-            if (SunJSSE.isFIPS()) {
-                clientDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS12,
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10
-                });
-            } else {
-                clientDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS12,
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10,
-                    ProtocolVersion.SSL30
-                });
-            }
+            clientDefaultProtocols = getAvailableProtocols(
+                    new ProtocolVersion[] {
+                ProtocolVersion.TLS12,
+                ProtocolVersion.TLS11,
+                ProtocolVersion.TLS10,
+                ProtocolVersion.SSL30
+            });
 
             clientDefaultCipherSuites = getApplicableEnabledCipherSuites(
                     clientDefaultProtocols, true);
@@ -777,24 +702,14 @@
         private static final List<CipherSuite> clientDefaultCipherSuites;
 
         static {
-            if (SunJSSE.isFIPS()) {
-                clientDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS13,
-                    ProtocolVersion.TLS12,
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10
-                });
-            } else {
-                clientDefaultProtocols = getAvailableProtocols(
-                        new ProtocolVersion[] {
-                    ProtocolVersion.TLS13,
-                    ProtocolVersion.TLS12,
-                    ProtocolVersion.TLS11,
-                    ProtocolVersion.TLS10,
-                    ProtocolVersion.SSL30
-                });
-            }
+            clientDefaultProtocols = getAvailableProtocols(
+                    new ProtocolVersion[] {
+                ProtocolVersion.TLS13,
+                ProtocolVersion.TLS12,
+                ProtocolVersion.TLS11,
+                ProtocolVersion.TLS10,
+                ProtocolVersion.SSL30
+            });
 
             clientDefaultCipherSuites = getApplicableEnabledCipherSuites(
                     clientDefaultProtocols, true);
@@ -866,16 +781,6 @@
                             " is not a supported SSL protocol name");
                     }
 
-                    if (SunJSSE.isFIPS() &&
-                            ((pv == ProtocolVersion.SSL30) ||
-                             (pv == ProtocolVersion.SSL20Hello))) {
-                        reservedException = new IllegalArgumentException(
-                                propname + ": " + pv +
-                                " is not FIPS compliant");
-
-                        break;
-                    }
-
                     // ignore duplicated protocols
                     if (!arrayList.contains(pv)) {
                         arrayList.add(pv);
@@ -955,22 +860,13 @@
         }
 
         static ProtocolVersion[] getProtocols() {
-            if (SunJSSE.isFIPS()) {
-                return new ProtocolVersion[]{
-                        ProtocolVersion.TLS13,
-                        ProtocolVersion.TLS12,
-                        ProtocolVersion.TLS11,
-                        ProtocolVersion.TLS10
-                };
-            } else {
-                return new ProtocolVersion[]{
-                        ProtocolVersion.TLS13,
-                        ProtocolVersion.TLS12,
-                        ProtocolVersion.TLS11,
-                        ProtocolVersion.TLS10,
-                        ProtocolVersion.SSL30
-                };
-            }
+            return new ProtocolVersion[]{
+                    ProtocolVersion.TLS13,
+                    ProtocolVersion.TLS12,
+                    ProtocolVersion.TLS11,
+                    ProtocolVersion.TLS10,
+                    ProtocolVersion.SSL30
+            };
         }
 
         protected CustomizedTLSContext() {
--- a/src/java.base/share/classes/sun/security/ssl/SSLMasterKeyDerivation.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLMasterKeyDerivation.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,7 +145,7 @@
             }
 
             try {
-                KeyGenerator kg = JsseJce.getKeyGenerator(masterAlg);
+                KeyGenerator kg = KeyGenerator.getInstance(masterAlg);
                 kg.init(spec);
                 return kg.generateKey();
             } catch (InvalidAlgorithmParameterException |
--- a/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SSLTrafficKeyDerivation.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -280,7 +280,7 @@
                     hashAlg.name, hashAlg.hashLength, hashAlg.blockSize);
 
             try {
-                KeyGenerator kg = JsseJce.getKeyGenerator(keyMaterialAlg);
+                KeyGenerator kg = KeyGenerator.getInstance(keyMaterialAlg);
                 kg.init(spec);
 
                 this.keyMaterialSpec = (TlsKeyMaterialSpec)kg.generateKey();
--- a/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SignatureScheme.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -194,7 +194,7 @@
 
             boolean mediator = true;
             try {
-                Signature signer = JsseJce.getSignature("RSASSA-PSS");
+                Signature signer = Signature.getInstance("RSASSA-PSS");
                 signer.setParameter(pssParamSpec);
             } catch (InvalidAlgorithmParameterException |
                     NoSuchAlgorithmException exp) {
@@ -275,7 +275,7 @@
             mediator = signAlgParamSpec.isAvailable;
         } else {
             try {
-                JsseJce.getSignature(algorithm);
+                Signature.getInstance(algorithm);
             } catch (Exception e) {
                 mediator = false;
                 if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
@@ -466,7 +466,7 @@
             return null;
         }
 
-        Signature signer = JsseJce.getSignature(algorithm);
+        Signature signer = Signature.getInstance(algorithm);
         if (key instanceof PublicKey) {
             signer.initVerify((PublicKey)(key));
         } else {
--- a/src/java.base/share/classes/sun/security/ssl/SunJSSE.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SunJSSE.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,97 +66,16 @@
         "(PKCS12, SunX509/PKIX key/trust factories, " +
         "SSLv3/TLSv1/TLSv1.1/TLSv1.2/TLSv1.3/DTLSv1.0/DTLSv1.2)";
 
-    private static String fipsInfo =
-        "Sun JSSE provider (FIPS mode, crypto provider ";
-
-    // tri-valued flag:
-    // null  := no final decision made
-    // false := data structures initialized in non-FIPS mode
-    // true  := data structures initialized in FIPS mode
-    private static Boolean fips;
-
-    // the FIPS certificate crypto provider that we use to perform all crypto
-    // operations. null in non-FIPS mode
-    static java.security.Provider cryptoProvider;
-
-    protected static synchronized boolean isFIPS() {
-        if (fips == null) {
-            fips = false;
-        }
-        return fips;
-    }
-
-    // ensure we can use FIPS mode using the specified crypto provider.
-    // enable FIPS mode if not already enabled.
-    private static synchronized void ensureFIPS(java.security.Provider p) {
-        if (fips == null) {
-            fips = true;
-            cryptoProvider = p;
-        } else {
-            if (fips == false) {
-                throw new ProviderException
-                    ("SunJSSE already initialized in non-FIPS mode");
-            }
-            if (cryptoProvider != p) {
-                throw new ProviderException
-                    ("SunJSSE already initialized with FIPS crypto provider "
-                    + cryptoProvider);
-            }
-        }
-    }
-
-    // standard constructor
     protected SunJSSE() {
         super("SunJSSE", PROVIDER_VER, info);
         subclassCheck();
-        if (Boolean.TRUE.equals(fips)) {
-            throw new ProviderException
-                ("SunJSSE is already initialized in FIPS mode");
-        }
-        registerAlgorithms(false);
+        registerAlgorithms();
     }
 
-    // preferred constructor to enable FIPS mode at runtime
-    protected SunJSSE(java.security.Provider cryptoProvider){
-        this(checkNull(cryptoProvider), cryptoProvider.getName());
-    }
-
-    // constructor to enable FIPS mode from java.security file
-    protected SunJSSE(String cryptoProvider){
-        this(null, checkNull(cryptoProvider));
-    }
-
-    private static <T> T checkNull(T t) {
-        if (t == null) {
-            throw new ProviderException("cryptoProvider must not be null");
-        }
-        return t;
-    }
-
-    private SunJSSE(java.security.Provider cryptoProvider,
-            String providerName) {
-        super("SunJSSE", PROVIDER_VER, fipsInfo + providerName + ")");
-        subclassCheck();
-        if (cryptoProvider == null) {
-            // Calling Security.getProvider() will cause other providers to be
-            // loaded. That is not good but unavoidable here.
-            cryptoProvider = Security.getProvider(providerName);
-            if (cryptoProvider == null) {
-                throw new ProviderException
-                    ("Crypto provider not installed: " + providerName);
-            }
-        }
-        ensureFIPS(cryptoProvider);
-        registerAlgorithms(true);
-    }
-
-    private void registerAlgorithms(final boolean isfips) {
-        AccessController.doPrivileged(new PrivilegedAction<Object>() {
-            @Override
-            public Object run() {
-                doRegister(isfips);
-                return null;
-            }
+    private void registerAlgorithms() {
+        AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
+            doRegister();
+            return null;
         });
     }
 
@@ -165,14 +84,13 @@
         putService(new Provider.Service(this, type, algo, cn, aliases, attrs));
     }
 
-    private void doRegister(boolean isfips) {
-        if (isfips == false) {
-            Iterator<Provider.Service> rsaIter =
-                new SunRsaSignEntries(this).iterator();
-            while (rsaIter.hasNext()) {
-                putService(rsaIter.next());
-            }
+    private void doRegister() {
+        Iterator<Provider.Service> rsaIter =
+            new SunRsaSignEntries(this).iterator();
+        while (rsaIter.hasNext()) {
+            putService(rsaIter.next());
         }
+
         ps("Signature", "MD5andSHA1withRSA",
             "sun.security.ssl.RSASignature", null, null);
 
@@ -183,14 +101,15 @@
             createAliases("PKIX"), null);
 
         ps("TrustManagerFactory", "SunX509",
-            "sun.security.ssl.TrustManagerFactoryImpl$SimpleFactory", null, null);
+            "sun.security.ssl.TrustManagerFactoryImpl$SimpleFactory",
+            null, null);
         ps("TrustManagerFactory", "PKIX",
             "sun.security.ssl.TrustManagerFactoryImpl$PKIXFactory",
             createAliases("SunPKIX", "X509", "X.509"), null);
 
         ps("SSLContext", "TLSv1",
             "sun.security.ssl.SSLContextImpl$TLS10Context",
-            (isfips? null : createAliases("SSLv3")), null);
+            createAliases("SSLv3"), null);
         ps("SSLContext", "TLSv1.1",
             "sun.security.ssl.SSLContextImpl$TLS11Context", null, null);
         ps("SSLContext", "TLSv1.2",
@@ -199,7 +118,7 @@
             "sun.security.ssl.SSLContextImpl$TLS13Context", null, null);
         ps("SSLContext", "TLS",
             "sun.security.ssl.SSLContextImpl$TLSContext",
-            (isfips? null : createAliases("SSL")), null);
+            createAliases("SSL"), null);
 
         ps("SSLContext", "DTLSv1.0",
             "sun.security.ssl.SSLContextImpl$DTLS10Context", null, null);
@@ -225,12 +144,4 @@
             throw new AssertionError("Illegal subclass: " + getClass());
         }
     }
-
-    @Override
-    @SuppressWarnings("deprecation")
-    protected final void finalize() throws Throwable {
-        // empty
-        super.finalize();
-    }
-
 }
--- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,6 +52,7 @@
 import sun.security.ssl.SSLExtension.ExtensionConsumer;
 import sun.security.ssl.SSLExtension.SSLExtensionSpec;
 import sun.security.ssl.SSLHandshake.HandshakeMessage;
+import sun.security.util.ECUtil;
 
 /**
  * Pack of the "supported_groups" extensions [RFC 4492/7919].
@@ -158,15 +159,23 @@
     }
 
     static enum NamedGroupType {
-        NAMED_GROUP_ECDHE,          // Elliptic Curve Groups (ECDHE)
-        NAMED_GROUP_FFDHE,          // Finite Field Groups (DHE)
-        NAMED_GROUP_XDH,            // Finite Field Groups (XDH)
-        NAMED_GROUP_ARBITRARY,      // arbitrary prime and curves (ECDHE)
-        NAMED_GROUP_NONE;           // Not predefined named group
+        NAMED_GROUP_ECDHE     ("EC"),
+        NAMED_GROUP_FFDHE     ("DiffieHellman"),
+        NAMED_GROUP_X25519    ("x25519"),
+        NAMED_GROUP_X448      ("x448"),
+        NAMED_GROUP_ARBITRARY ("EC"),
+        NAMED_GROUP_NONE      ("");
+
+        private final String algorithm;
+
+        private NamedGroupType(String algorithm) {
+            this.algorithm = algorithm;
+        }
 
         boolean isSupported(List<CipherSuite> cipherSuites) {
             for (CipherSuite cs : cipherSuites) {
-                if (cs.keyExchange == null || cs.keyExchange.groupType == this) {
+                if (cs.keyExchange == null ||
+                        cs.keyExchange.groupType == this) {
                     return true;
                 }
             }
@@ -180,108 +189,142 @@
         //
         // See sun.security.util.CurveDB for the OIDs
         // NIST K-163
-        SECT163_K1  (0x0001, "sect163k1", "1.3.132.0.1", true,
+        SECT163_K1  (0x0001, "sect163k1", "1.3.132.0.1",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECT163_R1  (0x0002, "sect163r1", "1.3.132.0.2", false,
+        SECT163_R1  (0x0002, "sect163r1", "1.3.132.0.2",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST B-163
-        SECT163_R2  (0x0003, "sect163r2", "1.3.132.0.15", true,
+        SECT163_R2  (0x0003, "sect163r2", "1.3.132.0.15",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECT193_R1  (0x0004, "sect193r1", "1.3.132.0.24", false,
+        SECT193_R1  (0x0004, "sect193r1", "1.3.132.0.24",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECT193_R2  (0x0005, "sect193r2", "1.3.132.0.25", false,
+        SECT193_R2  (0x0005, "sect193r2", "1.3.132.0.25",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST K-233
-        SECT233_K1  (0x0006, "sect233k1", "1.3.132.0.26", true,
+        SECT233_K1  (0x0006, "sect233k1", "1.3.132.0.26",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST B-233
-        SECT233_R1  (0x0007, "sect233r1", "1.3.132.0.27", true,
+        SECT233_R1  (0x0007, "sect233r1", "1.3.132.0.27",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECT239_K1  (0x0008, "sect239k1", "1.3.132.0.3", false,
+        SECT239_K1  (0x0008, "sect239k1", "1.3.132.0.3",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST K-283
-        SECT283_K1  (0x0009, "sect283k1", "1.3.132.0.16", true,
+        SECT283_K1  (0x0009, "sect283k1", "1.3.132.0.16",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST B-283
-        SECT283_R1  (0x000A, "sect283r1", "1.3.132.0.17", true,
+        SECT283_R1  (0x000A, "sect283r1", "1.3.132.0.17",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST K-409
-        SECT409_K1  (0x000B, "sect409k1", "1.3.132.0.36", true,
+        SECT409_K1  (0x000B, "sect409k1", "1.3.132.0.36",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST B-409
-        SECT409_R1  (0x000C, "sect409r1", "1.3.132.0.37", true,
+        SECT409_R1  (0x000C, "sect409r1", "1.3.132.0.37",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST K-571
-        SECT571_K1  (0x000D, "sect571k1", "1.3.132.0.38", true,
+        SECT571_K1  (0x000D, "sect571k1", "1.3.132.0.38",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST B-571
-        SECT571_R1  (0x000E, "sect571r1", "1.3.132.0.39", true,
+        SECT571_R1  (0x000E, "sect571r1", "1.3.132.0.39",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECP160_K1  (0x000F, "secp160k1", "1.3.132.0.9", false,
+        SECP160_K1  (0x000F, "secp160k1", "1.3.132.0.9",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECP160_R1  (0x0010, "secp160r1", "1.3.132.0.8", false,
+        SECP160_R1  (0x0010, "secp160r1", "1.3.132.0.8",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECP160_R2  (0x0011, "secp160r2", "1.3.132.0.30", false,
+        SECP160_R2  (0x0011, "secp160r2", "1.3.132.0.30",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECP192_K1  (0x0012, "secp192k1", "1.3.132.0.31", false,
+        SECP192_K1  (0x0012, "secp192k1", "1.3.132.0.31",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST P-192
-        SECP192_R1  (0x0013, "secp192r1", "1.2.840.10045.3.1.1", true,
+        SECP192_R1  (0x0013, "secp192r1", "1.2.840.10045.3.1.1",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECP224_K1  (0x0014, "secp224k1", "1.3.132.0.32", false,
+        SECP224_K1  (0x0014, "secp224k1", "1.3.132.0.32",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
         // NIST P-224
-        SECP224_R1  (0x0015, "secp224r1", "1.3.132.0.33", true,
+        SECP224_R1  (0x0015, "secp224r1", "1.3.132.0.33",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        SECP256_K1  (0x0016, "secp256k1", "1.3.132.0.10", false,
+        SECP256_K1  (0x0016, "secp256k1", "1.3.132.0.10",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_12),
 
         // NIST P-256
-        SECP256_R1  (0x0017, "secp256r1", "1.2.840.10045.3.1.7", true,
+        SECP256_R1  (0x0017, "secp256r1", "1.2.840.10045.3.1.7",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_13),
 
         // NIST P-384
-        SECP384_R1  (0x0018, "secp384r1", "1.3.132.0.34", true,
+        SECP384_R1  (0x0018, "secp384r1", "1.3.132.0.34",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_13),
 
         // NIST P-521
-        SECP521_R1  (0x0019, "secp521r1", "1.3.132.0.35", true,
+        SECP521_R1  (0x0019, "secp521r1", "1.3.132.0.35",
+                            NamedGroupType.NAMED_GROUP_ECDHE,
                             ProtocolVersion.PROTOCOLS_TO_13),
 
         // x25519 and x448
-        X25519      (0x001D, "x25519", true, "x25519",
+        X25519      (0x001D, "x25519", null,
+                            NamedGroupType.NAMED_GROUP_X25519,
                             ProtocolVersion.PROTOCOLS_TO_13),
-        X448        (0x001E, "x448", true, "x448",
+        X448        (0x001E, "x448", null,
+                            NamedGroupType.NAMED_GROUP_X448,
                             ProtocolVersion.PROTOCOLS_TO_13),
 
         // Finite Field Diffie-Hellman Ephemeral Parameters (RFC 7919)
-        FFDHE_2048  (0x0100, "ffdhe2048",  true,
+        FFDHE_2048  (0x0100, "ffdhe2048", null,
+                            NamedGroupType.NAMED_GROUP_FFDHE,
                             ProtocolVersion.PROTOCOLS_TO_13),
-        FFDHE_3072  (0x0101, "ffdhe3072",  true,
+        FFDHE_3072  (0x0101, "ffdhe3072", null,
+                            NamedGroupType.NAMED_GROUP_FFDHE,
                             ProtocolVersion.PROTOCOLS_TO_13),
-        FFDHE_4096  (0x0102, "ffdhe4096",  true,
+        FFDHE_4096  (0x0102, "ffdhe4096", null,
+                            NamedGroupType.NAMED_GROUP_FFDHE,
                             ProtocolVersion.PROTOCOLS_TO_13),
-        FFDHE_6144  (0x0103, "ffdhe6144",  true,
+        FFDHE_6144  (0x0103, "ffdhe6144", null,
+                            NamedGroupType.NAMED_GROUP_FFDHE,
                             ProtocolVersion.PROTOCOLS_TO_13),
-        FFDHE_8192  (0x0104, "ffdhe8192",  true,
+        FFDHE_8192  (0x0104, "ffdhe8192", null,
+                            NamedGroupType.NAMED_GROUP_FFDHE,
                             ProtocolVersion.PROTOCOLS_TO_13),
 
         // Elliptic Curves (RFC 4492)
         //
         // arbitrary prime and characteristic-2 curves
-        ARBITRARY_PRIME  (0xFF01, "arbitrary_explicit_prime_curves",
+        ARBITRARY_PRIME  (0xFF01, "arbitrary_explicit_prime_curves", null,
+                            NamedGroupType.NAMED_GROUP_ARBITRARY,
                             ProtocolVersion.PROTOCOLS_TO_12),
-        ARBITRARY_CHAR2  (0xFF02, "arbitrary_explicit_char2_curves",
+        ARBITRARY_CHAR2  (0xFF02, "arbitrary_explicit_char2_curves", null,
+                            NamedGroupType.NAMED_GROUP_ARBITRARY,
                             ProtocolVersion.PROTOCOLS_TO_12);
 
         final int id;               // hash + signature
@@ -289,55 +332,16 @@
         final String name;          // literal name
         final String oid;           // object identifier of the named group
         final String algorithm;     // signature algorithm
-        final boolean isFips;       // can be used in FIPS mode?
         final ProtocolVersion[] supportedProtocols;
 
-        // Constructor used for Elliptic Curve Groups (ECDHE)
-        private NamedGroup(int id, String name, String oid, boolean isFips,
+        private NamedGroup(int id, String name, String oid,
+                NamedGroupType namedGroupType,
                 ProtocolVersion[] supportedProtocols) {
             this.id = id;
-            this.type = NamedGroupType.NAMED_GROUP_ECDHE;
+            this.type = namedGroupType;
             this.name = name;
             this.oid = oid;
-            this.algorithm = "EC";
-            this.isFips = isFips;
-            this.supportedProtocols = supportedProtocols;
-        }
-
-        // Constructor used for Elliptic Curve Groups (XDH)
-        private NamedGroup(int id, String name,
-                boolean isFips, String algorithm,
-                ProtocolVersion[] supportedProtocols) {
-            this.id = id;
-            this.type = NamedGroupType.NAMED_GROUP_XDH;
-            this.name = name;
-            this.oid = null;
-            this.algorithm = algorithm;
-            this.isFips = isFips;
-            this.supportedProtocols = supportedProtocols;
-        }
-
-        // Constructor used for Finite Field Diffie-Hellman Groups (FFDHE)
-        private NamedGroup(int id, String name, boolean isFips,
-                ProtocolVersion[] supportedProtocols) {
-            this.id = id;
-            this.type = NamedGroupType.NAMED_GROUP_FFDHE;
-            this.name = name;
-            this.oid = null;
-            this.algorithm = "DiffieHellman";
-            this.isFips = isFips;
-            this.supportedProtocols = supportedProtocols;
-        }
-
-        // Constructor used for arbitrary prime and curves (ECDHE)
-        private NamedGroup(int id, String name,
-                ProtocolVersion[] supportedProtocols) {
-            this.id = id;
-            this.type = NamedGroupType.NAMED_GROUP_ARBITRARY;
-            this.name = name;
-            this.oid = null;
-            this.algorithm = "EC";
-            this.isFips = false;
+            this.algorithm = namedGroupType.algorithm;
             this.supportedProtocols = supportedProtocols;
         }
 
@@ -352,7 +356,7 @@
         }
 
         static NamedGroup valueOf(ECParameterSpec params) {
-            String oid = JsseJce.getNamedCurveOid(params);
+            String oid = ECUtil.getCurveName(null, params);
             if ((oid != null) && (!oid.isEmpty())) {
                 for (NamedGroup group : NamedGroup.values()) {
                     if ((group.type == NamedGroupType.NAMED_GROUP_ECDHE) &&
@@ -472,8 +476,6 @@
         static final NamedGroup[] supportedNamedGroups;
 
         static {
-            boolean requireFips = SunJSSE.isFIPS();
-
             // The value of the System Property defines a list of enabled named
             // groups in preference order, separated with comma.  For example:
             //
@@ -499,8 +501,7 @@
                     group = group.trim();
                     if (!group.isEmpty()) {
                         NamedGroup namedGroup = NamedGroup.nameOf(group);
-                        if (namedGroup != null &&
-                                (!requireFips || namedGroup.isFips)) {
+                        if (namedGroup != null) {
                             if (isAvailableGroup(namedGroup)) {
                                 groupList.add(namedGroup);
                             }
@@ -514,29 +515,7 @@
                             property + ") contains no supported named groups");
                 }
             } else {        // default groups
-                NamedGroup[] groups;
-                if (requireFips) {
-                    groups = new NamedGroup[] {
-                        // only NIST curves in FIPS mode
-                        NamedGroup.SECP256_R1,
-                        NamedGroup.SECP384_R1,
-                        NamedGroup.SECP521_R1,
-                        NamedGroup.SECT283_K1,
-                        NamedGroup.SECT283_R1,
-                        NamedGroup.SECT409_K1,
-                        NamedGroup.SECT409_R1,
-                        NamedGroup.SECT571_K1,
-                        NamedGroup.SECT571_R1,
-
-                        // FFDHE 2048
-                        NamedGroup.FFDHE_2048,
-                        NamedGroup.FFDHE_3072,
-                        NamedGroup.FFDHE_4096,
-                        NamedGroup.FFDHE_6144,
-                        NamedGroup.FFDHE_8192,
-                    };
-                } else {
-                    groups = new NamedGroup[] {
+                NamedGroup[] groups = new NamedGroup[] {
                         // NIST curves first
                         NamedGroup.SECP256_R1,
                         NamedGroup.SECP384_R1,
@@ -558,7 +537,6 @@
                         NamedGroup.FFDHE_6144,
                         NamedGroup.FFDHE_8192,
                     };
-                }
 
                 groupList = new ArrayList<>(groups.length);
                 for (NamedGroup group : groups) {
@@ -587,7 +565,7 @@
             if (namedGroup.type == NamedGroupType.NAMED_GROUP_ECDHE) {
                 if (namedGroup.oid != null) {
                     try {
-                        params = JsseJce.getAlgorithmParameters("EC");
+                        params = AlgorithmParameters.getInstance("EC");
                         spec = new ECGenParameterSpec(namedGroup.oid);
                     } catch (NoSuchAlgorithmException e) {
                         return false;
@@ -595,7 +573,7 @@
                 }
             } else if (namedGroup.type == NamedGroupType.NAMED_GROUP_FFDHE) {
                 try {
-                    params = JsseJce.getAlgorithmParameters("DiffieHellman");
+                    params = AlgorithmParameters.getInstance("DiffieHellman");
                     spec = getFFDHEDHParameterSpec(namedGroup);
                 } catch (NoSuchAlgorithmException e) {
                     return false;
--- a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -218,7 +218,7 @@
                 responseList =
                         ((ExtendedSSLSession)session).getStatusResponses();
             }
-            trustedChain = validate(v, chain, responseList,
+            trustedChain = v.validate(chain, null, responseList,
                     constraints, isClient ? null : authType);
 
             // check if EE certificate chains to a public root CA (as
@@ -234,7 +234,7 @@
                         getRequestedServerNames(socket), chainsToPublicCA);
             }
         } else {
-            trustedChain = validate(v, chain, Collections.emptyList(),
+            trustedChain = v.validate(chain, null, Collections.emptyList(),
                     null, isClient ? null : authType);
         }
 
@@ -276,7 +276,7 @@
                 responseList =
                         ((ExtendedSSLSession)session).getStatusResponses();
             }
-            trustedChain = validate(v, chain, responseList,
+            trustedChain = v.validate(chain, null, responseList,
                     constraints, isClient ? null : authType);
 
             // check if EE certificate chains to a public root CA (as
@@ -292,7 +292,7 @@
                         getRequestedServerNames(engine), chainsToPublicCA);
             }
         } else {
-            trustedChain = validate(v, chain, Collections.emptyList(),
+            trustedChain = v.validate(chain, null, Collections.emptyList(),
                     null, isClient ? null : authType);
         }
 
@@ -312,18 +312,6 @@
         return v;
     }
 
-    private static X509Certificate[] validate(Validator v,
-            X509Certificate[] chain, List<byte[]> responseList,
-            AlgorithmConstraints constraints, String authType)
-            throws CertificateException {
-        Object o = JsseJce.beginFipsProvider();
-        try {
-            return v.validate(chain, null, responseList, constraints, authType);
-        } finally {
-            JsseJce.endFipsProvider(o);
-        }
-    }
-
     // Get string representation of HostName from a list of server names.
     //
     // We are only accepting host_name name type in the list.
--- a/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/share/classes/sun/security/tools/keytool/Main.java	Thu Feb 14 22:08:36 2019 +0100
@@ -211,7 +211,7 @@
             STORETYPE, PROVIDERNAME, ADDPROVIDER, PROVIDERCLASS,
             PROVIDERPATH, V, PROTECTED),
         GENKEYPAIR("Generates.a.key.pair",
-            ALIAS, KEYALG, KEYSIZE, CURVENAME, SIGALG, DESTALIAS, DNAME,
+            ALIAS, KEYALG, KEYSIZE, CURVENAME, SIGALG, DNAME,
             STARTDATE, EXT, VALIDITY, KEYPASS, KEYSTORE,
             STOREPASS, STORETYPE, PROVIDERNAME, ADDPROVIDER,
             PROVIDERCLASS, PROVIDERPATH, V, PROTECTED),
--- a/src/java.base/solaris/native/libnet/solaris_close.c	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/solaris/native/libnet/solaris_close.c	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,10 +59,6 @@
     RESTARTABLE_RETURN_INT(readv(s, vector, count));
 }
 
-int NET_WriteV(int s, const struct iovec * vector, int count) {
-    RESTARTABLE_RETURN_INT(writev(s, vector, count));
-}
-
 int NET_Send(int s, void *msg, int len, unsigned int flags) {
     RESTARTABLE_RETURN_INT(send(s, msg, len, flags));
 }
--- a/src/java.base/unix/classes/java/lang/ProcessImpl.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/unix/classes/java/lang/ProcessImpl.java	Thu Feb 14 22:08:36 2019 +0100
@@ -89,7 +89,7 @@
 
     private static enum Platform {
 
-        LINUX(LaunchMechanism.VFORK, LaunchMechanism.POSIX_SPAWN, LaunchMechanism.FORK),
+        LINUX(LaunchMechanism.POSIX_SPAWN, LaunchMechanism.VFORK, LaunchMechanism.FORK),
 
         BSD(LaunchMechanism.POSIX_SPAWN, LaunchMechanism.FORK),
 
@@ -106,27 +106,6 @@
                 EnumSet.copyOf(Arrays.asList(launchMechanisms));
         }
 
-        @SuppressWarnings("fallthrough")
-        private String helperPath(String javahome, String osArch) {
-            switch (this) {
-                case SOLARIS:
-                    // fall through...
-                case LINUX:
-                case AIX:
-                case BSD:
-                    return javahome + "/lib/jspawnhelper";
-
-                default:
-                    throw new AssertionError("Unsupported platform: " + this);
-            }
-        }
-
-        String helperPath() {
-            Properties props = GetPropertyAction.privilegedGetProperties();
-            return helperPath(StaticProperty.javaHome(),
-                              props.getProperty("os.arch"));
-        }
-
         LaunchMechanism launchMechanism() {
             return AccessController.doPrivileged(
                 (PrivilegedAction<LaunchMechanism>) () -> {
@@ -169,7 +148,7 @@
 
     private static final Platform platform = Platform.get();
     private static final LaunchMechanism launchMechanism = platform.launchMechanism();
-    private static final byte[] helperpath = toCString(platform.helperPath());
+    private static final byte[] helperpath = toCString(StaticProperty.javaHome() + "/lib/jspawnhelper");
 
     private static byte[] toCString(String s) {
         if (s == null)
--- a/src/java.base/unix/native/libjava/ProcessImpl_md.c	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c	Thu Feb 14 22:08:36 2019 +0100
@@ -49,56 +49,139 @@
 #include "childproc.h"
 
 /*
- * There are 4 possible strategies we might use to "fork":
  *
- * - fork(2).  Very portable and reliable but subject to
- *   failure due to overcommit (see the documentation on
- *   /proc/sys/vm/overcommit_memory in Linux proc(5)).
- *   This is the ancient problem of spurious failure whenever a large
- *   process starts a small subprocess.
+ * When starting a child on Unix, we need to do three things:
+ * - fork off
+ * - in the child process, do some pre-exec work: duping/closing file
+ *   descriptors to set up stdio-redirection, setting environment variables,
+ *   changing paths...
+ * - then exec(2) the target binary
  *
- * - vfork().  Using this is scary because all relevant man pages
- *   contain dire warnings, e.g. Linux vfork(2).  But at least it's
- *   documented in the glibc docs and is standardized by XPG4.
- *   http://www.opengroup.org/onlinepubs/000095399/functions/vfork.html
- *   On Linux, one might think that vfork() would be implemented using
- *   the clone system call with flag CLONE_VFORK, but in fact vfork is
- *   a separate system call (which is a good sign, suggesting that
- *   vfork will continue to be supported at least on Linux).
- *   Another good sign is that glibc implements posix_spawn using
- *   vfork whenever possible.  Note that we cannot use posix_spawn
- *   ourselves because there's no reliable way to close all inherited
- *   file descriptors.
+ * There are three ways to fork off:
  *
- * - clone() with flags CLONE_VM but not CLONE_THREAD.  clone() is
- *   Linux-specific, but this ought to work - at least the glibc
- *   sources contain code to handle different combinations of CLONE_VM
- *   and CLONE_THREAD.  However, when this was implemented, it
- *   appeared to fail on 32-bit i386 (but not 64-bit x86_64) Linux with
- *   the simple program
- *     Runtime.getRuntime().exec("/bin/true").waitFor();
- *   with:
- *     #  Internal Error (os_linux_x86.cpp:683), pid=19940, tid=2934639536
- *     #  Error: pthread_getattr_np failed with errno = 3 (ESRCH)
- *   We believe this is a glibc bug, reported here:
- *     http://sources.redhat.com/bugzilla/show_bug.cgi?id=10311
- *   but the glibc maintainers closed it as WONTFIX.
+ * A) fork(2). Portable and safe (no side effects) but may fail with ENOMEM on
+ *    all Unices when invoked from a VM with a high memory footprint. On Unices
+ *    with strict no-overcommit policy this problem is most visible.
  *
- * - posix_spawn(). While posix_spawn() is a fairly elaborate and
- *   complicated system call, it can't quite do everything that the old
- *   fork()/exec() combination can do, so the only feasible way to do
- *   this, is to use posix_spawn to launch a new helper executable
- *   "jprochelper", which in turn execs the target (after cleaning
- *   up file-descriptors etc.) The end result is the same as before,
- *   a child process linked to the parent in the same way, but it
- *   avoids the problem of duplicating the parent (VM) process
- *   address space temporarily, before launching the target command.
+ *    This is because forking the VM will first create a child process with
+ *    theoretically the same memory footprint as the parent - even if you plan
+ *    to follow up with exec'ing a tiny binary. In reality techniques like
+ *    copy-on-write etc mitigate the problem somewhat but we still run the risk
+ *    of hitting system limits.
  *
- * Based on the above analysis, we are currently using vfork() on
- * Linux and posix_spawn() on other Unix systems.
+ *    For a Linux centric description of this problem, see the documentation on
+ *    /proc/sys/vm/overcommit_memory in Linux proc(5).
+ *
+ * B) vfork(2): Portable and fast but very unsafe. It bypasses the memory
+ *    problems related to fork(2) by starting the child in the memory image of
+ *    the parent. Things that can go wrong include:
+ *    - Programming errors in the child process before the exec(2) call may
+ *      trash memory in the parent process, most commonly the stack of the
+ *      thread invoking vfork.
+ *    - Signals received by the child before the exec(2) call may be at best
+ *      misdirected to the parent, at worst immediately kill child and parent.
+ *
+ *    This is mitigated by very strict rules about what one is allowed to do in
+ *    the child process between vfork(2) and exec(2), which is basically nothing.
+ *    However, we always broke this rule by doing the pre-exec work between
+ *    vfork(2) and exec(2).
+ *
+ *    Also note that vfork(2) has been deprecated by the OpenGroup, presumably
+ *    because of its many dangers.
+ *
+ * C) clone(2): This is a Linux specific call which gives the caller fine
+ *    grained control about how exactly the process fork is executed. It is
+ *    powerful, but Linux-specific.
+ *
+ * Aside from these three possibilities there is a forth option:  posix_spawn(3).
+ * Where fork/vfork/clone all fork off the process and leave pre-exec work and
+ * calling exec(2) to the user, posix_spawn(3) offers the user fork+exec-like
+ * functionality in one package, similar to CreateProcess() on Windows.
+ *
+ * It is not a system call in itself, but usually a wrapper implemented within
+ * the libc in terms of one of (fork|vfork|clone)+exec - so whether or not it
+ * has advantages over calling the naked (fork|vfork|clone) functions depends
+ * on how posix_spawn(3) is implemented.
+ *
+ * Note that when using posix_spawn(3), we exec twice: first a tiny binary called
+ * the jspawnhelper, then in the jspawnhelper we do the pre-exec work and exec a
+ * second time, this time the target binary (similar to the "exec-twice-technique"
+ * described in http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-September/055333.html).
+ *
+ * This is a JDK-specific implementation detail which just happens to be
+ * implemented for jdk.lang.Process.launchMechanism=POSIX_SPAWN.
+ *
+ * --- Linux-specific ---
+ *
+ * How does glibc implement posix_spawn?
+ * (see: sysdeps/posix/spawni.c for glibc < 2.24,
+ *       sysdeps/unix/sysv/linux/spawni.c for glibc >= 2.24):
+ *
+ * 1) Before glibc 2.4 (released 2006), posix_spawn(3) used just fork(2)/exec(2).
+ *    This would be bad for the JDK since we would risk the known memory issues with
+ *    fork(2). But since this only affects glibc variants which have long been
+ *    phased out by modern distributions, this is irrelevant.
+ *
+ * 2) Between glibc 2.4 and glibc 2.23, posix_spawn uses either fork(2) or
+ *    vfork(2) depending on how exactly the user called posix_spawn(3):
+ *
+ * <quote>
+ *       The child process is created using vfork(2) instead of fork(2) when
+ *       either of the following is true:
+ *
+ *       * the spawn-flags element of the attributes object pointed to by
+ *          attrp contains the GNU-specific flag POSIX_SPAWN_USEVFORK; or
+ *
+ *       * file_actions is NULL and the spawn-flags element of the attributes
+ *          object pointed to by attrp does not contain
+ *          POSIX_SPAWN_SETSIGMASK, POSIX_SPAWN_SETSIGDEF,
+ *          POSIX_SPAWN_SETSCHEDPARAM, POSIX_SPAWN_SETSCHEDULER,
+ *          POSIX_SPAWN_SETPGROUP, or POSIX_SPAWN_RESETIDS.
+ * </quote>
+ *
+ * Due to the way the JDK calls posix_spawn(3), it would therefore call vfork(2).
+ * So we would avoid the fork(2) memory problems. However, there still remains the
+ * risk associated with vfork(2). But it is smaller than were we to call vfork(2)
+ * directly since we use the jspawnhelper, moving all pre-exec work off to after
+ * the first exec, thereby reducing the vulnerable time window.
+ *
+ * 3) Since glibc >= 2.24, glibc uses clone+exec:
+ *
+ *    new_pid = CLONE (__spawni_child, STACK (stack, stack_size), stack_size,
+ *                     CLONE_VM | CLONE_VFORK | SIGCHLD, &args);
+ *
+ * This is even better than (2):
+ *
+ * CLONE_VM means we run in the parent's memory image, as with (2)
+ * CLONE_VFORK means parent waits until we exec, as with (2)
+ *
+ * However, error possibilities are further reduced since:
+ * - posix_spawn(3) passes a separate stack for the child to run on, eliminating
+ *   the danger of trashing the forking thread's stack in the parent process.
+ * - posix_spawn(3) takes care to temporarily block all incoming signals to the
+ *   child process until the first exec(2) has been called,
+ *
+ * TL;DR
+ * Calling posix_spawn(3) for glibc
+ * (2) < 2.24 is not perfect but still better than using plain vfork(2), since
+ *     the chance of an error happening is greatly reduced
+ * (3) >= 2.24 is the best option - portable, fast and as safe as possible.
+ *
+ * ---
+ *
+ * How does muslc implement posix_spawn?
+ *
+ * They always did use the clone (.. CLONE_VM | CLONE_VFORK ...)
+ * technique. So we are safe to use posix_spawn() here regardless of muslc
+ * version.
+ *
+ * </Linux-specific>
+ *
+ *
+ * Based on the above analysis, we are currently defaulting to posix_spawn()
+ * on all Unices including Linux.
  */
 
-
 static void
 setSIGCHLDHandler(JNIEnv *env)
 {
--- a/src/java.base/unix/native/libnet/net_util_md.h	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.base/unix/native/libnet/net_util_md.h	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,6 @@
 int NET_Send(int s, void *msg, int len, unsigned int flags);
 int NET_SendTo(int s, const void *msg, int len,  unsigned  int
                flags, const struct sockaddr *to, int tolen);
-int NET_Writev(int s, const struct iovec * vector, int count);
 int NET_Connect(int s, struct sockaddr *addr, int addrlen);
 int NET_Accept(int s, struct sockaddr *addr, socklen_t *addrlen);
 int NET_SocketClose(int s);
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/OutputPropertiesFactory.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,15 +20,6 @@
 
 package com.sun.org.apache.xml.internal.serializer;
 
-import com.sun.org.apache.xml.internal.serializer.utils.MsgKey;
-import com.sun.org.apache.xml.internal.serializer.utils.Utils;
-import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException;
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Enumeration;
 import java.util.Properties;
 import javax.xml.transform.OutputKeys;
 import jdk.xml.internal.SecuritySupport;
@@ -68,18 +59,18 @@
  * of the corresponding character, like this one: <br> quot=34 <br>
  *
  * <li> <b>S_USE_URL_ESCAPING </b> -
- * This non-standard property key is used to set a value of "yes" if the href values for HTML serialization should
- *  use %xx escaping.
+ * This non-standard property key is used to set a value of "yes" if the href values
+ * for HTML serialization should use %xx escaping.
  *
  * <li> <b>S_OMIT_META_TAG </b> -
- * This non-standard property key is used to set a value of "yes" if the META tag should be omitted where it would
- *  otherwise be supplied.
+ * This non-standard property key is used to set a value of "yes" if the META tag
+ * should be omitted where it would otherwise be supplied.
  * </ul>
  *
  * @see SerializerFactory
  * @see Method
  * @see Serializer
- * @LastModified: Oct 2017
+ * @LastModified: Feb 2019
  */
 public final class OutputPropertiesFactory
 {
@@ -147,14 +138,15 @@
         S_BUILTIN_EXTENSIONS_UNIVERSAL + "entities";
 
     /**
-     * This non-standard property key is used to set a value of "yes" if the href values for HTML serialization should
-     *  use %xx escaping. */
+     * This non-standard property key is used to set a value of "yes" if the href
+     * values for HTML serialization should use %xx escaping.
+     */
     public static final String S_USE_URL_ESCAPING =
         S_BUILTIN_EXTENSIONS_UNIVERSAL + "use-url-escaping";
 
     /**
-     * This non-standard property key is used to set a value of "yes" if the META tag should be omitted where it would
-     *  otherwise be supplied.
+     * This non-standard property key is used to set a value of "yes" if the META
+     * tag should be omitted where it would otherwise be supplied.
      */
     public static final String S_OMIT_META_TAG =
         S_BUILTIN_EXTENSIONS_UNIVERSAL + "omit-meta-tag";
@@ -174,53 +166,133 @@
         S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL.length();
 
     /**
-     * This non-standard, Oracle-impl only property key is used as if OutputKeys.STANDALONE is specified but
-     * without writing it out in the declaration; It can be used to reverse the change by Xalan patch 1495.
-     * Since Xalan patch 1495 can cause incompatible behavior, this property is add for application to neutralize
-     * the effect of Xalan patch 1495
+     * This non-standard, Oracle-impl only property key is used as if
+     * OutputKeys.STANDALONE is specified but without writing it out in the declaration;
+     * It can be used to reverse the change by Xalan patch 1495.
+     * Since Xalan patch 1495 can cause incompatible behavior, this property is
+     * added for application to neutralize the effect of Xalan patch 1495
      */
-        /**
-         * <p>Is Standalone</p>
-         *
-         * <ul>
-         *   <li>
-         *     <code>yes</code> to indicate the output is intended to be used as standalone
-         *   </li>
-         *   <li>
-         *     <code>no</code> has no effect.
-         *   </li>
-         * </ul>
-         */
+    /**
+     * <p>Is Standalone</p>
+     *
+     * <ul>
+     *   <li>
+     *     <code>yes</code> to indicate the output is intended to be used as standalone
+     *   </li>
+     *   <li>
+     *     <code>no</code> has no effect.
+     *   </li>
+     * </ul>
+     */
     public static final String ORACLE_IS_STANDALONE = "http://www.oracle.com/xml/is-standalone";
 
     //************************************************************
     //*  PRIVATE CONSTANTS
     //************************************************************
 
-    private static final String S_XSLT_PREFIX = "xslt.output.";
-    private static final int S_XSLT_PREFIX_LEN = S_XSLT_PREFIX.length();
-    private static final String S_XALAN_PREFIX = "org.apache.xslt.";
-    private static final int S_XALAN_PREFIX_LEN = S_XALAN_PREFIX.length();
+    /*
+     * XSLT properties do not need namespace qualification.
+     *
+     * Xalan-specific output properties can be overridden in the stylesheet
+     * assigning a xalan namespace.  For example:
+     * <xsl:stylesheet version="1.0"
+     *          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+     *          xmlns:xalan="http://xml.apache.org/xalan">
+     *  <xsl:output method="html" encoding="UTF-8"
+     *              xalan:content-handler="MyContentHandler"/>
+     *  ...
+     */
+    private static final String[] PROP_XML = {
+        "method",
+        "version",
+        "encoding",
+        "indent",
+        "omit-xml-declaration",
+        "standalone",
+        "media-type",
+        "{http://xml.apache.org/xalan}indent-amount",
+        "{http://xml.apache.org/xalan}content-handler",
+        "{http://xml.apache.org/xalan}entities"
+    };
 
-    /** Synchronization object for lazy initialization of the above tables. */
-    private static final Object m_synch_object = new Object();
+    private static final String[] PROP_XML_VALUE = {
+        "xml",
+        "1.0",
+        "UTF-8",
+        "no",
+        "no",
+        "no",
+        "text/xml",
+        "0",
+        "com.sun.org.apache.xml.internal.serializer.ToXMLStream",
+        "com/sun/org/apache/xml/internal/serializer/XMLEntities"
+    };
 
-    /** the directory in which the various method property files are located */
-    private static final String PROP_DIR = "com/sun/org/apache/xml/internal/serializer/";
-    /** property file for default XML properties */
-    private static final String PROP_FILE_XML = "output_xml.properties";
-    /** property file for default TEXT properties */
-    private static final String PROP_FILE_TEXT = "output_text.properties";
-    /** property file for default HTML properties */
-    private static final String PROP_FILE_HTML = "output_html.properties";
-    /** property file for default UNKNOWN (Either XML or HTML, to be determined later) properties */
-    private static final String PROP_FILE_UNKNOWN = "output_unknown.properties";
+    private static final String[] PROP_HTML = {
+        "method",
+        "indent",
+        "media",
+        "version",
+        "{http://xml.apache.org/xalan}indent-amount",
+        "{http://xml.apache.org/xalan}content-handler",
+        "{http://xml.apache.org/xalan}entities",
+        "{http://xml.apache.org/xalan}use-url-escaping",
+        "{http://xml.apache.org/xalan}omit-meta-tag"
+    };
+
+    private static final String[] PROP_HTML_VALUE = {
+        "html",
+        "yes",
+        "text/html",
+        "4.0",
+        "4",
+        "com.sun.org.apache.xml.internal.serializer.ToHTMLStream",
+        "com/sun/org/apache/xml/internal/serializer/HTMLEntities",
+        "yes",
+        "no"
+    };
+
+    private static final String[] PROP_TEXT = {
+        "method",
+        "media-type",
+        "{http://xml.apache.org/xalan}content-handler"
+    };
+
+    private static final String[] PROP_TEXT_VALUE = {
+        "text",
+        "text/plain",
+        "com.sun.org.apache.xml.internal.serializer.ToTextStream"
+    };
+
+    private static final String[] PROP_UNKNOWN = {
+        "method",
+        "version",
+        "encoding",
+        "indent",
+        "omit-xml-declaration",
+        "standalone",
+        "media-type",
+        "{http://xml.apache.org/xalan}indent-amount",
+        "{http://xml.apache.org/xalan}content-handler"
+    };
+
+    private static final String[] PROP_UNKNOWN_VALUE = {
+        "xml",
+        "1.0",
+        "UTF-8",
+        "no",
+        "no",
+        "no",
+        "text/xml",
+        "0",
+        "com.sun.org.apache.xml.internal.serializer.ToUnknownStream",
+    };
 
     //************************************************************
     //*  PRIVATE STATIC FIELDS
     //************************************************************
 
-    /** The default properties of all output files. */
+    /** The default properties for all other than html and text. */
     private static Properties m_xml_properties = null;
 
     /** The default properties when method="html". */
@@ -232,38 +304,8 @@
     /** The properties when method="" for the "unknown" wrapper */
     private static Properties m_unknown_properties = null;
 
-    private static final Class<?>
-        ACCESS_CONTROLLER_CLASS = findAccessControllerClass();
-
-    private static Class<?> findAccessControllerClass() {
-        try
-        {
-            // This Class was introduced in JDK 1.2. With the re-architecture of
-            // security mechanism ( starting in JDK 1.2 ), we have option of
-            // giving privileges to certain part of code using doPrivileged block.
-            // In JDK1.1.X applications won't be having security manager and if
-            // there is security manager ( in applets ), code need to be signed
-            // and trusted for having access to resources.
-
-            return Class.forName("java.security.AccessController");
-        }
-        catch (Exception e)
-        {
-            //User may be using older JDK ( JDK <1.2 ). Allow him/her to use it.
-            // But don't try to use doPrivileged
-        }
-
-        return null;
-    }
-
     /**
-     * Creates an empty OutputProperties with the property key/value defaults specified by
-     * a property file.  The method argument is used to construct a string of
-     * the form output_[method].properties (for instance, output_html.properties).
-     * The output_xml.properties file is always used as the base.
-     *
-     * <p>Anything other than 'text', 'xml', and 'html', will
-     * use the output_xml.properties file.</p>
+     * Returns a Properties based on the specified method. The default is xml.
      *
      * @param   method non-null reference to method name.
      *
@@ -271,265 +313,71 @@
      */
     static public final Properties getDefaultMethodProperties(String method)
     {
-        String fileName = null;
         Properties defaultProperties = null;
-        // According to this article : Double-check locking does not work
-        // http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-toolbox.html
-        try
-        {
-            synchronized (m_synch_object)
-            {
-                if (null == m_xml_properties) // double check
-                {
-                    fileName = PROP_FILE_XML;
-                    m_xml_properties = loadPropertiesFile(fileName, null);
+
+        if (null == m_xml_properties) {
+            m_xml_properties = initProperties(PROP_XML, PROP_XML_VALUE, null);
+        }
+
+
+        switch (method) {
+            case Method.XML:
+                defaultProperties = m_xml_properties;
+                break;
+            case Method.HTML:
+                if (null == m_html_properties) {
+                    m_html_properties = initProperties(
+                            PROP_HTML, PROP_HTML_VALUE, m_xml_properties);
                 }
-            }
+                defaultProperties = m_html_properties;
+                break;
+            case Method.TEXT:
+                if (null == m_text_properties) {
+                    m_text_properties = initProperties(
+                            PROP_TEXT, PROP_TEXT_VALUE, m_xml_properties);
 
-            if (method.equals(Method.XML))
-            {
-                defaultProperties = m_xml_properties;
-            }
-            else if (method.equals(Method.HTML))
-            {
-                if (null == m_html_properties) // double check
-                {
-                    fileName = PROP_FILE_HTML;
-                    m_html_properties =
-                        loadPropertiesFile(fileName, m_xml_properties);
-                }
-
-                defaultProperties = m_html_properties;
-            }
-            else if (method.equals(Method.TEXT))
-            {
-                if (null == m_text_properties) // double check
-                {
-                    fileName = PROP_FILE_TEXT;
-                    m_text_properties =
-                        loadPropertiesFile(fileName, m_xml_properties);
-                    if (null
-                        == m_text_properties.getProperty(OutputKeys.ENCODING))
+                    if (null == m_text_properties.getProperty(OutputKeys.ENCODING))
                     {
                         String mimeEncoding = Encodings.getMimeEncoding(null);
-                        m_text_properties.put(
-                            OutputKeys.ENCODING,
-                            mimeEncoding);
+                        m_text_properties.put(OutputKeys.ENCODING, mimeEncoding);
                     }
                 }
+                defaultProperties = m_text_properties;
+                break;
+            case com.sun.org.apache.xml.internal.serializer.Method.UNKNOWN:
+                if (null == m_unknown_properties) {
+                    m_unknown_properties = initProperties(
+                            PROP_UNKNOWN, PROP_UNKNOWN_VALUE, m_xml_properties);
+                }
+                defaultProperties = m_unknown_properties;
+                break;
+            default:
+                defaultProperties = m_xml_properties;
+                break;
+        }
 
-                defaultProperties = m_text_properties;
-            }
-            else if (method.equals(com.sun.org.apache.xml.internal.serializer.Method.UNKNOWN))
-            {
-                if (null == m_unknown_properties) // double check
-                {
-                    fileName = PROP_FILE_UNKNOWN;
-                    m_unknown_properties =
-                        loadPropertiesFile(fileName, m_xml_properties);
-                }
-
-                defaultProperties = m_unknown_properties;
-            }
-            else
-            {
-                // TODO: Calculate res file from name.
-                defaultProperties = m_xml_properties;
-            }
-        }
-        catch (IOException ioe)
-        {
-            throw new WrappedRuntimeException(
-                Utils.messages.createMessage(
-                    MsgKey.ER_COULD_NOT_LOAD_METHOD_PROPERTY,
-                    new Object[] { fileName, method }),
-                ioe);
-        }
         // wrap these cached defaultProperties in a new Property object just so
         // that the caller of this method can't modify the default values
         return new Properties(defaultProperties);
     }
 
     /**
-     * Load the properties file from a resource stream.  If a
-     * key name such as "org.apache.xslt.xxx", fix up the start of
-     * string to be a curly namespace.  If a key name starts with
-     * "xslt.output.xxx", clip off "xslt.output.".  If a key name *or* a
-     * key value is discovered, check for \u003a in the text, and
-     * fix it up to be ":", since earlier versions of the JDK do not
-     * handle the escape sequence (at least in key names).
+     * Initiates the properties
      *
-     * @param resourceName non-null reference to resource name.
+     * @param keys an array of keys
+     * @param values values corresponding to the keys
      * @param defaults Default properties, which may be null.
      */
-    static private Properties loadPropertiesFile(
-        final String resourceName,
-        Properties defaults)
-        throws IOException
+    static private Properties initProperties(String[] keys, String[] values, Properties defaults)
     {
-
-        // This static method should eventually be moved to a thread-specific class
-        // so that we can cache the ContextClassLoader and bottleneck all properties file
-        // loading throughout Xalan.
-
         Properties props = new Properties(defaults);
 
-        InputStream is = null;
-        BufferedInputStream bis = null;
-
-        try
-        {
-            if (ACCESS_CONTROLLER_CLASS != null)
-            {
-                is = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
-                        public InputStream run()
-                        {
-                            return OutputPropertiesFactory.class
-                                .getResourceAsStream(resourceName);
-                        }
-                    });
-            }
-            else
-            {
-                // User may be using older JDK ( JDK < 1.2 )
-                is = OutputPropertiesFactory.class
-                    .getResourceAsStream(resourceName);
-            }
-
-            bis = new BufferedInputStream(is);
-            props.load(bis);
-        }
-        catch (IOException ioe)
-        {
-            if (defaults == null)
-            {
-                throw ioe;
-            }
-            else
-            {
-                throw new WrappedRuntimeException(
-                    Utils.messages.createMessage(
-                        MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
-                        new Object[] { resourceName }),
-                    ioe);
-                //"Could not load '"+resourceName+"' (check CLASSPATH), now using just the defaults ", ioe);
-            }
-        }
-        catch (SecurityException se)
-        {
-            // Repeat IOException handling for sandbox/applet case -sc
-            if (defaults == null)
-            {
-                throw se;
-            }
-            else
-            {
-                throw new WrappedRuntimeException(
-                    Utils.messages.createMessage(
-                        MsgKey.ER_COULD_NOT_LOAD_RESOURCE,
-                        new Object[] { resourceName }),
-                    se);
-                //"Could not load '"+resourceName+"' (check CLASSPATH, applet security), now using just the defaults ", se);
-            }
-        }
-        finally
-        {
-            if (bis != null)
-            {
-                bis.close();
-            }
-            if (is != null)
-            {
-                is.close();
-            }
-        }
-
-        // Note that we're working at the HashTable level here,
-        // and not at the Properties level!  This is important
-        // because we don't want to modify the default properties.
-        // NB: If fixupPropertyString ends up changing the property
-        // name or value, we need to remove the old key and re-add
-        // with the new key and value.  However, then our Enumeration
-        // could lose its place in the HashTable.  So, we first
-        // clone the HashTable and enumerate over that since the
-        // clone will not change.  When we migrate to Collections,
-        // this code should be revisited and cleaned up to use
-        // an Iterator which may (or may not) alleviate the need for
-        // the clone.  Many thanks to Padraig O'hIceadha
-        // <padraig@gradient.ie> for finding this problem.  Bugzilla 2000.
-
-        Enumeration<Object> keys = ((Properties) props.clone()).keys();
-        while (keys.hasMoreElements())
-        {
-            String key = (String) keys.nextElement();
-            // Now check if the given key was specified as a
-            // System property. If so, the system property
-            // overides the default value in the propery file.
-            String value = null;
-            try
-            {
-                value = SecuritySupport.getSystemProperty(key);
-            }
-            catch (SecurityException se)
-            {
-                // No-op for sandbox/applet case, leave null -sc
-            }
-            if (value == null)
-                value = (String) props.get(key);
-
-            String newKey = fixupPropertyString(key, true);
-            String newValue = null;
-            try
-            {
-                newValue = SecuritySupport.getSystemProperty(newKey);
-            }
-            catch (SecurityException se)
-            {
-                // No-op for sandbox/applet case, leave null -sc
-            }
-            if (newValue == null)
-                newValue = fixupPropertyString(value, false);
-            else
-                newValue = fixupPropertyString(newValue, false);
-
-            if (key != newKey || value != newValue)
-            {
-                props.remove(key);
-                props.put(newKey, newValue);
-            }
-
+        for (int i = 0; i < keys.length; i++) {
+            // check System Property. This is kept as is for binary compatibility
+            String sys = SecuritySupport.getSystemProperty(keys[i]);
+            props.put(keys[i], (sys == null) ? values[i] : sys);
         }
 
         return props;
     }
-
-    /**
-     * Fix up a string in an output properties file according to
-     * the rules of {@link #loadPropertiesFile}.
-     *
-     * @param s non-null reference to string that may need to be fixed up.
-     * @return A new string if fixup occured, otherwise the s argument.
-     */
-    static private String fixupPropertyString(String s, boolean doClipping)
-    {
-        int index;
-        if (doClipping && s.startsWith(S_XSLT_PREFIX))
-        {
-            s = s.substring(S_XSLT_PREFIX_LEN);
-        }
-        if (s.startsWith(S_XALAN_PREFIX))
-        {
-            s =
-                S_BUILTIN_EXTENSIONS_UNIVERSAL
-                    + s.substring(S_XALAN_PREFIX_LEN);
-        }
-        if ((index = s.indexOf("\\u003a")) > 0)
-        {
-            String temp = s.substring(index + 6);
-            s = s.substring(0, index) + ":" + temp;
-
-        }
-        return s;
-    }
-
 }
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/output_html.properties	Wed Feb 13 16:43:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-###########################################################################
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
-###########################################################################
-##
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the  "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##
-#
-# Specify defaults when method="html".  These defaults use output_xml.properties
-# as a base.
-#
-
-# XSLT properties do not need namespace qualification.
-method=html
-indent=yes
-media-type=text/html
-version=4.0
-
-# Xalan-specific output properties.  These can be overridden in the stylesheet 
-# assigning a xalan namespace.  For example:
-# <xsl:stylesheet version="1.0"
-#          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-#          xmlns:xalan="http://xml.apache.org/xalan">
-#  <xsl:output method="html" encoding="UTF-8"
-#              xalan:content-handler="MyContentHandler"/>
-#  ...
-# Note that the colon after the protocol needs to be escaped.
-{http\u003a//xml.apache.org/xalan}indent-amount=4
-{http\u003a//xml.apache.org/xalan}content-handler=com.sun.org.apache.xml.internal.serializer.ToHTMLStream
-{http\u003a//xml.apache.org/xalan}entities=com/sun/org/apache/xml/internal/serializer/HTMLEntities
-{http\u003a//xml.apache.org/xalan}use-url-escaping=yes
-{http\u003a//xml.apache.org/xalan}omit-meta-tag=no
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/output_text.properties	Wed Feb 13 16:43:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-###########################################################################
-# reserved comment block
-# DO NOT REMOVE OR ALTER!
-###########################################################################
-##########################################################################
-# Copyright 2003-2004 The Apache Software Foundation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-#
-# $Id: output_text.properties,v 1.3 2005/09/28 13:49:10 pvedula Exp $
-#
-# Specify defaults when method="text".
-#
-
-# XSLT properties do not need namespace qualification.
-method=text
-media-type=text/plain
-
-# Xalan-specific output properties.  These can be overridden in the stylesheet 
-# assigning a xalan namespace.  For example:
-# <xsl:stylesheet version="1.0"
-#          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-#          xmlns:xalan="http://xml.apache.org/xalan">
-#  <xsl:output method="html" encoding="UTF-8"
-#              xalan:content-handler="MyContentHandler"/>
-#  ...
-# Note that the colon after the protocol needs to be escaped.
-{http\u003a//xml.apache.org/xalan}content-handler=com.sun.org.apache.xml.internal.serializer.ToTextStream
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/output_unknown.properties	Wed Feb 13 16:43:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-###########################################################################
-# reserved comment block
-# DO NOT REMOVE OR ALTER!
-###########################################################################
-###########################################################################
-# Copyright 2003-2004 The Apache Software Foundation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-#
-# $Id: output_unknown.properties,v 1.2.4.1 2005/09/15 08:15:33 suresh_emailid Exp $
-#
-# Specify defaults when no method="..." is specified.
-# This type of output will quickly switch to "xml" or "html"
-# depending on the first element name.
-#
-
-# XSLT properties do not need namespace qualification.
-method=xml
-version=1.0
-encoding=UTF-8
-indent=no
-omit-xml-declaration=no
-standalone=no
-media-type=text/xml
-
-# Xalan-specific output properties.  These can be overridden in the stylesheet 
-# assigning a xalan namespace.  For example:
-# <xsl:stylesheet version="1.0"
-#          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-#          xmlns:xalan="http://xml.apache.org/xalan">
-#  <xsl:output method="html" encoding="UTF-8"
-#              xalan:content-handler="MyContentHandler"/>
-#  ...
-# Note that the colon after the protocol needs to be escaped.
-{http\u003a//xml.apache.org/xalan}indent-amount=0
-{http\u003a//xml.apache.org/xalan}content-handler=com.sun.org.apache.xml.internal.serializer.ToUnknownStream
-
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/output_xml.properties	Wed Feb 13 16:43:41 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-###########################################################################
-# reserved comment block
-# DO NOT REMOVE OR ALTER!
-###########################################################################
-###########################################################################
-# Copyright 2003-2004 The Apache Software Foundation.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##########################################################################
-#
-# $Id: output_xml.properties,v 1.2.4.1 2005/09/15 08:15:33 suresh_emailid Exp $
-#
-# Specify defaults when method="xml".  These defaults serve as a base for 
-# other defaults, such as output_html and output_text.
-#
-
-# XSLT properties do not need namespace qualification.
-method=xml
-version=1.0
-encoding=UTF-8
-indent=no
-omit-xml-declaration=no
-standalone=no
-media-type=text/xml
-
-# Xalan-specific output properties.  These can be overridden in the stylesheet 
-# assigning a xalan namespace.  For example:
-# <xsl:stylesheet version="1.0"
-#          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-#          xmlns:xalan="http://xml.apache.org/xalan">
-#  <xsl:output method="html" encoding="UTF-8"
-#              xalan:content-handler="MyContentHandler"/>
-#  ...
-# Note that the colon after the protocol needs to be escaped.
-{http\u003a//xml.apache.org/xalan}indent-amount=0
-{http\u003a//xml.apache.org/xalan}content-handler=com.sun.org.apache.xml.internal.serializer.ToXMLStream
-{http\u003a//xml.apache.org/xalan}entities=com/sun/org/apache/xml/internal/serializer/XMLEntities
-
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.io.PrintWriter;
 import java.lang.module.ModuleDescriptor;
 import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.text.Collator;
@@ -752,14 +753,18 @@
         @Override
         public void process(OptionHelper helper, String option) throws InvalidValueException {
             if (option.endsWith(".java") ) {
-                Path p = Paths.get(option);
-                if (!Files.exists(p)) {
-                    throw helper.newInvalidValueException(Errors.FileNotFound(p.toString()));
+                try {
+                    Path p = Paths.get(option);
+                    if (!Files.exists(p)) {
+                        throw helper.newInvalidValueException(Errors.FileNotFound(p.toString()));
+                    }
+                    if (!Files.isRegularFile(p)) {
+                        throw helper.newInvalidValueException(Errors.FileNotFile(p));
+                    }
+                    helper.addFile(p);
+                } catch (InvalidPathException ex) {
+                    throw helper.newInvalidValueException(Errors.InvalidPath(option));
                 }
-                if (!Files.isRegularFile(p)) {
-                    throw helper.newInvalidValueException(Errors.FileNotFile(p));
-                }
-                helper.addFile(p);
             } else {
                 helper.addClassName(option);
             }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Feb 14 22:08:36 2019 +0100
@@ -1977,6 +1977,11 @@
 compiler.warn.invalid.path=\
     Invalid filename: {0}
 
+# 0: string
+compiler.err.invalid.path=\
+    Invalid filename: {0}
+
+
 # 0: path
 compiler.warn.invalid.archive.file=\
     Unexpected file on path: {0}
--- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -171,6 +171,13 @@
      * this is set to the appropriate value depending on the response length parameter.
      * <p>
      * This method must be called prior to calling {@link #getResponseBody()}.
+     *
+     * @implNote This implementation allows the caller to instruct the
+     * server to force a connection close after the exchange terminates, by
+     * supplying a {@code Connection: close} header to the {@linkplain
+     * #getResponseHeaders() response headers} before {@code sendResponseHeaders}
+     * is called.
+     *
      * @param rCode the response code to send
      * @param responseLength if {@literal > 0}, specifies a fixed response
      *        body length and that exact number of bytes must be written
--- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
 import java.lang.System.Logger;
 import java.lang.System.Logger.Level;
 import java.text.*;
+import java.util.stream.Stream;
 import com.sun.net.httpserver.*;
 
 class ExchangeImpl {
@@ -261,6 +262,22 @@
                 o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen));
             }
         }
+
+        // A custom handler can request that the connection be
+        // closed after the exchange by supplying Connection: close
+        // to the response header. Nothing to do if the exchange is
+        // already set up to be closed.
+        if (!close) {
+            Stream<String> conheader =
+                    Optional.ofNullable(rspHdrs.get("Connection"))
+                    .map(List::stream).orElse(Stream.empty());
+            if (conheader.anyMatch("close"::equalsIgnoreCase)) {
+                Logger logger = server.getLogger();
+                logger.log (Level.DEBUG, "Connection: close requested by handler");
+                close = true;
+            }
+        }
+
         write (rspHdrs, tmpout);
         this.rspContentLen = contentLen;
         tmpout.flush() ;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/BigIntegerIntrinsicsTest.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/BigIntegerIntrinsicsTest.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,22 +21,23 @@
  * questions.
  */
 
-
 package org.graalvm.compiler.hotspot.test;
 
+import java.lang.reflect.InvocationTargetException;
 import java.math.BigInteger;
 import java.util.Random;
 
 import org.graalvm.compiler.api.test.Graal;
+import org.graalvm.compiler.core.test.GraalCompilerTest;
 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
 import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider;
-import org.graalvm.compiler.replacements.test.MethodSubstitutionTest;
 import org.graalvm.compiler.runtime.RuntimeProvider;
 
 import org.junit.Test;
 
 import jdk.vm.ci.amd64.AMD64;
 import jdk.vm.ci.code.InstalledCode;
+import jdk.vm.ci.code.InvalidInstalledCodeException;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 
 /*
@@ -52,7 +53,7 @@
  * is not tested per se (only execution based on admissible intrinsics).
  *
  */
-public final class BigIntegerIntrinsicsTest extends MethodSubstitutionTest {
+public final class BigIntegerIntrinsicsTest extends GraalCompilerTest {
 
     static final int N = 100;
 
@@ -149,8 +150,8 @@
 
             assertDeepEquals(res1, res2);
 
-            // Invoke BigInteger testMontgomeryAux(BigInteger, BigExp, BigInteger) through code
-            // handle.
+            // Invoke BigInteger testMontgomeryAux(BigInteger, BigExp, BigInteger)
+            // through code handle.
             BigInteger res3 = (BigInteger) tin.invokeCode(big1, bigTwo, big2);
 
             assertDeepEquals(res1, res3);
@@ -168,7 +169,6 @@
     private class TestIntrinsic {
 
         TestIntrinsic(String testmname, Class<?> javaclass, String javamname, Class<?>... params) {
-
             javamethod = getResolvedJavaMethod(javaclass, javamname, params);
             testmethod = getResolvedJavaMethod(testmname);
 
@@ -179,21 +179,39 @@
             testcode = getCode(testmethod);
 
             assert testcode != null;
+            assert testcode.isValid();
         }
 
         Object invokeJava(BigInteger big, Object... args) {
-
             return invokeSafe(javamethod, big, args);
         }
 
         Object invokeTest(Object... args) {
-
             return invokeSafe(testmethod, null, args);
         }
 
         Object invokeCode(Object... args) {
+            try {
+                return testcode.executeVarargs(args);
+            }
+            catch (InvalidInstalledCodeException e) {
+                // Ensure the installed code is valid, possibly recompiled.
+                testcode = getCode(testmethod);
 
-            return executeVarargsSafe(testcode, args);
+                assert testcode != null;
+                assert testcode.isValid();
+
+                return invokeCode(args);
+            }
+        }
+
+        private Object invokeSafe(ResolvedJavaMethod method, Object receiver, Object... args) {
+            try {
+                return invoke(method, receiver, args);
+            } catch (IllegalAccessException   | InvocationTargetException |
+                     IllegalArgumentException | InstantiationException e) {
+                throw new RuntimeException(e);
+            }
         }
 
         // Private data section:
@@ -202,7 +220,8 @@
         private InstalledCode testcode;
     }
 
-    private static GraalHotSpotVMConfig config = ((HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class)).getVMConfig();
+    private static GraalHotSpotVMConfig config =
+        ((HotSpotGraalRuntimeProvider) Graal.getRequiredCapability(RuntimeProvider.class)).getVMConfig();
 
     private static BigInteger bigTwo = BigInteger.valueOf(2);
     private static Random rnd = new Random(17);
--- a/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/jdk.jcmd/share/classes/sun/tools/common/ProcessArgumentMatcher.java	Thu Feb 14 22:08:36 2019 +0100
@@ -85,9 +85,6 @@
         ProcessHelper helper = ProcessHelper.platformProcessHelper();
         if (helper != null) {
             mainClass = helper.getMainClass(vmd.id());
-            if (mainClass == null) {
-                return false;
-            }
         }
 
         // If the main class name is still unset then retrieve it with the attach mechanism
--- a/src/jdk.zipfs/share/classes/module-info.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/src/jdk.zipfs/share/classes/module-info.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,14 +24,89 @@
  */
 
 /**
- * Provides the implementation of the zip file system provider.
+ * Provides the implementation of the Zip file system provider.
+ * The Zip file system provider treats the contents of a Zip or JAR file as a file system.
+ * <p>
  *
- * <p> The zip file system provider treats a zip or JAR file as a file system
- * and provides the ability to manipulate the contents of the file.
- * The zip file system provider can be created by
- * {@link java.nio.file.FileSystems#newFileSystem
- * FileSystems.newFileSystem} if installed.
+ * <h3>Accessing a Zip File System</h3>
  *
+ * The {@linkplain java.nio.file.FileSystems FileSystems} {@code newFileSystem}
+ * static factory methods can be used to:
+ * <ul>
+ *     <li>Create a Zip file system</li>
+ *     <li>Open an existing file as a Zip file system</li>
+ * </ul>
+ *
+ * <h3>URI Scheme Used to Identify the Zip File System</h3>
+ *
+ * The URI {@link java.net.URI#getScheme scheme} that identifies the ZIP file system is {@code jar}.
+ *
+ * <h3>Zip File System Properties</h3>
+ *
+ * The following properties may be specified when creating a Zip
+ * file system:
+ * <p>
+ * <table class="striped">
+ * <caption style="display:none">
+ *     Configurable properties that may be specified when creating
+ *     a new Zip file system
+ * </caption>
+ * <thead>
+ * <tr>
+ * <th scope="col">Property Name</th>
+ * <th scope="col">Data Type</th>
+ * <th scope="col">Default Value</th>
+ * <th scope="col">Description</th>
+ * </tr>
+ * </thead>
+ *
+ * <tbody>
+ * <tr>
+ *   <td scope="row">create</td>
+ *   <td>java.lang.String</td>
+ *   <td>false</td>
+ *   <td>
+ *       If the value is {@code true}, the Zip file system provider
+ *       creates a new Zip or JAR file if it does not exist.
+ *   </td>
+ * </tr>
+ * <tr>
+ *   <td scope="row">encoding</td>
+ *   <td>java.lang.String</td>
+ *   <td>UTF-8</td>
+ *   <td>
+ *       The value indicates the encoding scheme for the
+ *       names of the entries in the Zip or JAR file.
+ *   </td>
+ * </tr>
+ * </tbody>
+ * </table>
+ *
+ * <h3>Examples:</h3>
+ *
+ * Construct a new Zip file system that is identified by a URI.  If the Zip file does not exist,
+ * it will be created:
+ * <pre>
+ * {@code
+ *
+ *     URI uri = URI.create("jar:file:/home/luckydog/tennisTeam.zip");
+ *     Map<String, String> env = Map.of("create", "true");
+ *     FileSystem zipfs = FileSystems.newFileSystem(uri, env);
+ * }
+ * </pre>
+ *
+ * Construct a new Zip file system that is identified by specifying a path
+ * and using automatic file type detection. Iterate from the root of the JAR displaying each
+ * found entry:
+ * <pre>
+ * {@code
+ *
+ *     FileSystem zipfs = FileSystems.newFileSystem(Path.of("helloworld.jar"), null);
+ *     Path rootDir = zipfs.getPath("/");
+ *     Files.walk(rootDir)
+ *            .forEach(System.out::println);
+ * }
+ * </pre>
  * @provides java.nio.file.spi.FileSystemProvider
  * @moduleGraph
  * @since 9
--- a/test/hotspot/gtest/unittest.hpp	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/gtest/unittest.hpp	Thu Feb 14 22:08:36 2019 +0100
@@ -105,7 +105,7 @@
   TEST(category, CONCAT(name, _vm_assert)) {                        \
     ASSERT_EXIT(child_ ## category ## _ ## name ## _(),             \
                 ::testing::ExitedWithCode(1),                       \
-                "assert failed: " msg);                             \
+                "^assert failed: " msg);                             \
   }                                                                 \
                                                                     \
   void test_ ## category ## _ ## name ## _()
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -195,6 +195,26 @@
 compiler/stable/TestStableUByte.java                             8204347   generic-all
 compiler/stable/TestStableUShort.java                            8204347   generic-all
 
+gc/g1/mixedgc/TestOldGenCollectionUsage.java                                  8196611 generic-all
+gc/g1/TestPeriodicCollection.java                                             8196611 generic-all
+gc/parallel/TestPrintGCDetailsVerbose.java                                    8196611 generic-all
+vm/gc/InfiniteList.java                                                       8196611 generic-all
+vmTestbase/nsk/stress/except/except007.java                                   8196611 generic-all
+vmTestbase/nsk/stress/except/except008.java                                   8196611 generic-all
+serviceability/tmtools/jstat/GcTest02.java                                    8196611 generic-all
+serviceability/tmtools/jstat/GcCapacityTest.java                              8196611 generic-all
+serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorMultiArrayTest.java     8196611 generic-all
+
+runtime/RedefineObject/TestRedefineObject.java                                8218399 generic-all
+
+vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/TestDescription.java    8218167 generic-all
+
+vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TestDescription.java          8218700 generic-all
+
+vmTestbase/nsk/jdb/unmonitor/unmonitor001/unmonitor001.java                   8218701 generic-all
+
+vmTestbase/nsk/jdb/clear/clear003/clear003.java                               8218701 generic-all
+
 # Graal unit tests
 org.graalvm.compiler.core.test.CheckGraalInvariants                              8205081
 org.graalvm.compiler.core.test.OptionsVerifierTest                               8205081
@@ -207,3 +227,5 @@
 org.graalvm.compiler.hotspot.test.ReservedStackAccessTest        8213567   windows-all
 
 org.graalvm.compiler.replacements.test.StringCompressInflateTest 8214947
+
+org.graalvm.compiler.hotspot.test.CheckGraalIntrinsics           8218698
--- a/test/hotspot/jtreg/ProblemList.txt	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/ProblemList.txt	Thu Feb 14 22:08:36 2019 +0100
@@ -164,7 +164,6 @@
 vmTestbase/nsk/jdi/EventRequest/setEnabled/setenabled003/TestDescription.java 8066993 generic-all
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses021/TestDescription.java 8065773 generic-all
 vmTestbase/nsk/jdi/VirtualMachine/redefineClasses/redefineclasses023/TestDescription.java 8065773 generic-all
-vmTestbase/nsk/jdi/EventQueue/remove_l/remove_l005/TestDescription.java 8068225 generic-all
 
 vmTestbase/metaspace/gc/firstGC_10m/TestDescription.java 8208250 generic-all
 vmTestbase/metaspace/gc/firstGC_50m/TestDescription.java 8208250 generic-all
--- a/test/hotspot/jtreg/compiler/c2/TestUseOptoBiasInliningWithoutEliminateLocks.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/compiler/c2/TestUseOptoBiasInliningWithoutEliminateLocks.java	Thu Feb 14 22:08:36 2019 +0100
@@ -40,7 +40,7 @@
  *                   -XX:CompileCommand=compileonly,*.TestUseOptoBiasInliningWithoutEliminateLocks::dontinline_testMethod
  *                   -XX:CompileCommand=dontinline,*::dontinline_*
  *                   -XX:-EliminateLocks
- *                   -XX:+WhiteBoxAPI -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
  *                   -Xbatch
  *                   -XX:-TieredCompilation
  *                   compiler.c2.TestUseOptoBiasInliningWithoutEliminateLocks
--- a/test/hotspot/jtreg/compiler/whitebox/GetCodeHeapEntriesTest.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/compiler/whitebox/GetCodeHeapEntriesTest.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
         CodeBlob blob = Arrays.stream(blobs)
                               .filter(GetCodeHeapEntriesTest::filter)
                               .findAny()
-                              .get();
+                              .orElse(null);
         Asserts.assertNotNull(blob);
         Asserts.assertEQ(blob.code_blob_type, type);
         Asserts.assertGTE(blob.size, SIZE);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/NMT/MallocSiteTypeChange.java	Thu Feb 14 22:08:36 2019 +0100
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test MallocSiteTypeChange
+ * @bug 8200109
+ * @key nmt jcmd
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteTypeChange
+ */
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import sun.hotspot.WhiteBox;
+
+public class MallocSiteTypeChange {
+    public static void main(String args[]) throws Exception {
+        OutputAnalyzer output;
+        WhiteBox wb = WhiteBox.getWhiteBox();
+
+        // Grab my own PID
+        String pid = Long.toString(ProcessTools.getProcessId());
+        ProcessBuilder pb = new ProcessBuilder();
+
+        int pc = 1;
+        long addr = wb.NMTMallocWithPseudoStack(4 * 1024, pc);
+
+        // Verify that current tracking level is "detail"
+        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "summary"});
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Test (reserved=4KB, committed=4KB)");
+
+        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "baseline"});
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Baseline succeeded");
+
+        wb.NMTFree(addr);
+        addr = wb.NMTMallocWithPseudoStackAndType(2 * 1024, pc, 7 /* mtInternal */ );
+        pb.command(new String[] { JDKToolFinder.getJDKTool("jcmd"), pid, "VM.native_memory", "detail.diff"});
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("(malloc=0KB type=Test -4KB)");
+        output.shouldContain("(malloc=2KB type=Internal +2KB #1 +1)");
+        output.shouldHaveExitValue(0);
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/defineAnonClass/AnonSymbolLeak.java	Thu Feb 14 22:08:36 2019 +0100
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// This is copied from DefineAnon to test Symbol Refcounting for the package prepended name.
+
+package p1;
+
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.MethodVisitor;
+import jdk.internal.org.objectweb.asm.Opcodes;
+import jdk.internal.misc.Unsafe;
+
+
+class T {
+    static           protected void test0() { System.out.println("test0 (public)"); }
+    static           protected void test1() { System.out.println("test1 (protected)"); }
+    static /*package-private*/ void test2() { System.out.println("test2 (package)"); }
+    static             private void test3() { System.out.println("test3 (private)"); }
+}
+
+public class AnonSymbolLeak {
+
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+
+    static Class<?> getAnonClass(Class<?> hostClass, final String className) {
+        final String superName = "java/lang/Object";
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS + ClassWriter.COMPUTE_FRAMES);
+        cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER, className, null, superName, null);
+
+        MethodVisitor mv = cw.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC, "test", "()V", null, null);
+        mv.visitMethodInsn(Opcodes.INVOKESTATIC, "p1/T", "test0", "()V", false);
+        mv.visitMethodInsn(Opcodes.INVOKESTATIC, "p1/T", "test1", "()V", false);
+        mv.visitMethodInsn(Opcodes.INVOKESTATIC, "p1/T", "test2", "()V", false);
+        mv.visitMethodInsn(Opcodes.INVOKESTATIC, "p1/T", "test3", "()V", false);
+        mv.visitInsn(Opcodes.RETURN);
+        mv.visitMaxs(0, 0);
+        mv.visitEnd();
+
+        final byte[] classBytes = cw.toByteArray();
+        Class<?> invokerClass = UNSAFE.defineAnonymousClass(hostClass, classBytes, new Object[0]);
+        UNSAFE.ensureClassInitialized(invokerClass);
+        return invokerClass;
+    }
+
+    public static void test() throws Throwable {
+        // AnonClass is injected into package p1.
+        System.out.println("Injecting from the same package (p1):");
+        Class<?> p1cls = getAnonClass(T.class, "AnonClass");
+        p1cls.getMethod("test").invoke(null);
+    }
+
+    public static void main(java.lang.String[] unused) throws Throwable {
+        test();
+    }
+}
--- a/test/hotspot/jtreg/runtime/defineAnonClass/DefineAnon.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/runtime/defineAnonClass/DefineAnon.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.management
+ *          java.base/jdk.internal.misc
  * @compile -XDignore.symbol.file=true DefineAnon.java
  * @run main/othervm p1.DefineAnon
  */
@@ -36,7 +37,7 @@
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.org.objectweb.asm.Opcodes;
-import sun.misc.Unsafe;
+import jdk.internal.misc.Unsafe;
 
 
 class T {
@@ -48,17 +49,7 @@
 
 public class DefineAnon {
 
-    private static Unsafe getUnsafe() {
-        try {
-            java.lang.reflect.Field singleoneInstanceField = Unsafe.class.getDeclaredField("theUnsafe");
-            singleoneInstanceField.setAccessible(true);
-            return (Unsafe) singleoneInstanceField.get(null);
-        } catch (Throwable ex) {
-            throw new RuntimeException("Was unable to get Unsafe instance.");
-        }
-    }
-
-    static Unsafe UNSAFE = DefineAnon.getUnsafe();
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
 
     static Class<?> getAnonClass(Class<?> hostClass, final String className) {
         final String superName = "java/lang/Object";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/defineAnonClass/TestAnonSymbolLeak.java	Thu Feb 14 22:08:36 2019 +0100
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+/*
+ * @test TestAnonSymbolLeak
+ * @bug 8218755
+ * @requires vm.opt.final.ClassUnloading
+ * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.org.objectweb.asm
+ *          java.management
+ * @library /test/lib /runtime/testlibrary
+ * @build p1.AnonSymbolLeak
+ * @build sun.hotspot.WhiteBox
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -Xlog:class+unload -XX:+WhiteBoxAPI TestAnonSymbolLeak
+ */
+
+import java.lang.reflect.Method;
+import sun.hotspot.WhiteBox;
+import jdk.test.lib.Asserts;
+
+public class TestAnonSymbolLeak {
+    static String className = "p1.AnonSymbolLeak";
+
+    private static class ClassUnloadTestMain {
+        public static void test() throws Exception {
+            // Load the AnonSymbolLeak class in a new class loader, run it, which loads
+            // an unsafe anonymous class in the same package p1.  Then unload it.
+            // Then test that the refcount of the symbol created for the prepended name doesn't leak.
+            ClassLoader cl = ClassUnloadCommon.newClassLoader();
+            Class<?> c = cl.loadClass(className);
+            c.getMethod("test").invoke(null);
+            cl = null; c = null;
+            ClassUnloadCommon.triggerUnloading();
+        }
+    }
+
+    public static WhiteBox wb = WhiteBox.getWhiteBox();
+
+    public static void main(String... args) throws Exception {
+        String oldName = "AnonClass";
+        String prependedName = "p1/AnonClass";
+        ClassUnloadCommon.failIf(wb.isClassAlive(className), "should not be loaded");
+        int countBeforeOld = wb.getSymbolRefcount(oldName);
+        int countBefore = wb.getSymbolRefcount(prependedName);
+        ClassUnloadTestMain.test();
+        ClassUnloadCommon.failIf(wb.isClassAlive(className), "should be unloaded");
+        int countAfterOld = wb.getSymbolRefcount(oldName);
+        int countAfter = wb.getSymbolRefcount(prependedName);
+        Asserts.assertEquals(countBeforeOld, countAfterOld); // no leaks to the old name
+        System.out.println("count before and after " + countBeforeOld + " " + countAfterOld);
+        Asserts.assertEquals(countBefore, countAfter);       // no leaks to the prepended name
+        System.out.println("count before and after " + countBefore + " " + countAfter);
+    }
+}
--- a/test/hotspot/jtreg/runtime/defineAnonClass/UnsafeDefMeths.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/runtime/defineAnonClass/UnsafeDefMeths.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
  * @library /testlibrary
  * @modules java.base/jdk.internal.org.objectweb.asm
  *          java.management
+ *          java.base/jdk.internal.misc
  * @compile -XDignore.symbol.file=true UnsafeDefMeths.java
  * @run main UnsafeDefMeths
  */
@@ -35,7 +36,7 @@
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.MethodVisitor;
 import jdk.internal.org.objectweb.asm.Type;
-import sun.misc.Unsafe;
+import jdk.internal.misc.Unsafe;
 
 import java.lang.invoke.MethodType;
 import java.lang.reflect.Field;
@@ -57,18 +58,7 @@
 
 public class UnsafeDefMeths {
 
-    static final Unsafe UNSAFE;
-
-    static {
-        try {
-            Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe");
-            unsafeField.setAccessible(true);
-            UNSAFE = (Unsafe) unsafeField.get(null);
-        }
-        catch (Exception e) {
-            throw new InternalError(e);
-        }
-    }
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
 
     interface Resource {
         Pointer ptr();
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canBeModified/canbemodified001.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,6 +78,7 @@
             exitStatus = Consts.TEST_FAILED;
             e.printStackTrace();
         } finally {
+            debugee.resume();
             debugee.endDebugee();
         }
         display("Test finished. exitStatus = " + exitStatus);
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -557,6 +557,7 @@
      * exit status code.
      */
     public int endDebugee() {
+        int status = waitFor();
         if (vm != null) {
             try {
                 vm.dispose();
@@ -564,7 +565,7 @@
             }
             vm = null;
         }
-        return waitFor();
+        return status;
     }
 
     /*
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/share/StressClassLoadingTest.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/share/StressClassLoadingTest.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -169,7 +169,7 @@
                             c = CustomClassLoaders.makeClassBytesLoader(classBytes, className)
                                     .loadClass(className);
                         }
-                        c.newInstance();
+                        UnsafeAccess.unsafe.ensureClassInitialized(c);
                     } catch (Throwable e) {
                         Env.traceVerbose(e, "parser caught exception");
                     }
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/jdi/JDIBreakpointTest.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/jdi/JDIBreakpointTest.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,7 @@
 import com.sun.jdi.ThreadReference;
 import com.sun.jdi.Value;
 import com.sun.jdi.VirtualMachine;
+import com.sun.jdi.VMDisconnectedException;
 import com.sun.jdi.event.BreakpointEvent;
 import com.sun.jdi.event.ClassPrepareEvent;
 import com.sun.jdi.event.Event;
@@ -358,8 +359,12 @@
             }
         }.go();
 
-        if (!debuggee.terminated())
-            debuggee.endDebugee();
+        if (!debuggee.terminated()) {
+            try {
+                debuggee.dispose();
+            } catch (VMDisconnectedException ignore) {
+            }
+        }
 
         debuggee.waitFor();
         return true;
--- a/test/jdk/ProblemList-graal.txt	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/jdk/ProblemList-graal.txt	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -92,6 +92,8 @@
 com/sun/jdi/EarlyReturnTest.java                                        8195635   generic-all
 com/sun/jdi/EarlyReturnTest.java                                        8195635   generic-all
 
+com/sun/jdi/RedefineCrossEvent.java                                     8218396   generic-all
+
 # Next JFR tests fail with Graal. Assuming 8193210.
 jdk/jfr/event/compiler/TestCodeSweeper.java              8193210   generic-all
 jdk/jfr/event/compiler/TestCompilerInlining.java         8193210   generic-all
--- a/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java	Thu Feb 14 22:08:36 2019 +0100
@@ -33,9 +33,11 @@
 import java.net.Socket;
 import java.net.SocketException;
 
+import jdk.test.lib.Utils;
 import jdk.test.lib.apps.LingeredApp;
 
 import java.util.ArrayList;
+import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -72,13 +74,27 @@
     }
 
     private static Pattern listenRegexp = Pattern.compile("Listening for transport \\b(.+)\\b at address: \\b(\\d+)\\b");
-    private static int detectPort(String s) {
-        Matcher m = listenRegexp.matcher(s);
-        if (!m.find()) {
-            throw new RuntimeException("Could not detect port from '" + s + "'");
+    private static int detectPort(LingeredApp app) {
+        long maxWaitTime = System.currentTimeMillis()
+                + Utils.adjustTimeout(10000);  // 10 seconds adjusted for TIMEOUT_FACTOR
+        while (true) {
+            String s = app.getProcessStdout();
+            Matcher m = listenRegexp.matcher(s);
+            if (m.find()) {
+                // m.group(1) is transport, m.group(2) is port
+                return Integer.parseInt(m.group(2));
+            }
+            if (System.currentTimeMillis() > maxWaitTime) {
+                throw new RuntimeException("Could not detect port from '" + s + "' (timeout)");
+            }
+            try {
+                if (app.getProcess().waitFor(500, TimeUnit.MILLISECONDS)) {
+                    throw new RuntimeException("Could not detect port from '" + s + "' (debuggee is terminated)");
+                }
+            } catch (InterruptedException e) {
+                // ignore
+            }
         }
-        // m.group(1) is transport, m.group(2) is port
-        return Integer.parseInt(m.group(2));
     }
 
     public static void positiveTest(String testName, String allowOpt)
@@ -89,7 +105,7 @@
         LingeredApp a = LingeredApp.startApp(cmd);
         int res;
         try {
-            res = handshake(detectPort(a.getProcessStdout()));
+            res = handshake(detectPort(a));
         } finally {
             a.stopApp();
         }
@@ -107,7 +123,7 @@
         LingeredApp a = LingeredApp.startApp(cmd);
         int res;
         try {
-            res = handshake(detectPort(a.getProcessStdout()));
+            res = handshake(detectPort(a));
         } finally {
             a.stopApp();
         }
--- a/test/jdk/com/sun/jdi/RepStep.java	Wed Feb 13 16:43:41 2019 -0500
+++ b/test/jdk/com/sun/jdi/RepStep.java	Thu Feb 14 22:08:36 2019 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary RepStep detects missed step events due to lack of
  * frame pop events (in back-end).
  * @author Robert Field
+ * @library /test/lib
  *
  * @run compile -g RepStepTarg.java
  * @run build VMConnection RepStep
@@ -37,6 +38,7 @@
 import com.sun.jdi.event.*;
 import com.sun.jdi.request.*;
 import com.sun.jdi.connect.*;
+import jdk.test.lib.process.StreamPumper;
 
 import java.util.*;
 
@@ -90,6 +92,7 @@
             EventSet set = queue.remove();
             for (EventIterator it = set.eventIterator(); it.hasNext(); ) {
                 Event event = it.nextEvent();
+                System.out.println("event: " + String.valueOf(event));
                 if (event instanceof VMStartEvent) {
                     // get thread for setting step later
                     thread = ((VMStartEvent)event).thread();
@@ -165,6 +168,23 @@
         optionsArg.setValue(VMConnection.getDebuggeeVMOptions());
 
         vm = launcher.launch(connectorArgs);
+        // redirect stdout/stderr
+        new StreamPumper(vm.process().getInputStream())
+                .addPump(new StreamPumper.LinePump() {
+                    @Override
+                    protected void processLine(String line) {
+                        System.out.println("[debugee_stdout] " + line);
+                    }
+                })
+                .process();
+        new StreamPumper(vm.process().getErrorStream())
+                .addPump(new StreamPumper.LinePump() {
+                    @Override
+                    protected void processLine(String line) {
+                        System.err.println("[debugee_stderr] " + line);
+                    }
+                })
+                .process();
         System.out.println("launched: " + TARGET);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/net/httpserver/bugs/HandlerConnectionClose.java	Thu Feb 14 22:08:36 2019 +0100
@@ -0,0 +1,437 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8218554
+ * @summary  test that the handler can request a connection close.
+ * @library /test/lib
+ * @build jdk.test.lib.net.SimpleSSLContext
+ * @run main/othervm HandlerConnectionClose
+ */
+
+import com.sun.net.httpserver.HttpExchange;
+import com.sun.net.httpserver.HttpHandler;
+import com.sun.net.httpserver.HttpServer;
+import com.sun.net.httpserver.HttpsConfigurator;
+import com.sun.net.httpserver.HttpsServer;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.URI;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Locale;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+import java.util.logging.StreamHandler;
+import jdk.test.lib.net.SimpleSSLContext;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+
+public class HandlerConnectionClose
+{
+    static final int ONEK = 1024;
+    static final long POST_SIZE = ONEK * 1L;
+    SSLContext sslContext;
+    Logger logger;
+
+    void test(String[] args) throws Exception {
+
+        HttpServer httpServer = startHttpServer("http");
+        try {
+            testHttpURLConnection(httpServer, "http","/close/legacy/http/chunked");
+            testHttpURLConnection(httpServer, "http","/close/legacy/http/fixed");
+            testPlainSocket(httpServer, "http","/close/plain/http/chunked");
+            testPlainSocket(httpServer, "http","/close/plain/http/fixed");
+        } finally {
+            httpServer.stop(0);
+        }
+        sslContext = new SimpleSSLContext().get();
+        HttpServer httpsServer = startHttpServer("https");
+        try {
+            testHttpURLConnection(httpsServer, "https","/close/legacy/https/chunked");
+            testHttpURLConnection(httpsServer, "https","/close/legacy/https/fixed");
+            testPlainSocket(httpsServer, "https","/close/plain/https/chunked");
+            testPlainSocket(httpsServer, "https","/close/plain/https/fixed");
+        } finally{
+            httpsServer.stop(0);
+        }
+    }
+
+    void testHttpURLConnection(HttpServer httpServer, String protocol, String path) throws Exception {
+        int port = httpServer.getAddress().getPort();
+        String host = httpServer.getAddress().getHostString();
+        URL url = new URI(protocol, null, host, port, path, null, null).toURL();
+        HttpURLConnection uc = (HttpURLConnection) url.openConnection();
+        if ("https".equalsIgnoreCase(protocol)) {
+            ((HttpsURLConnection)uc).setSSLSocketFactory(sslContext.getSocketFactory());
+            ((HttpsURLConnection)uc).setHostnameVerifier((String hostname, SSLSession session) -> true);
+        }
+        uc.setDoOutput(true);
+        uc.setRequestMethod("POST");
+        uc.setFixedLengthStreamingMode(POST_SIZE);
+        OutputStream os = uc.getOutputStream();
+
+        /* create a 1K byte array with data to POST */
+        byte[] ba = new byte[ONEK];
+        for (int i = 0; i < ONEK; i++)
+            ba[i] = (byte) i;
+
+        System.out.println("\n" + uc.getClass().getSimpleName() +": POST " + url + " HTTP/1.1");
+        long times = POST_SIZE / ONEK;
+        for (int i = 0; i < times; i++) {
+            os.write(ba);
+        }
+
+        os.close();
+        InputStream is = uc.getInputStream();
+        int read;
+        long count = 0;
+        while ((read = is.read(ba)) != -1) {
+            for (int i = 0; i < read; i++) {
+                byte expected = (byte) count++;
+                if (ba[i] != expected) {
+                    throw new IOException("byte mismatch at "
+                            + (count - 1) + ": expected " + expected + " got " + ba[i]);
+                }
+            }
+        }
+        if (count != POST_SIZE) {
+            throw new IOException("Unexpected length: " + count + " expected " + POST_SIZE);
+        }
+        is.close();
+
+        pass();
+    }
+
+    void testPlainSocket(HttpServer httpServer, String protocol, String path) throws Exception {
+        int port = httpServer.getAddress().getPort();
+        String host = httpServer.getAddress().getHostString();
+        URL url = new URI(protocol, null, host, port, path, null, null).toURL();
+        Socket socket;
+        if ("https".equalsIgnoreCase(protocol)) {
+            socket = sslContext.getSocketFactory().createSocket(host, port);
+        } else {
+            socket = new Socket(host, port);
+        }
+        try (Socket sock = socket) {
+            OutputStream os = socket.getOutputStream();
+
+            // send request headers
+            String request = new StringBuilder()
+                    .append("POST ").append(path).append(" HTTP/1.1").append("\r\n")
+                    .append("host: ").append(host).append(':').append(port).append("\r\n")
+                    .append("Content-Length: ").append(POST_SIZE).append("\r\n")
+                    .append("\r\n")
+                    .toString();
+            os.write(request.getBytes(StandardCharsets.US_ASCII));
+
+            /* create a 1K byte array with data to POST */
+            byte[] ba = new byte[ONEK];
+            for (int i = 0; i < ONEK; i++)
+                ba[i] = (byte) i;
+
+            // send request data
+            long times = POST_SIZE / ONEK;
+            for (int i = 0; i < times; i++) {
+                os.write(ba);
+            }
+            os.flush();
+
+            InputStream is = socket.getInputStream();
+            ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+            // read all response headers
+            int c;
+            int crlf = 0;
+            while ((c = is.read()) != -1) {
+                if (c == '\r') continue;
+                if (c == '\n') crlf++;
+                else crlf = 0;
+                bos.write(c);
+                if (crlf == 2) break;
+            }
+            String responseHeadersStr = bos.toString(StandardCharsets.US_ASCII);
+            List<String> responseHeaders = List.of(responseHeadersStr.split("\n"));
+            System.out.println("\nPOST " + url + " HTTP/1.1");
+            responseHeaders.stream().forEach(s -> System.out.println("[reply]\t" + s));
+            String statusLine = responseHeaders.get(0);
+            if (!statusLine.startsWith("HTTP/1.1 200 "))
+                throw new IOException("Unexpected status: " + statusLine);
+            String cl = responseHeaders.stream()
+                    .map(s -> s.toLowerCase(Locale.ROOT))
+                    .filter(s -> s.startsWith("content-length: "))
+                    .findFirst()
+                    .orElse(null);
+            String te = responseHeaders.stream()
+                    .map(s -> s.toLowerCase(Locale.ROOT))