changeset 59583:cd8f44ac380d nestmates

Summary: Improve passing arguments to ClassFileParser constructor Reviewed-by: lfoltan, mchung, coleenp
author hseigel
date Thu, 26 Mar 2020 18:22:26 +0000
parents 1e14b42ab69b
children 580f082b9fc1
files src/hotspot/share/classfile/classFileParser.cpp src/hotspot/share/classfile/classFileParser.hpp src/hotspot/share/classfile/klassFactory.cpp src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
diffstat 4 files changed, 18 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/classFileParser.cpp	Thu Mar 26 09:55:29 2020 -0700
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Thu Mar 26 18:22:26 2020 +0000
@@ -5961,20 +5961,16 @@
 ClassFileParser::ClassFileParser(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,
+                                 const ClassLoadInfo* cl_info,
                                  Publicity pub_level,
                                  TRAPS) :
   _stream(stream),
   _class_name(NULL),
   _loader_data(loader_data),
-  _unsafe_anonymous_host(unsafe_anonymous_host),
-  _cp_patches(cp_patches),
-  _is_hidden(is_hidden),
-  _can_access_vm_annotations(can_access_vm_annotations),
+  _unsafe_anonymous_host(cl_info->unsafe_anonymous_host()),
+  _cp_patches(cl_info->cp_patches()),
+  _is_hidden(cl_info->is_hidden()),
+  _can_access_vm_annotations(cl_info->can_access_vm_annotations()),
   _num_patched_klasses(0),
   _max_num_patched_klasses(0),
   _orig_cp_size(0),
@@ -6005,7 +6001,7 @@
   _itable_size(0),
   _num_miranda_methods(0),
   _rt(REF_NONE),
-  _protection_domain(protection_domain),
+  _protection_domain(cl_info->protection_domain()),
   _access_flags(),
   _pub_level(pub_level),
   _bad_constant_seen(0),
--- a/src/hotspot/share/classfile/classFileParser.hpp	Thu Mar 26 09:55:29 2020 -0700
+++ b/src/hotspot/share/classfile/classFileParser.hpp	Thu Mar 26 18:22:26 2020 +0000
@@ -37,6 +37,7 @@
 class Array;
 class ClassFileStream;
 class ClassLoaderData;
+class ClassLoadInfo;
 class ClassInstanceInfo;
 class CompressedLineNumberWriteStream;
 class ConstMethod;
@@ -539,11 +540,7 @@
   ClassFileParser(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,
+                  const ClassLoadInfo* cl_info,
                   Publicity pub_level,
                   TRAPS);
 
--- a/src/hotspot/share/classfile/klassFactory.cpp	Thu Mar 26 09:55:29 2020 -0700
+++ b/src/hotspot/share/classfile/klassFactory.cpp	Thu Mar 26 18:22:26 2020 +0000
@@ -79,19 +79,16 @@
                                                     end_ptr - ptr,
                                                     cfs->source(),
                                                     ClassFileStream::verify);
+      ClassLoadInfo cl_info(protection_domain);
       ClassFileParser parser(stream,
                              class_name,
                              loader_data,
-                             protection_domain,
-                             NULL,  // unsafe_anonymous_host
-                             NULL,  // cp_patches
-                             false, // is_hidden
-                             false, // can_access_vm_annotations
+                             &cl_info,
                              ClassFileParser::BROADCAST, // publicity level
                              CHECK_NULL);
-      ClassInstanceInfo cl_inst_info;
+      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
+                                                           *cl_inst_info,  // dynamic_nest_host and classData
                                                            CHECK_NULL);
 
       if (cached_class_file != NULL) {
@@ -202,11 +199,7 @@
   ClassFileParser parser(stream,
                          name,
                          loader_data,
-                         cl_info.protection_domain(),
-                         cl_info.unsafe_anonymous_host(),
-                         cl_info.cp_patches(),
-                         cl_info.is_hidden(),
-                         cl_info.can_access_vm_annotations(),
+                         &cl_info,
                          ClassFileParser::BROADCAST, // publicity level
                          CHECK_NULL);
 
--- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Thu Mar 26 09:55:29 2020 -0700
+++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp	Thu Mar 26 18:22:26 2020 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -1460,14 +1460,11 @@
   Handle pd(THREAD, ik->protection_domain());
   Symbol* const class_name = ik->name();
   const char* const klass_name = class_name != NULL ? class_name->as_C_string() : "";
+  ClassLoadInfo cl_info(pd);
   ClassFileParser new_parser(stream,
                              class_name,
                              cld,
-                             pd,
-                             NULL,  // host klass
-                             NULL,  // cp_patches
-                             false, // is_hidden
-                             false, // can_access_vm_annotations
+                             &cl_info,
                              ClassFileParser::INTERNAL, // internal visibility
                              THREAD);
   if (HAS_PENDING_EXCEPTION) {
@@ -1475,8 +1472,8 @@
     CLEAR_PENDING_EXCEPTION;
     return NULL;
   }
-  ClassInstanceInfo cl_inst_info;
-  InstanceKlass* const new_ik = new_parser.create_instance_klass(false, cl_inst_info, THREAD);
+  const ClassInstanceInfo* cl_inst_info = cl_info.class_hidden_info_ptr();
+  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;