1 /*
 2  * Copyright Amazon.com Inc. 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_SHENANDOAH_SHENANDOAHGLOBALGENERATION_HPP
26 #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHGLOBALGENERATION_HPP
27 
28 #include "gc/shenandoah/shenandoahGeneration.hpp"
29 #include "gc/shenandoah/shenandoahYoungGeneration.hpp"
30 #include "gc/shenandoah/shenandoahOldGeneration.hpp"
31 
32 // A "generation" that represents the whole heap.
33 class ShenandoahGlobalGeneration : public ShenandoahGeneration {
34 public:
35   ShenandoahGlobalGeneration(bool generational, uint max_queues, size_t max_capacity, size_t soft_max_capacity)
36   : ShenandoahGeneration(generational ? GLOBAL : NON_GEN, max_queues, max_capacity, soft_max_capacity) { }
37 
38 public:
39   const char* name() const override;
40 
41   size_t max_capacity() const override;
42   size_t soft_max_capacity() const override;
43   size_t used_regions() const override;
44   size_t used_regions_size() const override;
45   size_t available() const override;
46   size_t soft_available() const override;
47 
48   void set_concurrent_mark_in_progress(bool in_progress) override;
49 
50   bool contains(ShenandoahHeapRegion* region) const override;
51 
52   bool contains(oop obj) const override {
53     return ShenandoahHeap::heap()->is_in_reserved(obj);
54   }
55 
56   void parallel_heap_region_iterate(ShenandoahHeapRegionClosure* cl) override;
57 
58   void heap_region_iterate(ShenandoahHeapRegionClosure* cl) override;
59 
60   bool is_concurrent_mark_in_progress() override;
61 
62   void set_mark_complete() override;
63 
64   void set_mark_incomplete() override;
65 
66   ShenandoahHeuristics* initialize_heuristics(ShenandoahMode* gc_mode) override;
67 
68   virtual void prepare_gc() override;
69 };
70 
71 #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHGLOBALGENERATION_HPP
72