8042796: jvmtiRedefineClasses.cpp: guarantee(false) failed: OLD and/or OBSOLETE method(s) found
Summary: Relax the guaranty for deleted methods
Reviewed-by: dcubed, coleenp
Contributed-by: serguei.spitsyn@oracle.com
--- a/hotspot/src/share/vm/oops/cpCache.cpp Thu May 15 20:16:14 2014 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.cpp Fri May 16 15:05:44 2014 -0700
@@ -498,9 +498,10 @@
// _f1 == NULL || !_f1->is_method() are OK here
return true;
}
- // return false if _f1 refers to an old or an obsolete method
+ // return false if _f1 refers to a non-deleted old or obsolete method
return (NOT_PRODUCT(_f1->is_valid() &&) _f1->is_method() &&
- !((Method*)_f1)->is_old() && !((Method*)_f1)->is_obsolete());
+ (f1_as_method()->is_deleted() ||
+ (!f1_as_method()->is_old() && !f1_as_method()->is_obsolete())));
}
bool ConstantPoolCacheEntry::is_interesting_method_entry(Klass* k) {
--- a/hotspot/src/share/vm/oops/method.hpp Thu May 15 20:16:14 2014 -0700
+++ b/hotspot/src/share/vm/oops/method.hpp Fri May 16 15:05:44 2014 -0700
@@ -669,6 +669,8 @@
void set_is_old() { _access_flags.set_is_old(); }
bool is_obsolete() const { return access_flags().is_obsolete(); }
void set_is_obsolete() { _access_flags.set_is_obsolete(); }
+ bool is_deleted() const { return access_flags().is_deleted(); }
+ void set_is_deleted() { _access_flags.set_is_deleted(); }
bool on_stack() const { return access_flags().on_stack(); }
void set_on_stack(const bool value);
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp Thu May 15 20:16:14 2014 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp Fri May 16 15:05:44 2014 -0700
@@ -2970,7 +2970,8 @@
assert(!old_method->has_vtable_index(),
"cannot delete methods with vtable entries");;
- // Mark all deleted methods as old and obsolete
+ // Mark all deleted methods as old, obsolete and deleted
+ old_method->set_is_deleted();
old_method->set_is_old();
old_method->set_is_obsolete();
++obsolete_count;
@@ -3576,7 +3577,7 @@
no_old_methods = false;
}
- // the constant pool cache should never contain old or obsolete methods
+ // the constant pool cache should never contain non-deleted old or obsolete methods
if (ik->constants() != NULL &&
ik->constants()->cache() != NULL &&
!ik->constants()->cache()->check_no_old_or_obsolete_entries()) {
--- a/hotspot/src/share/vm/utilities/accessFlags.hpp Thu May 15 20:16:14 2014 -0700
+++ b/hotspot/src/share/vm/utilities/accessFlags.hpp Fri May 16 15:05:44 2014 -0700
@@ -54,7 +54,8 @@
JVM_ACC_IS_OLD = 0x00010000, // RedefineClasses() has replaced this method
JVM_ACC_IS_OBSOLETE = 0x00020000, // RedefineClasses() has made method obsolete
JVM_ACC_IS_PREFIXED_NATIVE = 0x00040000, // JVMTI has prefixed this native method
- JVM_ACC_ON_STACK = 0x00080000, // RedefinedClasses() is used on the stack
+ JVM_ACC_ON_STACK = 0x00080000, // RedefineClasses() was used on the stack
+ JVM_ACC_IS_DELETED = 0x00008000, // RedefineClasses() has deleted this method
// Klass* flags
JVM_ACC_HAS_MIRANDA_METHODS = 0x10000000, // True if this class has miranda methods in it's vtable
@@ -131,6 +132,7 @@
bool has_jsrs () const { return (_flags & JVM_ACC_HAS_JSRS ) != 0; }
bool is_old () const { return (_flags & JVM_ACC_IS_OLD ) != 0; }
bool is_obsolete () const { return (_flags & JVM_ACC_IS_OBSOLETE ) != 0; }
+ bool is_deleted () const { return (_flags & JVM_ACC_IS_DELETED ) != 0; }
bool is_prefixed_native () const { return (_flags & JVM_ACC_IS_PREFIXED_NATIVE ) != 0; }
// Klass* flags
@@ -195,6 +197,7 @@
void set_has_jsrs() { atomic_set_bits(JVM_ACC_HAS_JSRS); }
void set_is_old() { atomic_set_bits(JVM_ACC_IS_OLD); }
void set_is_obsolete() { atomic_set_bits(JVM_ACC_IS_OBSOLETE); }
+ void set_is_deleted() { atomic_set_bits(JVM_ACC_IS_DELETED); }
void set_is_prefixed_native() { atomic_set_bits(JVM_ACC_IS_PREFIXED_NATIVE); }
void clear_not_c1_compilable() { atomic_clear_bits(JVM_ACC_NOT_C1_COMPILABLE); }