mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-21 07:45:11 +00:00
8358580: Rethink how classes are kept alive in training data
Reviewed-by: coleenp, shade
This commit is contained in:
parent
a86dd56de3
commit
59bec29c35
@ -35,6 +35,7 @@
|
||||
#include "memory/metadataFactory.hpp"
|
||||
#include "memory/metaspaceClosure.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "oops/method.hpp"
|
||||
#include "oops/methodCounters.hpp"
|
||||
#include "oops/trainingData.hpp"
|
||||
@ -433,9 +434,9 @@ void KlassTrainingData::print_on(outputStream* st, bool name_only) const {
|
||||
|
||||
KlassTrainingData::KlassTrainingData(InstanceKlass* klass) : TrainingData(klass) {
|
||||
assert(klass != nullptr, "");
|
||||
Handle hm(JavaThread::current(), klass->java_mirror());
|
||||
jobject hmj = JNIHandles::make_global(hm);
|
||||
_holder_mirror = hmj;
|
||||
// The OopHandle constructor will allocate a handle. We don't need to ever release it so we don't preserve
|
||||
// the handle object.
|
||||
OopHandle handle(Universe::vm_global(), klass->java_mirror());
|
||||
_holder = klass;
|
||||
assert(holder() == klass, "");
|
||||
}
|
||||
@ -759,7 +760,6 @@ void TrainingData::DepList<T>::prepare(ClassLoaderData* loader_data) {
|
||||
|
||||
void KlassTrainingData::remove_unshareable_info() {
|
||||
TrainingData::remove_unshareable_info();
|
||||
_holder_mirror = nullptr;
|
||||
_comp_deps.remove_unshareable_info();
|
||||
}
|
||||
|
||||
|
||||
@ -431,7 +431,6 @@ class KlassTrainingData : public TrainingData {
|
||||
|
||||
// cross-link to live klass, or null if not loaded or encountered yet
|
||||
InstanceKlass* _holder;
|
||||
jobject _holder_mirror; // extra link to prevent unloading by GC
|
||||
|
||||
DepList<CompileTrainingData*> _comp_deps; // compiles that depend on me
|
||||
|
||||
@ -454,7 +453,6 @@ class KlassTrainingData : public TrainingData {
|
||||
TrainingDataLocker::assert_locked();
|
||||
_comp_deps.remove_if_existing(ctd);
|
||||
}
|
||||
|
||||
public:
|
||||
Symbol* name() const {
|
||||
precond(has_holder());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user