I8PZ3I: Fix an error caused by anonymous when AppCDS generates jsa
This commit is contained in:
parent
743c6d5f2a
commit
ac0f0d84ee
111
Fix-an-error-caused-by-anonymous-when-AppCDS-generat.patch
Normal file
111
Fix-an-error-caused-by-anonymous-when-AppCDS-generat.patch
Normal file
@ -0,0 +1,111 @@
|
||||
From: l00803608 <liuyulong35@huawei.com>
|
||||
Subject: Fix an error caused by anonymous when AppCDS generates jsa
|
||||
---
|
||||
hotspot/src/share/vm/classfile/dictionary.hpp | 1 +
|
||||
hotspot/src/share/vm/classfile/systemDictionary.cpp | 13 ++++++++++++-
|
||||
hotspot/src/share/vm/classfile/systemDictionary.hpp | 1 +
|
||||
hotspot/src/share/vm/memory/metaspaceShared.cpp | 8 ++++----
|
||||
hotspot/src/share/vm/prims/unsafe.cpp | 6 ------
|
||||
5 files changed, 18 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/hotspot/src/share/vm/classfile/dictionary.hpp b/hotspot/src/share/vm/classfile/dictionary.hpp
|
||||
index 8a88fa2e4..e5d98184b 100644
|
||||
--- a/hotspot/src/share/vm/classfile/dictionary.hpp
|
||||
+++ b/hotspot/src/share/vm/classfile/dictionary.hpp
|
||||
@@ -394,6 +394,7 @@ class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> {
|
||||
// MethodHandle.invoke(S)T, for all signatures (S)T.
|
||||
class SymbolPropertyTable : public Hashtable<Symbol*, mtSymbol> {
|
||||
friend class VMStructs;
|
||||
+ friend class SystemDictionary;
|
||||
private:
|
||||
SymbolPropertyEntry* bucket(int i) {
|
||||
return (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::bucket(i);
|
||||
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
|
||||
index c8f66e830..59ab829c7 100644
|
||||
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
|
||||
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
|
||||
@@ -1031,7 +1031,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name,
|
||||
// as the host_klass
|
||||
assert(EnableInvokeDynamic, "");
|
||||
guarantee(host_klass->class_loader() == class_loader(), "should be the same");
|
||||
- guarantee(!DumpSharedSpaces, "must not create anonymous classes when dumping");
|
||||
loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader(), CHECK_NULL);
|
||||
loader_data->record_dependency(host_klass(), CHECK_NULL);
|
||||
} else {
|
||||
@@ -1498,6 +1497,18 @@ instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik,
|
||||
}
|
||||
return ik;
|
||||
}
|
||||
+
|
||||
+void SystemDictionary::clear_invoke_method_table() {
|
||||
+ SymbolPropertyEntry* spe = NULL;
|
||||
+ for (int index = 0; index < _invoke_method_table->table_size(); index++) {
|
||||
+ SymbolPropertyEntry* p = _invoke_method_table->bucket(index);
|
||||
+ while (p != NULL) {
|
||||
+ spe = p;
|
||||
+ p = p->next();
|
||||
+ _invoke_method_table->free_entry(spe);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
#endif // INCLUDE_CDS
|
||||
|
||||
instanceKlassHandle SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
|
||||
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.hpp b/hotspot/src/share/vm/classfile/systemDictionary.hpp
|
||||
index e39c1de62..83ca3794b 100644
|
||||
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp
|
||||
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp
|
||||
@@ -652,6 +652,7 @@ public:
|
||||
static bool is_ext_class_loader(Handle class_loader);
|
||||
static bool is_app_class_loader(Handle class_loader);
|
||||
static bool is_builtin_loader(Handle class_loader);
|
||||
+ static void clear_invoke_method_table();
|
||||
|
||||
protected:
|
||||
static Klass* find_shared_class(Symbol* class_name);
|
||||
diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp
|
||||
index eea79cc09..1576f4fbc 100644
|
||||
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp
|
||||
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp
|
||||
@@ -793,6 +793,10 @@ void MetaspaceShared::preload_and_dump(TRAPS) {
|
||||
link_and_cleanup_shared_classes(CATCH);
|
||||
tty->print_cr("Rewriting and linking classes: done");
|
||||
|
||||
+ tty->print("clear _invoke_method_table ...");
|
||||
+ SystemDictionary::clear_invoke_method_table();
|
||||
+ tty->print_cr(" done");
|
||||
+
|
||||
// At this point, many classes have been loaded.
|
||||
// Gather systemDictionary classes in a global array and do everything to
|
||||
// that so we don't have to walk the SystemDictionary again.
|
||||
@@ -829,10 +833,6 @@ int MetaspaceShared::preload_and_dump(const char * class_list_path,
|
||||
TempNewSymbol class_name_symbol = SymbolTable::new_permanent_symbol(class_name, THREAD);
|
||||
guarantee(!HAS_PENDING_EXCEPTION, "Exception creating a symbol.");
|
||||
|
||||
- // If preload_and_dump has anonymous class failed ,pls del this class_name in classlist
|
||||
- if (TraceClassLoading) {
|
||||
- tty->print_cr("preload_and_dump start: %s", class_name);
|
||||
- }
|
||||
Handle loader = UseAppCDS ? SystemDictionary::java_system_loader() : Handle();
|
||||
Klass* klass = SystemDictionary::resolve_or_null(class_name_symbol,
|
||||
loader,
|
||||
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
|
||||
index d6c33dd33..f1bd5799d 100644
|
||||
--- a/hotspot/src/share/vm/prims/unsafe.cpp
|
||||
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
|
||||
@@ -1040,12 +1040,6 @@ Unsafe_DefineAnonymousClass_impl(JNIEnv *env,
|
||||
HeapWord* *temp_alloc,
|
||||
TRAPS) {
|
||||
|
||||
- if (DumpSharedSpaces) {
|
||||
- tty->print_cr("failed: must not create anonymous classes when dumping.");
|
||||
- tty->print_cr("Please delete the last class_name prefixed with \"preload_and_dump start\" from -XX:SharedClassListFile to avoid anonymous classes.");
|
||||
- JVM_Halt(0);
|
||||
- }
|
||||
-
|
||||
if (UsePerfData) {
|
||||
ClassLoader::unsafe_defineClassCallCounter()->inc();
|
||||
}
|
||||
--
|
||||
2.19.1
|
||||
|
||||
@ -925,7 +925,7 @@ Provides: java-%{javaver}-%{origin}-accessibility%{?1} = %{epoch}:%{version}-%{r
|
||||
|
||||
Name: java-%{javaver}-%{origin}
|
||||
Version: %{javaver}.%{updatever}.%{buildver}
|
||||
Release: 3
|
||||
Release: 4
|
||||
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
|
||||
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
|
||||
# also included the epoch in their virtual provides. This created a
|
||||
@ -1288,6 +1288,7 @@ Patch406: 8293344-JDK-8242181-broke-stack-printing-for-non-att.patch
|
||||
Patch407: 8278794-Infinite-loop-in-DeflaterOutputStream.finish.patch
|
||||
Patch408: 8312065-Socket.connect-does-not-timeout-when-profili.patch
|
||||
Patch409: Add-Problemlist.patch
|
||||
Patch410: Fix-an-error-caused-by-anonymous-when-AppCDS-generat.patch
|
||||
|
||||
#############################################
|
||||
#
|
||||
@ -1902,6 +1903,7 @@ pushd %{top_level_dir_name}
|
||||
%patch407 -p1
|
||||
%patch408 -p1
|
||||
%patch409 -p1
|
||||
%patch410 -p1
|
||||
|
||||
%ifarch riscv64
|
||||
%patch2000 -p1
|
||||
@ -2553,6 +2555,9 @@ cjc.mainProgram(arg)
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Dec 20 2023 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.392-b08.4
|
||||
- Add Fix-an-error-caused-by-anonymous-when-AppCDS-generat.patch
|
||||
|
||||
* Mon Oct 30 2023 kuenking111 <wangkun49@huawei.com> - 1:1.8.0.392-b08.3
|
||||
- Add Add-Problemlist.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user