< prev index next >

src/share/vm/gc/parallel/parMarkBitMap.hpp

Print this page
rev 8362 : [mq]: hotspot
   1 /*
   2  * Copyright (c) 2005, 2014, 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_PARALLELSCAVENGE_PARMARKBITMAP_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP
  27 
  28 #include "memory/memRegion.hpp"
  29 #include "oops/oop.hpp"
  30 #include "utilities/bitMap.hpp"
  31 
  32 class ParMarkBitMapClosure;
  33 class PSVirtualSpace;
  34 
  35 class ParMarkBitMap: public CHeapObj<mtGC>
  36 {
  37 public:
  38   typedef BitMap::idx_t idx_t;
  39 
  40   // Values returned by the iterate() methods.
  41   enum IterationStatus { incomplete, complete, full, would_overflow };
  42 
  43   inline ParMarkBitMap();
  44   bool initialize(MemRegion covered_region);
  45 
  46   // Atomically mark an object as live.


 379   const idx_t search_end = BitMap::word_align_up(end_bit);
 380   const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit);
 381   return bit_to_addr(res_bit);
 382 }
 383 
 384 #ifdef  ASSERT
 385 inline void ParMarkBitMap::verify_bit(idx_t bit) const {
 386   // Allow one past the last valid bit; useful for loop bounds.
 387   assert(bit <= _beg_bits.size(), "bit out of range");
 388 }
 389 
 390 inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
 391   // Allow one past the last valid address; useful for loop bounds.
 392   assert(addr >= region_start(),
 393       err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start())));
 394   assert(addr <= region_end(),
 395       err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end())));
 396 }
 397 #endif  // #ifdef ASSERT
 398 
 399 #endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PARMARKBITMAP_HPP
   1 /*
   2  * Copyright (c) 2005, 2015, 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_PARALLEL_PARMARKBITMAP_HPP
  26 #define SHARE_VM_GC_PARALLEL_PARMARKBITMAP_HPP
  27 
  28 #include "memory/memRegion.hpp"
  29 #include "oops/oop.hpp"
  30 #include "utilities/bitMap.hpp"
  31 
  32 class ParMarkBitMapClosure;
  33 class PSVirtualSpace;
  34 
  35 class ParMarkBitMap: public CHeapObj<mtGC>
  36 {
  37 public:
  38   typedef BitMap::idx_t idx_t;
  39 
  40   // Values returned by the iterate() methods.
  41   enum IterationStatus { incomplete, complete, full, would_overflow };
  42 
  43   inline ParMarkBitMap();
  44   bool initialize(MemRegion covered_region);
  45 
  46   // Atomically mark an object as live.


 379   const idx_t search_end = BitMap::word_align_up(end_bit);
 380   const idx_t res_bit = MIN2(find_obj_end(beg_bit, search_end), end_bit);
 381   return bit_to_addr(res_bit);
 382 }
 383 
 384 #ifdef  ASSERT
 385 inline void ParMarkBitMap::verify_bit(idx_t bit) const {
 386   // Allow one past the last valid bit; useful for loop bounds.
 387   assert(bit <= _beg_bits.size(), "bit out of range");
 388 }
 389 
 390 inline void ParMarkBitMap::verify_addr(HeapWord* addr) const {
 391   // Allow one past the last valid address; useful for loop bounds.
 392   assert(addr >= region_start(),
 393       err_msg("addr too small, addr: " PTR_FORMAT " region start: " PTR_FORMAT, p2i(addr), p2i(region_start())));
 394   assert(addr <= region_end(),
 395       err_msg("addr too big, addr: " PTR_FORMAT " region end: " PTR_FORMAT, p2i(addr), p2i(region_end())));
 396 }
 397 #endif  // #ifdef ASSERT
 398 
 399 #endif // SHARE_VM_GC_PARALLEL_PARMARKBITMAP_HPP
< prev index next >