< prev index next > src/hotspot/share/oops/trainingData.hpp
Print this page
#include "compiler/compiler_globals.hpp"
#include "memory/allocation.hpp"
#include "memory/metaspaceClosure.hpp"
#include "oops/instanceKlass.hpp"
#include "oops/method.hpp"
+ #include "oops/objArrayKlass.hpp"
#include "runtime/handles.hpp"
#include "runtime/mutexLocker.hpp"
+ #include "utilities/count_leading_zeros.hpp"
#include "utilities/resizeableResourceHash.hpp"
class ciEnv;
class ciBaseObject;
class CompileTask;
static bool have_data() { return AOTReplayTraining; } // Going to read
static bool need_data() { return AOTRecordTraining; } // Going to write
static bool assembling_data() { return have_data() && CDSConfig::is_dumping_final_static_archive() && CDSConfig::is_dumping_aot_linked_classes(); }
+ static bool is_klass_loaded(Klass* k) {
+ if (have_data()) {
+ // If we're running in AOT mode some classes may not be loaded yet
+ if (k->is_objArray_klass()) {
+ k = ObjArrayKlass::cast(k)->bottom_klass();
+ }
+ if (k->is_instance_klass()) {
+ return InstanceKlass::cast(k)->is_loaded();
+ }
+ }
+ return true;
+ }
+
template<typename Function>
static void iterate(const Function& fn) { iterate(const_cast<Function&>(fn)); }
template<typename Function>
static void iterate(Function& fn) { // lambda enabled API
virtual void prepare(Visitor& visitor) = 0;
virtual void cleanup(Visitor& visitor) = 0;
static void initialize() NOT_CDS_RETURN;
- static void verify();
+ static void verify() NOT_CDS_RETURN;
// Widget for recording dependencies, as an N-to-M graph relation,
// possibly cyclic.
template<typename E>
class DepList : public StackObj {
template <class T> friend class CppVtableTesterB;
template <class T> friend class CppVtableCloner;
// 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
KlassTrainingData();
KlassTrainingData(InstanceKlass* klass);
}
void remove_comp_dep(CompileTrainingData* ctd) {
TrainingDataLocker::assert_locked();
_comp_deps.remove_if_existing(ctd);
}
-
public:
Symbol* name() const {
precond(has_holder());
return holder()->name();
}
}
static int level_mask(int level) {
return ((level & 0xF) != level ? 0 : 1 << level);
}
+ static CompLevel highest_level(int mask) {
+ if (mask == 0) return (CompLevel) 0;
+ int diff = (count_leading_zeros(level_mask(0)) - count_leading_zeros(mask));
+ return (CompLevel) diff;
+ }
public:
KlassTrainingData* klass() const { return _klass; }
bool has_holder() const { return _holder != nullptr; }
Method* holder() const { return _holder; }
bool only_inlined() const { return !_was_toplevel; }
bool saw_level(CompLevel l) const { return (_level_mask & level_mask(l)) != 0; }
+ int highest_level() const { return highest_level(_level_mask); }
int highest_top_level() const { return _highest_top_level; }
MethodData* final_profile() const { return _final_profile; }
Symbol* name() const {
precond(has_holder());
< prev index next >