Skip to content

Commit ae1892f

Browse files
author
Igor Veresov
committed
8358003: KlassTrainingData initializer reads garbage holder
Reviewed-by: coleenp, shade, vlivanov
1 parent 0352477 commit ae1892f

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

src/hotspot/share/oops/trainingData.cpp

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -432,24 +432,11 @@ void KlassTrainingData::print_on(outputStream* st, bool name_only) const {
432432
}
433433

434434
KlassTrainingData::KlassTrainingData(InstanceKlass* klass) : TrainingData(klass) {
435-
if (holder() == klass) {
436-
return; // no change to make
437-
}
438-
439-
jobject hmj = _holder_mirror;
440-
if (hmj != nullptr) { // clear out previous handle, if any
441-
_holder_mirror = nullptr;
442-
assert(JNIHandles::is_global_handle(hmj), "");
443-
JNIHandles::destroy_global(hmj);
444-
}
445-
446-
if (klass != nullptr) {
447-
Handle hm(JavaThread::current(), klass->java_mirror());
448-
hmj = JNIHandles::make_global(hm);
449-
Atomic::release_store(&_holder_mirror, hmj);
450-
}
451-
452-
Atomic::release_store(&_holder, const_cast<InstanceKlass*>(klass));
435+
assert(klass != nullptr, "");
436+
Handle hm(JavaThread::current(), klass->java_mirror());
437+
jobject hmj = JNIHandles::make_global(hm);
438+
_holder_mirror = hmj;
439+
_holder = klass;
453440
assert(holder() == klass, "");
454441
}
455442

0 commit comments

Comments
 (0)