mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-07 01:50:12 +01:00
Compare commits
3 Commits
nprovotoro
...
jb17-b143.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
799b46db7d | ||
|
|
172b3a6400 | ||
|
|
9fa58395c9 |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
From d937dae078891013a644c6a53eb17f8f5deb8ec8 Mon Sep 17 00:00:00 2001
|
||||
From 6e99aea309783dab138d3789b0039128bcc7344a Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Wed, 11 Mar 2020 14:19:34 +0100
|
||||
Subject: [PATCH 03/39] Fix class cast exception on redefinition of class A,
|
||||
Subject: [PATCH 03/42] Fix class cast exception on redefinition of class A,
|
||||
that is superclass of B that has anonymous class C
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 53d50b53f83aa5135ff5092d0d566424024b8b4b Mon Sep 17 00:00:00 2001
|
||||
From 146b85fb6af764594999cb9922fd820798f3e9cc Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 4 Oct 2020 21:12:12 +0200
|
||||
Subject: [PATCH 04/39] Support for Lambda class redefinition
|
||||
Subject: [PATCH 04/42] Support for Lambda class redefinition
|
||||
|
||||
---
|
||||
.../share/classfile/classLoaderData.cpp | 9 +++
|
||||
@@ -80,114 +80,114 @@ index 2bfd9cb802f..cea614a574f 100644
|
||||
// Hidden classes that are not strong must update ClassLoaderData holder
|
||||
// so that they can be unloaded when the mirror is no longer referenced.
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 5551d3ca123..bf31819479d 100644
|
||||
index 5308b079e67..c1b1b354541 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -492,6 +492,8 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
|
||||
|
||||
+ // SystemDictionary::methods_do(fix_invoke_method);
|
||||
+
|
||||
// JSR-292 support
|
||||
if (_any_class_has_resolved_methods) {
|
||||
bool trace_name_printed = false;
|
||||
ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
|
||||
|
||||
+ // SystemDictionary::methods_do(fix_invoke_method);
|
||||
+
|
||||
// JSR-292 support
|
||||
if (_any_class_has_resolved_methods) {
|
||||
bool trace_name_printed = false;
|
||||
@@ -754,12 +756,34 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
// load hook event.
|
||||
state->set_class_being_redefined(the_class, _class_load_kind);
|
||||
|
||||
- InstanceKlass* k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- protection_domain,
|
||||
- &st,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ InstanceKlass* k;
|
||||
+
|
||||
+ if (InstanceKlass::cast(the_class)->is_anonymous()) {
|
||||
+ const InstanceKlass* host_class = the_class->host_klass();
|
||||
+
|
||||
+ // Make sure it's the real host class, not another anonymous class.
|
||||
+ while (host_class != NULL && host_class->is_anonymous()) {
|
||||
+ host_class = host_class->host_klass();
|
||||
+ }
|
||||
+
|
||||
+ k = SystemDictionary::parse_stream(the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ &st,
|
||||
+ host_class,
|
||||
+ the_class,
|
||||
+ NULL,
|
||||
+ THREAD);
|
||||
+ k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
+ the_class->class_loader_data()->inc_keep_alive();
|
||||
+ } else {
|
||||
+ k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ &st,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
+ }
|
||||
// Clear class_being_redefined just to be sure.
|
||||
state->clear_class_being_redefined();
|
||||
|
||||
// load hook event.
|
||||
state->set_class_being_redefined(the_class, _class_load_kind);
|
||||
|
||||
- InstanceKlass* k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- protection_domain,
|
||||
- &st,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ InstanceKlass* k;
|
||||
+
|
||||
+ if (InstanceKlass::cast(the_class)->is_anonymous()) {
|
||||
+ const InstanceKlass* host_class = the_class->host_klass();
|
||||
+
|
||||
+ // Make sure it's the real host class, not another anonymous class.
|
||||
+ while (host_class != NULL && host_class->is_anonymous()) {
|
||||
+ host_class = host_class->host_klass();
|
||||
+ }
|
||||
+
|
||||
+ k = SystemDictionary::parse_stream(the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ &st,
|
||||
+ host_class,
|
||||
+ the_class,
|
||||
+ NULL,
|
||||
+ THREAD);
|
||||
+ k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
+ the_class->class_loader_data()->inc_keep_alive();
|
||||
+ } else {
|
||||
+ k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ &st,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
+ }
|
||||
// Clear class_being_redefined just to be sure.
|
||||
state->clear_class_being_redefined();
|
||||
|
||||
@@ -1440,6 +1464,30 @@ void VM_EnhancedRedefineClasses::MethodDataCleaner::do_klass(Klass* k) {
|
||||
}
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::fix_invoke_method(Method* method) {
|
||||
+
|
||||
+ constantPoolHandle other_cp = constantPoolHandle(method->constants());
|
||||
+
|
||||
+ for (int i = 0; i < other_cp->length(); i++) {
|
||||
+ if (other_cp->tag_at(i).is_klass()) {
|
||||
+ Klass* klass = other_cp->resolved_klass_at(i);
|
||||
+ if (klass->new_version() != NULL) {
|
||||
+ // Constant pool entry points to redefined class -- update to the new version
|
||||
+ other_cp->klass_at_put(i, klass->newest_version());
|
||||
+ }
|
||||
+ assert(other_cp->resolved_klass_at(i)->new_version() == NULL, "Must be new klass!");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ConstantPoolCache* cp_cache = other_cp->cache();
|
||||
+ if (cp_cache != NULL) {
|
||||
+ cp_cache->clear_entries();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
void VM_EnhancedRedefineClasses::update_jmethod_ids() {
|
||||
for (int j = 0; j < _matching_methods_length; ++j) {
|
||||
Method* old_method = _matching_old_methods[j];
|
||||
}
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::fix_invoke_method(Method* method) {
|
||||
+
|
||||
+ constantPoolHandle other_cp = constantPoolHandle(method->constants());
|
||||
+
|
||||
+ for (int i = 0; i < other_cp->length(); i++) {
|
||||
+ if (other_cp->tag_at(i).is_klass()) {
|
||||
+ Klass* klass = other_cp->resolved_klass_at(i);
|
||||
+ if (klass->new_version() != NULL) {
|
||||
+ // Constant pool entry points to redefined class -- update to the new version
|
||||
+ other_cp->klass_at_put(i, klass->newest_version());
|
||||
+ }
|
||||
+ assert(other_cp->resolved_klass_at(i)->new_version() == NULL, "Must be new klass!");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ ConstantPoolCache* cp_cache = other_cp->cache();
|
||||
+ if (cp_cache != NULL) {
|
||||
+ cp_cache->clear_entries();
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
+
|
||||
+
|
||||
+
|
||||
void VM_EnhancedRedefineClasses::update_jmethod_ids() {
|
||||
for (int j = 0; j < _matching_methods_length; ++j) {
|
||||
Method* old_method = _matching_old_methods[j];
|
||||
@@ -1977,7 +2025,10 @@ jvmtiError VM_EnhancedRedefineClasses::find_sorted_affected_classes(TRAPS) {
|
||||
// Find classes not directly redefined, but affected by a redefinition (because one of its supertypes is redefined)
|
||||
AffectedKlassClosure closure(_affected_klasses);
|
||||
// Updated in j10, from original SystemDictionary::classes_do
|
||||
- ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
+ ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ //ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
|
||||
// Sort the affected klasses such that a supertype is always on a smaller array index than its subtype.
|
||||
// Find classes not directly redefined, but affected by a redefinition (because one of its supertypes is redefined)
|
||||
AffectedKlassClosure closure(_affected_klasses);
|
||||
// Updated in j10, from original SystemDictionary::classes_do
|
||||
- ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
+ ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ //ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
|
||||
// Sort the affected klasses such that a supertype is always on a smaller array index than its subtype.
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 60b62c3170a..d8a11b51fe9 100644
|
||||
index a48e07e3a6a..3551b06ecde 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -116,6 +116,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
void rollback();
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method);
|
||||
+ static void fix_invoke_method(Method* method);
|
||||
|
||||
// Figure out which new methods match old methods in name and signature,
|
||||
// which methods have been added, and which are no longer present
|
||||
void rollback();
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method);
|
||||
+ static void fix_invoke_method(Method* method);
|
||||
|
||||
// Figure out which new methods match old methods in name and signature,
|
||||
// which methods have been added, and which are no longer present
|
||||
diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
index 6a8128e844f..8644937dbbb 100644
|
||||
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 7bb6ea77608cd43cb7ca8c1ea8d492ae07789a0f Mon Sep 17 00:00:00 2001
|
||||
From 57d2451903b84dfc772cc0bf6957a52ee5e8c0f3 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 23 May 2020 10:02:15 +0200
|
||||
Subject: [PATCH 05/39] Fix "no original bytecode found" error if method with
|
||||
Subject: [PATCH 05/42] Fix "no original bytecode found" error if method with
|
||||
bkp is missing
|
||||
|
||||
Sometimes IDE can deploy class with erroneous method, such method has
|
||||
@@ -102,34 +102,34 @@ index 030ddd1f675..a8d6507ff6c 100644
|
||||
void set_breakpoint(int bci);
|
||||
void clear_breakpoint(int bci);
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index bf31819479d..07935bd0ada 100644
|
||||
index c1b1b354541..ad05b4f34cf 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -1360,14 +1360,16 @@ void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
|
||||
if (code == Bytecodes::_breakpoint) {
|
||||
int bci = method->bci_from(bcp);
|
||||
- code = method->orig_bytecode_at(bci);
|
||||
- java_code = Bytecodes::java_code(code);
|
||||
- if (code != java_code &&
|
||||
- (java_code == Bytecodes::_getfield ||
|
||||
- java_code == Bytecodes::_putfield ||
|
||||
- java_code == Bytecodes::_aload_0)) {
|
||||
- // Let breakpoint table handling unpatch bytecode
|
||||
- method->set_orig_bytecode_at(bci, java_code);
|
||||
+ code = method->orig_bytecode_at(bci, true);
|
||||
+ if (code != Bytecodes::_shouldnotreachhere) {
|
||||
+ java_code = Bytecodes::java_code(code);
|
||||
+ if (code != java_code &&
|
||||
+ (java_code == Bytecodes::_getfield ||
|
||||
+ java_code == Bytecodes::_putfield ||
|
||||
+ java_code == Bytecodes::_aload_0)) {
|
||||
+ // Let breakpoint table handling unpatch bytecode
|
||||
+ method->set_orig_bytecode_at(bci, java_code);
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
java_code = Bytecodes::java_code(code);
|
||||
|
||||
if (code == Bytecodes::_breakpoint) {
|
||||
int bci = method->bci_from(bcp);
|
||||
- code = method->orig_bytecode_at(bci);
|
||||
- java_code = Bytecodes::java_code(code);
|
||||
- if (code != java_code &&
|
||||
- (java_code == Bytecodes::_getfield ||
|
||||
- java_code == Bytecodes::_putfield ||
|
||||
- java_code == Bytecodes::_aload_0)) {
|
||||
- // Let breakpoint table handling unpatch bytecode
|
||||
- method->set_orig_bytecode_at(bci, java_code);
|
||||
+ code = method->orig_bytecode_at(bci, true);
|
||||
+ if (code != Bytecodes::_shouldnotreachhere) {
|
||||
+ java_code = Bytecodes::java_code(code);
|
||||
+ if (code != java_code &&
|
||||
+ (java_code == Bytecodes::_getfield ||
|
||||
+ java_code == Bytecodes::_putfield ||
|
||||
+ java_code == Bytecodes::_aload_0)) {
|
||||
+ // Let breakpoint table handling unpatch bytecode
|
||||
+ method->set_orig_bytecode_at(bci, java_code);
|
||||
+ }
|
||||
}
|
||||
} else {
|
||||
java_code = Bytecodes::java_code(code);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From c40cd307310822e6e60c61931c14f97a8501f975 Mon Sep 17 00:00:00 2001
|
||||
From d606e7de6dfe1204128a8ac034d8f57ad6130e0a Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 24 May 2020 12:07:42 +0200
|
||||
Subject: [PATCH 06/39] Replace deleted method with
|
||||
Subject: [PATCH 06/42] Replace deleted method with
|
||||
Universe::throw_no_such_method_error
|
||||
|
||||
+ Change log level in advanced redefinition
|
||||
@@ -13,18 +13,18 @@ Subject: [PATCH 06/39] Replace deleted method with
|
||||
2 files changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 07935bd0ada..3c86e8c68ac 100644
|
||||
index ad05b4f34cf..95be32f0070 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -881,7 +881,7 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
// Calculated the difference between new and old class (field change, method change, supertype change, ...).
|
||||
int VM_EnhancedRedefineClasses::calculate_redefinition_flags(InstanceKlass* new_class) {
|
||||
int result = Klass::NoRedefinition;
|
||||
- log_info(redefine, class, load)("Comparing different class versions of class %s",new_class->name()->as_C_string());
|
||||
+ log_debug(redefine, class, load)("Comparing different class versions of class %s",new_class->name()->as_C_string());
|
||||
|
||||
assert(new_class->old_version() != NULL, "must have old version");
|
||||
InstanceKlass* the_class = InstanceKlass::cast(new_class->old_version());
|
||||
// Calculated the difference between new and old class (field change, method change, supertype change, ...).
|
||||
int VM_EnhancedRedefineClasses::calculate_redefinition_flags(InstanceKlass* new_class) {
|
||||
int result = Klass::NoRedefinition;
|
||||
- log_info(redefine, class, load)("Comparing different class versions of class %s",new_class->name()->as_C_string());
|
||||
+ log_debug(redefine, class, load)("Comparing different class versions of class %s",new_class->name()->as_C_string());
|
||||
|
||||
assert(new_class->old_version() != NULL, "must have old version");
|
||||
InstanceKlass* the_class = InstanceKlass::cast(new_class->old_version());
|
||||
diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
index 8644937dbbb..b8d039adff6 100644
|
||||
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From a3775e77a2b4c5ec15051d5cfbf150fc67719d90 Mon Sep 17 00:00:00 2001
|
||||
From 2365d0dc56b6b28ee3355e89ecf981a42fdfe440 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Jun 2020 17:43:52 +0200
|
||||
Subject: [PATCH 07/39] Support for G1 gc
|
||||
Subject: [PATCH 07/42] Support for G1 gc
|
||||
|
||||
---
|
||||
src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 23 +++
|
||||
@@ -1032,258 +1032,258 @@ index 8091ab2808d..9fcbb6c41b3 100644
|
||||
SystemDictionary::oops_do(oopClosure);
|
||||
}
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 3c86e8c68ac..1da6661dd3e 100644
|
||||
index 95be32f0070..2679d3a556a 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -36,7 +36,6 @@
|
||||
#include "memory/metaspaceShared.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/iterator.inline.hpp"
|
||||
-#include "gc/serial/markSweep.hpp"
|
||||
#include "oops/fieldStreams.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "memory/metaspaceShared.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/iterator.inline.hpp"
|
||||
-#include "gc/serial/markSweep.hpp"
|
||||
#include "oops/fieldStreams.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
@@ -54,6 +53,8 @@
|
||||
#include "prims/jvmtiThreadState.inline.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
#include "oops/constantPool.inline.hpp"
|
||||
+#include "gc/g1/g1CollectedHeap.hpp"
|
||||
+#include "gc/shared/dcevmSharedGC.hpp"
|
||||
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_new_methods = NULL;
|
||||
#include "prims/jvmtiThreadState.inline.hpp"
|
||||
#include "utilities/events.hpp"
|
||||
#include "oops/constantPool.inline.hpp"
|
||||
+#include "gc/g1/g1CollectedHeap.hpp"
|
||||
+#include "gc/shared/dcevmSharedGC.hpp"
|
||||
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_new_methods = NULL;
|
||||
@@ -77,7 +78,7 @@ Klass* VM_EnhancedRedefineClasses::_the_class_oop = NULL;
|
||||
// - class_defs class definition - either new class or redefined class
|
||||
// note that this is not the final array of classes to be redefined
|
||||
// we need to scan for all affected classes (e.g. subclasses) and
|
||||
-// caculcate redefinition for them as well.
|
||||
+// calculate redefinition for them as well.
|
||||
// @param class_load_kind always jvmti_class_load_kind_redefine
|
||||
VM_EnhancedRedefineClasses::VM_EnhancedRedefineClasses(jint class_count, const jvmtiClassDefinition *class_defs, JvmtiClassLoadKind class_load_kind) :
|
||||
VM_GC_Operation(Universe::heap()->total_collections(), GCCause::_heap_inspection, Universe::heap()->total_full_collections(), true) {
|
||||
// - class_defs class definition - either new class or redefined class
|
||||
// note that this is not the final array of classes to be redefined
|
||||
// we need to scan for all affected classes (e.g. subclasses) and
|
||||
-// caculcate redefinition for them as well.
|
||||
+// calculate redefinition for them as well.
|
||||
// @param class_load_kind always jvmti_class_load_kind_redefine
|
||||
VM_EnhancedRedefineClasses::VM_EnhancedRedefineClasses(jint class_count, const jvmtiClassDefinition *class_defs, JvmtiClassLoadKind class_load_kind) :
|
||||
VM_GC_Operation(Universe::heap()->total_collections(), GCCause::_heap_inspection, Universe::heap()->total_full_collections(), true) {
|
||||
@@ -215,6 +216,20 @@ void VM_EnhancedRedefineClasses::mark_as_scavengable(nmethod* nm) {
|
||||
}
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::unregister_nmethod_g1(nmethod* nm) {
|
||||
+ // It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
+ if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ Universe::heap()->unregister_nmethod(nm);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void VM_EnhancedRedefineClasses::register_nmethod_g1(nmethod* nm) {
|
||||
+ // It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
+ if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ Universe::heap()->register_nmethod(nm);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// TODO comment
|
||||
struct StoreBarrier {
|
||||
// TODO: j10 review change ::oop_store -> HeapAccess<>::oop_store
|
||||
}
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::unregister_nmethod_g1(nmethod* nm) {
|
||||
+ // It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
+ if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ Universe::heap()->unregister_nmethod(nm);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void VM_EnhancedRedefineClasses::register_nmethod_g1(nmethod* nm) {
|
||||
+ // It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
+ if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ Universe::heap()->register_nmethod(nm);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// TODO comment
|
||||
struct StoreBarrier {
|
||||
// TODO: j10 review change ::oop_store -> HeapAccess<>::oop_store
|
||||
@@ -429,12 +444,7 @@ public:
|
||||
src->set_klass(obj->klass()->new_version());
|
||||
// FIXME: instance updates...
|
||||
//guarantee(false, "instance updates!");
|
||||
- MarkSweep::update_fields(obj, src, new_klass->update_information());
|
||||
-
|
||||
- if (size_diff > 0) {
|
||||
- HeapWord* dead_space = ((HeapWord *)obj) + obj->size();
|
||||
- CollectedHeap::fill_with_object(dead_space, size_diff);
|
||||
- }
|
||||
+ DcevmSharedGC::update_fields(obj, src, new_klass->update_information());
|
||||
}
|
||||
} else {
|
||||
obj->set_klass(obj->klass()->new_version());
|
||||
src->set_klass(obj->klass()->new_version());
|
||||
// FIXME: instance updates...
|
||||
//guarantee(false, "instance updates!");
|
||||
- MarkSweep::update_fields(obj, src, new_klass->update_information());
|
||||
-
|
||||
- if (size_diff > 0) {
|
||||
- HeapWord* dead_space = ((HeapWord *)obj) + obj->size();
|
||||
- CollectedHeap::fill_with_object(dead_space, size_diff);
|
||||
- }
|
||||
+ DcevmSharedGC::update_fields(obj, src, new_klass->update_information());
|
||||
}
|
||||
} else {
|
||||
obj->set_klass(obj->klass()->new_version());
|
||||
@@ -456,6 +466,10 @@ public:
|
||||
void VM_EnhancedRedefineClasses::doit() {
|
||||
Thread *thread = Thread::current();
|
||||
|
||||
+ if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
+ _timer_vm_op_doit.start();
|
||||
+ }
|
||||
+
|
||||
#if INCLUDE_CDS
|
||||
if (UseSharedSpaces) {
|
||||
// Sharing is enabled so we remap the shared readonly space to
|
||||
void VM_EnhancedRedefineClasses::doit() {
|
||||
Thread *thread = Thread::current();
|
||||
|
||||
+ if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
+ _timer_vm_op_doit.start();
|
||||
+ }
|
||||
+
|
||||
#if INCLUDE_CDS
|
||||
if (UseSharedSpaces) {
|
||||
// Sharing is enabled so we remap the shared readonly space to
|
||||
@@ -511,12 +525,37 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
// mark such nmethod's as "scavengable".
|
||||
// For now, mark all nmethod's as scavengable that are not scavengable already
|
||||
if (ScavengeRootsInCode) {
|
||||
- CodeCache::nmethods_do(mark_as_scavengable);
|
||||
+ if (UseG1GC) {
|
||||
+ // G1 holds references to nmethods in regions based on oops values. Since oops in nmethod can be changed in ChangePointers* closures
|
||||
+ // we unregister nmethods from G1 heap, then closures are processed (oops are changed) and finally we register nmethod to G1 again
|
||||
+ CodeCache::nmethods_do(unregister_nmethod_g1);
|
||||
+ } else {
|
||||
+ CodeCache::nmethods_do(mark_as_scavengable);
|
||||
+ }
|
||||
}
|
||||
|
||||
Universe::heap()->ensure_parsability(false);
|
||||
- Universe::heap()->object_iterate(&objectClosure);
|
||||
+ if (UseG1GC) {
|
||||
+ if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
+ _timer_heap_iterate.start();
|
||||
+ }
|
||||
+ G1CollectedHeap::heap()->object_par_iterate(&objectClosure);
|
||||
+ _timer_heap_iterate.stop();
|
||||
+ } else {
|
||||
+ if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
+ _timer_heap_iterate.start();
|
||||
+ }
|
||||
+ Universe::heap()->object_iterate(&objectClosure);
|
||||
+ _timer_heap_iterate.stop();
|
||||
+ }
|
||||
+
|
||||
Universe::root_oops_do(&oopClosureNoBarrier);
|
||||
+
|
||||
+ if (UseG1GC) {
|
||||
+ // this should work also for other GCs
|
||||
+ CodeCache::nmethods_do(register_nmethod_g1);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
log_trace(redefine, class, obsolete, metadata)("After updating instances");
|
||||
|
||||
// mark such nmethod's as "scavengable".
|
||||
// For now, mark all nmethod's as scavengable that are not scavengable already
|
||||
if (ScavengeRootsInCode) {
|
||||
- CodeCache::nmethods_do(mark_as_scavengable);
|
||||
+ if (UseG1GC) {
|
||||
+ // G1 holds references to nmethods in regions based on oops values. Since oops in nmethod can be changed in ChangePointers* closures
|
||||
+ // we unregister nmethods from G1 heap, then closures are processed (oops are changed) and finally we register nmethod to G1 again
|
||||
+ CodeCache::nmethods_do(unregister_nmethod_g1);
|
||||
+ } else {
|
||||
+ CodeCache::nmethods_do(mark_as_scavengable);
|
||||
+ }
|
||||
}
|
||||
|
||||
Universe::heap()->ensure_parsability(false);
|
||||
- Universe::heap()->object_iterate(&objectClosure);
|
||||
+ if (UseG1GC) {
|
||||
+ if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
+ _timer_heap_iterate.start();
|
||||
+ }
|
||||
+ G1CollectedHeap::heap()->object_par_iterate(&objectClosure);
|
||||
+ _timer_heap_iterate.stop();
|
||||
+ } else {
|
||||
+ if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
+ _timer_heap_iterate.start();
|
||||
+ }
|
||||
+ Universe::heap()->object_iterate(&objectClosure);
|
||||
+ _timer_heap_iterate.stop();
|
||||
+ }
|
||||
+
|
||||
Universe::root_oops_do(&oopClosureNoBarrier);
|
||||
+
|
||||
+ if (UseG1GC) {
|
||||
+ // this should work also for other GCs
|
||||
+ CodeCache::nmethods_do(register_nmethod_g1);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
log_trace(redefine, class, obsolete, metadata)("After updating instances");
|
||||
|
||||
@@ -569,11 +608,19 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
|
||||
if (objectClosure.needs_instance_update()) {
|
||||
// Do a full garbage collection to update the instance sizes accordingly
|
||||
+
|
||||
+ if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
+ _timer_heap_full_gc.start();
|
||||
+ }
|
||||
+
|
||||
Universe::set_redefining_gc_run(true);
|
||||
notify_gc_begin(true);
|
||||
+ // TODO: check _metadata_GC_clear_soft_refs with ScavengeRootsInCode
|
||||
Universe::heap()->collect_as_vm_thread(GCCause::_heap_inspection);
|
||||
notify_gc_end();
|
||||
Universe::set_redefining_gc_run(false);
|
||||
+
|
||||
+ _timer_heap_full_gc.stop();
|
||||
}
|
||||
|
||||
// Unmark Klass*s as "redefining"
|
||||
|
||||
if (objectClosure.needs_instance_update()) {
|
||||
// Do a full garbage collection to update the instance sizes accordingly
|
||||
+
|
||||
+ if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
+ _timer_heap_full_gc.start();
|
||||
+ }
|
||||
+
|
||||
Universe::set_redefining_gc_run(true);
|
||||
notify_gc_begin(true);
|
||||
+ // TODO: check _metadata_GC_clear_soft_refs with ScavengeRootsInCode
|
||||
Universe::heap()->collect_as_vm_thread(GCCause::_heap_inspection);
|
||||
notify_gc_end();
|
||||
Universe::set_redefining_gc_run(false);
|
||||
+
|
||||
+ _timer_heap_full_gc.stop();
|
||||
}
|
||||
|
||||
// Unmark Klass*s as "redefining"
|
||||
@@ -621,6 +668,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
}
|
||||
#endif
|
||||
|
||||
+ _timer_vm_op_doit.stop();
|
||||
}
|
||||
|
||||
// Cleanup - runs in JVM thread
|
||||
}
|
||||
#endif
|
||||
|
||||
+ _timer_vm_op_doit.stop();
|
||||
}
|
||||
|
||||
// Cleanup - runs in JVM thread
|
||||
@@ -644,16 +692,14 @@ void VM_EnhancedRedefineClasses::doit_epilogue() {
|
||||
if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
// Used to have separate timers for "doit" and "all", but the timer
|
||||
// overhead skewed the measurements.
|
||||
- jlong doit_time = _timer_rsc_phase1.milliseconds() +
|
||||
- _timer_rsc_phase2.milliseconds();
|
||||
- jlong all_time = _timer_vm_op_prologue.milliseconds() + doit_time;
|
||||
+ jlong all_time = _timer_vm_op_prologue.milliseconds() + _timer_vm_op_doit.milliseconds();
|
||||
|
||||
log_info(redefine, class, timer)
|
||||
("vm_op: all=" JLONG_FORMAT " prologue=" JLONG_FORMAT " doit=" JLONG_FORMAT,
|
||||
- all_time, _timer_vm_op_prologue.milliseconds(), doit_time);
|
||||
+ all_time, _timer_vm_op_prologue.milliseconds(), _timer_vm_op_doit.milliseconds());
|
||||
log_info(redefine, class, timer)
|
||||
- ("redefine_single_class: phase1=" JLONG_FORMAT " phase2=" JLONG_FORMAT,
|
||||
- _timer_rsc_phase1.milliseconds(), _timer_rsc_phase2.milliseconds());
|
||||
+ ("doit: heap iterate=" JLONG_FORMAT " fullgc=" JLONG_FORMAT,
|
||||
+ _timer_heap_iterate.milliseconds(), _timer_heap_full_gc.milliseconds());
|
||||
}
|
||||
}
|
||||
|
||||
if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
// Used to have separate timers for "doit" and "all", but the timer
|
||||
// overhead skewed the measurements.
|
||||
- jlong doit_time = _timer_rsc_phase1.milliseconds() +
|
||||
- _timer_rsc_phase2.milliseconds();
|
||||
- jlong all_time = _timer_vm_op_prologue.milliseconds() + doit_time;
|
||||
+ jlong all_time = _timer_vm_op_prologue.milliseconds() + _timer_vm_op_doit.milliseconds();
|
||||
|
||||
log_info(redefine, class, timer)
|
||||
("vm_op: all=" JLONG_FORMAT " prologue=" JLONG_FORMAT " doit=" JLONG_FORMAT,
|
||||
- all_time, _timer_vm_op_prologue.milliseconds(), doit_time);
|
||||
+ all_time, _timer_vm_op_prologue.milliseconds(), _timer_vm_op_doit.milliseconds());
|
||||
log_info(redefine, class, timer)
|
||||
- ("redefine_single_class: phase1=" JLONG_FORMAT " phase2=" JLONG_FORMAT,
|
||||
- _timer_rsc_phase1.milliseconds(), _timer_rsc_phase2.milliseconds());
|
||||
+ ("doit: heap iterate=" JLONG_FORMAT " fullgc=" JLONG_FORMAT,
|
||||
+ _timer_heap_iterate.milliseconds(), _timer_heap_full_gc.milliseconds());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1402,7 +1448,7 @@ void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
// arrayKlassOops. See Open Issues in jvmtiRedefineClasses.hpp.
|
||||
void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
if (!k->is_instance_klass()) {
|
||||
- return;
|
||||
+ return;
|
||||
}
|
||||
|
||||
HandleMark hm(_thread);
|
||||
// arrayKlassOops. See Open Issues in jvmtiRedefineClasses.hpp.
|
||||
void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
if (!k->is_instance_klass()) {
|
||||
- return;
|
||||
+ return;
|
||||
}
|
||||
|
||||
HandleMark hm(_thread);
|
||||
@@ -1588,7 +1634,7 @@ class TransferNativeFunctionRegistration {
|
||||
|
||||
// Recursively search the binary tree of possibly prefixed method names.
|
||||
// Iteration could be used if all agents were well behaved. Full tree walk is
|
||||
- // more resilent to agents not cleaning up intermediate methods.
|
||||
+ // more resilient to agents not cleaning up intermediate methods.
|
||||
// Branch at each depth in the binary tree is:
|
||||
// (1) without the prefix.
|
||||
// (2) with the prefix.
|
||||
|
||||
// Recursively search the binary tree of possibly prefixed method names.
|
||||
// Iteration could be used if all agents were well behaved. Full tree walk is
|
||||
- // more resilent to agents not cleaning up intermediate methods.
|
||||
+ // more resilient to agents not cleaning up intermediate methods.
|
||||
// Branch at each depth in the binary tree is:
|
||||
// (1) without the prefix.
|
||||
// (2) with the prefix.
|
||||
@@ -1693,7 +1739,7 @@ void VM_EnhancedRedefineClasses::transfer_old_native_function_registrations(Inst
|
||||
transfer.transfer_registrations(_matching_old_methods, _matching_methods_length);
|
||||
}
|
||||
|
||||
-// DCEVM - it always deoptimases everything! (because it is very difficult to find only correct dependencies)
|
||||
+// DCEVM - it always deoptimizes everything! (because it is very difficult to find only correct dependencies)
|
||||
// Deoptimize all compiled code that depends on this class.
|
||||
//
|
||||
// If the can_redefine_classes capability is obtained in the onload
|
||||
transfer.transfer_registrations(_matching_old_methods, _matching_methods_length);
|
||||
}
|
||||
|
||||
-// DCEVM - it always deoptimases everything! (because it is very difficult to find only correct dependencies)
|
||||
+// DCEVM - it always deoptimizes everything! (because it is very difficult to find only correct dependencies)
|
||||
// Deoptimize all compiled code that depends on this class.
|
||||
//
|
||||
// If the can_redefine_classes capability is obtained in the onload
|
||||
@@ -1820,10 +1866,6 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
|
||||
HandleMark hm(THREAD); // make sure handles from this call are freed
|
||||
|
||||
- if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
- _timer_rsc_phase1.start();
|
||||
- }
|
||||
-
|
||||
InstanceKlass* new_class = new_class_oop;
|
||||
InstanceKlass* the_class = InstanceKlass::cast(new_class_oop->old_version());
|
||||
assert(the_class != NULL, "must have old version");
|
||||
|
||||
HandleMark hm(THREAD); // make sure handles from this call are freed
|
||||
|
||||
- if (log_is_enabled(Info, redefine, class, timer)) {
|
||||
- _timer_rsc_phase1.start();
|
||||
- }
|
||||
-
|
||||
InstanceKlass* new_class = new_class_oop;
|
||||
InstanceKlass* the_class = InstanceKlass::cast(new_class_oop->old_version());
|
||||
assert(the_class != NULL, "must have old version");
|
||||
@@ -1878,7 +1920,6 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
new_class->external_name(),
|
||||
java_lang_Class::classRedefinedCount(new_class->java_mirror()));
|
||||
}
|
||||
- _timer_rsc_phase2.stop();
|
||||
} // end redefine_single_class()
|
||||
|
||||
|
||||
new_class->external_name(),
|
||||
java_lang_Class::classRedefinedCount(new_class->java_mirror()));
|
||||
}
|
||||
- _timer_rsc_phase2.stop();
|
||||
} // end redefine_single_class()
|
||||
|
||||
|
||||
@@ -2061,8 +2102,8 @@ static bool match_second(void* value, KlassPair elem) {
|
||||
// For each class to be redefined parse the bytecode and figure out the superclass and all interfaces.
|
||||
// First newly introduced classes (_class_defs) are scanned and then affected classed (_affected_klasses).
|
||||
// Affected flag is cleared (clear_redefinition_flag(Klass::MarkedAsAffected))
|
||||
-// For each dependency create a KlassPair instance. Finnaly, affected classes (_affected_klasses) are sorted according to pairs.
|
||||
-// TODO - the class file is potentionally parsed multiple times - introduce a cache?
|
||||
+// For each dependency create a KlassPair instance. Finally, affected classes (_affected_klasses) are sorted according to pairs.
|
||||
+// TODO - the class file is potentially parsed multiple times - introduce a cache?
|
||||
jvmtiError VM_EnhancedRedefineClasses::do_topological_class_sorting(TRAPS) {
|
||||
ResourceMark mark(THREAD);
|
||||
|
||||
// For each class to be redefined parse the bytecode and figure out the superclass and all interfaces.
|
||||
// First newly introduced classes (_class_defs) are scanned and then affected classed (_affected_klasses).
|
||||
// Affected flag is cleared (clear_redefinition_flag(Klass::MarkedAsAffected))
|
||||
-// For each dependency create a KlassPair instance. Finnaly, affected classes (_affected_klasses) are sorted according to pairs.
|
||||
-// TODO - the class file is potentionally parsed multiple times - introduce a cache?
|
||||
+// For each dependency create a KlassPair instance. Finally, affected classes (_affected_klasses) are sorted according to pairs.
|
||||
+// TODO - the class file is potentially parsed multiple times - introduce a cache?
|
||||
jvmtiError VM_EnhancedRedefineClasses::do_topological_class_sorting(TRAPS) {
|
||||
ResourceMark mark(THREAD);
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index d8a11b51fe9..4c0412d343d 100644
|
||||
index 3551b06ecde..d00109a0b92 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -86,9 +86,10 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
// Performance measurement support. These timers do not cover all
|
||||
// the work done for JVM/TI RedefineClasses() but they do cover
|
||||
// the heavy lifting.
|
||||
- elapsedTimer _timer_rsc_phase1;
|
||||
- elapsedTimer _timer_rsc_phase2;
|
||||
+ elapsedTimer _timer_vm_op_doit;
|
||||
elapsedTimer _timer_vm_op_prologue;
|
||||
+ elapsedTimer _timer_heap_iterate;
|
||||
+ elapsedTimer _timer_heap_full_gc;
|
||||
|
||||
// These routines are roughly in call order unless otherwise noted.
|
||||
|
||||
// Performance measurement support. These timers do not cover all
|
||||
// the work done for JVM/TI RedefineClasses() but they do cover
|
||||
// the heavy lifting.
|
||||
- elapsedTimer _timer_rsc_phase1;
|
||||
- elapsedTimer _timer_rsc_phase2;
|
||||
+ elapsedTimer _timer_vm_op_doit;
|
||||
elapsedTimer _timer_vm_op_prologue;
|
||||
+ elapsedTimer _timer_heap_iterate;
|
||||
+ elapsedTimer _timer_heap_full_gc;
|
||||
|
||||
// These routines are roughly in call order unless otherwise noted.
|
||||
|
||||
@@ -115,6 +116,8 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
|
||||
void rollback();
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
+ static void unregister_nmethod_g1(nmethod* nm);
|
||||
+ static void register_nmethod_g1(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method);
|
||||
static void fix_invoke_method(Method* method);
|
||||
|
||||
|
||||
void rollback();
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
+ static void unregister_nmethod_g1(nmethod* nm);
|
||||
+ static void register_nmethod_g1(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method);
|
||||
static void fix_invoke_method(Method* method);
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
|
||||
index 1373408f18d..b7bb88e2a46 100644
|
||||
index 11e7997b4a6..2d33448ec8d 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.cpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.cpp
|
||||
@@ -1981,9 +1981,9 @@ bool Arguments::check_gc_consistency() {
|
||||
@@ -1985,9 +1985,9 @@ bool Arguments::check_gc_consistency() {
|
||||
if (AllowEnhancedClassRedefinition) {
|
||||
// Must use serial GC. This limitation applies because the instance size changing GC modifications
|
||||
// are only built into the mark and compact algorithm.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From e062743b148a099a8593a3110d5f1d9156f4ca23 Mon Sep 17 00:00:00 2001
|
||||
From e818e4a83fafc07142b7b7279c633823d5d8ab23 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Tue, 6 Oct 2020 22:15:31 +0200
|
||||
Subject: [PATCH 08/39] AllowEnhancedClassRedefinition is false (disabled) by
|
||||
Subject: [PATCH 08/42] AllowEnhancedClassRedefinition is false (disabled) by
|
||||
default
|
||||
|
||||
---
|
||||
@@ -9,7 +9,7 @@ Subject: [PATCH 08/39] AllowEnhancedClassRedefinition is false (disabled) by
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
|
||||
index 2fcb02fcf49..7051b634a9b 100644
|
||||
index 845a39b0225..fb6d1667156 100644
|
||||
--- a/src/hotspot/share/runtime/globals.hpp
|
||||
+++ b/src/hotspot/share/runtime/globals.hpp
|
||||
@@ -2088,7 +2088,7 @@ const intx ObjectAlignmentInBytes = 8;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 703cb7aa230b6a159c7f1f86b749a8e0119ef881 Mon Sep 17 00:00:00 2001
|
||||
From 737c3616d674224661dd8751861f0365d9591d80 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Mon, 19 Oct 2020 20:00:04 +0200
|
||||
Subject: [PATCH 09/39] Set HOTSPOT_VM_DISTRO=Dynamic Code Evolution
|
||||
Subject: [PATCH 09/42] Set HOTSPOT_VM_DISTRO=Dynamic Code Evolution
|
||||
|
||||
---
|
||||
make/autoconf/version-numbers | 55 +++++++++++++++++++++++++++++++++++
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 3b4788c779cb9ffe2751e996bba3b445b474eba7 Mon Sep 17 00:00:00 2001
|
||||
From b14f6ba2d743aacf15dedfe8ad677f176683d51c Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 23 Oct 2020 10:20:26 +0200
|
||||
Subject: [PATCH 10/39] Clear dcevm code separation
|
||||
Subject: [PATCH 10/42] Clear dcevm code separation
|
||||
|
||||
---
|
||||
src/hotspot/share/classfile/systemDictionary.cpp | 3 +--
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From bb8f91da24b2649507f2e200f1ff2bae2d2658bf Mon Sep 17 00:00:00 2001
|
||||
From 3957393df0bd440fe90f4a8eea007b3354a45b98 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Wed, 11 Nov 2020 18:45:15 +0100
|
||||
Subject: [PATCH 11/39] Fix LoadedClassesClosure - fixes problems with remote
|
||||
Subject: [PATCH 11/42] Fix LoadedClassesClosure - fixes problems with remote
|
||||
debugging
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 2dd09ce40a545a4256f990346e5cebf23dbf0b56 Mon Sep 17 00:00:00 2001
|
||||
From f583e16509936d6873c4a2dac936d9089cc402a1 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 10:10:02 +0100
|
||||
Subject: [PATCH 12/39] dcevm15 - fix java15 compilation issues
|
||||
Subject: [PATCH 12/42] dcevm15 - fix java15 compilation issues
|
||||
|
||||
---
|
||||
.../share/classfile/classFileParser.hpp | 8 +-
|
||||
@@ -411,496 +411,496 @@ index a7fe090ba01..2966343c835 100644
|
||||
|
||||
// The hidden class loader data has been artificially been kept alive to
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 1da6661dd3e..efaf11e1666 100644
|
||||
index 2679d3a556a..a27c2ff87ae 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -24,11 +24,14 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "aot/aotLoader.hpp"
|
||||
+#include "classfile/classFileParser.hpp"
|
||||
#include "classfile/classFileStream.hpp"
|
||||
#include "classfile/metadataOnStackMark.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "classfile/verifier.hpp"
|
||||
#include "classfile/dictionary.hpp"
|
||||
+#include "classfile/classLoaderDataGraph.hpp"
|
||||
+#include "interpreter/linkResolver.hpp"
|
||||
#include "interpreter/oopMapCache.hpp"
|
||||
#include "interpreter/rewriter.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "aot/aotLoader.hpp"
|
||||
+#include "classfile/classFileParser.hpp"
|
||||
#include "classfile/classFileStream.hpp"
|
||||
#include "classfile/metadataOnStackMark.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "classfile/verifier.hpp"
|
||||
#include "classfile/dictionary.hpp"
|
||||
+#include "classfile/classLoaderDataGraph.hpp"
|
||||
+#include "interpreter/linkResolver.hpp"
|
||||
#include "interpreter/oopMapCache.hpp"
|
||||
#include "interpreter/rewriter.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
@@ -37,17 +40,22 @@
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/iterator.inline.hpp"
|
||||
#include "oops/fieldStreams.hpp"
|
||||
+#include "oops/fieldStreams.inline.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/constantPool.inline.hpp"
|
||||
+#include "oops/metadata.hpp"
|
||||
+#include "oops/methodData.hpp"
|
||||
#include "prims/jvmtiImpl.hpp"
|
||||
#include "prims/jvmtiClassFileReconstituter.hpp"
|
||||
#include "prims/jvmtiEnhancedRedefineClasses.hpp"
|
||||
#include "prims/methodComparator.hpp"
|
||||
#include "prims/resolvedMethodTable.hpp"
|
||||
+#include "prims/methodHandles.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
#include "runtime/jniHandles.inline.hpp"
|
||||
#include "runtime/relocator.hpp"
|
||||
+#include "runtime/fieldDescriptor.hpp"
|
||||
#include "runtime/fieldDescriptor.inline.hpp"
|
||||
#include "utilities/bitMap.inline.hpp"
|
||||
#include "prims/jvmtiThreadState.inline.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/iterator.inline.hpp"
|
||||
#include "oops/fieldStreams.hpp"
|
||||
+#include "oops/fieldStreams.inline.hpp"
|
||||
#include "oops/klassVtable.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "oops/constantPool.inline.hpp"
|
||||
+#include "oops/metadata.hpp"
|
||||
+#include "oops/methodData.hpp"
|
||||
#include "prims/jvmtiImpl.hpp"
|
||||
#include "prims/jvmtiClassFileReconstituter.hpp"
|
||||
#include "prims/jvmtiEnhancedRedefineClasses.hpp"
|
||||
#include "prims/methodComparator.hpp"
|
||||
#include "prims/resolvedMethodTable.hpp"
|
||||
+#include "prims/methodHandles.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
#include "runtime/jniHandles.inline.hpp"
|
||||
#include "runtime/relocator.hpp"
|
||||
+#include "runtime/fieldDescriptor.hpp"
|
||||
#include "runtime/fieldDescriptor.inline.hpp"
|
||||
#include "utilities/bitMap.inline.hpp"
|
||||
#include "prims/jvmtiThreadState.inline.hpp"
|
||||
@@ -55,6 +63,8 @@
|
||||
#include "oops/constantPool.inline.hpp"
|
||||
#include "gc/g1/g1CollectedHeap.hpp"
|
||||
#include "gc/shared/dcevmSharedGC.hpp"
|
||||
+#include "gc/shared/scavengableNMethods.hpp"
|
||||
+#include "ci/ciObjectFactory.hpp"
|
||||
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_new_methods = NULL;
|
||||
#include "oops/constantPool.inline.hpp"
|
||||
#include "gc/g1/g1CollectedHeap.hpp"
|
||||
#include "gc/shared/dcevmSharedGC.hpp"
|
||||
+#include "gc/shared/scavengableNMethods.hpp"
|
||||
+#include "ci/ciObjectFactory.hpp"
|
||||
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_new_methods = NULL;
|
||||
@@ -66,6 +76,7 @@ int VM_EnhancedRedefineClasses::_matching_methods_length = 0;
|
||||
int VM_EnhancedRedefineClasses::_deleted_methods_length = 0;
|
||||
int VM_EnhancedRedefineClasses::_added_methods_length = 0;
|
||||
Klass* VM_EnhancedRedefineClasses::_the_class_oop = NULL;
|
||||
+u8 VM_EnhancedRedefineClasses::_id_counter = 0;
|
||||
|
||||
//
|
||||
// Create new instance of enhanced class redefiner.
|
||||
int VM_EnhancedRedefineClasses::_deleted_methods_length = 0;
|
||||
int VM_EnhancedRedefineClasses::_added_methods_length = 0;
|
||||
Klass* VM_EnhancedRedefineClasses::_the_class_oop = NULL;
|
||||
+u8 VM_EnhancedRedefineClasses::_id_counter = 0;
|
||||
|
||||
//
|
||||
// Create new instance of enhanced class redefiner.
|
||||
@@ -88,6 +99,7 @@ VM_EnhancedRedefineClasses::VM_EnhancedRedefineClasses(jint class_count, const j
|
||||
_class_load_kind = class_load_kind;
|
||||
_res = JVMTI_ERROR_NONE;
|
||||
_any_class_has_resolved_methods = false;
|
||||
+ _id = next_id();
|
||||
}
|
||||
|
||||
static inline InstanceKlass* get_ik(jclass def) {
|
||||
_class_load_kind = class_load_kind;
|
||||
_res = JVMTI_ERROR_NONE;
|
||||
_any_class_has_resolved_methods = false;
|
||||
+ _id = next_id();
|
||||
}
|
||||
|
||||
static inline InstanceKlass* get_ik(jclass def) {
|
||||
@@ -211,9 +223,7 @@ class FieldCopier : public FieldClosure {
|
||||
|
||||
// TODO: review...
|
||||
void VM_EnhancedRedefineClasses::mark_as_scavengable(nmethod* nm) {
|
||||
- if (!nm->on_scavenge_root_list()) {
|
||||
- CodeCache::add_scavenge_root_nmethod(nm);
|
||||
- }
|
||||
+ ScavengableNMethods::register_nmethod(nm);
|
||||
}
|
||||
|
||||
void VM_EnhancedRedefineClasses::unregister_nmethod_g1(nmethod* nm) {
|
||||
|
||||
// TODO: review...
|
||||
void VM_EnhancedRedefineClasses::mark_as_scavengable(nmethod* nm) {
|
||||
- if (!nm->on_scavenge_root_list()) {
|
||||
- CodeCache::add_scavenge_root_nmethod(nm);
|
||||
- }
|
||||
+ ScavengableNMethods::register_nmethod(nm);
|
||||
}
|
||||
|
||||
void VM_EnhancedRedefineClasses::unregister_nmethod_g1(nmethod* nm) {
|
||||
@@ -414,7 +424,7 @@ public:
|
||||
_tmp_obj_size = size;
|
||||
_tmp_obj = (oop)resource_allocate_bytes(size * HeapWordSize);
|
||||
}
|
||||
- Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)_tmp_obj, size);
|
||||
+ Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(o), cast_from_oop<HeapWord*>(_tmp_obj), size);
|
||||
}
|
||||
|
||||
virtual void do_object(oop obj) {
|
||||
_tmp_obj_size = size;
|
||||
_tmp_obj = (oop)resource_allocate_bytes(size * HeapWordSize);
|
||||
}
|
||||
- Copy::aligned_disjoint_words((HeapWord*)o, (HeapWord*)_tmp_obj, size);
|
||||
+ Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(o), cast_from_oop<HeapWord*>(_tmp_obj), size);
|
||||
}
|
||||
|
||||
virtual void do_object(oop obj) {
|
||||
@@ -498,16 +508,13 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
|
||||
// Deoptimize all compiled code that depends on this class (do only once, because it clears whole cache)
|
||||
// if (_max_redefinition_flags > Klass::ModifyClass) {
|
||||
- flush_dependent_code(NULL, thread);
|
||||
+ flush_dependent_code(thread);
|
||||
// }
|
||||
|
||||
// Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
ClearCpoolCacheAndUnpatch clear_cpool_cache(thread);
|
||||
ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
|
||||
-
|
||||
- // SystemDictionary::methods_do(fix_invoke_method);
|
||||
-
|
||||
// JSR-292 support
|
||||
if (_any_class_has_resolved_methods) {
|
||||
bool trace_name_printed = false;
|
||||
|
||||
// Deoptimize all compiled code that depends on this class (do only once, because it clears whole cache)
|
||||
// if (_max_redefinition_flags > Klass::ModifyClass) {
|
||||
- flush_dependent_code(NULL, thread);
|
||||
+ flush_dependent_code(thread);
|
||||
// }
|
||||
|
||||
// Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
ClearCpoolCacheAndUnpatch clear_cpool_cache(thread);
|
||||
ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
|
||||
-
|
||||
- // SystemDictionary::methods_do(fix_invoke_method);
|
||||
-
|
||||
// JSR-292 support
|
||||
if (_any_class_has_resolved_methods) {
|
||||
bool trace_name_printed = false;
|
||||
@@ -564,8 +571,8 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
InstanceKlass* old = InstanceKlass::cast(cur->old_version());
|
||||
|
||||
// Swap marks to have same hashcodes
|
||||
- markOop cur_mark = cur->prototype_header();
|
||||
- markOop old_mark = old->prototype_header();
|
||||
+ markWord cur_mark = cur->prototype_header();
|
||||
+ markWord old_mark = old->prototype_header();
|
||||
cur->set_prototype_header(old_mark);
|
||||
old->set_prototype_header(cur_mark);
|
||||
|
||||
InstanceKlass* old = InstanceKlass::cast(cur->old_version());
|
||||
|
||||
// Swap marks to have same hashcodes
|
||||
- markOop cur_mark = cur->prototype_header();
|
||||
- markOop old_mark = old->prototype_header();
|
||||
+ markWord cur_mark = cur->prototype_header();
|
||||
+ markWord old_mark = old->prototype_header();
|
||||
cur->set_prototype_header(old_mark);
|
||||
old->set_prototype_header(cur_mark);
|
||||
|
||||
@@ -579,14 +586,14 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
// Revert pool holder for old version of klass (it was updated by one of ours closure!)
|
||||
old->constants()->set_pool_holder(old);
|
||||
|
||||
- Klass* array_klasses = old->array_klasses();
|
||||
+ ObjArrayKlass* array_klasses = old->array_klasses();
|
||||
if (array_klasses != NULL) {
|
||||
assert(cur->array_klasses() == NULL, "just checking");
|
||||
|
||||
// Transfer the array classes, otherwise we might get cast exceptions when casting array types.
|
||||
// Also, set array klasses element klass.
|
||||
cur->set_array_klasses(array_klasses);
|
||||
- ObjArrayKlass::cast(array_klasses)->set_element_klass(cur);
|
||||
+ array_klasses->set_element_klass(cur);
|
||||
java_lang_Class::release_set_array_klass(cur->java_mirror(), array_klasses);
|
||||
java_lang_Class::set_component_mirror(array_klasses->java_mirror(), cur->java_mirror());
|
||||
}
|
||||
// Revert pool holder for old version of klass (it was updated by one of ours closure!)
|
||||
old->constants()->set_pool_holder(old);
|
||||
|
||||
- Klass* array_klasses = old->array_klasses();
|
||||
+ ObjArrayKlass* array_klasses = old->array_klasses();
|
||||
if (array_klasses != NULL) {
|
||||
assert(cur->array_klasses() == NULL, "just checking");
|
||||
|
||||
// Transfer the array classes, otherwise we might get cast exceptions when casting array types.
|
||||
// Also, set array klasses element klass.
|
||||
cur->set_array_klasses(array_klasses);
|
||||
- ObjArrayKlass::cast(array_klasses)->set_element_klass(cur);
|
||||
+ array_klasses->set_element_klass(cur);
|
||||
java_lang_Class::release_set_array_klass(cur->java_mirror(), array_klasses);
|
||||
java_lang_Class::set_component_mirror(array_klasses->java_mirror(), cur->java_mirror());
|
||||
}
|
||||
@@ -640,12 +647,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
//MethodDataCleaner clean_weak_method_links;
|
||||
//ClassLoaderDataGraph::classes_do(&clean_weak_method_links);
|
||||
|
||||
- // Disable any dependent concurrent compilations
|
||||
- SystemDictionary::notice_modification();
|
||||
-
|
||||
- // Set flag indicating that some invariants are no longer true.
|
||||
- // See jvmtiExport.hpp for detailed explanation.
|
||||
- JvmtiExport::set_has_redefined_a_class();
|
||||
+ JvmtiExport::increment_redefinition_count();
|
||||
|
||||
#ifdef PRODUCT
|
||||
if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) {
|
||||
//MethodDataCleaner clean_weak_method_links;
|
||||
//ClassLoaderDataGraph::classes_do(&clean_weak_method_links);
|
||||
|
||||
- // Disable any dependent concurrent compilations
|
||||
- SystemDictionary::notice_modification();
|
||||
-
|
||||
- // Set flag indicating that some invariants are no longer true.
|
||||
- // See jvmtiExport.hpp for detailed explanation.
|
||||
- JvmtiExport::set_has_redefined_a_class();
|
||||
+ JvmtiExport::increment_redefinition_count();
|
||||
|
||||
#ifdef PRODUCT
|
||||
if (log_is_enabled(Trace, redefine, class, obsolete, metadata)) {
|
||||
@@ -718,7 +720,7 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
}
|
||||
|
||||
// Cannot redefine or retransform an anonymous class.
|
||||
- if (InstanceKlass::cast(k)->is_anonymous()) {
|
||||
+ if (InstanceKlass::cast(k)->is_unsafe_anonymous()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cannot redefine or retransform an anonymous class.
|
||||
- if (InstanceKlass::cast(k)->is_anonymous()) {
|
||||
+ if (InstanceKlass::cast(k)->is_unsafe_anonymous()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -804,22 +806,30 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
InstanceKlass* k;
|
||||
|
||||
- if (InstanceKlass::cast(the_class)->is_anonymous()) {
|
||||
- const InstanceKlass* host_class = the_class->host_klass();
|
||||
+ if (InstanceKlass::cast(the_class)->is_unsafe_anonymous()) {
|
||||
+ const InstanceKlass* host_class = the_class->unsafe_anonymous_host();
|
||||
|
||||
// Make sure it's the real host class, not another anonymous class.
|
||||
- while (host_class != NULL && host_class->is_anonymous()) {
|
||||
- host_class = host_class->host_klass();
|
||||
+ while (host_class != NULL && host_class->is_unsafe_anonymous()) {
|
||||
+ host_class = host_class->unsafe_anonymous_host();
|
||||
}
|
||||
|
||||
+ ClassLoadInfo cl_info(protection_domain,
|
||||
+ host_class,
|
||||
+ NULL, // dynamic_nest_host
|
||||
+ NULL, // cp_patches
|
||||
+ Handle(), // classData
|
||||
+ false, // is_hidden
|
||||
+ false, // is_strong_hidden
|
||||
+ true); // FIXME: check if correct. can_access_vm_annotations
|
||||
+
|
||||
k = SystemDictionary::parse_stream(the_class_sym,
|
||||
the_class_loader,
|
||||
- protection_domain,
|
||||
&st,
|
||||
- host_class,
|
||||
+ cl_info,
|
||||
the_class,
|
||||
- NULL,
|
||||
THREAD);
|
||||
+
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
the_class->class_loader_data()->inc_keep_alive();
|
||||
} else {
|
||||
|
||||
InstanceKlass* k;
|
||||
|
||||
- if (InstanceKlass::cast(the_class)->is_anonymous()) {
|
||||
- const InstanceKlass* host_class = the_class->host_klass();
|
||||
+ if (InstanceKlass::cast(the_class)->is_unsafe_anonymous()) {
|
||||
+ const InstanceKlass* host_class = the_class->unsafe_anonymous_host();
|
||||
|
||||
// Make sure it's the real host class, not another anonymous class.
|
||||
- while (host_class != NULL && host_class->is_anonymous()) {
|
||||
- host_class = host_class->host_klass();
|
||||
+ while (host_class != NULL && host_class->is_unsafe_anonymous()) {
|
||||
+ host_class = host_class->unsafe_anonymous_host();
|
||||
}
|
||||
|
||||
+ ClassLoadInfo cl_info(protection_domain,
|
||||
+ host_class,
|
||||
+ NULL, // dynamic_nest_host
|
||||
+ NULL, // cp_patches
|
||||
+ Handle(), // classData
|
||||
+ false, // is_hidden
|
||||
+ false, // is_strong_hidden
|
||||
+ true); // FIXME: check if correct. can_access_vm_annotations
|
||||
+
|
||||
k = SystemDictionary::parse_stream(the_class_sym,
|
||||
the_class_loader,
|
||||
- protection_domain,
|
||||
&st,
|
||||
- host_class,
|
||||
+ cl_info,
|
||||
the_class,
|
||||
- NULL,
|
||||
THREAD);
|
||||
+
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
the_class->class_loader_data()->inc_keep_alive();
|
||||
} else {
|
||||
@@ -966,7 +976,7 @@ int VM_EnhancedRedefineClasses::calculate_redefinition_flags(InstanceKlass* new_
|
||||
// Check interfaces
|
||||
|
||||
// Interfaces removed?
|
||||
- Array<Klass*>* old_interfaces = the_class->transitive_interfaces();
|
||||
+ Array<InstanceKlass*>* old_interfaces = the_class->transitive_interfaces();
|
||||
for (i = 0; i < old_interfaces->length(); i++) {
|
||||
InstanceKlass* old_interface = InstanceKlass::cast(old_interfaces->at(i));
|
||||
if (!new_class->implements_interface_any_version(old_interface)) {
|
||||
// Check interfaces
|
||||
|
||||
// Interfaces removed?
|
||||
- Array<Klass*>* old_interfaces = the_class->transitive_interfaces();
|
||||
+ Array<InstanceKlass*>* old_interfaces = the_class->transitive_interfaces();
|
||||
for (i = 0; i < old_interfaces->length(); i++) {
|
||||
InstanceKlass* old_interface = InstanceKlass::cast(old_interfaces->at(i));
|
||||
if (!new_class->implements_interface_any_version(old_interface)) {
|
||||
@@ -976,7 +986,7 @@ int VM_EnhancedRedefineClasses::calculate_redefinition_flags(InstanceKlass* new_
|
||||
}
|
||||
|
||||
// Interfaces added?
|
||||
- Array<Klass*>* new_interfaces = new_class->transitive_interfaces();
|
||||
+ Array<InstanceKlass*>* new_interfaces = new_class->transitive_interfaces();
|
||||
for (i = 0; i<new_interfaces->length(); i++) {
|
||||
if (!the_class->implements_interface_any_version(new_interfaces->at(i))) {
|
||||
result = result | Klass::ModifyClass;
|
||||
}
|
||||
|
||||
// Interfaces added?
|
||||
- Array<Klass*>* new_interfaces = new_class->transitive_interfaces();
|
||||
+ Array<InstanceKlass*>* new_interfaces = new_class->transitive_interfaces();
|
||||
for (i = 0; i<new_interfaces->length(); i++) {
|
||||
if (!the_class->implements_interface_any_version(new_interfaces->at(i))) {
|
||||
result = result | Klass::ModifyClass;
|
||||
@@ -1389,8 +1399,8 @@ void VM_EnhancedRedefineClasses::rollback() {
|
||||
// Rewrite faster byte-codes back to their slower equivalent. Undoes rewriting happening in templateTable_xxx.cpp
|
||||
// The reason is that once we zero cpool caches, we need to re-resolve all entries again. Faster bytecodes do not
|
||||
// do that, they assume that cache entry is resolved already.
|
||||
-void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
- RawBytecodeStream bcs(method);
|
||||
+void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method, TRAPS) {
|
||||
+ RawBytecodeStream bcs(methodHandle(THREAD, method));
|
||||
Bytecodes::Code code;
|
||||
Bytecodes::Code java_code;
|
||||
while (!bcs.is_last_bytecode()) {
|
||||
// Rewrite faster byte-codes back to their slower equivalent. Undoes rewriting happening in templateTable_xxx.cpp
|
||||
// The reason is that once we zero cpool caches, we need to re-resolve all entries again. Faster bytecodes do not
|
||||
// do that, they assume that cache entry is resolved already.
|
||||
-void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
- RawBytecodeStream bcs(method);
|
||||
+void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method, TRAPS) {
|
||||
+ RawBytecodeStream bcs(methodHandle(THREAD, method));
|
||||
Bytecodes::Code code;
|
||||
Bytecodes::Code java_code;
|
||||
while (!bcs.is_last_bytecode()) {
|
||||
@@ -1454,11 +1464,11 @@ void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
HandleMark hm(_thread);
|
||||
InstanceKlass *ik = InstanceKlass::cast(k);
|
||||
|
||||
- constantPoolHandle other_cp = constantPoolHandle(ik->constants());
|
||||
+ constantPoolHandle other_cp = constantPoolHandle(_thread, ik->constants());
|
||||
|
||||
// Update host klass of anonymous classes (for example, produced by lambdas) to newest version.
|
||||
- if (ik->is_anonymous() && ik->host_klass()->new_version() != NULL) {
|
||||
- ik->set_host_klass(InstanceKlass::cast(ik->host_klass()->newest_version()));
|
||||
+ if (ik->is_unsafe_anonymous() && ik->unsafe_anonymous_host()->new_version() != NULL) {
|
||||
+ ik->set_unsafe_anonymous_host(InstanceKlass::cast(ik->unsafe_anonymous_host()->newest_version()));
|
||||
}
|
||||
|
||||
// Update implementor if there is only one, in this case implementor() can reference old class
|
||||
HandleMark hm(_thread);
|
||||
InstanceKlass *ik = InstanceKlass::cast(k);
|
||||
|
||||
- constantPoolHandle other_cp = constantPoolHandle(ik->constants());
|
||||
+ constantPoolHandle other_cp = constantPoolHandle(_thread, ik->constants());
|
||||
|
||||
// Update host klass of anonymous classes (for example, produced by lambdas) to newest version.
|
||||
- if (ik->is_anonymous() && ik->host_klass()->new_version() != NULL) {
|
||||
- ik->set_host_klass(InstanceKlass::cast(ik->host_klass()->newest_version()));
|
||||
+ if (ik->is_unsafe_anonymous() && ik->unsafe_anonymous_host()->new_version() != NULL) {
|
||||
+ ik->set_unsafe_anonymous_host(InstanceKlass::cast(ik->unsafe_anonymous_host()->newest_version()));
|
||||
}
|
||||
|
||||
// Update implementor if there is only one, in this case implementor() can reference old class
|
||||
@@ -1492,7 +1502,18 @@ void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
|
||||
// If bytecode rewriting is enabled, we also need to unpatch bytecode to force resolution of zeroed entries
|
||||
if (RewriteBytecodes) {
|
||||
- ik->methods_do(unpatch_bytecode);
|
||||
+ ik->methods_do(unpatch_bytecode, _thread);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+u8 VM_EnhancedRedefineClasses::next_id() {
|
||||
+ while (true) {
|
||||
+ u8 id = _id_counter;
|
||||
+ u8 next_id = id + 1;
|
||||
+ u8 result = Atomic::cmpxchg(&_id_counter, id, next_id);
|
||||
+ if (result == id) {
|
||||
+ return next_id;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If bytecode rewriting is enabled, we also need to unpatch bytecode to force resolution of zeroed entries
|
||||
if (RewriteBytecodes) {
|
||||
- ik->methods_do(unpatch_bytecode);
|
||||
+ ik->methods_do(unpatch_bytecode, _thread);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+u8 VM_EnhancedRedefineClasses::next_id() {
|
||||
+ while (true) {
|
||||
+ u8 id = _id_counter;
|
||||
+ u8 next_id = id + 1;
|
||||
+ u8 result = Atomic::cmpxchg(&_id_counter, id, next_id);
|
||||
+ if (result == id) {
|
||||
+ return next_id;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1512,31 +1533,8 @@ void VM_EnhancedRedefineClasses::MethodDataCleaner::do_klass(Klass* k) {
|
||||
}
|
||||
}
|
||||
|
||||
-void VM_EnhancedRedefineClasses::fix_invoke_method(Method* method) {
|
||||
-
|
||||
- constantPoolHandle other_cp = constantPoolHandle(method->constants());
|
||||
-
|
||||
- for (int i = 0; i < other_cp->length(); i++) {
|
||||
- if (other_cp->tag_at(i).is_klass()) {
|
||||
- Klass* klass = other_cp->resolved_klass_at(i);
|
||||
- if (klass->new_version() != NULL) {
|
||||
- // Constant pool entry points to redefined class -- update to the new version
|
||||
- other_cp->klass_at_put(i, klass->newest_version());
|
||||
- }
|
||||
- assert(other_cp->resolved_klass_at(i)->new_version() == NULL, "Must be new klass!");
|
||||
- }
|
||||
- }
|
||||
|
||||
- ConstantPoolCache* cp_cache = other_cp->cache();
|
||||
- if (cp_cache != NULL) {
|
||||
- cp_cache->clear_entries();
|
||||
- }
|
||||
-
|
||||
-}
|
||||
-
|
||||
-
|
||||
-
|
||||
-void VM_EnhancedRedefineClasses::update_jmethod_ids() {
|
||||
+void VM_EnhancedRedefineClasses::update_jmethod_ids(TRAPS) {
|
||||
for (int j = 0; j < _matching_methods_length; ++j) {
|
||||
Method* old_method = _matching_old_methods[j];
|
||||
jmethodID jmid = old_method->find_jmethod_id_or_null();
|
||||
}
|
||||
}
|
||||
|
||||
-void VM_EnhancedRedefineClasses::fix_invoke_method(Method* method) {
|
||||
-
|
||||
- constantPoolHandle other_cp = constantPoolHandle(method->constants());
|
||||
-
|
||||
- for (int i = 0; i < other_cp->length(); i++) {
|
||||
- if (other_cp->tag_at(i).is_klass()) {
|
||||
- Klass* klass = other_cp->resolved_klass_at(i);
|
||||
- if (klass->new_version() != NULL) {
|
||||
- // Constant pool entry points to redefined class -- update to the new version
|
||||
- other_cp->klass_at_put(i, klass->newest_version());
|
||||
- }
|
||||
- assert(other_cp->resolved_klass_at(i)->new_version() == NULL, "Must be new klass!");
|
||||
- }
|
||||
- }
|
||||
|
||||
- ConstantPoolCache* cp_cache = other_cp->cache();
|
||||
- if (cp_cache != NULL) {
|
||||
- cp_cache->clear_entries();
|
||||
- }
|
||||
-
|
||||
-}
|
||||
-
|
||||
-
|
||||
-
|
||||
-void VM_EnhancedRedefineClasses::update_jmethod_ids() {
|
||||
+void VM_EnhancedRedefineClasses::update_jmethod_ids(TRAPS) {
|
||||
for (int j = 0; j < _matching_methods_length; ++j) {
|
||||
Method* old_method = _matching_old_methods[j];
|
||||
jmethodID jmid = old_method->find_jmethod_id_or_null();
|
||||
@@ -1547,10 +1545,10 @@ void VM_EnhancedRedefineClasses::update_jmethod_ids() {
|
||||
|
||||
if (jmid != NULL) {
|
||||
// There is a jmethodID, change it to point to the new method
|
||||
- methodHandle new_method_h(_matching_new_methods[j]);
|
||||
+ methodHandle new_method_h(THREAD, _matching_new_methods[j]);
|
||||
|
||||
if (old_method->new_version() == NULL) {
|
||||
- methodHandle old_method_h(_matching_old_methods[j]);
|
||||
+ methodHandle old_method_h(THREAD, _matching_old_methods[j]);
|
||||
jmethodID new_jmethod_id = Method::make_jmethod_id(old_method_h->method_holder()->class_loader_data(), old_method_h());
|
||||
bool result = InstanceKlass::cast(old_method_h->method_holder())->update_jmethod_id(old_method_h(), new_jmethod_id);
|
||||
} else {
|
||||
|
||||
if (jmid != NULL) {
|
||||
// There is a jmethodID, change it to point to the new method
|
||||
- methodHandle new_method_h(_matching_new_methods[j]);
|
||||
+ methodHandle new_method_h(THREAD, _matching_new_methods[j]);
|
||||
|
||||
if (old_method->new_version() == NULL) {
|
||||
- methodHandle old_method_h(_matching_old_methods[j]);
|
||||
+ methodHandle old_method_h(THREAD, _matching_old_methods[j]);
|
||||
jmethodID new_jmethod_id = Method::make_jmethod_id(old_method_h->method_holder()->class_loader_data(), old_method_h());
|
||||
bool result = InstanceKlass::cast(old_method_h->method_holder())->update_jmethod_id(old_method_h(), new_jmethod_id);
|
||||
} else {
|
||||
@@ -1739,6 +1737,18 @@ void VM_EnhancedRedefineClasses::transfer_old_native_function_registrations(Inst
|
||||
transfer.transfer_registrations(_matching_old_methods, _matching_methods_length);
|
||||
}
|
||||
|
||||
+// First step is to walk the code cache for each class redefined and mark
|
||||
+// dependent methods. Wait until all classes are processed to deoptimize everything.
|
||||
+void VM_EnhancedRedefineClasses::mark_dependent_code(InstanceKlass* ik) {
|
||||
+ assert_locked_or_safepoint(Compile_lock);
|
||||
+
|
||||
+ // All dependencies have been recorded from startup or this is a second or
|
||||
+ // subsequent use of RedefineClasses
|
||||
+ if (0 && JvmtiExport::all_dependencies_are_recorded()) {
|
||||
+ CodeCache::mark_for_evol_deoptimization(ik);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// DCEVM - it always deoptimizes everything! (because it is very difficult to find only correct dependencies)
|
||||
// Deoptimize all compiled code that depends on this class.
|
||||
//
|
||||
transfer.transfer_registrations(_matching_old_methods, _matching_methods_length);
|
||||
}
|
||||
|
||||
+// First step is to walk the code cache for each class redefined and mark
|
||||
+// dependent methods. Wait until all classes are processed to deoptimize everything.
|
||||
+void VM_EnhancedRedefineClasses::mark_dependent_code(InstanceKlass* ik) {
|
||||
+ assert_locked_or_safepoint(Compile_lock);
|
||||
+
|
||||
+ // All dependencies have been recorded from startup or this is a second or
|
||||
+ // subsequent use of RedefineClasses
|
||||
+ if (0 && JvmtiExport::all_dependencies_are_recorded()) {
|
||||
+ CodeCache::mark_for_evol_deoptimization(ik);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// DCEVM - it always deoptimizes everything! (because it is very difficult to find only correct dependencies)
|
||||
// Deoptimize all compiled code that depends on this class.
|
||||
//
|
||||
@@ -1755,33 +1765,21 @@ void VM_EnhancedRedefineClasses::transfer_old_native_function_registrations(Inst
|
||||
// subsequent calls to RedefineClasses need only throw away code
|
||||
// that depends on the class.
|
||||
//
|
||||
-void VM_EnhancedRedefineClasses::flush_dependent_code(InstanceKlass* k_h, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::flush_dependent_code(TRAPS) {
|
||||
assert_locked_or_safepoint(Compile_lock);
|
||||
|
||||
// All dependencies have been recorded from startup or this is a second or
|
||||
// subsequent use of RedefineClasses
|
||||
// FIXME: for now, deoptimize all!
|
||||
- if (0 && k_h != NULL && JvmtiExport::all_dependencies_are_recorded()) {
|
||||
- CodeCache::flush_evol_dependents_on(k_h);
|
||||
- Klass* superCl = k_h->super();
|
||||
- // Deoptimize super classes since redefined class can has a new method override
|
||||
- while (superCl != NULL && !superCl->is_redefining()) {
|
||||
- CodeCache::flush_evol_dependents_on(InstanceKlass::cast(superCl));
|
||||
- superCl = superCl->super();
|
||||
+ if (0 && JvmtiExport::all_dependencies_are_recorded()) {
|
||||
+ int deopt = CodeCache::mark_dependents_for_evol_deoptimization();
|
||||
+ log_debug(redefine, class, nmethod)("Marked %d dependent nmethods for deopt", deopt);
|
||||
+ if (deopt != 0) {
|
||||
+ CodeCache::flush_evol_dependents();
|
||||
}
|
||||
} else {
|
||||
- CodeCache::mark_all_nmethods_for_deoptimization();
|
||||
-
|
||||
- ResourceMark rm(THREAD);
|
||||
- DeoptimizationMarker dm;
|
||||
-
|
||||
- // Deoptimize all activations depending on marked nmethods
|
||||
- Deoptimization::deoptimize_dependents();
|
||||
-
|
||||
- // Make the dependent methods not entrant
|
||||
- CodeCache::make_marked_nmethods_not_entrant();
|
||||
-
|
||||
- // From now on we know that the dependency information is complete
|
||||
+ CodeCache::mark_all_nmethods_for_evol_deoptimization();
|
||||
+ CodeCache::flush_evol_dependents();
|
||||
JvmtiExport::set_all_dependencies_are_recorded(true);
|
||||
}
|
||||
}
|
||||
// subsequent calls to RedefineClasses need only throw away code
|
||||
// that depends on the class.
|
||||
//
|
||||
-void VM_EnhancedRedefineClasses::flush_dependent_code(InstanceKlass* k_h, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::flush_dependent_code(TRAPS) {
|
||||
assert_locked_or_safepoint(Compile_lock);
|
||||
|
||||
// All dependencies have been recorded from startup or this is a second or
|
||||
// subsequent use of RedefineClasses
|
||||
// FIXME: for now, deoptimize all!
|
||||
- if (0 && k_h != NULL && JvmtiExport::all_dependencies_are_recorded()) {
|
||||
- CodeCache::flush_evol_dependents_on(k_h);
|
||||
- Klass* superCl = k_h->super();
|
||||
- // Deoptimize super classes since redefined class can has a new method override
|
||||
- while (superCl != NULL && !superCl->is_redefining()) {
|
||||
- CodeCache::flush_evol_dependents_on(InstanceKlass::cast(superCl));
|
||||
- superCl = superCl->super();
|
||||
+ if (0 && JvmtiExport::all_dependencies_are_recorded()) {
|
||||
+ int deopt = CodeCache::mark_dependents_for_evol_deoptimization();
|
||||
+ log_debug(redefine, class, nmethod)("Marked %d dependent nmethods for deopt", deopt);
|
||||
+ if (deopt != 0) {
|
||||
+ CodeCache::flush_evol_dependents();
|
||||
}
|
||||
} else {
|
||||
- CodeCache::mark_all_nmethods_for_deoptimization();
|
||||
-
|
||||
- ResourceMark rm(THREAD);
|
||||
- DeoptimizationMarker dm;
|
||||
-
|
||||
- // Deoptimize all activations depending on marked nmethods
|
||||
- Deoptimization::deoptimize_dependents();
|
||||
-
|
||||
- // Make the dependent methods not entrant
|
||||
- CodeCache::make_marked_nmethods_not_entrant();
|
||||
-
|
||||
- // From now on we know that the dependency information is complete
|
||||
+ CodeCache::mark_all_nmethods_for_evol_deoptimization();
|
||||
+ CodeCache::flush_evol_dependents();
|
||||
JvmtiExport::set_all_dependencies_are_recorded(true);
|
||||
}
|
||||
}
|
||||
@@ -1874,11 +1872,7 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
|
||||
jvmti_breakpoints.clearall_in_class_at_safepoint(the_class);
|
||||
|
||||
- // DCEVM Deoptimization is always for whole java world, call only once after all classes are redefined
|
||||
- // Deoptimize all compiled code that depends on this class
|
||||
-// if (_max_redefinition_flags <= Klass::ModifyClass) {
|
||||
-// flush_dependent_code(the_class, THREAD);
|
||||
-// }
|
||||
+ mark_dependent_code(the_class);
|
||||
|
||||
_old_methods = the_class->methods();
|
||||
_new_methods = new_class->methods();
|
||||
JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
|
||||
jvmti_breakpoints.clearall_in_class_at_safepoint(the_class);
|
||||
|
||||
- // DCEVM Deoptimization is always for whole java world, call only once after all classes are redefined
|
||||
- // Deoptimize all compiled code that depends on this class
|
||||
-// if (_max_redefinition_flags <= Klass::ModifyClass) {
|
||||
-// flush_dependent_code(the_class, THREAD);
|
||||
-// }
|
||||
+ mark_dependent_code(the_class);
|
||||
|
||||
_old_methods = the_class->methods();
|
||||
_new_methods = new_class->methods();
|
||||
@@ -1887,7 +1881,7 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
|
||||
// track number of methods that are EMCP for add_previous_version() call below
|
||||
check_methods_and_mark_as_obsolete();
|
||||
- update_jmethod_ids();
|
||||
+ update_jmethod_ids(THREAD);
|
||||
|
||||
_any_class_has_resolved_methods = the_class->has_resolved_methods() || _any_class_has_resolved_methods;
|
||||
|
||||
|
||||
// track number of methods that are EMCP for add_previous_version() call below
|
||||
check_methods_and_mark_as_obsolete();
|
||||
- update_jmethod_ids();
|
||||
+ update_jmethod_ids(THREAD);
|
||||
|
||||
_any_class_has_resolved_methods = the_class->has_resolved_methods() || _any_class_has_resolved_methods;
|
||||
|
||||
@@ -2119,12 +2113,12 @@ jvmtiError VM_EnhancedRedefineClasses::do_topological_class_sorting(TRAPS) {
|
||||
|
||||
Handle protection_domain(THREAD, klass->protection_domain());
|
||||
|
||||
+ ClassLoadInfo cl_info(protection_domain);
|
||||
+
|
||||
ClassFileParser parser(&st,
|
||||
klass->name(),
|
||||
klass->class_loader_data(),
|
||||
- protection_domain,
|
||||
- NULL, // host_klass
|
||||
- NULL, // cp_patches
|
||||
+ &cl_info,
|
||||
ClassFileParser::INTERNAL, // publicity level
|
||||
true,
|
||||
THREAD);
|
||||
|
||||
Handle protection_domain(THREAD, klass->protection_domain());
|
||||
|
||||
+ ClassLoadInfo cl_info(protection_domain);
|
||||
+
|
||||
ClassFileParser parser(&st,
|
||||
klass->name(),
|
||||
klass->class_loader_data(),
|
||||
- protection_domain,
|
||||
- NULL, // host_klass
|
||||
- NULL, // cp_patches
|
||||
+ &cl_info,
|
||||
ClassFileParser::INTERNAL, // publicity level
|
||||
true,
|
||||
THREAD);
|
||||
@@ -2134,7 +2128,7 @@ jvmtiError VM_EnhancedRedefineClasses::do_topological_class_sorting(TRAPS) {
|
||||
links.append(KlassPair(super_klass, klass));
|
||||
}
|
||||
|
||||
- Array<Klass*>* local_interfaces = parser.local_interfaces();
|
||||
+ Array<InstanceKlass*>* local_interfaces = parser.local_interfaces();
|
||||
for (int j = 0; j < local_interfaces->length(); j++) {
|
||||
Klass* iface = local_interfaces->at(j);
|
||||
if (iface != NULL && _affected_klasses->contains(iface)) {
|
||||
links.append(KlassPair(super_klass, klass));
|
||||
}
|
||||
|
||||
- Array<Klass*>* local_interfaces = parser.local_interfaces();
|
||||
+ Array<InstanceKlass*>* local_interfaces = parser.local_interfaces();
|
||||
for (int j = 0; j < local_interfaces->length(); j++) {
|
||||
Klass* iface = local_interfaces->at(j);
|
||||
if (iface != NULL && _affected_klasses->contains(iface)) {
|
||||
@@ -2157,7 +2151,7 @@ jvmtiError VM_EnhancedRedefineClasses::do_topological_class_sorting(TRAPS) {
|
||||
links.append(KlassPair(super_klass, klass));
|
||||
}
|
||||
|
||||
- Array<Klass*>* local_interfaces = klass->local_interfaces();
|
||||
+ Array<InstanceKlass*>* local_interfaces = klass->local_interfaces();
|
||||
for (int j = 0; j < local_interfaces->length(); j++) {
|
||||
Klass* interfaceKlass = local_interfaces->at(j);
|
||||
if (_affected_klasses->contains(interfaceKlass)) {
|
||||
links.append(KlassPair(super_klass, klass));
|
||||
}
|
||||
|
||||
- Array<Klass*>* local_interfaces = klass->local_interfaces();
|
||||
+ Array<InstanceKlass*>* local_interfaces = klass->local_interfaces();
|
||||
for (int j = 0; j < local_interfaces->length(); j++) {
|
||||
Klass* interfaceKlass = local_interfaces->at(j);
|
||||
if (_affected_klasses->contains(interfaceKlass)) {
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 4c0412d343d..bd5e7d153be 100644
|
||||
index d00109a0b92..61f62e7f831 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.hpp"
|
||||
-#include "gc/shared/vmGCOperations.hpp"
|
||||
+#include "gc/shared/gcVMOperations.hpp"
|
||||
#include "../../../java.base/unix/native/include/jni_md.h"
|
||||
|
||||
//
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/objArrayKlass.hpp"
|
||||
#include "oops/objArrayOop.hpp"
|
||||
-#include "gc/shared/vmGCOperations.hpp"
|
||||
+#include "gc/shared/gcVMOperations.hpp"
|
||||
#include "../../../java.base/unix/native/include/jni_md.h"
|
||||
|
||||
//
|
||||
@@ -59,6 +59,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
static int _deleted_methods_length;
|
||||
static int _added_methods_length;
|
||||
static Klass* _the_class_oop;
|
||||
+ static u8 _id_counter;
|
||||
|
||||
// The instance fields are used to pass information from
|
||||
// doit_prologue() to doit() and doit_epilogue().
|
||||
static int _deleted_methods_length;
|
||||
static int _added_methods_length;
|
||||
static Klass* _the_class_oop;
|
||||
+ static u8 _id_counter;
|
||||
|
||||
// The instance fields are used to pass information from
|
||||
// doit_prologue() to doit() and doit_epilogue().
|
||||
@@ -91,6 +92,9 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
elapsedTimer _timer_heap_iterate;
|
||||
elapsedTimer _timer_heap_full_gc;
|
||||
|
||||
+ // Redefinition id used by JFR
|
||||
+ u8 _id;
|
||||
+
|
||||
// These routines are roughly in call order unless otherwise noted.
|
||||
|
||||
// Load and link new classes (either redefined or affected by redefinition - subclass, ...)
|
||||
elapsedTimer _timer_heap_iterate;
|
||||
elapsedTimer _timer_heap_full_gc;
|
||||
|
||||
+ // Redefinition id used by JFR
|
||||
+ u8 _id;
|
||||
+
|
||||
// These routines are roughly in call order unless otherwise noted.
|
||||
|
||||
// Load and link new classes (either redefined or affected by redefinition - subclass, ...)
|
||||
@@ -118,15 +122,14 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
static void unregister_nmethod_g1(nmethod* nm);
|
||||
static void register_nmethod_g1(nmethod* nm);
|
||||
- static void unpatch_bytecode(Method* method);
|
||||
- static void fix_invoke_method(Method* method);
|
||||
+ static void unpatch_bytecode(Method* method, TRAPS);
|
||||
|
||||
// Figure out which new methods match old methods in name and signature,
|
||||
// which methods have been added, and which are no longer present
|
||||
void compute_added_deleted_matching_methods();
|
||||
|
||||
// Change jmethodIDs to point to the new methods
|
||||
- void update_jmethod_ids();
|
||||
+ void update_jmethod_ids(TRAPS);
|
||||
|
||||
// marking methods as old and/or obsolete
|
||||
void check_methods_and_mark_as_obsolete();
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
static void unregister_nmethod_g1(nmethod* nm);
|
||||
static void register_nmethod_g1(nmethod* nm);
|
||||
- static void unpatch_bytecode(Method* method);
|
||||
- static void fix_invoke_method(Method* method);
|
||||
+ static void unpatch_bytecode(Method* method, TRAPS);
|
||||
|
||||
// Figure out which new methods match old methods in name and signature,
|
||||
// which methods have been added, and which are no longer present
|
||||
void compute_added_deleted_matching_methods();
|
||||
|
||||
// Change jmethodIDs to point to the new methods
|
||||
- void update_jmethod_ids();
|
||||
+ void update_jmethod_ids(TRAPS);
|
||||
|
||||
// marking methods as old and/or obsolete
|
||||
void check_methods_and_mark_as_obsolete();
|
||||
@@ -139,7 +142,11 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
// and in all direct and indirect subclasses.
|
||||
void increment_class_counter(InstanceKlass *ik, TRAPS);
|
||||
|
||||
- void flush_dependent_code(InstanceKlass* k_h, TRAPS);
|
||||
+ void mark_dependent_code(InstanceKlass* ik);
|
||||
+
|
||||
+ void flush_dependent_code(TRAPS);
|
||||
+
|
||||
+ u8 next_id();
|
||||
|
||||
static void check_class(InstanceKlass* k_oop, TRAPS);
|
||||
|
||||
// and in all direct and indirect subclasses.
|
||||
void increment_class_counter(InstanceKlass *ik, TRAPS);
|
||||
|
||||
- void flush_dependent_code(InstanceKlass* k_h, TRAPS);
|
||||
+ void mark_dependent_code(InstanceKlass* ik);
|
||||
+
|
||||
+ void flush_dependent_code(TRAPS);
|
||||
+
|
||||
+ u8 next_id();
|
||||
|
||||
static void check_class(InstanceKlass* k_oop, TRAPS);
|
||||
|
||||
@@ -181,6 +188,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
|
||||
bool allow_nested_vm_operations() const { return true; }
|
||||
jvmtiError check_error() { return _res; }
|
||||
+ u8 id() { return _id; }
|
||||
|
||||
// Modifiable test must be shared between IsModifiableClass query
|
||||
// and redefine implementation
|
||||
|
||||
bool allow_nested_vm_operations() const { return true; }
|
||||
jvmtiError check_error() { return _res; }
|
||||
+ u8 id() { return _id; }
|
||||
|
||||
// Modifiable test must be shared between IsModifiableClass query
|
||||
// and redefine implementation
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp
|
||||
index 6d1692949cb..8970d7991b7 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnv.cpp
|
||||
@@ -1151,10 +1151,10 @@ index b8d039adff6..3c29eda4da0 100644
|
||||
class VerifyResolvedMethod : StackObj {
|
||||
public:
|
||||
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
|
||||
index b7bb88e2a46..567803b70b7 100644
|
||||
index 2d33448ec8d..9661f2b62b9 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.cpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.cpp
|
||||
@@ -1975,13 +1975,15 @@ bool Arguments::check_gc_consistency() {
|
||||
@@ -1979,13 +1979,15 @@ bool Arguments::check_gc_consistency() {
|
||||
// of collectors.
|
||||
uint i = 0;
|
||||
if (UseSerialGC) i++;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 9815ee603b27484953651bdc6d5705994a4d38aa Mon Sep 17 00:00:00 2001
|
||||
From 4c98b29fed42b51e399f2ae0dc06f0c7a4397e2c Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 22 Nov 2020 19:51:46 +0100
|
||||
Subject: [PATCH 13/39] dcevm15 - add ClassLoaderDataGraph_lock on
|
||||
Subject: [PATCH 13/42] dcevm15 - add ClassLoaderDataGraph_lock on
|
||||
ClassLoaderDataGraph::classes_do
|
||||
|
||||
ClassLoaderDataGraph::classes_do and need safepoint or lock,
|
||||
@@ -13,31 +13,31 @@ ClassLoaderDataGraph::rollback_redefinition need safepoint too
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index efaf11e1666..9f42d14ce98 100644
|
||||
index a27c2ff87ae..001d2c782d8 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -1380,7 +1380,9 @@ void VM_EnhancedRedefineClasses::calculate_instance_update_information(Klass* ne
|
||||
// Rollback all changes - clear new classes from the system dictionary, return old classes to directory, free memory.
|
||||
void VM_EnhancedRedefineClasses::rollback() {
|
||||
log_info(redefine, class, load)("Rolling back redefinition, result=%d", _res);
|
||||
+ ClassLoaderDataGraph_lock->lock();
|
||||
ClassLoaderDataGraph::rollback_redefinition();
|
||||
+ ClassLoaderDataGraph_lock->unlock();
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
SystemDictionary::remove_from_hierarchy(_new_classes->at(i));
|
||||
// Rollback all changes - clear new classes from the system dictionary, return old classes to directory, free memory.
|
||||
void VM_EnhancedRedefineClasses::rollback() {
|
||||
log_info(redefine, class, load)("Rolling back redefinition, result=%d", _res);
|
||||
+ ClassLoaderDataGraph_lock->lock();
|
||||
ClassLoaderDataGraph::rollback_redefinition();
|
||||
+ ClassLoaderDataGraph_lock->unlock();
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
SystemDictionary::remove_from_hierarchy(_new_classes->at(i));
|
||||
@@ -2063,7 +2065,10 @@ jvmtiError VM_EnhancedRedefineClasses::find_sorted_affected_classes(TRAPS) {
|
||||
AffectedKlassClosure closure(_affected_klasses);
|
||||
// Updated in j10, from original SystemDictionary::classes_do
|
||||
|
||||
- ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ {
|
||||
+ MutexLocker mcld(ClassLoaderDataGraph_lock);
|
||||
+ ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ }
|
||||
//ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
AffectedKlassClosure closure(_affected_klasses);
|
||||
// Updated in j10, from original SystemDictionary::classes_do
|
||||
|
||||
- ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ {
|
||||
+ MutexLocker mcld(ClassLoaderDataGraph_lock);
|
||||
+ ClassLoaderDataGraph::classes_do(&closure);
|
||||
+ }
|
||||
//ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From d3e5f8acd389021128bb8a899bb538294de353f6 Mon Sep 17 00:00:00 2001
|
||||
From b312e64db8532c57658d1f39269d73969ecf98d4 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 22 Nov 2020 12:05:50 +0100
|
||||
Subject: [PATCH 14/39] dcevm15 - fix Universe::root_oops_do
|
||||
Subject: [PATCH 14/42] dcevm15 - fix Universe::root_oops_do
|
||||
|
||||
Removed ClassLoaderDataGraph::cld_do was cause of crashes due multiple
|
||||
oop patching. ClassLoaderDataGraph::cld_do replaced in dcevm15
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 574cddeb00c3d93bddbaf1845a7d9d3ffdced324 Mon Sep 17 00:00:00 2001
|
||||
From b99bae1157fea7a62a2c9d2f10aaf722de1a5299 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 28 Nov 2020 19:29:42 +0100
|
||||
Subject: [PATCH 15/39] dcevm15 - check if has_nestmate_access_to has newest
|
||||
Subject: [PATCH 15/42] dcevm15 - check if has_nestmate_access_to has newest
|
||||
host class
|
||||
|
||||
---
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
From 983b4aaed2c56a74287b9400ddae4b7d7f3fd715 Mon Sep 17 00:00:00 2001
|
||||
From 936d83f295468e7c0e51b759def1d8664cca2a6e Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 29 Nov 2020 17:18:16 +0100
|
||||
Subject: [PATCH 16/39] dcevm15 - mark_as_scavengable only alive methods
|
||||
Subject: [PATCH 16/42] dcevm15 - mark_as_scavengable only alive methods
|
||||
|
||||
---
|
||||
.../share/prims/jvmtiEnhancedRedefineClasses.cpp | 14 ++++++++------
|
||||
1 file changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 9f42d14ce98..db5fb1c472b 100644
|
||||
index 001d2c782d8..d742679d199 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -223,19 +223,21 @@ class FieldCopier : public FieldClosure {
|
||||
|
||||
// TODO: review...
|
||||
void VM_EnhancedRedefineClasses::mark_as_scavengable(nmethod* nm) {
|
||||
- ScavengableNMethods::register_nmethod(nm);
|
||||
+ if (nm->is_alive()) {
|
||||
+ ScavengableNMethods::register_nmethod(nm);
|
||||
+ }
|
||||
}
|
||||
|
||||
void VM_EnhancedRedefineClasses::unregister_nmethod_g1(nmethod* nm) {
|
||||
// It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
- if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ if (nm->is_alive()) {
|
||||
Universe::heap()->unregister_nmethod(nm);
|
||||
}
|
||||
}
|
||||
|
||||
void VM_EnhancedRedefineClasses::register_nmethod_g1(nmethod* nm) {
|
||||
// It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
- if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ if (nm->is_alive()) {
|
||||
Universe::heap()->register_nmethod(nm);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: review...
|
||||
void VM_EnhancedRedefineClasses::mark_as_scavengable(nmethod* nm) {
|
||||
- ScavengableNMethods::register_nmethod(nm);
|
||||
+ if (nm->is_alive()) {
|
||||
+ ScavengableNMethods::register_nmethod(nm);
|
||||
+ }
|
||||
}
|
||||
|
||||
void VM_EnhancedRedefineClasses::unregister_nmethod_g1(nmethod* nm) {
|
||||
// It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
- if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ if (nm->is_alive()) {
|
||||
Universe::heap()->unregister_nmethod(nm);
|
||||
}
|
||||
}
|
||||
|
||||
void VM_EnhancedRedefineClasses::register_nmethod_g1(nmethod* nm) {
|
||||
// It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
- if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ if (nm->is_alive()) {
|
||||
Universe::heap()->register_nmethod(nm);
|
||||
}
|
||||
}
|
||||
@@ -511,9 +513,9 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
flush_dependent_code(thread);
|
||||
// }
|
||||
|
||||
- // Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
- ClearCpoolCacheAndUnpatch clear_cpool_cache(thread);
|
||||
- ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
+ // Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
+ ClearCpoolCacheAndUnpatch clear_cpool_cache(thread);
|
||||
+ ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
|
||||
// JSR-292 support
|
||||
if (_any_class_has_resolved_methods) {
|
||||
flush_dependent_code(thread);
|
||||
// }
|
||||
|
||||
- // Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
- ClearCpoolCacheAndUnpatch clear_cpool_cache(thread);
|
||||
- ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
+ // Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
+ ClearCpoolCacheAndUnpatch clear_cpool_cache(thread);
|
||||
+ ClassLoaderDataGraph::classes_do(&clear_cpool_cache);
|
||||
|
||||
// JSR-292 support
|
||||
if (_any_class_has_resolved_methods) {
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
From ed546016ead6064d8b95a9c1e4cdc6bc192f8d67 Mon Sep 17 00:00:00 2001
|
||||
From 50e3023f20fbea76fcc644a037bebc3ee5afc212 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 29 Nov 2020 20:05:03 +0100
|
||||
Subject: [PATCH 17/39] dcevm15 - fix hidded classes
|
||||
Subject: [PATCH 17/42] dcevm15 - fix hidded classes
|
||||
|
||||
---
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 41 ++++++++++++++-----
|
||||
1 file changed, 30 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index db5fb1c472b..590f7fdfafe 100644
|
||||
index d742679d199..1433e429e30 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -722,7 +722,8 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
}
|
||||
|
||||
// Cannot redefine or retransform an anonymous class.
|
||||
- if (InstanceKlass::cast(k)->is_unsafe_anonymous()) {
|
||||
+ // TODO: check if is correct in j15
|
||||
+ if (InstanceKlass::cast(k)->is_unsafe_anonymous() || InstanceKlass::cast(k)->is_hidden()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cannot redefine or retransform an anonymous class.
|
||||
- if (InstanceKlass::cast(k)->is_unsafe_anonymous()) {
|
||||
+ // TODO: check if is correct in j15
|
||||
+ if (InstanceKlass::cast(k)->is_unsafe_anonymous() || InstanceKlass::cast(k)->is_hidden()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -808,21 +809,27 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
InstanceKlass* k;
|
||||
|
||||
- if (InstanceKlass::cast(the_class)->is_unsafe_anonymous()) {
|
||||
- const InstanceKlass* host_class = the_class->unsafe_anonymous_host();
|
||||
+ if (the_class->is_unsafe_anonymous() || the_class->is_hidden()) {
|
||||
+ InstanceKlass* dynamic_host_class = NULL;
|
||||
+ InstanceKlass* unsafe_anonymous_host = NULL;
|
||||
|
||||
- // Make sure it's the real host class, not another anonymous class.
|
||||
- while (host_class != NULL && host_class->is_unsafe_anonymous()) {
|
||||
- host_class = host_class->unsafe_anonymous_host();
|
||||
+ if (the_class->is_hidden()) {
|
||||
+ log_debug(redefine, class, load)("loading hidden class %s", the_class->name()->as_C_string());
|
||||
+ dynamic_host_class = the_class->nest_host(THREAD);
|
||||
+ }
|
||||
+
|
||||
+ if (the_class->is_unsafe_anonymous()) {
|
||||
+ log_debug(redefine, class, load)("loading usafe anonymous %s", the_class->name()->as_C_string());
|
||||
+ unsafe_anonymous_host = the_class->unsafe_anonymous_host();
|
||||
}
|
||||
|
||||
ClassLoadInfo cl_info(protection_domain,
|
||||
- host_class,
|
||||
- NULL, // dynamic_nest_host
|
||||
+ unsafe_anonymous_host,
|
||||
NULL, // cp_patches
|
||||
+ dynamic_host_class, // dynamic_nest_host
|
||||
Handle(), // classData
|
||||
- false, // is_hidden
|
||||
- false, // is_strong_hidden
|
||||
+ the_class->is_hidden(), // is_hidden
|
||||
+ !the_class->is_non_strong_hidden(), // is_strong_hidden
|
||||
true); // FIXME: check if correct. can_access_vm_annotations
|
||||
|
||||
k = SystemDictionary::parse_stream(the_class_sym,
|
||||
|
||||
InstanceKlass* k;
|
||||
|
||||
- if (InstanceKlass::cast(the_class)->is_unsafe_anonymous()) {
|
||||
- const InstanceKlass* host_class = the_class->unsafe_anonymous_host();
|
||||
+ if (the_class->is_unsafe_anonymous() || the_class->is_hidden()) {
|
||||
+ InstanceKlass* dynamic_host_class = NULL;
|
||||
+ InstanceKlass* unsafe_anonymous_host = NULL;
|
||||
|
||||
- // Make sure it's the real host class, not another anonymous class.
|
||||
- while (host_class != NULL && host_class->is_unsafe_anonymous()) {
|
||||
- host_class = host_class->unsafe_anonymous_host();
|
||||
+ if (the_class->is_hidden()) {
|
||||
+ log_debug(redefine, class, load)("loading hidden class %s", the_class->name()->as_C_string());
|
||||
+ dynamic_host_class = the_class->nest_host(THREAD);
|
||||
+ }
|
||||
+
|
||||
+ if (the_class->is_unsafe_anonymous()) {
|
||||
+ log_debug(redefine, class, load)("loading usafe anonymous %s", the_class->name()->as_C_string());
|
||||
+ unsafe_anonymous_host = the_class->unsafe_anonymous_host();
|
||||
}
|
||||
|
||||
ClassLoadInfo cl_info(protection_domain,
|
||||
- host_class,
|
||||
- NULL, // dynamic_nest_host
|
||||
+ unsafe_anonymous_host,
|
||||
NULL, // cp_patches
|
||||
+ dynamic_host_class, // dynamic_nest_host
|
||||
Handle(), // classData
|
||||
- false, // is_hidden
|
||||
- false, // is_strong_hidden
|
||||
+ the_class->is_hidden(), // is_hidden
|
||||
+ !the_class->is_non_strong_hidden(), // is_strong_hidden
|
||||
true); // FIXME: check if correct. can_access_vm_annotations
|
||||
|
||||
k = SystemDictionary::parse_stream(the_class_sym,
|
||||
@@ -833,7 +840,17 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
THREAD);
|
||||
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
- the_class->class_loader_data()->inc_keep_alive();
|
||||
+
|
||||
+ if (the_class->is_hidden()) {
|
||||
+ // from jvm_lookup_define_class() (jvm.cpp):
|
||||
+ // The hidden class loader data has been artificially been kept alive to
|
||||
+ // this point. The mirror and any instances of this class have to keep
|
||||
+ // it alive afterwards.
|
||||
+ the_class->class_loader_data()->dec_keep_alive();
|
||||
+ } else {
|
||||
+ the_class->class_loader_data()->inc_keep_alive();
|
||||
+ }
|
||||
+
|
||||
} else {
|
||||
k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
the_class_loader,
|
||||
THREAD);
|
||||
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
- the_class->class_loader_data()->inc_keep_alive();
|
||||
+
|
||||
+ if (the_class->is_hidden()) {
|
||||
+ // from jvm_lookup_define_class() (jvm.cpp):
|
||||
+ // The hidden class loader data has been artificially been kept alive to
|
||||
+ // this point. The mirror and any instances of this class have to keep
|
||||
+ // it alive afterwards.
|
||||
+ the_class->class_loader_data()->dec_keep_alive();
|
||||
+ } else {
|
||||
+ the_class->class_loader_data()->inc_keep_alive();
|
||||
+ }
|
||||
+
|
||||
} else {
|
||||
k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
the_class_loader,
|
||||
@@ -1475,6 +1492,8 @@ void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
ik->set_unsafe_anonymous_host(InstanceKlass::cast(ik->unsafe_anonymous_host()->newest_version()));
|
||||
}
|
||||
|
||||
+ // FIXME: check new nest_host for hidden
|
||||
+
|
||||
// Update implementor if there is only one, in this case implementor() can reference old class
|
||||
if (ik->is_interface()) {
|
||||
Klass* implKlass = ik->implementor();
|
||||
ik->set_unsafe_anonymous_host(InstanceKlass::cast(ik->unsafe_anonymous_host()->newest_version()));
|
||||
}
|
||||
|
||||
+ // FIXME: check new nest_host for hidden
|
||||
+
|
||||
// Update implementor if there is only one, in this case implementor() can reference old class
|
||||
if (ik->is_interface()) {
|
||||
Klass* implKlass = ik->implementor();
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 9983c44fe6903daba758ed0c43b8c86e738e0741 Mon Sep 17 00:00:00 2001
|
||||
From 21a17a7caf43236590d2e7319e176cb19c42f9aa Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 29 Nov 2020 20:08:57 +0100
|
||||
Subject: [PATCH 18/39] dcevm15 - DON'T clear F2 in CP cache after indy
|
||||
Subject: [PATCH 18/42] dcevm15 - DON'T clear F2 in CP cache after indy
|
||||
unevolving
|
||||
|
||||
It's not clear why it was cleared in dcevm7-11
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 3b09df69c007285ea6c258388532a8e5f9fe3d45 Mon Sep 17 00:00:00 2001
|
||||
From e286bbfb6ef8235be6aa9b41e30e9ed36cfd177d Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 22 Nov 2020 12:03:32 +0100
|
||||
Subject: [PATCH 19/39] Cleanup and review comments
|
||||
Subject: [PATCH 19/42] Cleanup and review comments
|
||||
|
||||
---
|
||||
src/hotspot/share/classfile/classLoaderDataGraph.hpp | 2 +-
|
||||
@@ -37,30 +37,30 @@ index 26a2b67b8e9..8e78696bef5 100644
|
||||
} else if (os::is_server_class_machine()) {
|
||||
#if INCLUDE_G1GC
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 590f7fdfafe..2a7dd35bdd1 100644
|
||||
index 1433e429e30..af34d751bdb 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -842,6 +842,7 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
|
||||
if (the_class->is_hidden()) {
|
||||
+ // TODO: (DCEVM) review if is correct
|
||||
// from jvm_lookup_define_class() (jvm.cpp):
|
||||
// The hidden class loader data has been artificially been kept alive to
|
||||
// this point. The mirror and any instances of this class have to keep
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
|
||||
if (the_class->is_hidden()) {
|
||||
+ // TODO: (DCEVM) review if is correct
|
||||
// from jvm_lookup_define_class() (jvm.cpp):
|
||||
// The hidden class loader data has been artificially been kept alive to
|
||||
// this point. The mirror and any instances of this class have to keep
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index bd5e7d153be..5de375fb888 100644
|
||||
index 61f62e7f831..43f1aff8e91 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -78,7 +78,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
// have any entries.
|
||||
bool _any_class_has_resolved_methods;
|
||||
|
||||
- // Enhanced class redefinition, affected klasses contain all classes which should be redefined
|
||||
+ // (DCEVM) Enhanced class redefinition, affected klasses contain all classes which should be redefined
|
||||
// either because of redefine, class hierarchy or interface change
|
||||
GrowableArray<Klass*>* _affected_klasses;
|
||||
|
||||
// have any entries.
|
||||
bool _any_class_has_resolved_methods;
|
||||
|
||||
- // Enhanced class redefinition, affected klasses contain all classes which should be redefined
|
||||
+ // (DCEVM) Enhanced class redefinition, affected klasses contain all classes which should be redefined
|
||||
// either because of redefine, class hierarchy or interface change
|
||||
GrowableArray<Klass*>* _affected_klasses;
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 5c41ecc9f48d22b81b3ac610e5655f1a74d25614 Mon Sep 17 00:00:00 2001
|
||||
From a755a90e2845ef3a30f3f03185ecee1a71182606 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 10:11:10 +0100
|
||||
Subject: [PATCH 20/39] Disable AllowEnhancedClassRedefinition in flight
|
||||
Subject: [PATCH 20/42] Disable AllowEnhancedClassRedefinition in flight
|
||||
recorder
|
||||
|
||||
---
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH 20/39] Disable AllowEnhancedClassRedefinition in flight
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
|
||||
index 567803b70b7..cbcd8f91c66 100644
|
||||
index 9661f2b62b9..252ebbc4e57 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.cpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.cpp
|
||||
@@ -3994,6 +3994,13 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
@@ -4027,6 +4027,13 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
// Set object alignment values.
|
||||
set_object_alignment();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From e560b33cdec3ef0e4ce91714663d3befa87ff4e5 Mon Sep 17 00:00:00 2001
|
||||
From 8770c3da756a6193d69bb8c23aa992584edcb723 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 09:44:28 +0100
|
||||
Subject: [PATCH 21/39] dcevm17 - fix compilation issues
|
||||
Subject: [PATCH 21/42] dcevm17 - fix compilation issues
|
||||
|
||||
---
|
||||
.../share/classfile/classLoaderData.cpp | 2 +-
|
||||
@@ -533,120 +533,120 @@ index b4d09e92830..c2de2bec7d4 100644
|
||||
|
||||
// Verify local interfaces
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 2a7dd35bdd1..071dbc6d6ad 100644
|
||||
index af34d751bdb..0b1db1581d1 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -26,8 +26,10 @@
|
||||
#include "aot/aotLoader.hpp"
|
||||
#include "classfile/classFileParser.hpp"
|
||||
#include "classfile/classFileStream.hpp"
|
||||
+#include "classfile/classLoadInfo.hpp"
|
||||
#include "classfile/metadataOnStackMark.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
+#include "classfile/symbolTable.hpp"
|
||||
#include "classfile/verifier.hpp"
|
||||
#include "classfile/dictionary.hpp"
|
||||
#include "classfile/classLoaderDataGraph.hpp"
|
||||
#include "aot/aotLoader.hpp"
|
||||
#include "classfile/classFileParser.hpp"
|
||||
#include "classfile/classFileStream.hpp"
|
||||
+#include "classfile/classLoadInfo.hpp"
|
||||
#include "classfile/metadataOnStackMark.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
+#include "classfile/symbolTable.hpp"
|
||||
#include "classfile/verifier.hpp"
|
||||
#include "classfile/dictionary.hpp"
|
||||
#include "classfile/classLoaderDataGraph.hpp"
|
||||
@@ -198,8 +200,8 @@ class FieldCopier : public FieldClosure {
|
||||
if (found && result.is_static()) {
|
||||
log_trace(redefine, class, obsolete, metadata)("Copying static field value for field %s old_offset=%d new_offset=%d",
|
||||
fd->name()->as_C_string(), result.offset(), fd->offset());
|
||||
- memcpy(cur_oop->obj_field_addr_raw<HeapWord>(fd->offset()),
|
||||
- old_oop->obj_field_addr_raw<HeapWord>(result.offset()),
|
||||
+ memcpy(cur_oop->obj_field_addr<HeapWord>(fd->offset()),
|
||||
+ old_oop->obj_field_addr<HeapWord>(result.offset()),
|
||||
type2aelembytes(fd->field_type()));
|
||||
|
||||
// Static fields may have references to java.lang.Class
|
||||
if (found && result.is_static()) {
|
||||
log_trace(redefine, class, obsolete, metadata)("Copying static field value for field %s old_offset=%d new_offset=%d",
|
||||
fd->name()->as_C_string(), result.offset(), fd->offset());
|
||||
- memcpy(cur_oop->obj_field_addr_raw<HeapWord>(fd->offset()),
|
||||
- old_oop->obj_field_addr_raw<HeapWord>(result.offset()),
|
||||
+ memcpy(cur_oop->obj_field_addr<HeapWord>(fd->offset()),
|
||||
+ old_oop->obj_field_addr<HeapWord>(result.offset()),
|
||||
type2aelembytes(fd->field_type()));
|
||||
|
||||
// Static fields may have references to java.lang.Class
|
||||
@@ -242,6 +244,17 @@ void VM_EnhancedRedefineClasses::register_nmethod_g1(nmethod* nm) {
|
||||
}
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::root_oops_do(OopClosure *oopClosure) {
|
||||
+ Universe::vm_global()->oops_do(oopClosure);
|
||||
+
|
||||
+ Threads::oops_do(oopClosure, NULL);
|
||||
+ AOT_ONLY(AOTLoader::oops_do(oopClosure);)
|
||||
+ OopStorageSet::strong_oops_do(oopClosure);
|
||||
+
|
||||
+ CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
|
||||
+ CodeCache::blobs_do(&blobClosure);
|
||||
+}
|
||||
+
|
||||
// TODO comment
|
||||
struct StoreBarrier {
|
||||
// TODO: j10 review change ::oop_store -> HeapAccess<>::oop_store
|
||||
}
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::root_oops_do(OopClosure *oopClosure) {
|
||||
+ Universe::vm_global()->oops_do(oopClosure);
|
||||
+
|
||||
+ Threads::oops_do(oopClosure, NULL);
|
||||
+ AOT_ONLY(AOTLoader::oops_do(oopClosure);)
|
||||
+ OopStorageSet::strong_oops_do(oopClosure);
|
||||
+
|
||||
+ CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
|
||||
+ CodeCache::blobs_do(&blobClosure);
|
||||
+}
|
||||
+
|
||||
// TODO comment
|
||||
struct StoreBarrier {
|
||||
// TODO: j10 review change ::oop_store -> HeapAccess<>::oop_store
|
||||
@@ -558,7 +571,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
_timer_heap_iterate.stop();
|
||||
}
|
||||
|
||||
- Universe::root_oops_do(&oopClosureNoBarrier);
|
||||
+ root_oops_do(&oopClosureNoBarrier);
|
||||
|
||||
if (UseG1GC) {
|
||||
// this should work also for other GCs
|
||||
_timer_heap_iterate.stop();
|
||||
}
|
||||
|
||||
- Universe::root_oops_do(&oopClosureNoBarrier);
|
||||
+ root_oops_do(&oopClosureNoBarrier);
|
||||
|
||||
if (UseG1GC) {
|
||||
// this should work also for other GCs
|
||||
@@ -737,8 +750,8 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
// - link new classes
|
||||
jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
- _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count, true);
|
||||
- _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count, true);
|
||||
+ _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count);
|
||||
+ _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count);
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
// - link new classes
|
||||
jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
- _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count, true);
|
||||
- _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count, true);
|
||||
+ _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count);
|
||||
+ _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count);
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
@@ -832,12 +845,12 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
!the_class->is_non_strong_hidden(), // is_strong_hidden
|
||||
true); // FIXME: check if correct. can_access_vm_annotations
|
||||
|
||||
- k = SystemDictionary::parse_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- &st,
|
||||
- cl_info,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ k = SystemDictionary::resolve_from_stream(&st,
|
||||
+ the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ cl_info,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
|
||||
!the_class->is_non_strong_hidden(), // is_strong_hidden
|
||||
true); // FIXME: check if correct. can_access_vm_annotations
|
||||
|
||||
- k = SystemDictionary::parse_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- &st,
|
||||
- cl_info,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ k = SystemDictionary::resolve_from_stream(&st,
|
||||
+ the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ cl_info,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
|
||||
k->class_loader_data()->exchange_holders(the_class->class_loader_data());
|
||||
|
||||
@@ -853,12 +866,12 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
}
|
||||
|
||||
} else {
|
||||
- k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- protection_domain,
|
||||
- &st,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ k = SystemDictionary::resolve_from_stream(&st,
|
||||
+ the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
}
|
||||
// Clear class_being_redefined just to be sure.
|
||||
state->clear_class_being_redefined();
|
||||
}
|
||||
|
||||
} else {
|
||||
- k = SystemDictionary::resolve_from_stream(the_class_sym,
|
||||
- the_class_loader,
|
||||
- protection_domain,
|
||||
- &st,
|
||||
- the_class,
|
||||
- THREAD);
|
||||
+ k = SystemDictionary::resolve_from_stream(&st,
|
||||
+ the_class_sym,
|
||||
+ the_class_loader,
|
||||
+ protection_domain,
|
||||
+ the_class,
|
||||
+ THREAD);
|
||||
}
|
||||
// Clear class_being_redefined just to be sure.
|
||||
state->clear_class_being_redefined();
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 5de375fb888..9be70039e32 100644
|
||||
index 43f1aff8e91..ae0a15281f3 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -124,6 +124,8 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
static void register_nmethod_g1(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method, TRAPS);
|
||||
|
||||
+ void root_oops_do(OopClosure *oopClosure);
|
||||
+
|
||||
// Figure out which new methods match old methods in name and signature,
|
||||
// which methods have been added, and which are no longer present
|
||||
void compute_added_deleted_matching_methods();
|
||||
static void register_nmethod_g1(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method, TRAPS);
|
||||
|
||||
+ void root_oops_do(OopClosure *oopClosure);
|
||||
+
|
||||
// Figure out which new methods match old methods in name and signature,
|
||||
// which methods have been added, and which are no longer present
|
||||
void compute_added_deleted_matching_methods();
|
||||
diff --git a/src/hotspot/share/prims/resolvedMethodTable.cpp b/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
index 3c29eda4da0..a1eadc2958a 100644
|
||||
--- a/src/hotspot/share/prims/resolvedMethodTable.cpp
|
||||
@@ -678,10 +678,10 @@ index 3c29eda4da0..a1eadc2958a 100644
|
||||
if (_local_table->insert(thread, lookup, wh)) {
|
||||
log_insert(method);
|
||||
diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp
|
||||
index 1b7f8fe9f47..6a8ceb7fa8a 100644
|
||||
index 3adc03a6583..b8eb4d0ab24 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.hpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.hpp
|
||||
@@ -482,6 +482,8 @@ class Arguments : AllStatic {
|
||||
@@ -487,6 +487,8 @@ class Arguments : AllStatic {
|
||||
// Adjusts the arguments after the OS have adjusted the arguments
|
||||
static jint adjust_after_os();
|
||||
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
From 6e18ad67981ab5a1bbdac46e1e0c7cc80beb4a5b Mon Sep 17 00:00:00 2001
|
||||
From d170fa0a21d5c62348fe77eeaa81b16c8c51531a Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 11:38:48 +0100
|
||||
Subject: [PATCH 22/39] Fix crash on GrowableArray allocation in C_HEAP
|
||||
Subject: [PATCH 22/42] Fix crash on GrowableArray allocation in C_HEAP
|
||||
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 071dbc6d6ad..a5264077bfe 100644
|
||||
index 0b1db1581d1..b88c071be13 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -750,8 +750,8 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
// - link new classes
|
||||
jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
- _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count);
|
||||
- _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count);
|
||||
+ _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count, mtInternal);
|
||||
+ _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count, mtInternal);
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
// - link new classes
|
||||
jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
- _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count);
|
||||
- _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count);
|
||||
+ _affected_klasses = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<Klass*>(_class_count, mtInternal);
|
||||
+ _new_classes = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<InstanceKlass*>(_class_count, mtInternal);
|
||||
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 96680710816d9cd6e9cd8d5ce6dcbe054a7e53bd Mon Sep 17 00:00:00 2001
|
||||
From 8f59a799ec9996f3d92843f1a9f8504390c20009 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 11:39:05 +0100
|
||||
Subject: [PATCH 23/39] Rename confusing method name old_if_redefined to
|
||||
Subject: [PATCH 23/42] Rename confusing method name old_if_redefined to
|
||||
old_if_redefining
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 5d10d789150dfa6f8366dceb7fce3251d725ab8a Mon Sep 17 00:00:00 2001
|
||||
From cc05b370b2fdf4c367bb9b6e4a21b9f97ae53dcf Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Fri, 12 Feb 2021 12:33:47 +0100
|
||||
Subject: [PATCH 24/39] Check InstanceKlass::has_nestmate_access_to with active
|
||||
Subject: [PATCH 24/42] Check InstanceKlass::has_nestmate_access_to with active
|
||||
classes
|
||||
|
||||
Dcevm can leave old host in nested class if nested class is not
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From dac9d7a7d87de680a50be7c2857646323c4c8ffa Mon Sep 17 00:00:00 2001
|
||||
From fdc87a0203f5aa1a21b3bf2e7a5aa114739f66cf Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 13 Feb 2021 20:47:52 +0100
|
||||
Subject: [PATCH 25/39] JBR-3111 Update class in all dictionaries where it was
|
||||
Subject: [PATCH 25/42] JBR-3111 Update class in all dictionaries where it was
|
||||
already defined
|
||||
|
||||
This patch keeps compatibility with std redefinition, that does not
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From f42115a3d488c93a2d163aebd030530f060dcef8 Mon Sep 17 00:00:00 2001
|
||||
From a33424d92f6001c9f9cb627b620f490fdfbc1196 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 20 Feb 2021 15:47:47 +0100
|
||||
Subject: [PATCH 26/39] Add ClassLoaderDataGraph_lock to define new class in
|
||||
Subject: [PATCH 26/42] Add ClassLoaderDataGraph_lock to define new class in
|
||||
enhanced redefiniton
|
||||
|
||||
ClassLoaderDataGraph locking for introduced in redefinition in
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 30308e893e43425da166175f5f18f84abf2c6110 Mon Sep 17 00:00:00 2001
|
||||
From e85a74a6bd33e5d81569ec209311e698de402990 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Thu, 18 Jun 2020 18:40:11 +0200
|
||||
Subject: [PATCH 27/39] JBR-3140 - support for modularized HotswapAgent
|
||||
Subject: [PATCH 27/42] JBR-3140 - support for modularized HotswapAgent
|
||||
|
||||
Add -XX:HotswapAgent=[disabled,fatjar.core]
|
||||
---
|
||||
@@ -13,10 +13,10 @@ Add -XX:HotswapAgent=[disabled,fatjar.core]
|
||||
5 files changed, 102 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
|
||||
index cbcd8f91c66..4f9cfde9323 100644
|
||||
index 252ebbc4e57..9c6fab8ae4b 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.cpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.cpp
|
||||
@@ -4001,6 +4001,8 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
@@ -4034,6 +4034,8 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ index cbcd8f91c66..4f9cfde9323 100644
|
||||
#if !INCLUDE_CDS
|
||||
if (DumpSharedSpaces || RequireSharedSpaces) {
|
||||
jio_fprintf(defaultStream::error_stream(),
|
||||
@@ -4357,3 +4359,78 @@ bool Arguments::copy_expand_pid(const char* src, size_t srclen,
|
||||
@@ -4390,3 +4392,78 @@ bool Arguments::copy_expand_pid(const char* src, size_t srclen,
|
||||
*b = '\0';
|
||||
return (p == src_end); // return false if not all of the source was copied
|
||||
}
|
||||
@@ -105,10 +105,10 @@ index cbcd8f91c66..4f9cfde9323 100644
|
||||
+
|
||||
+}
|
||||
diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp
|
||||
index 6a8ceb7fa8a..7669a283375 100644
|
||||
index b8eb4d0ab24..a14e11b48ef 100644
|
||||
--- a/src/hotspot/share/runtime/arguments.hpp
|
||||
+++ b/src/hotspot/share/runtime/arguments.hpp
|
||||
@@ -491,6 +491,10 @@ class Arguments : AllStatic {
|
||||
@@ -496,6 +496,10 @@ class Arguments : AllStatic {
|
||||
|
||||
static size_t conservative_max_heap_alignment() { return _conservative_max_heap_alignment; }
|
||||
|
||||
@@ -154,7 +154,7 @@ index 8bc3a9a1548..c5f58fd16ee 100644
|
||||
RUNTIME_CONSTRAINTS(DECLARE_CONSTRAINT)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
|
||||
index 7051b634a9b..d23e43407e1 100644
|
||||
index fb6d1667156..20838a878ce 100644
|
||||
--- a/src/hotspot/share/runtime/globals.hpp
|
||||
+++ b/src/hotspot/share/runtime/globals.hpp
|
||||
@@ -2090,7 +2090,16 @@ const intx ObjectAlignmentInBytes = 8;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 51f0036ff15d39330b787512af9e38d15c748e4b Mon Sep 17 00:00:00 2001
|
||||
From b2e59ba5f246798f4901fa16d8fd3aeceac8309e Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 7 Mar 2021 20:22:54 +0100
|
||||
Subject: [PATCH 28/39] Support for redefinition of Well Known classses
|
||||
Subject: [PATCH 28/42] Support for redefinition of Well Known classses
|
||||
(java.*,jdk.*, sun.*)
|
||||
|
||||
---
|
||||
@@ -222,126 +222,126 @@ index 4b2211c415e..4d4c444220e 100644
|
||||
|
||||
// Reference pending list manipulation. Access is protected by
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index a5264077bfe..e00f0e19e20 100644
|
||||
index b88c071be13..fb9da134e97 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "prims/resolvedMethodTable.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
+#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/jniHandles.inline.hpp"
|
||||
#include "runtime/relocator.hpp"
|
||||
#include "runtime/fieldDescriptor.hpp"
|
||||
#include "prims/resolvedMethodTable.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "runtime/deoptimization.hpp"
|
||||
+#include "runtime/javaCalls.hpp"
|
||||
#include "runtime/jniHandles.inline.hpp"
|
||||
#include "runtime/relocator.hpp"
|
||||
#include "runtime/fieldDescriptor.hpp"
|
||||
@@ -66,6 +67,7 @@
|
||||
#include "gc/g1/g1CollectedHeap.hpp"
|
||||
#include "gc/shared/dcevmSharedGC.hpp"
|
||||
#include "gc/shared/scavengableNMethods.hpp"
|
||||
+#include "gc/shared/oopStorageSet.inline.hpp"
|
||||
#include "ci/ciObjectFactory.hpp"
|
||||
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
|
||||
#include "gc/g1/g1CollectedHeap.hpp"
|
||||
#include "gc/shared/dcevmSharedGC.hpp"
|
||||
#include "gc/shared/scavengableNMethods.hpp"
|
||||
+#include "gc/shared/oopStorageSet.inline.hpp"
|
||||
#include "ci/ciObjectFactory.hpp"
|
||||
|
||||
Array<Method*>* VM_EnhancedRedefineClasses::_old_methods = NULL;
|
||||
@@ -521,6 +523,16 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
redefine_single_class(_new_classes->at(i), thread);
|
||||
}
|
||||
|
||||
+ // Update possible redefinition of vm classes (like ClassLoader)
|
||||
+ for (int i = 0; i < _new_classes->length(); i++) {
|
||||
+ InstanceKlass* cur = _new_classes->at(i);
|
||||
+ if (cur->old_version() != NULL && vmClasses::update_vm_klass(InstanceKlass::cast(cur->old_version()), cur))
|
||||
+ {
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Well known class updated %s", cur->external_name());
|
||||
+ ciObjectFactory::set_reinitialize_vm_klasses();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// Deoptimize all compiled code that depends on this class (do only once, because it clears whole cache)
|
||||
// if (_max_redefinition_flags > Klass::ModifyClass) {
|
||||
flush_dependent_code(thread);
|
||||
redefine_single_class(_new_classes->at(i), thread);
|
||||
}
|
||||
|
||||
+ // Update possible redefinition of vm classes (like ClassLoader)
|
||||
+ for (int i = 0; i < _new_classes->length(); i++) {
|
||||
+ InstanceKlass* cur = _new_classes->at(i);
|
||||
+ if (cur->old_version() != NULL && vmClasses::update_vm_klass(InstanceKlass::cast(cur->old_version()), cur))
|
||||
+ {
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Well known class updated %s", cur->external_name());
|
||||
+ ciObjectFactory::set_reinitialize_vm_klasses();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// Deoptimize all compiled code that depends on this class (do only once, because it clears whole cache)
|
||||
// if (_max_redefinition_flags > Klass::ModifyClass) {
|
||||
flush_dependent_code(thread);
|
||||
@@ -688,12 +700,56 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
_timer_vm_op_doit.stop();
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
+ if (!_new_classes->is_empty()) {
|
||||
+ ResourceMark rm(Thread::current());
|
||||
+
|
||||
+ for (int i = 0; i < _new_classes->length(); i++) {
|
||||
+ InstanceKlass* cur = _new_classes->at(i);
|
||||
+
|
||||
+ if (cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/")) {
|
||||
+
|
||||
+ if (cur == vmClasses::ClassLoader_klass()) {
|
||||
+ // ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
+ Universe::reinitialize_loader_addClass_method(Thread::current());
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Reinitialize ClassLoade addClass method cache.");
|
||||
+ }
|
||||
+
|
||||
+ // naive assumptions that only JDK classes has native static "registerNative" and "initIDs" methods
|
||||
+ int end;
|
||||
+ Symbol* signature = vmSymbols::registerNatives_method_name();
|
||||
+ int midx = cur->find_method_by_name(signature, &end);
|
||||
+ if (midx == -1) {
|
||||
+ signature = vmSymbols::initIDs_method_name();
|
||||
+ midx = cur->find_method_by_name(signature, &end);
|
||||
+ }
|
||||
+ Method* m = NULL;
|
||||
+ if (midx != -1) {
|
||||
+ m = cur->methods()->at(midx);
|
||||
+ }
|
||||
+ if (m != NULL && m->is_static() && m->is_native()) {
|
||||
+ // call static registerNative if present
|
||||
+ JavaValue result(T_VOID);
|
||||
+ JavaCalls::call_static(&result,
|
||||
+ cur,
|
||||
+ signature,
|
||||
+ vmSymbols::void_method_signature(),
|
||||
+ Thread::current());
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Reregister natives of JDK class %s", cur->external_name());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// Cleanup - runs in JVM thread
|
||||
// - free used memory
|
||||
// - end GC
|
||||
void VM_EnhancedRedefineClasses::doit_epilogue() {
|
||||
VM_GC_Operation::doit_epilogue();
|
||||
|
||||
+ reinitializeJDKClasses();
|
||||
+
|
||||
if (_new_classes != NULL) {
|
||||
delete _new_classes;
|
||||
}
|
||||
_timer_vm_op_doit.stop();
|
||||
}
|
||||
|
||||
+void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
+ if (!_new_classes->is_empty()) {
|
||||
+ ResourceMark rm(Thread::current());
|
||||
+
|
||||
+ for (int i = 0; i < _new_classes->length(); i++) {
|
||||
+ InstanceKlass* cur = _new_classes->at(i);
|
||||
+
|
||||
+ if (cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/")) {
|
||||
+
|
||||
+ if (cur == vmClasses::ClassLoader_klass()) {
|
||||
+ // ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
+ Universe::reinitialize_loader_addClass_method(Thread::current());
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Reinitialize ClassLoade addClass method cache.");
|
||||
+ }
|
||||
+
|
||||
+ // naive assumptions that only JDK classes has native static "registerNative" and "initIDs" methods
|
||||
+ int end;
|
||||
+ Symbol* signature = vmSymbols::registerNatives_method_name();
|
||||
+ int midx = cur->find_method_by_name(signature, &end);
|
||||
+ if (midx == -1) {
|
||||
+ signature = vmSymbols::initIDs_method_name();
|
||||
+ midx = cur->find_method_by_name(signature, &end);
|
||||
+ }
|
||||
+ Method* m = NULL;
|
||||
+ if (midx != -1) {
|
||||
+ m = cur->methods()->at(midx);
|
||||
+ }
|
||||
+ if (m != NULL && m->is_static() && m->is_native()) {
|
||||
+ // call static registerNative if present
|
||||
+ JavaValue result(T_VOID);
|
||||
+ JavaCalls::call_static(&result,
|
||||
+ cur,
|
||||
+ signature,
|
||||
+ vmSymbols::void_method_signature(),
|
||||
+ Thread::current());
|
||||
+ log_trace(redefine, class, obsolete, metadata)("Reregister natives of JDK class %s", cur->external_name());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// Cleanup - runs in JVM thread
|
||||
// - free used memory
|
||||
// - end GC
|
||||
void VM_EnhancedRedefineClasses::doit_epilogue() {
|
||||
VM_GC_Operation::doit_epilogue();
|
||||
|
||||
+ reinitializeJDKClasses();
|
||||
+
|
||||
if (_new_classes != NULL) {
|
||||
delete _new_classes;
|
||||
}
|
||||
@@ -1623,7 +1679,12 @@ void VM_EnhancedRedefineClasses::check_methods_and_mark_as_obsolete() {
|
||||
|
||||
// obsolete methods need a unique idnum so they become new entries in
|
||||
// the jmethodID cache in InstanceKlass
|
||||
- assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
|
||||
+ if (old_method->method_idnum() != new_method->method_idnum()) {
|
||||
+ log_error(redefine, class, normalize)
|
||||
+ ("Method not matched: %d != %d old: %s = new: %s", old_method->method_idnum(), new_method->method_idnum(),
|
||||
+ old_method->name_and_sig_as_C_string(), new_method->name_and_sig_as_C_string());
|
||||
+ // assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
|
||||
+ }
|
||||
// u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum();
|
||||
// if (num != ConstMethod::UNSET_IDNUM) {
|
||||
// old_method->set_method_idnum(num);
|
||||
|
||||
// obsolete methods need a unique idnum so they become new entries in
|
||||
// the jmethodID cache in InstanceKlass
|
||||
- assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
|
||||
+ if (old_method->method_idnum() != new_method->method_idnum()) {
|
||||
+ log_error(redefine, class, normalize)
|
||||
+ ("Method not matched: %d != %d old: %s = new: %s", old_method->method_idnum(), new_method->method_idnum(),
|
||||
+ old_method->name_and_sig_as_C_string(), new_method->name_and_sig_as_C_string());
|
||||
+ // assert(old_method->method_idnum() == new_method->method_idnum(), "must match");
|
||||
+ }
|
||||
// u2 num = InstanceKlass::cast(_the_class_oop)->next_method_idnum();
|
||||
// if (num != ConstMethod::UNSET_IDNUM) {
|
||||
// old_method->set_method_idnum(num);
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 9be70039e32..673688dff84 100644
|
||||
index ae0a15281f3..d0d2f78aa62 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -150,6 +150,8 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
|
||||
u8 next_id();
|
||||
|
||||
+ void reinitializeJDKClasses();
|
||||
+
|
||||
static void check_class(InstanceKlass* k_oop, TRAPS);
|
||||
|
||||
static void dump_methods();
|
||||
|
||||
u8 next_id();
|
||||
|
||||
+ void reinitializeJDKClasses();
|
||||
+
|
||||
static void check_class(InstanceKlass* k_oop, TRAPS);
|
||||
|
||||
static void dump_methods();
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 6cde71e353f823f2df2d0875cd03b656fe060d5c Mon Sep 17 00:00:00 2001
|
||||
From 76c2c517d54f0fdbae2cb10cceb6c1aab7ee3a7b Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 15 May 2021 10:31:28 +0200
|
||||
Subject: [PATCH 29/39] Fix fastdebug compilation issues - cast_to_oop
|
||||
Subject: [PATCH 29/42] Fix fastdebug compilation issues - cast_to_oop
|
||||
|
||||
---
|
||||
.../share/gc/g1/g1FullGCCompactTask.cpp | 12 +++++-----
|
||||
@@ -243,18 +243,18 @@ index cafa2503ef4..076ce6b0cce 100644
|
||||
debug_only(prev_obj = cur_obj);
|
||||
cur_obj += size;
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index e00f0e19e20..62477b5ce10 100644
|
||||
index fb9da134e97..890382e2029 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -439,7 +439,7 @@ public:
|
||||
int size = o->size();
|
||||
if (_tmp_obj_size < size) {
|
||||
_tmp_obj_size = size;
|
||||
- _tmp_obj = (oop)resource_allocate_bytes(size * HeapWordSize);
|
||||
+ _tmp_obj = cast_to_oop(resource_allocate_bytes(size * HeapWordSize));
|
||||
}
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(o), cast_from_oop<HeapWord*>(_tmp_obj), size);
|
||||
}
|
||||
int size = o->size();
|
||||
if (_tmp_obj_size < size) {
|
||||
_tmp_obj_size = size;
|
||||
- _tmp_obj = (oop)resource_allocate_bytes(size * HeapWordSize);
|
||||
+ _tmp_obj = cast_to_oop(resource_allocate_bytes(size * HeapWordSize));
|
||||
}
|
||||
Copy::aligned_disjoint_words(cast_from_oop<HeapWord*>(o), cast_from_oop<HeapWord*>(_tmp_obj), size);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 585e2f11d293081db5dc919fa8c13fb5bc7cbc53 Mon Sep 17 00:00:00 2001
|
||||
From e3dcad4df8369cfa4a5eb90058ce265c0233b272 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Fri, 19 Mar 2021 19:13:38 +0100
|
||||
Subject: [PATCH 30/39] JBR-3458: Skip dynamic proxy classes based on
|
||||
Subject: [PATCH 30/42] JBR-3458: Skip dynamic proxy classes based on
|
||||
com.sun.proxy
|
||||
|
||||
---
|
||||
@@ -9,19 +9,19 @@ Subject: [PATCH 30/39] JBR-3458: Skip dynamic proxy classes based on
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 62477b5ce10..7bdbc861c1f 100644
|
||||
index 890382e2029..90dfc1ae545 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -707,7 +707,8 @@ void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
|
||||
- if (cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/")) {
|
||||
+ if ((cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/"))
|
||||
+ && cur->name()->index_of_at(0, "$$") == -1) { // skip dynamic proxies
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
|
||||
- if (cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/")) {
|
||||
+ if ((cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/"))
|
||||
+ && cur->name()->index_of_at(0, "$$") == -1) { // skip dynamic proxies
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From d4d56b7ad6cd8f73f7485cdc608655c014c55f3c Mon Sep 17 00:00:00 2001
|
||||
From b57c414d7885df5142a4a6bbf78001e96938f8ac Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Sat, 20 Mar 2021 20:51:08 +0100
|
||||
Subject: [PATCH 31/39] JBR-3459: Fix race condition in
|
||||
Subject: [PATCH 31/42] JBR-3459: Fix race condition in
|
||||
ClassLoaderDataGraph::classes_do
|
||||
|
||||
InstanceKlass in ClassLoaderData can be uninitialized when
|
||||
@@ -51,31 +51,31 @@ index ebdb0bc2c8c..da712eaf55f 100644
|
||||
static void methods_do(void f(Method*));
|
||||
static void modules_do(void f(ModuleEntry*));
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 7bdbc861c1f..4e8e7141e61 100644
|
||||
index 90dfc1ae545..10407755457 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -2164,9 +2164,19 @@ jvmtiError VM_EnhancedRedefineClasses::find_sorted_affected_classes(TRAPS) {
|
||||
|
||||
{
|
||||
MutexLocker mcld(ClassLoaderDataGraph_lock);
|
||||
- ClassLoaderDataGraph::classes_do(&closure);
|
||||
+
|
||||
+ // 0. we can't use ClassLoaderDataGraph::classes_do since classes can be uninitialized in cld,
|
||||
+ // fully initialized class is in system dictionary
|
||||
+ // ClassLoaderDataGraph::classes_do(&closure);
|
||||
+
|
||||
+ // 1. Scan over dictionaries
|
||||
+ ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
+ // 2. Anonymous or hidden class is not in dictionary, we have to iterate anonymous cld directly, but there is race cond...
|
||||
+ // TODO: review ... anonymous class is added to cld before InstanceKlass initialization,
|
||||
+ // find out how to check if the InstanceKlass is initialized
|
||||
+ ClassLoaderDataGraph::anonymous_or_hidden_classes_do(&closure);
|
||||
}
|
||||
- //ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
|
||||
|
||||
{
|
||||
MutexLocker mcld(ClassLoaderDataGraph_lock);
|
||||
- ClassLoaderDataGraph::classes_do(&closure);
|
||||
+
|
||||
+ // 0. we can't use ClassLoaderDataGraph::classes_do since classes can be uninitialized in cld,
|
||||
+ // fully initialized class is in system dictionary
|
||||
+ // ClassLoaderDataGraph::classes_do(&closure);
|
||||
+
|
||||
+ // 1. Scan over dictionaries
|
||||
+ ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
+
|
||||
+ // 2. Anonymous or hidden class is not in dictionary, we have to iterate anonymous cld directly, but there is race cond...
|
||||
+ // TODO: review ... anonymous class is added to cld before InstanceKlass initialization,
|
||||
+ // find out how to check if the InstanceKlass is initialized
|
||||
+ ClassLoaderDataGraph::anonymous_or_hidden_classes_do(&closure);
|
||||
}
|
||||
- //ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 5356c4dbbcc2564e401fc92b7680b870ee7070ec Mon Sep 17 00:00:00 2001
|
||||
From 66d53205a84c8e4db40fb2fc91f563cde458afcc Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sat, 15 May 2021 13:01:25 +0200
|
||||
Subject: [PATCH 32/39] Fix compilation problems
|
||||
Subject: [PATCH 32/42] Fix compilation problems
|
||||
|
||||
---
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 2 +-
|
||||
@@ -22,18 +22,18 @@ index 3cc96f98f41..c54b6b1bf46 100644
|
||||
}
|
||||
}
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 4e8e7141e61..f6bef8262d3 100644
|
||||
index 10407755457..e87d4452d31 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -708,7 +708,7 @@ void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
|
||||
if ((cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/"))
|
||||
- && cur->name()->index_of_at(0, "$$") == -1) { // skip dynamic proxies
|
||||
+ && cur->name()->index_of_at(0, "$$", (int) strlen("$$")) == -1) { // skip dynamic proxies
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
|
||||
if ((cur->name()->starts_with("java/") || cur->name()->starts_with("jdk/") || cur->name()->starts_with("sun/"))
|
||||
- && cur->name()->index_of_at(0, "$$") == -1) { // skip dynamic proxies
|
||||
+ && cur->name()->index_of_at(0, "$$", (int) strlen("$$")) == -1) { // skip dynamic proxies
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 3eb64e8ed65ae214091b55e497d24dff0eb1e353 Mon Sep 17 00:00:00 2001
|
||||
From fd5b6cd29a5dfed532b0c6ac80c94271f388c5bc Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 20 Jun 2021 19:11:16 +0200
|
||||
Subject: [PATCH 33/39] Fix dcevm issues related to refactorization of Thread
|
||||
Subject: [PATCH 33/42] Fix dcevm issues related to refactorization of Thread
|
||||
to JavaThread
|
||||
|
||||
---
|
||||
@@ -23,328 +23,328 @@ index 5c058dc43ac..9de28f740ac 100644
|
||||
|
||||
{
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index f6bef8262d3..b662976afcb 100644
|
||||
index e87d4452d31..0aeeea4e7a4 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -23,7 +23,6 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
-#include "aot/aotLoader.hpp"
|
||||
#include "classfile/classFileParser.hpp"
|
||||
#include "classfile/classFileStream.hpp"
|
||||
#include "classfile/classLoadInfo.hpp"
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
-#include "aot/aotLoader.hpp"
|
||||
#include "classfile/classFileParser.hpp"
|
||||
#include "classfile/classFileStream.hpp"
|
||||
#include "classfile/classLoadInfo.hpp"
|
||||
@@ -38,7 +37,7 @@
|
||||
#include "interpreter/rewriter.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
-#include "memory/metaspaceShared.hpp"
|
||||
+#include "cds/metaspaceShared.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/iterator.inline.hpp"
|
||||
#include "oops/fieldStreams.hpp"
|
||||
#include "interpreter/rewriter.hpp"
|
||||
#include "logging/logStream.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
-#include "memory/metaspaceShared.hpp"
|
||||
+#include "cds/metaspaceShared.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/iterator.inline.hpp"
|
||||
#include "oops/fieldStreams.hpp"
|
||||
@@ -156,7 +155,7 @@ bool VM_EnhancedRedefineClasses::doit_prologue() {
|
||||
|
||||
// We first load new class versions in the prologue, because somewhere down the
|
||||
// call chain it is required that the current thread is a Java thread.
|
||||
- _res = load_new_class_versions(Thread::current());
|
||||
+ _res = load_new_class_versions(JavaThread::current());
|
||||
|
||||
// prepare GC, lock heap
|
||||
if (_res == JVMTI_ERROR_NONE && !VM_GC_Operation::doit_prologue()) {
|
||||
|
||||
// We first load new class versions in the prologue, because somewhere down the
|
||||
// call chain it is required that the current thread is a Java thread.
|
||||
- _res = load_new_class_versions(Thread::current());
|
||||
+ _res = load_new_class_versions(JavaThread::current());
|
||||
|
||||
// prepare GC, lock heap
|
||||
if (_res == JVMTI_ERROR_NONE && !VM_GC_Operation::doit_prologue()) {
|
||||
@@ -250,7 +249,6 @@ void VM_EnhancedRedefineClasses::root_oops_do(OopClosure *oopClosure) {
|
||||
Universe::vm_global()->oops_do(oopClosure);
|
||||
|
||||
Threads::oops_do(oopClosure, NULL);
|
||||
- AOT_ONLY(AOTLoader::oops_do(oopClosure);)
|
||||
OopStorageSet::strong_oops_do(oopClosure);
|
||||
|
||||
CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
|
||||
Universe::vm_global()->oops_do(oopClosure);
|
||||
|
||||
Threads::oops_do(oopClosure, NULL);
|
||||
- AOT_ONLY(AOTLoader::oops_do(oopClosure);)
|
||||
OopStorageSet::strong_oops_do(oopClosure);
|
||||
|
||||
CodeBlobToOopClosure blobClosure(oopClosure, CodeBlobToOopClosure::FixRelocations);
|
||||
@@ -520,7 +518,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
// before the stack walk again.
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
- redefine_single_class(_new_classes->at(i), thread);
|
||||
+ redefine_single_class(thread, _new_classes->at(i));
|
||||
}
|
||||
|
||||
// Update possible redefinition of vm classes (like ClassLoader)
|
||||
// before the stack walk again.
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
- redefine_single_class(_new_classes->at(i), thread);
|
||||
+ redefine_single_class(thread, _new_classes->at(i));
|
||||
}
|
||||
|
||||
// Update possible redefinition of vm classes (like ClassLoader)
|
||||
@@ -535,7 +533,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
|
||||
// Deoptimize all compiled code that depends on this class (do only once, because it clears whole cache)
|
||||
// if (_max_redefinition_flags > Klass::ModifyClass) {
|
||||
- flush_dependent_code(thread);
|
||||
+ flush_dependent_code();
|
||||
// }
|
||||
|
||||
// Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
|
||||
// Deoptimize all compiled code that depends on this class (do only once, because it clears whole cache)
|
||||
// if (_max_redefinition_flags > Klass::ModifyClass) {
|
||||
- flush_dependent_code(thread);
|
||||
+ flush_dependent_code();
|
||||
// }
|
||||
|
||||
// Adjust constantpool caches for all classes that reference methods of the evolved class.
|
||||
@@ -692,7 +690,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
assert(new_version->super() == NULL || new_version->super()->new_version() == NULL, "Super class must be newest version");
|
||||
}
|
||||
log_trace(redefine, class, obsolete, metadata)("calling check_class");
|
||||
- ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(check_class, thread);
|
||||
+ ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(check_class);
|
||||
#ifdef PRODUCT
|
||||
}
|
||||
#endif
|
||||
assert(new_version->super() == NULL || new_version->super()->new_version() == NULL, "Super class must be newest version");
|
||||
}
|
||||
log_trace(redefine, class, obsolete, metadata)("calling check_class");
|
||||
- ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(check_class, thread);
|
||||
+ ClassLoaderData::the_null_class_loader_data()->dictionary()->classes_do(check_class);
|
||||
#ifdef PRODUCT
|
||||
}
|
||||
#endif
|
||||
@@ -702,7 +700,7 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
|
||||
void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
if (!_new_classes->is_empty()) {
|
||||
- ResourceMark rm(Thread::current());
|
||||
+ ResourceMark rm(JavaThread::current());
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
|
||||
void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
if (!_new_classes->is_empty()) {
|
||||
- ResourceMark rm(Thread::current());
|
||||
+ ResourceMark rm(JavaThread::current());
|
||||
|
||||
for (int i = 0; i < _new_classes->length(); i++) {
|
||||
InstanceKlass* cur = _new_classes->at(i);
|
||||
@@ -712,7 +710,7 @@ void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
- Universe::reinitialize_loader_addClass_method(Thread::current());
|
||||
+ Universe::reinitialize_loader_addClass_method(JavaThread::current());
|
||||
log_trace(redefine, class, obsolete, metadata)("Reinitialize ClassLoade addClass method cache.");
|
||||
}
|
||||
|
||||
|
||||
if (cur == vmClasses::ClassLoader_klass()) {
|
||||
// ClassLoader.addClass method is cached in Universe, we must redefine
|
||||
- Universe::reinitialize_loader_addClass_method(Thread::current());
|
||||
+ Universe::reinitialize_loader_addClass_method(JavaThread::current());
|
||||
log_trace(redefine, class, obsolete, metadata)("Reinitialize ClassLoade addClass method cache.");
|
||||
}
|
||||
|
||||
@@ -735,7 +733,7 @@ void VM_EnhancedRedefineClasses::reinitializeJDKClasses() {
|
||||
cur,
|
||||
signature,
|
||||
vmSymbols::void_method_signature(),
|
||||
- Thread::current());
|
||||
+ JavaThread::current());
|
||||
log_trace(redefine, class, obsolete, metadata)("Reregister natives of JDK class %s", cur->external_name());
|
||||
}
|
||||
}
|
||||
cur,
|
||||
signature,
|
||||
vmSymbols::void_method_signature(),
|
||||
- Thread::current());
|
||||
+ JavaThread::current());
|
||||
log_trace(redefine, class, obsolete, metadata)("Reregister natives of JDK class %s", cur->external_name());
|
||||
}
|
||||
}
|
||||
@@ -793,7 +791,7 @@ bool VM_EnhancedRedefineClasses::is_modifiable_class(oop klass_mirror) {
|
||||
|
||||
// Cannot redefine or retransform an anonymous class.
|
||||
// TODO: check if is correct in j15
|
||||
- if (InstanceKlass::cast(k)->is_unsafe_anonymous() || InstanceKlass::cast(k)->is_hidden()) {
|
||||
+ if (InstanceKlass::cast(k)->is_hidden()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
// Cannot redefine or retransform an anonymous class.
|
||||
// TODO: check if is correct in j15
|
||||
- if (InstanceKlass::cast(k)->is_unsafe_anonymous() || InstanceKlass::cast(k)->is_hidden()) {
|
||||
+ if (InstanceKlass::cast(k)->is_hidden()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -879,23 +877,15 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
InstanceKlass* k;
|
||||
|
||||
- if (the_class->is_unsafe_anonymous() || the_class->is_hidden()) {
|
||||
+ if (the_class->is_hidden()) {
|
||||
InstanceKlass* dynamic_host_class = NULL;
|
||||
- InstanceKlass* unsafe_anonymous_host = NULL;
|
||||
|
||||
if (the_class->is_hidden()) {
|
||||
log_debug(redefine, class, load)("loading hidden class %s", the_class->name()->as_C_string());
|
||||
dynamic_host_class = the_class->nest_host(THREAD);
|
||||
}
|
||||
|
||||
- if (the_class->is_unsafe_anonymous()) {
|
||||
- log_debug(redefine, class, load)("loading usafe anonymous %s", the_class->name()->as_C_string());
|
||||
- unsafe_anonymous_host = the_class->unsafe_anonymous_host();
|
||||
- }
|
||||
-
|
||||
ClassLoadInfo cl_info(protection_domain,
|
||||
- unsafe_anonymous_host,
|
||||
- NULL, // cp_patches
|
||||
dynamic_host_class, // dynamic_nest_host
|
||||
Handle(), // classData
|
||||
the_class->is_hidden(), // is_hidden
|
||||
|
||||
InstanceKlass* k;
|
||||
|
||||
- if (the_class->is_unsafe_anonymous() || the_class->is_hidden()) {
|
||||
+ if (the_class->is_hidden()) {
|
||||
InstanceKlass* dynamic_host_class = NULL;
|
||||
- InstanceKlass* unsafe_anonymous_host = NULL;
|
||||
|
||||
if (the_class->is_hidden()) {
|
||||
log_debug(redefine, class, load)("loading hidden class %s", the_class->name()->as_C_string());
|
||||
dynamic_host_class = the_class->nest_host(THREAD);
|
||||
}
|
||||
|
||||
- if (the_class->is_unsafe_anonymous()) {
|
||||
- log_debug(redefine, class, load)("loading usafe anonymous %s", the_class->name()->as_C_string());
|
||||
- unsafe_anonymous_host = the_class->unsafe_anonymous_host();
|
||||
- }
|
||||
-
|
||||
ClassLoadInfo cl_info(protection_domain,
|
||||
- unsafe_anonymous_host,
|
||||
- NULL, // cp_patches
|
||||
dynamic_host_class, // dynamic_nest_host
|
||||
Handle(), // classData
|
||||
the_class->is_hidden(), // is_hidden
|
||||
@@ -1143,7 +1133,7 @@ int VM_EnhancedRedefineClasses::calculate_redefinition_flags(InstanceKlass* new_
|
||||
Array<Method*>* k_new_methods(new_class->methods());
|
||||
int n_old_methods = k_old_methods->length();
|
||||
int n_new_methods = k_new_methods->length();
|
||||
- Thread* thread = Thread::current();
|
||||
+ JavaThread* thread = JavaThread::current();
|
||||
|
||||
int ni = 0;
|
||||
int oi = 0;
|
||||
Array<Method*>* k_new_methods(new_class->methods());
|
||||
int n_old_methods = k_old_methods->length();
|
||||
int n_new_methods = k_new_methods->length();
|
||||
- Thread* thread = Thread::current();
|
||||
+ JavaThread* thread = JavaThread::current();
|
||||
|
||||
int ni = 0;
|
||||
int oi = 0;
|
||||
@@ -1491,8 +1481,8 @@ void VM_EnhancedRedefineClasses::rollback() {
|
||||
// Rewrite faster byte-codes back to their slower equivalent. Undoes rewriting happening in templateTable_xxx.cpp
|
||||
// The reason is that once we zero cpool caches, we need to re-resolve all entries again. Faster bytecodes do not
|
||||
// do that, they assume that cache entry is resolved already.
|
||||
-void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method, TRAPS) {
|
||||
- RawBytecodeStream bcs(methodHandle(THREAD, method));
|
||||
+void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
+ RawBytecodeStream bcs(methodHandle(Thread::current(), method));
|
||||
Bytecodes::Code code;
|
||||
Bytecodes::Code java_code;
|
||||
while (!bcs.is_last_bytecode()) {
|
||||
// Rewrite faster byte-codes back to their slower equivalent. Undoes rewriting happening in templateTable_xxx.cpp
|
||||
// The reason is that once we zero cpool caches, we need to re-resolve all entries again. Faster bytecodes do not
|
||||
// do that, they assume that cache entry is resolved already.
|
||||
-void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method, TRAPS) {
|
||||
- RawBytecodeStream bcs(methodHandle(THREAD, method));
|
||||
+void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
+ RawBytecodeStream bcs(methodHandle(Thread::current(), method));
|
||||
Bytecodes::Code code;
|
||||
Bytecodes::Code java_code;
|
||||
while (!bcs.is_last_bytecode()) {
|
||||
@@ -1535,10 +1525,10 @@ void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method, TRAPS) {
|
||||
assert(code2 == Bytecodes::_fast_igetfield ||
|
||||
code2 == Bytecodes::_fast_agetfield ||
|
||||
code2 == Bytecodes::_fast_fgetfield, "");
|
||||
- *(bcp + 1) = Bytecodes::java_code(code2);
|
||||
- }
|
||||
+ *(bcp + 1) = Bytecodes::java_code(code2);
|
||||
}
|
||||
}
|
||||
+}
|
||||
|
||||
// Unevolving classes may point to old methods directly
|
||||
// from their constant pool caches, itables, and/or vtables. We
|
||||
assert(code2 == Bytecodes::_fast_igetfield ||
|
||||
code2 == Bytecodes::_fast_agetfield ||
|
||||
code2 == Bytecodes::_fast_fgetfield, "");
|
||||
- *(bcp + 1) = Bytecodes::java_code(code2);
|
||||
- }
|
||||
+ *(bcp + 1) = Bytecodes::java_code(code2);
|
||||
}
|
||||
}
|
||||
+}
|
||||
|
||||
// Unevolving classes may point to old methods directly
|
||||
// from their constant pool caches, itables, and/or vtables. We
|
||||
@@ -1559,9 +1549,11 @@ void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
constantPoolHandle other_cp = constantPoolHandle(_thread, ik->constants());
|
||||
|
||||
// Update host klass of anonymous classes (for example, produced by lambdas) to newest version.
|
||||
+ /*
|
||||
if (ik->is_unsafe_anonymous() && ik->unsafe_anonymous_host()->new_version() != NULL) {
|
||||
ik->set_unsafe_anonymous_host(InstanceKlass::cast(ik->unsafe_anonymous_host()->newest_version()));
|
||||
}
|
||||
+ */
|
||||
|
||||
// FIXME: check new nest_host for hidden
|
||||
|
||||
constantPoolHandle other_cp = constantPoolHandle(_thread, ik->constants());
|
||||
|
||||
// Update host klass of anonymous classes (for example, produced by lambdas) to newest version.
|
||||
+ /*
|
||||
if (ik->is_unsafe_anonymous() && ik->unsafe_anonymous_host()->new_version() != NULL) {
|
||||
ik->set_unsafe_anonymous_host(InstanceKlass::cast(ik->unsafe_anonymous_host()->newest_version()));
|
||||
}
|
||||
+ */
|
||||
|
||||
// FIXME: check new nest_host for hidden
|
||||
|
||||
@@ -1596,7 +1588,7 @@ void VM_EnhancedRedefineClasses::ClearCpoolCacheAndUnpatch::do_klass(Klass* k) {
|
||||
|
||||
// If bytecode rewriting is enabled, we also need to unpatch bytecode to force resolution of zeroed entries
|
||||
if (RewriteBytecodes) {
|
||||
- ik->methods_do(unpatch_bytecode, _thread);
|
||||
+ ik->methods_do(unpatch_bytecode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If bytecode rewriting is enabled, we also need to unpatch bytecode to force resolution of zeroed entries
|
||||
if (RewriteBytecodes) {
|
||||
- ik->methods_do(unpatch_bytecode, _thread);
|
||||
+ ik->methods_do(unpatch_bytecode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1628,7 +1620,7 @@ void VM_EnhancedRedefineClasses::MethodDataCleaner::do_klass(Klass* k) {
|
||||
}
|
||||
|
||||
|
||||
-void VM_EnhancedRedefineClasses::update_jmethod_ids(TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::update_jmethod_ids(Thread* current) {
|
||||
for (int j = 0; j < _matching_methods_length; ++j) {
|
||||
Method* old_method = _matching_old_methods[j];
|
||||
jmethodID jmid = old_method->find_jmethod_id_or_null();
|
||||
}
|
||||
|
||||
|
||||
-void VM_EnhancedRedefineClasses::update_jmethod_ids(TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::update_jmethod_ids(Thread* current) {
|
||||
for (int j = 0; j < _matching_methods_length; ++j) {
|
||||
Method* old_method = _matching_old_methods[j];
|
||||
jmethodID jmid = old_method->find_jmethod_id_or_null();
|
||||
@@ -1639,10 +1631,10 @@ void VM_EnhancedRedefineClasses::update_jmethod_ids(TRAPS) {
|
||||
|
||||
if (jmid != NULL) {
|
||||
// There is a jmethodID, change it to point to the new method
|
||||
- methodHandle new_method_h(THREAD, _matching_new_methods[j]);
|
||||
+ methodHandle new_method_h(current, _matching_new_methods[j]);
|
||||
|
||||
if (old_method->new_version() == NULL) {
|
||||
- methodHandle old_method_h(THREAD, _matching_old_methods[j]);
|
||||
+ methodHandle old_method_h(current, _matching_old_methods[j]);
|
||||
jmethodID new_jmethod_id = Method::make_jmethod_id(old_method_h->method_holder()->class_loader_data(), old_method_h());
|
||||
bool result = InstanceKlass::cast(old_method_h->method_holder())->update_jmethod_id(old_method_h(), new_jmethod_id);
|
||||
} else {
|
||||
|
||||
if (jmid != NULL) {
|
||||
// There is a jmethodID, change it to point to the new method
|
||||
- methodHandle new_method_h(THREAD, _matching_new_methods[j]);
|
||||
+ methodHandle new_method_h(current, _matching_new_methods[j]);
|
||||
|
||||
if (old_method->new_version() == NULL) {
|
||||
- methodHandle old_method_h(THREAD, _matching_old_methods[j]);
|
||||
+ methodHandle old_method_h(current, _matching_old_methods[j]);
|
||||
jmethodID new_jmethod_id = Method::make_jmethod_id(old_method_h->method_holder()->class_loader_data(), old_method_h());
|
||||
bool result = InstanceKlass::cast(old_method_h->method_holder())->update_jmethod_id(old_method_h(), new_jmethod_id);
|
||||
} else {
|
||||
@@ -1864,7 +1856,7 @@ void VM_EnhancedRedefineClasses::mark_dependent_code(InstanceKlass* ik) {
|
||||
// subsequent calls to RedefineClasses need only throw away code
|
||||
// that depends on the class.
|
||||
//
|
||||
-void VM_EnhancedRedefineClasses::flush_dependent_code(TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::flush_dependent_code() {
|
||||
assert_locked_or_safepoint(Compile_lock);
|
||||
|
||||
// All dependencies have been recorded from startup or this is a second or
|
||||
// subsequent calls to RedefineClasses need only throw away code
|
||||
// that depends on the class.
|
||||
//
|
||||
-void VM_EnhancedRedefineClasses::flush_dependent_code(TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::flush_dependent_code() {
|
||||
assert_locked_or_safepoint(Compile_lock);
|
||||
|
||||
// All dependencies have been recorded from startup or this is a second or
|
||||
@@ -1959,9 +1951,9 @@ void VM_EnhancedRedefineClasses::compute_added_deleted_matching_methods() {
|
||||
// a helper method to be specified. The interesting parameters
|
||||
// that we would like to pass to the helper method are saved in
|
||||
// static global fields in the VM operation.
|
||||
-void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_oop, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::redefine_single_class(Thread* current, InstanceKlass* new_class_oop) {
|
||||
|
||||
- HandleMark hm(THREAD); // make sure handles from this call are freed
|
||||
+ HandleMark hm(current); // make sure handles from this call are freed
|
||||
|
||||
InstanceKlass* new_class = new_class_oop;
|
||||
InstanceKlass* the_class = InstanceKlass::cast(new_class_oop->old_version());
|
||||
// a helper method to be specified. The interesting parameters
|
||||
// that we would like to pass to the helper method are saved in
|
||||
// static global fields in the VM operation.
|
||||
-void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_oop, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::redefine_single_class(Thread* current, InstanceKlass* new_class_oop) {
|
||||
|
||||
- HandleMark hm(THREAD); // make sure handles from this call are freed
|
||||
+ HandleMark hm(current); // make sure handles from this call are freed
|
||||
|
||||
InstanceKlass* new_class = new_class_oop;
|
||||
InstanceKlass* the_class = InstanceKlass::cast(new_class_oop->old_version());
|
||||
@@ -1980,7 +1972,7 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
|
||||
// track number of methods that are EMCP for add_previous_version() call below
|
||||
check_methods_and_mark_as_obsolete();
|
||||
- update_jmethod_ids(THREAD);
|
||||
+ update_jmethod_ids(current);
|
||||
|
||||
_any_class_has_resolved_methods = the_class->has_resolved_methods() || _any_class_has_resolved_methods;
|
||||
|
||||
|
||||
// track number of methods that are EMCP for add_previous_version() call below
|
||||
check_methods_and_mark_as_obsolete();
|
||||
- update_jmethod_ids(THREAD);
|
||||
+ update_jmethod_ids(current);
|
||||
|
||||
_any_class_has_resolved_methods = the_class->has_resolved_methods() || _any_class_has_resolved_methods;
|
||||
|
||||
@@ -2002,14 +1994,14 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
*/
|
||||
|
||||
{
|
||||
- ResourceMark rm(THREAD);
|
||||
+ ResourceMark rm(current);
|
||||
// increment the classRedefinedCount field in the_class and in any
|
||||
// direct and indirect subclasses of the_class
|
||||
- increment_class_counter(new_class, THREAD);
|
||||
+ increment_class_counter(current, new_class);
|
||||
log_info(redefine, class, load)
|
||||
("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
|
||||
new_class->external_name(), java_lang_Class::classRedefinedCount(new_class->java_mirror()), os::available_memory() >> 10);
|
||||
- Events::log_redefinition(THREAD, "redefined class name=%s, count=%d",
|
||||
+ Events::log_redefinition(current, "redefined class name=%s, count=%d",
|
||||
new_class->external_name(),
|
||||
java_lang_Class::classRedefinedCount(new_class->java_mirror()));
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
- ResourceMark rm(THREAD);
|
||||
+ ResourceMark rm(current);
|
||||
// increment the classRedefinedCount field in the_class and in any
|
||||
// direct and indirect subclasses of the_class
|
||||
- increment_class_counter(new_class, THREAD);
|
||||
+ increment_class_counter(current, new_class);
|
||||
log_info(redefine, class, load)
|
||||
("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
|
||||
new_class->external_name(), java_lang_Class::classRedefinedCount(new_class->java_mirror()), os::available_memory() >> 10);
|
||||
- Events::log_redefinition(THREAD, "redefined class name=%s, count=%d",
|
||||
+ Events::log_redefinition(current, "redefined class name=%s, count=%d",
|
||||
new_class->external_name(),
|
||||
java_lang_Class::classRedefinedCount(new_class->java_mirror()));
|
||||
}
|
||||
@@ -2018,21 +2010,21 @@ void VM_EnhancedRedefineClasses::redefine_single_class(InstanceKlass* new_class_
|
||||
|
||||
// Increment the classRedefinedCount field in the specific InstanceKlass
|
||||
// and in all direct and indirect subclasses.
|
||||
-void VM_EnhancedRedefineClasses::increment_class_counter(InstanceKlass *ik, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::increment_class_counter(Thread* current, InstanceKlass *ik) {
|
||||
oop class_mirror = ik->old_version()->java_mirror();
|
||||
Klass* class_oop = java_lang_Class::as_Klass(class_mirror);
|
||||
int new_count = java_lang_Class::classRedefinedCount(class_mirror) + 1;
|
||||
java_lang_Class::set_classRedefinedCount(ik->java_mirror(), new_count);
|
||||
}
|
||||
|
||||
-void VM_EnhancedRedefineClasses::check_class(InstanceKlass* ik, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::check_class(InstanceKlass* ik) {
|
||||
if (ik->is_instance_klass() && ik->old_version() != NULL) {
|
||||
- HandleMark hm(THREAD);
|
||||
+ HandleMark hm(Thread::current());
|
||||
|
||||
assert(ik->new_version() == NULL, "must be latest version in system dictionary");
|
||||
|
||||
if (ik->vtable_length() > 0) {
|
||||
- ResourceMark rm(THREAD);
|
||||
+ ResourceMark rm(Thread::current());
|
||||
assert(ik->vtable().check_no_old_or_obsolete_entries(), "old method found");
|
||||
ik->vtable().verify(tty, true);
|
||||
}
|
||||
|
||||
// Increment the classRedefinedCount field in the specific InstanceKlass
|
||||
// and in all direct and indirect subclasses.
|
||||
-void VM_EnhancedRedefineClasses::increment_class_counter(InstanceKlass *ik, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::increment_class_counter(Thread* current, InstanceKlass *ik) {
|
||||
oop class_mirror = ik->old_version()->java_mirror();
|
||||
Klass* class_oop = java_lang_Class::as_Klass(class_mirror);
|
||||
int new_count = java_lang_Class::classRedefinedCount(class_mirror) + 1;
|
||||
java_lang_Class::set_classRedefinedCount(ik->java_mirror(), new_count);
|
||||
}
|
||||
|
||||
-void VM_EnhancedRedefineClasses::check_class(InstanceKlass* ik, TRAPS) {
|
||||
+void VM_EnhancedRedefineClasses::check_class(InstanceKlass* ik) {
|
||||
if (ik->is_instance_klass() && ik->old_version() != NULL) {
|
||||
- HandleMark hm(THREAD);
|
||||
+ HandleMark hm(Thread::current());
|
||||
|
||||
assert(ik->new_version() == NULL, "must be latest version in system dictionary");
|
||||
|
||||
if (ik->vtable_length() > 0) {
|
||||
- ResourceMark rm(THREAD);
|
||||
+ ResourceMark rm(Thread::current());
|
||||
assert(ik->vtable().check_no_old_or_obsolete_entries(), "old method found");
|
||||
ik->vtable().verify(tty, true);
|
||||
}
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 673688dff84..378e6f78582 100644
|
||||
index d0d2f78aa62..252287a3697 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -122,7 +122,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
static void unregister_nmethod_g1(nmethod* nm);
|
||||
static void register_nmethod_g1(nmethod* nm);
|
||||
- static void unpatch_bytecode(Method* method, TRAPS);
|
||||
+ static void unpatch_bytecode(Method* method);
|
||||
|
||||
void root_oops_do(OopClosure *oopClosure);
|
||||
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
static void unregister_nmethod_g1(nmethod* nm);
|
||||
static void register_nmethod_g1(nmethod* nm);
|
||||
- static void unpatch_bytecode(Method* method, TRAPS);
|
||||
+ static void unpatch_bytecode(Method* method);
|
||||
|
||||
void root_oops_do(OopClosure *oopClosure);
|
||||
|
||||
@@ -131,28 +131,28 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
void compute_added_deleted_matching_methods();
|
||||
|
||||
// Change jmethodIDs to point to the new methods
|
||||
- void update_jmethod_ids(TRAPS);
|
||||
+ void update_jmethod_ids(Thread* current);
|
||||
|
||||
// marking methods as old and/or obsolete
|
||||
void check_methods_and_mark_as_obsolete();
|
||||
void transfer_old_native_function_registrations(InstanceKlass* the_class);
|
||||
|
||||
// Install the redefinition of a class
|
||||
- void redefine_single_class(InstanceKlass* new_class_oop, TRAPS);
|
||||
+ void redefine_single_class(Thread* current, InstanceKlass* new_class_oop);
|
||||
|
||||
// Increment the classRedefinedCount field in the specific InstanceKlass
|
||||
// and in all direct and indirect subclasses.
|
||||
- void increment_class_counter(InstanceKlass *ik, TRAPS);
|
||||
+ void increment_class_counter(Thread* current, InstanceKlass *ik);
|
||||
|
||||
void mark_dependent_code(InstanceKlass* ik);
|
||||
|
||||
- void flush_dependent_code(TRAPS);
|
||||
+ void flush_dependent_code();
|
||||
|
||||
u8 next_id();
|
||||
|
||||
void reinitializeJDKClasses();
|
||||
|
||||
- static void check_class(InstanceKlass* k_oop, TRAPS);
|
||||
+ static void check_class(InstanceKlass* k_oop);
|
||||
|
||||
static void dump_methods();
|
||||
|
||||
void compute_added_deleted_matching_methods();
|
||||
|
||||
// Change jmethodIDs to point to the new methods
|
||||
- void update_jmethod_ids(TRAPS);
|
||||
+ void update_jmethod_ids(Thread* current);
|
||||
|
||||
// marking methods as old and/or obsolete
|
||||
void check_methods_and_mark_as_obsolete();
|
||||
void transfer_old_native_function_registrations(InstanceKlass* the_class);
|
||||
|
||||
// Install the redefinition of a class
|
||||
- void redefine_single_class(InstanceKlass* new_class_oop, TRAPS);
|
||||
+ void redefine_single_class(Thread* current, InstanceKlass* new_class_oop);
|
||||
|
||||
// Increment the classRedefinedCount field in the specific InstanceKlass
|
||||
// and in all direct and indirect subclasses.
|
||||
- void increment_class_counter(InstanceKlass *ik, TRAPS);
|
||||
+ void increment_class_counter(Thread* current, InstanceKlass *ik);
|
||||
|
||||
void mark_dependent_code(InstanceKlass* ik);
|
||||
|
||||
- void flush_dependent_code(TRAPS);
|
||||
+ void flush_dependent_code();
|
||||
|
||||
u8 next_id();
|
||||
|
||||
void reinitializeJDKClasses();
|
||||
|
||||
- static void check_class(InstanceKlass* k_oop, TRAPS);
|
||||
+ static void check_class(InstanceKlass* k_oop);
|
||||
|
||||
static void dump_methods();
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From db2d7cd0cd956f297c58baa7500c1440092648bf Mon Sep 17 00:00:00 2001
|
||||
From 52c661cebf92d4ad68058ada5d3463e54428aee7 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 20 Jun 2021 19:42:51 +0200
|
||||
Subject: [PATCH 34/39] Fix init_method_MemberName after Thread to JavaThread
|
||||
Subject: [PATCH 34/42] Fix init_method_MemberName after Thread to JavaThread
|
||||
refactorization
|
||||
|
||||
---
|
||||
@@ -116,27 +116,27 @@ index 317a006a4ec..36587031fec 100644
|
||||
void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index b662976afcb..ff012383872 100644
|
||||
index 0aeeea4e7a4..e7f26b7d08e 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -292,8 +292,15 @@ class ChangePointersOopClosure : public BasicOopIterateClosure {
|
||||
// Note: we might set NULL at this point, which should force AbstractMethodError at runtime
|
||||
Thread *thread = Thread::current();
|
||||
CallInfo info(new_method, newest, thread);
|
||||
- Handle objHandle(thread, obj);
|
||||
- MethodHandles::init_method_MemberName(objHandle, info);
|
||||
+ oop resolved_method = ResolvedMethodTable::find_method(info.resolved_method());
|
||||
+ if (resolved_method != NULL) {
|
||||
+ info.set_resolved_method_name_dcevm(resolved_method, thread);
|
||||
+ Handle objHandle(thread, obj);
|
||||
+ MethodHandles::init_method_MemberName(objHandle, info);
|
||||
+ } else {
|
||||
+ assert(0, "Must be resolved");
|
||||
+ java_lang_invoke_MemberName::set_method(obj, NULL);
|
||||
+ }
|
||||
} else {
|
||||
java_lang_invoke_MemberName::set_method(obj, NULL);
|
||||
}
|
||||
// Note: we might set NULL at this point, which should force AbstractMethodError at runtime
|
||||
Thread *thread = Thread::current();
|
||||
CallInfo info(new_method, newest, thread);
|
||||
- Handle objHandle(thread, obj);
|
||||
- MethodHandles::init_method_MemberName(objHandle, info);
|
||||
+ oop resolved_method = ResolvedMethodTable::find_method(info.resolved_method());
|
||||
+ if (resolved_method != NULL) {
|
||||
+ info.set_resolved_method_name_dcevm(resolved_method, thread);
|
||||
+ Handle objHandle(thread, obj);
|
||||
+ MethodHandles::init_method_MemberName(objHandle, info);
|
||||
+ } else {
|
||||
+ assert(0, "Must be resolved");
|
||||
+ java_lang_invoke_MemberName::set_method(obj, NULL);
|
||||
+ }
|
||||
} else {
|
||||
java_lang_invoke_MemberName::set_method(obj, NULL);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From bfbbae66340a223328542722b299f67c21166c52 Mon Sep 17 00:00:00 2001
|
||||
From 523ce6dd1559af84ebd6e4f10e7de9142f88d9d0 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Mon, 21 Jun 2021 20:44:17 +0200
|
||||
Subject: [PATCH 35/39] Fix "implicit conversion of NULL constant to 'bool'"
|
||||
Subject: [PATCH 35/42] Fix "implicit conversion of NULL constant to 'bool'"
|
||||
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiRedefineClasses.cpp | 2 +-
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 5bb6ef0fc266a748232c7c51191deab47d4f3857 Mon Sep 17 00:00:00 2001
|
||||
From df4c29b24d41069168ee5647b2737348d9902090 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Wed, 30 Jun 2021 18:30:00 +0200
|
||||
Subject: [PATCH 36/39] Fix, pass SystemDictionary::resolve_from_stream cl_info
|
||||
Subject: [PATCH 36/42] Fix, pass SystemDictionary::resolve_from_stream cl_info
|
||||
param
|
||||
|
||||
---
|
||||
@@ -9,27 +9,27 @@ Subject: [PATCH 36/39] Fix, pass SystemDictionary::resolve_from_stream cl_info
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index ff012383872..cbcb484a290 100644
|
||||
index e7f26b7d08e..4d145f30100 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -920,10 +920,16 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
}
|
||||
|
||||
} else {
|
||||
+ ClassLoadInfo cl_info(protection_domain,
|
||||
+ NULL, // dynamic_nest_host
|
||||
+ Handle(), // classData
|
||||
+ false, // is_hidden
|
||||
+ !the_class->is_non_strong_hidden(), // is_strong_hidden
|
||||
+ true); // FIXME: check if correct. can_access_vm_annotations
|
||||
k = SystemDictionary::resolve_from_stream(&st,
|
||||
the_class_sym,
|
||||
the_class_loader,
|
||||
- protection_domain,
|
||||
+ cl_info,
|
||||
the_class,
|
||||
THREAD);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
+ ClassLoadInfo cl_info(protection_domain,
|
||||
+ NULL, // dynamic_nest_host
|
||||
+ Handle(), // classData
|
||||
+ false, // is_hidden
|
||||
+ !the_class->is_non_strong_hidden(), // is_strong_hidden
|
||||
+ true); // FIXME: check if correct. can_access_vm_annotations
|
||||
k = SystemDictionary::resolve_from_stream(&st,
|
||||
the_class_sym,
|
||||
the_class_loader,
|
||||
- protection_domain,
|
||||
+ cl_info,
|
||||
the_class,
|
||||
THREAD);
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 563e06d1c56cfc3f4e93e3975cd6c2dab8183c98 Mon Sep 17 00:00:00 2001
|
||||
From 47ae71afaf12c7bab4f928579b154ec72aad3c02 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Wed, 30 Jun 2021 18:50:38 +0200
|
||||
Subject: [PATCH 37/39] Search for affected classes in all initialized classes
|
||||
Subject: [PATCH 37/42] Search for affected classes in all initialized classes
|
||||
in cld
|
||||
|
||||
Fix also case when lambda interface is redefined. Lambda class is
|
||||
@@ -83,31 +83,31 @@ index da712eaf55f..ff391ec74fc 100644
|
||||
static void classes_do(void f(Klass* const));
|
||||
static void methods_do(void f(Method*));
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index cbcb484a290..43899ea3d48 100644
|
||||
index 4d145f30100..8615806ac98 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -2170,17 +2170,12 @@ jvmtiError VM_EnhancedRedefineClasses::find_sorted_affected_classes(TRAPS) {
|
||||
{
|
||||
MutexLocker mcld(ClassLoaderDataGraph_lock);
|
||||
|
||||
- // 0. we can't use ClassLoaderDataGraph::classes_do since classes can be uninitialized in cld,
|
||||
- // fully initialized class is in system dictionary
|
||||
+ // We can't use ClassLoaderDataGraph::classes_do since classes can be uninitialized in cld,
|
||||
+ // fully initialized class is in system dictionary, but hidden classes are excluded. Therefore
|
||||
+ // we use special method iterating over initialized classes only
|
||||
// ClassLoaderDataGraph::classes_do(&closure);
|
||||
|
||||
- // 1. Scan over dictionaries
|
||||
- ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
-
|
||||
- // 2. Anonymous or hidden class is not in dictionary, we have to iterate anonymous cld directly, but there is race cond...
|
||||
- // TODO: review ... anonymous class is added to cld before InstanceKlass initialization,
|
||||
- // find out how to check if the InstanceKlass is initialized
|
||||
- ClassLoaderDataGraph::anonymous_or_hidden_classes_do(&closure);
|
||||
+ ClassLoaderDataGraph::initialized_classes_do(&closure);
|
||||
}
|
||||
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
{
|
||||
MutexLocker mcld(ClassLoaderDataGraph_lock);
|
||||
|
||||
- // 0. we can't use ClassLoaderDataGraph::classes_do since classes can be uninitialized in cld,
|
||||
- // fully initialized class is in system dictionary
|
||||
+ // We can't use ClassLoaderDataGraph::classes_do since classes can be uninitialized in cld,
|
||||
+ // fully initialized class is in system dictionary, but hidden classes are excluded. Therefore
|
||||
+ // we use special method iterating over initialized classes only
|
||||
// ClassLoaderDataGraph::classes_do(&closure);
|
||||
|
||||
- // 1. Scan over dictionaries
|
||||
- ClassLoaderDataGraph::dictionary_classes_do(&closure);
|
||||
-
|
||||
- // 2. Anonymous or hidden class is not in dictionary, we have to iterate anonymous cld directly, but there is race cond...
|
||||
- // TODO: review ... anonymous class is added to cld before InstanceKlass initialization,
|
||||
- // find out how to check if the InstanceKlass is initialized
|
||||
- ClassLoaderDataGraph::anonymous_or_hidden_classes_do(&closure);
|
||||
+ ClassLoaderDataGraph::initialized_classes_do(&closure);
|
||||
}
|
||||
|
||||
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());
|
||||
--
|
||||
2.23.0
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From acad06204bc4f7e7a89e9a44ded6b9d27082327b Mon Sep 17 00:00:00 2001
|
||||
From e9c3042e13c5fe58cac7409b1f93a4dc287cc14a Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Wed, 30 Jun 2021 18:58:47 +0200
|
||||
Subject: [PATCH 38/39] Fix compilation issue
|
||||
Subject: [PATCH 38/42] Fix compilation issue
|
||||
|
||||
---
|
||||
src/hotspot/share/interpreter/linkResolver.cpp | 4 ++--
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 563465b112da14e8b81ef32eefc06c79015a809b Mon Sep 17 00:00:00 2001
|
||||
From f303ef1fec703144efe6b9989a1a71fae0fb4263 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Tue, 27 Jul 2021 21:32:51 +0200
|
||||
Subject: [PATCH 39/39] Remove duplicated lambdaFormInvokers.cpp
|
||||
Subject: [PATCH 39/42] Remove duplicated lambdaFormInvokers.cpp
|
||||
|
||||
---
|
||||
.../share/classfile/lambdaFormInvokers.cpp | 152 ------------------
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
From 9cb4aaf17c8e35f39aed0dfa33e173b40968eee6 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Sun, 10 Oct 2021 20:25:30 +0200
|
||||
Subject: [PATCH 40/42] JBR-3867 - update keys of jvmti TAG map after
|
||||
redefinition
|
||||
|
||||
jdwp keeps relation class_ptr->class_ref in jvmti tag. class_ptr is used
|
||||
as a tag key, tag value is refnode. There are new class_ptrs after
|
||||
redefinition, therefore jdwp redefinition method update all affected
|
||||
keys in the tag map.
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiExtensions.cpp | 24 ++++++++++++++
|
||||
.../share/native/libjdwp/VirtualMachineImpl.c | 20 +++++++++++
|
||||
.../share/native/libjdwp/commonRef.c | 29 ++++++++++++++++
|
||||
.../share/native/libjdwp/commonRef.h | 2 ++
|
||||
.../share/native/libjdwp/util.c | 33 +++++++++++++++++++
|
||||
.../share/native/libjdwp/util.h | 3 ++
|
||||
6 files changed, 111 insertions(+)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiExtensions.cpp b/src/hotspot/share/prims/jvmtiExtensions.cpp
|
||||
index a3fc430e1d1..ab2e663b95d 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiExtensions.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiExtensions.cpp
|
||||
@@ -49,6 +49,15 @@ static jvmtiError JNICALL IsClassUnloadingEnabled(const jvmtiEnv* env, ...) {
|
||||
return JVMTI_ERROR_NONE;
|
||||
}
|
||||
|
||||
+// extension function
|
||||
+static jvmtiError JNICALL IsEnhancedClassRedefinitionEnabled(const jvmtiEnv* env, jboolean* enabled, ...) {
|
||||
+ if (enabled == NULL) {
|
||||
+ return JVMTI_ERROR_NULL_POINTER;
|
||||
+ }
|
||||
+ *enabled = (jboolean)AllowEnhancedClassRedefinition;
|
||||
+ return JVMTI_ERROR_NONE;
|
||||
+}
|
||||
+
|
||||
// register extension functions and events. In this implementation we
|
||||
// have a single extension function (to prove the API) that tests if class
|
||||
// unloading is enabled or disabled. We also have a single extension event
|
||||
@@ -88,6 +97,21 @@ void JvmtiExtensions::register_extensions() {
|
||||
event_params
|
||||
};
|
||||
_ext_events->append(&ext_event);
|
||||
+
|
||||
+ static jvmtiParamInfo func_params_enh_redef[] = {
|
||||
+ { (char*)"IsEnhancedClassRedefinitionEnabled", JVMTI_KIND_OUT, JVMTI_TYPE_JBOOLEAN, JNI_FALSE }
|
||||
+
|
||||
+ };
|
||||
+ static jvmtiExtensionFunctionInfo ext_func_enh_redef = {
|
||||
+ (jvmtiExtensionFunction)IsEnhancedClassRedefinitionEnabled,
|
||||
+ (char*)"com.sun.hotspot.functions.IsEnhancedClassRedefinitionEnabled",
|
||||
+ (char*)"Tell if enhanced class redefinition is enabled (-noclassgc)",
|
||||
+ sizeof(func_params_enh_redef)/sizeof(func_params_enh_redef[0]),
|
||||
+ func_params_enh_redef,
|
||||
+ 0, // no non-universal errors
|
||||
+ NULL
|
||||
+ };
|
||||
+ _ext_functions->append(&ext_func_enh_redef);
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c b/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
|
||||
index c07bdac2922..7e3070d7d1d 100644
|
||||
--- a/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
|
||||
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
|
||||
@@ -477,6 +477,14 @@ redefineClasses(PacketInputStream *in, PacketOutputStream *out)
|
||||
if (ok == JNI_TRUE) {
|
||||
jvmtiError error;
|
||||
|
||||
+ jlong classIds[classCount];
|
||||
+
|
||||
+ if (gdata->isEnhancedClassRedefinitionEnabled) {
|
||||
+ for (i = 0; i < classCount; ++i) {
|
||||
+ classIds[i] = commonRef_refToID(env, classDefs[i].klass);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
error = JVMTI_FUNC_PTR(gdata->jvmti,RedefineClasses)
|
||||
(gdata->jvmti, classCount, classDefs);
|
||||
if (error != JVMTI_ERROR_NONE) {
|
||||
@@ -486,6 +494,18 @@ redefineClasses(PacketInputStream *in, PacketOutputStream *out)
|
||||
for ( i = 0 ; i < classCount; i++ ) {
|
||||
eventHandler_freeClassBreakpoints(classDefs[i].klass);
|
||||
}
|
||||
+
|
||||
+ if (gdata->isEnhancedClassRedefinitionEnabled) {
|
||||
+ /* Update tags in jvmti to use new classes */
|
||||
+ for ( i = 0 ; i < classCount; i++ ) {
|
||||
+ /* pointer in classIds[i] is updated by advanced redefinition to a new class */
|
||||
+ error = commonRef_updateTags(env, classIds[i]);
|
||||
+ if (error != JVMTI_ERROR_NONE) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c b/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c
|
||||
index bc7ddb660bf..f8cb8e36f17 100644
|
||||
--- a/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c
|
||||
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.c
|
||||
@@ -712,3 +712,32 @@ commonRef_unlock(void)
|
||||
{
|
||||
debugMonitorExit(gdata->refLock);
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * Update JVMTI tags, used from enhanced redefinition
|
||||
+ */
|
||||
+jvmtiError
|
||||
+commonRef_updateTags(JNIEnv *env, jlong id)
|
||||
+{
|
||||
+ jvmtiError error;
|
||||
+
|
||||
+ error = JVMTI_ERROR_NONE;
|
||||
+
|
||||
+ if (id == NULL_OBJECT_ID) {
|
||||
+ return error;
|
||||
+ }
|
||||
+
|
||||
+ debugMonitorEnter(gdata->refLock); {
|
||||
+ RefNode *node;
|
||||
+
|
||||
+ node = findNodeByID(env, id);
|
||||
+ if (node != NULL) {
|
||||
+ error = JVMTI_FUNC_PTR(gdata->jvmti, SetTag)
|
||||
+ (gdata->jvmti, node->ref, ptr_to_jlong(node));
|
||||
+ } else {
|
||||
+ printf("Node not found\n");
|
||||
+ }
|
||||
+ } debugMonitorExit(gdata->refLock);
|
||||
+
|
||||
+ return error;
|
||||
+}
|
||||
diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.h b/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.h
|
||||
index c3700f8c743..35c77e4adbf 100644
|
||||
--- a/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.h
|
||||
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/commonRef.h
|
||||
@@ -43,4 +43,6 @@ void commonRef_compact(void);
|
||||
void commonRef_lock(void);
|
||||
void commonRef_unlock(void);
|
||||
|
||||
+jvmtiError commonRef_updateTags(JNIEnv *env, jlong id);
|
||||
+
|
||||
#endif
|
||||
diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/util.c b/src/jdk.jdwp.agent/share/native/libjdwp/util.c
|
||||
index 2403c5273ba..b4a5ad183e0 100644
|
||||
--- a/src/jdk.jdwp.agent/share/native/libjdwp/util.c
|
||||
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/util.c
|
||||
@@ -43,6 +43,7 @@ BackendGlobalData *gdata = NULL;
|
||||
static jboolean isInterface(jclass clazz);
|
||||
static jboolean isArrayClass(jclass clazz);
|
||||
static char * getPropertyUTF8(JNIEnv *env, char *propertyName);
|
||||
+static jboolean isEnhancedClassRedefinitionEnabled(JNIEnv *env);
|
||||
|
||||
/* Save an object reference for use later (create a NewGlobalRef) */
|
||||
void
|
||||
@@ -285,6 +286,8 @@ util_initialize(JNIEnv *env)
|
||||
}
|
||||
}
|
||||
|
||||
+ gdata->isEnhancedClassRedefinitionEnabled = isEnhancedClassRedefinitionEnabled(env);
|
||||
+
|
||||
} END_WITH_LOCAL_REFS(env);
|
||||
|
||||
}
|
||||
@@ -1701,6 +1704,36 @@ getPropertyUTF8(JNIEnv *env, char *propertyName)
|
||||
return value;
|
||||
}
|
||||
|
||||
+static jboolean
|
||||
+isEnhancedClassRedefinitionEnabled(JNIEnv *env)
|
||||
+{
|
||||
+ jvmtiError error;
|
||||
+ jint count, i;
|
||||
+ jvmtiExtensionFunctionInfo* ext_funcs;
|
||||
+
|
||||
+ error = JVMTI_FUNC_PTR(gdata->jvmti,GetExtensionFunctions)
|
||||
+ (gdata->jvmti, &count, &ext_funcs);
|
||||
+ if (error != JVMTI_ERROR_NONE) {
|
||||
+ return JNI_FALSE;
|
||||
+ }
|
||||
+
|
||||
+ for (i=0; i<count; i++) {
|
||||
+ if (strcmp(ext_funcs[i].id, (char*)"com.sun.hotspot.functions.IsEnhancedClassRedefinitionEnabled") == 0) {
|
||||
+ jboolean enabled;
|
||||
+ error = (*ext_funcs[i].func)(gdata->jvmti, &enabled);
|
||||
+
|
||||
+ if (error != JVMTI_ERROR_NONE) {
|
||||
+ return JNI_FALSE;
|
||||
+ } else {
|
||||
+ return enabled;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return JNI_FALSE;
|
||||
+}
|
||||
+
|
||||
+
|
||||
jboolean
|
||||
isMethodObsolete(jmethodID method)
|
||||
{
|
||||
diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/util.h b/src/jdk.jdwp.agent/share/native/libjdwp/util.h
|
||||
index f62b5c409f0..6de8f17bb23 100644
|
||||
--- a/src/jdk.jdwp.agent/share/native/libjdwp/util.h
|
||||
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/util.h
|
||||
@@ -133,6 +133,9 @@ typedef struct {
|
||||
int objectsByIDsize;
|
||||
int objectsByIDcount;
|
||||
|
||||
+ /* true if enhanced class redefinition is enabled */
|
||||
+ jboolean isEnhancedClassRedefinitionEnabled;
|
||||
+
|
||||
/* Indication that the agent has been loaded */
|
||||
jboolean isLoaded;
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
From db54a42adf258e2ba3459fe017221cf2cf49c33f Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Mon, 11 Oct 2021 20:22:26 +0200
|
||||
Subject: [PATCH 41/42] JBR-3867 - fix msvc compilation issue with non const
|
||||
array on stack
|
||||
|
||||
---
|
||||
.../share/native/libjdwp/VirtualMachineImpl.c | 14 ++++++++++----
|
||||
1 file changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c b/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
|
||||
index 7e3070d7d1d..669fac7cb5b 100644
|
||||
--- a/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
|
||||
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/VirtualMachineImpl.c
|
||||
@@ -477,11 +477,16 @@ redefineClasses(PacketInputStream *in, PacketOutputStream *out)
|
||||
if (ok == JNI_TRUE) {
|
||||
jvmtiError error;
|
||||
|
||||
- jlong classIds[classCount];
|
||||
+ jlong* classIds = NULL;
|
||||
|
||||
if (gdata->isEnhancedClassRedefinitionEnabled) {
|
||||
- for (i = 0; i < classCount; ++i) {
|
||||
- classIds[i] = commonRef_refToID(env, classDefs[i].klass);
|
||||
+ classIds = jvmtiAllocate(classCount*(int)sizeof(jlong));
|
||||
+ if (classIds == NULL) {
|
||||
+ outStream_setError(out, JDWP_ERROR(OUT_OF_MEMORY));
|
||||
+ return JNI_TRUE;
|
||||
+ }
|
||||
+ for (i = 0; i < classCount; i++) {
|
||||
+ classIds[i] = commonRef_refToID(env, classDefs[i].klass);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,7 +500,7 @@ redefineClasses(PacketInputStream *in, PacketOutputStream *out)
|
||||
eventHandler_freeClassBreakpoints(classDefs[i].klass);
|
||||
}
|
||||
|
||||
- if (gdata->isEnhancedClassRedefinitionEnabled) {
|
||||
+ if (gdata->isEnhancedClassRedefinitionEnabled && classIds != NULL) {
|
||||
/* Update tags in jvmti to use new classes */
|
||||
for ( i = 0 ; i < classCount; i++ ) {
|
||||
/* pointer in classIds[i] is updated by advanced redefinition to a new class */
|
||||
@@ -504,6 +509,7 @@ redefineClasses(PacketInputStream *in, PacketOutputStream *out)
|
||||
break;
|
||||
}
|
||||
}
|
||||
+ jvmtiDeallocate((void*) classIds);
|
||||
}
|
||||
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
From 976b5f8b1326fee64febef8771d7cebee46bada9 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@jetbrains.com>
|
||||
Date: Tue, 19 Oct 2021 17:02:35 +0200
|
||||
Subject: [PATCH 42/42] Attempt to fix JBR-3887
|
||||
|
||||
---
|
||||
src/hotspot/share/prims/jvmtiExtensions.cpp | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiExtensions.cpp b/src/hotspot/share/prims/jvmtiExtensions.cpp
|
||||
index ab2e663b95d..698d32a7228 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiExtensions.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiExtensions.cpp
|
||||
@@ -50,7 +50,13 @@ static jvmtiError JNICALL IsClassUnloadingEnabled(const jvmtiEnv* env, ...) {
|
||||
}
|
||||
|
||||
// extension function
|
||||
-static jvmtiError JNICALL IsEnhancedClassRedefinitionEnabled(const jvmtiEnv* env, jboolean* enabled, ...) {
|
||||
+static jvmtiError JNICALL IsEnhancedClassRedefinitionEnabled(const jvmtiEnv* env, ...) {
|
||||
+ jboolean* enabled = NULL;
|
||||
+ va_list ap;
|
||||
+
|
||||
+ va_start(ap, env);
|
||||
+ enabled = va_arg(ap, jboolean *);
|
||||
+ va_end(ap);
|
||||
if (enabled == NULL) {
|
||||
return JVMTI_ERROR_NULL_POINTER;
|
||||
}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -375,6 +375,9 @@ jdk_accessibility = \
|
||||
jfc_demo = \
|
||||
demo/jfc
|
||||
|
||||
jbr_all = \
|
||||
jb
|
||||
|
||||
jdk_desktop = \
|
||||
:jdk_awt \
|
||||
:jdk_2d \
|
||||
@@ -384,7 +387,8 @@ jdk_desktop = \
|
||||
:jdk_imageio \
|
||||
:jdk_accessibility \
|
||||
:jfc_demo \
|
||||
:jdk_client_sanity
|
||||
:jdk_client_sanity \
|
||||
:jbr_all
|
||||
|
||||
# SwingSet3 tests.
|
||||
jdk_client_sanity = \
|
||||
|
||||
45
test/jdk/jb/build/version.sh
Normal file
45
test/jdk/jb/build/version.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright 2000-2021 JetBrains s.r.o.
|
||||
# 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.
|
||||
#
|
||||
# This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
# version 2 for more details (a copy is included in the LICENSE file that
|
||||
# accompanied this code).
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License version
|
||||
# 2 along with this work; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
|
||||
# @test
|
||||
# @summary Regression test for JBR-3887.
|
||||
# The test checks <code>java $arg -version</code> do not cause crashes
|
||||
# @run shell version.sh
|
||||
|
||||
if [ -z "${TESTJAVA}" ]; then
|
||||
echo "TESTJAVA undefined: testing cancelled"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
args="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:0"
|
||||
|
||||
echo "check> ${TESTJAVA}/bin/java $args -version"
|
||||
"${TESTJAVA}"/bin/java $args -version
|
||||
exit_status=$?
|
||||
echo "exit status: ${exit_status}"
|
||||
if [ $exit_status != 0 ]; then
|
||||
echo "\nTest failed"
|
||||
exit $exit_status
|
||||
fi
|
||||
@@ -1,50 +1 @@
|
||||
java/awt/Focus/ModalDialogInitialFocusTest/ModalDialogInitialFocusTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java JBR-3730 macosx-all
|
||||
java/awt/Mixing/ValidBounds.java JBR-3730 macosx-all
|
||||
java/awt/Mixing/Validating.java JBR-3730 macosx-all
|
||||
sanity/client/SwingSet/src/TableDemoTest.java JBR-3389 macosx-all intermittent
|
||||
java/awt/Component/7097771/bug7097771.java JBR-3730 macosx-all
|
||||
java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java JBR-3730 macosx-all
|
||||
java/awt/Component/SetComponentsBounds/SetComponentsBounds.java JBR-3722 macosx-all
|
||||
java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java JBR-3730 macosx-all
|
||||
java/awt/event/MouseEvent/EnterAsGrabbedEvent/EnterAsGrabbedEvent.java JBR-3730 macosx-all
|
||||
java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.java JBR-3730 macosx-all
|
||||
java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/ChildWindowFocusTest/ChildWindowFocusTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/DisposedWindow/DisposeDialogNotActivateOwnerTest/DisposeDialogNotActivateOwnerTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/FrameMinimizeTest/FrameMinimizeTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/NonFocusableWindowTest/NoEventsTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/RequestFocusAndHideTest/RequestFocusAndHideTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/RequestOnCompWithNullParent/RequestOnCompWithNullParent1.java JBR-3730 macosx-all
|
||||
java/awt/Focus/RestoreFocusOnDisabledComponentTest/RestoreFocusOnDisabledComponentTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/ShowFrameCheckForegroundTest/ShowFrameCheckForegroundTest.java JBR-3733 macosx-all
|
||||
java/awt/Focus/ToFrontFocusTest/ToFrontFocus.java JBR-3730 macosx-all
|
||||
java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java JBR-3730 macosx-all
|
||||
java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java JBR-3730 macosx-all
|
||||
java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java JBR-3730 macosx-all
|
||||
java/awt/Frame/MiscUndecorated/FrameCloseTest.java JBR-3733 macosx-all
|
||||
java/awt/Frame/ObscuredFrame/ObscuredFrameTest.java JBR-3730 macosx-all
|
||||
java/awt/GridLayout/ChangeGridSize/ChangeGridSize.java JBR-3730 macosx-all
|
||||
java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java JBR-3730 macosx-all
|
||||
java/awt/Insets/CombinedTestApp1.java JBR-3730 macosx-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java JBR-3730 macosx-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogTest/EnqueueWithDialogTest.java JBR-3730 macosx-all
|
||||
java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java JBR-3730 macosx-all
|
||||
java/awt/Mixing/MixingOnDialog.java JBR-3730 macosx-all
|
||||
java/awt/Mixing/MixingOnShrinkingHWButton.java JBR-3730 macosx-all
|
||||
java/awt/MouseAdapter/MouseAdapterUnitTest/MouseAdapterUnitTest.java JBR-3730 macosx-all
|
||||
java/awt/Paint/ButtonRepaint.java JBR-3730 macosx-all
|
||||
java/awt/print/PaintSetEnabledDeadlock/PaintSetEnabledDeadlock.java JBR-3730 macosx-all
|
||||
java/awt/Toolkit/RealSync/Test.java JBR-3730 macosx-all
|
||||
java/awt/TrayIcon/ActionEventMask/ActionEventMask.java JBR-3730 macosx-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/TranslucentChoice.java JBR-3730 macosx-all
|
||||
java/awt/Window/ShapedAndTranslucentWindows/TranslucentWindowClick.java JBR-3730 macosx-all
|
||||
java/awt/Window/setLocRelativeTo/SetLocationRelativeToTest.java JBR-3730 macosx-all
|
||||
javax/swing/ProgressMonitor/ProgressMonitorEscapeKeyPress.java JBR-3730 macosx-all
|
||||
|
||||
sanity/client/SwingSet/src/TreeDemoTest.java JBR-3389 macosx-all
|
||||
|
||||
Reference in New Issue
Block a user