src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp

Print this page


   1 /*
   2  * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   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 /////////////////////////////////////////////////////////////////
  26 // Closures used by ConcurrentMarkSweepGeneration's collector
  27 /////////////////////////////////////////////////////////////////
  28 class ConcurrentMarkSweepGeneration;
  29 class CMSBitMap;
  30 class CMSMarkStack;
  31 class CMSCollector;
  32 class MarkFromRootsClosure;
  33 class Par_MarkFromRootsClosure;
  34 
  35 // Decode the oop and call do_oop on it.
  36 #define DO_OOP_WORK_DEFN \
  37   void do_oop(oop obj);                                   \
  38   template <class T> inline void do_oop_work(T* p) {      \
  39     T heap_oop = oopDesc::load_heap_oop(p);               \
  40     if (!oopDesc::is_null(heap_oop)) {                    \
  41       oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);       \
  42       do_oop(obj);                                        \
  43     }                                                     \
  44   }


 410 class CMSParKeepAliveClosure: public Par_KlassRememberingOopClosure {
 411  private:
 412   MemRegion     _span;
 413   OopTaskQueue* _work_queue;
 414   CMSBitMap*    _bit_map;
 415   CMSInnerParMarkAndPushClosure
 416                 _mark_and_push;
 417   const uint    _low_water_mark;
 418   void trim_queue(uint max);
 419  protected:
 420   DO_OOP_WORK_DEFN
 421  public:
 422   CMSParKeepAliveClosure(CMSCollector* collector, MemRegion span,
 423                          CMSBitMap* bit_map, CMSMarkStack* revisit_stack,
 424                          OopTaskQueue* work_queue);
 425   virtual void do_oop(oop* p);
 426   virtual void do_oop(narrowOop* p);
 427   inline void do_oop_nv(oop* p)       { CMSParKeepAliveClosure::do_oop_work(p); }
 428   inline void do_oop_nv(narrowOop* p) { CMSParKeepAliveClosure::do_oop_work(p); }
 429 };


   1 /*
   2  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   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_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP
  27 
  28 #include "memory/genOopClosures.hpp"
  29 
  30 /////////////////////////////////////////////////////////////////
  31 // Closures used by ConcurrentMarkSweepGeneration's collector
  32 /////////////////////////////////////////////////////////////////
  33 class ConcurrentMarkSweepGeneration;
  34 class CMSBitMap;
  35 class CMSMarkStack;
  36 class CMSCollector;
  37 class MarkFromRootsClosure;
  38 class Par_MarkFromRootsClosure;
  39 
  40 // Decode the oop and call do_oop on it.
  41 #define DO_OOP_WORK_DEFN \
  42   void do_oop(oop obj);                                   \
  43   template <class T> inline void do_oop_work(T* p) {      \
  44     T heap_oop = oopDesc::load_heap_oop(p);               \
  45     if (!oopDesc::is_null(heap_oop)) {                    \
  46       oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);       \
  47       do_oop(obj);                                        \
  48     }                                                     \
  49   }


 415 class CMSParKeepAliveClosure: public Par_KlassRememberingOopClosure {
 416  private:
 417   MemRegion     _span;
 418   OopTaskQueue* _work_queue;
 419   CMSBitMap*    _bit_map;
 420   CMSInnerParMarkAndPushClosure
 421                 _mark_and_push;
 422   const uint    _low_water_mark;
 423   void trim_queue(uint max);
 424  protected:
 425   DO_OOP_WORK_DEFN
 426  public:
 427   CMSParKeepAliveClosure(CMSCollector* collector, MemRegion span,
 428                          CMSBitMap* bit_map, CMSMarkStack* revisit_stack,
 429                          OopTaskQueue* work_queue);
 430   virtual void do_oop(oop* p);
 431   virtual void do_oop(narrowOop* p);
 432   inline void do_oop_nv(oop* p)       { CMSParKeepAliveClosure::do_oop_work(p); }
 433   inline void do_oop_nv(narrowOop* p) { CMSParKeepAliveClosure::do_oop_work(p); }
 434 };
 435 
 436 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSOOPCLOSURES_HPP