Fetch the repository succeeded.
This action will force synchronization from src-openEuler/openjdk-1.8.0, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
From fccc34c57f171463e871d8beeb4f97a67abc03da Mon Sep 17 00:00:00 2001
Date: Fri, 22 Sep 2023 14:44:32 +0800
Subject: add add-Count-instance-klass-when-loading-from-jsa-file
---
hotspot/src/share/vm/classfile/classLoaderData.cpp | 5 ++++-
hotspot/src/share/vm/oops/instanceKlass.cpp | 1 -
hotspot/src/share/vm/oops/instanceKlass.hpp | 1 +
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp
index 12b7e5036..ba86a0ebc 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp
@@ -64,6 +64,7 @@
#include "utilities/growableArray.hpp"
#include "utilities/macros.hpp"
#include "utilities/ostream.hpp"
+#include "oops/instanceKlass.hpp"
ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
@@ -304,7 +305,9 @@ void ClassLoaderData::add_class(Klass* k) {
k->set_next_link(old_value);
// link the new item into the list
_klasses = k;
-
+ if(k->oop_is_instance()){
+ InstanceKlass::inc_instance_classes();
+ }
if (TraceClassLoaderData && Verbose && k->class_loader_data() != NULL) {
ResourceMark rm;
tty->print_cr("[TraceClassLoaderData] Adding k: " PTR_FORMAT " %s to CLD: "
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index 993778270..00aea4377 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -232,7 +232,6 @@ InstanceKlass* InstanceKlass::allocate_instance_klass(
// including classes in the bootstrap (NULL) class loader.
loader_data->add_class(ik);
- Atomic::inc(&_total_instanceKlass_count);
return ik;
}
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index 6e36fa4ce..973480341 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -175,6 +175,7 @@ class InstanceKlass: public Klass {
initialization_error // error happened during initialization
};
+ static void inc_instance_classes() { Atomic::inc(&_total_instanceKlass_count); }
static int number_of_instance_classes() { return _total_instanceKlass_count; }
private:
--
2.22.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。