8344445: MethodCounters don't need a vptr
Reviewed-by: kbarrett, dlong
This commit is contained in:
parent
dc940ec8af
commit
d4cd27e875
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -44,11 +44,10 @@ 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;
|
||||||
virtual void metaspace_pointers_do(MetaspaceClosure* iter) {}
|
virtual void metaspace_pointers_do(MetaspaceClosure* iter) = 0;
|
||||||
|
|
||||||
void print() const;
|
void print() const;
|
||||||
void print_value() const;
|
void print_value() const;
|
||||||
|
@ -50,12 +50,12 @@ MethodCounters::MethodCounters(const methodHandle& mh) :
|
|||||||
|
|
||||||
MethodCounters* MethodCounters::allocate_no_exception(const methodHandle& mh) {
|
MethodCounters* MethodCounters::allocate_no_exception(const methodHandle& mh) {
|
||||||
ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
|
ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
|
||||||
return new(loader_data, method_counters_size(), MetaspaceObj::MethodCountersType) MethodCounters(mh);
|
return new(loader_data, size(), MetaspaceObj::MethodCountersType) MethodCounters(mh);
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodCounters* MethodCounters::allocate_with_exception(const methodHandle& mh, TRAPS) {
|
MethodCounters* MethodCounters::allocate_with_exception(const methodHandle& mh, TRAPS) {
|
||||||
ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
|
ClassLoaderData* loader_data = mh->method_holder()->class_loader_data();
|
||||||
return new(loader_data, method_counters_size(), MetaspaceObj::MethodCountersType, THREAD) MethodCounters(mh);
|
return new(loader_data, size(), MetaspaceObj::MethodCountersType, THREAD) MethodCounters(mh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MethodCounters::clear_counters() {
|
void MethodCounters::clear_counters() {
|
||||||
@ -70,7 +70,6 @@ void MethodCounters::clear_counters() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MethodCounters::print_value_on(outputStream* st) const {
|
void MethodCounters::print_value_on(outputStream* st) const {
|
||||||
assert(is_methodCounters(), "must be methodCounters");
|
|
||||||
st->print("method counters");
|
st->print("method counters");
|
||||||
print_address_on(st);
|
print_address_on(st);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "interpreter/invocationCounter.hpp"
|
#include "interpreter/invocationCounter.hpp"
|
||||||
#include "utilities/align.hpp"
|
#include "utilities/align.hpp"
|
||||||
|
|
||||||
class MethodCounters : public Metadata {
|
class MethodCounters : public MetaspaceObj {
|
||||||
friend class VMStructs;
|
friend class VMStructs;
|
||||||
friend class JVMCIVMStructs;
|
friend class JVMCIVMStructs;
|
||||||
private:
|
private:
|
||||||
@ -52,19 +52,18 @@ class MethodCounters : public Metadata {
|
|||||||
|
|
||||||
MethodCounters(const methodHandle& mh);
|
MethodCounters(const methodHandle& mh);
|
||||||
public:
|
public:
|
||||||
virtual bool is_methodCounters() const { return true; }
|
|
||||||
|
|
||||||
static MethodCounters* allocate_no_exception(const methodHandle& mh);
|
static MethodCounters* allocate_no_exception(const methodHandle& mh);
|
||||||
static MethodCounters* allocate_with_exception(const methodHandle& mh, TRAPS);
|
static MethodCounters* allocate_with_exception(const methodHandle& mh, TRAPS);
|
||||||
|
|
||||||
|
DEBUG_ONLY(bool on_stack() { return false; })
|
||||||
void deallocate_contents(ClassLoaderData* loader_data) {}
|
void deallocate_contents(ClassLoaderData* loader_data) {}
|
||||||
|
|
||||||
static int method_counters_size() {
|
void metaspace_pointers_do(MetaspaceClosure* it) { return; }
|
||||||
|
|
||||||
|
static int size() {
|
||||||
return align_up((int)sizeof(MethodCounters), wordSize) / wordSize;
|
return align_up((int)sizeof(MethodCounters), wordSize) / wordSize;
|
||||||
}
|
}
|
||||||
virtual int size() const {
|
|
||||||
return method_counters_size();
|
|
||||||
}
|
|
||||||
MetaspaceObj::Type type() const { return MethodCountersType; }
|
MetaspaceObj::Type type() const { return MethodCountersType; }
|
||||||
void clear_counters();
|
void clear_counters();
|
||||||
|
|
||||||
@ -128,8 +127,7 @@ class MethodCounters : public Metadata {
|
|||||||
return byte_offset_of(MethodCounters, _backedge_mask);
|
return byte_offset_of(MethodCounters, _backedge_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const char* internal_name() const { return "{method counters}"; }
|
const char* internal_name() const { return "{method counters}"; }
|
||||||
virtual void print_value_on(outputStream* st) const;
|
void print_value_on(outputStream* st) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // SHARE_OOPS_METHODCOUNTERS_HPP
|
#endif // SHARE_OOPS_METHODCOUNTERS_HPP
|
||||||
|
Loading…
Reference in New Issue
Block a user