8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool

8151546: nsk/jvmti/RedefineClasses/StressRedefine fails in hs nightly

ConstantPool::resolve_constant_at_impl() isn't thread safe for MethodHandleInError and MethodTypeInError and Constant pool merging is not thread safe for source_file_name.

Reviewed-by: sspitsyn, dcubed
This commit is contained in:
Coleen Phillimore 2016-04-13 12:57:31 -04:00
parent b5a7ed16dd
commit 8e63a10779
4 changed files with 40 additions and 57 deletions

View file

@ -222,20 +222,17 @@ inline int Backtrace::get_line_number(const methodHandle& method, int bci) {
return line_number;
}
/*
* Returns the source file name of a given InstanceKlass and version
*/
inline Symbol* Backtrace::get_source_file_name(InstanceKlass* holder, int version) {
// Find the specific ik version that contains this source_file_name_index
// via the previous versions list, but use the current version's
// constant pool to look it up. The previous version's index has been
// merged for the current constant pool.
InstanceKlass* ik = holder->get_klass_version(version);
// This version has been cleaned up.
if (ik == NULL) return NULL;
int source_file_name_index = ik->source_file_name_index();
return (source_file_name_index == 0) ?
(Symbol*)NULL : holder->constants()->symbol_at(source_file_name_index);
// RedefineClasses() currently permits redefine operations to
// happen in parallel using a "last one wins" philosophy. That
// spec laxness allows the constant pool entry associated with
// the source_file_name_index for any older constant pool version
// to be unstable so we shouldn't try to use it.
if (holder->constants()->version() != version) {
return NULL;
} else {
return holder->source_file_name();
}
}
#endif // SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP