< prev index next >

src/share/vm/gc_implementation/shenandoah/shenandoahCollectorPolicy.hpp

Print this page
rev 10690 : [backport] Cleanup header files and forward declarations
rev 10715 : [backport] Cleanup up superfluous newlines
rev 10748 : [backport] Handle metadata induced GC
rev 10756 : [backport] Factor out implicit/explicit GC requests
rev 10772 : [backport] Update copyrights
rev 10792 : [backport] Move ShenandoahGCTracer to gc/shenandoah
   1 /*
   2  * Copyright (c) 2013, 2015, Red Hat, Inc. and/or its affiliates.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
  25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
  26 
  27 #include "gc_implementation/shenandoah/shenandoahPhaseTimings.hpp"
  28 #include "gc_implementation/shenandoah/shenandoahHeap.hpp"
  29 #include "memory/collectorPolicy.hpp"
  30 #include "runtime/arguments.hpp"
  31 #include "utilities/numberSeq.hpp"
  32 
  33 class ShenandoahCollectionSet;
  34 class ShenandoahFreeSet;
  35 class ShenandoahHeap;
  36 class ShenandoahHeuristics;
  37 
  38 class STWGCTimer;
  39 class ConcurrentGCTimer;
  40 class outputStream;
  41 
  42 class ShenandoahCollectorPolicy: public CollectorPolicy {
  43 private:
  44   size_t _success_concurrent_gcs;
  45   size_t _success_degenerated_gcs;
  46   size_t _success_full_gcs;
  47   size_t _alloc_failure_degenerated;
  48   size_t _alloc_failure_degenerated_upgrade_to_full;
  49   size_t _alloc_failure_full;
  50   size_t _explicit_concurrent;
  51   size_t _explicit_full;


  52   size_t _degen_points[ShenandoahHeap::_DEGENERATED_LIMIT];
  53 
  54   ShenandoahSharedFlag _in_shutdown;
  55 
  56   ShenandoahTracer* _tracer;
  57 
  58   size_t _cycle_counter;
  59 
  60 
  61 public:
  62   ShenandoahCollectorPolicy();
  63 
  64   void post_heap_initialize() {};
  65 
  66   BarrierSet::Name barrier_set_name();
  67 
  68   HeapWord* mem_allocate_work(size_t size,
  69                               bool is_tlab,
  70                               bool* gc_overhead_limit_was_exceeded);
  71 
  72   HeapWord* satisfy_failed_allocation(size_t size, bool is_tlab);
  73 




  74   void initialize_alignments();
  75 
  76   // TODO: This is different from gc_end: that one encompasses one VM operation.
  77   // These two encompass the entire cycle.
  78   void record_cycle_start();
  79 
  80   void record_success_concurrent();
  81   void record_success_degenerated();
  82   void record_success_full();
  83   void record_alloc_failure_to_degenerated(ShenandoahHeap::ShenandoahDegenPoint point);
  84   void record_alloc_failure_to_full();
  85   void record_degenerated_upgrade_to_full();
  86   void record_explicit_to_concurrent();
  87   void record_explicit_to_full();


  88 
  89   void record_shutdown();
  90   bool is_at_shutdown();
  91 
  92   ShenandoahTracer* tracer() {return _tracer;}
  93 
  94   size_t cycle_counter() const;
  95 
  96   void print_gc_stats(outputStream* out) const;
  97 };
  98 
  99 
 100 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
   1 /*
   2  * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved.
   3  *
   4  * This code is free software; you can redistribute it and/or modify it
   5  * under the terms of the GNU General Public License version 2 only, as
   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 2 along with this work; if not, write to the Free Software Foundation,
  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
  25 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
  26 


  27 #include "memory/collectorPolicy.hpp"
  28 #include "gc_implementation/shenandoah/shenandoahHeap.hpp"
  29 #include "gc_implementation/shenandoah/shenandoahTracer.hpp"
  30 #include "utilities/ostream.hpp"




  31 
  32 class STWGCTimer;
  33 class ConcurrentGCTimer;

  34 
  35 class ShenandoahCollectorPolicy: public CollectorPolicy {
  36 private:
  37   size_t _success_concurrent_gcs;
  38   size_t _success_degenerated_gcs;
  39   size_t _success_full_gcs;
  40   size_t _alloc_failure_degenerated;
  41   size_t _alloc_failure_degenerated_upgrade_to_full;
  42   size_t _alloc_failure_full;
  43   size_t _explicit_concurrent;
  44   size_t _explicit_full;
  45   size_t _implicit_concurrent;
  46   size_t _implicit_full;
  47   size_t _degen_points[ShenandoahHeap::_DEGENERATED_LIMIT];
  48 
  49   ShenandoahSharedFlag _in_shutdown;
  50 
  51   ShenandoahTracer* _tracer;
  52 
  53   size_t _cycle_counter;
  54 

  55 public:
  56   ShenandoahCollectorPolicy();
  57 
  58   void post_heap_initialize() {};
  59 
  60   BarrierSet::Name barrier_set_name();
  61 
  62   HeapWord* mem_allocate_work(size_t size,
  63                               bool is_tlab,
  64                               bool* gc_overhead_limit_was_exceeded);
  65 
  66   HeapWord* satisfy_failed_allocation(size_t size, bool is_tlab);
  67 
  68   MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
  69                                                size_t size,
  70                                                Metaspace::MetadataType mdtype);
  71 
  72   void initialize_alignments();
  73 
  74   // TODO: This is different from gc_end: that one encompasses one VM operation.
  75   // These two encompass the entire cycle.
  76   void record_cycle_start();
  77 
  78   void record_success_concurrent();
  79   void record_success_degenerated();
  80   void record_success_full();
  81   void record_alloc_failure_to_degenerated(ShenandoahHeap::ShenandoahDegenPoint point);
  82   void record_alloc_failure_to_full();
  83   void record_degenerated_upgrade_to_full();
  84   void record_explicit_to_concurrent();
  85   void record_explicit_to_full();
  86   void record_implicit_to_concurrent();
  87   void record_implicit_to_full();
  88 
  89   void record_shutdown();
  90   bool is_at_shutdown();
  91 
  92   ShenandoahTracer* tracer() {return _tracer;}
  93 
  94   size_t cycle_counter() const;
  95 
  96   void print_gc_stats(outputStream* out) const;
  97 };

  98 
  99 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHCOLLECTORPOLICY_HPP
< prev index next >