mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8232050: Improve inlining of Klass accessors
Reviewed-by: lfoltan, tschatzl, coleenp, dholmes, jiangli
This commit is contained in:
parent
9751b5669a
commit
88d28a2bf9
14 changed files with 32 additions and 23 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "interpreter/bytecode.hpp"
|
#include "interpreter/bytecode.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "oops/constMethod.hpp"
|
#include "oops/constMethod.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "oops/method.hpp"
|
#include "oops/method.hpp"
|
||||||
#include "prims/methodHandles.hpp"
|
#include "prims/methodHandles.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "oops/constMethod.hpp"
|
#include "oops/constMethod.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "oops/method.hpp"
|
#include "oops/method.hpp"
|
||||||
#include "runtime/frame.inline.hpp"
|
#include "runtime/frame.inline.hpp"
|
||||||
#include "utilities/debug.hpp"
|
#include "utilities/debug.hpp"
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "oops/constMethod.hpp"
|
#include "oops/constMethod.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "oops/method.hpp"
|
#include "oops/method.hpp"
|
||||||
#include "runtime/frame.inline.hpp"
|
#include "runtime/frame.inline.hpp"
|
||||||
#include "utilities/debug.hpp"
|
#include "utilities/debug.hpp"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
#include "oops/constMethod.hpp"
|
#include "oops/constMethod.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "oops/method.hpp"
|
#include "oops/method.hpp"
|
||||||
#include "runtime/arguments.hpp"
|
#include "runtime/arguments.hpp"
|
||||||
#include "runtime/frame.inline.hpp"
|
#include "runtime/frame.inline.hpp"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "ci/ciMethod.hpp"
|
#include "ci/ciMethod.hpp"
|
||||||
#include "interpreter/interpreter.hpp"
|
#include "interpreter/interpreter.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "runtime/frame.inline.hpp"
|
#include "runtime/frame.inline.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
#include "memory/universe.hpp"
|
#include "memory/universe.hpp"
|
||||||
#include "oops/compressedOops.hpp"
|
#include "oops/compressedOops.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "oops/method.inline.hpp"
|
#include "oops/method.inline.hpp"
|
||||||
#include "runtime/deoptimization.hpp"
|
#include "runtime/deoptimization.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "compiler/compilerOracle.hpp"
|
#include "compiler/compilerOracle.hpp"
|
||||||
#include "gc/shared/cardTableBarrierSet.hpp"
|
#include "gc/shared/cardTableBarrierSet.hpp"
|
||||||
#include "gc/shared/collectedHeap.hpp"
|
#include "gc/shared/collectedHeap.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "oops/method.inline.hpp"
|
#include "oops/method.inline.hpp"
|
||||||
#include "runtime/frame.inline.hpp"
|
#include "runtime/frame.inline.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "ci/ciUtilities.hpp"
|
#include "ci/ciUtilities.hpp"
|
||||||
#include "gc/shared/barrierSet.hpp"
|
#include "gc/shared/barrierSet.hpp"
|
||||||
#include "gc/shared/c1/barrierSetC1.hpp"
|
#include "gc/shared/c1/barrierSetC1.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "runtime/arguments.hpp"
|
#include "runtime/arguments.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
#include "runtime/stubRoutines.hpp"
|
#include "runtime/stubRoutines.hpp"
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "classfile/verificationType.hpp"
|
#include "classfile/verificationType.hpp"
|
||||||
#include "classfile/verifier.hpp"
|
#include "classfile/verifier.hpp"
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
|
|
||||||
VerificationType VerificationType::from_tag(u1 tag) {
|
VerificationType VerificationType::from_tag(u1 tag) {
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "jvmci/vmStructs_jvmci.hpp"
|
#include "jvmci/vmStructs_jvmci.hpp"
|
||||||
#include "memory/universe.hpp"
|
#include "memory/universe.hpp"
|
||||||
#include "oops/compressedOops.hpp"
|
#include "oops/compressedOops.hpp"
|
||||||
|
#include "oops/klass.inline.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
#include "utilities/resourceHash.hpp"
|
#include "utilities/resourceHash.hpp"
|
||||||
|
|
||||||
|
|
|
@ -992,7 +992,6 @@ public:
|
||||||
void process_interfaces(Thread *thread);
|
void process_interfaces(Thread *thread);
|
||||||
|
|
||||||
// virtual operations from Klass
|
// virtual operations from Klass
|
||||||
bool is_leaf_class() const { return _subklass == NULL; }
|
|
||||||
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
|
GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
|
||||||
Array<InstanceKlass*>* transitive_interfaces);
|
Array<InstanceKlass*>* transitive_interfaces);
|
||||||
bool can_be_primary_super_slow() const;
|
bool can_be_primary_super_slow() const;
|
||||||
|
|
|
@ -57,10 +57,6 @@ void Klass::set_java_mirror(Handle m) {
|
||||||
_java_mirror = class_loader_data()->add_handle(m);
|
_java_mirror = class_loader_data()->add_handle(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
oop Klass::java_mirror() const {
|
|
||||||
return _java_mirror.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
oop Klass::java_mirror_no_keepalive() const {
|
oop Klass::java_mirror_no_keepalive() const {
|
||||||
return _java_mirror.peek();
|
return _java_mirror.peek();
|
||||||
}
|
}
|
||||||
|
@ -681,8 +677,6 @@ void Klass::check_array_allocation_length(int length, int max_length, TRAPS) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
|
|
||||||
|
|
||||||
// In product mode, this function doesn't have virtual function calls so
|
// In product mode, this function doesn't have virtual function calls so
|
||||||
// there might be some performance advantage to handling InstanceKlass here.
|
// there might be some performance advantage to handling InstanceKlass here.
|
||||||
const char* Klass::external_name() const {
|
const char* Klass::external_name() const {
|
||||||
|
@ -826,14 +820,6 @@ bool Klass::is_valid(Klass* k) {
|
||||||
return ClassLoaderDataGraph::is_valid(k->class_loader_data());
|
return ClassLoaderDataGraph::is_valid(k->class_loader_data());
|
||||||
}
|
}
|
||||||
|
|
||||||
klassVtable Klass::vtable() const {
|
|
||||||
return klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size());
|
|
||||||
}
|
|
||||||
|
|
||||||
vtableEntry* Klass::start_of_vtable() const {
|
|
||||||
return (vtableEntry*) ((address)this + in_bytes(vtable_start_offset()));
|
|
||||||
}
|
|
||||||
|
|
||||||
Method* Klass::method_at_vtable(int index) {
|
Method* Klass::method_at_vtable(int index) {
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
assert(index >= 0, "valid vtable index");
|
assert(index >= 0, "valid vtable index");
|
||||||
|
@ -844,9 +830,6 @@ Method* Klass::method_at_vtable(int index) {
|
||||||
return start_of_vtable()[index].method();
|
return start_of_vtable()[index].method();
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteSize Klass::vtable_start_offset() {
|
|
||||||
return in_ByteSize(InstanceKlass::header_size() * wordSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
|
|
||||||
|
|
|
@ -469,8 +469,6 @@ protected:
|
||||||
virtual bool should_be_initialized() const { return false; }
|
virtual bool should_be_initialized() const { return false; }
|
||||||
// initializes the klass
|
// initializes the klass
|
||||||
virtual void initialize(TRAPS);
|
virtual void initialize(TRAPS);
|
||||||
// lookup operation for MethodLookupCache
|
|
||||||
friend class MethodLookupCache;
|
|
||||||
virtual Klass* find_field(Symbol* name, Symbol* signature, fieldDescriptor* fd) const;
|
virtual Klass* find_field(Symbol* name, Symbol* signature, fieldDescriptor* fd) const;
|
||||||
virtual Method* uncached_lookup_method(const Symbol* name, const Symbol* signature,
|
virtual Method* uncached_lookup_method(const Symbol* name, const Symbol* signature,
|
||||||
OverpassLookupMode overpass_mode,
|
OverpassLookupMode overpass_mode,
|
||||||
|
@ -536,9 +534,6 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
|
||||||
// subclass accessor (here for convenience; undefined for non-klass objects)
|
|
||||||
virtual bool is_leaf_class() const { fatal("not a class"); return false; }
|
|
||||||
public:
|
public:
|
||||||
// ALL FUNCTIONS BELOW THIS POINT ARE DISPATCHED FROM AN OOP
|
// ALL FUNCTIONS BELOW THIS POINT ARE DISPATCHED FROM AN OOP
|
||||||
// These functions describe behavior for the oop not the KLASS.
|
// These functions describe behavior for the oop not the KLASS.
|
||||||
|
|
|
@ -25,13 +25,35 @@
|
||||||
#ifndef SHARE_OOPS_KLASS_INLINE_HPP
|
#ifndef SHARE_OOPS_KLASS_INLINE_HPP
|
||||||
#define SHARE_OOPS_KLASS_INLINE_HPP
|
#define SHARE_OOPS_KLASS_INLINE_HPP
|
||||||
|
|
||||||
|
#include "classfile/classLoaderData.inline.hpp"
|
||||||
#include "oops/compressedOops.hpp"
|
#include "oops/compressedOops.hpp"
|
||||||
#include "oops/klass.hpp"
|
#include "oops/klass.hpp"
|
||||||
#include "oops/markWord.hpp"
|
#include "oops/markWord.hpp"
|
||||||
|
#include "oops/oopHandle.inline.hpp"
|
||||||
|
|
||||||
inline void Klass::set_prototype_header(markWord header) {
|
inline void Klass::set_prototype_header(markWord header) {
|
||||||
assert(!header.has_bias_pattern() || is_instance_klass(), "biased locking currently only supported for Java instances");
|
assert(!header.has_bias_pattern() || is_instance_klass(), "biased locking currently only supported for Java instances");
|
||||||
_prototype_header = header;
|
_prototype_header = header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline oop Klass::java_mirror() const {
|
||||||
|
return _java_mirror.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline klassVtable Klass::vtable() const {
|
||||||
|
return klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline oop Klass::class_loader() const {
|
||||||
|
return class_loader_data()->class_loader();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline vtableEntry* Klass::start_of_vtable() const {
|
||||||
|
return (vtableEntry*) ((address)this + in_bytes(vtable_start_offset()));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ByteSize Klass::vtable_start_offset() {
|
||||||
|
return in_ByteSize(InstanceKlass::header_size() * wordSize);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // SHARE_OOPS_KLASS_INLINE_HPP
|
#endif // SHARE_OOPS_KLASS_INLINE_HPP
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue