8232050: Improve inlining of Klass accessors
authorredestad
Thu, 10 Oct 2019 13:26:22 +0200
changeset 58537 30a9612a657d
parent 58536 1b76d17440a0
child 58539 327232be010c
child 58541 8bc609fcd691
8232050: Improve inlining of Klass accessors Reviewed-by: lfoltan, tschatzl, coleenp, dholmes, jiangli
src/hotspot/cpu/arm/abstractInterpreter_arm.cpp
src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp
src/hotspot/cpu/s390/abstractInterpreter_s390.cpp
src/hotspot/cpu/sparc/abstractInterpreter_sparc.cpp
src/hotspot/cpu/x86/abstractInterpreter_x86.cpp
src/hotspot/share/aot/aotCodeHeap.cpp
src/hotspot/share/aot/aotCompiledMethod.cpp
src/hotspot/share/c1/c1_LIRGenerator.cpp
src/hotspot/share/classfile/verificationType.cpp
src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp
src/hotspot/share/oops/instanceKlass.hpp
src/hotspot/share/oops/klass.cpp
src/hotspot/share/oops/klass.hpp
src/hotspot/share/oops/klass.inline.hpp
--- a/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -27,6 +27,7 @@
 #include "interpreter/bytecode.hpp"
 #include "interpreter/interpreter.hpp"
 #include "oops/constMethod.hpp"
+#include "oops/klass.inline.hpp"
 #include "oops/method.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/handles.inline.hpp"
--- a/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -26,6 +26,7 @@
 #include "precompiled.hpp"
 #include "interpreter/interpreter.hpp"
 #include "oops/constMethod.hpp"
+#include "oops/klass.inline.hpp"
 #include "oops/method.hpp"
 #include "runtime/frame.inline.hpp"
 #include "utilities/debug.hpp"
--- a/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -26,6 +26,7 @@
 #include "precompiled.hpp"
 #include "interpreter/interpreter.hpp"
 #include "oops/constMethod.hpp"
+#include "oops/klass.inline.hpp"
 #include "oops/method.hpp"
 #include "runtime/frame.inline.hpp"
 #include "utilities/debug.hpp"
--- a/src/hotspot/cpu/sparc/abstractInterpreter_sparc.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/cpu/sparc/abstractInterpreter_sparc.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "interpreter/interpreter.hpp"
 #include "oops/constMethod.hpp"
+#include "oops/klass.inline.hpp"
 #include "oops/method.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/frame.inline.hpp"
--- a/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "ci/ciMethod.hpp"
 #include "interpreter/interpreter.hpp"
+#include "oops/klass.inline.hpp"
 #include "runtime/frame.inline.hpp"
 
 
--- a/src/hotspot/share/aot/aotCodeHeap.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -37,6 +37,7 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/universe.hpp"
 #include "oops/compressedOops.hpp"
+#include "oops/klass.inline.hpp"
 #include "oops/method.inline.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/handles.inline.hpp"
--- a/src/hotspot/share/aot/aotCompiledMethod.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/aot/aotCompiledMethod.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -32,6 +32,7 @@
 #include "compiler/compilerOracle.hpp"
 #include "gc/shared/cardTableBarrierSet.hpp"
 #include "gc/shared/collectedHeap.hpp"
+#include "oops/klass.inline.hpp"
 #include "oops/method.inline.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
--- a/src/hotspot/share/c1/c1_LIRGenerator.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -36,6 +36,7 @@
 #include "ci/ciUtilities.hpp"
 #include "gc/shared/barrierSet.hpp"
 #include "gc/shared/c1/barrierSetC1.hpp"
+#include "oops/klass.inline.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
--- a/src/hotspot/share/classfile/verificationType.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/classfile/verificationType.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -28,6 +28,7 @@
 #include "classfile/verificationType.hpp"
 #include "classfile/verifier.hpp"
 #include "logging/log.hpp"
+#include "oops/klass.inline.hpp"
 #include "runtime/handles.inline.hpp"
 
 VerificationType VerificationType::from_tag(u1 tag) {
--- a/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -31,6 +31,7 @@
 #include "jvmci/vmStructs_jvmci.hpp"
 #include "memory/universe.hpp"
 #include "oops/compressedOops.hpp"
+#include "oops/klass.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "utilities/resourceHash.hpp"
 
--- a/src/hotspot/share/oops/instanceKlass.hpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/oops/instanceKlass.hpp	Thu Oct 10 13:26:22 2019 +0200
@@ -992,7 +992,6 @@
   void process_interfaces(Thread *thread);
 
   // virtual operations from Klass
-  bool is_leaf_class() const               { return _subklass == NULL; }
   GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots,
                                                   Array<InstanceKlass*>* transitive_interfaces);
   bool can_be_primary_super_slow() const;
--- a/src/hotspot/share/oops/klass.cpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/oops/klass.cpp	Thu Oct 10 13:26:22 2019 +0200
@@ -57,10 +57,6 @@
   _java_mirror = class_loader_data()->add_handle(m);
 }
 
-oop Klass::java_mirror() const {
-  return _java_mirror.resolve();
-}
-
 oop Klass::java_mirror_no_keepalive() const {
   return _java_mirror.peek();
 }
@@ -681,8 +677,6 @@
   }
 }
 
-oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
-
 // In product mode, this function doesn't have virtual function calls so
 // there might be some performance advantage to handling InstanceKlass here.
 const char* Klass::external_name() const {
@@ -826,14 +820,6 @@
   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)  {
 #ifndef PRODUCT
   assert(index >= 0, "valid vtable index");
@@ -844,9 +830,6 @@
   return start_of_vtable()[index].method();
 }
 
-ByteSize Klass::vtable_start_offset() {
-  return in_ByteSize(InstanceKlass::header_size() * wordSize);
-}
 
 #ifndef PRODUCT
 
--- a/src/hotspot/share/oops/klass.hpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/oops/klass.hpp	Thu Oct 10 13:26:22 2019 +0200
@@ -469,8 +469,6 @@
   virtual bool should_be_initialized() const    { return false; }
   // initializes the klass
   virtual void initialize(TRAPS);
-  // lookup operation for MethodLookupCache
-  friend class MethodLookupCache;
   virtual Klass* find_field(Symbol* name, Symbol* signature, fieldDescriptor* fd) const;
   virtual Method* uncached_lookup_method(const Symbol* name, const Symbol* signature,
                                          OverpassLookupMode overpass_mode,
@@ -537,9 +535,6 @@
   }
 
  public:
-  // subclass accessor (here for convenience; undefined for non-klass objects)
-  virtual bool is_leaf_class() const { fatal("not a class"); return false; }
- public:
   // ALL FUNCTIONS BELOW THIS POINT ARE DISPATCHED FROM AN OOP
   // These functions describe behavior for the oop not the KLASS.
 
--- a/src/hotspot/share/oops/klass.inline.hpp	Thu Oct 10 10:27:12 2019 +0200
+++ b/src/hotspot/share/oops/klass.inline.hpp	Thu Oct 10 13:26:22 2019 +0200
@@ -25,13 +25,35 @@
 #ifndef SHARE_OOPS_KLASS_INLINE_HPP
 #define SHARE_OOPS_KLASS_INLINE_HPP
 
+#include "classfile/classLoaderData.inline.hpp"
 #include "oops/compressedOops.hpp"
 #include "oops/klass.hpp"
 #include "oops/markWord.hpp"
+#include "oops/oopHandle.inline.hpp"
 
 inline void Klass::set_prototype_header(markWord header) {
   assert(!header.has_bias_pattern() || is_instance_klass(), "biased locking currently only supported for Java instances");
   _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