JBR-7635 Skip rolled-back classes in search for affected classes

This commit is contained in:
Vladimir Dvorak
2024-09-17 20:51:34 +02:00
parent ce5bba5e43
commit 9957a98e79
3 changed files with 12 additions and 1 deletions

View File

@@ -307,7 +307,8 @@ Klass::Klass(KlassKind kind) : _kind(kind),
_redefinition_flags(Klass::NoRedefinition),
_is_redefining(false),
_update_information(nullptr),
_is_copying_backwards(false) {
_is_copying_backwards(false),
_is_rolled_back(false) {
CDS_ONLY(_shared_class_flags = 0;)
CDS_JAVA_HEAP_ONLY(_archived_mirror_index = -1;)
_primary_supers[0] = this;

View File

@@ -176,6 +176,7 @@ class Klass : public Metadata {
bool _is_redefining;
int* _update_information;
bool _is_copying_backwards; // Does the class need to copy fields backwards? => possibly overwrite itself?
bool _is_rolled_back; // true if class was rolled back in redefinition
private:
// This is an index into AOTClassLocationConfig::class_locations(), to
@@ -439,6 +440,8 @@ protected:
void set_update_information(int *info) { _update_information = info; }
bool is_copying_backwards() const { return _is_copying_backwards; }
void set_copying_backwards(bool b) { _is_copying_backwards = b; }
bool is_rolled_back() { return _is_rolled_back; }
void set_rolled_back(bool b) { _is_rolled_back = b;}
protected: // internal accessors
void set_subklass(Klass* s);

View File

@@ -954,6 +954,8 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions_single_step(TRAPS
log_info(redefine, class, load, exceptions)("link_class exception: '%s'", ex_name->as_C_string());
}
CLEAR_PENDING_EXCEPTION;
the_class->set_redefinition_flags(Klass::NoRedefinition);
if (ex_name == vmSymbols::java_lang_OutOfMemoryError()) {
return JVMTI_ERROR_OUT_OF_MEMORY;
} else if (ex_name == vmSymbols::java_lang_NoClassDefFoundError()) {
@@ -1615,6 +1617,7 @@ void VM_EnhancedRedefineClasses::rollback() {
new_class->set_redefining(false);
new_class->old_version()->set_new_version(nullptr);
new_class->set_old_version(nullptr);
new_class->set_rolled_back(true);
}
_new_classes->clear();
}
@@ -2243,6 +2246,10 @@ class AffectedKlassClosure : public KlassClosure {
return;
}
if (klass->is_rolled_back()) {
return;
}
if (klass->check_redefinition_flag(Klass::MarkedAsAffected)) {
_affected_klasses->append(klass);
return;