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: goetz
Backport-of: a907b2b144f2af27392eb7c2f9656fbb1a759618
  • Loading branch information
zhengyu123 committed Dec 22, 2021
1 parent c9ebb93 commit 93234a48abc18ea1f3a9e092cf2f81105adbafd7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
@@ -254,8 +254,7 @@ class InstanceKlass: public Klass {
_misc_is_shared_platform_class = 1 << 11, // defining class loader is platform class loader
_misc_is_shared_app_class = 1 << 12, // defining class loader is app class loader
_misc_has_resolved_methods = 1 << 13, // resolved methods table entries added for this class
_misc_is_being_redefined = 1 << 14, // used for locking redefinition
_misc_has_contended_annotations = 1 << 15 // has @Contended annotation
_misc_has_contended_annotations = 1 << 14 // has @Contended annotation
};
u2 shared_loader_type_bits() const {
return _misc_is_shared_boot_class|_misc_is_shared_platform_class|_misc_is_shared_app_class;
@@ -738,14 +737,16 @@ class InstanceKlass: public Klass {

#if INCLUDE_JVMTI
// Redefinition locking. Class can only be redefined by one thread at a time.
// 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 ((_misc_flags & _misc_is_being_redefined) != 0);
return _access_flags.is_being_redefined();
}
void set_is_being_redefined(bool value) {
if (value) {
_misc_flags |= _misc_is_being_redefined;
_access_flags.set_is_being_redefined();
} else {
_misc_flags &= ~_misc_is_being_redefined;
_access_flags.clear_is_being_redefined();
}
}

@@ -69,6 +69,7 @@ enum {
JVM_ACC_IS_SHARED_CLASS = 0x02000000, // True if klass is shared
JVM_ACC_IS_HIDDEN_CLASS = 0x04000000, // True if klass is hidden
JVM_ACC_IS_VALUE_BASED_CLASS = 0x08000000, // True if klass is marked as a ValueBased class
JVM_ACC_IS_BEING_REDEFINED = 0x00100000, // True if the klass is being redefined.

// Klass* and Method* flags
JVM_ACC_HAS_LOCAL_VARIABLE_TABLE= 0x00200000,
@@ -159,6 +160,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 93234a4

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 93234a4 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.