8076456: Remove unnecessary oopDesc::klass() calls
authorstefank
Thu, 02 Apr 2015 10:22:13 +0200
changeset 30151 c7cdaa576875
parent 30150 d9c940aa42ef
child 30152 5fe1c8494b49
8076456: Remove unnecessary oopDesc::klass() calls Reviewed-by: pliden, jmasa
hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp
hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp
hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp
hotspot/src/share/vm/oops/instanceKlass.inline.hpp
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp	Thu Apr 02 10:04:27 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.cpp	Thu Apr 02 10:22:13 2015 +0200
@@ -180,7 +180,7 @@
 void InstanceKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
   assert(obj != NULL, "can't follow the content of NULL object");
 
-  PSParallelCompact::follow_klass(cm, obj->klass());
+  PSParallelCompact::follow_klass(cm, this);
   // Only mark the header and let the scan of the meta-data mark
   // everything else.
 
@@ -301,9 +301,9 @@
   PSParallelCompact::follow_klass(cm, this);
 
   if (UseCompressedOops) {
-    oop_pc_follow_contents_specialized<narrowOop>(this, obj, 0, cm);
+    oop_pc_follow_contents_specialized<narrowOop>(objArrayOop(obj), 0, cm);
   } else {
-    oop_pc_follow_contents_specialized<oop>(this, obj, 0, cm);
+    oop_pc_follow_contents_specialized<oop>(objArrayOop(obj), 0, cm);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp	Thu Apr 02 10:04:27 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.inline.hpp	Thu Apr 02 10:22:13 2015 +0200
@@ -56,15 +56,14 @@
 }
 
 template <class T>
-inline void oop_pc_follow_contents_specialized(ObjArrayKlass* klass, oop obj, int index, ParCompactionManager* cm) {
-  objArrayOop a = objArrayOop(obj);
-  const size_t len = size_t(a->length());
+inline void oop_pc_follow_contents_specialized(objArrayOop obj, int index, ParCompactionManager* cm) {
+  const size_t len = size_t(obj->length());
   const size_t beg_index = size_t(index);
   assert(beg_index < len || len == 0, "index too large");
 
   const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
   const size_t end_index = beg_index + stride;
-  T* const base = (T*)a->base();
+  T* const base = (T*)obj->base();
   T* const beg = base + beg_index;
   T* const end = base + end_index;
 
@@ -74,15 +73,15 @@
   }
 
   if (end_index < len) {
-    cm->push_objarray(a, end_index); // Push the continuation.
+    cm->push_objarray(obj, end_index); // Push the continuation.
   }
 }
 
 inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) {
   if (UseCompressedOops) {
-    oop_pc_follow_contents_specialized<narrowOop>((ObjArrayKlass*)obj->klass(), obj, index, this);
+    oop_pc_follow_contents_specialized<narrowOop>(obj, index, this);
   } else {
-    oop_pc_follow_contents_specialized<oop>((ObjArrayKlass*)obj->klass(), obj, index, this);
+    oop_pc_follow_contents_specialized<oop>(obj, index, this);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Thu Apr 02 10:04:27 2015 +0200
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Thu Apr 02 10:22:13 2015 +0200
@@ -68,7 +68,7 @@
 
 void InstanceKlass::oop_ms_follow_contents(oop obj) {
   assert(obj != NULL, "can't follow the content of NULL object");
-  MarkSweep::follow_klass(obj->klass());
+  MarkSweep::follow_klass(this);
 
   oop_oop_iterate_oop_maps<true>(obj, &MarkSweep::mark_and_push_closure);
 }
--- a/hotspot/src/share/vm/oops/instanceKlass.inline.hpp	Thu Apr 02 10:04:27 2015 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.inline.hpp	Thu Apr 02 10:22:13 2015 +0200
@@ -152,7 +152,7 @@
 template <bool nv, class OopClosureType>
 INLINE int InstanceKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
   if (Devirtualizer<nv>::do_metadata(closure)) {
-    Devirtualizer<nv>::do_klass(closure, obj->klass());
+    Devirtualizer<nv>::do_klass(closure, this);
   }
 
   oop_oop_iterate_oop_maps<nv>(obj, closure);
@@ -176,7 +176,7 @@
 INLINE int InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
   if (Devirtualizer<nv>::do_metadata(closure)) {
     if (mr.contains(obj)) {
-      Devirtualizer<nv>::do_klass(closure, obj->klass());
+      Devirtualizer<nv>::do_klass(closure, this);
     }
   }