< prev index next >

src/share/vm/gc/g1/heapRegionManager.hpp

Print this page
rev 8362 : [mq]: hotspot


   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_G1_HEAPREGIONMANAGER_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONMANAGER_HPP
  27 
  28 #include "gc_implementation/g1/g1BiasedArray.hpp"
  29 #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
  30 #include "gc_implementation/g1/heapRegionSet.hpp"
  31 #include "services/memoryUsage.hpp"
  32 
  33 class HeapRegion;
  34 class HeapRegionClosure;
  35 class HeapRegionClaimer;
  36 class FreeRegionList;
  37 
  38 class G1HeapRegionTable : public G1BiasedMappedArray<HeapRegion*> {
  39  protected:
  40   virtual HeapRegion* default_value() const { return NULL; }
  41 };
  42 
  43 // This class keeps track of the actual heap memory, auxiliary data
  44 // and its metadata (i.e., HeapRegion instances) and the list of free regions.
  45 //
  46 // This allows maximum flexibility for deciding what to commit or uncommit given
  47 // a request from outside.
  48 //
  49 // HeapRegions are kept in the _regions array in address order. A region's
  50 // index in the array corresponds to its index in the heap (i.e., 0 is the


 248   static const uint Claimed   = 1;
 249 
 250  public:
 251   HeapRegionClaimer(uint n_workers);
 252   ~HeapRegionClaimer();
 253 
 254   inline uint n_regions() const {
 255     return _n_regions;
 256   }
 257 
 258   // Calculate the starting region for given worker so
 259   // that they do not all start from the same region.
 260   uint start_region_for_worker(uint worker_id) const;
 261 
 262   // Check if region has been claimed with this HRClaimer.
 263   bool is_region_claimed(uint region_index) const;
 264 
 265   // Claim the given region, returns true if successfully claimed.
 266   bool claim_region(uint region_index);
 267 };
 268 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONMANAGER_HPP
 269 


   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_G1_HEAPREGIONMANAGER_HPP
  26 #define SHARE_VM_GC_G1_HEAPREGIONMANAGER_HPP
  27 
  28 #include "gc/g1/g1BiasedArray.hpp"
  29 #include "gc/g1/g1RegionToSpaceMapper.hpp"
  30 #include "gc/g1/heapRegionSet.hpp"
  31 #include "services/memoryUsage.hpp"
  32 
  33 class HeapRegion;
  34 class HeapRegionClosure;
  35 class HeapRegionClaimer;
  36 class FreeRegionList;
  37 
  38 class G1HeapRegionTable : public G1BiasedMappedArray<HeapRegion*> {
  39  protected:
  40   virtual HeapRegion* default_value() const { return NULL; }
  41 };
  42 
  43 // This class keeps track of the actual heap memory, auxiliary data
  44 // and its metadata (i.e., HeapRegion instances) and the list of free regions.
  45 //
  46 // This allows maximum flexibility for deciding what to commit or uncommit given
  47 // a request from outside.
  48 //
  49 // HeapRegions are kept in the _regions array in address order. A region's
  50 // index in the array corresponds to its index in the heap (i.e., 0 is the


 248   static const uint Claimed   = 1;
 249 
 250  public:
 251   HeapRegionClaimer(uint n_workers);
 252   ~HeapRegionClaimer();
 253 
 254   inline uint n_regions() const {
 255     return _n_regions;
 256   }
 257 
 258   // Calculate the starting region for given worker so
 259   // that they do not all start from the same region.
 260   uint start_region_for_worker(uint worker_id) const;
 261 
 262   // Check if region has been claimed with this HRClaimer.
 263   bool is_region_claimed(uint region_index) const;
 264 
 265   // Claim the given region, returns true if successfully claimed.
 266   bool claim_region(uint region_index);
 267 };
 268 #endif // SHARE_VM_GC_G1_HEAPREGIONMANAGER_HPP
 269 
< prev index next >