< prev index next >

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

Print this page
rev 8362 : [mq]: hotspot
   1 /*
   2  * Copyright (c) 2011, 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_G1_G1ALLOCREGION_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_HPP
  27 
  28 #include "gc_implementation/g1/heapRegion.hpp"
  29 
  30 class G1CollectedHeap;
  31 
  32 // 0 -> no tracing, 1 -> basic tracing, 2 -> basic + allocation tracing
  33 #define G1_ALLOC_REGION_TRACING 0
  34 
  35 class ar_ext_msg;
  36 
  37 // A class that holds a region that is active in satisfying allocation
  38 // requests, potentially issued in parallel. When the active region is
  39 // full it will be retired and replaced with a new one. The
  40 // implementation assumes that fast-path allocations will be lock-free
  41 // and a lock will need to be taken when the active region needs to be
  42 // replaced.
  43 
  44 class G1AllocRegion VALUE_OBJ_CLASS_SPEC {
  45   friend class ar_ext_msg;
  46 
  47 private:
  48   // The active allocating region we are currently allocating out


 216   virtual void retire_region(HeapRegion* alloc_region, size_t allocated_bytes);
 217 public:
 218   OldGCAllocRegion()
 219   : G1AllocRegion("Old GC Alloc Region", true /* bot_updates */) { }
 220 
 221   // This specialization of release() makes sure that the last card that has
 222   // been allocated into has been completely filled by a dummy object.  This
 223   // avoids races when remembered set scanning wants to update the BOT of the
 224   // last card in the retained old gc alloc region, and allocation threads
 225   // allocating into that card at the same time.
 226   virtual HeapRegion* release();
 227 };
 228 
 229 class ar_ext_msg : public err_msg {
 230 public:
 231   ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("%s", "") {
 232     alloc_region->fill_in_ext_msg(this, message);
 233   }
 234 };
 235 
 236 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCREGION_HPP
   1 /*
   2  * Copyright (c) 2011, 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_G1_G1ALLOCREGION_HPP
  26 #define SHARE_VM_GC_G1_G1ALLOCREGION_HPP
  27 
  28 #include "gc/g1/heapRegion.hpp"
  29 
  30 class G1CollectedHeap;
  31 
  32 // 0 -> no tracing, 1 -> basic tracing, 2 -> basic + allocation tracing
  33 #define G1_ALLOC_REGION_TRACING 0
  34 
  35 class ar_ext_msg;
  36 
  37 // A class that holds a region that is active in satisfying allocation
  38 // requests, potentially issued in parallel. When the active region is
  39 // full it will be retired and replaced with a new one. The
  40 // implementation assumes that fast-path allocations will be lock-free
  41 // and a lock will need to be taken when the active region needs to be
  42 // replaced.
  43 
  44 class G1AllocRegion VALUE_OBJ_CLASS_SPEC {
  45   friend class ar_ext_msg;
  46 
  47 private:
  48   // The active allocating region we are currently allocating out


 216   virtual void retire_region(HeapRegion* alloc_region, size_t allocated_bytes);
 217 public:
 218   OldGCAllocRegion()
 219   : G1AllocRegion("Old GC Alloc Region", true /* bot_updates */) { }
 220 
 221   // This specialization of release() makes sure that the last card that has
 222   // been allocated into has been completely filled by a dummy object.  This
 223   // avoids races when remembered set scanning wants to update the BOT of the
 224   // last card in the retained old gc alloc region, and allocation threads
 225   // allocating into that card at the same time.
 226   virtual HeapRegion* release();
 227 };
 228 
 229 class ar_ext_msg : public err_msg {
 230 public:
 231   ar_ext_msg(G1AllocRegion* alloc_region, const char *message) : err_msg("%s", "") {
 232     alloc_region->fill_in_ext_msg(this, message);
 233   }
 234 };
 235 
 236 #endif // SHARE_VM_GC_G1_G1ALLOCREGION_HPP
< prev index next >