< prev index next >

src/share/vm/gc_implementation/g1/g1OopClosures.hpp

Print this page
rev 7557 : 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
Summary: Evaluate and improve object copy time by micro-optimizations and splitting out slow and fast paths aggressively.
Reviewed-by:
Contributed-by: Tony Printezis <tprintezis@twitter.com>, Thomas Schatzl <thomas.schatzl@oracle.com>


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
  27 
  28 #include "memory/iterator.hpp"

  29 
  30 class HeapRegion;
  31 class G1CollectedHeap;
  32 class G1RemSet;
  33 class ConcurrentMark;
  34 class DirtyCardToOopClosure;
  35 class CMBitMap;
  36 class CMMarkStack;
  37 class G1ParScanThreadState;
  38 class CMTask;
  39 class ReferenceProcessor;
  40 
  41 // A class that scans oops in a given heap region (much as OopsInGenClosure
  42 // scans oops in a generation.)
  43 class OopsInHeapRegionClosure: public ExtendedOopClosure {
  44 protected:
  45   HeapRegion* _from;
  46 public:
  47   void set_region(HeapRegion* from) { _from = from; }
  48 };


 239   G1CollectedHeap* _g1;
 240   G1RemSet* _g1_rem_set;
 241   HeapRegion* _from;
 242   OopsInHeapRegionClosure* _push_ref_cl;
 243   bool _record_refs_into_cset;
 244   uint _worker_i;
 245 
 246 public:
 247   G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
 248                                 G1RemSet* rs,
 249                                 OopsInHeapRegionClosure* push_ref_cl,
 250                                 bool record_refs_into_cset,
 251                                 uint worker_i = 0);
 252 
 253   void set_from(HeapRegion* from) {
 254     assert(from != NULL, "from region must be non-NULL");
 255     _from = from;
 256   }
 257 
 258   bool self_forwarded(oop obj) {
 259     bool result = (obj->is_forwarded() && (obj->forwardee()== obj));

 260     return result;
 261   }
 262 
 263   bool apply_to_weak_ref_discovered_field() { return true; }
 264 
 265   template <class T> void do_oop_nv(T* p);
 266   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
 267   virtual void do_oop(oop* p)       { do_oop_nv(p); }
 268 };
 269 
 270 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
  27 
  28 #include "memory/iterator.hpp"
  29 #include "oops/markOop.hpp"
  30 
  31 class HeapRegion;
  32 class G1CollectedHeap;
  33 class G1RemSet;
  34 class ConcurrentMark;
  35 class DirtyCardToOopClosure;
  36 class CMBitMap;
  37 class CMMarkStack;
  38 class G1ParScanThreadState;
  39 class CMTask;
  40 class ReferenceProcessor;
  41 
  42 // A class that scans oops in a given heap region (much as OopsInGenClosure
  43 // scans oops in a generation.)
  44 class OopsInHeapRegionClosure: public ExtendedOopClosure {
  45 protected:
  46   HeapRegion* _from;
  47 public:
  48   void set_region(HeapRegion* from) { _from = from; }
  49 };


 240   G1CollectedHeap* _g1;
 241   G1RemSet* _g1_rem_set;
 242   HeapRegion* _from;
 243   OopsInHeapRegionClosure* _push_ref_cl;
 244   bool _record_refs_into_cset;
 245   uint _worker_i;
 246 
 247 public:
 248   G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h,
 249                                 G1RemSet* rs,
 250                                 OopsInHeapRegionClosure* push_ref_cl,
 251                                 bool record_refs_into_cset,
 252                                 uint worker_i = 0);
 253 
 254   void set_from(HeapRegion* from) {
 255     assert(from != NULL, "from region must be non-NULL");
 256     _from = from;
 257   }
 258 
 259   bool self_forwarded(oop obj) {
 260     markOop m = obj->mark();
 261     bool result = (m->is_marked() && ((oop)m->decode_pointer() == obj));
 262     return result;
 263   }
 264 
 265   bool apply_to_weak_ref_discovered_field() { return true; }
 266 
 267   template <class T> void do_oop_nv(T* p);
 268   virtual void do_oop(narrowOop* p) { do_oop_nv(p); }
 269   virtual void do_oop(oop* p)       { do_oop_nv(p); }
 270 };
 271 
 272 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1OOPCLOSURES_HPP
< prev index next >