8358339: Handle MethodCounters::_method backlinks after JDK-8355003

Reviewed-by: coleenp, kvn, iveresov
This commit is contained in:
Aleksey Shipilev 2025-06-04 21:32:29 +00:00
parent 77c110c309
commit 3cf3e4bbec
3 changed files with 10 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include "compiler/disassembler.hpp" #include "compiler/disassembler.hpp"
#include "logging/log.hpp" #include "logging/log.hpp"
#include "oops/klass.inline.hpp" #include "oops/klass.inline.hpp"
#include "oops/methodCounters.hpp"
#include "oops/methodData.hpp" #include "oops/methodData.hpp"
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "runtime/icache.hpp" #include "runtime/icache.hpp"
@ -537,6 +538,9 @@ void CodeBuffer::finalize_oop_references(const methodHandle& mh) {
if (m->is_methodData()) { if (m->is_methodData()) {
m = ((MethodData*)m)->method(); m = ((MethodData*)m)->method();
} }
if (m->is_methodCounters()) {
m = ((MethodCounters*)m)->method();
}
if (m->is_method()) { if (m->is_method()) {
m = ((Method*)m)->method_holder(); m = ((Method*)m)->method_holder();
} }
@ -561,6 +565,9 @@ void CodeBuffer::finalize_oop_references(const methodHandle& mh) {
if (m->is_methodData()) { if (m->is_methodData()) {
m = ((MethodData*)m)->method(); m = ((MethodData*)m)->method();
} }
if (m->is_methodCounters()) {
m = ((MethodCounters*)m)->method();
}
if (m->is_method()) { if (m->is_method()) {
m = ((Method*)m)->method_holder(); m = ((Method*)m)->method_holder();
} }

View File

@ -788,6 +788,8 @@ class CheckClass : public MetadataClosure {
klass = ((Method*)md)->method_holder(); klass = ((Method*)md)->method_holder();
} else if (md->is_methodData()) { } else if (md->is_methodData()) {
klass = ((MethodData*)md)->method()->method_holder(); klass = ((MethodData*)md)->method()->method_holder();
} else if (md->is_methodCounters()) {
klass = ((MethodCounters*)md)->method()->method_holder();
} else { } else {
md->print(); md->print();
ShouldNotReachHere(); ShouldNotReachHere();

View File

@ -44,6 +44,7 @@ class Metadata : public MetaspaceObj {
virtual bool is_method() const { return false; } virtual bool is_method() const { return false; }
virtual bool is_methodData() const { return false; } virtual bool is_methodData() const { return false; }
virtual bool is_constantPool() const { return false; } virtual bool is_constantPool() const { return false; }
virtual bool is_methodCounters() const { return false; }
virtual int size() const = 0; virtual int size() const = 0;
virtual MetaspaceObj::Type type() const = 0; virtual MetaspaceObj::Type type() const = 0;
virtual const char* internal_name() const = 0; virtual const char* internal_name() const = 0;