Skip to content

Commit

Permalink
[Backport]: 8257919: [JVMCI] profiling info didn't change after
Browse files Browse the repository at this point in the history
Summary: 8257919: [JVMCI] profiling info didn't change after reprofile
Reviewers: kuaiwei, wenjie
Testings: jtreg
Issue: https://bugs.openjdk.org/browse/JDK-8257919,
 #903
  • Loading branch information
ziyilin committed Dec 24, 2024
1 parent 6c13dc0 commit d1fc896
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 2 additions & 0 deletions src/hotspot/share/ci/ciMethodData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ ciMethodData::ciMethodData(MethodData* md)
_saw_free_extra_data(false),
// Initialize the escape information (to "don't know.");
_eflags(0), _arg_local(0), _arg_stack(0), _arg_returned(0),
_creation_mileage(0),
_current_mileage(0),
_invocation_counter(0),
_backedge_counter(0),
Expand Down Expand Up @@ -242,6 +243,7 @@ bool ciMethodData::load_data() {
load_remaining_extra_data();

// Note: Extra data are all BitData, and do not need translation.
_creation_mileage = mdo->creation_mileage();
_current_mileage = MethodData::mileage_of(mdo->method());
_invocation_counter = mdo->invocation_count();
_backedge_counter = mdo->backedge_count();
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/ci/ciMethodData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ class ciMethodData : public ciMetadata {
intx _arg_stack; // bit set of stack-allocatable arguments
intx _arg_returned; // bit set of returned arguments

int _creation_mileage; // method mileage at MDO creation

// Maturity of the oop when the snapshot is taken.
int _current_mileage;

Expand Down Expand Up @@ -488,7 +490,7 @@ class ciMethodData : public ciMetadata {
bool is_empty() { return _state == empty_state; }
bool is_mature() { return _state == mature_state; }

int creation_mileage() { return _orig.creation_mileage(); }
int creation_mileage() { return _creation_mileage; }
int current_mileage() { return _current_mileage; }

int invocation_count() { return _invocation_counter; }
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/oops/methodData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ void MethodData::post_initialize(BytecodeStream* stream) {
MethodData::MethodData(const methodHandle& method)
: _method(method()),
_extra_data_lock(Mutex::leaf, "MDO extra data lock"),
_compiler_counters(method()),
_compiler_counters(),
_parameters_type_data_di(parameters_uninitialized) {
initialize();
}
Expand All @@ -1145,6 +1145,7 @@ void MethodData::initialize() {
ResourceMark rm;

init();
set_creation_mileage(mileage_of(method()));

// Go through the bytecodes and allocate and initialize the
// corresponding data cells.
Expand Down Expand Up @@ -1211,6 +1212,7 @@ void MethodData::initialize() {
}

void MethodData::init() {
_compiler_counters = CompilerCounters(); // reset compiler counters
_invocation_counter.init();
_backedge_counter.init();
_invocation_counter_start = 0;
Expand Down
14 changes: 4 additions & 10 deletions src/hotspot/share/oops/methodData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1994,7 +1994,6 @@ class MethodData : public Metadata {
friend class VMStructs;
friend class JVMCIVMStructs;

int _creation_mileage; // method mileage at MDO creation
uint _nof_decompiles; // count of all nmethod removals
uint _nof_overflow_recompiles; // recompile count, excluding recomp. bits
uint _nof_overflow_traps; // trap count, excluding _trap_hist
Expand All @@ -2010,16 +2009,9 @@ class MethodData : public Metadata {
Copy::zero_to_words((HeapWord*) &_trap_hist, size_in_words);
}
public:
CompilerCounters(Method* m) : _creation_mileage(MethodData::mileage_of(m)),
_nof_decompiles(0), _nof_overflow_recompiles(0), _nof_overflow_traps(0) {
CompilerCounters() : _nof_decompiles(0), _nof_overflow_recompiles(0), _nof_overflow_traps(0) {
init_trap_hist();
}
CompilerCounters() : _creation_mileage(0), // for ciMethodData
_nof_decompiles(0), _nof_overflow_recompiles(0), _nof_overflow_traps(0) {
init_trap_hist();
}

int creation_mileage() const { return _creation_mileage; }

// Return (uint)-1 for overflow.
uint trap_count(int reason) const {
Expand Down Expand Up @@ -2070,6 +2062,7 @@ class MethodData : public Metadata {
intx _arg_local; // bit set of non-escaping arguments
intx _arg_stack; // bit set of stack-allocatable arguments
intx _arg_returned; // bit set of returned arguments
int _creation_mileage; // method mileage at MDO creation

// How many invocations has this MDO seen?
// These counters are used to determine the exact age of MDO.
Expand Down Expand Up @@ -2216,7 +2209,8 @@ class MethodData : public Metadata {
void collect_statistics(KlassSizeStats *sz) const;
#endif

int creation_mileage() const { return _compiler_counters.creation_mileage(); }
int creation_mileage() const { return _creation_mileage; }
void set_creation_mileage(int x) { _creation_mileage = x; }

int invocation_count() {
if (invocation_counter()->carry()) {
Expand Down

0 comments on commit d1fc896

Please sign in to comment.