< prev index next >

src/share/vm/gc_implementation/g1/g1Allocator.hpp

Print this page
rev 7471 : 8060025: Object copy time regressions after JDK-8031323 and JDK-8057536
Summary: Evaluate and improve object copy time by micro-optimizations and splitting out slow and fast paths aggressively.
Reviewed-by:
Contributed-by: Tony Printezis <tprintezis@twitter.com>, Thomas Schatzl <thomas.schatzl@oracle.com>
rev 7472 : [mq]: 8060025-mikael-review1


  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_G1ALLOCATOR_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATOR_HPP
  27 
  28 #include "gc_implementation/g1/g1AllocationContext.hpp"
  29 #include "gc_implementation/g1/g1AllocRegion.hpp"

  30 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
  31 
  32 typedef int8_t in_cset_state_t;
  33 
  34 // Helper class used to examine in_cset_t values.
  35 class InCSetState : AllStatic {
  36 public:
  37   enum {
  38     // Values <0 mean the region is a humongous region.
  39     NotInCSet    = 0,     // The region is not in the collection set.
  40     Young        = 1,     // The region is in the collection set and a young region.
  41     Old          = 2,     // The region is in the collection set and an old region.
  42     Num
  43   };
  44 
  45   static in_cset_state_t humongous() { return -1; }
  46 
  47   static bool is_not_in_cset(in_cset_state_t state) { return state == NotInCSet; }
  48   static bool is_in_cset_or_humongous(in_cset_state_t state) { return state != NotInCSet; }
  49   static bool is_in_cset(in_cset_state_t state) { return state > NotInCSet; }
  50   static bool is_humongous(in_cset_state_t state) { return state < NotInCSet; }
  51 };
  52 
  53 // Base class for G1 allocators.
  54 class G1Allocator : public CHeapObj<mtGC> {
  55   friend class VMStructs;
  56 protected:
  57   G1CollectedHeap* _g1h;
  58 
  59   // Outside of GC pauses, the number of bytes used in all regions other
  60   // than the current allocation region.
  61   size_t _summary_bytes_used;
  62 
  63 public:
  64    G1Allocator(G1CollectedHeap* heap) :
  65      _g1h(heap), _summary_bytes_used(0) { }
  66 
  67    static G1Allocator* create_allocator(G1CollectedHeap* g1h);
  68 
  69    virtual void init_mutator_alloc_region() = 0;
  70    virtual void release_mutator_alloc_region() = 0;
  71 




  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_G1ALLOCATOR_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1ALLOCATOR_HPP
  27 
  28 #include "gc_implementation/g1/g1AllocationContext.hpp"
  29 #include "gc_implementation/g1/g1AllocRegion.hpp"
  30 #include "gc_implementation/g1/g1InCSetState.hpp"
  31 #include "gc_implementation/shared/parGCAllocBuffer.hpp"





















  32 
  33 // Base class for G1 allocators.
  34 class G1Allocator : public CHeapObj<mtGC> {
  35   friend class VMStructs;
  36 protected:
  37   G1CollectedHeap* _g1h;
  38 
  39   // Outside of GC pauses, the number of bytes used in all regions other
  40   // than the current allocation region.
  41   size_t _summary_bytes_used;
  42 
  43 public:
  44    G1Allocator(G1CollectedHeap* heap) :
  45      _g1h(heap), _summary_bytes_used(0) { }
  46 
  47    static G1Allocator* create_allocator(G1CollectedHeap* g1h);
  48 
  49    virtual void init_mutator_alloc_region() = 0;
  50    virtual void release_mutator_alloc_region() = 0;
  51 


< prev index next >