Skip to content
Permalink
Browse files
8276177: nsk/jvmti/RedefineClasses/StressRedefineWithoutBytecodeCorru…
…ption failed with "assert(def_ik->is_being_redefined()) failed: should be being redefined to get here"

Reviewed-by: mdoerr
Backport-of: a907b2b144f2af27392eb7c2f9656fbb1a759618
  • Loading branch information
zhengyu123 committed Dec 22, 2021
1 parent cd8ea37 commit 2893731284e41262f022d2c311b3170436b21e23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
@@ -738,9 +738,18 @@ class InstanceKlass: public Klass {
}

#if INCLUDE_JVMTI
// Redefinition locking. Class can only be redefined by one thread at a time.
bool is_being_redefined() const { return _is_being_redefined; }
void set_is_being_redefined(bool value) { _is_being_redefined = value; }
// The flag is in access_flags so that it can be set and reset using atomic
// operations, and not be reset by other misc_flag settings.
bool is_being_redefined() const {
return _access_flags.is_being_redefined();
}
void set_is_being_redefined(bool value) {
if (value) {
_access_flags.set_is_being_redefined();
} else {
_access_flags.clear_is_being_redefined();
}
}

// RedefineClasses() support for previous versions:
void add_previous_version(InstanceKlass* ik, int emcp_method_count);
@@ -66,6 +66,7 @@ enum {
JVM_ACC_IS_CLONEABLE_FAST = (int)0x80000000,// True if klass implements the Cloneable interface and can be optimized in generated code
JVM_ACC_HAS_FINAL_METHOD = 0x01000000, // True if klass has final method
JVM_ACC_IS_SHARED_CLASS = 0x02000000, // True if klass is shared
JVM_ACC_IS_BEING_REDEFINED = 0x00100000, // True if the klass is being redefined.

// Klass* and Method* flags
JVM_ACC_HAS_LOCAL_VARIABLE_TABLE= 0x00200000,
@@ -155,6 +156,10 @@ class AccessFlags {
void set_has_localvariable_table() { atomic_set_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }
void clear_has_localvariable_table() { atomic_clear_bits(JVM_ACC_HAS_LOCAL_VARIABLE_TABLE); }

bool is_being_redefined() const { return (_flags & JVM_ACC_IS_BEING_REDEFINED) != 0; }
void set_is_being_redefined() { atomic_set_bits(JVM_ACC_IS_BEING_REDEFINED); }
void clear_is_being_redefined() { atomic_clear_bits(JVM_ACC_IS_BEING_REDEFINED); }

// field flags
bool is_field_access_watched() const { return (_flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; }
bool is_field_modification_watched() const

1 comment on commit 2893731

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 2893731 Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.