changeset 57757:7764761b3a98 nestmates

8230816: Consolidate classData and dynamic_nest_host into a new ClassLoadInfo data structure Summary: create ClassInstanceInfo and ClassLoadInfo classes to consolidate parameter types Reviewed-by: lfoltan, mchung
author hseigel
date Tue, 12 Nov 2019 20:48:39 +0000
parents 3696d32b89d9
children 0340c109eca1
files src/hotspot/share/classfile/classFileParser.cpp src/hotspot/share/classfile/classFileParser.hpp src/hotspot/share/classfile/classLoader.cpp src/hotspot/share/classfile/classLoaderExt.cpp src/hotspot/share/classfile/klassFactory.cpp src/hotspot/share/classfile/klassFactory.hpp src/hotspot/share/classfile/systemDictionary.cpp src/hotspot/share/classfile/systemDictionary.hpp src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp src/hotspot/share/prims/jvm.cpp src/hotspot/share/prims/jvmtiRedefineClasses.cpp src/hotspot/share/prims/unsafe.cpp
diffstat 12 files changed, 166 insertions(+), 136 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/classFileParser.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -5436,8 +5436,7 @@
 }
 
 InstanceKlass* ClassFileParser::create_instance_klass(bool changed_by_loadhook,
-                                                      InstanceKlass* dynamic_nest_host,
-                                                      Handle classData,
+                                                      const ClassInstanceInfo& cl_inst_info,
                                                       TRAPS) {
   if (_klass != NULL) {
     return _klass;
@@ -5446,7 +5445,7 @@
   InstanceKlass* const ik =
     InstanceKlass::allocate_instance_klass(*this, CHECK_NULL);
 
-  fill_instance_klass(ik, changed_by_loadhook, dynamic_nest_host, classData, CHECK_NULL);
+  fill_instance_klass(ik, changed_by_loadhook, cl_inst_info, CHECK_NULL);
 
   assert(_klass == ik, "invariant");
 
@@ -5474,8 +5473,7 @@
 
 void ClassFileParser::fill_instance_klass(InstanceKlass* ik,
                                           bool changed_by_loadhook,
-                                          InstanceKlass* dynamic_nest_host,
-                                          Handle classData,
+                                          const ClassInstanceInfo& cl_inst_info,
                                           TRAPS) {
   assert(ik != NULL, "invariant");
 
@@ -5513,8 +5511,8 @@
   apply_parsed_class_metadata(ik, _java_fields_count, CHECK);
 
   // can only set dynamic nest-host after static nest information is set
-  if (dynamic_nest_host != NULL) {
-    ik->set_nest_host(dynamic_nest_host, CHECK);
+  if (cl_inst_info.dynamic_nest_host() != NULL) {
+    ik->set_nest_host(cl_inst_info.dynamic_nest_host(), CHECK);
   }
 
   // note that is not safe to use the fields in the parser from this point on
@@ -5637,7 +5635,7 @@
                                  Handle(THREAD, _loader_data->class_loader()),
                                  module_handle,
                                  _protection_domain,
-                                 classData,
+                                 cl_inst_info.class_data(),
                                  CHECK);
 
   assert(_all_mirandas != NULL, "invariant");
--- a/src/hotspot/share/classfile/classFileParser.hpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/classfile/classFileParser.hpp	Tue Nov 12 20:48:39 2019 +0000
@@ -36,6 +36,7 @@
 class Array;
 class ClassFileStream;
 class ClassLoaderData;
+class ClassInstanceInfo;
 class CompressedLineNumberWriteStream;
 class ConstMethod;
 class FieldInfo;
@@ -177,8 +178,7 @@
   void fix_unsafe_anonymous_class_name(TRAPS);
 
   void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH,
-                           InstanceKlass* dynamic_nest_host,
-                           Handle classData, TRAPS);
+                           const ClassInstanceInfo& cl_inst_info, TRAPS);
 
   void set_klass(InstanceKlass* instance);
 
@@ -505,7 +505,7 @@
 
   ~ClassFileParser();
 
-  InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, InstanceKlass* dynamic_nest_host, Handle classData, TRAPS);
+  InstanceKlass* create_instance_klass(bool cf_changed_in_CFLH, const ClassInstanceInfo& cl_inst_info, TRAPS);
 
   const ClassFileStream* clone_stream() const;
 
--- a/src/hotspot/share/classfile/classLoader.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/classfile/classLoader.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -1314,17 +1314,12 @@
 
   ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
   Handle protection_domain;
+  ClassLoadInfo cl_info(protection_domain);
 
   InstanceKlass* result = KlassFactory::create_from_stream(stream,
                                                            name,
                                                            loader_data,
-                                                           protection_domain,
-                                                           NULL,  // unsafe_anonymous_host
-                                                           NULL,  // cp_patches
-                                                           false, // is_hidden
-                                                           false, // can_access_vm_annotations
-                                                           NULL,  // dynamic_nest_host
-                                                           Handle(), // classData
+                                                           cl_info,
                                                            THREAD);
   if (HAS_PENDING_EXCEPTION) {
     if (DumpSharedSpaces) {
--- a/src/hotspot/share/classfile/classLoaderExt.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/classfile/classLoaderExt.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -284,17 +284,12 @@
 
   ClassLoaderData* loader_data = ClassLoaderData::the_null_class_loader_data();
   Handle protection_domain;
+  ClassLoadInfo cl_info(protection_domain);
 
   InstanceKlass* result = KlassFactory::create_from_stream(stream,
                                                            name,
                                                            loader_data,
-                                                           protection_domain,
-                                                           NULL,  // unsafe_anonymous_host
-                                                           NULL,  // cp_patches
-                                                           false, // is_hidden
-                                                           false, // can_access_vm_annotations
-                                                           NULL,  // dynamic_nest_host
-                                                           Handle(), // classData
+                                                           cl_info,
                                                            THREAD);
 
   if (HAS_PENDING_EXCEPTION) {
--- a/src/hotspot/share/classfile/klassFactory.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/classfile/klassFactory.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -89,9 +89,9 @@
                              false, // can_access_vm_annotations
                              ClassFileParser::BROADCAST, // publicity level
                              CHECK_NULL);
+      ClassInstanceInfo cl_inst_info;
       InstanceKlass* new_ik = parser.create_instance_klass(true, // changed_by_loadhook
-                                                           NULL,  // dynamic_nest_host
-                                                           Handle(), // classData
+                                                           cl_inst_info,  // dynamic_nest_host and classData
                                                            CHECK_NULL);
 
       if (cached_class_file != NULL) {
@@ -171,13 +171,7 @@
 InstanceKlass* KlassFactory::create_from_stream(ClassFileStream* stream,
                                                 Symbol* name,
                                                 ClassLoaderData* loader_data,
-                                                Handle protection_domain,
-                                                const InstanceKlass* unsafe_anonymous_host,
-                                                GrowableArray<Handle>* cp_patches,
-                                                const bool is_hidden,
-                                                const bool can_access_vm_annotations,
-                                                InstanceKlass* dynamic_nest_host,
-                                                Handle classData,
+                                                const ClassLoadInfo& cl_info,
                                                 TRAPS) {
   assert(stream != NULL, "invariant");
   assert(loader_data != NULL, "invariant");
@@ -193,15 +187,15 @@
   // increment counter
   THREAD->statistical_info().incr_define_class_count();
 
-  assert(!(is_hidden && (unsafe_anonymous_host != NULL)),
+  assert(!(cl_info.is_hidden() && (cl_info.unsafe_anonymous_host() != NULL)),
          "hidden class has an anonymous host");
 
   // Skip this processing for VM hidden or anonymous classes
-  if (!is_hidden && (unsafe_anonymous_host == NULL)) {
+  if (!cl_info.is_hidden() && (cl_info.unsafe_anonymous_host() == NULL)) {
     stream = check_class_file_load_hook(stream,
                                         name,
                                         loader_data,
-                                        protection_domain,
+                                        cl_info.protection_domain(),
                                         &cached_class_file,
                                         CHECK_NULL);
   }
@@ -209,16 +203,21 @@
   ClassFileParser parser(stream,
                          name,
                          loader_data,
-                         protection_domain,
-                         unsafe_anonymous_host,
-                         cp_patches,
-                         is_hidden,
-                         can_access_vm_annotations,
+                         cl_info.protection_domain(),
+                         cl_info.unsafe_anonymous_host(),
+                         cl_info.cp_patches(),
+                         cl_info.is_hidden(),
+                         cl_info.can_access_vm_annotations(),
                          ClassFileParser::BROADCAST, // publicity level
                          CHECK_NULL);
 
-  InstanceKlass* result = parser.create_instance_klass(old_stream != stream, dynamic_nest_host, classData, CHECK_NULL);
-  assert(result == parser.create_instance_klass(old_stream != stream, NULL, classData, THREAD), "invariant");
+  const ClassInstanceInfo* cl_inst_info = cl_info.class_hidden_info_ptr();
+  InstanceKlass* result = parser.create_instance_klass(old_stream != stream, *cl_inst_info, CHECK_NULL);
+#ifdef ASSERT
+  // Need a NULL dynamic_nest_host here otherwise set_nest_host() may assert.
+  ClassInstanceInfo cl_inst_info_null(NULL, cl_inst_info->class_data());
+  assert(result == parser.create_instance_klass(old_stream != stream, cl_inst_info_null, THREAD), "invariant");
+#endif
 
   if (result == NULL) {
     return NULL;
--- a/src/hotspot/share/classfile/klassFactory.hpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/classfile/klassFactory.hpp	Tue Nov 12 20:48:39 2019 +0000
@@ -30,6 +30,7 @@
 
 class ClassFileStream;
 class ClassLoaderData;
+class ClassLoadInfo;
 template <typename>
 class GrowableArray;
 class Klass;
@@ -71,13 +72,7 @@
   static InstanceKlass* create_from_stream(ClassFileStream* stream,
                                            Symbol* name,
                                            ClassLoaderData* loader_data,
-                                           Handle protection_domain,
-                                           const InstanceKlass* unsafe_anonymous_host,
-                                           GrowableArray<Handle>* cp_patches,
-                                           const bool is_hidden,
-                                           const bool can_access_vm_annotations,
-                                           InstanceKlass* dynamic_nest_host,
-                                           Handle classData,
+                                           const ClassLoadInfo& cl_info,
                                            TRAPS);
  public:
   static InstanceKlass* check_shared_class_file_load_hook(
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -113,6 +113,46 @@
 
 const int defaultProtectionDomainCacheSize = 1009;
 
+ClassLoadInfo::ClassLoadInfo() {
+  _protection_domain = Handle();
+  _unsafe_anonymous_host = NULL;
+  _cp_patches = NULL;
+  _class_hidden_info._dynamic_nest_host = NULL;
+  _class_hidden_info._class_data = Handle();
+  _is_hidden = false;
+  _is_weak_hidden = false;
+  _can_access_vm_annotations = false;
+}
+
+ClassLoadInfo::ClassLoadInfo(Handle protection_domain) {
+  _protection_domain = protection_domain;
+  _unsafe_anonymous_host = NULL;
+  _cp_patches = NULL;
+  _class_hidden_info._dynamic_nest_host = NULL;
+  _class_hidden_info._class_data = Handle();
+  _is_hidden = false;
+  _is_weak_hidden = false;
+  _can_access_vm_annotations = false;
+}
+
+ClassLoadInfo::ClassLoadInfo(Handle protection_domain,
+                             const InstanceKlass* unsafe_anonymous_host,
+                             GrowableArray<Handle>* cp_patches,
+                             InstanceKlass* dynamic_nest_host,
+                             Handle class_data,
+                             bool is_hidden,
+                             bool is_weak_hidden,
+                             bool can_access_vm_annotations) {
+  _protection_domain = protection_domain;
+  _unsafe_anonymous_host = unsafe_anonymous_host;
+  _cp_patches = cp_patches;
+  _class_hidden_info._dynamic_nest_host = dynamic_nest_host;
+  _class_hidden_info._class_data = class_data;
+  _is_hidden = is_hidden;
+  _is_weak_hidden = is_weak_hidden;
+  _can_access_vm_annotations = can_access_vm_annotations;
+}
+
 // ----------------------------------------------------------------------------
 // Java-level SystemLoader and PlatformLoader
 
@@ -987,31 +1027,25 @@
 // and redefineclasses. RedefinedClasses do not add to the class hierarchy.
 InstanceKlass* SystemDictionary::parse_stream(Symbol* class_name,
                                               Handle class_loader,
-                                              Handle protection_domain,
                                               ClassFileStream* st,
-                                              const InstanceKlass* unsafe_anonymous_host,
-                                              GrowableArray<Handle>* cp_patches,
-                                              const bool is_hidden,
-                                              const bool is_weakhidden,
-                                              const bool can_access_vm_annotations,
-                                              InstanceKlass* dynamic_nest_host,
-                                              Handle classData,
+                                              const ClassLoadInfo& cl_info,
                                               TRAPS) {
 
   EventClassLoad class_load_start_event;
 
   ClassLoaderData* loader_data;
 
-  if (unsafe_anonymous_host != NULL) {
+  if (cl_info.unsafe_anonymous_host() != NULL) {
     // - for unsafe anonymous class: create a new short-lived CLD that uses the same
     //                               class loader as the unsafe_anonymous_host.
-    guarantee(unsafe_anonymous_host->class_loader() == class_loader(), "should be the same");
+    guarantee(cl_info.unsafe_anonymous_host()->class_loader() == class_loader(),
+              "should be the same");
     loader_data = ClassLoaderData::shortlived_class_loader_data(class_loader);
-  } else if (is_hidden) {
+  } else if (cl_info.is_hidden()) {
     // - for weak hidden class: create a new short-lived CLD whose loader is
     //                               the Lookup class' loader.
     // - for hidden class: add the class to the Lookup class' loader's CLD.
-    if (is_weakhidden) {
+    if (cl_info.is_weak_hidden()) {
       loader_data = ClassLoaderData::shortlived_class_loader_data(class_loader);
     } else {
       // This hidden class goes into the regular CLD pool for this loader.
@@ -1032,19 +1066,13 @@
   InstanceKlass* k = KlassFactory::create_from_stream(st,
                                                       class_name,
                                                       loader_data,
-                                                      protection_domain,
-                                                      unsafe_anonymous_host,
-                                                      cp_patches,
-                                                      is_hidden,
-                                                      can_access_vm_annotations,
-                                                      dynamic_nest_host,
-                                                      classData,
+                                                      cl_info,
                                                       CHECK_NULL);
 
-  if ((is_hidden || (unsafe_anonymous_host != NULL)) && k != NULL) {
+  if ((cl_info.is_hidden() || (cl_info.unsafe_anonymous_host() != NULL)) && k != NULL) {
     // Weak hidden and unsafe anonymous classes must update ClassLoaderData holder
     // so that they can be unloaded when the mirror is no longer referenced.
-    if (is_weakhidden || (unsafe_anonymous_host != NULL)) {
+    if (cl_info.is_weak_hidden() || (cl_info.unsafe_anonymous_host() != NULL)) {
       k->class_loader_data()->initialize_holder(Handle(THREAD, k->java_mirror()));
     }
 
@@ -1059,8 +1087,8 @@
 
     // Rewrite and patch constant pool here.
     k->link_class(CHECK_NULL);
-    if (cp_patches != NULL) {
-      k->constants()->patch_resolved_references(cp_patches);
+    if (cl_info.cp_patches() != NULL) {
+      k->constants()->patch_resolved_references(cl_info.cp_patches());
     }
 
     // Initialize it now, since nobody else will.
@@ -1076,7 +1104,7 @@
       post_class_load_event(&class_load_start_event, k, loader_data);
     }
   }
-  assert(unsafe_anonymous_host != NULL || NULL == cp_patches,
+  assert(cl_info.unsafe_anonymous_host() != NULL || NULL == cl_info.cp_patches(),
          "cp_patches only found with unsafe_anonymous_host");
 
   return k;
@@ -1132,17 +1160,16 @@
     if (st->buffer() == NULL) {
       return NULL;
     }
-    k = KlassFactory::create_from_stream(st,
-                                         class_name,
-                                         loader_data,
-                                         protection_domain,
-                                         NULL,  // unsafe_anonymous_host
-                                         NULL,  // cp_patches
-                                         false, // is_hidden
-                                         false, // can_access_vm_annotations
-                                         dynamic_nest_host,
-                                         Handle(), // classData
-                                         CHECK_NULL);
+    ClassLoadInfo cl_info(protection_domain,
+                          NULL,     // unsafe_anonymous_host
+                          NULL,     // cp_patches
+                          dynamic_nest_host,
+                          Handle(), // classData
+                          false,    // is_hidden
+                          false,    // is_weak_hidden
+                          false);   // can_access_vm_annotations
+
+    k = KlassFactory::create_from_stream(st, class_name, loader_data, cl_info, CHECK_NULL);
   }
 
   assert(k != NULL, "no klass created");
--- a/src/hotspot/share/classfile/systemDictionary.hpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Tue Nov 12 20:48:39 2019 +0000
@@ -34,6 +34,53 @@
 #include "runtime/signature.hpp"
 #include "utilities/hashtable.hpp"
 
+class ClassInstanceInfo : public StackObj {
+ private:
+  InstanceKlass* _dynamic_nest_host;
+  Handle _class_data;
+
+ public:
+  ClassInstanceInfo() {
+    _dynamic_nest_host = NULL;
+    _class_data = Handle();
+  }
+  ClassInstanceInfo(InstanceKlass* dynamic_nest_host, Handle class_data) {
+    _dynamic_nest_host = dynamic_nest_host;
+    _class_data = class_data;
+  }
+
+  InstanceKlass* dynamic_nest_host() const { return _dynamic_nest_host; }
+  Handle class_data() const { return _class_data; }
+  friend class ClassLoadInfo;
+};
+
+class ClassLoadInfo : public StackObj {
+ private:
+  Handle                 _protection_domain;
+  const InstanceKlass*   _unsafe_anonymous_host;
+  GrowableArray<Handle>* _cp_patches;
+  ClassInstanceInfo      _class_hidden_info;
+  bool                   _is_hidden;
+  bool                   _is_weak_hidden;
+  bool                   _can_access_vm_annotations;
+
+ public:
+  ClassLoadInfo();
+  ClassLoadInfo(Handle protection_domain);
+  ClassLoadInfo(Handle protection_domain, const InstanceKlass* unsafe_anonymous_host,
+                GrowableArray<Handle>* cp_patches, InstanceKlass* dynamic_nest_host,
+                Handle class_data, bool is_hidden, bool is_weak_hidden,
+                bool can_access_vm_annotations);
+
+  Handle protection_domain()             const { return _protection_domain; }
+  const InstanceKlass* unsafe_anonymous_host() const { return _unsafe_anonymous_host; }
+  GrowableArray<Handle>* cp_patches()    const { return _cp_patches; }
+  const ClassInstanceInfo* class_hidden_info_ptr() const { return &_class_hidden_info; }
+  bool is_hidden()                       const { return _is_hidden; }
+  bool is_weak_hidden()                  const { return _is_weak_hidden; }
+  bool can_access_vm_annotations()       const { return _can_access_vm_annotations; }
+};
+
 // The dictionary in each ClassLoaderData stores all loaded classes, either
 // initiatied by its class loader or defined by its class loader:
 //
@@ -268,39 +315,10 @@
                                               bool is_superclass,
                                               TRAPS);
 
-  // Parse new stream. This won't update the dictionary or
-  // class hierarchy, simply parse the stream. Used by JVMTI RedefineClasses.
-  // Also used by Unsafe_DefineAnonymousClass
   static InstanceKlass* parse_stream(Symbol* class_name,
                                      Handle class_loader,
-                                     Handle protection_domain,
                                      ClassFileStream* st,
-                                     InstanceKlass* dynamic_nest_host,
-                                     TRAPS) {
-    return parse_stream(class_name,
-                        class_loader,
-                        protection_domain,
-                        st,
-                        NULL,  // unsafe_anonymous_host
-                        NULL,  // cp_patches
-                        false, // is_hidden
-                        false, // is_weakhidden
-                        false, // can_access_vm_annotations
-                        dynamic_nest_host,
-                        Handle(),  // classData
-                        THREAD);
-  }
-  static InstanceKlass* parse_stream(Symbol* class_name,
-                                     Handle class_loader,
-                                     Handle protection_domain,
-                                     ClassFileStream* st,
-                                     const InstanceKlass* unsafe_anonymous_host,
-                                     GrowableArray<Handle>* cp_patches,
-                                     const bool is_hidden,
-                                     const bool is_weakhidden,
-                                     const bool can_access_vm_annotations,
-                                     InstanceKlass* dynamic_nest_host,
-                                     Handle classData,
+                                     const ClassLoadInfo& cl_info,
                                      TRAPS);
 
   // Resolve from stream (called by jni_DefineClass and JVM_DefineClass)
--- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -1475,8 +1475,8 @@
     CLEAR_PENDING_EXCEPTION;
     return NULL;
   }
-  InstanceKlass* const new_ik = new_parser.create_instance_klass(false, NULL,
-                                                                 Handle(), THREAD);
+  ClassInstanceInfo cl_inst_info;
+  InstanceKlass* const new_ik = new_parser.create_instance_klass(false, cl_inst_info, THREAD);
   if (HAS_PENDING_EXCEPTION) {
     log_pending_exception(PENDING_EXCEPTION);
     CLEAR_PENDING_EXCEPTION;
--- a/src/hotspot/share/prims/jvm.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/prims/jvm.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -1088,17 +1088,18 @@
     }
   } else { //hidden
     Handle classData_h(THREAD, JNIHandles::resolve(classData));
+    ClassLoadInfo cl_info(protection_domain,
+                          NULL, // unsafe_anonymous_host
+                          NULL, // cp_patches
+                          host_class,
+                          classData_h,
+                          is_hidden,
+                          is_weak,
+                          vm_annotations);
     k = SystemDictionary::parse_stream(class_name,
                                        class_loader,
-                                       protection_domain,
                                        &st,
-                                       NULL, // unsafe_anonymous_host
-                                       NULL, // cp_patches
-                                       is_hidden,
-                                       is_weak,
-                                       vm_annotations,
-                                       host_class,
-                                       classData_h,
+                                       cl_info,
                                        CHECK_NULL);
     if (k == NULL) {
       THROW_MSG_0(vmSymbols::java_lang_Error(), "Failure to define a hidden class");
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -1167,12 +1167,12 @@
     // load hook event.
     state->set_class_being_redefined(the_class, _class_load_kind);
 
+    ClassLoadInfo cl_info(protection_domain);
     InstanceKlass* scratch_class = SystemDictionary::parse_stream(
                                                       the_class_sym,
                                                       the_class_loader,
-                                                      protection_domain,
                                                       &st,
-                                                      NULL, // dynamic_nest_host
+                                                      cl_info,
                                                       THREAD);
     // Clear class_being_redefined just to be sure.
     state->clear_class_being_redefined();
--- a/src/hotspot/share/prims/unsafe.cpp	Tue Oct 29 19:49:55 2019 -0700
+++ b/src/hotspot/share/prims/unsafe.cpp	Tue Nov 12 20:48:39 2019 +0000
@@ -849,17 +849,19 @@
   ClassFileStream st(class_bytes, class_bytes_length, host_source, ClassFileStream::verify);
 
   Symbol* no_class_name = NULL;
+  ClassLoadInfo cl_info(host_domain,
+                        InstanceKlass::cast(host_klass),
+                        cp_patches,
+                        NULL,     // dynamic_nest_host
+                        Handle(), // classData
+                        false,    // is_hidden
+                        false,    // is_weak_hidden
+                        false);   // can_access_vm_annotations
+
   Klass* anonk = SystemDictionary::parse_stream(no_class_name,
                                                 host_loader,
-                                                host_domain,
                                                 &st,
-                                                InstanceKlass::cast(host_klass),
-                                                cp_patches,
-                                                false, // is_hidden
-                                                false, // is_weak
-                                                false, // can_access_vm_annotations
-                                                NULL,  // dynamic_nest_host
-                                                Handle(), // classData
+                                                cl_info,
                                                 CHECK_NULL);
   if (anonk == NULL) {
     return NULL;