< prev index next >

src/hotspot/share/classfile/klassFactory.cpp

Print this page
rev 58565 : 8238358: Implementation of JEP 371: Hidden Classes
Reviewed-by: duke
Contributed-by: mandy.chung@oracle.com, lois.foltan@oracle.com, david.holmes@oracle.com, harold.seigel@oracle.com, serguei.spitsyn@oracle.com, alex.buckley@oracle.com, jamsheed.c.m@oracle.com

@@ -1,7 +1,7 @@
 /*
-* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2015, 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.

@@ -77,20 +77,22 @@
       int path_index = ik->shared_classpath_index();
       ClassFileStream* stream = new ClassFileStream(ptr,
                                                     end_ptr - ptr,
                                                     cfs->source(),
                                                     ClassFileStream::verify);
+      ClassLoadInfo cl_info(protection_domain);
       ClassFileParser parser(stream,
                              class_name,
                              loader_data,
-                             protection_domain,
-                             NULL,
-                             NULL,
+                             &cl_info,
                              ClassFileParser::BROADCAST, // publicity level
                              CHECK_NULL);
-      InstanceKlass* new_ik = parser.create_instance_klass(true /* changed_by_loadhook */,
+      const ClassInstanceInfo* cl_inst_info = cl_info.class_hidden_info_ptr();
+      InstanceKlass* new_ik = parser.create_instance_klass(true, // changed_by_loadhook
+                                                           *cl_inst_info,  // dynamic_nest_host and classData
                                                            CHECK_NULL);
+
       if (cached_class_file != NULL) {
         new_ik->set_cached_class_file(cached_class_file);
       }
 
       if (class_loader.is_null()) {

@@ -163,13 +165,11 @@
 
 
 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 ClassLoadInfo& cl_info,
                                                 TRAPS) {
   assert(stream != NULL, "invariant");
   assert(loader_data != NULL, "invariant");
   assert(THREAD->is_Java_thread(), "must be a JavaThread");
 

@@ -181,31 +181,32 @@
   ClassFileStream* old_stream = stream;
 
   // increment counter
   THREAD->statistical_info().incr_define_class_count();
 
-  // Skip this processing for VM anonymous classes
-  if (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 (!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);
   }
 
   ClassFileParser parser(stream,
                          name,
                          loader_data,
-                         protection_domain,
-                         unsafe_anonymous_host,
-                         cp_patches,
+                         &cl_info,
                          ClassFileParser::BROADCAST, // publicity level
                          CHECK_NULL);
 
-  InstanceKlass* result = parser.create_instance_klass(old_stream != stream, CHECK_NULL);
-  assert(result == parser.create_instance_klass(old_stream != stream, 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);
 
   if (result == NULL) {
     return NULL;
   }
 
< prev index next >