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

@ -1443,8 +1443,9 @@ jvmtiError VM_RedefineClasses::merge_cp_and_rewrite(
return JVMTI_ERROR_INTERNAL;
}
// Update the version number of the constant pool
// Update the version number of the constant pools (may keep scratch_cp)
merge_cp->increment_and_save_version(old_cp->version());
scratch_cp->increment_and_save_version(old_cp->version());
ResourceMark rm(THREAD);
_index_map_count = 0;
@ -3911,6 +3912,11 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass,
method->set_constants(scratch_class->constants());
}
// NOTE: this doesn't work because you can redefine the same class in two
// threads, each getting their own constant pool data appended to the
// original constant pool. In order for the new methods to work when they
// become old methods, they need to keep their updated copy of the constant pool.
{
// walk all previous versions of the klass
InstanceKlass *ik = (InstanceKlass *)the_class();