Merge metal-prototype-branch
authorjdv
Tue, 25 Jun 2019 15:24:41 +0530
branchmetal-prototype-branch
changeset 57424 a327727090c7
parent 57423 539748673056 (current diff)
parent 55479 80b27dc96ca3 (diff)
child 57426 68ec5c5ae381
Merge
test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationAllTest.java
test/jdk/sun/security/tools/keytool/PSS.java
--- a/make/common/FindTests.gmk	Mon Jun 24 15:18:05 2019 +0530
+++ b/make/common/FindTests.gmk	Tue Jun 25 15:24:41 2019 +0530
@@ -62,10 +62,8 @@
 
 # If this file is deemed outdated, it will automatically get regenerated
 # by this rule before being included below.
-#
-# When calling TestMake.gmk, override the log level to avoid any kind of debug
-# output being captured into the generated makefile.
-$(FIND_TESTS_CACHE_FILE): $(JTREG_ROOT_FILES) $(JTREG_GROUP_FILES)
+$(FIND_TESTS_CACHE_FILE): $(JTREG_ROOT_FILES) $(JTREG_GROUP_FILES) \
+    $(TOPDIR)/test/make/TestMake.gmk
 	$(call MakeTargetDir)
 	( $(foreach root, $(JTREG_TESTROOTS), \
 	    $(PRINTF) "\n$(root)_JTREG_TEST_GROUPS := " ; \
@@ -73,10 +71,11 @@
 	      $($(root)_JTREG_GROUP_FILES) \
 	      | $(SORT) -u | $(TR) '\n' ' ' ; \
 	  ) \
-	  $(PRINTF) "\nMAKE_TEST_TARGETS := " ; \
-	  $(MAKE) -s --no-print-directory $(MAKE_ARGS) LOG_LEVEL=warn \
-	      SPEC=$(SPEC) -f $(TOPDIR)/test/make/TestMake.gmk print-targets \
 	) > $@
+	$(PRINTF) "\nMAKE_TEST_TARGETS := " >> $@
+	$(MAKE) -s --no-print-directory $(MAKE_ARGS) \
+	    SPEC=$(SPEC) -f $(TOPDIR)/test/make/TestMake.gmk print-targets \
+	    TARGETS_FILE=$@
 
 -include $(FIND_TESTS_CACHE_FILE)
 
--- a/make/common/ProcessMarkdown.gmk	Mon Jun 24 15:18:05 2019 +0530
+++ b/make/common/ProcessMarkdown.gmk	Tue Jun 25 15:24:41 2019 +0530
@@ -103,7 +103,7 @@
 	$$(call LogInfo, Post-processing markdown file $2)
 	$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$($1_$2_TARGET_DIR))
 	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post, \
-	    $$($1_POST_PROCESS) < $$($1_$2_PANDOC_OUTPUT) > $$($1_$2_OUTPUT_FILE))
+	    ( $$($1_POST_PROCESS) < $$($1_$2_PANDOC_OUTPUT) > $$($1_$2_OUTPUT_FILE) ) )
   endif
 
   $1 += $$($1_$2_OUTPUT_FILE)
--- a/src/hotspot/share/aot/aotCodeHeap.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -38,7 +38,6 @@
 #include "memory/universe.hpp"
 #include "oops/compressedOops.hpp"
 #include "oops/method.inline.hpp"
-#include "runtime/deoptimization.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/os.hpp"
 #include "runtime/safepointVerifiers.hpp"
@@ -734,7 +733,8 @@
     }
   }
   if (marked > 0) {
-    Deoptimization::deoptimize_all_marked();
+    VM_Deoptimize op;
+    VMThread::execute(&op);
   }
 }
 
--- a/src/hotspot/share/aot/aotCompiledMethod.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/aot/aotCompiledMethod.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -165,7 +165,7 @@
 
   {
     // Enter critical section.  Does not block for safepoint.
-    MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
 
     if (*_state_adr == new_state) {
       // another thread already performed this transition so nothing
@@ -188,10 +188,12 @@
 #endif
 
     // Remove AOTCompiledMethod from method.
-    if (method() != NULL) {
-      method()->unlink_code(this);
+    if (method() != NULL && (method()->code() == this ||
+                             method()->from_compiled_entry() == verified_entry_point())) {
+      HandleMark hm;
+      method()->clear_code(false /* already owns Patching_lock */);
     }
-  } // leave critical region under CompiledMethod_lock
+  } // leave critical region under Patching_lock
 
 
   if (TraceCreateZombies) {
@@ -214,7 +216,7 @@
 
   {
     // Enter critical section.  Does not block for safepoint.
-    MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
 
     if (*_state_adr == in_use) {
       // another thread already performed this transition so nothing
@@ -228,7 +230,7 @@
 
     // Log the transition once
     log_state_change();
-  } // leave critical region under CompiledMethod_lock
+  } // leave critical region under Patching_lock
 
 
   if (TraceCreateZombies) {
--- a/src/hotspot/share/aot/aotCompiledMethod.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/aot/aotCompiledMethod.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -176,7 +176,6 @@
                                                  state() == not_used; }
   virtual bool is_alive() const { return _is_alive(); }
   virtual bool is_in_use() const { return state() == in_use; }
-  virtual bool is_not_installed() const { return state() == not_installed; }
 
   virtual bool is_unloading() { return false; }
 
--- a/src/hotspot/share/classfile/stringTable.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/classfile/stringTable.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -79,8 +79,7 @@
 
 // --------------------------------------------------------------------------
 
-typedef ConcurrentHashTable<WeakHandle<vm_string_table_data>,
-                            StringTableConfig, mtSymbol> StringTableHash;
+typedef ConcurrentHashTable<StringTableConfig, mtSymbol> StringTableHash;
 static StringTableHash* _local_table = NULL;
 
 volatile bool StringTable::_has_work = false;
@@ -101,11 +100,12 @@
     java_lang_String::hash_code(s, len);
 }
 
-class StringTableConfig : public StringTableHash::BaseConfig {
+class StringTableConfig : public StackObj {
  private:
  public:
-  static uintx get_hash(WeakHandle<vm_string_table_data> const& value,
-                        bool* is_dead) {
+  typedef WeakHandle<vm_string_table_data> Value;
+
+  static uintx get_hash(Value const& value, bool* is_dead) {
     EXCEPTION_MARK;
     oop val_oop = value.peek();
     if (val_oop == NULL) {
@@ -124,15 +124,13 @@
     return 0;
   }
   // We use default allocation/deallocation but counted
-  static void* allocate_node(size_t size,
-                             WeakHandle<vm_string_table_data> const& value) {
+  static void* allocate_node(size_t size, Value const& value) {
     StringTable::item_added();
-    return StringTableHash::BaseConfig::allocate_node(size, value);
+    return AllocateHeap(size, mtSymbol);
   }
-  static void free_node(void* memory,
-                        WeakHandle<vm_string_table_data> const& value) {
+  static void free_node(void* memory, Value const& value) {
     value.release();
-    StringTableHash::BaseConfig::free_node(memory, value);
+    FreeHeap(memory);
     StringTable::item_removed();
   }
 };
--- a/src/hotspot/share/classfile/symbolTable.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/classfile/symbolTable.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -77,8 +77,7 @@
 
 // --------------------------------------------------------------------------
 
-typedef ConcurrentHashTable<Symbol*,
-                            SymbolTableConfig, mtSymbol> SymbolTableHash;
+typedef ConcurrentHashTable<SymbolTableConfig, mtSymbol> SymbolTableHash;
 static SymbolTableHash* _local_table = NULL;
 
 volatile bool SymbolTable::_has_work = 0;
@@ -121,10 +120,12 @@
 }
 #endif
 
-class SymbolTableConfig : public SymbolTableHash::BaseConfig {
+class SymbolTableConfig : public AllStatic {
 private:
 public:
-  static uintx get_hash(Symbol* const& value, bool* is_dead) {
+  typedef Symbol* Value;  // value of the Node in the hashtable
+
+  static uintx get_hash(Value const& value, bool* is_dead) {
     *is_dead = (value->refcount() == 0);
     if (*is_dead) {
       return 0;
@@ -133,11 +134,11 @@
     }
   }
   // We use default allocation/deallocation but counted
-  static void* allocate_node(size_t size, Symbol* const& value) {
+  static void* allocate_node(size_t size, Value const& value) {
     SymbolTable::item_added();
-    return SymbolTableHash::BaseConfig::allocate_node(size, value);
+    return AllocateHeap(size, mtSymbol);
   }
-  static void free_node(void* memory, Symbol* const& value) {
+  static void free_node(void* memory, Value const& value) {
     // We get here because #1 some threads lost a race to insert a newly created Symbol
     // or #2 we're cleaning up unused symbol.
     // If #1, then the symbol can be either permanent (refcount==PERM_REFCOUNT),
@@ -150,7 +151,7 @@
       assert(value->refcount() == 0, "expected dead symbol");
     }
     SymbolTable::delete_symbol(value);
-    SymbolTableHash::BaseConfig::free_node(memory, value);
+    FreeHeap(memory);
     SymbolTable::item_removed();
   }
 };
--- a/src/hotspot/share/code/codeCache.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/code/codeCache.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -1142,25 +1142,28 @@
 
   // At least one nmethod has been marked for deoptimization
 
-  Deoptimization::deoptimize_all_marked();
+  // All this already happens inside a VM_Operation, so we'll do all the work here.
+  // Stuff copied from VM_Deoptimize and modified slightly.
+
+  // We do not want any GCs to happen while we are in the middle of this VM operation
+  ResourceMark rm;
+  DeoptimizationMarker dm;
+
+  // Deoptimize all activations depending on marked nmethods
+  Deoptimization::deoptimize_dependents();
+
+  // Make the dependent methods not entrant
+  make_marked_nmethods_not_entrant();
 }
 #endif // INCLUDE_JVMTI
 
-// Mark methods for deopt (if safe or possible).
+// Deoptimize all methods
 void CodeCache::mark_all_nmethods_for_deoptimization() {
   MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
     CompiledMethod* nm = iter.method();
-    if (!nm->method()->is_method_handle_intrinsic() &&
-        !nm->is_not_installed() &&
-        nm->is_in_use() &&
-        !nm->is_native_method()) {
-      // Intrinsics and native methods are never deopted. A method that is
-      // not installed yet or is not in use is not safe to deopt; the
-      // is_in_use() check covers the not_entrant and not zombie cases.
-      // Note: A not_entrant method can become a zombie at anytime if it was
-      // made not_entrant before the previous safepoint/handshake.
+    if (!nm->method()->is_method_handle_intrinsic()) {
       nm->mark_for_deoptimization();
     }
   }
@@ -1188,12 +1191,7 @@
   CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
   while(iter.next()) {
     CompiledMethod* nm = iter.method();
-    if (nm->is_marked_for_deoptimization() && nm->is_in_use()) {
-      // only_alive_and_not_unloading() can return not_entrant nmethods.
-      // A not_entrant method can become a zombie at anytime if it was
-      // made not_entrant before the previous safepoint/handshake. The
-      // is_in_use() check covers the not_entrant and not zombie cases
-      // that have become true after the method was marked for deopt.
+    if (nm->is_marked_for_deoptimization() && !nm->is_not_entrant()) {
       nm->make_not_entrant();
     }
   }
@@ -1205,12 +1203,17 @@
 
   if (number_of_nmethods_with_dependencies() == 0) return;
 
+  // CodeCache can only be updated by a thread_in_VM and they will all be
+  // stopped during the safepoint so CodeCache will be safe to update without
+  // holding the CodeCache_lock.
+
   KlassDepChange changes(dependee);
 
   // Compute the dependent nmethods
   if (mark_for_deoptimization(changes) > 0) {
     // At least one nmethod has been marked for deoptimization
-    Deoptimization::deoptimize_all_marked();
+    VM_Deoptimize op;
+    VMThread::execute(&op);
   }
 }
 
@@ -1219,9 +1222,26 @@
   // --- Compile_lock is not held. However we are at a safepoint.
   assert_locked_or_safepoint(Compile_lock);
 
+  // CodeCache can only be updated by a thread_in_VM and they will all be
+  // stopped dring the safepoint so CodeCache will be safe to update without
+  // holding the CodeCache_lock.
+
   // Compute the dependent nmethods
   if (mark_for_deoptimization(m_h()) > 0) {
-    Deoptimization::deoptimize_all_marked();
+    // At least one nmethod has been marked for deoptimization
+
+    // All this already happens inside a VM_Operation, so we'll do all the work here.
+    // Stuff copied from VM_Deoptimize and modified slightly.
+
+    // We do not want any GCs to happen while we are in the middle of this VM operation
+    ResourceMark rm;
+    DeoptimizationMarker dm;
+
+    // Deoptimize all activations depending on marked nmethods
+    Deoptimization::deoptimize_dependents();
+
+    // Make the dependent methods not entrant
+    make_marked_nmethods_not_entrant();
   }
 }
 
--- a/src/hotspot/share/code/compiledMethod.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/code/compiledMethod.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -214,7 +214,6 @@
   };
 
   virtual bool  is_in_use() const = 0;
-  virtual bool  is_not_installed() const = 0;
   virtual int   comp_level() const = 0;
   virtual int   compile_id() const = 0;
 
--- a/src/hotspot/share/code/nmethod.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/code/nmethod.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -50,7 +50,6 @@
 #include "oops/oop.inline.hpp"
 #include "prims/jvmtiImpl.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/deoptimization.hpp"
 #include "runtime/flags/flagSetting.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
@@ -1178,7 +1177,11 @@
   // have the Method* live here, in case we unload the nmethod because
   // it is pointing to some oop (other than the Method*) being unloaded.
   if (_method != NULL) {
-    _method->unlink_code(this);
+    // OSR methods point to the Method*, but the Method* does not
+    // point back!
+    if (_method->code() == this) {
+      _method->clear_code(); // Break a cycle
+    }
   }
 
   // Make the class unloaded - i.e., change state and notify sweeper
@@ -1260,9 +1263,16 @@
   }
 }
 
-void nmethod::unlink_from_method() {
-  if (method() != NULL) {
-    method()->unlink_code(this);
+void nmethod::unlink_from_method(bool acquire_lock) {
+  // We need to check if both the _code and _from_compiled_code_entry_point
+  // refer to this nmethod because there is a race in setting these two fields
+  // in Method* as seen in bugid 4947125.
+  // If the vep() points to the zombie nmethod, the memory for the nmethod
+  // could be flushed and the compiler and vtable stubs could still call
+  // through it.
+  if (method() != NULL && (method()->code() == this ||
+                           method()->from_compiled_entry() == verified_entry_point())) {
+    method()->clear_code(acquire_lock);
   }
 }
 
@@ -1289,24 +1299,24 @@
 
   // during patching, depending on the nmethod state we must notify the GC that
   // code has been unloaded, unregistering it. We cannot do this right while
-  // holding the CompiledMethod_lock because we need to use the CodeCache_lock. This
+  // holding the Patching_lock because we need to use the CodeCache_lock. This
   // would be prone to deadlocks.
   // This flag is used to remember whether we need to later lock and unregister.
   bool nmethod_needs_unregister = false;
 
-  // invalidate osr nmethod before acquiring the patching lock since
-  // they both acquire leaf locks and we don't want a deadlock.
-  // This logic is equivalent to the logic below for patching the
-  // verified entry point of regular methods. We check that the
-  // nmethod is in use to ensure that it is invalidated only once.
-  if (is_osr_method() && is_in_use()) {
-    // this effectively makes the osr nmethod not entrant
-    invalidate_osr_method();
-  }
-
   {
+    // invalidate osr nmethod before acquiring the patching lock since
+    // they both acquire leaf locks and we don't want a deadlock.
+    // This logic is equivalent to the logic below for patching the
+    // verified entry point of regular methods. We check that the
+    // nmethod is in use to ensure that it is invalidated only once.
+    if (is_osr_method() && is_in_use()) {
+      // this effectively makes the osr nmethod not entrant
+      invalidate_osr_method();
+    }
+
     // Enter critical section.  Does not block for safepoint.
-    MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+    MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
 
     if (_state == state) {
       // another thread already performed this transition so nothing
@@ -1350,9 +1360,8 @@
     log_state_change();
 
     // Remove nmethod from method.
-    unlink_from_method();
-
-  } // leave critical region under CompiledMethod_lock
+    unlink_from_method(false /* already owns Patching_lock */);
+  } // leave critical region under Patching_lock
 
 #if INCLUDE_JVMCI
   // Invalidate can't occur while holding the Patching lock
--- a/src/hotspot/share/code/nmethod.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/code/nmethod.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -119,7 +119,7 @@
   // used by jvmti to track if an unload event has been posted for this nmethod.
   bool _unload_reported;
 
-  // Protected by CompiledMethod_lock
+  // Protected by Patching_lock
   volatile signed char _state;               // {not_installed, in_use, not_entrant, zombie, unloaded}
 
 #ifdef ASSERT
@@ -387,7 +387,7 @@
 
   int   comp_level() const                        { return _comp_level; }
 
-  void unlink_from_method();
+  void unlink_from_method(bool acquire_lock);
 
   // Support for oops in scopes and relocs:
   // Note: index 0 is reserved for null.
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -31,6 +31,7 @@
 #include "gc/shared/gcTimer.hpp"
 #include "gc/shared/referenceProcessor.hpp"
 #include "gc/shared/referenceProcessorPhaseTimes.hpp"
+#include "gc/shared/strongRootsScope.hpp"
 
 #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp"
 #include "gc/shenandoah/shenandoahClosures.inline.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -1513,7 +1513,9 @@
       // From here on, we need to update references.
       set_has_forwarded_objects(true);
 
-      evacuate_and_update_roots();
+      if (!is_degenerated_gc_in_progress()) {
+        evacuate_and_update_roots();
+      }
 
       if (ShenandoahPacing) {
         pacer()->setup_for_evac();
@@ -1521,7 +1523,9 @@
 
       if (ShenandoahVerify) {
         if (ShenandoahConcurrentRoots::should_do_concurrent_roots()) {
-          verifier()->verify_roots_no_forwarded_except(ShenandoahRootVerifier::JNIHandleRoots);
+          ShenandoahRootVerifier::RootTypes types = ShenandoahRootVerifier::combine(ShenandoahRootVerifier::JNIHandleRoots, ShenandoahRootVerifier::WeakRoots);
+          types = ShenandoahRootVerifier::combine(types, ShenandoahRootVerifier::CLDGRoots);
+          verifier()->verify_roots_no_forwarded_except(types);
         } else {
           verifier()->verify_roots_no_forwarded();
         }
@@ -1588,6 +1592,8 @@
 class ShenandoahConcurrentRootsEvacUpdateTask : public AbstractGangTask {
 private:
   ShenandoahJNIHandleRoots<true /*concurrent*/> _jni_roots;
+  ShenandoahWeakRoots<true /*concurrent*/>      _weak_roots;
+  ShenandoahClassLoaderDataRoots<true /*concurrent*/, false /*single threaded*/> _cld_roots;
 
 public:
   ShenandoahConcurrentRootsEvacUpdateTask() :
@@ -1597,7 +1603,11 @@
   void work(uint worker_id) {
     ShenandoahEvacOOMScope oom;
     ShenandoahEvacuateUpdateRootsClosure cl;
+    CLDToOopClosure clds(&cl, ClassLoaderData::_claim_strong);
+
     _jni_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
+    _cld_roots.cld_do(&clds);
+    _weak_roots.oops_do<ShenandoahEvacuateUpdateRootsClosure>(&cl);
   }
 };
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -27,16 +27,13 @@
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
-#include "gc/shenandoah/shenandoahClosures.inline.hpp"
 #include "gc/shenandoah/shenandoahRootProcessor.inline.hpp"
 #include "gc/shenandoah/shenandoahHeap.hpp"
-#include "gc/shenandoah/shenandoahHeuristics.hpp"
 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
 #include "gc/shenandoah/shenandoahStringDedup.hpp"
 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
 #include "gc/shenandoah/shenandoahVMOperations.hpp"
-#include "gc/shared/weakProcessor.inline.hpp"
-#include "memory/allocation.inline.hpp"
+#include "jfr/jfr.hpp"
 #include "memory/iterator.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
@@ -71,6 +68,40 @@
   _jvmti_root.oops_do(cl, worker_id);
 }
 
+ShenandoahWeakSerialRoot::ShenandoahWeakSerialRoot(ShenandoahWeakSerialRoot::WeakOopsDo weak_oops_do, ShenandoahPhaseTimings::GCParPhases phase) :
+  _weak_oops_do(weak_oops_do), _phase(phase) {
+}
+
+void ShenandoahWeakSerialRoot::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id) {
+  if (_claimed.try_set()) {
+    ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
+    ShenandoahWorkerTimingsTracker timer(worker_times, _phase, worker_id);
+    _weak_oops_do(is_alive, keep_alive);
+  }
+}
+
+#if INCLUDE_JVMTI
+ShenandoahJVMTIWeakRoot::ShenandoahJVMTIWeakRoot() :
+  ShenandoahWeakSerialRoot(&JvmtiExport::weak_oops_do, ShenandoahPhaseTimings::JVMTIWeakRoots) {
+}
+#endif // INCLUDE_JVMTI
+
+#if INCLUDE_JFR
+ShenandoahJFRWeakRoot::ShenandoahJFRWeakRoot() :
+  ShenandoahWeakSerialRoot(&Jfr::weak_oops_do, ShenandoahPhaseTimings::JFRWeakRoots) {
+}
+#endif // INCLUDE_JFR
+
+void ShenandoahSerialWeakRoots::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id) {
+  JVMTI_ONLY(_jvmti_weak_roots.weak_oops_do(is_alive, keep_alive, worker_id);)
+  JFR_ONLY(_jfr_weak_roots.weak_oops_do(is_alive, keep_alive, worker_id);)
+}
+
+void ShenandoahSerialWeakRoots::weak_oops_do(OopClosure* cl, uint worker_id) {
+  AlwaysTrueClosure always_true;
+  weak_oops_do(&always_true, cl, worker_id);
+}
+
 ShenandoahThreadRoots::ShenandoahThreadRoots(bool is_par) : _is_par(is_par) {
   Threads::change_thread_claim_token();
 }
@@ -93,17 +124,6 @@
   Threads::assert_all_threads_claimed();
 }
 
-ShenandoahWeakRoots::ShenandoahWeakRoots(uint n_workers) :
-  _process_timings(n_workers),
-  _task(&_process_timings, n_workers) {
-}
-
-ShenandoahWeakRoots::~ShenandoahWeakRoots() {
-  ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
-  ShenandoahTimingConverter::weak_processing_timing_to_shenandoah_timing(&_process_timings,
-                                                                         worker_times);
-}
-
 ShenandoahStringDedupRoots::ShenandoahStringDedupRoots() {
   if (ShenandoahStringDedup::is_enabled()) {
     StringDedup::gc_prologue(false);
@@ -137,39 +157,37 @@
 ShenandoahRootEvacuator::ShenandoahRootEvacuator(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool include_concurrent_roots) :
   ShenandoahRootProcessor(phase),
   _thread_roots(n_workers > 1),
-  _weak_roots(n_workers),
   _include_concurrent_roots(include_concurrent_roots) {
 }
 
 void ShenandoahRootEvacuator::roots_do(uint worker_id, OopClosure* oops) {
   MarkingCodeBlobClosure blobsCl(oops, CodeBlobToOopClosure::FixRelocations);
-  CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
   AlwaysTrueClosure always_true;
 
   _serial_roots.oops_do(oops, worker_id);
+  _serial_weak_roots.weak_oops_do(oops, worker_id);
   if (_include_concurrent_roots) {
+    CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
     _jni_roots.oops_do<OopClosure>(oops, worker_id);
+    _cld_roots.cld_do(&clds, worker_id);
+    _weak_roots.oops_do<OopClosure>(oops, worker_id);
   }
 
   _thread_roots.oops_do(oops, NULL, worker_id);
-  _cld_roots.cld_do(&clds, worker_id);
   _code_roots.code_blobs_do(&blobsCl, worker_id);
 
-  _weak_roots.oops_do<AlwaysTrueClosure, OopClosure>(&always_true, oops, worker_id);
   _dedup_roots.oops_do(&always_true, oops, worker_id);
 }
 
 ShenandoahRootUpdater::ShenandoahRootUpdater(uint n_workers, ShenandoahPhaseTimings::Phase phase, bool update_code_cache) :
   ShenandoahRootProcessor(phase),
   _thread_roots(n_workers > 1),
-  _weak_roots(n_workers),
   _update_code_cache(update_code_cache) {
 }
 
 ShenandoahRootAdjuster::ShenandoahRootAdjuster(uint n_workers, ShenandoahPhaseTimings::Phase phase) :
   ShenandoahRootProcessor(phase),
-  _thread_roots(n_workers > 1),
-  _weak_roots(n_workers) {
+  _thread_roots(n_workers > 1) {
   assert(ShenandoahHeap::heap()->is_full_gc_in_progress(), "Full GC only");
 }
 
@@ -185,7 +203,8 @@
   _cld_roots.cld_do(&adjust_cld_closure, worker_id);
   _code_roots.code_blobs_do(&adjust_code_closure, worker_id);
 
-  _weak_roots.oops_do<AlwaysTrueClosure, OopClosure>(&always_true, oops, worker_id);
+  _serial_weak_roots.weak_oops_do(oops, worker_id);
+  _weak_roots.oops_do<OopClosure>(oops, worker_id);
   _dedup_roots.oops_do(&always_true, oops, worker_id);
 }
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -29,11 +29,7 @@
 #include "gc/shenandoah/shenandoahCodeRoots.hpp"
 #include "gc/shenandoah/shenandoahHeap.hpp"
 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
-#include "gc/shared/strongRootsScope.hpp"
-#include "gc/shared/weakProcessor.hpp"
-#include "gc/shared/weakProcessorPhaseTimes.hpp"
-#include "gc/shared/workgroup.hpp"
-#include "memory/allocation.hpp"
+#include "gc/shenandoah/shenandoahSharedVariables.hpp"
 #include "memory/iterator.hpp"
 
 class ShenandoahSerialRoot {
@@ -61,10 +57,102 @@
   void oops_do(OopClosure* cl, uint worker_id);
 };
 
+class ShenandoahWeakSerialRoot {
+  typedef void (*WeakOopsDo)(BoolObjectClosure*, OopClosure*);
+private:
+  ShenandoahSharedFlag                      _claimed;
+  const WeakOopsDo                          _weak_oops_do;
+  const ShenandoahPhaseTimings::GCParPhases _phase;
+
+public:
+  ShenandoahWeakSerialRoot(WeakOopsDo oops_do, ShenandoahPhaseTimings::GCParPhases);
+  void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
+};
+
+#if INCLUDE_JVMTI
+class ShenandoahJVMTIWeakRoot : public ShenandoahWeakSerialRoot {
+public:
+  ShenandoahJVMTIWeakRoot();
+};
+#endif // INCLUDE_JVMTI
+
+#if INCLUDE_JFR
+class ShenandoahJFRWeakRoot : public ShenandoahWeakSerialRoot {
+public:
+  ShenandoahJFRWeakRoot();
+};
+#endif // INCLUDE_JFR
+
+class ShenandoahSerialWeakRoots {
+private:
+  JVMTI_ONLY(ShenandoahJVMTIWeakRoot _jvmti_weak_roots;)
+  JFR_ONLY(ShenandoahJFRWeakRoot     _jfr_weak_roots;)
+public:
+  void weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, uint worker_id);
+  void weak_oops_do(OopClosure* cl, uint worker_id);
+};
+
+template <bool CONCURRENT>
+class ShenandoahWeakRoot {
+private:
+  OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
+  const ShenandoahPhaseTimings::GCParPhases _phase;
+public:
+  ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
+
+  template <typename Closure>
+  void oops_do(Closure* cl, uint worker_id);
+};
+
+template <>
+class ShenandoahWeakRoot<false /*concurrent*/> {
+private:
+  OopStorage::ParState<false /*concurrent*/, false /*is_const*/> _itr;
+  const ShenandoahPhaseTimings::GCParPhases _phase;
+
+public:
+  ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase);
+
+  template <typename IsAliveClosure, typename KeepAliveClosure>
+  void weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id);
+};
+
+template <bool CONCURRENT>
+class ShenandoahWeakRoots {
+private:
+  ShenandoahWeakRoot<CONCURRENT>  _jni_roots;
+  ShenandoahWeakRoot<CONCURRENT>  _string_table_roots;
+  ShenandoahWeakRoot<CONCURRENT>  _resolved_method_table_roots;
+  ShenandoahWeakRoot<CONCURRENT>  _vm_roots;
+
+public:
+  ShenandoahWeakRoots();
+
+  template <typename Closure>
+  void oops_do(Closure* cl, uint worker_id = 0);
+};
+
+template <>
+class ShenandoahWeakRoots<false /*concurrent */> {
+private:
+  ShenandoahWeakRoot<false /*concurrent*/>  _jni_roots;
+  ShenandoahWeakRoot<false /*concurrent*/>  _string_table_roots;
+  ShenandoahWeakRoot<false /*concurrent*/>  _resolved_method_table_roots;
+  ShenandoahWeakRoot<false /*concurrent*/>  _vm_roots;
+public:
+  ShenandoahWeakRoots();
+
+  template <typename Closure>
+  void oops_do(Closure* cl, uint worker_id = 0);
+
+  template <typename IsAliveClosure, typename KeepAliveClosure>
+  void weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id);
+};
+
 template <bool CONCURRENT>
 class ShenandoahJNIHandleRoots {
 private:
-  OopStorage::ParState<CONCURRENT, false /* is_const */> _itr;
+  OopStorage::ParState<CONCURRENT, false /*is_const*/> _itr;
 public:
   ShenandoahJNIHandleRoots();
 
@@ -83,18 +171,6 @@
   void threads_do(ThreadClosure* tc, uint worker_id);
 };
 
-class ShenandoahWeakRoots {
-private:
-  WeakProcessorPhaseTimes _process_timings;
-  WeakProcessor::Task     _task;
-public:
-  ShenandoahWeakRoots(uint n_workers);
-  ~ShenandoahWeakRoots();
-
-  template <typename IsAlive, typename KeepAlive>
-  void oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id);
-};
-
 class ShenandoahStringDedupRoots {
 public:
   ShenandoahStringDedupRoots();
@@ -114,13 +190,14 @@
   void code_blobs_do(CodeBlobClosure* blob_cl, uint worker_id);
 };
 
-template <bool SINGLE_THREADED>
+template <bool CONCURRENT, bool SINGLE_THREADED>
 class ShenandoahClassLoaderDataRoots {
 public:
   ShenandoahClassLoaderDataRoots();
+  ~ShenandoahClassLoaderDataRoots();
 
-  void always_strong_cld_do(CLDClosure* clds, uint worker_id);
-  void cld_do(CLDClosure* clds, uint worker_id);
+  void always_strong_cld_do(CLDClosure* clds, uint worker_id = 0);
+  void cld_do(CLDClosure* clds, uint worker_id = 0);
 };
 
 class ShenandoahRootProcessor : public StackObj {
@@ -141,7 +218,8 @@
   ShenandoahThreadRoots                                     _thread_roots;
   ShenandoahCodeCacheRoots<ITR>                             _code_roots;
   ShenandoahJNIHandleRoots<false /*concurrent*/ >           _jni_roots;
-  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
+  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
+                                                            _cld_roots;
 public:
   ShenandoahRootScanner(uint n_workers, ShenandoahPhaseTimings::Phase phase);
 
@@ -166,7 +244,8 @@
   ShenandoahSerialRoots                                    _serial_roots;
   ShenandoahThreadRoots                                    _thread_roots;
   ShenandoahJNIHandleRoots<false /*concurrent*/>           _jni_roots;
-  ShenandoahClassLoaderDataRoots<true /*single threaded*/> _cld_roots;
+  ShenandoahClassLoaderDataRoots<false /*concurrent*/, true /*single threaded*/>
+                                                           _cld_roots;
   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator> _code_roots;
 
 public:
@@ -181,9 +260,11 @@
 private:
   ShenandoahSerialRoots                                     _serial_roots;
   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
-  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
+  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
+                                                            _cld_roots;
   ShenandoahThreadRoots                                     _thread_roots;
-  ShenandoahWeakRoots                                       _weak_roots;
+  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
+  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
   ShenandoahStringDedupRoots                                _dedup_roots;
   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
   bool                                                      _include_concurrent_roots;
@@ -199,9 +280,11 @@
 private:
   ShenandoahSerialRoots                                     _serial_roots;
   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
-  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
+  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
+                                                            _cld_roots;
   ShenandoahThreadRoots                                     _thread_roots;
-  ShenandoahWeakRoots                                       _weak_roots;
+  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
+  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
   ShenandoahStringDedupRoots                                _dedup_roots;
   ShenandoahCodeCacheRoots<ShenandoahCsetCodeRootsIterator> _code_roots;
   const bool                                                _update_code_cache;
@@ -218,9 +301,11 @@
 private:
   ShenandoahSerialRoots                                     _serial_roots;
   ShenandoahJNIHandleRoots<false /*concurrent*/>            _jni_roots;
-  ShenandoahClassLoaderDataRoots<false /*single threaded*/> _cld_roots;
+  ShenandoahClassLoaderDataRoots<false /*concurrent*/, false /*single threaded*/>
+                                                            _cld_roots;
   ShenandoahThreadRoots                                     _thread_roots;
-  ShenandoahWeakRoots                                       _weak_roots;
+  ShenandoahSerialWeakRoots                                 _serial_weak_roots;
+  ShenandoahWeakRoots<false /*concurrent*/>                 _weak_roots;
   ShenandoahStringDedupRoots                                _dedup_roots;
   ShenandoahCodeCacheRoots<ShenandoahAllCodeRootsIterator>  _code_roots;
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootProcessor.inline.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -25,15 +25,84 @@
 #define SHARE_GC_SHENANDOAH_SHENANDOAHROOTPROCESSOR_INLINE_HPP
 
 #include "classfile/classLoaderDataGraph.hpp"
+#include "classfile/stringTable.hpp"
+#include "classfile/systemDictionary.hpp"
 #include "gc/shared/oopStorageParState.inline.hpp"
 #include "gc/shenandoah/shenandoahHeuristics.hpp"
 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
 #include "gc/shenandoah/shenandoahTimingTracker.hpp"
 #include "gc/shenandoah/shenandoahUtils.hpp"
 #include "memory/resourceArea.hpp"
+#include "prims/resolvedMethodTable.hpp"
 #include "runtime/safepoint.hpp"
 
 template <bool CONCURRENT>
+inline ShenandoahWeakRoot<CONCURRENT>::ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase) :
+  _itr(storage), _phase(phase) {
+}
+
+template <bool CONCURRENT>
+template <typename Closure>
+inline void ShenandoahWeakRoot<CONCURRENT>::oops_do(Closure* cl, uint worker_id) {
+  if (CONCURRENT) {
+    _itr.oops_do(cl);
+  } else {
+    ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
+    ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::ThreadRoots, worker_id);
+    _itr.oops_do(cl);
+  }
+}
+
+inline ShenandoahWeakRoot<false>::ShenandoahWeakRoot(OopStorage* storage, ShenandoahPhaseTimings::GCParPhases phase) :
+  _itr(storage), _phase(phase) {
+}
+
+template <typename IsAliveClosure, typename KeepAliveClosure>
+void ShenandoahWeakRoot<false /* concurrent */>::weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id) {
+  ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
+  ShenandoahWorkerTimingsTracker timer(worker_times, _phase, worker_id);
+  _itr.weak_oops_do(is_alive, keep_alive);
+}
+
+template <bool CONCURRENT>
+ShenandoahWeakRoots<CONCURRENT>::ShenandoahWeakRoots() :
+  _jni_roots(JNIHandles::weak_global_handles(), ShenandoahPhaseTimings::JNIWeakRoots),
+  _string_table_roots(StringTable::weak_storage(), ShenandoahPhaseTimings::StringTableRoots),
+  _resolved_method_table_roots(ResolvedMethodTable::weak_storage(), ShenandoahPhaseTimings::ResolvedMethodTableRoots),
+  _vm_roots(SystemDictionary::vm_weak_oop_storage(), ShenandoahPhaseTimings::VMWeakRoots) {
+}
+
+template <bool CONCURRENT>
+template <typename Closure>
+void ShenandoahWeakRoots<CONCURRENT>::oops_do(Closure* cl, uint worker_id) {
+  _jni_roots.oops_do(cl, worker_id);
+  _string_table_roots.oops_do(cl, worker_id);
+  _resolved_method_table_roots.oops_do(cl, worker_id);
+  _vm_roots.oops_do(cl, worker_id);
+}
+
+inline ShenandoahWeakRoots<false /* concurrent */>::ShenandoahWeakRoots() :
+  _jni_roots(JNIHandles::weak_global_handles(), ShenandoahPhaseTimings::JNIWeakRoots),
+  _string_table_roots(StringTable::weak_storage(), ShenandoahPhaseTimings::StringTableRoots),
+  _resolved_method_table_roots(ResolvedMethodTable::weak_storage(), ShenandoahPhaseTimings::ResolvedMethodTableRoots),
+  _vm_roots(SystemDictionary::vm_weak_oop_storage(), ShenandoahPhaseTimings::VMWeakRoots) {
+}
+
+template <typename IsAliveClosure, typename KeepAliveClosure>
+void ShenandoahWeakRoots<false /* concurrent*/>::weak_oops_do(IsAliveClosure* is_alive, KeepAliveClosure* keep_alive, uint worker_id) {
+  _jni_roots.weak_oops_do(is_alive, keep_alive, worker_id);
+  _string_table_roots.weak_oops_do(is_alive, keep_alive, worker_id);
+  _resolved_method_table_roots.weak_oops_do(is_alive, keep_alive, worker_id);
+  _vm_roots.weak_oops_do(is_alive, keep_alive, worker_id);
+}
+
+template <typename Closure>
+void ShenandoahWeakRoots<false /* concurrent */>::oops_do(Closure* cl, uint worker_id) {
+  AlwaysTrueClosure always_true;
+  weak_oops_do<AlwaysTrueClosure, Closure>(&always_true, cl, worker_id);
+}
+
+template <bool CONCURRENT>
 ShenandoahJNIHandleRoots<CONCURRENT>::ShenandoahJNIHandleRoots() :
   _itr(JNIHandles::global_handles()) {
 }
@@ -50,24 +119,32 @@
   }
 }
 
-template <typename IsAlive, typename KeepAlive>
-void ShenandoahWeakRoots::oops_do(IsAlive* is_alive, KeepAlive* keep_alive, uint worker_id) {
-  _task.work<IsAlive, KeepAlive>(worker_id, is_alive, keep_alive);
-}
-
-template <bool SINGLE_THREADED>
-ShenandoahClassLoaderDataRoots<SINGLE_THREADED>::ShenandoahClassLoaderDataRoots() {
+template <bool CONCURRENT, bool SINGLE_THREADED>
+ShenandoahClassLoaderDataRoots<CONCURRENT, SINGLE_THREADED>::ShenandoahClassLoaderDataRoots() {
   if (!SINGLE_THREADED) {
     ClassLoaderDataGraph::clear_claimed_marks();
   }
+  if (CONCURRENT) {
+    ClassLoaderDataGraph_lock->lock();
+  }
 }
 
-template <bool SINGLE_THREADED>
-void ShenandoahClassLoaderDataRoots<SINGLE_THREADED>::always_strong_cld_do(CLDClosure* clds, uint worker_id) {
+template <bool CONCURRENT, bool SINGLE_THREADED>
+ShenandoahClassLoaderDataRoots<CONCURRENT, SINGLE_THREADED>::~ShenandoahClassLoaderDataRoots() {
+  if (CONCURRENT) {
+    ClassLoaderDataGraph_lock->unlock();
+  }
+}
+
+
+template <bool CONCURRENT, bool SINGLE_THREADED>
+void ShenandoahClassLoaderDataRoots<CONCURRENT, SINGLE_THREADED>::always_strong_cld_do(CLDClosure* clds, uint worker_id) {
   if (SINGLE_THREADED) {
     assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
     assert(Thread::current()->is_VM_thread(), "Single threaded CLDG iteration can only be done by VM thread");
     ClassLoaderDataGraph::always_strong_cld_do(clds);
+  } else if (CONCURRENT) {
+     ClassLoaderDataGraph::always_strong_cld_do(clds);
   } else {
    ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
    ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id);
@@ -75,13 +152,15 @@
   }
 }
 
-template <bool SINGLE_THREADED>
-void ShenandoahClassLoaderDataRoots<SINGLE_THREADED>::cld_do(CLDClosure* clds, uint worker_id) {
+template <bool CONCURRENT, bool SINGLE_THREADED>
+void ShenandoahClassLoaderDataRoots<CONCURRENT, SINGLE_THREADED>::cld_do(CLDClosure* clds, uint worker_id) {
   if (SINGLE_THREADED) {
     assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
     assert(Thread::current()->is_VM_thread(), "Single threaded CLDG iteration can only be done by VM thread");
     ClassLoaderDataGraph::cld_do(clds);
-  } else {
+  } else if (CONCURRENT) {
+    ClassLoaderDataGraph::cld_do(clds);
+  }  else {
     ShenandoahWorkerTimings* worker_times = ShenandoahHeap::heap()->phase_timings()->worker_times();
     ShenandoahWorkerTimingsTracker timer(worker_times, ShenandoahPhaseTimings::CLDGRoots, worker_id);
     ClassLoaderDataGraph::cld_do(clds);
@@ -197,7 +276,8 @@
     _code_roots.code_blobs_do(&update_blobs, worker_id);
   }
 
-  _weak_roots.oops_do<IsAlive, KeepAlive>(is_alive, keep_alive, worker_id);
+  _serial_weak_roots.weak_oops_do(is_alive, keep_alive, worker_id);
+  _weak_roots.weak_oops_do(is_alive, keep_alive, worker_id);
   _dedup_roots.oops_do(is_alive, keep_alive, worker_id);
 }
 
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -54,6 +54,10 @@
   return (_types & type) != 0;
 }
 
+ShenandoahRootVerifier::RootTypes ShenandoahRootVerifier::combine(RootTypes t1, RootTypes t2) {
+  return static_cast<ShenandoahRootVerifier::RootTypes>(static_cast<uint>(t1) | static_cast<uint>(t2));
+}
+
 void ShenandoahRootVerifier::oops_do(OopClosure* oops) {
   CodeBlobToOopClosure blobs(oops, !CodeBlobToOopClosure::FixRelocations);
   if (verify(CodeRoots)) {
--- a/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/shenandoah/shenandoahRootVerifier.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -52,6 +52,8 @@
   // Used to seed ShenandoahVerifier, do not honor root type filter
   void roots_do(OopClosure* cl);
   void strong_roots_do(OopClosure* cl);
+
+  static RootTypes combine(RootTypes t1, RootTypes t2);
 private:
   bool verify(RootTypes type) const;
 };
--- a/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,7 +45,7 @@
     // We don't need to take the lock when unlinking nmethods from
     // the Method, because it is only concurrently unlinked by
     // the entry barrier, which acquires the per nmethod lock.
-    nm->unlink_from_method();
+    nm->unlink_from_method(false /* acquire_lock */);
 
     // We can end up calling nmethods that are unloading
     // since we clear compiled ICs lazily. Returning false
--- a/src/hotspot/share/gc/z/zNMethod.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/gc/z/zNMethod.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -285,7 +285,7 @@
       // We don't need to take the lock when unlinking nmethods from
       // the Method, because it is only concurrently unlinked by
       // the entry barrier, which acquires the per nmethod lock.
-      nm->unlink_from_method();
+      nm->unlink_from_method(false /* acquire_lock */);
       return;
     }
 
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -568,6 +568,33 @@
   return JVMCIENV->get_jobject(result);
 C2V_END
 
+C2V_VMENTRY_NULL(jobject, getArrayType, (JNIEnv* env, jobject, jobject jvmci_type))
+  if (jvmci_type == NULL) {
+    JVMCI_THROW_0(NullPointerException);
+  }
+
+  JVMCIObject jvmci_type_object = JVMCIENV->wrap(jvmci_type);
+  JVMCIKlassHandle array_klass(THREAD);
+  if (JVMCIENV->isa_HotSpotResolvedPrimitiveType(jvmci_type_object)) {
+    BasicType type = JVMCIENV->kindToBasicType(JVMCIENV->get_HotSpotResolvedPrimitiveType_kind(jvmci_type_object), JVMCI_CHECK_0);
+    if (type == T_VOID) {
+      return NULL;
+    }
+    array_klass = Universe::typeArrayKlassObj(type);
+    if (array_klass == NULL) {
+      JVMCI_THROW_MSG_NULL(InternalError, err_msg("No array klass for primitive type %s", type2name(type)));
+    }
+  } else {
+    Klass* klass = JVMCIENV->asKlass(jvmci_type);
+    if (klass == NULL) {
+      JVMCI_THROW_0(NullPointerException);
+    }
+    array_klass = klass->array_klass(CHECK_NULL);
+  }
+  JVMCIObject result = JVMCIENV->get_jvmci_type(array_klass, JVMCI_CHECK_NULL);
+  return JVMCIENV->get_jobject(result);
+C2V_END
+
 C2V_VMENTRY_NULL(jobject, lookupClass, (JNIEnv* env, jobject, jclass mirror))
   requireInHotSpot("lookupClass", JVMCI_CHECK_NULL);
   if (mirror == NULL) {
@@ -2578,6 +2605,18 @@
   return FailedSpeculation::add_failed_speculation(NULL, (FailedSpeculation**)(address) failed_speculations_address, (address) speculation, speculation_len);
 }
 
+C2V_VMENTRY(void, callSystemExit, (JNIEnv* env, jobject, jint status))
+  JavaValue result(T_VOID);
+  JavaCallArguments jargs(1);
+  jargs.push_int(status);
+  JavaCalls::call_static(&result,
+                       SystemDictionary::System_klass(),
+                       vmSymbols::exit_method_name(),
+                       vmSymbols::int_void_signature(),
+                       &jargs,
+                       CHECK);
+}
+
 #define CC (char*)  /*cast a literal from (const char*)*/
 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
 
@@ -2624,6 +2663,7 @@
   {CC "hasNeverInlineDirective",                      CC "(" HS_RESOLVED_METHOD ")Z",                                                       FN_PTR(hasNeverInlineDirective)},
   {CC "shouldInlineMethod",                           CC "(" HS_RESOLVED_METHOD ")Z",                                                       FN_PTR(shouldInlineMethod)},
   {CC "lookupType",                                   CC "(" STRING HS_RESOLVED_KLASS "Z)" HS_RESOLVED_TYPE,                                FN_PTR(lookupType)},
+  {CC "getArrayType",                                 CC "(" HS_RESOLVED_TYPE ")" HS_RESOLVED_KLASS,                                        FN_PTR(getArrayType)},
   {CC "lookupClass",                                  CC "(" CLASS ")" HS_RESOLVED_TYPE,                                                    FN_PTR(lookupClass)},
   {CC "lookupNameInPool",                             CC "(" HS_CONSTANT_POOL "I)" STRING,                                                  FN_PTR(lookupNameInPool)},
   {CC "lookupNameAndTypeRefIndexInPool",              CC "(" HS_CONSTANT_POOL "I)I",                                                        FN_PTR(lookupNameAndTypeRefIndexInPool)},
@@ -2723,6 +2763,7 @@
   {CC "getFailedSpeculationsAddress",                 CC "(" HS_RESOLVED_METHOD ")J",                                                       FN_PTR(getFailedSpeculationsAddress)},
   {CC "releaseFailedSpeculations",                    CC "(J)V",                                                                            FN_PTR(releaseFailedSpeculations)},
   {CC "addFailedSpeculation",                         CC "(J[B)Z",                                                                          FN_PTR(addFailedSpeculation)},
+  {CC "callSystemExit",                               CC "(I)V",                                                                            FN_PTR(callSystemExit)},
 };
 
 int CompilerToVM::methods_count() {
--- a/src/hotspot/share/jvmci/jvmciEnv.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/jvmci/jvmciEnv.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -31,7 +31,6 @@
 #include "memory/universe.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/typeArrayOop.inline.hpp"
-#include "runtime/deoptimization.hpp"
 #include "runtime/jniHandles.inline.hpp"
 #include "runtime/javaCalls.hpp"
 #include "jvmci/jniAccessMark.inline.hpp"
@@ -1361,6 +1360,9 @@
     return Handle(THREAD, obj);
   } else if (isa_IndirectHotSpotObjectConstantImpl(constant)) {
     jlong object_handle = get_IndirectHotSpotObjectConstantImpl_objectHandle(constant);
+    if (object_handle == 0L) {
+      JVMCI_THROW_MSG_(NullPointerException, "Foreign object reference has been cleared", Handle());
+    }
     oop result = resolve_handle(object_handle);
     if (result == NULL) {
       JVMCI_THROW_MSG_(InternalError, "Constant was unexpectedly NULL", Handle());
@@ -1490,7 +1492,8 @@
     // Invalidating the HotSpotNmethod means we want the nmethod
     // to be deoptimized.
     nm->mark_for_deoptimization();
-    Deoptimization::deoptimize_all_marked();
+    VM_Deoptimize op;
+    VMThread::execute(&op);
   }
 
   // A HotSpotNmethod instance can only reference a single nmethod
--- a/src/hotspot/share/oops/method.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/oops/method.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -103,7 +103,7 @@
   // Fix and bury in Method*
   set_interpreter_entry(NULL); // sets i2i entry and from_int
   set_adapter_entry(NULL);
-  Method::clear_code(); // from_c/from_i get set to c2i/i2i
+  clear_code(false /* don't need a lock */); // from_c/from_i get set to c2i/i2i
 
   if (access_flags.is_native()) {
     clear_native_function();
@@ -819,7 +819,7 @@
   set_native_function(
     SharedRuntime::native_method_throw_unsatisfied_link_error_entry(),
     !native_bind_event_is_interesting);
-  this->unlink_code();
+  clear_code();
 }
 
 address Method::critical_native_function() {
@@ -943,7 +943,8 @@
 }
 
 // Revert to using the interpreter and clear out the nmethod
-void Method::clear_code() {
+void Method::clear_code(bool acquire_lock /* = true */) {
+  MutexLocker pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
   // this may be NULL if c2i adapters have not been made yet
   // Only should happen at allocate time.
   if (adapter() == NULL) {
@@ -957,25 +958,6 @@
   _code = NULL;
 }
 
-void Method::unlink_code(CompiledMethod *compare) {
-  MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
-  // We need to check if either the _code or _from_compiled_code_entry_point
-  // refer to this nmethod because there is a race in setting these two fields
-  // in Method* as seen in bugid 4947125.
-  // If the vep() points to the zombie nmethod, the memory for the nmethod
-  // could be flushed and the compiler and vtable stubs could still call
-  // through it.
-  if (code() == compare ||
-      from_compiled_entry() == compare->verified_entry_point()) {
-    clear_code();
-  }
-}
-
-void Method::unlink_code() {
-  MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
-  clear_code();
-}
-
 #if INCLUDE_CDS
 // Called by class data sharing to remove any entry points (which are not shared)
 void Method::unlink_method() {
@@ -1202,7 +1184,7 @@
 
 // Install compiled code.  Instantly it can execute.
 void Method::set_code(const methodHandle& mh, CompiledMethod *code) {
-  MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag);
+  MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
   assert( code, "use clear_code to remove code" );
   assert( mh->check_code(), "" );
 
--- a/src/hotspot/share/oops/method.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/oops/method.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -463,17 +463,7 @@
   address verified_code_entry();
   bool check_code() const;      // Not inline to avoid circular ref
   CompiledMethod* volatile code() const;
-
-  // Locks CompiledMethod_lock if not held.
-  void unlink_code(CompiledMethod *compare);
-  // Locks CompiledMethod_lock if not held.
-  void unlink_code();
-
-private:
-  // Either called with CompiledMethod_lock held or from constructor.
-  void clear_code();
-
-public:
+  void clear_code(bool acquire_lock = true);    // Clear out any compiled code
   static void set_code(const methodHandle& mh, CompiledMethod* code);
   void set_adapter_entry(AdapterHandlerEntry* adapter) {
     constMethod()->set_adapter_entry(adapter);
--- a/src/hotspot/share/prims/jvmtiEventController.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/prims/jvmtiEventController.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -32,7 +32,6 @@
 #include "prims/jvmtiExport.hpp"
 #include "prims/jvmtiImpl.hpp"
 #include "prims/jvmtiThreadState.inline.hpp"
-#include "runtime/deoptimization.hpp"
 #include "runtime/frame.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/threadSMR.hpp"
@@ -240,7 +239,8 @@
       }
     }
     if (num_marked > 0) {
-      Deoptimization::deoptimize_all_marked();
+      VM_Deoptimize op;
+      VMThread::execute(&op);
     }
   }
 }
--- a/src/hotspot/share/prims/methodHandles.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/prims/methodHandles.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -42,7 +42,6 @@
 #include "oops/typeArrayOop.inline.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/compilationPolicy.hpp"
-#include "runtime/deoptimization.hpp"
 #include "runtime/fieldDescriptor.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
@@ -1110,7 +1109,8 @@
   }
   if (marked > 0) {
     // At least one nmethod has been marked for deoptimization.
-    Deoptimization::deoptimize_all_marked();
+    VM_Deoptimize op;
+    VMThread::execute(&op);
   }
 }
 
@@ -1506,7 +1506,8 @@
     }
     if (marked > 0) {
       // At least one nmethod has been marked for deoptimization
-      Deoptimization::deoptimize_all_marked();
+      VM_Deoptimize op;
+      VMThread::execute(&op);
     }
   }
 }
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/prims/resolvedMethodTable.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -56,15 +56,15 @@
   return name_hash ^ signature_hash;
 }
 
-typedef ConcurrentHashTable<WeakHandle<vm_resolved_method_table_data>,
-                            ResolvedMethodTableConfig,
+typedef ConcurrentHashTable<ResolvedMethodTableConfig,
                             mtClass> ResolvedMethodTableHash;
 
-class ResolvedMethodTableConfig : public ResolvedMethodTableHash::BaseConfig {
+class ResolvedMethodTableConfig : public AllStatic {
  private:
  public:
-  static uintx get_hash(WeakHandle<vm_resolved_method_table_data> const& value,
-                        bool* is_dead) {
+  typedef WeakHandle<vm_resolved_method_table_data> Value;
+
+  static uintx get_hash(Value const& value, bool* is_dead) {
     oop val_oop = value.peek();
     if (val_oop == NULL) {
       *is_dead = true;
@@ -76,13 +76,13 @@
   }
 
   // We use default allocation/deallocation but counted
-  static void* allocate_node(size_t size, WeakHandle<vm_resolved_method_table_data> const& value) {
+  static void* allocate_node(size_t size, Value const& value) {
     ResolvedMethodTable::item_added();
-    return ResolvedMethodTableHash::BaseConfig::allocate_node(size, value);
+    return AllocateHeap(size, mtClass);
   }
-  static void free_node(void* memory, WeakHandle<vm_resolved_method_table_data> const& value) {
+  static void free_node(void* memory, Value const& value) {
     value.release();
-    ResolvedMethodTableHash::BaseConfig::free_node(memory, value);
+    FreeHeap(memory);
     ResolvedMethodTable::item_removed();
   }
 };
--- a/src/hotspot/share/prims/whitebox.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/prims/whitebox.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -822,8 +822,10 @@
 WB_END
 
 WB_ENTRY(void, WB_DeoptimizeAll(JNIEnv* env, jobject o))
+  MutexLocker mu(Compile_lock);
   CodeCache::mark_all_nmethods_for_deoptimization();
-  Deoptimization::deoptimize_all_marked();
+  VM_Deoptimize op;
+  VMThread::execute(&op);
 WB_END
 
 WB_ENTRY(jint, WB_DeoptimizeMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
@@ -840,7 +842,8 @@
   }
   result += CodeCache::mark_for_deoptimization(mh());
   if (result > 0) {
-    Deoptimization::deoptimize_all_marked();
+    VM_Deoptimize op;
+    VMThread::execute(&op);
   }
   return result;
 WB_END
--- a/src/hotspot/share/runtime/biasedLocking.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/biasedLocking.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -628,29 +628,6 @@
   event->commit();
 }
 
-BiasedLocking::Condition BiasedLocking::revoke_own_locks_in_handshake(Handle obj, TRAPS) {
-  markOop mark = obj->mark();
-
-  if (!mark->has_bias_pattern()) {
-    return NOT_BIASED;
-  }
-
-  Klass *k = obj->klass();
-  markOop prototype_header = k->prototype_header();
-  assert(mark->biased_locker() == THREAD &&
-         prototype_header->bias_epoch() == mark->bias_epoch(), "Revoke failed, unhandled biased lock state");
-  ResourceMark rm;
-  log_info(biasedlocking)("Revoking bias by walking my own stack:");
-  EventBiasedLockSelfRevocation event;
-  BiasedLocking::Condition cond = revoke_bias(obj(), false, false, (JavaThread*) THREAD, NULL);
-  ((JavaThread*) THREAD)->set_cached_monitor_info(NULL);
-  assert(cond == BIAS_REVOKED, "why not?");
-  if (event.should_commit()) {
-    post_self_revocation_event(&event, k);
-  }
-  return cond;
-}
-
 BiasedLocking::Condition BiasedLocking::revoke_and_rebias(Handle obj, bool attempt_rebias, TRAPS) {
   assert(!SafepointSynchronize::is_at_safepoint(), "must not be called while at safepoint");
 
--- a/src/hotspot/share/runtime/biasedLocking.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/biasedLocking.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -175,7 +175,6 @@
 
   // This should be called by JavaThreads to revoke the bias of an object
   static Condition revoke_and_rebias(Handle obj, bool attempt_rebias, TRAPS);
-  static Condition revoke_own_locks_in_handshake(Handle obj, TRAPS);
 
   // These do not allow rebiasing; they are used by deoptimization to
   // ensure that monitors on the stack can be migrated
--- a/src/hotspot/share/runtime/deoptimization.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/deoptimization.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -779,35 +779,10 @@
   return bt;
 JRT_END
 
-class DeoptimizeMarkedTC : public ThreadClosure {
-  bool _in_handshake;
- public:
-  DeoptimizeMarkedTC(bool in_handshake) : _in_handshake(in_handshake) {}
-  virtual void do_thread(Thread* thread) {
-    assert(thread->is_Java_thread(), "must be");
-    JavaThread* jt = (JavaThread*)thread;
-    jt->deoptimize_marked_methods(_in_handshake);
-  }
-};
 
-void Deoptimization::deoptimize_all_marked() {
-  ResourceMark rm;
-  DeoptimizationMarker dm;
-
-  if (SafepointSynchronize::is_at_safepoint()) {
-    DeoptimizeMarkedTC deopt(false);
-    // Make the dependent methods not entrant
-    CodeCache::make_marked_nmethods_not_entrant();
-    Threads::java_threads_do(&deopt);
-  } else {
-    // Make the dependent methods not entrant
-    {
-      MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-      CodeCache::make_marked_nmethods_not_entrant();
-    }
-    DeoptimizeMarkedTC deopt(true);
-    Handshake::execute(&deopt);
-  }
+int Deoptimization::deoptimize_dependents() {
+  Threads::deoptimized_wrt_marked_nmethods();
+  return 0;
 }
 
 Deoptimization::DeoptAction Deoptimization::_unloaded_action
@@ -1412,7 +1387,14 @@
   }
 }
 
-static void get_monitors_from_stack(GrowableArray<Handle>* objects_to_revoke, JavaThread* thread, frame fr, RegisterMap* map) {
+
+void Deoptimization::revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map) {
+  if (!UseBiasedLocking) {
+    return;
+  }
+
+  GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
+
   // Unfortunately we don't have a RegisterMap available in most of
   // the places we want to call this routine so we need to walk the
   // stack again to update the register map.
@@ -1436,14 +1418,6 @@
     cvf = compiledVFrame::cast(cvf->sender());
   }
   collect_monitors(cvf, objects_to_revoke);
-}
-
-void Deoptimization::revoke_using_safepoint(JavaThread* thread, frame fr, RegisterMap* map) {
-  if (!UseBiasedLocking) {
-    return;
-  }
-  GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
-  get_monitors_from_stack(objects_to_revoke, thread, fr, map);
 
   if (SafepointSynchronize::is_at_safepoint()) {
     BiasedLocking::revoke_at_safepoint(objects_to_revoke);
@@ -1452,21 +1426,6 @@
   }
 }
 
-void Deoptimization::revoke_using_handshake(JavaThread* thread, frame fr, RegisterMap* map) {
-  if (!UseBiasedLocking) {
-    return;
-  }
-  GrowableArray<Handle>* objects_to_revoke = new GrowableArray<Handle>();
-  get_monitors_from_stack(objects_to_revoke, thread, fr, map);
-
-  int len = objects_to_revoke->length();
-  for (int i = 0; i < len; i++) {
-    oop obj = (objects_to_revoke->at(i))();
-    BiasedLocking::revoke_own_locks_in_handshake(objects_to_revoke->at(i), thread);
-    assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
-  }
-}
-
 
 void Deoptimization::deoptimize_single_frame(JavaThread* thread, frame fr, Deoptimization::DeoptReason reason) {
   assert(fr.can_be_deoptimized(), "checking frame type");
@@ -1495,16 +1454,11 @@
   fr.deoptimize(thread);
 }
 
-void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map, bool in_handshake) {
-  deopt_thread(in_handshake, thread, fr, map, Reason_constraint);
+void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map) {
+  deoptimize(thread, fr, map, Reason_constraint);
 }
 
 void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map, DeoptReason reason) {
-  deopt_thread(false, thread, fr, map, reason);
-}
-
-void Deoptimization::deopt_thread(bool in_handshake, JavaThread* thread,
-                                  frame fr, RegisterMap *map, DeoptReason reason) {
   // Deoptimize only if the frame comes from compile code.
   // Do not deoptimize the frame which is already patched
   // during the execution of the loops below.
@@ -1514,11 +1468,7 @@
   ResourceMark rm;
   DeoptimizationMarker dm;
   if (UseBiasedLocking) {
-    if (in_handshake) {
-      revoke_using_handshake(thread, fr, map);
-    } else {
-      revoke_using_safepoint(thread, fr, map);
-    }
+    revoke_biases_of_monitors(thread, fr, map);
   }
   deoptimize_single_frame(thread, fr, reason);
 
--- a/src/hotspot/share/runtime/deoptimization.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/deoptimization.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -137,19 +137,12 @@
     Unpack_LIMIT                = 4
   };
 
-  static void deoptimize_all_marked();
-
- private:
   // Checks all compiled methods. Invalid methods are deleted and
   // corresponding activations are deoptimized.
   static int deoptimize_dependents();
-  static void revoke_using_handshake(JavaThread* thread, frame fr, RegisterMap* map);
-  static void revoke_using_safepoint(JavaThread* thread, frame fr, RegisterMap* map);
-  static void deopt_thread(bool in_handshake, JavaThread* thread, frame fr, RegisterMap *map, DeoptReason reason);
 
- public:
   // Deoptimizes a frame lazily. nmethod gets patched deopt happens on return to the frame
-  static void deoptimize(JavaThread* thread, frame fr, RegisterMap *map, bool in_handshake = false);
+  static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map);
   static void deoptimize(JavaThread* thread, frame fr, RegisterMap *reg_map, DeoptReason reason);
 
 #if INCLUDE_JVMCI
@@ -163,9 +156,7 @@
 
   // Helper function to revoke biases of all monitors in frame if UseBiasedLocking
   // is enabled
-  static void revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map) {
-    revoke_using_safepoint(thread, fr, map);
-  }
+  static void revoke_biases_of_monitors(JavaThread* thread, frame fr, RegisterMap* map);
 
 #if COMPILER2_OR_JVMCI
 JVMCI_ONLY(public:)
--- a/src/hotspot/share/runtime/mutex.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/mutex.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -62,7 +62,7 @@
        event,
        access         = event          +   1,
        tty            = access         +   2,
-       special        = tty            +   2,
+       special        = tty            +   1,
        suspend_resume = special        +   1,
        vmweak         = suspend_resume +   2,
        leaf           = vmweak         +   2,
--- a/src/hotspot/share/runtime/mutexLocker.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/mutexLocker.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -39,7 +39,6 @@
 // Consider using GCC's __read_mostly.
 
 Mutex*   Patching_lock                = NULL;
-Mutex*   CompiledMethod_lock          = NULL;
 Monitor* SystemDictionary_lock        = NULL;
 Mutex*   ProtectionDomainSet_lock     = NULL;
 Mutex*   SharedDictionary_lock        = NULL;
@@ -262,8 +261,6 @@
   def(ClassLoaderDataGraph_lock    , PaddedMutex  , nonleaf,     true,  Monitor::_safepoint_check_always);
 
   def(Patching_lock                , PaddedMutex  , special,     true,  Monitor::_safepoint_check_never);      // used for safepointing and code patching.
-  def(OsrList_lock                 , PaddedMutex  , special-1,   true,  Monitor::_safepoint_check_never);
-  def(CompiledMethod_lock          , PaddedMutex  , special-1,   true,  Monitor::_safepoint_check_never);
   def(Service_lock                 , PaddedMonitor, special,     true,  Monitor::_safepoint_check_never);      // used for service thread operations
   def(JmethodIdCreation_lock       , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_always); // used for creating jmethodIDs.
 
@@ -279,6 +276,7 @@
   def(SymbolArena_lock             , PaddedMutex  , leaf+2,      true,  Monitor::_safepoint_check_never);
   def(ProfilePrint_lock            , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // serial profile printing
   def(ExceptionCache_lock          , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // serial profile printing
+  def(OsrList_lock                 , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
   def(Debug1_lock                  , PaddedMutex  , leaf,        true,  Monitor::_safepoint_check_never);
 #ifndef PRODUCT
   def(FullGCALot_lock              , PaddedMutex  , leaf,        false, Monitor::_safepoint_check_always); // a lock to make FullGCALot MT safe
--- a/src/hotspot/share/runtime/mutexLocker.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/mutexLocker.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -32,7 +32,6 @@
 // Mutexes used in the VM.
 
 extern Mutex*   Patching_lock;                   // a lock used to guard code patching of compiled code
-extern Mutex*   CompiledMethod_lock;             // a lock used to guard a compiled method
 extern Monitor* SystemDictionary_lock;           // a lock on the system dictionary
 extern Mutex*   ProtectionDomainSet_lock;        // a lock on the pd_set list in the system dictionary
 extern Mutex*   SharedDictionary_lock;           // a lock on the CDS shared dictionary
--- a/src/hotspot/share/runtime/thread.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/thread.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -2903,17 +2903,18 @@
 #endif // PRODUCT
 
 
-void JavaThread::deoptimize_marked_methods(bool in_handshake) {
+void JavaThread::deoptimized_wrt_marked_nmethods() {
   if (!has_last_Java_frame()) return;
   // BiasedLocking needs an updated RegisterMap for the revoke monitors pass
   StackFrameStream fst(this, UseBiasedLocking);
   for (; !fst.is_done(); fst.next()) {
     if (fst.current()->should_be_deoptimized()) {
-      Deoptimization::deoptimize(this, *fst.current(), fst.register_map(), in_handshake);
+      Deoptimization::deoptimize(this, *fst.current(), fst.register_map());
     }
   }
 }
 
+
 // If the caller is a NamedThread, then remember, in the current scope,
 // the given JavaThread in its _processed_thread field.
 class RememberProcessedThread: public StackObj {
@@ -4652,6 +4653,13 @@
   threads_do(&handles_closure);
 }
 
+void Threads::deoptimized_wrt_marked_nmethods() {
+  ALL_JAVA_THREADS(p) {
+    p->deoptimized_wrt_marked_nmethods();
+  }
+}
+
+
 // Get count Java threads that are waiting to enter the specified monitor.
 GrowableArray<JavaThread*>* Threads::get_pending_threads(ThreadsList * t_list,
                                                          int count,
--- a/src/hotspot/share/runtime/thread.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/thread.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -1923,7 +1923,7 @@
   void deoptimize();
   void make_zombies();
 
-  void deoptimize_marked_methods(bool in_handshake);
+  void deoptimized_wrt_marked_nmethods();
 
  public:
   // Returns the running thread as a JavaThread
--- a/src/hotspot/share/runtime/vmOperations.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/vmOperations.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -118,6 +118,18 @@
   }
 }
 
+void VM_Deoptimize::doit() {
+  // We do not want any GCs to happen while we are in the middle of this VM operation
+  ResourceMark rm;
+  DeoptimizationMarker dm;
+
+  // Deoptimize all activations depending on marked nmethods
+  Deoptimization::deoptimize_dependents();
+
+  // Make the dependent methods not entrant
+  CodeCache::make_marked_nmethods_not_entrant();
+}
+
 void VM_MarkActiveNMethods::doit() {
   NMethodSweeper::mark_active_nmethods();
 }
--- a/src/hotspot/share/runtime/vmOperations.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/runtime/vmOperations.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -49,6 +49,7 @@
   template(ClearICs)                              \
   template(ForceSafepoint)                        \
   template(ForceAsyncSafepoint)                   \
+  template(Deoptimize)                            \
   template(DeoptimizeFrame)                       \
   template(DeoptimizeAll)                         \
   template(ZombieAll)                             \
@@ -318,6 +319,14 @@
   VM_GTestExecuteAtSafepoint() {}
 };
 
+class VM_Deoptimize: public VM_Operation {
+ public:
+  VM_Deoptimize() {}
+  VMOp_Type type() const                        { return VMOp_Deoptimize; }
+  void doit();
+  bool allow_nested_vm_operations() const        { return true; }
+};
+
 class VM_MarkActiveNMethods: public VM_Operation {
  public:
   VM_MarkActiveNMethods() {}
--- a/src/hotspot/share/services/dtraceAttacher.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/services/dtraceAttacher.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,23 @@
 
 #ifdef SOLARIS
 
+class VM_DeoptimizeTheWorld : public VM_Operation {
+ public:
+  VMOp_Type type() const {
+    return VMOp_DeoptimizeTheWorld;
+  }
+  void doit() {
+    CodeCache::mark_all_nmethods_for_deoptimization();
+    ResourceMark rm;
+    DeoptimizationMarker dm;
+    // Deoptimize all activations depending on marked methods
+    Deoptimization::deoptimize_dependents();
+
+    // Mark the dependent methods non entrant
+    CodeCache::make_marked_nmethods_not_entrant();
+  }
+};
+
 static void set_bool_flag(const char* flag, bool value) {
   JVMFlag::boolAtPut((char*)flag, strlen(flag), &value,
                               JVMFlag::ATTACH_ON_DEMAND);
@@ -57,8 +74,8 @@
 
   if (changed) {
     // one or more flags changed, need to deoptimize
-    CodeCache::mark_all_nmethods_for_deoptimization();
-    Deoptimization::deoptimize_all_marked();
+    VM_DeoptimizeTheWorld op;
+    VMThread::execute(&op);
   }
 }
 
@@ -80,8 +97,8 @@
   }
   if (changed) {
     // one or more flags changed, need to deoptimize
-    CodeCache::mark_all_nmethods_for_deoptimization();
-    Deoptimization::deoptimize_all_marked();
+    VM_DeoptimizeTheWorld op;
+    VMThread::execute(&op);
   }
 }
 
--- a/src/hotspot/share/utilities/concurrentHashTable.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/utilities/concurrentHashTable.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -38,8 +38,9 @@
 class Thread;
 class Mutex;
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 class ConcurrentHashTable : public CHeapObj<F> {
+  typedef typename CONFIG::Value VALUE;
  private:
   // This is the internal node structure.
   // Only constructed with placement new from memory allocated with MEMFLAGS of
@@ -252,10 +253,10 @@
   class ScopedCS: public StackObj {
    protected:
     Thread* _thread;
-    ConcurrentHashTable<VALUE, CONFIG, F>* _cht;
+    ConcurrentHashTable<CONFIG, F>* _cht;
     GlobalCounter::CSContext _cs_context;
    public:
-    ScopedCS(Thread* thread, ConcurrentHashTable<VALUE, CONFIG, F>* cht);
+    ScopedCS(Thread* thread, ConcurrentHashTable<CONFIG, F>* cht);
     ~ScopedCS();
   };
 
@@ -473,26 +474,12 @@
                      const char* table_name);
 
   // Moves all nodes from this table to to_cht
-  bool try_move_nodes_to(Thread* thread, ConcurrentHashTable<VALUE, CONFIG, F>* to_cht);
-
-  // This is a Curiously Recurring Template Pattern (CRPT) interface for the
-  // specialization.
-  struct BaseConfig {
-   public:
-    // Called when the hash table needs the hash for a VALUE.
-    static uintx get_hash(const VALUE& value, bool* dead) {
-      return CONFIG::get_hash(value, dead);
-    }
-    // Default node allocation.
-    static void* allocate_node(size_t size, const VALUE& value);
-    // Default node reclamation.
-    static void free_node(void* memory, const VALUE& value);
-  };
+  bool try_move_nodes_to(Thread* thread, ConcurrentHashTable<CONFIG, F>* to_cht);
 
   // Scoped multi getter.
   class MultiGetHandle : private ScopedCS {
    public:
-    MultiGetHandle(Thread* thread, ConcurrentHashTable<VALUE, CONFIG, F>* cht)
+    MultiGetHandle(Thread* thread, ConcurrentHashTable<CONFIG, F>* cht)
       : ScopedCS(thread, cht) {}
     // In the MultiGetHandle scope you can lookup items matching LOOKUP_FUNC.
     // The VALUEs are safe as long as you never save the VALUEs outside the
--- a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -53,28 +53,28 @@
 #endif
 
 // Node
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline typename ConcurrentHashTable<VALUE, CONFIG, F>::Node*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline typename ConcurrentHashTable<CONFIG, F>::Node*
+ConcurrentHashTable<CONFIG, F>::
   Node::next() const
 {
   return OrderAccess::load_acquire(&_next);
 }
 
 // Bucket
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline typename ConcurrentHashTable<VALUE, CONFIG, F>::Node*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline typename ConcurrentHashTable<CONFIG, F>::Node*
+ConcurrentHashTable<CONFIG, F>::
   Bucket::first_raw() const
 {
   return OrderAccess::load_acquire(&_first);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   Bucket::release_assign_node_ptr(
-    typename ConcurrentHashTable<VALUE, CONFIG, F>::Node* const volatile * dst,
-    typename ConcurrentHashTable<VALUE, CONFIG, F>::Node* node) const
+    typename ConcurrentHashTable<CONFIG, F>::Node* const volatile * dst,
+    typename ConcurrentHashTable<CONFIG, F>::Node* node) const
 {
   // Due to this assert this methods is not static.
   assert(is_locked(), "Must be locked.");
@@ -82,31 +82,31 @@
   OrderAccess::release_store(tmp, clear_set_state(node, *dst));
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline typename ConcurrentHashTable<VALUE, CONFIG, F>::Node*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline typename ConcurrentHashTable<CONFIG, F>::Node*
+ConcurrentHashTable<CONFIG, F>::
   Bucket::first() const
 {
   // We strip the states bit before returning the ptr.
   return clear_state(OrderAccess::load_acquire(&_first));
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   Bucket::have_redirect() const
 {
   return is_state(first_raw(), STATE_REDIRECT_BIT);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   Bucket::is_locked() const
 {
   return is_state(first_raw(), STATE_LOCK_BIT);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   Bucket::lock()
 {
   int i = 0;
@@ -123,10 +123,10 @@
   }
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   Bucket::release_assign_last_node_next(
-     typename ConcurrentHashTable<VALUE, CONFIG, F>::Node* node)
+     typename ConcurrentHashTable<CONFIG, F>::Node* node)
 {
   assert(is_locked(), "Must be locked.");
   Node* const volatile * ret = first_ptr();
@@ -136,10 +136,10 @@
   release_assign_node_ptr(ret, node);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
-  Bucket::cas_first(typename ConcurrentHashTable<VALUE, CONFIG, F>::Node* node,
-                    typename ConcurrentHashTable<VALUE, CONFIG, F>::Node* expect
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
+  Bucket::cas_first(typename ConcurrentHashTable<CONFIG, F>::Node* node,
+                    typename ConcurrentHashTable<CONFIG, F>::Node* expect
                     )
 {
   if (is_locked()) {
@@ -151,8 +151,8 @@
   return false;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   Bucket::trylock()
 {
   if (is_locked()) {
@@ -166,8 +166,8 @@
   return false;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   Bucket::unlock()
 {
   assert(is_locked(), "Must be locked.");
@@ -176,8 +176,8 @@
   OrderAccess::release_store(&_first, clear_state(first()));
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   Bucket::redirect()
 {
   assert(is_locked(), "Must be locked.");
@@ -185,8 +185,8 @@
 }
 
 // InternalTable
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline ConcurrentHashTable<CONFIG, F>::
   InternalTable::InternalTable(size_t log2_size)
     : _log2_size(log2_size), _size(((size_t)1ul) << _log2_size),
       _hash_mask(~(~((size_t)0) << _log2_size))
@@ -201,17 +201,17 @@
   }
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline ConcurrentHashTable<CONFIG, F>::
   InternalTable::~InternalTable()
 {
   FREE_C_HEAP_ARRAY(Bucket, _buckets);
 }
 
 // ScopedCS
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline ConcurrentHashTable<VALUE, CONFIG, F>::
-  ScopedCS::ScopedCS(Thread* thread, ConcurrentHashTable<VALUE, CONFIG, F>* cht)
+template <typename CONFIG, MEMFLAGS F>
+inline ConcurrentHashTable<CONFIG, F>::
+  ScopedCS::ScopedCS(Thread* thread, ConcurrentHashTable<CONFIG, F>* cht)
     : _thread(thread),
       _cht(cht),
       _cs_context(GlobalCounter::critical_section_begin(_thread))
@@ -222,40 +222,25 @@
   }
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline ConcurrentHashTable<CONFIG, F>::
   ScopedCS::~ScopedCS()
 {
   GlobalCounter::critical_section_end(_thread, _cs_context);
 }
 
-// BaseConfig
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void* ConcurrentHashTable<VALUE, CONFIG, F>::
-  BaseConfig::allocate_node(size_t size, const VALUE& value)
-{
-  return AllocateHeap(size, F);
-}
-
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
-  BaseConfig::free_node(void* memory, const VALUE& value)
-{
-  FreeHeap(memory);
-}
-
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename LOOKUP_FUNC>
-inline VALUE* ConcurrentHashTable<VALUE, CONFIG, F>::
+inline typename CONFIG::Value* ConcurrentHashTable<CONFIG, F>::
   MultiGetHandle::get(LOOKUP_FUNC& lookup_f, bool* grow_hint)
 {
   return ScopedCS::_cht->internal_get(ScopedCS::_thread, lookup_f, grow_hint);
 }
 
 // HaveDeletables
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename EVALUATE_FUNC>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+inline bool ConcurrentHashTable<CONFIG, F>::
   HaveDeletables<true, EVALUATE_FUNC>::have_deletable(Bucket* bucket,
                                                       EVALUATE_FUNC& eval_f,
                                                       Bucket* prefetch_bucket)
@@ -281,9 +266,9 @@
   return false;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <bool b, typename EVALUATE_FUNC>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+inline bool ConcurrentHashTable<CONFIG, F>::
   HaveDeletables<b, EVALUATE_FUNC>::have_deletable(Bucket* bucket,
                                                    EVALUATE_FUNC& eval_f,
                                                    Bucket* preb)
@@ -297,8 +282,8 @@
 }
 
 // ConcurrentHashTable
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   write_synchonize_on_visible_epoch(Thread* thread)
 {
   assert(_resize_lock_owner == thread, "Re-size lock not held");
@@ -314,8 +299,8 @@
   GlobalCounter::write_synchronize();
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   try_resize_lock(Thread* locker)
 {
   if (_resize_lock->try_lock()) {
@@ -333,8 +318,8 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   lock_resize_lock(Thread* locker)
 {
   size_t i = 0;
@@ -358,8 +343,8 @@
   _invisible_epoch = 0;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   unlock_resize_lock(Thread* locker)
 {
   _invisible_epoch = 0;
@@ -368,8 +353,8 @@
   _resize_lock->unlock();
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   free_nodes()
 {
   // We assume we are not MT during freeing.
@@ -384,25 +369,25 @@
   }
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline typename ConcurrentHashTable<VALUE, CONFIG, F>::InternalTable*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline typename ConcurrentHashTable<CONFIG, F>::InternalTable*
+ConcurrentHashTable<CONFIG, F>::
   get_table() const
 {
   return OrderAccess::load_acquire(&_table);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline typename ConcurrentHashTable<VALUE, CONFIG, F>::InternalTable*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline typename ConcurrentHashTable<CONFIG, F>::InternalTable*
+ConcurrentHashTable<CONFIG, F>::
   get_new_table() const
 {
   return OrderAccess::load_acquire(&_new_table);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline typename ConcurrentHashTable<VALUE, CONFIG, F>::InternalTable*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline typename ConcurrentHashTable<CONFIG, F>::InternalTable*
+ConcurrentHashTable<CONFIG, F>::
   set_table_from_new()
 {
   InternalTable* old_table = _table;
@@ -416,8 +401,8 @@
   return old_table;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   internal_grow_range(Thread* thread, size_t start, size_t stop)
 {
   assert(stop <= _table->_size, "Outside backing array");
@@ -456,9 +441,9 @@
   }
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename LOOKUP_FUNC, typename DELETE_FUNC>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+inline bool ConcurrentHashTable<CONFIG, F>::
   internal_remove(Thread* thread, LOOKUP_FUNC& lookup_f, DELETE_FUNC& delete_f)
 {
   Bucket* bucket = get_bucket_locked(thread, lookup_f.get_hash());
@@ -489,9 +474,9 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename EVALUATE_FUNC, typename DELETE_FUNC>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+inline void ConcurrentHashTable<CONFIG, F>::
   do_bulk_delete_locked_for(Thread* thread, size_t start_idx, size_t stop_idx,
                             EVALUATE_FUNC& eval_f, DELETE_FUNC& del_f, bool is_mt)
 {
@@ -542,9 +527,9 @@
   GlobalCounter::critical_section_end(thread, cs_context);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename LOOKUP_FUNC>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+inline void ConcurrentHashTable<CONFIG, F>::
   delete_in_bucket(Thread* thread, Bucket* bucket, LOOKUP_FUNC& lookup_f)
 {
   assert(bucket->is_locked(), "Must be locked.");
@@ -579,9 +564,9 @@
   }
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline typename ConcurrentHashTable<VALUE, CONFIG, F>::Bucket*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline typename ConcurrentHashTable<CONFIG, F>::Bucket*
+ConcurrentHashTable<CONFIG, F>::
   get_bucket(uintx hash) const
 {
   InternalTable* table = get_table();
@@ -593,9 +578,9 @@
   return bucket;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline typename ConcurrentHashTable<VALUE, CONFIG, F>::Bucket*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline typename ConcurrentHashTable<CONFIG, F>::Bucket*
+ConcurrentHashTable<CONFIG, F>::
   get_bucket_locked(Thread* thread, const uintx hash)
 {
   Bucket* bucket;
@@ -624,10 +609,10 @@
 }
 
 // Always called within critical section
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename LOOKUP_FUNC>
-typename ConcurrentHashTable<VALUE, CONFIG, F>::Node*
-ConcurrentHashTable<VALUE, CONFIG, F>::
+typename ConcurrentHashTable<CONFIG, F>::Node*
+ConcurrentHashTable<CONFIG, F>::
   get_node(const Bucket* const bucket, LOOKUP_FUNC& lookup_f,
            bool* have_dead, size_t* loops) const
 {
@@ -650,8 +635,8 @@
   return node;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   unzip_bucket(Thread* thread, InternalTable* old_table,
                InternalTable* new_table, size_t even_index, size_t odd_index)
 {
@@ -708,8 +693,8 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   internal_shrink_prolog(Thread* thread, size_t log2_size)
 {
   if (!try_resize_lock(thread)) {
@@ -725,8 +710,8 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   internal_shrink_epilog(Thread* thread)
 {
   assert(_resize_lock_owner == thread, "Re-size lock not held");
@@ -744,8 +729,8 @@
   delete old_table;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   internal_shrink_range(Thread* thread, size_t start, size_t stop)
 {
   // The state is also copied here.
@@ -781,8 +766,8 @@
   }
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   internal_shrink(Thread* thread, size_t log2_size)
 {
   if (!internal_shrink_prolog(thread, log2_size)) {
@@ -796,8 +781,8 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   internal_grow_prolog(Thread* thread, size_t log2_size)
 {
   // This double checking of _size_limit_reached/is_max_size_reached()
@@ -825,8 +810,8 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline void ConcurrentHashTable<CONFIG, F>::
   internal_grow_epilog(Thread* thread)
 {
   assert(_resize_lock_owner == thread, "Should be locked");
@@ -843,8 +828,8 @@
   delete old_table;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   internal_grow(Thread* thread, size_t log2_size)
 {
   if (!internal_grow_prolog(thread, log2_size)) {
@@ -859,9 +844,9 @@
 }
 
 // Always called within critical section
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename LOOKUP_FUNC>
-inline VALUE* ConcurrentHashTable<VALUE, CONFIG, F>::
+inline typename CONFIG::Value* ConcurrentHashTable<CONFIG, F>::
   internal_get(Thread* thread, LOOKUP_FUNC& lookup_f, bool* grow_hint)
 {
   bool clean = false;
@@ -880,9 +865,9 @@
   return ret;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename LOOKUP_FUNC>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+inline bool ConcurrentHashTable<CONFIG, F>::
   internal_insert(Thread* thread, LOOKUP_FUNC& lookup_f, const VALUE& value,
                   bool* grow_hint, bool* clean_hint)
 {
@@ -945,9 +930,9 @@
   return ret;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename FUNC>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+inline bool ConcurrentHashTable<CONFIG, F>::
   visit_nodes(Bucket* bucket, FUNC& visitor_f)
 {
   Node* current_node = bucket->first();
@@ -960,9 +945,9 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename FUNC>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+inline void ConcurrentHashTable<CONFIG, F>::
   do_scan_locked(Thread* thread, FUNC& scan_f)
 {
   assert(_resize_lock_owner == thread, "Re-size lock not held");
@@ -977,9 +962,9 @@
   } /* ends critical section */
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename EVALUATE_FUNC>
-inline size_t ConcurrentHashTable<VALUE, CONFIG, F>::
+inline size_t ConcurrentHashTable<CONFIG, F>::
   delete_check_nodes(Bucket* bucket, EVALUATE_FUNC& eval_f,
                      size_t num_del, Node** ndel)
 {
@@ -1004,8 +989,8 @@
 }
 
 // Constructor
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline ConcurrentHashTable<CONFIG, F>::
   ConcurrentHashTable(size_t log2size, size_t log2size_limit, size_t grow_hint)
     : _new_table(NULL), _log2_size_limit(log2size_limit),
        _log2_start_size(log2size), _grow_hint(grow_hint),
@@ -1021,8 +1006,8 @@
   _size_limit_reached = _table->_log2_size == _log2_size_limit;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline ConcurrentHashTable<CONFIG, F>::
   ~ConcurrentHashTable()
 {
   delete _resize_lock;
@@ -1030,16 +1015,16 @@
   delete _table;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline size_t ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline size_t ConcurrentHashTable<CONFIG, F>::
   get_size_log2(Thread* thread)
 {
   ScopedCS cs(thread, this);
   return _table->_log2_size;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   shrink(Thread* thread, size_t size_limit_log2)
 {
   size_t tmp = size_limit_log2 == 0 ? _log2_start_size : size_limit_log2;
@@ -1047,17 +1032,17 @@
   return ret;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   grow(Thread* thread, size_t size_limit_log2)
 {
   size_t tmp = size_limit_log2 == 0 ? _log2_size_limit : size_limit_log2;
   return internal_grow(thread, tmp);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename LOOKUP_FUNC, typename FOUND_FUNC>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+inline bool ConcurrentHashTable<CONFIG, F>::
   get(Thread* thread, LOOKUP_FUNC& lookup_f, FOUND_FUNC& found_f, bool* grow_hint)
 {
   bool ret = false;
@@ -1070,8 +1055,8 @@
   return ret;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
   unsafe_insert(const VALUE& value) {
   bool dead_hash = false;
   size_t hash = CONFIG::get_hash(value, &dead_hash);
@@ -1090,9 +1075,9 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename SCAN_FUNC>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+inline bool ConcurrentHashTable<CONFIG, F>::
   try_scan(Thread* thread, SCAN_FUNC& scan_f)
 {
   if (!try_resize_lock(thread)) {
@@ -1103,9 +1088,9 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename SCAN_FUNC>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+inline void ConcurrentHashTable<CONFIG, F>::
   do_scan(Thread* thread, SCAN_FUNC& scan_f)
 {
   assert(!SafepointSynchronize::is_at_safepoint(),
@@ -1117,9 +1102,9 @@
   assert(_resize_lock_owner != thread, "Re-size lock held");
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename SCAN_FUNC>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+inline void ConcurrentHashTable<CONFIG, F>::
   do_safepoint_scan(SCAN_FUNC& scan_f)
 {
   // We only allow this method to be used during a safepoint.
@@ -1160,9 +1145,9 @@
   }
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename EVALUATE_FUNC, typename DELETE_FUNC>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+inline bool ConcurrentHashTable<CONFIG, F>::
   try_bulk_delete(Thread* thread, EVALUATE_FUNC& eval_f, DELETE_FUNC& del_f)
 {
   if (!try_resize_lock(thread)) {
@@ -1174,9 +1159,9 @@
   return true;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename EVALUATE_FUNC, typename DELETE_FUNC>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+inline void ConcurrentHashTable<CONFIG, F>::
   bulk_delete(Thread* thread, EVALUATE_FUNC& eval_f, DELETE_FUNC& del_f)
 {
   assert(!SafepointSynchronize::is_at_safepoint(),
@@ -1186,9 +1171,9 @@
   unlock_resize_lock(thread);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename VALUE_SIZE_FUNC>
-inline TableStatistics ConcurrentHashTable<VALUE, CONFIG, F>::
+inline TableStatistics ConcurrentHashTable<CONFIG, F>::
   statistics_calculate(Thread* thread, VALUE_SIZE_FUNC& vs_f)
 {
   NumberSeq summary;
@@ -1213,9 +1198,9 @@
   return TableStatistics(_stats_rate, summary, literal_bytes, sizeof(Bucket), sizeof(Node));
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename VALUE_SIZE_FUNC>
-inline TableStatistics ConcurrentHashTable<VALUE, CONFIG, F>::
+inline TableStatistics ConcurrentHashTable<CONFIG, F>::
   statistics_get(Thread* thread, VALUE_SIZE_FUNC& vs_f, TableStatistics old)
 {
   if (!try_resize_lock(thread)) {
@@ -1228,9 +1213,9 @@
   return ts;
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
+template <typename CONFIG, MEMFLAGS F>
 template <typename VALUE_SIZE_FUNC>
-inline void ConcurrentHashTable<VALUE, CONFIG, F>::
+inline void ConcurrentHashTable<CONFIG, F>::
   statistics_to(Thread* thread, VALUE_SIZE_FUNC& vs_f,
                 outputStream* st, const char* table_name)
 {
@@ -1245,9 +1230,9 @@
   ts.print(st, table_name);
 }
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
-  try_move_nodes_to(Thread* thread, ConcurrentHashTable<VALUE, CONFIG, F>* to_cht)
+template <typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<CONFIG, F>::
+  try_move_nodes_to(Thread* thread, ConcurrentHashTable<CONFIG, F>* to_cht)
 {
   if (!try_resize_lock(thread)) {
     return false;
--- a/src/hotspot/share/utilities/concurrentHashTableTasks.inline.hpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/hotspot/share/utilities/concurrentHashTableTasks.inline.hpp	Tue Jun 25 15:24:41 2019 +0530
@@ -32,10 +32,10 @@
 // operations, which they are serialized with each other.
 
 // Base class for pause and/or parallel bulk operations.
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-class ConcurrentHashTable<VALUE, CONFIG, F>::BucketsOperation {
+template <typename CONFIG, MEMFLAGS F>
+class ConcurrentHashTable<CONFIG, F>::BucketsOperation {
  protected:
-  ConcurrentHashTable<VALUE, CONFIG, F>* _cht;
+  ConcurrentHashTable<CONFIG, F>* _cht;
 
   // Default size of _task_size_log2
   static const size_t DEFAULT_TASK_SIZE_LOG2 = 12;
@@ -47,7 +47,7 @@
   size_t _size_log2;      // Table size.
   bool   _is_mt;
 
-  BucketsOperation(ConcurrentHashTable<VALUE, CONFIG, F>* cht, bool is_mt = false)
+  BucketsOperation(ConcurrentHashTable<CONFIG, F>* cht, bool is_mt = false)
     : _cht(cht), _next_to_claim(0), _task_size_log2(DEFAULT_TASK_SIZE_LOG2),
     _stop_task(0), _size_log2(0), _is_mt(is_mt) {}
 
@@ -116,12 +116,12 @@
 };
 
 // For doing pausable/parallel bulk delete.
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-class ConcurrentHashTable<VALUE, CONFIG, F>::BulkDeleteTask :
+template <typename CONFIG, MEMFLAGS F>
+class ConcurrentHashTable<CONFIG, F>::BulkDeleteTask :
   public BucketsOperation
 {
  public:
-  BulkDeleteTask(ConcurrentHashTable<VALUE, CONFIG, F>* cht, bool is_mt = false)
+  BulkDeleteTask(ConcurrentHashTable<CONFIG, F>* cht, bool is_mt = false)
     : BucketsOperation(cht, is_mt) {
   }
   // Before start prepare must be called.
@@ -160,12 +160,12 @@
   }
 };
 
-template <typename VALUE, typename CONFIG, MEMFLAGS F>
-class ConcurrentHashTable<VALUE, CONFIG, F>::GrowTask :
+template <typename CONFIG, MEMFLAGS F>
+class ConcurrentHashTable<CONFIG, F>::GrowTask :
   public BucketsOperation
 {
  public:
-  GrowTask(ConcurrentHashTable<VALUE, CONFIG, F>* cht) : BucketsOperation(cht) {
+  GrowTask(ConcurrentHashTable<CONFIG, F>* cht) : BucketsOperation(cht) {
   }
   // Before start prepare must be called.
   bool prepare(Thread* thread) {
--- a/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/java.base/share/classes/java/nio/MappedByteBuffer.java	Tue Jun 25 15:24:41 2019 +0530
@@ -235,8 +235,11 @@
      * is made.
      *
      * <p> If this buffer was not mapped in read/write mode ({@link
-     * java.nio.channels.FileChannel.MapMode#READ_WRITE}) then invoking this
-     * method has no effect. </p>
+     * java.nio.channels.FileChannel.MapMode#READ_WRITE}) then
+     * invoking this method may have no effect. In particular, the
+     * method has no effect for buffers mapped in read-only or private
+     * mapping modes. This method may or may not have an effect for
+     * implementation-specific mapping modes. </p>
      *
      * @return  This buffer
      */
@@ -271,7 +274,10 @@
      *
      * <p> If this buffer was not mapped in read/write mode ({@link
      * java.nio.channels.FileChannel.MapMode#READ_WRITE}) then
-     * invoking this method has no effect. </p>
+     * invoking this method may have no effect. In particular, the
+     * method has no effect for buffers mapped in read-only or private
+     * mapping modes. This method may or may not have an effect for
+     * implementation-specific mapping modes. </p>
      *
      * @param index
      *        The index of the first byte in the buffer region that is
--- a/src/java.base/share/classes/sun/security/util/CurveDB.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/java.base/share/classes/sun/security/util/CurveDB.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2016, 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
@@ -68,7 +68,7 @@
             return spec;
         }
 
-        return nameMap.get(name);
+        return nameMap.get(name.toLowerCase(Locale.ENGLISH));
     }
 
     // Return EC parameters for the specified field size. If there are known
@@ -151,7 +151,8 @@
 
         String[] commonNames = nameSplitPattern.split(name);
         for (String commonName : commonNames) {
-            if (nameMap.put(commonName.trim(), params) != null) {
+            if (nameMap.put(commonName.trim().toLowerCase(Locale.ENGLISH),
+                            params) != null) {
                 throw new RuntimeException("Duplication name: " + commonName);
             }
         }
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Tue Jun 25 15:24:41 2019 +0530
@@ -771,6 +771,12 @@
     native HotSpotResolvedJavaType getComponentType(HotSpotResolvedObjectTypeImpl type);
 
     /**
+     * Get the array class for {@code type}. This can't be done symbolically since anonymous types
+     * can't be looked up by name.
+     */
+    native HotSpotResolvedObjectTypeImpl getArrayType(HotSpotResolvedJavaType type);
+
+    /**
      * Forces initialization of {@code type}.
      */
     native void ensureInitialized(HotSpotResolvedObjectTypeImpl type);
@@ -978,4 +984,9 @@
      * @see HotSpotJVMCIRuntime#detachCurrentThread()
      */
     native void detachCurrentThread();
+
+    /**
+     * @see HotSpotJVMCIRuntime#exitHotSpot(int)
+     */
+    native void callSystemExit(int status);
 }
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompilationRequest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotCompilationRequest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -87,4 +87,9 @@
     public int getId() {
         return id;
     }
+
+    @Override
+    public String toString() {
+        return id + ":" + super.toString();
+    }
 }
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Jun 25 15:24:41 2019 +0530
@@ -223,6 +223,8 @@
         // so that -XX:+JVMCIPrintProperties shows the option.
         InitTimer(Boolean.class, false, "Specifies if initialization timing is enabled."),
         PrintConfig(Boolean.class, false, "Prints VM configuration available via JVMCI."),
+        AuditHandles(Boolean.class, false, "Record stack trace along with scoped foreign object reference wrappers " +
+                "to debug issue with a wrapper being used after its scope has closed."),
         TraceMethodDataFilter(String.class, null,
                 "Enables tracing of profiling info when read by JVMCI.",
                 "Empty value: trace all methods",
@@ -687,9 +689,11 @@
         return Collections.unmodifiableMap(backends);
     }
 
+    @SuppressWarnings("try")
     @VMEntryPoint
     private HotSpotCompilationRequestResult compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long compileState, int id) {
-        CompilationRequestResult result = getCompiler().compileMethod(new HotSpotCompilationRequest(method, entryBCI, compileState, id));
+        HotSpotCompilationRequest request = new HotSpotCompilationRequest(method, entryBCI, compileState, id);
+        CompilationRequestResult result = getCompiler().compileMethod(request);
         assert result != null : "compileMethod must always return something";
         HotSpotCompilationRequestResult hsResult;
         if (result instanceof HotSpotCompilationRequestResult) {
@@ -704,7 +708,6 @@
                 hsResult = HotSpotCompilationRequestResult.success(inlinedBytecodes);
             }
         }
-
         return hsResult;
     }
 
@@ -1032,4 +1035,14 @@
     public void excludeFromJVMCICompilation(Module...modules) {
         this.excludeFromJVMCICompilation = modules.clone();
     }
+
+    /**
+     * Calls {@link System#exit(int)} in HotSpot's runtime.
+     */
+    public void exitHotSpot(int status) {
+        if (!IS_IN_NATIVE_IMAGE) {
+            System.exit(status);
+        }
+        compilerToVm.callSystemExit(status);
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotObjectConstantScope.java	Tue Jun 25 15:24:41 2019 +0530
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.vm.ci.hotspot;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+import jdk.vm.ci.services.Services;
+
+/**
+ * A mechanism for limiting the lifetime of a foreign object reference encapsulated in a
+ * {@link HotSpotObjectConstant}.
+ *
+ * A {@link HotSpotObjectConstant} allocated in a {@linkplain #openLocalScope local} scope will have
+ * its reference to any foreign object cleared when the scope {@linkplain #close() closes}. This
+ * allows the foreign memory manager to reclaim the foreign object (once there are no other strong
+ * references to it).
+ *
+ * {@link HotSpotObjectConstantScope}s have no impact on {@link HotSpotObjectConstant}s that do not
+ * encapsulate a foreign object reference.
+ *
+ * The object returned by {@link #enterGlobalScope()} or {@link #openLocalScope(Object)} should
+ * always be used in a try-with-resources statement. Failure to close a scope will almost certainly
+ * result in foreign objects being leaked.
+ */
+public final class HotSpotObjectConstantScope implements AutoCloseable {
+    static final ThreadLocal<HotSpotObjectConstantScope> CURRENT = new ThreadLocal<>();
+
+    private final HotSpotObjectConstantScope parent;
+    private List<IndirectHotSpotObjectConstantImpl> foreignObjects;
+
+    /**
+     * An object whose {@link Object#toString()} value describes a non-global scope. This is
+     * {@code null} iff this is a global scope.
+     */
+    final Object localScopeDescription;
+
+    /**
+     * Opens a local scope that upon closing, will release foreign object references encapsulated by
+     * {@link HotSpotObjectConstant}s created in the scope.
+     *
+     * @param description an non-null object whose {@link Object#toString()} value describes the
+     *            scope being opened
+     * @return {@code null} if the current runtime does not support remote object references
+     */
+    public static HotSpotObjectConstantScope openLocalScope(Object description) {
+        return Services.IS_IN_NATIVE_IMAGE ? new HotSpotObjectConstantScope(Objects.requireNonNull(description)) : null;
+    }
+
+    /**
+     * Enters the global scope. This is useful to escape a local scope for execution that will
+     * create foreign object references that need to outlive the local scope.
+     *
+     * Foreign object references encapsulated by {@link HotSpotObjectConstant}s created in the
+     * global scope are only subject to reclamation once the {@link HotSpotObjectConstant} wrapper
+     * dies.
+     *
+     * @return {@code null} if the current runtime does not support remote object references or if
+     *         this thread is currently in the global scope
+     */
+    public static HotSpotObjectConstantScope enterGlobalScope() {
+        return Services.IS_IN_NATIVE_IMAGE && CURRENT.get() != null ? new HotSpotObjectConstantScope(null) : null;
+    }
+
+    private HotSpotObjectConstantScope(Object localScopeDescription) {
+        this.parent = CURRENT.get();
+        CURRENT.set(this);
+        this.localScopeDescription = localScopeDescription;
+    }
+
+    /**
+     * Determines if this scope is global.
+     */
+    boolean isGlobal() {
+        return localScopeDescription == null;
+    }
+
+    void add(IndirectHotSpotObjectConstantImpl obj) {
+        assert !isGlobal();
+        if (foreignObjects == null) {
+            foreignObjects = new ArrayList<>();
+        }
+        foreignObjects.add(obj);
+    }
+
+    @VMEntryPoint
+    @Override
+    public void close() {
+        if (CURRENT.get() != this) {
+            throw new IllegalStateException("Cannot close non-active scope");
+        }
+        if (foreignObjects != null) {
+            for (IndirectHotSpotObjectConstantImpl obj : foreignObjects) {
+                obj.clear(localScopeDescription);
+            }
+            foreignObjects = null;
+        }
+        CURRENT.set(parent);
+    }
+}
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaType.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedJavaType.java	Tue Jun 25 15:24:41 2019 +0530
@@ -22,11 +22,15 @@
  */
 package jdk.vm.ci.hotspot;
 
+import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
+
 import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.ResolvedJavaType;
 
 public abstract class HotSpotResolvedJavaType extends HotSpotJavaType implements ResolvedJavaType {
 
+    HotSpotResolvedObjectTypeImpl arrayOfType;
+
     HotSpotResolvedJavaType(String name) {
         super(name);
     }
@@ -40,4 +44,12 @@
     }
 
     abstract JavaConstant getJavaMirror();
+
+    @Override
+    public HotSpotResolvedObjectType getArrayClass() {
+        if (arrayOfType == null) {
+            arrayOfType = runtime().compilerToVm.getArrayType(this);
+        }
+        return arrayOfType;
+    }
 }
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl.java	Tue Jun 25 15:24:41 2019 +0530
@@ -72,7 +72,6 @@
     private volatile HotSpotResolvedJavaField[] instanceFields;
     private volatile HotSpotResolvedObjectTypeImpl[] interfaces;
     private HotSpotConstantPool constantPool;
-    private HotSpotResolvedObjectType arrayOfType;
     private final JavaConstant mirror;
     private HotSpotResolvedObjectTypeImpl superClass;
 
@@ -103,17 +102,24 @@
      * Creates the JVMCI mirror for a {@link Class} object.
      *
      * <b>NOTE</b>: Creating an instance of this class does not install the mirror for the
-     * {@link Class} type. {@link #fromMetaspace} instead.
+     * {@link Class} type.
      * </p>
      *
      * @param metadataPointer the Klass* to create the mirror for
      */
+    @SuppressWarnings("try")
     HotSpotResolvedObjectTypeImpl(long metadataPointer, String name) {
         super(name);
+        assert metadataPointer != 0;
         this.metadataPointer = metadataPointer;
-        this.mirror = runtime().compilerToVm.getJavaMirror(this);
-        assert metadataPointer != 0;
-        assert getName().charAt(0) != '[' || isArray() : getName();
+
+        // The mirror object must be in the global scope since
+        // this object will be cached in HotSpotJVMCIRuntime.resolvedJavaTypes
+        // and live across more than one compilation.
+        try (HotSpotObjectConstantScope global = HotSpotObjectConstantScope.enterGlobalScope()) {
+            this.mirror = runtime().compilerToVm.getJavaMirror(this);
+            assert getName().charAt(0) != '[' || isArray() : getName();
+        }
     }
 
     /**
@@ -147,18 +153,6 @@
     }
 
     @Override
-    public HotSpotResolvedObjectType getArrayClass() {
-        if (arrayOfType == null) {
-            try {
-                arrayOfType = (HotSpotResolvedObjectType) runtime().compilerToVm.lookupType("[" + getName(), this, true);
-            } catch (ClassNotFoundException e) {
-                throw new JVMCIError(e);
-            }
-        }
-        return arrayOfType;
-    }
-
-    @Override
     public ResolvedJavaType getComponentType() {
         return runtime().compilerToVm.getComponentType(this);
     }
@@ -580,6 +574,11 @@
             return null;
         }
 
+        if (resolvedMethod.canBeStaticallyBound()) {
+            // No assumptions are required.
+            return new AssumptionResult<>(resolvedMethod);
+        }
+
         ResolvedJavaMethod result = resolvedMethod.uniqueConcreteMethod(this);
         if (result != null) {
             return new AssumptionResult<>(result, new ConcreteMethod(method, this, result));
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedPrimitiveType.java	Tue Jun 25 15:24:41 2019 +0530
@@ -46,7 +46,6 @@
     @NativeImageReinitialize static HotSpotResolvedPrimitiveType[] primitives;
 
     private JavaKind kind;
-    private HotSpotResolvedObjectType arrayClass;
     HotSpotObjectConstantImpl mirror;
 
     /**
@@ -87,14 +86,7 @@
         if (kind == JavaKind.Void) {
             return null;
         }
-        if (arrayClass == null) {
-            try {
-                arrayClass = (HotSpotResolvedObjectType) runtime().compilerToVm.lookupType("[" + kind.getTypeChar(), null, true);
-            } catch (ClassNotFoundException e) {
-                throw new JVMCIError(e);
-            }
-        }
-        return arrayClass;
+        return super.getArrayClass();
     }
 
     @Override
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/IndirectHotSpotObjectConstantImpl.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/IndirectHotSpotObjectConstantImpl.java	Tue Jun 25 15:24:41 2019 +0530
@@ -24,17 +24,52 @@
 
 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.runtime;
 
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+
+import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
 import jdk.vm.ci.meta.JavaConstant;
 
+/**
+ * Encapsulates a JNI reference to an object in the HotSpot heap.
+ *
+ * {@link IndirectHotSpotObjectConstantImpl} objects are only allocated in the shared library heap.
+ *
+ * @see HotSpotObjectConstantScope
+ */
 final class IndirectHotSpotObjectConstantImpl extends HotSpotObjectConstantImpl {
     /**
-     * An object handle in {@code JVMCI::_jvmci_handles}.
+     * An object handle in {@code JVMCI::_object_handles}.
      */
-    final long objectHandle;
+    private long objectHandle;
+
+    /**
+     * Lazily computed hash code.
+     */
     private int hashCode;
 
     final IndirectHotSpotObjectConstantImpl base;
 
+    private static class Audit {
+        final Object scope;
+        final long handle;
+        final Throwable origin;
+
+        Audit(Object scope, long handle, Throwable origin) {
+            this.scope = scope;
+            this.handle = handle;
+            this.origin = origin;
+        }
+    }
+
+    /**
+     * Details useful to audit a scoped handle used after its creating scope closes. Set to an
+     * {@link Audit} object if {@link HotSpotJVMCIRuntime.Option#AuditHandles} is true otherwise to
+     * {@link HotSpotObjectConstantScope#localScopeDescription}.
+     */
+    private Object rawAudit;
+
+    @SuppressWarnings("serial")
     @VMEntryPoint
     private IndirectHotSpotObjectConstantImpl(long objectHandle, boolean compressed, boolean skipRegister) {
         super(compressed);
@@ -42,7 +77,20 @@
         this.objectHandle = objectHandle;
         this.base = null;
         if (!skipRegister) {
-            HandleCleaner.create(this, objectHandle);
+            HotSpotObjectConstantScope scope = HotSpotObjectConstantScope.CURRENT.get();
+            if (scope != null && !scope.isGlobal()) {
+                scope.add(this);
+                if (HotSpotJVMCIRuntime.Option.AuditHandles.getBoolean()) {
+                    rawAudit = new Audit(scope.localScopeDescription, objectHandle, new Throwable() {
+                        @Override
+                        public String toString() {
+                            return "Created " + objectHandle;
+                        }
+                    });
+                }
+            } else {
+                HandleCleaner.create(this, objectHandle);
+            }
         }
     }
 
@@ -50,12 +98,59 @@
         super(compressed);
         // This is a variant of an original object that only varies in compress vs uncompressed.
         // Instead of creating a new handle, reference that object and objectHandle.
-        this.objectHandle = base.objectHandle;
-        // There should only be on level of indirection to the base object.
+        this.objectHandle = base.getHandle();
+        // There should only be one level of indirection to the base object.
         assert base.base == null || base.base.base == null;
         this.base = base.base != null ? base.base : base;
     }
 
+    long getHandle() {
+        checkHandle();
+        return objectHandle;
+    }
+
+    private void checkHandle() {
+        if (objectHandle == 0L) {
+            String message;
+            if (rawAudit instanceof Audit) {
+                Audit audit = (Audit) rawAudit;
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                PrintStream ps = new PrintStream(baos);
+                ps.println("Foreign object reference " + audit.handle + " created in scope '" + audit.scope + "' is no longer valid. Origin: {");
+                audit.origin.printStackTrace(ps);
+                ps.print('}');
+                ps.flush();
+                message = baos.toString();
+            } else {
+                message = "Foreign object reference created in scope '" + rawAudit + "' is no longer valid. " +
+                                "Set property " + Option.AuditHandles.getPropertyName() + "=true to show origin of invalid foreign references.";
+            }
+            throw new NullPointerException(message);
+        }
+    }
+
+    boolean isValid() {
+        return objectHandle != 0L;
+    }
+
+    @Override
+    public HotSpotResolvedObjectType getType() {
+        checkHandle();
+        return super.getType();
+    }
+
+    /**
+     * Clears the foreign object reference.
+     */
+    void clear(Object scopeDescription) {
+        checkHandle();
+        CompilerToVM.compilerToVM().deleteGlobalHandle(objectHandle);
+        if (rawAudit == null) {
+            rawAudit = scopeDescription;
+        }
+        objectHandle = 0L;
+    }
+
     @Override
     public JavaConstant compress() {
         assert !compressed;
@@ -70,6 +165,7 @@
 
     @Override
     public int getIdentityHashCode() {
+        checkHandle();
         int hash = hashCode;
         if (hash == 0) {
             hash = runtime().compilerToVm.getIdentityHashCode(this);
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/SharedLibraryJVMCIReflection.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/SharedLibraryJVMCIReflection.java	Tue Jun 25 15:24:41 2019 +0530
@@ -114,7 +114,7 @@
         }
         IndirectHotSpotObjectConstantImpl indirectX = (IndirectHotSpotObjectConstantImpl) x;
         IndirectHotSpotObjectConstantImpl indirectY = (IndirectHotSpotObjectConstantImpl) y;
-        return runtime().compilerToVm.equals(x, indirectX.objectHandle, y, indirectY.objectHandle);
+        return runtime().compilerToVm.equals(x, indirectX.getHandle(), y, indirectY.getHandle());
     }
 
     @Override
@@ -288,6 +288,10 @@
             DirectHotSpotObjectConstantImpl direct = (DirectHotSpotObjectConstantImpl) object;
             return "CompilerObject<" + direct.object.getClass().getName() + ">";
         }
+        IndirectHotSpotObjectConstantImpl indirect = (IndirectHotSpotObjectConstantImpl) object;
+        if (!indirect.isValid()) {
+            return "Instance<null>";
+        }
         return "Instance<" + object.getType().toJavaName() + ">";
     }
 
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MetaUtil.java	Tue Jun 25 15:24:41 2019 +0530
@@ -87,6 +87,29 @@
     }
 
     /**
+     * Classes for lambdas can have {@code /} characters that are not package separators. These are
+     * distinguished by being followed by a character that is not a
+     * {@link Character#isJavaIdentifierStart(char)} (e.g.,
+     * "jdk.vm.ci.runtime.test.TypeUniverse$$Lambda$1/869601985").
+     */
+    private static String replacePackageSeparatorsWithDot(String name) {
+        int length = name.length();
+        int i = 0;
+        StringBuilder buf = new StringBuilder(length);
+        while (i < length - 1) {
+            char ch = name.charAt(i);
+            if (ch == '/' && Character.isJavaIdentifierStart(name.charAt(i + 1))) {
+                buf.append('.');
+            } else {
+                buf.append(ch);
+            }
+            i++;
+        }
+        buf.append(name.charAt(length - 1));
+        return buf.toString();
+    }
+
+    /**
      * Converts a type name in internal form to an external form.
      *
      * @param name the internal name to convert
@@ -99,7 +122,7 @@
     public static String internalNameToJava(String name, boolean qualified, boolean classForNameCompatible) {
         switch (name.charAt(0)) {
             case 'L': {
-                String result = name.substring(1, name.length() - 1).replace('/', '.');
+                String result = replacePackageSeparatorsWithDot(name.substring(1, name.length() - 1));
                 if (!qualified) {
                     final int lastDot = result.lastIndexOf('.');
                     if (lastDot != -1) {
@@ -109,7 +132,7 @@
                 return result;
             }
             case '[':
-                return classForNameCompatible ? name.replace('/', '.') : internalNameToJava(name.substring(1), qualified, classForNameCompatible) + "[]";
+                return classForNameCompatible ? replacePackageSeparatorsWithDot(name) : internalNameToJava(name.substring(1), qualified, classForNameCompatible) + "[]";
             default:
                 if (name.length() != 1) {
                     throw new IllegalArgumentException("Illegal internal name: " + name);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Tue Jun 25 15:24:41 2019 +0530
@@ -43,7 +43,6 @@
     altColor,
     annotations,
     arguments,
-    bar,
     block,
     blockList,
     bottomNav,
@@ -69,7 +68,6 @@
     descfrmTypeLabel,
     details,
     detail,
-    docSummary,
     emphasizedPhrase,
     exceptions,
     externalLink,
@@ -80,18 +78,11 @@
     helpSection,
     hierarchy,
     horizontal,
-    footer,
     implementationLabel,
-    indexContainer,
-    indexNav,
     inheritance,
     inheritedList,
     interfaceName,
-    leftContainer,
-    leftTop,
-    leftBottom,
     legalCopy,
-    mainContainer,
     memberDetails,
     memberName,
     memberNameLabel,
@@ -99,7 +90,6 @@
     memberSignature,
     memberSummary,
     methodDetails,
-    methodSignature,
     methodSummary,
     modifiers,
     moduleDescription,
@@ -128,8 +118,6 @@
     requiresSummary,
     returnLabel,
     returnType,
-    rightContainer,
-    rightIframe,
     rowColor,
     searchTagLink,
     searchTagResult,
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Tue Jun 25 15:24:41 2019 +0530
@@ -121,13 +121,6 @@
 .legalCopy {
     margin-left:.5em;
 }
-.bar a, .bar a:link, .bar a:visited, .bar a:active {
-    color:#FFFFFF;
-    text-decoration:none;
-}
-.bar a:hover, .bar a:focus {
-    color:#bb7a2a;
-}
 .tab {
     background-color:#0066FF;
     color:#ffffff;
@@ -138,14 +131,6 @@
 /*
  * Styles for navigation bar.
  */
-.bar {
-    background-color:#4D7A97;
-    color:#FFFFFF;
-    padding:.8em .5em .4em .8em;
-    height:auto;/*height:1.8em;*/
-    font-size:11px;
-    margin:0;
-}
 .navPadding {
     padding-top: 107px;
 }
@@ -246,29 +231,11 @@
 /*
  * Styles for page header and footer.
  */
-.header, .footer {
+.header {
     clear:both;
     margin:0 20px;
     padding:5px 0 0 0;
 }
-.indexNav {
-    position:relative;
-    font-size:12px;
-    background-color:#dee3e9;
-}
-.indexNav ul {
-    margin-top:0;
-    padding:5px;
-}
-.indexNav ul li {
-    display:inline;
-    list-style-type:none;
-    padding-right:10px;
-    text-transform:uppercase;
-}
-.indexNav h1 {
-    font-size:13px;
-}
 .title {
     color:#2c4557;
     margin:10px 0;
@@ -280,9 +247,6 @@
     margin:0 0 15px 0;
     padding:0;
 }
-.footer ul {
-    margin:20px 0 5px 0;
-}
 .header ul li, .footer ul li {
     list-style:none;
     font-size:13px;
@@ -315,23 +279,6 @@
     padding:10px 20px;
     position:relative;
 }
-.indexContainer {
-    margin:10px;
-    position:relative;
-    font-size:12px;
-}
-.indexContainer h2 {
-    font-size:13px;
-    padding:0 0 3px 0;
-}
-.indexContainer ul {
-    margin:0;
-    padding:0;
-}
-.indexContainer ul li {
-    list-style:none;
-    padding-top:2px;
-}
 .contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
     font-size:12px;
     font-weight:bold;
@@ -558,9 +505,6 @@
     margin:0;
     padding:10px 0;
 }
-.docSummary {
-    padding:0;
-}
 div.block {
     font-size:14px;
     font-family:'DejaVu Serif', Georgia, "Times New Roman", Times, serif;
@@ -632,61 +576,6 @@
     font-style:normal;
 }
 /*
- * Styles for IFRAME.
- */
-.mainContainer {
-    margin:0 auto;
-    padding:0;
-    height:100%;
-    width:100%;
-    position:fixed;
-    top:0;
-    left:0;
-}
-.leftContainer {
-    height:100%;
-    position:fixed;
-    width:320px;
-}
-.leftTop {
-    position:relative;
-    float:left;
-    width:315px;
-    top:0;
-    left:0;
-    height:30%;
-    border-right:6px solid #ccc;
-    border-bottom:6px solid #ccc;
-}
-.leftBottom {
-    position:relative;
-    float:left;
-    width:315px;
-    bottom:0;
-    left:0;
-    height:70%;
-    border-right:6px solid #ccc;
-    border-top:1px solid #000;
-}
-.rightContainer {
-    position:absolute;
-    left:320px;
-    top:0;
-    bottom:0;
-    height:100%;
-    right:0;
-    border-left:1px solid #000;
-}
-.rightIframe {
-    margin:0;
-    padding:0;
-    height:100%;
-    right:30px;
-    width:100%;
-    overflow:visible;
-    margin-bottom:30px;
-}
-/*
  * Styles specific to HTML5 elements.
  */
 main, nav, header, footer, section {
@@ -772,9 +661,6 @@
     margin: -100px 0 0 100px;
     z-index: 1;
 }
-.methodSignature {
-    white-space:normal;
-}
 .inheritedList {
     margin: 10px 0 10px 0;
 }
--- a/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.jdi/share/classes/com/sun/jdi/doc-files/signature.html	Tue Jun 25 15:24:41 2019 +0530
@@ -40,7 +40,6 @@
 </STYLE>
 </HEAD>
 <BODY style="background-color:white">
-<div role="main">
 <h1>JDI Type Signatures</h1>
 <Table Border="0">
 <caption style="font-size:x-large"><b>JDI Type Signatures</b></caption>
@@ -74,6 +73,5 @@
 </pre>has the following type signature:
 <pre>    (ILjava/lang/String;[I)J
 </pre>
-</div>
 </BODY>
 </HTML>
--- a/src/jdk.zipfs/share/classes/module-info.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/src/jdk.zipfs/share/classes/module-info.java	Tue Jun 25 15:24:41 2019 +0530
@@ -60,7 +60,7 @@
  *
  * <tbody>
  * <tr>
- *   <td scope="row">create</td>
+ *   <th scope="row">create</th>
  *   <td>java.lang.String</td>
  *   <td>false</td>
  *   <td>
@@ -69,7 +69,7 @@
  *   </td>
  * </tr>
  * <tr>
- *   <td scope="row">encoding</td>
+ *   <th scope="row">encoding</th>
  *   <td>java.lang.String</td>
  *   <td>UTF-8</td>
  *   <td>
--- a/test/hotspot/gtest/utilities/test_concurrentHashtable.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/hotspot/gtest/utilities/test_concurrentHashtable.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -36,24 +36,22 @@
 // Amusingly as long as they do not assert they are mt-safe.
 #define SIZE_32 5
 
-struct Pointer;
-
-typedef ConcurrentHashTable<uintptr_t, Pointer, mtInternal> SimpleTestTable;
-typedef ConcurrentHashTable<uintptr_t, Pointer, mtInternal>::MultiGetHandle SimpleTestGetHandle;
-
-// Simplest working CRPT implementation for the hash-table.
-struct Pointer : public SimpleTestTable::BaseConfig {
-  static uintx get_hash(const uintptr_t& value, bool* dead_hash) {
+struct Pointer : public AllStatic {
+  typedef uintptr_t Value;
+  static uintx get_hash(const Value& value, bool* dead_hash) {
     return (uintx)value;
   }
-  static void* allocate_node(size_t size, const uintptr_t& value) {
+  static void* allocate_node(size_t size, const Value& value) {
     return ::malloc(size);
   }
-  static void free_node(void* memory, const uintptr_t& value) {
+  static void free_node(void* memory, const Value& value) {
     ::free(memory);
   }
 };
 
+typedef ConcurrentHashTable<Pointer, mtInternal> SimpleTestTable;
+typedef ConcurrentHashTable<Pointer, mtInternal>::MultiGetHandle SimpleTestGetHandle;
+
 struct SimpleTestLookup {
   uintptr_t _val;
   SimpleTestLookup(uintptr_t val) : _val(val) {}
@@ -414,18 +412,23 @@
 
 //#############################################################################################
 
-class TestInterface;
-
-typedef ConcurrentHashTable<uintptr_t, TestInterface, mtInternal> TestTable;
-typedef ConcurrentHashTable<uintptr_t, TestInterface, mtInternal>::MultiGetHandle TestGetHandle;
-
-class TestInterface : public TestTable::BaseConfig {
+class TestInterface : public AllStatic {
 public:
-  static uintx get_hash(const uintptr_t& value, bool* dead_hash) {
+  typedef uintptr_t Value;
+  static uintx get_hash(const Value& value, bool* dead_hash) {
     return (uintx)(value + 18446744073709551557ul) * 18446744073709551557ul;
   }
+  static void* allocate_node(size_t size, const Value& value) {
+    return AllocateHeap(size, mtInternal);
+  }
+  static void free_node(void* memory, const Value& value) {
+    FreeHeap(memory);
+  }
 };
 
+typedef ConcurrentHashTable<TestInterface, mtInternal> TestTable;
+typedef ConcurrentHashTable<TestInterface, mtInternal>::MultiGetHandle TestGetHandle;
+
 struct TestLookup {
   uintptr_t _val;
   TestLookup(uintptr_t val) : _val(val) {}
--- a/test/hotspot/jtreg/compiler/codecache/stress/UnexpectedDeoptimizationAllTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * 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 UnexpectedDeoptimizationAllTest
- * @key stress
- * @summary stressing code cache by forcing unexpected deoptimizations of all methods
- * @library /test/lib /
- * @modules java.base/jdk.internal.misc
- *          java.management
- *
- * @build sun.hotspot.WhiteBox compiler.codecache.stress.Helper compiler.codecache.stress.TestCaseImpl
- * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- *                                sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI -XX:-DeoptimizeRandom
- *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
- *                   -XX:-SegmentedCodeCache
- *                   compiler.codecache.stress.UnexpectedDeoptimizationAllTest
- * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
- *                   -XX:+WhiteBoxAPI -XX:-DeoptimizeRandom
- *                   -XX:CompileCommand=dontinline,compiler.codecache.stress.Helper$TestCase::method
- *                   -XX:+SegmentedCodeCache
- *                   compiler.codecache.stress.UnexpectedDeoptimizationAllTest
- */
-
-package compiler.codecache.stress;
-
-public class UnexpectedDeoptimizationAllTest implements Runnable {
-
-    public static void main(String[] args) {
-        new CodeCacheStressRunner(new UnexpectedDeoptimizationAllTest()).runTest();
-    }
-
-    @Override
-    public void run() {
-        Helper.WHITE_BOX.deoptimizeAll();
-        try {
-            Thread.sleep(10);
-        } catch (Exception e) {
-        }
-    }
-
-}
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestMetaAccessProvider.java	Tue Jun 25 15:24:41 2019 +0530
@@ -68,16 +68,22 @@
                     metaAccess.encodeDeoptActionAndReason(DEOPT_ACTION, DEOPT_REASON, DEBUG_IDS[3]).asInt()
     };
 
+    private static boolean isUnsafeAnoymous(ResolvedJavaType type) {
+        return type.getHostClass() != null;
+    }
+
     @Test
     public void lookupJavaTypeTest() {
         for (Class<?> c : classes) {
             ResolvedJavaType type = metaAccess.lookupJavaType(c);
             assertNotNull(c.toString(), type);
-            assertEquals(c.toString(), type.getName(), toInternalName(c.getName()));
-            assertEquals(c.toString(), type.getName(), toInternalName(type.toJavaName()));
-            assertEquals(c.toString(), c.getName(), type.toClassName());
-            if (!type.isArray()) {
-                assertEquals(c.toString(), c.getName(), type.toJavaName());
+            if (!isUnsafeAnoymous(type)) {
+                assertEquals(c.toString(), type.getName(), toInternalName(c.getName()));
+                assertEquals(c.toString(), type.getName(), toInternalName(type.toJavaName()));
+                assertEquals(c.toString(), c.getName(), type.toClassName());
+                if (!type.isArray()) {
+                    assertEquals(c.toString(), c.getName(), type.toJavaName());
+                }
             }
         }
     }
@@ -92,7 +98,9 @@
         ResolvedJavaType[] result = metaAccess.lookupJavaTypes(classes.toArray(new Class<?>[classes.size()]));
         int counter = 0;
         for (Class<?> aClass : classes) {
-            assertEquals("Unexpected javaType: " + result[counter] + " while expecting of class: " + aClass, result[counter].toClassName(), aClass.getName());
+            if (!isUnsafeAnoymous(result[counter])) {
+                assertEquals("Unexpected javaType: " + result[counter] + " while expecting of class: " + aClass, result[counter].toClassName(), aClass.getName());
+            }
             counter++;
         }
     }
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Tue Jun 25 15:24:41 2019 +0530
@@ -161,7 +161,11 @@
         for (Class<?> c : classes) {
             ResolvedJavaType type = metaAccess.lookupJavaType(c);
             ResolvedJavaType host = type.getHostClass();
-            assertNull(host);
+            if (!type.equals(predicateType)) {
+                assertNull(host);
+            } else {
+                assertNotNull(host);
+            }
         }
 
         class LocalClass {}
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TypeUniverse.java	Tue Jun 25 15:24:41 2019 +0530
@@ -51,6 +51,7 @@
 import java.util.Queue;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.function.Predicate;
 import java.util.stream.Collectors;
 
 import static java.lang.reflect.Modifier.isFinal;
@@ -68,6 +69,7 @@
     public static final ConstantReflectionProvider constantReflection = JVMCI.getRuntime().getHostJVMCIBackend().getConstantReflection();
     public static final Collection<Class<?>> classes = new HashSet<>();
     public static final Set<ResolvedJavaType> javaTypes;
+    public static final ResolvedJavaType predicateType;
     public static final Map<Class<?>, Class<?>> arrayClasses = new HashMap<>();
 
     private static List<ConstantValue> constants;
@@ -116,6 +118,9 @@
         for (Class<?> c : initialClasses) {
             addClass(c);
         }
+        Predicate<String> predicate = s -> s.length() == 1;
+        addClass(predicate.getClass());
+        predicateType = metaAccess.lookupJavaType(predicate.getClass());
 
         javaTypes = Collections.unmodifiableSet(classes.stream().map(c -> metaAccess.lookupJavaType(c)).collect(Collectors.toSet()));
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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,6 +24,7 @@
 package nsk.jvmti.scenarios.contention.TC04;
 
 import java.io.PrintStream;
+import java.util.concurrent.*;
 
 import nsk.share.*;
 import nsk.share.jvmti.*;
@@ -31,6 +32,7 @@
 public class tc04t001 extends DebugeeClass {
 
     final static int THREADS_LIMIT = 2;
+    final static CountDownLatch threadsDoneSignal = new CountDownLatch(THREADS_LIMIT);
 
     // run test from command line
     public static void main(String argv[]) {
@@ -68,8 +70,8 @@
         }
 
         try {
-            for (int i = 0; i < THREADS_LIMIT; i++) {
-                threads[i].join(timeout/THREADS_LIMIT);
+            if (!threadsDoneSignal.await(timeout, TimeUnit.MILLISECONDS)) {
+                throw new RuntimeException("Threads timeout");
             }
         } catch (InterruptedException e) {
             throw new Failure(e);
@@ -122,6 +124,8 @@
 */
 
     private int id;
+    private static volatile int lastEnterEventsCount;
+    private static native   int enterEventsCount();
 
     public tc04t001Thread(int i) {
         super("Debuggee Thread " + i);
@@ -131,11 +135,13 @@
     public synchronized void run() {
         for (int i = 0; i < INCREMENT_LIMIT; i++) {
             flicker.waitFor(id);
+            lastEnterEventsCount = enterEventsCount();
             increment(id);
             try {
                 wait(1);
             } catch (InterruptedException e) {}
         }
+        tc04t001.threadsDoneSignal.countDown();
     }
 
     static synchronized void increment(int i) {
@@ -144,10 +150,24 @@
 */
         flicker.unlock(i);
         int temp = value;
-        for (int j = 0; j < DELAY; j++) ;
-        try {
-            sleep(500);
-        } catch (InterruptedException e) {}
+
+        // Wait in a loop for a MonitorContendedEnter event.
+        // Timeout is: 20ms * DELAY.
+        for (int j = 0; j < DELAY; j++) {
+            try {
+                sleep(20);
+            } catch (InterruptedException e) {}
+
+            if (enterEventsCount() > lastEnterEventsCount) {
+                break; // Got an expected MonitorContendedEnter event
+            }
+        }
+        System.out.println("Thread-" + i + ": increment event: " + enterEventsCount());
+
+        if (enterEventsCount() == lastEnterEventsCount) {
+            String msg = "Timeout in waiting for a MonitorContendedEnter event";
+            throw new RuntimeException(msg);
+        }
         value = temp + 1;
     }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -344,6 +344,11 @@
     return JNI_OK;
 }
 
+JNIEXPORT jint JNICALL
+Java_nsk_jvmti_scenarios_contention_TC04_tc04t001Thread_enterEventsCount(JNIEnv* jni, jclass klass) {
+    return enterEventsCount;
+}
+
 /* ========================================================================== */
 
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java	Tue Jun 25 15:24:41 2019 +0530
@@ -57,10 +57,10 @@
             }
 
             /**
-                         * Returns true if the given error message matches
-                         * one of expected strings.
-                         */
-                        public boolean accept(String errorMessage) {
+             * Returns true if the given error message matches
+             * one of expected strings.
+             */
+            public boolean accept(String errorMessage) {
                 if (expectedStrings == null || expectedStrings.length == 0 || errorMessage == null) {
                     return true;
                 }
@@ -81,7 +81,6 @@
         public static final StringWriter preloadStringWriter = new StringWriter(1);
         public static final PrintWriter preloadPrintWriter = new PrintWriter(preloadStringWriter);
         public static final Throwable preloadThrowable = new Throwable("preload");
-        public static final StackTraceElement[] preloadStackTraceElement = preloadThrowable.getStackTrace();
 
         private GarbageUtils() {
         }
@@ -215,8 +214,6 @@
         public static int eatMemory(ExecutionController stresser, GarbageProducer gp, long initialFactor, long minMemoryChunk, long factor, OOM_TYPE type) {
                 int numberOfOOMEs = 0;
                 try {
-                        StringWriter sw = new StringWriter(10000);
-                        PrintWriter pw = new PrintWriter(sw);
                         byte[] someMemory = new byte[200000]; //200 Kb
                         try {
                                 Runtime runtime = Runtime.getRuntime();
@@ -243,13 +240,11 @@
                                         } catch (OutOfMemoryError e) {
                                             someMemory = null;
                                             if (type != OOM_TYPE.ANY) {
-                                                e.printStackTrace(pw);
-                                                pw.close();
-                                                if (type.accept(sw.toString())) {
+                                                if (type.accept(e.toString())) {
                                                     numberOfOOMEs++;
                                                 } else {
                                                     // Trying to catch situation when Java generates OOM different type that test trying to catch
-                                                    throw new TestBug("Test throw OOM of unexpected type." + sw.toString());
+                                                    throw new TestBug("Test throw OOM of unexpected type." + e.toString());
                                                 }
                                             } else {
                                                numberOfOOMEs++;
@@ -265,13 +260,11 @@
                         } catch (OutOfMemoryError e) {
                             someMemory = null;
                             if (type != OOM_TYPE.ANY) {
-                                e.printStackTrace(pw);
-                                pw.close();
-                                if (type.accept(sw.toString())) {
+                                if (type.accept(e.toString())) {
                                     numberOfOOMEs++;
                                 } else {
                                     // Trying to catch situation when Java generates OOM different type that test trying to catch
-                                    throw new TestBug("Test throw OOM of unexpected type." + sw.toString());
+                                    throw new TestBug("Test throw OOM of unexpected type." + e.toString());
                                 }
                             } else {
                                 numberOfOOMEs++;
--- a/test/jdk/ProblemList-graal.txt	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/ProblemList-graal.txt	Tue Jun 25 15:24:41 2019 +0530
@@ -27,48 +27,8 @@
 #
 #############################################################################
 
-java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java           8185139   generic-all
-java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java            8185139   generic-all
-java/lang/invoke/InvokeDynamicPrintArgs.java                            8185139   generic-all
-java/lang/invoke/MethodHandleConstants.java                             8185139   generic-all
-java/lang/ProcessBuilder/Basic.java#id0                                 8185139   generic-all
-java/lang/ProcessBuilder/Basic.java#id1                                 8185139   generic-all
-java/lang/ProcessBuilder/SecurityManagerClinit.java                     8185139   generic-all
-java/lang/ProcessHandle/PermissionTest.java                             8185139   generic-all
-java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java         8185139   generic-all
-java/lang/StackWalker/CallerSensitiveMethod/Main.java                   8185139   generic-all
-java/lang/StackWalker/GetCallerClassTest.java                           8185139   generic-all
-java/lang/String/concat/WithSecurityManager.java                        8185139   generic-all
-java/lang/System/Logger/custom/CustomLoggerTest.java                    8185139   generic-all
-java/lang/System/Logger/default/DefaultLoggerTest.java                  8185139   generic-all
-java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java                        8185139   generic-all
-java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java                  8185139   generic-all
-java/lang/System/LoggerFinder/internal/BaseDefaultLoggerFinderTest/BaseDefaultLoggerFinderTest.java 8185139   generic-all
-java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java               8185139   generic-all
-java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java           8185139   generic-all
-java/lang/System/LoggerFinder/internal/BootstrapLogger/BootstrapLoggerTest.java                     8185139   generic-all
-java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java                       8185139   generic-all
-java/lang/System/LoggerFinder/internal/LoggerFinderLoaderTest/LoggerFinderLoaderTest.java           8185139   generic-all
-java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java       8185139   generic-all
-java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java              8185139   generic-all
-java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java          8185139   generic-all
-java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java      8185139   generic-all
-java/util/concurrent/atomic/AtomicUpdaters.java                         8185139   generic-all
-java/util/concurrent/Executors/PrivilegedCallables.java                 8185139   generic-all
-java/util/logging/FileHandlerPath.java                                  8185139   generic-all
-java/util/logging/FileHandlerPatternExceptions.java                     8185139   generic-all
-java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java   8185139   generic-all
-java/util/logging/LogManagerAppContextDeadlock.java                     8185139   generic-all
-java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java    8185139   generic-all
-java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java         8185139   generic-all
-java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java   8185139   generic-all
-java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigWithInputStreamTest.java   8185139   generic-all
-java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java   8185139   generic-all
-java/util/logging/RootLogger/RootLevelInConfigFile.java                 8185139   generic-all
-java/util/logging/TestAppletLoggerContext.java                          8185139   generic-all
-java/util/logging/TestConfigurationListeners.java                       8185139   generic-all
-java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java 8185139 generic-all
-java/util/logging/FileHandlerLongLimit.java                             8185139   generic-all
+java/lang/String/concat/WithSecurityManager.java                        8207267   generic-all
+java/lang/System/LoggerFinder/LoggerFinderAPI/LoggerFinderAPI.java      8207267   generic-all
 
 java/util/concurrent/tck/JSR166TestCase.java                            8187486   generic-all
 
--- a/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -166,6 +166,7 @@
     // Policy for the test...
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
@@ -187,7 +188,7 @@
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get().get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -385,6 +385,8 @@
     // Policy for the test...
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowAll;
@@ -420,6 +422,7 @@
                     return true;
                 }
             }
+            if (DEFAULT_POLICY.implies(domain, permission)) return true;
             return false;
         }
 
--- a/test/jdk/java/lang/ProcessBuilder/Basic.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/ProcessBuilder/Basic.java	Tue Jun 25 15:24:41 2019 +0530
@@ -2602,6 +2602,8 @@
     // A Policy class designed to make permissions fiddling very easy.
     //----------------------------------------------------------------
     private static class Policy extends java.security.Policy {
+        static final java.security.Policy DEFAULT_POLICY = java.security.Policy.getPolicy();
+
         private Permissions perms;
 
         public void setPermissions(Permission...permissions) {
@@ -2621,7 +2623,7 @@
         }
 
         public boolean implies(ProtectionDomain pd, Permission p) {
-            return perms.implies(p);
+            return perms.implies(p) || DEFAULT_POLICY.implies(pd, p);
         }
 
         public void refresh() {}
--- a/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/ProcessBuilder/SecurityManagerClinit.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,6 @@
 /*
  * Copyright 2010 Google Inc.  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
@@ -35,17 +36,19 @@
 import java.security.*;
 
 public class SecurityManagerClinit {
-    private static class Policy extends java.security.Policy {
+    private static class SimplePolicy extends Policy {
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         private Permissions perms;
 
-        public Policy(Permission... permissions) {
+        public SimplePolicy(Permission... permissions) {
             perms = new Permissions();
             for (Permission permission : permissions)
                 perms.add(permission);
         }
 
         public boolean implies(ProtectionDomain pd, Permission p) {
-            return perms.implies(p);
+            return perms.implies(p) || DEFAULT_POLICY.implies(pd, p);
         }
     }
 
@@ -54,8 +57,8 @@
             System.getProperty("java.home") +
             File.separator + "bin" + File.separator + "java";
 
-        final Policy policy =
-            new Policy
+        final SimplePolicy policy =
+            new SimplePolicy
             (new FilePermission("<<ALL FILES>>", "execute"),
              new RuntimePermission("setSecurityManager"));
         Policy.setPolicy(policy);
--- a/test/jdk/java/lang/ProcessHandle/PermissionTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/ProcessHandle/PermissionTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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
@@ -178,6 +178,9 @@
 }
 
 class TestPolicy extends Policy {
+
+    static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
     private final PermissionCollection permissions = new Permissions();
 
     public TestPolicy() {
@@ -222,6 +225,6 @@
 
     @Override
     public boolean implies(ProtectionDomain domain, Permission perm) {
-        return permissions.implies(perm);
+        return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm);
     }
 }
--- a/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/Logger/custom/CustomLoggerTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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
@@ -704,6 +704,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         static final RuntimePermission LOGGERFINDER_PERMISSION =
                 new RuntimePermission("loggerFinder");
         final Permissions permissions;
@@ -736,7 +738,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return permissions().implies(permission);
+            return permissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/Logger/default/DefaultLoggerTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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
@@ -884,6 +884,9 @@
     }
 
     public static class SimplePolicy extends Policy {
+
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         static final RuntimePermission LOGGERFINDER_PERMISSION =
                 new RuntimePermission("loggerFinder");
         final Permissions permissions;
@@ -908,7 +911,7 @@
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get().get()) return allPermissions.implies(permission);
             if (allowControl.get().get()) return controlPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/LoggerFinder/BaseLoggerFinderTest/BaseLoggerFinderTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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
@@ -652,6 +652,8 @@
         final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION;
         final static RuntimePermission ACCESS = new RuntimePermission("accessClassInPackage.jdk.internal.logger");
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final ThreadLocal<AtomicBoolean> allowControl;
         final ThreadLocal<AtomicBoolean> allowAccess;
@@ -678,7 +680,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return getPermissions().implies(permission);
+            return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/LoggerFinder/DefaultLoggerFinderTest/DefaultLoggerFinderTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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
@@ -842,6 +842,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions withControlPermissions;
         final Permissions allPermissions;
@@ -865,7 +867,7 @@
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get().get()) return allPermissions.implies(permission);
             if (allowControl.get().get()) return withControlPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BaseLoggerBridgeTest/BaseLoggerBridgeTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -981,6 +981,8 @@
         final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger");
         final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging");
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowControl;
@@ -1019,7 +1021,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return getPermissions().implies(permission);
+            return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/BasePlatformLoggerTest/BasePlatformLoggerTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -663,6 +663,8 @@
         final static RuntimePermission CONTROL = LOGGERFINDER_PERMISSION;
         final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging");
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowControl;
@@ -700,7 +702,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return getPermissions().implies(permission);
+            return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/LoggerBridgeTest/LoggerBridgeTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -1026,6 +1026,8 @@
         final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger");
         final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging");
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowControl;
@@ -1064,7 +1066,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return getPermissions().implies(permission);
+            return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/LoggerFinder/internal/PlatformLoggerBridgeTest/PlatformLoggerBridgeTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -805,6 +805,8 @@
         final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger");
         final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging");
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowControl;
@@ -843,7 +845,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return getPermissions().implies(permission);
+            return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultLoggerBridgeTest/DefaultLoggerBridgeTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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
@@ -801,6 +801,8 @@
         final static RuntimePermission ACCESS_LOGGER = new RuntimePermission("accessClassInPackage.jdk.internal.logger");
         final static RuntimePermission ACCESS_LOGGING = new RuntimePermission("accessClassInPackage.sun.util.logging");
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowControl;
@@ -839,7 +841,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return getPermissions().implies(permission);
+            return getPermissions().implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/System/LoggerFinder/jdk/DefaultPlatformLoggerTest/DefaultPlatformLoggerTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, 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
@@ -499,6 +499,8 @@
         public static final RuntimePermission LOGGERFINDER_PERMISSION =
                 new RuntimePermission("loggerFinder");
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions withControlPermissions;
         final Permissions allPermissions;
@@ -522,7 +524,7 @@
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get().get()) return allPermissions.implies(permission);
             if (allowControl.get().get()) return withControlPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/invoke/InvokeDynamicPrintArgs.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, 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
@@ -234,6 +234,8 @@
     }
 
     static class TestPolicy extends Policy {
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final PermissionCollection permissions = new Permissions();
         TestPolicy() {
             permissions.add(new java.io.FilePermission("<<ALL FILES>>", "read"));
@@ -247,7 +249,7 @@
         }
 
         public boolean implies(ProtectionDomain domain, Permission perm) {
-            return permissions.implies(perm);
+            return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm);
         }
     }
 }
--- a/test/jdk/java/lang/invoke/MethodHandleConstants.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/lang/invoke/MethodHandleConstants.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, 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,6 +169,8 @@
     }
 
     static class TestPolicy extends Policy {
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final PermissionCollection permissions = new Permissions();
         TestPolicy() {
             permissions.add(new java.io.FilePermission("<<ALL FILES>>", "read"));
@@ -182,7 +184,7 @@
         }
 
         public boolean implies(ProtectionDomain domain, Permission perm) {
-            return permissions.implies(perm);
+            return permissions.implies(perm) || DEFAULT_POLICY.implies(domain, perm);
         }
     }
 }
--- a/test/jdk/java/net/MulticastSocket/Promiscuous.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/net/MulticastSocket/Promiscuous.java	Tue Jun 25 15:24:41 2019 +0530
@@ -22,7 +22,7 @@
  *
 
 /* @test
- * @bug 8014499
+ * @bug 8014499 8219804
  * @library /test/lib
  * @summary Test for interference when two sockets are bound to the same
  *          port but joined to different multicast groups
@@ -44,11 +44,20 @@
         throws IOException
     {
         byte[] ba = new byte[100];
-        DatagramPacket p = new DatagramPacket(ba, ba.length);
+        DatagramPacket p;
         try {
-            mc.receive(p);
-            int recvId = Integer.parseInt(
-                    new String(p.getData(), 0, p.getLength(), "UTF-8"));
+            String data = null;
+            while (true) {
+                p = new DatagramPacket(ba, ba.length);
+                mc.receive(p);
+                data = new String(p.getData(), 0, p.getLength(), "UTF-8");
+                if (data.length() > UUID.length() && data.startsWith(UUID)) {
+                    data = data.substring(UUID.length());
+                    break;
+                }
+                logUnexpected(p);
+            }
+            int recvId = Integer.parseInt(data);
             if (datagramExpected) {
                 if (recvId != id)
                     throw new RuntimeException("Unexpected id, got " + recvId
@@ -67,6 +76,20 @@
         }
     }
 
+    static void logUnexpected(DatagramPacket p) {
+        byte[] ba = p.getData();
+        System.out.printf("Unexpected packet: length: %d. First three bytes: %d, %d, %d\n",
+                          p.getLength(), ba[0], ba[1], ba[2]);
+    }
+
+    static final String UUID; // process-id : currentTimeMillis
+
+    static {
+        String s1 = Long.toString(ProcessHandle.current().pid());
+        String s2 = Long.toString(System.currentTimeMillis());
+        UUID = "<" + s1 + s2 + ">";
+    }
+
     static void test(InetAddress group1, InetAddress group2)
         throws IOException
     {
@@ -79,7 +102,7 @@
             mc1.setSoTimeout(TIMEOUT);
             mc2.setSoTimeout(TIMEOUT);
             int nextId = id;
-            byte[] msg = Integer.toString(nextId).getBytes("UTF-8");
+            byte[] msg = (UUID + Integer.toString(nextId)).getBytes("UTF-8");
             DatagramPacket p = new DatagramPacket(msg, msg.length);
             p.setAddress(group1);
             p.setPort(port);
@@ -97,7 +120,7 @@
             receive(mc2, false, 0);
 
             nextId = ++id;
-            msg = Integer.toString(nextId).getBytes("UTF-8");
+            msg = (UUID + Integer.toString(nextId)).getBytes("UTF-8");
             p = new DatagramPacket(msg, msg.length);
             p.setAddress(group2);
             p.setPort(port);
@@ -116,7 +139,6 @@
 
     public static void main(String args[]) throws IOException {
         IPSupport.throwSkippedExceptionIfNonOperational();
-
         String os = System.getProperty("os.name");
 
         // Requires IP_MULTICAST_ALL on Linux (new since 2.6.31) so skip
@@ -133,8 +155,8 @@
         }
 
         // multicast groups used for the test
-        InetAddress ip4Group1 = InetAddress.getByName("224.7.8.9");
-        InetAddress ip4Group2 = InetAddress.getByName("225.4.5.6");
+        InetAddress ip4Group1 = InetAddress.getByName("224.0.0.120");
+        InetAddress ip4Group2 = InetAddress.getByName("224.0.0.121");
 
         test(ip4Group1, ip4Group2);
     }
--- a/test/jdk/java/security/KeyAgreement/KeyAgreementTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/security/KeyAgreement/KeyAgreementTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -23,7 +23,7 @@
 
  /*
  * @test
- * @bug 4936763 8184359 8205476
+ * @bug 4936763 8184359 8205476 8226307
  * @summary KeyAgreement Test with all supported algorithms from JCE.
  *          Arguments order <KeyExchangeAlgorithm> <KeyGenAlgorithm> <Provider>
  *          It removes com/sun/crypto/provider/KeyAgreement/DHGenSecretKey.java
@@ -73,7 +73,7 @@
                 // SEC2 prime curves
                 "secp112r1", "secp112r2", "secp128r1", "secp128r2", "secp160k1",
                 "secp160r1", "secp192k1", "secp192r1", "secp224k1", "secp224r1",
-                "secp256k1", "secp256r1", "secp384r1", "secp521r1",
+                "secp256k1", "secp256r1", "secp384r1", "secp521r1", "SECP521R1",
                 // ANSI X9.62 prime curves
                 "X9.62 prime192v2", "X9.62 prime192v3", "X9.62 prime239v1",
                 "X9.62 prime239v2", "X9.62 prime239v3",
@@ -87,7 +87,7 @@
                 "X9.62 c2tnb239v1", "X9.62 c2tnb239v2", "X9.62 c2tnb239v3",
                 "X9.62 c2tnb359v1", "X9.62 c2tnb431r1"
         ),
-        XDH("X25519", "X448"),
+        XDH("X25519", "X448", "x25519"),
         // There is no curve for DiffieHellman
         DiffieHellman(new String[]{});
 
--- a/test/jdk/java/security/Policy/Dynamic/DynamicPolicy.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/security/Policy/Dynamic/DynamicPolicy.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 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
@@ -28,6 +28,7 @@
 
 public class DynamicPolicy extends Policy{
 
+    static final Policy DEFAULT_POLICY = Policy.getPolicy(); // do this early before setPolicy is called
     static int refresher = 0;
 
 
@@ -48,7 +49,7 @@
     }
 
     public boolean implies(ProtectionDomain pd, Permission p) {
-        return getPermissions(pd).implies(p);
+        return getPermissions(pd).implies(p) || DEFAULT_POLICY.implies(pd, p);
     }
 
     public PermissionCollection getPermissions(ProtectionDomain pd) {
--- a/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/concurrent/Executors/PrivilegedCallables.java	Tue Jun 25 15:24:41 2019 +0530
@@ -70,6 +70,8 @@
     // A Policy class designed to make permissions fiddling very easy.
     //----------------------------------------------------------------
     static class Policy extends java.security.Policy {
+        static final java.security.Policy DEFAULT_POLICY = java.security.Policy.getPolicy();
+
         private Permissions perms;
 
         public void setPermissions(Permission...permissions) {
@@ -89,7 +91,7 @@
         }
 
         public boolean implies(ProtectionDomain pd, Permission p) {
-            return perms.implies(p);
+            return perms.implies(p) || DEFAULT_POLICY.implies(pd, p);
         }
 
         public void refresh() {}
--- a/test/jdk/java/util/logging/FileHandlerLongLimit.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/FileHandlerLongLimit.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2015, 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
@@ -471,6 +471,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final AtomicBoolean allowAll;
@@ -490,7 +492,7 @@
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/util/logging/FileHandlerPath.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/FileHandlerPath.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -270,6 +270,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final AtomicBoolean allowAll;
@@ -297,7 +299,7 @@
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/util/logging/FileHandlerPatternExceptions.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/FileHandlerPatternExceptions.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -294,6 +294,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final AtomicBoolean allowAll;
@@ -313,7 +315,7 @@
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -480,6 +480,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final AtomicBoolean allowAll;
@@ -499,7 +501,7 @@
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexResetUpdate.java	Tue Jun 25 15:24:41 2019 +0530
@@ -522,6 +522,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
@@ -541,7 +543,7 @@
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get().get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/HandlersOnComplexUpdate.java	Tue Jun 25 15:24:41 2019 +0530
@@ -521,6 +521,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
@@ -540,7 +542,7 @@
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get().get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/LogManager/Configuration/updateConfiguration/SimpleUpdateConfigurationTest.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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
@@ -652,6 +652,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions basic;
         final Permissions control;
         final Permissions all;
@@ -690,7 +692,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return getPermissions(domain).implies(permission);
+            return getPermissions(domain).implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         public PermissionCollection permissions() {
--- a/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/LogManager/RootLogger/setLevel/TestRootLoggerLevel.java	Tue Jun 25 15:24:41 2019 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,6 +119,9 @@
      }
 
     private static final class SimplePolicy extends Policy {
+
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         private final Permissions perms;
 
         private static final Permissions permissions(Permission... perms) {
@@ -141,7 +144,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return perms.implies(permission);
+            return perms.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
     }
--- a/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/LogManagerAppContextDeadlock.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -340,6 +340,8 @@
     // Policy for the test...
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         final Permissions allPermissions;
         final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
@@ -360,7 +362,7 @@
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
             if (allowAll.get().get()) return allPermissions.implies(permission);
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/RootLogger/RootLevelInConfigFile.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -176,6 +176,8 @@
 
     static final class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final PermissionCollection perms = new Permissions();
         public SimplePolicy(String configFile) {
             perms.add(new LoggingPermission("control", null));
@@ -187,7 +189,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return perms.implies(permission);
+            return perms.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
     }
 
--- a/test/jdk/java/util/logging/TestAppletLoggerContext.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/TestAppletLoggerContext.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -72,6 +72,9 @@
 
     // Avoids the hassle of dealing with files and system props...
     static class SimplePolicy extends Policy {
+
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         private final Permissions perms;
         public SimplePolicy(Permission... permissions) {
             perms = new Permissions();
@@ -89,7 +92,7 @@
         }
         @Override
         public boolean implies(ProtectionDomain pd, Permission p) {
-           return perms.implies(p);
+           return perms.implies(p) || DEFAULT_POLICY.implies(pd, p);
         }
     }
 
--- a/test/jdk/java/util/logging/TestConfigurationListeners.java	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/jdk/java/util/logging/TestConfigurationListeners.java	Tue Jun 25 15:24:41 2019 +0530
@@ -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
@@ -458,6 +458,8 @@
 
     public static class SimplePolicy extends Policy {
 
+        static final Policy DEFAULT_POLICY = Policy.getPolicy();
+
         final Permissions permissions;
         public SimplePolicy(TestCase test) {
             permissions = new Permissions();
@@ -472,7 +474,7 @@
 
         @Override
         public boolean implies(ProtectionDomain domain, Permission permission) {
-            return permissions.implies(permission);
+            return permissions.implies(permission) || DEFAULT_POLICY.implies(domain, permission);
         }
 
         @Override
--- a/test/jdk/sun/security/tools/keytool/PSS.java	Mon Jun 24 15:18:05 2019 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 8215694 8222987
- * @summary keytool cannot generate RSASSA-PSS certificates
- * @library /test/lib
- * @modules java.base/sun.security.util
- *          java.base/sun.security.x509
- * @requires os.family != "solaris"
- * @run main PSS
- */
-
-// This test is excluded from Solaris because the 8192-bit RSA key pair
-// generator is extremely slow there.
-
-import jdk.test.lib.Asserts;
-import jdk.test.lib.SecurityTools;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.security.DerUtils;
-import sun.security.util.ObjectIdentifier;
-import sun.security.x509.AlgorithmId;
-
-import java.io.File;
-import java.security.KeyStore;
-import java.security.cert.X509Certificate;
-
-public class PSS {
-
-    public static void main(String[] args) throws Exception {
-
-        genkeypair("p", "-keyalg RSASSA-PSS -sigalg RSASSA-PSS")
-                .shouldHaveExitValue(0);
-
-        genkeypair("a", "-keyalg RSA -sigalg RSASSA-PSS -keysize 2048")
-                .shouldHaveExitValue(0);
-
-        genkeypair("b", "-keyalg RSA -sigalg RSASSA-PSS -keysize 4096")
-                .shouldHaveExitValue(0);
-
-        genkeypair("c", "-keyalg RSA -sigalg RSASSA-PSS -keysize 8192")
-                .shouldHaveExitValue(0);
-
-        KeyStore ks = KeyStore.getInstance(
-                new File("ks"), "changeit".toCharArray());
-
-        check((X509Certificate)ks.getCertificate("p"), "RSASSA-PSS",
-                AlgorithmId.SHA256_oid);
-
-        check((X509Certificate)ks.getCertificate("a"), "RSA",
-                AlgorithmId.SHA256_oid);
-
-        check((X509Certificate)ks.getCertificate("b"), "RSA",
-                AlgorithmId.SHA384_oid);
-
-        check((X509Certificate)ks.getCertificate("c"), "RSA",
-                AlgorithmId.SHA512_oid);
-
-        // More commands
-        kt("-certreq -alias p -sigalg RSASSA-PSS -file p.req")
-                .shouldHaveExitValue(0);
-
-        kt("-gencert -alias a -sigalg RSASSA-PSS -infile p.req -outfile p.cert")
-                .shouldHaveExitValue(0);
-
-        kt("-importcert -alias p -file p.cert")
-                .shouldHaveExitValue(0);
-
-        kt("-selfcert -alias p -sigalg RSASSA-PSS")
-                .shouldHaveExitValue(0);
-    }
-
-    static OutputAnalyzer genkeypair(String alias, String options)
-            throws Exception {
-        return kt("-genkeypair -alias " + alias
-                + " -dname CN=" + alias + " " + options);
-    }
-
-    static OutputAnalyzer kt(String cmd)
-            throws Exception {
-        return SecurityTools.keytool("-storepass changeit -keypass changeit "
-                + "-keystore ks " + cmd);
-    }
-
-    static void check(X509Certificate cert, String expectedKeyAlg,
-            ObjectIdentifier expectedMdAlg) throws Exception {
-        Asserts.assertEQ(cert.getPublicKey().getAlgorithm(), expectedKeyAlg);
-        Asserts.assertEQ(cert.getSigAlgName(), "RSASSA-PSS");
-        DerUtils.checkAlg(cert.getSigAlgParams(), "000", expectedMdAlg);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/keytool/pss/PSS.java	Tue Jun 25 15:24:41 2019 +0530
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8215694 8222987 8225257
+ * @summary keytool cannot generate RSASSA-PSS certificates
+ * @library /test/lib
+ * @build java.base/sun.security.rsa.RSAKeyPairGenerator
+ * @modules java.base/sun.security.util
+ *          java.base/sun.security.x509
+ * @requires os.family != "solaris"
+ * @run main PSS
+ */
+
+// This test is excluded from Solaris because the 8192-bit RSA key pair
+// generator is extremely slow there.
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.SecurityTools;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.security.DerUtils;
+import sun.security.util.ObjectIdentifier;
+import sun.security.x509.AlgorithmId;
+
+import java.io.File;
+import java.security.KeyStore;
+import java.security.cert.X509Certificate;
+
+public class PSS {
+
+    public static void main(String[] args) throws Exception {
+
+        genkeypair("p", "-keyalg RSASSA-PSS -sigalg RSASSA-PSS")
+                .shouldHaveExitValue(0);
+
+        genkeypair("a", "-keyalg RSA -sigalg RSASSA-PSS -keysize 2048")
+                .shouldHaveExitValue(0);
+
+        genkeypair("b", "-keyalg RSA -sigalg RSASSA-PSS -keysize 4096")
+                .shouldHaveExitValue(0);
+
+        genkeypair("c", "-keyalg RSA -sigalg RSASSA-PSS -keysize 8192")
+                .shouldHaveExitValue(0);
+
+        KeyStore ks = KeyStore.getInstance(
+                new File("ks"), "changeit".toCharArray());
+
+        check((X509Certificate)ks.getCertificate("p"), "RSASSA-PSS",
+                AlgorithmId.SHA256_oid);
+
+        check((X509Certificate)ks.getCertificate("a"), "RSA",
+                AlgorithmId.SHA256_oid);
+
+        check((X509Certificate)ks.getCertificate("b"), "RSA",
+                AlgorithmId.SHA384_oid);
+
+        check((X509Certificate)ks.getCertificate("c"), "RSA",
+                AlgorithmId.SHA512_oid);
+
+        // More commands
+        kt("-certreq -alias p -sigalg RSASSA-PSS -file p.req")
+                .shouldHaveExitValue(0);
+
+        kt("-gencert -alias a -sigalg RSASSA-PSS -infile p.req -outfile p.cert")
+                .shouldHaveExitValue(0);
+
+        kt("-importcert -alias p -file p.cert")
+                .shouldHaveExitValue(0);
+
+        kt("-selfcert -alias p -sigalg RSASSA-PSS")
+                .shouldHaveExitValue(0);
+    }
+
+    static OutputAnalyzer genkeypair(String alias, String options)
+            throws Exception {
+        String patchArg = "-J--patch-module=java.base=" + System.getProperty("test.classes")
+                + File.separator + "patches" + File.separator + "java.base";
+        return kt(patchArg + " -genkeypair -alias " + alias
+                + " -dname CN=" + alias + " " + options);
+    }
+
+    static OutputAnalyzer kt(String cmd)
+            throws Exception {
+        return SecurityTools.keytool("-storepass changeit -keypass changeit "
+                + "-keystore ks " + cmd);
+    }
+
+    static void check(X509Certificate cert, String expectedKeyAlg,
+            ObjectIdentifier expectedMdAlg) throws Exception {
+        Asserts.assertEQ(cert.getPublicKey().getAlgorithm(), expectedKeyAlg);
+        Asserts.assertEQ(cert.getSigAlgName(), "RSASSA-PSS");
+        DerUtils.checkAlg(cert.getSigAlgParams(), "000", expectedMdAlg);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/sun/security/tools/keytool/pss/java.base/sun/security/rsa/RSAKeyPairGenerator.java	Tue Jun 25 15:24:41 2019 +0530
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.rsa;
+
+import java.math.BigInteger;
+
+import java.security.*;
+import java.security.spec.AlgorithmParameterSpec;
+import java.security.spec.RSAKeyGenParameterSpec;
+
+import sun.security.jca.JCAUtil;
+import sun.security.x509.AlgorithmId;
+import static sun.security.rsa.RSAUtil.KeyType;
+
+/**
+ * Fake RSA keypair generation.
+ */
+public abstract class RSAKeyPairGenerator extends KeyPairGeneratorSpi {
+
+    // public exponent to use
+    private BigInteger publicExponent;
+
+    // size of the key to generate, >= RSAKeyFactory.MIN_MODLEN
+    private int keySize;
+
+    private final KeyType type;
+    private AlgorithmId rsaId;
+
+    RSAKeyPairGenerator(KeyType type, int defKeySize) {
+        this.type = type;
+        // initialize to default in case the app does not call initialize()
+        initialize(defKeySize, null);
+    }
+
+    // initialize the generator. See JCA doc
+    public void initialize(int keySize, SecureRandom random) {
+        try {
+            initialize(new RSAKeyGenParameterSpec(keySize,
+                    RSAKeyGenParameterSpec.F4), random);
+        } catch (InvalidAlgorithmParameterException iape) {
+            throw new InvalidParameterException(iape.getMessage());
+        }
+    }
+
+    // second initialize method. See JCA doc.
+    public void initialize(AlgorithmParameterSpec params, SecureRandom random)
+            throws InvalidAlgorithmParameterException {
+        if (params instanceof RSAKeyGenParameterSpec == false) {
+            throw new InvalidAlgorithmParameterException
+                ("Params must be instance of RSAKeyGenParameterSpec");
+        }
+
+        RSAKeyGenParameterSpec rsaSpec = (RSAKeyGenParameterSpec)params;
+        int tmpKeySize = rsaSpec.getKeysize();
+        BigInteger tmpPublicExponent = rsaSpec.getPublicExponent();
+        AlgorithmParameterSpec tmpParams = rsaSpec.getKeyParams();
+
+        if (tmpPublicExponent == null) {
+            tmpPublicExponent = RSAKeyGenParameterSpec.F4;
+        } else {
+            if (tmpPublicExponent.compareTo(RSAKeyGenParameterSpec.F0) < 0) {
+                throw new InvalidAlgorithmParameterException
+                        ("Public exponent must be 3 or larger");
+            }
+            if (tmpPublicExponent.bitLength() > tmpKeySize) {
+                throw new InvalidAlgorithmParameterException
+                        ("Public exponent must be smaller than key size");
+            }
+        }
+
+        // do not allow unreasonably large key sizes, probably user error
+        try {
+            RSAKeyFactory.checkKeyLengths(tmpKeySize, tmpPublicExponent,
+                512, 64 * 1024);
+        } catch (InvalidKeyException e) {
+            throw new InvalidAlgorithmParameterException(
+                "Invalid key sizes", e);
+        }
+
+        try {
+            this.rsaId = RSAUtil.createAlgorithmId(type, tmpParams);
+        } catch (ProviderException e) {
+            throw new InvalidAlgorithmParameterException(
+                "Invalid key parameters", e);
+        }
+
+        this.keySize = tmpKeySize;
+        this.publicExponent = tmpPublicExponent;
+    }
+
+    // generate the keypair. See JCA doc
+    public KeyPair generateKeyPair() {
+
+        // accommodate odd key sizes in case anybody wants to use them
+        BigInteger e = publicExponent;
+        if (!e.equals(RSAKeyGenParameterSpec.F4)) {
+            throw new AssertionError("Only support F4 now");
+        }
+        BigInteger p, q, n;
+
+        // Pre-calculated p and q for e == RSAKeyGenParameterSpec.F4
+        switch (keySize) {
+            case 2048:
+                p = new BigInteger("1600840041787354447543653385760927"
+                        + "2642568308955833364523274045522752644800599"
+                        + "8669541532595690224703734511692014533312515"
+                        + "1867029838883431415692353449578487671384896"
+                        + "6611685764860941767986520897595108597563035"
+                        + "4023785639802607792535812062420427283857665"
+                        + "9883578590844700707106157871508280052743363"
+                        + "65749456332400771");
+                q = new BigInteger("1303880717101677622201474394769850"
+                        + "7257196073324816341282215626935164930077468"
+                        + "5999131251387556761167658937349436378464220"
+                        + "4831804147777472146628148336776639855791417"
+                        + "3849903041999943901924899580268176393595653"
+                        + "7357080543898614581363167420619163047562600"
+                        + "6155574020606891195960345238780709194499010"
+                        + "43652862954645301");
+                break;
+            case 4096:
+                p = new BigInteger("2985635754414679487171962796211911"
+                        + "1563710734938215274736352092606404045130913"
+                        + "2477365484439939846705721840432140066578525"
+                        + "0762327458086280430118434094733412377416194"
+                        + "8736124795243564050755767519346747209606612"
+                        + "5835460937739428885308798309679495432910469"
+                        + "0294757621321446003970767164933974474924664"
+                        + "1513767092845098947552598109657871041666676"
+                        + "2945573325433283821164032766425479703026349"
+                        + "9433641551427112483593214628620450175257586"
+                        + "4350119143877183562692754400346175237007314"
+                        + "7121580349193179272551363894896336921717843"
+                        + "3734726842184251708799134654802475890197293"
+                        + "9094908310578403843742664173424031260840446"
+                        + "591633359364559754200663");
+                q = new BigInteger("2279248439141087793789384816271625"
+                        + "1304008816573950275844533962181244003563987"
+                        + "6638461665174020058827698592331066726709304"
+                        + "9231319346136709972639455506783245161859951"
+                        + "6191872757335765533547033659834427437142631"
+                        + "3801232751161907082392011429712327250253948"
+                        + "6012497852063361866175243227579880020724881"
+                        + "9393797645220239009219998518884396282407710"
+                        + "7199202450846395844337846503427790307364624"
+                        + "5124871273035872938616425951596065309519651"
+                        + "1519189356431513094684173807318945903212527"
+                        + "7712469749366620048658571121822171067675915"
+                        + "5479178304648399924549334007222294762969503"
+                        + "5341584429803583589276956979963609078497238"
+                        + "760757619468018224491053");
+                break;
+            case 8192:
+                p = new BigInteger("9821669838446774374944535804569858"
+                        + "0553278885576950130485823829973470553571905"
+                        + "3014418421996241500307589880457361653957913"
+                        + "9176499436767288125182942994089196450118944"
+                        + "8701794862752733776161684616570463744619126"
+                        + "4981622564763630694110472008409561205704867"
+                        + "0221819623405201369630462487520858670679048"
+                        + "5854008441429858453634949980424333056803703"
+                        + "1205609490778445762604050796894221725977551"
+                        + "1428887194691696420765173256600200430067305"
+                        + "4364524177041858044598166859757042904625691"
+                        + "4292728453597609683799189454690202563236931"
+                        + "8171122071288244573793276051041975005528757"
+                        + "0228306442708182141334279133965507583927772"
+                        + "9244311696220253059281524393613278272067808"
+                        + "7017494446447670799055720358621918361716353"
+                        + "5018317015764698318012095108914870478138809"
+                        + "8204738169777192718869484177321870413838036"
+                        + "8149216482968887382371881239714335470844573"
+                        + "1862934371951394070111726593305334971041399"
+                        + "5517260339034138718517336990212463882142363"
+                        + "9154412320743552301967162100734381046548816"
+                        + "3883737645359595416600487444018399886391071"
+                        + "3777667222706059170707223589163679915863781"
+                        + "4662302526078720977228426750718207481384357"
+                        + "7918717041190413457052439016978578217755022"
+                        + "7370720979516554707297685239584071755267452"
+                        + "6021894842754355160100506065457679069228273"
+                        + "95209345267367982516553449135291473361");
+                q = new BigInteger("7902448465953646210110784092684896"
+                        + "0265474424590294110174550047938700740921014"
+                        + "1981650823416127449143596912363210790070524"
+                        + "2903784112701128957948996730263815210531364"
+                        + "0489145287401377007608600217628773627723381"
+                        + "1194123533939872283952535576847014977682278"
+                        + "9332064706645169741712060131540562788886577"
+                        + "3762235020990267901959745687867018811088495"
+                        + "3716021011509120447248882358515954471433808"
+                        + "2782236662758287959413069553620728137831579"
+                        + "2321174813204514354999978428741310035945405"
+                        + "0226661395731921098764192439072425262100813"
+                        + "9732949866553839713092238096261034339815187"
+                        + "2832617055364163276140160068136296115910569"
+                        + "9466440903693740716929166334256441926903849"
+                        + "1082968246155177124035336609654226388424434"
+                        + "5775783323612758615407928446164631651292743"
+                        + "8428509642959278732826297890909454571009075"
+                        + "7836191622138731918099379467912681177757761"
+                        + "6141378131042432093843778753846726589215845"
+                        + "7402160146427434508515156204064224022904659"
+                        + "8645441448874409852211668374267341177082462"
+                        + "7341410218867175406105046487057429530801973"
+                        + "0931082058719258230993681115780999537424968"
+                        + "2385515792331573549935317407789344892257264"
+                        + "7464569110078675090194686816764429827739815"
+                        + "0566036514181547634372488184242167294602000"
+                        + "8232780963578241583529875079397308150506597"
+                        + "37190564909892937290776929541076192569");
+                break;
+            default:
+                throw new AssertionError("Unknown keySize " + keySize);
+        }
+
+        n = p.multiply(q);
+
+        // phi = (p - 1) * (q - 1) must be relative prime to e
+        // otherwise RSA just won't work ;-)
+        BigInteger p1 = p.subtract(BigInteger.ONE);
+        BigInteger q1 = q.subtract(BigInteger.ONE);
+        BigInteger phi = p1.multiply(q1);
+        // generate new p and q until they work. typically
+        // the first try will succeed when using F4
+        if (e.gcd(phi).equals(BigInteger.ONE) == false) {
+            throw new AssertionError("Should not happen");
+        }
+
+        // private exponent d is the inverse of e mod phi
+        BigInteger d = e.modInverse(phi);
+
+        // 1st prime exponent pe = d mod (p - 1)
+        BigInteger pe = d.mod(p1);
+        // 2nd prime exponent qe = d mod (q - 1)
+        BigInteger qe = d.mod(q1);
+
+        // crt coefficient coeff is the inverse of q mod p
+        BigInteger coeff = q.modInverse(p);
+
+        try {
+            PublicKey publicKey = new RSAPublicKeyImpl(rsaId, n, e);
+            PrivateKey privateKey = new RSAPrivateCrtKeyImpl(
+                    rsaId, n, e, d, p, q, pe, qe, coeff);
+            return new KeyPair(publicKey, privateKey);
+        } catch (InvalidKeyException exc) {
+            // invalid key exception only thrown for keys < 512 bit,
+            // will not happen here
+            throw new RuntimeException(exc);
+        }
+    }
+}
--- a/test/make/TestMake.gmk	Mon Jun 24 15:18:05 2019 +0530
+++ b/test/make/TestMake.gmk	Tue Jun 25 15:24:41 2019 +0530
@@ -46,7 +46,8 @@
 
 all: $(TARGETS)
 
+# Prints targets to TARGETS_FILE which must be set when calling this target.
 print-targets:
-	$(ECHO) "$(TARGETS)"
+	$(ECHO) "$(TARGETS)" >> $(TARGETS_FILE)
 
 .PHONY: default all $(TARGETS)