< prev index next >

src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.hpp

Print this page




   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_G1_G1CONCURRENTMARKBITMAP_HPP
  26 #define SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_HPP
  27 
  28 #include "gc/g1/g1RegionToSpaceMapper.hpp"
  29 #include "memory/allocation.hpp"
  30 #include "memory/memRegion.hpp"
  31 #include "oops/oopsHierarchy.hpp"
  32 #include "utilities/bitMap.hpp"
  33 #include "utilities/globalDefinitions.hpp"
  34 #include "utilities/macros.hpp"
  35 
  36 class G1CMBitMap;
  37 class G1CMTask;
  38 class G1ConcurrentMark;
  39 class HeapRegion;
  40 
  41 // Closure for iteration over bitmaps
  42 class G1CMBitMapClosure VALUE_OBJ_CLASS_SPEC {
  43 private:
  44   G1ConcurrentMark* const _cm;
  45   G1CMTask* const _task;
  46 public:
  47   G1CMBitMapClosure(G1CMTask *task, G1ConcurrentMark* cm) : _task(task), _cm(cm) { }
  48 
  49   bool do_addr(HeapWord* const addr);
  50 };
  51 
  52 class G1CMBitMapMappingChangedListener : public G1MappingChangedListener {
  53  private:
  54   G1CMBitMap* _bm;
  55  public:
  56   G1CMBitMapMappingChangedListener() : _bm(NULL) {}
  57 
  58   void set_bitmap(G1CMBitMap* bm) { _bm = bm; }
  59 
  60   virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
  61 };
  62 
  63 // A generic mark bitmap for concurrent marking.  This is essentially a wrapper
  64 // around the BitMap class that is based on HeapWords, with one bit per (1 << _shifter) HeapWords.
  65 class G1CMBitMap VALUE_OBJ_CLASS_SPEC {
  66 private:
  67   MemRegion _covered;    // The heap area covered by this bitmap.
  68 
  69   const int _shifter;    // Shift amount from heap index to bit index in the bitmap.
  70 
  71   BitMapView _bm;        // The actual bitmap.
  72 
  73   G1CMBitMapMappingChangedListener _listener;
  74 
  75   inline void check_mark(HeapWord* addr) NOT_DEBUG_RETURN;
  76 
  77   // Convert from bit offset to address.
  78   HeapWord* offset_to_addr(size_t offset) const {
  79     return _covered.start() + (offset << _shifter);
  80   }
  81   // Convert from address to bit offset.
  82   size_t addr_to_offset(const HeapWord* addr) const {
  83     return pointer_delta(addr, _covered.start()) >> _shifter;
  84   }
  85 public:




   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_G1_G1CONCURRENTMARKBITMAP_HPP
  26 #define SHARE_VM_GC_G1_G1CONCURRENTMARKBITMAP_HPP
  27 
  28 #include "gc/g1/g1RegionToSpaceMapper.hpp"

  29 #include "memory/memRegion.hpp"
  30 #include "oops/oopsHierarchy.hpp"
  31 #include "utilities/bitMap.hpp"
  32 #include "utilities/globalDefinitions.hpp"
  33 #include "utilities/macros.hpp"
  34 
  35 class G1CMBitMap;
  36 class G1CMTask;
  37 class G1ConcurrentMark;
  38 class HeapRegion;
  39 
  40 // Closure for iteration over bitmaps
  41 class G1CMBitMapClosure {
  42 private:
  43   G1ConcurrentMark* const _cm;
  44   G1CMTask* const _task;
  45 public:
  46   G1CMBitMapClosure(G1CMTask *task, G1ConcurrentMark* cm) : _task(task), _cm(cm) { }
  47 
  48   bool do_addr(HeapWord* const addr);
  49 };
  50 
  51 class G1CMBitMapMappingChangedListener : public G1MappingChangedListener {
  52  private:
  53   G1CMBitMap* _bm;
  54  public:
  55   G1CMBitMapMappingChangedListener() : _bm(NULL) {}
  56 
  57   void set_bitmap(G1CMBitMap* bm) { _bm = bm; }
  58 
  59   virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
  60 };
  61 
  62 // A generic mark bitmap for concurrent marking.  This is essentially a wrapper
  63 // around the BitMap class that is based on HeapWords, with one bit per (1 << _shifter) HeapWords.
  64 class G1CMBitMap {
  65 private:
  66   MemRegion _covered;    // The heap area covered by this bitmap.
  67 
  68   const int _shifter;    // Shift amount from heap index to bit index in the bitmap.
  69 
  70   BitMapView _bm;        // The actual bitmap.
  71 
  72   G1CMBitMapMappingChangedListener _listener;
  73 
  74   inline void check_mark(HeapWord* addr) NOT_DEBUG_RETURN;
  75 
  76   // Convert from bit offset to address.
  77   HeapWord* offset_to_addr(size_t offset) const {
  78     return _covered.start() + (offset << _shifter);
  79   }
  80   // Convert from address to bit offset.
  81   size_t addr_to_offset(const HeapWord* addr) const {
  82     return pointer_delta(addr, _covered.start()) >> _shifter;
  83   }
  84 public:


< prev index next >