< prev index next > src/hotspot/share/oops/methodCounters.hpp
Print this page
#include "oops/metadata.hpp"
#include "compiler/compilerDefinitions.hpp"
#include "interpreter/invocationCounter.hpp"
#include "utilities/align.hpp"
- class MethodCounters : public MetaspaceObj {
+ class MethodTrainingData;
+
+ class MethodCounters : public Metadata {
friend class VMStructs;
friend class JVMCIVMStructs;
+
+ // Used by CDS. These classes need to access the private default constructor.
+ template <class T> friend class CppVtableTesterA;
+ template <class T> friend class CppVtableTesterB;
+ template <class T> friend class CppVtableCloner;
+
private:
- InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations
- InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequency-based optimizations
- jlong _prev_time; // Previous time the rate was acquired
- float _rate; // Events (invocation and backedge counter increments) per millisecond
- int _invoke_mask; // per-method Tier0InvokeNotifyFreqLog
- int _backedge_mask; // per-method Tier0BackedgeNotifyFreqLog
- int _prev_event_count; // Total number of events saved at previous callback
+ InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations
+ InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequency-based optimizations
+
+ // Back pointer to the Method*
+ Method* _method;
+
+ MethodTrainingData* _method_training_data;
+ jlong _prev_time; // Previous time the rate was acquired
+ float _rate; // Events (invocation and backedge counter increments) per millisecond
+ int _invoke_mask; // per-method Tier0InvokeNotifyFreqLog
+ int _backedge_mask; // per-method Tier0BackedgeNotifyFreqLog
+ int _prev_event_count; // Total number of events saved at previous callback
#if COMPILER2_OR_JVMCI
- u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
+ u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
#endif
#if INCLUDE_JVMTI
- u2 _number_of_breakpoints; // fullspeed debugging support
+ u2 _number_of_breakpoints; // fullspeed debugging support
#endif
- u1 _highest_comp_level; // Highest compile level this method has ever seen.
- u1 _highest_osr_comp_level; // Same for OSR level
+ u1 _highest_comp_level; // Highest compile level this method has ever seen.
+ u1 _highest_osr_comp_level; // Same for OSR level
+ bool _training_data_lookup_failed;
MethodCounters(const methodHandle& mh);
+ MethodCounters();
+
public:
+ virtual bool is_methodCounters() const { return true; }
+ Method* method() const { return _method; }
static MethodCounters* allocate_no_exception(const methodHandle& mh);
static MethodCounters* allocate_with_exception(const methodHandle& mh, TRAPS);
- DEBUG_ONLY(bool on_stack() { return false; })
void deallocate_contents(ClassLoaderData* loader_data) {}
- void metaspace_pointers_do(MetaspaceClosure* it) { return; }
-
- static int size() {
+ static int method_counters_size() {
return align_up((int)sizeof(MethodCounters), wordSize) / wordSize;
}
+ virtual int size() const {
+ return method_counters_size();
+ }
MetaspaceObj::Type type() const { return MethodCountersType; }
+ void metaspace_pointers_do(MetaspaceClosure* iter);
+
void clear_counters();
#if COMPILER2_OR_JVMCI
void interpreter_throwout_increment() {
if (_interpreter_throwout_count < 65534) {
int highest_comp_level() const { return _highest_comp_level; }
void set_highest_comp_level(int level) { _highest_comp_level = (u1)level; }
int highest_osr_comp_level() const { return _highest_osr_comp_level; }
void set_highest_osr_comp_level(int level) { _highest_osr_comp_level = (u1)level; }
+ bool has_training_data_lookup_failed() const { return _training_data_lookup_failed; }
+ void set_training_data_lookup_failed() { _training_data_lookup_failed = true; }
+
// invocation counter
InvocationCounter* invocation_counter() { return &_invocation_counter; }
InvocationCounter* backedge_counter() { return &_backedge_counter; }
static ByteSize backedge_mask_offset() {
return byte_offset_of(MethodCounters, _backedge_mask);
}
- const char* internal_name() const { return "{method counters}"; }
+ virtual const char* internal_name() const { return "{method counters}"; }
+
+ MethodTrainingData* method_training_data() const { return _method_training_data; }
+ bool init_method_training_data(MethodTrainingData* tdata) {
+ return (_method_training_data == tdata ||
+ Atomic::replace_if_null(&_method_training_data, tdata));
+ }
+
+ #if INCLUDE_CDS
+ void remove_unshareable_info();
+ void restore_unshareable_info(TRAPS);
+ #endif
+
+ // Printing
+ void print_on (outputStream* st) const;
void print_value_on(outputStream* st) const;
+ void print_data_on(outputStream* st) const;
};
#endif // SHARE_OOPS_METHODCOUNTERS_HPP
< prev index next >