changeset 60571:d9cb148e3998

Merge
author psadhukhan
date Tue, 03 Mar 2020 14:45:47 +0530
parents 53efe5255d14 d765d242df98
children 91d6091570eb
files test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibrary.java test/hotspot/jtreg/runtime/testlibrary/GeneratedClassLoader.java
diffstat 28 files changed, 1216 insertions(+), 506 deletions(-) [+]
line wrap: on
line diff
--- a/make/test/JtregNativeHotspot.gmk	Tue Mar 03 03:46:11 2020 +0000
+++ b/make/test/JtregNativeHotspot.gmk	Tue Mar 03 14:45:47 2020 +0530
@@ -881,7 +881,7 @@
     BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
     BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c libterminatedThread.c
     BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exejvm-test-launcher := jvm.lib
-
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit := jvm.lib
 else
     BUILD_HOTSPOT_JTREG_EXECUTABLES_LIBS_exejvm-test-launcher := -ljvm
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libbootclssearch_agent += -lpthread
@@ -1517,6 +1517,7 @@
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetphase001 += -lpthread
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libgetphase002 += -lpthread
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libterminatedThread += -lpthread
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libatExit += -ljvm
 endif
 
 # This evaluation is expensive and should only be done if this target was
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -969,8 +969,7 @@
     if (t != T_OBJECT) {
       k = Universe::typeArrayKlassObj(t);
     } else {
-      Symbol* obj_class = ss.as_symbol();
-      k = SystemDictionary::find(obj_class, class_loader, protection_domain, THREAD);
+      k = SystemDictionary::find(ss.as_symbol(), class_loader, protection_domain, THREAD);
     }
     if (k != NULL) {
       k = k->array_klass_or_null(ndims);
@@ -2527,8 +2526,8 @@
           InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::MethodHandle_klass()));  // java.lang.invoke
 }
 
-// Find or construct the Java mirror (java.lang.Class instance) for a
-// for the given field type signature, as interpreted relative to the
+// Find or construct the Java mirror (java.lang.Class instance) for
+// the given field type signature, as interpreted relative to the
 // given class loader.  Handles primitives, void, references, arrays,
 // and all other reflectable types, except method types.
 // N.B.  Code in reflection should use this entry point.
@@ -2538,57 +2537,33 @@
                                                    Handle protection_domain,
                                                    SignatureStream::FailureMode failure_mode,
                                                    TRAPS) {
-  Handle empty;
-
   assert(accessing_klass == NULL || (class_loader.is_null() && protection_domain.is_null()),
          "one or the other, or perhaps neither");
 
-  SignatureStream ss(signature, false);
-
   // What we have here must be a valid field descriptor,
   // and all valid field descriptors are supported.
   // Produce the same java.lang.Class that reflection reports.
-  if (ss.is_primitive() || (ss.type() == T_VOID)) {
+  if (accessing_klass != NULL) {
+    class_loader      = Handle(THREAD, accessing_klass->class_loader());
+    protection_domain = Handle(THREAD, accessing_klass->protection_domain());
+  }
+  ResolvingSignatureStream ss(signature, class_loader, protection_domain, false);
+  oop mirror_oop = ss.as_java_mirror(failure_mode, CHECK_NH);
+  if (mirror_oop == NULL) {
+    return Handle();  // report failure this way
+  }
+  Handle mirror(THREAD, mirror_oop);
 
-    // It's a primitive.  (Void has a primitive mirror too.)
-    return Handle(THREAD, java_lang_Class::primitive_mirror(ss.type()));
-
-  } else if (ss.is_reference()) {
-
-    // It's a reference type.
-    if (accessing_klass != NULL) {
-      class_loader      = Handle(THREAD, accessing_klass->class_loader());
-      protection_domain = Handle(THREAD, accessing_klass->protection_domain());
-    }
-    Klass* constant_type_klass;
-    if (failure_mode == SignatureStream::ReturnNull) {
-      constant_type_klass = resolve_or_null(signature, class_loader, protection_domain,
-                                            CHECK_(empty));
-    } else {
-      bool throw_error = (failure_mode == SignatureStream::NCDFError);
-      constant_type_klass = resolve_or_fail(signature, class_loader, protection_domain,
-                                            throw_error, CHECK_(empty));
-    }
-    if (constant_type_klass == NULL) {
-      return Handle();  // report failure this way
-    }
-    Handle mirror(THREAD, constant_type_klass->java_mirror());
-
+  if (accessing_klass != NULL) {
     // Check accessibility, emulating ConstantPool::verify_constant_pool_resolve.
-    if (accessing_klass != NULL) {
-      Klass* sel_klass = constant_type_klass;
+    Klass* sel_klass = java_lang_Class::as_Klass(mirror());
+    if (sel_klass != NULL) {
       bool fold_type_to_class = true;
       LinkResolver::check_klass_accessability(accessing_klass, sel_klass,
-                                              fold_type_to_class, CHECK_(empty));
+                                              fold_type_to_class, CHECK_NH);
     }
-
-    return mirror;
-
   }
-
-  // Fall through to an error.
-  assert(false, "unsupported mirror syntax");
-  THROW_MSG_(vmSymbols::java_lang_InternalError(), "unsupported mirror syntax", empty);
+  return mirror;
 }
 
 
--- a/src/hotspot/share/oops/method.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/oops/method.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -1680,7 +1680,6 @@
   }
 }
 
-// These two methods are static since a GC may move the Method
 bool Method::load_signature_classes(const methodHandle& m, TRAPS) {
   if (!THREAD->can_call_java()) {
     // There is nothing useful this routine can do from within the Compile thread.
@@ -1689,16 +1688,11 @@
     return false;
   }
   bool sig_is_loaded = true;
-  Handle class_loader(THREAD, m->method_holder()->class_loader());
-  Handle protection_domain(THREAD, m->method_holder()->protection_domain());
   ResourceMark rm(THREAD);
-  Symbol*  signature = m->signature();
-  for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
+  for (ResolvingSignatureStream ss(m()); !ss.is_done(); ss.next()) {
     if (ss.is_reference()) {
-      Symbol* sym = ss.as_symbol();
-      Symbol*  name  = sym;
-      Klass* klass = SystemDictionary::resolve_or_null(name, class_loader,
-                                             protection_domain, THREAD);
+      // load everything, including arrays "[Lfoo;"
+      Klass* klass = ss.as_klass(SignatureStream::ReturnNull, THREAD);
       // We are loading classes eagerly. If a ClassNotFoundException or
       // a LinkageError was generated, be sure to ignore it.
       if (HAS_PENDING_EXCEPTION) {
@@ -1716,14 +1710,13 @@
 }
 
 bool Method::has_unloaded_classes_in_signature(const methodHandle& m, TRAPS) {
-  Handle class_loader(THREAD, m->method_holder()->class_loader());
-  Handle protection_domain(THREAD, m->method_holder()->protection_domain());
   ResourceMark rm(THREAD);
-  Symbol*  signature = m->signature();
-  for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
+  for(ResolvingSignatureStream ss(m()); !ss.is_done(); ss.next()) {
     if (ss.type() == T_OBJECT) {
-      Symbol* name = ss.as_symbol();
-      Klass* klass = SystemDictionary::find(name, class_loader, protection_domain, THREAD);
+      // Do not use ss.is_reference() here, since we don't care about
+      // unloaded array component types.
+      Klass* klass = ss.as_klass_if_loaded(THREAD);
+      assert(!HAS_PENDING_EXCEPTION, "as_klass_if_loaded contract");
       if (klass == NULL) return true;
     }
   }
--- a/src/hotspot/share/opto/loopUnswitch.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/opto/loopUnswitch.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -156,7 +156,7 @@
   if (predicate != NULL) {
     entry = skip_loop_predicates(entry);
   }
-  if (predicate != NULL && UseLoopPredicate) {
+  if (predicate != NULL && UseProfiledLoopPredicate) {
     // We may have two predicates, find first.
     Node* n = find_predicate(entry);
     if (n != NULL) {
@@ -164,7 +164,7 @@
       entry = skip_loop_predicates(entry);
     }
   }
-  if (predicate != NULL && UseProfiledLoopPredicate) {
+  if (predicate != NULL && UseLoopPredicate) {
     entry = find_predicate(entry);
     if (entry != NULL) predicate = entry;
   }
--- a/src/hotspot/share/opto/loopnode.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/opto/loopnode.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -2543,17 +2543,17 @@
     tty->print(" limit_check");
     entry = PhaseIdealLoop::skip_loop_predicates(entry);
   }
-  if (UseLoopPredicate) {
-    entry = PhaseIdealLoop::find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
-    if (entry != NULL) {
-      tty->print(" predicated");
+  if (UseProfiledLoopPredicate) {
+    predicate = PhaseIdealLoop::find_predicate_insertion_point(entry, Deoptimization::Reason_profile_predicate);
+    if (predicate != NULL) {
+      tty->print(" profile_predicated");
       entry = PhaseIdealLoop::skip_loop_predicates(entry);
     }
   }
-  if (UseProfiledLoopPredicate) {
-    entry = PhaseIdealLoop::find_predicate_insertion_point(entry, Deoptimization::Reason_profile_predicate);
-    if (entry != NULL) {
-      tty->print(" profile_predicated");
+  if (UseLoopPredicate) {
+    predicate = PhaseIdealLoop::find_predicate_insertion_point(entry, Deoptimization::Reason_predicate);
+    if (predicate != NULL) {
+      tty->print(" predicated");
     }
   }
   if (_head->is_CountedLoop()) {
@@ -2658,22 +2658,22 @@
     LoopNode* lpn = loop->_head->as_Loop();
     Node* entry = lpn->in(LoopNode::EntryControl);
     Node* predicate_proj = find_predicate(entry); // loop_limit_check first
-    if (predicate_proj != NULL ) { // right pattern that can be used by loop predication
+    if (predicate_proj != NULL) { // right pattern that can be used by loop predication
       assert(entry->in(0)->in(1)->in(1)->Opcode() == Op_Opaque1, "must be");
       useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one
       entry = skip_loop_predicates(entry);
     }
-    predicate_proj = find_predicate(entry); // Predicate
-    if (predicate_proj != NULL ) {
-      useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one
-      entry = skip_loop_predicates(entry);
-    }
     if (UseProfiledLoopPredicate) {
       predicate_proj = find_predicate(entry); // Predicate
-      if (predicate_proj != NULL ) {
+      if (predicate_proj != NULL) {
         useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one
+        entry = skip_loop_predicates(entry);
       }
     }
+    predicate_proj = find_predicate(entry); // Predicate
+    if (predicate_proj != NULL) {
+      useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one
+    }
   }
 
   if (loop->_next) { // sibling
--- a/src/hotspot/share/opto/superword.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/opto/superword.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -2259,48 +2259,12 @@
         _igvn.replace_input_of(ld, MemNode::Memory, upper_insert_pt);
       }
     }
-  } else if (pk->at(0)->is_Load()) { //load
-    // all loads in the pack should have the same memory state. By default,
+  } else if (pk->at(0)->is_Load()) { // Load pack
+    // All loads in the pack should have the same memory state. By default,
     // we use the memory state of the last load. However, if any load could
     // not be moved down due to the dependence constraint, we use the memory
     // state of the first load.
-    Node* last_mem  = pk->at(0)->in(MemNode::Memory);
-    Node* first_mem = last_mem;
-    // Walk the memory graph from the current first load until the
-    // start of the loop and check if nodes on the way are memory
-    // edges of loads in the pack. The last one we encounter is the
-    // first load.
-    for (Node* current = first_mem; in_bb(current); current = current->is_Phi() ? current->in(LoopNode::EntryControl) : current->in(MemNode::Memory)) {
-     assert(current->is_Mem() || (current->is_Phi() && current->in(0) == bb()), "unexpected memory");
-     for (uint i = 1; i < pk->size(); i++) {
-        Node* ld = pk->at(i);
-        if (ld->in(MemNode::Memory) == current) {
-          first_mem = current;
-          break;
-        }
-      }
-    }
-    // Find the last load by going over the pack again and walking
-    // the memory graph from the loads of the pack to the memory of
-    // the first load. If we encounter the memory of the current last
-    // load, then we started from further down in the memory graph and
-    // the load we started from is the last load. Check for dependence
-    // constraints in that loop as well.
-    bool schedule_last = true;
-    for (uint i = 0; i < pk->size(); i++) {
-      Node* ld = pk->at(i);
-      for (Node* current = ld->in(MemNode::Memory); current != first_mem; current = current->in(MemNode::Memory)) {
-        assert(current->is_Mem() && in_bb(current), "unexpected memory");
-        if (current->in(MemNode::Memory) == last_mem) {
-          last_mem = ld->in(MemNode::Memory);
-        }
-        if (!independent(current, ld)) {
-          schedule_last = false; // a later store depends on this load
-        }
-      }
-    }
-
-    Node* mem_input = schedule_last ? last_mem : first_mem;
+    Node* mem_input = pick_mem_state(pk);
     _igvn.hash_delete(mem_input);
     // Give each load the same memory state
     for (uint i = 0; i < pk->size(); i++) {
@@ -2310,6 +2274,75 @@
   }
 }
 
+// Finds the first and last memory state and then picks either of them by checking dependence constraints.
+// If a store is dependent on an earlier load then we need to pick the memory state of the first load and cannot
+// pick the memory state of the last load.
+Node* SuperWord::pick_mem_state(Node_List* pk) {
+  Node* first_mem = find_first_mem_state(pk);
+  Node* last_mem  = find_last_mem_state(pk, first_mem);
+
+  for (uint i = 0; i < pk->size(); i++) {
+    Node* ld = pk->at(i);
+    for (Node* current = last_mem; current != ld->in(MemNode::Memory); current = current->in(MemNode::Memory)) {
+      assert(current->is_Mem() && in_bb(current), "unexpected memory");
+      assert(current != first_mem, "corrupted memory graph");
+      if (!independent(current, ld)) {
+#ifdef ASSERT
+        // Added assertion code since no case has been observed that should pick the first memory state.
+        // Remove the assertion code whenever we find a (valid) case that really needs the first memory state.
+        pk->dump();
+        first_mem->dump();
+        last_mem->dump();
+        current->dump();
+        ld->dump();
+        ld->in(MemNode::Memory)->dump();
+        assert(false, "never observed that first memory should be picked");
+#endif
+        return first_mem; // A later store depends on this load, pick memory state of first load
+      }
+    }
+  }
+  return last_mem;
+}
+
+// Walk the memory graph from the current first load until the
+// start of the loop and check if nodes on the way are memory
+// edges of loads in the pack. The last one we encounter is the
+// first load.
+Node* SuperWord::find_first_mem_state(Node_List* pk) {
+  Node* first_mem = pk->at(0)->in(MemNode::Memory);
+  for (Node* current = first_mem; in_bb(current); current = current->is_Phi() ? current->in(LoopNode::EntryControl) : current->in(MemNode::Memory)) {
+    assert(current->is_Mem() || (current->is_Phi() && current->in(0) == bb()), "unexpected memory");
+    for (uint i = 1; i < pk->size(); i++) {
+      Node* ld = pk->at(i);
+      if (ld->in(MemNode::Memory) == current) {
+        first_mem = current;
+        break;
+      }
+    }
+  }
+  return first_mem;
+}
+
+// Find the last load by going over the pack again and walking
+// the memory graph from the loads of the pack to the memory of
+// the first load. If we encounter the memory of the current last
+// load, then we started from further down in the memory graph and
+// the load we started from is the last load.
+Node* SuperWord::find_last_mem_state(Node_List* pk, Node* first_mem) {
+  Node* last_mem = pk->at(0)->in(MemNode::Memory);
+  for (uint i = 0; i < pk->size(); i++) {
+    Node* ld = pk->at(i);
+    for (Node* current = ld->in(MemNode::Memory); current != first_mem; current = current->in(MemNode::Memory)) {
+      assert(current->is_Mem() && in_bb(current), "unexpected memory");
+      if (current->in(MemNode::Memory) == last_mem) {
+        last_mem = ld->in(MemNode::Memory);
+      }
+    }
+  }
+  return last_mem;
+}
+
 #ifndef PRODUCT
 void SuperWord::print_loop(bool whole) {
   Node_Stack stack(_arena, _phase->C->unique() >> 2);
--- a/src/hotspot/share/opto/superword.hpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/opto/superword.hpp	Tue Mar 03 14:45:47 2020 +0530
@@ -481,6 +481,10 @@
   // Within a store pack, schedule stores together by moving out the sandwiched memory ops according
   // to dependence info; and within a load pack, move loads down to the last executed load.
   void co_locate_pack(Node_List* p);
+  Node* pick_mem_state(Node_List* pk);
+  Node* find_first_mem_state(Node_List* pk);
+  Node* find_last_mem_state(Node_List* pk, Node* first_mem);
+
   // Convert packs into vector node operations
   void output();
   // Create a vector operand for the nodes in pack p for operand: in(opd_idx)
--- a/src/hotspot/share/prims/jni.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/prims/jni.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -3681,7 +3681,8 @@
 
 // Global invocation API vars
 volatile int vm_created = 0;
-// Indicate whether it is safe to recreate VM
+// Indicate whether it is safe to recreate VM. Recreation is only
+// possible after a failed initial creation attempt in some cases.
 volatile int safe_to_recreate_vm = 1;
 struct JavaVM_ main_vm = {&jni_InvokeInterface};
 
@@ -3751,8 +3752,14 @@
   if (Atomic::xchg(&vm_created, 1) == 1) {
     return JNI_EEXIST;   // already created, or create attempt in progress
   }
+
+  // If a previous creation attempt failed but can be retried safely,
+  // then safe_to_recreate_vm will have been reset to 1 after being
+  // cleared here. If a previous creation attempt succeeded and we then
+  // destroyed that VM, we will be prevented from trying to recreate
+  // the VM in the same process, as the value will still be 0.
   if (Atomic::xchg(&safe_to_recreate_vm, 0) == 0) {
-    return JNI_ERR;  // someone tried and failed and retry not allowed.
+    return JNI_ERR;
   }
 
   assert(vm_created == 1, "vm_created is true during the creation");
@@ -3945,9 +3952,14 @@
 
   Thread* t = Thread::current_or_null();
   if (t != NULL) {
-    // If the thread has been attached this operation is a no-op
-    *(JNIEnv**)penv = ((JavaThread*) t)->jni_environment();
-    return JNI_OK;
+    // If executing from an atexit hook we may be in the VMThread.
+    if (t->is_Java_thread()) {
+      // If the thread has been attached this operation is a no-op
+      *(JNIEnv**)penv = ((JavaThread*) t)->jni_environment();
+      return JNI_OK;
+    } else {
+      return JNI_ERR;
+    }
   }
 
   // Create a thread and mark it as attaching so it will be skipped by the
@@ -4045,7 +4057,7 @@
 jint JNICALL jni_AttachCurrentThread(JavaVM *vm, void **penv, void *_args) {
   HOTSPOT_JNI_ATTACHCURRENTTHREAD_ENTRY(vm, penv, _args);
   if (vm_created == 0) {
-  HOTSPOT_JNI_ATTACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
+    HOTSPOT_JNI_ATTACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
     return JNI_ERR;
   }
 
@@ -4058,18 +4070,30 @@
 
 jint JNICALL jni_DetachCurrentThread(JavaVM *vm)  {
   HOTSPOT_JNI_DETACHCURRENTTHREAD_ENTRY(vm);
+  if (vm_created == 0) {
+    HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN(JNI_ERR);
+    return JNI_ERR;
+  }
 
   JNIWrapper("DetachCurrentThread");
 
+  Thread* current = Thread::current_or_null();
+
   // If the thread has already been detached the operation is a no-op
-  if (Thread::current_or_null() == NULL) {
+  if (current == NULL) {
     HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN(JNI_OK);
     return JNI_OK;
   }
 
+  // If executing from an atexit hook we may be in the VMThread.
+  if (!current->is_Java_thread()) {
+    HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
+    return JNI_ERR;
+  }
+
   VM_Exit::block_if_vm_exited();
 
-  JavaThread* thread = JavaThread::current();
+  JavaThread* thread = (JavaThread*) current;
   if (thread->has_last_Java_frame()) {
     HOTSPOT_JNI_DETACHCURRENTTHREAD_RETURN((uint32_t) JNI_ERR);
     // Can't detach a thread that's running java, that can't work.
--- a/src/hotspot/share/runtime/reflection.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/runtime/reflection.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -52,7 +52,11 @@
 #include "runtime/thread.inline.hpp"
 #include "runtime/vframe.inline.hpp"
 
-static void trace_class_resolution(const Klass* to_class) {
+static void trace_class_resolution(oop mirror) {
+  if (mirror == NULL || java_lang_Class::is_primitive(mirror)) {
+    return;
+  }
+  Klass* to_class = java_lang_Class::as_Klass(mirror);
   ResourceMark rm;
   int line_number = -1;
   const char * source_file = NULL;
@@ -750,33 +754,6 @@
   );
 }
 
-// Utility method converting a single SignatureStream element into java.lang.Class instance
-static oop get_mirror_from_signature(const methodHandle& method,
-                                     SignatureStream* ss,
-                                     TRAPS) {
-
-
-  if (is_reference_type(ss->type())) {
-    Symbol* name = ss->as_symbol();
-    oop loader = method->method_holder()->class_loader();
-    oop protection_domain = method->method_holder()->protection_domain();
-    const Klass* k = SystemDictionary::resolve_or_fail(name,
-                                                       Handle(THREAD, loader),
-                                                       Handle(THREAD, protection_domain),
-                                                       true,
-                                                       CHECK_NULL);
-    if (log_is_enabled(Debug, class, resolve)) {
-      trace_class_resolution(k);
-    }
-    return k->java_mirror();
-  }
-
-  assert(ss->type() != T_VOID || ss->at_return_type(),
-    "T_VOID should only appear as return type");
-
-  return java_lang_Class::primitive_mirror(ss->type());
-}
-
 static objArrayHandle get_parameter_types(const methodHandle& method,
                                           int parameter_count,
                                           oop* return_type,
@@ -787,19 +764,20 @@
   int index = 0;
   // Collect parameter types
   ResourceMark rm(THREAD);
-  Symbol*  signature = method->signature();
-  SignatureStream ss(signature);
-  while (!ss.at_return_type()) {
-    oop mirror = get_mirror_from_signature(method, &ss, CHECK_(objArrayHandle()));
-    mirrors->obj_at_put(index++, mirror);
-    ss.next();
+  for (ResolvingSignatureStream ss(method()); !ss.is_done(); ss.next()) {
+    oop mirror = ss.as_java_mirror(SignatureStream::NCDFError, CHECK_(objArrayHandle()));
+    if (log_is_enabled(Debug, class, resolve)) {
+      trace_class_resolution(mirror);
+    }
+    if (!ss.at_return_type()) {
+      mirrors->obj_at_put(index++, mirror);
+    } else if (return_type != NULL) {
+      // Collect return type as well
+      assert(ss.at_return_type(), "return type should be present");
+      *return_type = mirror;
+    }
   }
   assert(index == parameter_count, "invalid parameter count");
-  if (return_type != NULL) {
-    // Collect return type as well
-    assert(ss.at_return_type(), "return type should be present");
-    *return_type = get_mirror_from_signature(method, &ss, CHECK_(objArrayHandle()));
-  }
   return mirrors;
 }
 
@@ -808,24 +786,11 @@
 }
 
 static Handle new_type(Symbol* signature, Klass* k, TRAPS) {
-  SignatureStream ss(signature, false);
-  // Basic types
-  BasicType type = ss.is_reference() ? T_OBJECT : ss.type();
-  if (type != T_OBJECT) {
-    return Handle(THREAD, Universe::java_mirror(type));
+  ResolvingSignatureStream ss(signature, k, false);
+  oop nt = ss.as_java_mirror(SignatureStream::NCDFError, CHECK_NH);
+  if (log_is_enabled(Debug, class, resolve)) {
+    trace_class_resolution(nt);
   }
-
-  Klass* result =
-    SystemDictionary::resolve_or_fail(signature,
-                                      Handle(THREAD, k->class_loader()),
-                                      Handle(THREAD, k->protection_domain()),
-                                      true, CHECK_(Handle()));
-
-  if (log_is_enabled(Debug, class, resolve)) {
-    trace_class_resolution(result);
-  }
-
-  oop nt = result->java_mirror();
   return Handle(THREAD, nt);
 }
 
--- a/src/hotspot/share/runtime/signature.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/runtime/signature.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -373,7 +373,9 @@
 
 Klass* SignatureStream::as_klass(Handle class_loader, Handle protection_domain,
                                  FailureMode failure_mode, TRAPS) {
-  if (!is_reference())  return NULL;
+  if (!is_reference()) {
+    return NULL;
+  }
   Symbol* name = as_symbol();
   Klass* k = NULL;
   if (failure_mode == ReturnNull) {
@@ -401,10 +403,13 @@
 
 oop SignatureStream::as_java_mirror(Handle class_loader, Handle protection_domain,
                                     FailureMode failure_mode, TRAPS) {
-  if (!is_reference())
+  if (!is_reference()) {
     return Universe::java_mirror(type());
+  }
   Klass* klass = as_klass(class_loader, protection_domain, failure_mode, CHECK_NULL);
-  if (klass == NULL)  return NULL;
+  if (klass == NULL) {
+    return NULL;
+  }
   return klass->java_mirror();
 }
 
@@ -414,6 +419,52 @@
   }
 }
 
+ResolvingSignatureStream::ResolvingSignatureStream(Symbol* signature,
+                                                   Handle class_loader,
+                                                   Handle protection_domain,
+                                                   bool is_method)
+  : SignatureStream(signature, is_method),
+    _class_loader(class_loader), _protection_domain(protection_domain)
+{
+  initialize_load_origin(NULL);
+}
+
+ResolvingSignatureStream::ResolvingSignatureStream(Symbol* signature, Klass* load_origin, bool is_method)
+  : SignatureStream(signature, is_method)
+{
+  assert(load_origin != NULL, "");
+  initialize_load_origin(load_origin);
+}
+
+ResolvingSignatureStream::ResolvingSignatureStream(const Method* method)
+  : SignatureStream(method->signature(), true)
+{
+  initialize_load_origin(method->method_holder());
+}
+
+ResolvingSignatureStream::ResolvingSignatureStream(fieldDescriptor& field)
+  : SignatureStream(field.signature(), false)
+{
+  initialize_load_origin(field.field_holder());
+}
+
+void ResolvingSignatureStream::cache_handles(TRAPS) {
+  assert(_load_origin != NULL, "");
+  _class_loader = Handle(THREAD, _load_origin->class_loader());
+  _protection_domain = Handle(THREAD, _load_origin->protection_domain());
+}
+
+Klass* ResolvingSignatureStream::as_klass_if_loaded(TRAPS) {
+  Klass* klass = as_klass(CachedOrNull, THREAD);
+  // SD::find does not trigger loading, so there should be no throws
+  // Still, bad things can happen, so we CHECK_NULL and ask callers
+  // to do likewise.
+  if (HAS_PENDING_EXCEPTION) {
+    CLEAR_PENDING_EXCEPTION;
+  }
+  return klass;
+}
+
 #ifdef ASSERT
 
 extern bool signature_constants_sane(); // called from basic_types_init()
--- a/src/hotspot/share/runtime/signature.hpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/hotspot/share/runtime/signature.hpp	Tue Mar 03 14:45:47 2020 +0530
@@ -564,6 +564,52 @@
   oop as_java_mirror(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS);
 };
 
+// Specialized SignatureStream: used for invoking SystemDictionary to either find
+//                              or resolve the underlying type when iterating over a
+//                              Java descriptor (or parts of it).
+class ResolvingSignatureStream : public SignatureStream {
+  Klass*       _load_origin;
+  bool         _handles_cached;
+  Handle       _class_loader;       // cached when needed
+  Handle       _protection_domain;  // cached when needed
+
+  void initialize_load_origin(Klass* load_origin) {
+    _load_origin = load_origin;
+    _handles_cached = (load_origin == NULL);
+  }
+  void need_handles(TRAPS) {
+    if (!_handles_cached) {
+      cache_handles(THREAD);
+      _handles_cached = true;
+    }
+  }
+  void cache_handles(TRAPS);
+
+ public:
+  ResolvingSignatureStream(Symbol* signature, Klass* load_origin, bool is_method = true);
+  ResolvingSignatureStream(Symbol* signature, Handle class_loader, Handle protection_domain, bool is_method = true);
+  ResolvingSignatureStream(const Method* method);
+  ResolvingSignatureStream(fieldDescriptor& field);
+
+  Klass* load_origin()            { return _load_origin; }
+  Handle class_loader(TRAPS)      { need_handles(THREAD); return _class_loader; }
+  Handle protection_domain(TRAPS) { need_handles(THREAD); return _protection_domain; }
+
+  Klass* as_klass_if_loaded(TRAPS);
+  Klass* as_klass(FailureMode failure_mode, TRAPS) {
+    need_handles(THREAD);
+    return SignatureStream::as_klass(_class_loader, _protection_domain,
+                                     failure_mode, THREAD);
+  }
+  oop as_java_mirror(FailureMode failure_mode, TRAPS) {
+    if (is_reference()) {
+      need_handles(THREAD);
+    }
+    return SignatureStream::as_java_mirror(_class_loader, _protection_domain,
+                                           failure_mode, THREAD);
+  }
+};
+
 // Here is how all the SignatureIterator classes invoke the
 // SignatureStream engine to do their parsing.
 template<typename T> inline
--- a/src/java.base/share/classes/java/util/UUID.java	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/java.base/share/classes/java/util/UUID.java	Tue Mar 03 14:45:47 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -180,6 +180,45 @@
         return new UUID(md5Bytes);
     }
 
+    private static final byte[] NIBBLES;
+    static {
+        byte[] ns = new byte[256];
+        Arrays.fill(ns, (byte) -1);
+        ns['0'] = 0;
+        ns['1'] = 1;
+        ns['2'] = 2;
+        ns['3'] = 3;
+        ns['4'] = 4;
+        ns['5'] = 5;
+        ns['6'] = 6;
+        ns['7'] = 7;
+        ns['8'] = 8;
+        ns['9'] = 9;
+        ns['A'] = 10;
+        ns['B'] = 11;
+        ns['C'] = 12;
+        ns['D'] = 13;
+        ns['E'] = 14;
+        ns['F'] = 15;
+        ns['a'] = 10;
+        ns['b'] = 11;
+        ns['c'] = 12;
+        ns['d'] = 13;
+        ns['e'] = 14;
+        ns['f'] = 15;
+        NIBBLES = ns;
+    }
+
+    private static long parse4Nibbles(String name, int pos) {
+        byte[] ns = NIBBLES;
+        char ch1 = name.charAt(pos);
+        char ch2 = name.charAt(pos + 1);
+        char ch3 = name.charAt(pos + 2);
+        char ch4 = name.charAt(pos + 3);
+        return (ch1 | ch2 | ch3 | ch4) > 0xff ?
+                -1 : ns[ch1] << 12 | ns[ch2] << 8 | ns[ch3] << 4 | ns[ch4];
+    }
+
     /**
      * Creates a {@code UUID} from the string standard representation as
      * described in the {@link #toString} method.
@@ -195,6 +234,31 @@
      *
      */
     public static UUID fromString(String name) {
+        if (name.length() == 36) {
+            char ch1 = name.charAt(8);
+            char ch2 = name.charAt(13);
+            char ch3 = name.charAt(18);
+            char ch4 = name.charAt(23);
+            if (ch1 == '-' && ch2 == '-' && ch3 == '-' && ch4 == '-') {
+                long msb1 = parse4Nibbles(name, 0);
+                long msb2 = parse4Nibbles(name, 4);
+                long msb3 = parse4Nibbles(name, 9);
+                long msb4 = parse4Nibbles(name, 14);
+                long lsb1 = parse4Nibbles(name, 19);
+                long lsb2 = parse4Nibbles(name, 24);
+                long lsb3 = parse4Nibbles(name, 28);
+                long lsb4 = parse4Nibbles(name, 32);
+                if ((msb1 | msb2 | msb3 | msb4 | lsb1 | lsb2 | lsb3 | lsb4) >= 0) {
+                    return new UUID(
+                            msb1 << 48 | msb2 << 32 | msb3 << 16 | msb4,
+                            lsb1 << 48 | lsb2 << 32 | lsb3 << 16 | lsb4);
+                }
+            }
+        }
+        return fromString1(name);
+    }
+
+    private static UUID fromString1(String name) {
         int len = name.length();
         if (len > 36) {
             throw new IllegalArgumentException("UUID string too large");
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Secmod.java	Tue Mar 03 03:46:11 2020 +0000
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Secmod.java	Tue Mar 03 14:45:47 2020 +0530
@@ -414,10 +414,6 @@
                 } else {
                     type = ModuleType.EXTERNAL;
                 }
-                if (fips) {
-                    throw new RuntimeException("FIPS flag set for non-internal "
-                        + "module: " + libraryName + ", " + commonName);
-                }
             }
             // On Ubuntu the libsoftokn3 library is located in a subdirectory
             // of the system libraries directory. (Since Ubuntu 11.04.)
--- a/test/hotspot/gtest/oops/test_oop.cpp	Tue Mar 03 03:46:11 2020 +0000
+++ b/test/hotspot/gtest/oops/test_oop.cpp	Tue Mar 03 14:45:47 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "unittest.hpp"
 #include "utilities/globalDefinitions.hpp"
 
-static char memory[32];
+static unsigned char memory[32];
 
 oop fake_object() {
   return cast_to_oop(memory);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/loopopts/superword/CoLocatePackMemoryState.java	Tue Mar 03 14:45:47 2020 +0530
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * 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
+ * @requires vm.compiler2.enabled
+ * @bug 8238438
+ * @summary Tests to select the memory state of the last load in a load pack in SuperWord::co_locate_pack.
+ *
+ * @run main/othervm -Xbatch -XX:CompileCommand=compileonly,compiler.loopopts.superword.CoLocatePackMemoryState::test
+ *      -XX:LoopMaxUnroll=16 compiler.loopopts.superword.CoLocatePackMemoryState
+ */
+
+package compiler.loopopts.superword;
+
+public class CoLocatePackMemoryState {
+
+    public static final int N = 64;
+    public static byte byFld;
+    public static int iArr[] = new int[N+1];
+
+    public static void test() {
+        // Needs to pick the memory state of the last load for the iArr[i] load pack in SuperWord::co_locate_pack
+        // since it is dependent on the iArr[i+1] stores.
+        for (int i = 0; i < N; ++i) {
+            iArr[i+1] = i;
+            iArr[i] -= 15;
+            byFld += 35;
+        }
+    }
+
+    public static void main(String[] strArr) {
+        for (int i = 0; i < 2000; i++) {
+            for (int j = 0; j < N; j++) {
+                iArr[j] = 0;
+            }
+            test();
+
+            if (iArr[0] != -15) {
+                throw new RuntimeException("iArr[0] must be -15 but was " + iArr[0]);
+            }
+            for (int j = 1; j < N; j++) {
+                if (iArr[j] != (j-16)) {
+                    throw new RuntimeException("iArr[" + j + "] must be " + (j-16) + " but was " + iArr[j]);
+                }
+            }
+        }
+    }
+}
--- a/test/hotspot/jtreg/runtime/Metaspace/FragmentMetaspace.java	Tue Mar 03 03:46:11 2020 +0000
+++ b/test/hotspot/jtreg/runtime/Metaspace/FragmentMetaspace.java	Tue Mar 03 14:45:47 2020 +0530
@@ -23,13 +23,14 @@
 
 /**
  * @test
- * @library /runtime/testlibrary
+ * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @modules java.compiler
  * @run main/othervm/timeout=200 -Xmx1g FragmentMetaspace
  */
 
 import java.io.IOException;
+import jdk.test.lib.classloader.GeneratingCompilingClassLoader;
 
 /**
  * Test that tries to fragment the native memory used by class loaders.
@@ -53,7 +54,7 @@
         long startTime = System.currentTimeMillis();
         for (int i = 0; System.currentTimeMillis() < startTime + time && i < iterations; ++i) {
             try {
-                GeneratedClassLoader gcl = new GeneratedClassLoader();
+                GeneratingCompilingClassLoader gcl = new GeneratingCompilingClassLoader();
 
                 // getGeneratedClasses throws a RuntimeException in cases where
                 // the javac exit code is not 0. If the original reason for the exception is
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/jni/atExit/TestAtExit.java	Tue Mar 03 14:45:47 2020 +0530
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+/*
+ * @test
+ * @bug 8238676
+ * @summary Check that attempting to use the JNI invocation API from an
+ *          atexit handler fails as expected without crashing.
+ *
+ * @library /test/lib
+ * @run main/othervm/native TestAtExit
+ */
+
+public class TestAtExit {
+
+    // Using a nested class that invokes an enclosing method makes it
+    // easier to setup and use the native library.
+    static class Tester {
+        static {
+            System.loadLibrary("atExit");
+        }
+
+        // Record the fact we are using System.exit for termination
+        static native void setUsingSystemExit();
+
+        public static void main(String[] args) throws Exception {
+            if (args.length > 0) {
+                setUsingSystemExit();
+                System.exit(0);
+            }
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        // We mustn't load Tester in this VM so we exec by name.
+        String main = "TestAtExit$Tester";
+
+        String jlp = "-Djava.library.path=" + System.getProperty("test.nativepath");
+        // First run will terminate via DestroyJavaVM
+        OutputAnalyzer output = ProcessTools.executeTestJvm(jlp, main);
+        output.shouldNotContain("Unexpected");
+        output.shouldHaveExitValue(0);
+        output.reportDiagnosticSummary();
+
+        // Second run will terminate via System.exit()
+        output = ProcessTools.executeTestJvm(jlp, main, "doExit");
+        output.shouldNotContain("Unexpected");
+        output.shouldHaveExitValue(0);
+        output.reportDiagnosticSummary();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/jni/atExit/libatExit.c	Tue Mar 03 14:45:47 2020 +0530
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "jni.h"
+
+static JavaVM *jvm;
+
+static const char* jni_error_code(int ret) {
+  switch(ret) {
+  case JNI_OK: return "JNI_OK";
+  case JNI_ERR: return "JNI_ERR";
+  case JNI_EDETACHED: return "JNI_EDETACHED";
+  case JNI_EVERSION: return "JNI_EVERSION";
+  case JNI_ENOMEM: return "JNI_ENOMEM";
+  case JNI_EEXIST: return "JNI_EEXIST";
+  case JNI_EINVAL: return "JNI_EINVAL";
+  default: return "Invalid JNI error code";
+  }
+}
+
+static void report(const char* func, int ret_actual, int ret_expected) {
+  const char* ret = jni_error_code(ret_actual);
+  if (ret_actual == ret_expected) {
+    printf("%s returned %s as expected\n", func, ret);
+  } else {
+    printf("Unexpected JNI return code %s from %s\n", ret, func);
+  }
+}
+
+static int using_system_exit = 0; // Not System.exit by default
+
+JNIEXPORT
+void JNICALL Java_TestAtExit_00024Tester_setUsingSystemExit(JNIEnv* env, jclass c) {
+  using_system_exit = 1;
+}
+
+void at_exit_handler(void) {
+  printf("In at_exit_handler\n");
+
+  // We've saved the JavaVM from OnLoad time so we first try to
+  // get a JNIEnv for the current thread.
+  JNIEnv *env;
+  jint res = (*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_2);
+  report("GetEnv", res, JNI_EDETACHED);
+  if (res == JNI_EDETACHED) {
+
+    // Test all of the Invocation API functions
+
+    res = (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void **)&env, NULL);
+    report("AttachCurrentThreadAsDaemon", res, JNI_ERR);
+    res = (*jvm)->AttachCurrentThread(jvm, (void **)&env, NULL);
+    report("AttachCurrentThread", res, JNI_ERR);
+    res = (*jvm)->DetachCurrentThread(jvm);
+    report("DetachCurrentThread", res, JNI_ERR);
+
+    JavaVMInitArgs args;
+    args.version = JNI_VERSION_1_2;
+    res = JNI_GetDefaultJavaVMInitArgs(&args);
+    report("JNI_GetDefaultJavaVMInitArgs", res, JNI_OK);
+
+    JavaVM* jvm_p[1];
+    int nVMs;
+    res = JNI_GetCreatedJavaVMs(jvm_p, 1, &nVMs);
+    report("JNI_GetCreatedJavaVMs", res, JNI_OK);
+    // Whether nVMs is 0 or 1 depends on the termination path
+    if (nVMs == 0 && !using_system_exit) {
+      printf("Found 0 created VMs as expected\n");
+    } else if (nVMs == 1 && using_system_exit) {
+      printf("Found 1 created VM as expected\n");
+    } else {
+      printf("Unexpected number of created VMs: %d\n", nVMs);
+    }
+
+    res = (*jvm)->DestroyJavaVM(jvm);
+    report("DestroyJavaVM", res, JNI_ERR);
+
+    // Failure mode depends on the termination path
+    res = JNI_CreateJavaVM(jvm_p, (void**)&env, &args);
+    report("JNI_CreateJavaVM", res, using_system_exit ? JNI_EEXIST : JNI_ERR);
+  }
+  // else test has already failed
+}
+
+jint JNI_OnLoad(JavaVM *vm, void *reserved) {
+  printf("JNI_OnLoad: registering atexit handler\n");
+  jvm = vm;
+  atexit(at_exit_handler);
+
+  return JNI_VERSION_1_1;
+}
--- a/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibrary.java	Tue Mar 03 03:46:11 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.channels.FileChannel;
-
-public class LoadLibrary {
-
-    public static String testClasses;
-
-    public static void runTest() throws Exception {
-        // create a classloader and load a class that loads a library.
-        MyClassLoader myLoader = new MyClassLoader();
-        Class<?> c = Class.forName("LoadLibraryClass", true, myLoader);
-    }
-
-    public static void main(String[] args) throws Exception {
-        testClasses = args[0];
-        runTest();
-        ClassUnloadCommon.triggerUnloading();
-    }
-
-    public static class MyClassLoader extends ClassLoader {
-
-        public static final String CLASS_NAME = "LoadLibraryClass";
-
-        static ByteBuffer readClassFile(String name) {
-            File f = new File(testClasses, name);
-            try (FileInputStream fin = new FileInputStream(f);
-                 FileChannel fc = fin.getChannel())
-            {
-                return fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
-            } catch (IOException e) {
-                throw new RuntimeException("Can't open file: " + name +
-                                           ", exception: " + e.toString());
-            }
-        }
-
-        protected Class<?> loadClass(String name, boolean resolve)
-            throws ClassNotFoundException {
-            Class<?> c;
-            if (!"LoadLibraryClass".equals(name)) {
-                c = super.loadClass(name, resolve);
-            } else {
-                // should not delegate to the system class loader
-                c = findClass(name);
-                if (resolve) {
-                    resolveClass(c);
-                }
-            }
-            return c;
-        }
-
-        protected Class<?> findClass(String name) throws ClassNotFoundException {
-            if (!"LoadLibraryClass".equals(name)) {
-                throw new ClassNotFoundException("Unexpected class: " + name);
-            }
-            return defineClass(name, readClassFile(name + ".class"), null);
-        }
-    } // MyClassLoader
-
-}
-
-
-class LoadLibraryClass {
-    static {
-        System.loadLibrary("LoadLibraryClass");
-        nTest();
-    }
-    native static void nTest();
-}
--- a/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java	Tue Mar 03 03:46:11 2020 +0000
+++ b/test/hotspot/jtreg/runtime/logging/loadLibraryTest/LoadLibraryTest.java	Tue Mar 03 14:45:47 2020 +0530
@@ -26,24 +26,114 @@
  * @bug 8187305
  * @summary Tests logging of shared library loads and unloads.
  * @library /runtime/testlibrary /test/lib
- * @compile LoadLibrary.java
+ * @build sun.hotspot.WhiteBox
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main LoadLibraryTest
  */
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
+import jtreg.SkippedException;
+
+import sun.hotspot.WhiteBox;
 
 public class LoadLibraryTest {
 
+    public static final String CLASS_NAME = "LoadLibraryTest$LoadLibraryClass";
+
+    private static class LoadLibrary {
+
+        static String testClasses;
+
+        public static void runTest() throws Exception {
+            // create a classloader and load a class that loads a library.
+            MyClassLoader myLoader = new MyClassLoader();
+            Class<?> c = Class.forName(CLASS_NAME, true, myLoader);
+        }
+
+        public static void main(String[] args) throws Exception {
+            testClasses = args[0];
+            runTest();
+            ClassUnloadCommon.triggerUnloading();
+            WhiteBox wb = WhiteBox.getWhiteBox();
+            if (!wb.isClassAlive(CLASS_NAME)) {
+                System.out.println("Class LoadLibraryClass was unloaded");
+            }
+        }
+
+
+        public static class MyClassLoader extends ClassLoader {
+
+            static ByteBuffer readClassFile(String name) {
+                File f = new File(testClasses, name);
+                try (FileInputStream fin = new FileInputStream(f);
+                     FileChannel fc = fin.getChannel())
+                {
+                    return fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+                } catch (IOException e) {
+                    throw new RuntimeException("Can't open file: " + name +
+                                               ", exception: " + e.toString());
+                }
+            }
+
+            protected Class<?> loadClass(String name, boolean resolve)
+                throws ClassNotFoundException {
+                Class<?> c;
+                if (!CLASS_NAME.equals(name)) {
+                    c = super.loadClass(name, resolve);
+                } else {
+                    // should not delegate to the system class loader
+                    c = findClass(name);
+                    if (resolve) {
+                        resolveClass(c);
+                    }
+                }
+                return c;
+            }
+
+            protected Class<?> findClass(String name) throws ClassNotFoundException {
+                if (!CLASS_NAME.equals(name)) {
+                    throw new ClassNotFoundException("Unexpected class: " + name);
+                }
+                return defineClass(name, readClassFile(name + ".class"), null);
+            }
+        } // MyClassLoader
+    }
+
+
+    static class LoadLibraryClass {
+        static {
+            System.loadLibrary("LoadLibraryClass");
+            nTest();
+        }
+        native static void nTest();
+    }
+
+
     public static void main(String... args) throws Exception {
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-            "-Xlog:library=info", "-Djava.library.path=" + System.getProperty("java.library.path"),
-            "LoadLibrary", System.getProperty("test.classes"));
+            "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions",
+            "-XX:+WhiteBoxAPI", "-Xmn8m", "-Xlog:library=info",
+            "-Djava.library.path=" + System.getProperty("java.library.path"),
+            "-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
+            "LoadLibraryTest$LoadLibrary", System.getProperty("test.classes"));
 
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldHaveExitValue(0);
         output.shouldContain("Loaded library");
-        output.shouldContain("Found Java_LoadLibraryClass_nTest in library");
-        output.shouldContain("Unloaded library with handle");
-        output.shouldHaveExitValue(0);
+        output.shouldContain("Found Java_LoadLibraryTest_00024LoadLibraryClass_nTest__ in library");
+        if (output.getOutput().contains("Class LoadLibraryClass was unloaded")) {
+            output.shouldContain("Unloaded library with handle");
+        } else {
+            throw new SkippedException(
+                "Skipping check for library unloading logging because no unloading occurred");
+        }
     }
 }
--- a/test/hotspot/jtreg/runtime/logging/loadLibraryTest/libLoadLibraryClass.c	Tue Mar 03 03:46:11 2020 +0000
+++ b/test/hotspot/jtreg/runtime/logging/loadLibraryTest/libLoadLibraryClass.c	Tue Mar 03 14:45:47 2020 +0530
@@ -27,4 +27,4 @@
 
 #include "jni.h"
 
-JNIEXPORT void JNICALL Java_LoadLibraryClass_nTest(JNIEnv* env, jclass jclazz) { }
+JNIEXPORT void JNICALL Java_LoadLibraryTest_00024LoadLibraryClass_nTest__(JNIEnv* env, jclass jclazz) { }
--- a/test/hotspot/jtreg/runtime/testlibrary/GeneratedClassLoader.java	Tue Mar 03 03:46:11 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,210 +0,0 @@
-/*
- * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.DataInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-import javax.tools.JavaCompiler;
-import javax.tools.ToolProvider;
-
-/**
- * A class loader that generates new classes.
- * The generated classes are made by first emitting java sources with nested
- * static classes, these are then compiled and the class files are read back.
- * Some efforts are made to make the class instances unique and of not insignificant
- * size.
- */
-public class GeneratedClassLoader extends ClassLoader {
-    /**
-     * Holds a pair of class bytecodes and class name (for use with defineClass).
-     */
-    private static class GeneratedClass {
-        public byte[] bytes;
-        public String name;
-        public GeneratedClass(byte[] bytes, String name) {
-            this.bytes = bytes; this.name = name;
-        }
-    }
-
-    /**
-     * Used to uniquely name every class generated.
-     */
-    private static int count = 0;
-    /**
-     * Used to enable/disable keeping the class files and java sources for
-     * the generated classes.
-     */
-    private static boolean deleteFiles = Boolean.parseBoolean(
-        System.getProperty("GeneratedClassLoader.deleteFiles", "true"));
-
-    private static String bigstr =
-        "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
-        + "In facilisis scelerisque vehicula. Donec congue nisi a "
-        + "leo posuere placerat lobortis felis ultrices. Pellentesque "
-        + "habitant morbi tristique senectus et netus et malesuada "
-        + "fames ac turpis egestas. Nam tristique velit at felis "
-        + "iaculis at tempor sem vestibulum. Sed adipiscing lectus "
-        + "non mi molestie sagittis. Morbi eu purus urna. Nam tempor "
-        + "tristique massa eget semper. Mauris cursus, nulla et ornare "
-        + "vehicula, leo dolor scelerisque metus, sit amet rutrum erat "
-        + "sapien quis dui. Nullam eleifend risus et velit accumsan sed "
-        + "suscipit felis pulvinar. Nullam faucibus suscipit gravida. "
-        + "Pellentesque habitant morbi tristique senectus et netus et "
-        + "malesuada fames ac turpis egestas. Nullam ut massa augue, "
-        + "nec viverra mauris.";
-
-    private static int getNextCount() {
-        return count++;
-    }
-
-    ////// end statics
-
-    private JavaCompiler javac;
-    private String nameBase;
-
-    public GeneratedClassLoader() {
-        javac = ToolProvider.getSystemJavaCompiler();
-        nameBase = "TestSimpleClass";
-    }
-
-    private long getBigValue(int which) {
-        // > 65536 is too large to encode in the bytecode
-        // so this will force us to emit a constant pool entry for this int
-        return (long)which + 65537;
-    }
-
-    private String getBigString(int which) {
-        return bigstr + which;
-    }
-
-    private String getClassName(int count) {
-        return nameBase + count;
-    }
-
-    private String generateSource(int count, int sizeFactor, int numClasses) {
-        StringBuilder sb = new StringBuilder();
-        sb.append("public class ").append(getClassName(count)).append("{\n");
-        for (int j = 0; j < numClasses; ++j) {
-            sb.append("public static class ")
-              .append("Class")
-              .append(j)
-              .append("{\n");
-            for (int i = 0; i < sizeFactor; ++i) {
-                int value = i;
-                sb.append("private long field")
-                  .append(i).append(" = ")
-                  .append(getBigValue(value++))
-                  .append(";\n");
-                sb.append("public long method")
-                  .append(i)
-                  .append("() {\n");
-                sb.append("return ")
-                  .append(getBigValue(value++))
-                  .append(";");
-                sb.append("}\n");
-                sb.append("private String str").append(i)
-                  .append(" = \"")
-                  .append(getBigString(i))
-                  .append("\";");
-            }
-            sb.append("\n}");
-        }
-        sb.append("\n}");
-        return sb.toString();
-    }
-
-    private GeneratedClass[] getGeneratedClass(int sizeFactor, int numClasses) throws IOException {
-        int uniqueCount = getNextCount();
-        String src = generateSource(uniqueCount, sizeFactor, numClasses);
-        String className = getClassName(uniqueCount);
-        File file = new File(className + ".java");
-        try (PrintWriter pw = new PrintWriter(new FileWriter(file))) {
-            pw.append(src);
-            pw.flush();
-        }
-        ByteArrayOutputStream err = new ByteArrayOutputStream();
-        int exitcode = javac.run(null, null, err, file.getCanonicalPath());
-        if (exitcode != 0) {
-            // Print Error
-            System.err.print(err);
-            if (err.toString().contains("java.lang.OutOfMemoryError: Java heap space")) {
-              throw new OutOfMemoryError("javac failed with resources exhausted");
-            } else {
-              throw new RuntimeException("javac failure when compiling: " +
-                      file.getCanonicalPath());
-            }
-        } else {
-            if (deleteFiles) {
-                file.delete();
-            }
-        }
-        GeneratedClass[] gc = new GeneratedClass[numClasses];
-        for (int i = 0; i < numClasses; ++i) {
-            String name = className + "$" + "Class" + i;
-            File classFile = new File(name + ".class");
-            byte[] bytes;
-            try (DataInputStream dis = new DataInputStream(new FileInputStream(classFile))) {
-                bytes = new byte[dis.available()];
-                dis.readFully(bytes);
-            }
-            if (deleteFiles) {
-                classFile.delete();
-            }
-            gc[i] = new GeneratedClass(bytes, name);
-        }
-        if (deleteFiles) {
-            new File(className + ".class").delete();
-        }
-        return gc;
-    }
-
-    /**
-     * Generate a single class, compile it and load it.
-     * @param sizeFactor Fuzzy measure of how large the class should be.
-     * @return the Class instance.
-     * @throws IOException
-     */
-    public Class<?> generateClass(int sizeFactor) throws IOException {
-        return getGeneratedClasses(sizeFactor, 1)[0];
-    }
-
-    /**
-     * Generate several classes, compile and load them.
-     * @param sizeFactor Fuzzy measure of how large each class should be.
-     * @param numClasses The number of classes to create
-     * @return an array of the Class instances.
-     * @throws IOException
-     */
-    public Class<?>[] getGeneratedClasses(int sizeFactor, int numClasses) throws IOException {
-        GeneratedClass[] gc = getGeneratedClass(sizeFactor, numClasses);
-        Class<?>[] classes = new Class[numClasses];
-        for (int i = 0; i < numClasses; ++i) {
-            classes[i] = defineClass(gc[i].name, gc[i].bytes, 0 , gc[i].bytes.length);
-        }
-        return classes;
-    }
-}
--- a/test/jdk/java/util/UUID/UUIDTest.java	Tue Mar 03 03:46:11 2020 +0000
+++ b/test/jdk/java/util/UUID/UUIDTest.java	Tue Mar 03 14:45:47 2020 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4173528 5068772 8148936
+ * @bug 4173528 5068772 8148936 8196334
  * @summary Unit tests for java.util.UUID
  * @key randomness
  * @run main/othervm -XX:+CompactStrings UUIDTest
@@ -95,8 +95,9 @@
     private static void stringTest() throws Exception {
         for (int i=0; i<100; i++) {
             UUID u1 = UUID.randomUUID();
-            UUID u2 = UUID.fromString(u1.toString());
-            if (!u1.equals(u2))
+            UUID u2 = UUID.fromString(u1.toString().toLowerCase());
+            UUID u3 = UUID.fromString(u1.toString().toUpperCase());
+            if (!u1.equals(u2) || !u1.equals(u3))
                 throw new Exception("UUID -> string -> UUID failed");
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/jdk/jfr/event/runtime/TestMetaspaceAllocationFailure.java	Tue Mar 03 14:45:47 2020 +0530
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary Test jdk.MetaspaceAllocationFailure event
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc java.compiler
+ * @run main/othervm -Xmx1G -XX:MaxMetaspaceSize=200M
+ *      -XX:StartFlightRecording -Xshare:off
+ *      jdk.jfr.event.runtime.TestMetaspaceAllocationFailure
+ * @run main/othervm -Xmx1G -XX:CompressedClassSpaceSize=200M
+ *      -XX:StartFlightRecording -Xshare:off
+ *      jdk.jfr.event.runtime.TestMetaspaceAllocationFailure
+ */
+package jdk.jfr.event.runtime;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import jdk.jfr.consumer.RecordingStream;
+import jdk.test.lib.classloader.GeneratingCompilingClassLoader;
+import jdk.test.lib.Asserts;
+
+
+public class TestMetaspaceAllocationFailure {
+    public static void main(String... args) throws Exception {
+        AtomicBoolean eventArrived = new AtomicBoolean(false);
+        try (RecordingStream r = new RecordingStream()) {
+            r.onEvent("jdk.MetaspaceAllocationFailure", e -> eventArrived.set(true));
+            r.startAsync();
+
+            try {
+                while (!eventArrived.get()) {
+                    GeneratingCompilingClassLoader cl = new GeneratingCompilingClassLoader();
+                    cl.getGeneratedClasses(50, 20);
+                    Thread.sleep(100);
+                    System.out.println("Iteration");
+                }
+                System.gc();
+                System.out.println("main(): Event arrived");
+            } catch (OutOfMemoryError e) {
+                System.gc();
+                System.out.println("main(): OutOfMemoryError (expected): " + e.getMessage());
+            }
+
+            Asserts.assertTrue(eventArrived.get());
+        }
+    }
+}
--- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java	Tue Mar 03 03:46:11 2020 +0000
+++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java	Tue Mar 03 14:45:47 2020 +0530
@@ -261,6 +261,12 @@
             add("utnuserfirstobjectca [jdk]");
             // Valid until: Tue May 26 00:00:00 GMT 2020
             add("keynectisrootca [jdk]");
+            // Valid until: Sat May 30 10:38:31 GMT 2020
+            add("addtrustexternalca [jdk]");
+            // Valid until: Sat May 30 10:48:38 GMT 2020
+            add("addtrustclass1ca [jdk]");
+            // Valid until: Sat May 30 10:44:50 GMT 2020
+            add("addtrustqualifiedca [jdk]");
         }
     };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/jdk/test/lib/classloader/GeneratingCompilingClassLoader.java	Tue Mar 03 14:45:47 2020 +0530
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
+ * 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.test.lib.classloader;
+
+import java.io.DataInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+/**
+ * A class loader that generates new classes.
+ * The generated classes are made by first emitting java sources with nested
+ * static classes, these are then compiled and the class files are read back.
+ * Some efforts are made to make the class instances unique and of not insignificant
+ * size.
+ */
+public class GeneratingCompilingClassLoader extends ClassLoader {
+    /**
+     * Holds a pair of class bytecodes and class name (for use with defineClass).
+     */
+    private static class GeneratedClass {
+        public byte[] bytes;
+        public String name;
+        public GeneratedClass(byte[] bytes, String name) {
+            this.bytes = bytes; this.name = name;
+        }
+    }
+
+    /**
+     * Used to uniquely name every class generated.
+     */
+    private static int count = 0;
+    /**
+     * Used to enable/disable keeping the class files and java sources for
+     * the generated classes.
+     */
+    private static boolean deleteFiles = Boolean.parseBoolean(
+        System.getProperty("GeneratingCompilingClassLoader.deleteFiles", "true"));
+
+    private static String bigstr =
+        "Lorem ipsum dolor sit amet, consectetur adipiscing elit. "
+        + "In facilisis scelerisque vehicula. Donec congue nisi a "
+        + "leo posuere placerat lobortis felis ultrices. Pellentesque "
+        + "habitant morbi tristique senectus et netus et malesuada "
+        + "fames ac turpis egestas. Nam tristique velit at felis "
+        + "iaculis at tempor sem vestibulum. Sed adipiscing lectus "
+        + "non mi molestie sagittis. Morbi eu purus urna. Nam tempor "
+        + "tristique massa eget semper. Mauris cursus, nulla et ornare "
+        + "vehicula, leo dolor scelerisque metus, sit amet rutrum erat "
+        + "sapien quis dui. Nullam eleifend risus et velit accumsan sed "
+        + "suscipit felis pulvinar. Nullam faucibus suscipit gravida. "
+        + "Pellentesque habitant morbi tristique senectus et netus et "
+        + "malesuada fames ac turpis egestas. Nullam ut massa augue, "
+        + "nec viverra mauris.";
+
+    private static int getNextCount() {
+        return count++;
+    }
+
+    ////// end statics
+
+    private JavaCompiler javac;
+    private String nameBase;
+
+    public GeneratingCompilingClassLoader() {
+        javac = ToolProvider.getSystemJavaCompiler();
+        nameBase = "TestSimpleClass";
+    }
+
+    private long getBigValue(int which) {
+        // > 65536 is too large to encode in the bytecode
+        // so this will force us to emit a constant pool entry for this int
+        return (long)which + 65537;
+    }
+
+    private String getBigString(int which) {
+        return bigstr + which;
+    }
+
+    private String getClassName(int count) {
+        return nameBase + count;
+    }
+
+    private String generateSource(int count, int sizeFactor, int numClasses) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("public class ").append(getClassName(count)).append("{\n");
+        for (int j = 0; j < numClasses; ++j) {
+            sb.append("public static class ")
+              .append("Class")
+              .append(j)
+              .append("{\n");
+            for (int i = 0; i < sizeFactor; ++i) {
+                int value = i;
+                sb.append("private long field")
+                  .append(i).append(" = ")
+                  .append(getBigValue(value++))
+                  .append(";\n");
+                sb.append("public long method")
+                  .append(i)
+                  .append("() {\n");
+                sb.append("return ")
+                  .append(getBigValue(value++))
+                  .append(";");
+                sb.append("}\n");
+                sb.append("private String str").append(i)
+                  .append(" = \"")
+                  .append(getBigString(i))
+                  .append("\";");
+            }
+            sb.append("\n}");
+        }
+        sb.append("\n}");
+        return sb.toString();
+    }
+
+    private GeneratedClass[] getGeneratedClass(int sizeFactor, int numClasses) throws IOException {
+        int uniqueCount = getNextCount();
+        String src = generateSource(uniqueCount, sizeFactor, numClasses);
+        String className = getClassName(uniqueCount);
+        File file = new File(className + ".java");
+        try (PrintWriter pw = new PrintWriter(new FileWriter(file))) {
+            pw.append(src);
+            pw.flush();
+        }
+        ByteArrayOutputStream err = new ByteArrayOutputStream();
+        int exitcode = javac.run(null, null, err, file.getCanonicalPath());
+        if (exitcode != 0) {
+            // Print Error
+            System.err.print(err);
+            if (err.toString().contains("java.lang.OutOfMemoryError: Java heap space")) {
+              throw new OutOfMemoryError("javac failed with resources exhausted");
+            } else {
+              throw new RuntimeException("javac failure when compiling: " +
+                      file.getCanonicalPath());
+            }
+        } else {
+            if (deleteFiles) {
+                file.delete();
+            }
+        }
+        GeneratedClass[] gc = new GeneratedClass[numClasses];
+        for (int i = 0; i < numClasses; ++i) {
+            String name = className + "$" + "Class" + i;
+            File classFile = new File(name + ".class");
+            byte[] bytes;
+            try (DataInputStream dis = new DataInputStream(new FileInputStream(classFile))) {
+                bytes = new byte[dis.available()];
+                dis.readFully(bytes);
+            }
+            if (deleteFiles) {
+                classFile.delete();
+            }
+            gc[i] = new GeneratedClass(bytes, name);
+        }
+        if (deleteFiles) {
+            new File(className + ".class").delete();
+        }
+        return gc;
+    }
+
+    /**
+     * Generate a single class, compile it and load it.
+     * @param sizeFactor Fuzzy measure of how large the class should be.
+     * @return the Class instance.
+     * @throws IOException
+     */
+    public Class<?> generateClass(int sizeFactor) throws IOException {
+        return getGeneratedClasses(sizeFactor, 1)[0];
+    }
+
+    /**
+     * Generate several classes, compile and load them.
+     * @param sizeFactor Fuzzy measure of how large each class should be.
+     * @param numClasses The number of classes to create
+     * @return an array of the Class instances.
+     * @throws IOException
+     */
+    public Class<?>[] getGeneratedClasses(int sizeFactor, int numClasses) throws IOException {
+        GeneratedClass[] gc = getGeneratedClass(sizeFactor, numClasses);
+        Class<?>[] classes = new Class[numClasses];
+        for (int i = 0; i < numClasses; ++i) {
+            classes[i] = defineClass(gc[i].name, gc[i].bytes, 0 , gc[i].bytes.length);
+        }
+        return classes;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/bench/java/nio/DatagramChannelSendReceive.java	Tue Mar 03 14:45:47 2020 +0530
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * 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 org.openjdk.bench.java.net;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
+
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.DatagramChannel;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Benchmark DatagramChannel send/receive.
+ */
+
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MICROSECONDS)
+@State(Scope.Thread)
+public class DatagramChannelSendReceive {
+
+    private int counter = 0;
+
+    private ByteBuffer buf;
+    private DatagramChannel channel1, channel2, connectedWriteChannel,
+            connectedReadChannel, multipleReceiveChannel, multipleSendChannel;
+    private DatagramChannel[] dca;
+
+    @Param({"128", "512", "2048", "8192", "32768"})
+    public int size;
+    @Param({"4"})
+    public int channelCount;
+    @Param({"true"})
+    public boolean useDirectBuffer;
+
+    @Setup
+    public void setUp() throws IOException {
+        buf = (useDirectBuffer) ? ByteBuffer.allocateDirect(size) :
+                ByteBuffer.allocate(size);
+        buf.clear();
+
+        InetSocketAddress addr =
+                new InetSocketAddress(InetAddress.getLoopbackAddress(), 0);
+
+        // single send - same socket; different sockets
+        channel1 = DatagramChannel.open().bind(addr);
+        channel2 = DatagramChannel.open().bind(addr);
+
+        // connected read / write
+        connectedWriteChannel = DatagramChannel.open().bind(addr);
+        connectedReadChannel = DatagramChannel.open().bind(addr);
+        connectedWriteChannel.connect(connectedReadChannel.getLocalAddress());
+        connectedReadChannel.connect(connectedWriteChannel.getLocalAddress());
+
+        // multiple senders / multiple receivers
+        dca = new DatagramChannel[channelCount];
+        for (int i = 0; i < dca.length; i++) {
+            dca[i] = DatagramChannel.open().bind(addr);
+        }
+        multipleReceiveChannel = DatagramChannel.open().bind(addr);
+        multipleSendChannel = DatagramChannel.open().bind(addr);
+    }
+
+    // same sender receiver
+    @Benchmark
+    public void sendReceiveSingleSocket() throws IOException {
+        buf.clear();
+        channel1.send(buf, channel1.getLocalAddress());
+        buf.clear();
+        channel1.receive(buf);
+    }
+
+    // single sender, single receiver
+    @Benchmark
+    public void sendReceive() throws IOException {
+        buf.clear();
+        channel1.send(buf, channel2.getLocalAddress());
+        buf.clear();
+        channel2.receive(buf);
+    }
+
+    // connected sender receiver
+    @Benchmark
+    public void sendReceiveConnected() throws IOException {
+        buf.clear();
+        connectedWriteChannel.write(buf);
+        buf.clear();
+        connectedReadChannel.read(buf);
+    }
+
+    // multiple senders, single receiver
+    @Benchmark
+    public void sendMultiple() throws IOException {
+        int i = counter;
+        buf.clear();
+        dca[i].send(buf, multipleReceiveChannel.getLocalAddress());
+        buf.clear();
+        multipleReceiveChannel.receive(buf);
+        counter = ++i % dca.length;
+    }
+
+    // single sender, multiple receivers
+    @Benchmark
+    public void receiveMultiple() throws IOException {
+        int i = counter;
+        buf.clear();
+        multipleSendChannel.send(buf, dca[i].getLocalAddress());
+        buf.clear();
+        dca[i].receive(buf);
+        counter = ++i % dca.length;
+    }
+
+    @TearDown
+    public void tearDown() throws IOException {
+        channel1.close();
+        channel2.close();
+        connectedWriteChannel.close();
+        connectedReadChannel.close();
+        multipleReceiveChannel.close();
+        multipleSendChannel.close();
+        for (DatagramChannel dc : dca) {
+            dc.close();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/micro/org/openjdk/bench/java/util/UUIDBench.java	Tue Mar 03 14:45:47 2020 +0530
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * 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 org.openjdk.bench.java.util;
+
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import org.openjdk.jmh.annotations.*;
+
+@State(Scope.Thread)
+@OutputTimeUnit(TimeUnit.MICROSECONDS)
+@Fork(value = 3)
+@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS)
+@Measurement(iterations = 5, time = 2, timeUnit = TimeUnit.SECONDS)
+public class UUIDBench {
+
+    @Param("20000")
+    private int size;
+
+    private UUID[] uuids;
+
+    private String[] uuidStrings;
+
+    private int index = 0;
+
+    @Setup
+    public void setup() {
+        uuids = new UUID[size];
+        uuidStrings = new String[size];
+        for (int i = 0; i < this.uuidStrings.length; i++) {
+            final UUID uuid = UUID.randomUUID();
+
+            this.uuids[i] = uuid;
+            this.uuidStrings[i] = uuid.toString();
+        }
+    }
+
+    @Setup(Level.Iteration)
+    public void setupIteration() {
+        index++;
+        if (index >= size) {
+            index = 0;
+        }
+    }
+
+    @Benchmark
+    public UUID fromString() {
+        return UUID.fromString(uuidStrings[index]);
+    }
+
+    @Benchmark
+    public String toString() {
+        return uuids[index].toString();
+    }
+}