8358003: KlassTrainingData initializer reads garbage holder
Reviewed-by: coleenp, shade, vlivanov
This commit is contained in:
parent
0352477ff5
commit
ae1892fb0f
@ -432,24 +432,11 @@ void KlassTrainingData::print_on(outputStream* st, bool name_only) const {
|
||||
}
|
||||
|
||||
KlassTrainingData::KlassTrainingData(InstanceKlass* klass) : TrainingData(klass) {
|
||||
if (holder() == klass) {
|
||||
return; // no change to make
|
||||
}
|
||||
|
||||
jobject hmj = _holder_mirror;
|
||||
if (hmj != nullptr) { // clear out previous handle, if any
|
||||
_holder_mirror = nullptr;
|
||||
assert(JNIHandles::is_global_handle(hmj), "");
|
||||
JNIHandles::destroy_global(hmj);
|
||||
}
|
||||
|
||||
if (klass != nullptr) {
|
||||
assert(klass != nullptr, "");
|
||||
Handle hm(JavaThread::current(), klass->java_mirror());
|
||||
hmj = JNIHandles::make_global(hm);
|
||||
Atomic::release_store(&_holder_mirror, hmj);
|
||||
}
|
||||
|
||||
Atomic::release_store(&_holder, const_cast<InstanceKlass*>(klass));
|
||||
jobject hmj = JNIHandles::make_global(hm);
|
||||
_holder_mirror = hmj;
|
||||
_holder = klass;
|
||||
assert(holder() == klass, "");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user