28 #include "gc/parallel/mutableSpace.hpp"
29 #include "gc/parallel/objectStartArray.hpp"
30 #include "gc/parallel/psGenerationCounters.hpp"
31 #include "gc/parallel/psVirtualspace.hpp"
32 #include "gc/parallel/spaceCounters.hpp"
33 #include "runtime/safepoint.hpp"
34
35 class PSMarkSweepDecorator;
36
37 class PSOldGen : public CHeapObj<mtGC> {
38 friend class VMStructs;
39 friend class PSPromotionManager; // Uses the cas_allocate methods
40 friend class ParallelScavengeHeap;
41 friend class AdjoiningGenerations;
42
43 protected:
44 MemRegion _reserved; // Used for simple containment tests
45 PSVirtualSpace* _virtual_space; // Controls mapping and unmapping of virtual mem
46 ObjectStartArray _start_array; // Keeps track of where objects start in a 512b block
47 MutableSpace* _object_space; // Where all the objects live
48 PSMarkSweepDecorator* _object_mark_sweep; // The mark sweep view of _object_space
49 const char* const _name; // Name of this generation.
50
51 // Performance Counters
52 PSGenerationCounters* _gen_counters;
53 SpaceCounters* _space_counters;
54
55 // Sizing information, in bytes, set in constructor
56 const size_t _init_gen_size;
57 const size_t _min_gen_size;
58 const size_t _max_gen_size;
59
60 // Used when initializing the _name field.
61 static inline const char* select_name();
62
63 #ifdef ASSERT
64 void assert_block_in_covered_region(MemRegion new_memregion) {
65 // Explictly capture current covered_region in a local
66 MemRegion covered_region = this->start_array()->covered_region();
67 assert(covered_region.contains(new_memregion),
68 "new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
133 virtual void initialize_performance_counters(const char* perf_data_name, int level);
134
135 MemRegion reserved() const { return _reserved; }
136 virtual size_t max_gen_size() { return _max_gen_size; }
137 size_t min_gen_size() { return _min_gen_size; }
138
139 // Returns limit on the maximum size of the generation. This
140 // is the same as _max_gen_size for PSOldGen but need not be
141 // for a derived class.
142 virtual size_t gen_size_limit();
143
144 bool is_in(const void* p) const {
145 return _virtual_space->contains((void *)p);
146 }
147
148 bool is_in_reserved(const void* p) const {
149 return reserved().contains(p);
150 }
151
152 MutableSpace* object_space() const { return _object_space; }
153 PSMarkSweepDecorator* object_mark_sweep() const { return _object_mark_sweep; }
154 ObjectStartArray* start_array() { return &_start_array; }
155 PSVirtualSpace* virtual_space() const { return _virtual_space;}
156
157 // Has the generation been successfully allocated?
158 bool is_allocated();
159
160 // MarkSweep methods
161 virtual void precompact();
162 void adjust_pointers();
163 void compact();
164
165 // Size info
166 size_t capacity_in_bytes() const { return object_space()->capacity_in_bytes(); }
167 size_t used_in_bytes() const { return object_space()->used_in_bytes(); }
168 size_t free_in_bytes() const { return object_space()->free_in_bytes(); }
169
170 size_t capacity_in_words() const { return object_space()->capacity_in_words(); }
171 size_t used_in_words() const { return object_space()->used_in_words(); }
172 size_t free_in_words() const { return object_space()->free_in_words(); }
173
174 // Includes uncommitted memory
175 size_t contiguous_available() const;
176
177 bool is_maximal_no_gc() const {
178 return virtual_space()->uncommitted_size() == 0;
179 }
180
181 // Calculating new sizes
182 void resize(size_t desired_free_space);
183
|
28 #include "gc/parallel/mutableSpace.hpp"
29 #include "gc/parallel/objectStartArray.hpp"
30 #include "gc/parallel/psGenerationCounters.hpp"
31 #include "gc/parallel/psVirtualspace.hpp"
32 #include "gc/parallel/spaceCounters.hpp"
33 #include "runtime/safepoint.hpp"
34
35 class PSMarkSweepDecorator;
36
37 class PSOldGen : public CHeapObj<mtGC> {
38 friend class VMStructs;
39 friend class PSPromotionManager; // Uses the cas_allocate methods
40 friend class ParallelScavengeHeap;
41 friend class AdjoiningGenerations;
42
43 protected:
44 MemRegion _reserved; // Used for simple containment tests
45 PSVirtualSpace* _virtual_space; // Controls mapping and unmapping of virtual mem
46 ObjectStartArray _start_array; // Keeps track of where objects start in a 512b block
47 MutableSpace* _object_space; // Where all the objects live
48 #if INCLUDE_SERIALGC
49 PSMarkSweepDecorator* _object_mark_sweep; // The mark sweep view of _object_space
50 #endif
51 const char* const _name; // Name of this generation.
52
53 // Performance Counters
54 PSGenerationCounters* _gen_counters;
55 SpaceCounters* _space_counters;
56
57 // Sizing information, in bytes, set in constructor
58 const size_t _init_gen_size;
59 const size_t _min_gen_size;
60 const size_t _max_gen_size;
61
62 // Used when initializing the _name field.
63 static inline const char* select_name();
64
65 #ifdef ASSERT
66 void assert_block_in_covered_region(MemRegion new_memregion) {
67 // Explictly capture current covered_region in a local
68 MemRegion covered_region = this->start_array()->covered_region();
69 assert(covered_region.contains(new_memregion),
70 "new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
135 virtual void initialize_performance_counters(const char* perf_data_name, int level);
136
137 MemRegion reserved() const { return _reserved; }
138 virtual size_t max_gen_size() { return _max_gen_size; }
139 size_t min_gen_size() { return _min_gen_size; }
140
141 // Returns limit on the maximum size of the generation. This
142 // is the same as _max_gen_size for PSOldGen but need not be
143 // for a derived class.
144 virtual size_t gen_size_limit();
145
146 bool is_in(const void* p) const {
147 return _virtual_space->contains((void *)p);
148 }
149
150 bool is_in_reserved(const void* p) const {
151 return reserved().contains(p);
152 }
153
154 MutableSpace* object_space() const { return _object_space; }
155 #if INCLUDE_SERIALGC
156 PSMarkSweepDecorator* object_mark_sweep() const { return _object_mark_sweep; }
157 #endif
158 ObjectStartArray* start_array() { return &_start_array; }
159 PSVirtualSpace* virtual_space() const { return _virtual_space;}
160
161 // Has the generation been successfully allocated?
162 bool is_allocated();
163
164 #if INCLUDE_SERIALGC
165 // MarkSweep methods
166 virtual void precompact();
167 void adjust_pointers();
168 void compact();
169 #endif
170
171 // Size info
172 size_t capacity_in_bytes() const { return object_space()->capacity_in_bytes(); }
173 size_t used_in_bytes() const { return object_space()->used_in_bytes(); }
174 size_t free_in_bytes() const { return object_space()->free_in_bytes(); }
175
176 size_t capacity_in_words() const { return object_space()->capacity_in_words(); }
177 size_t used_in_words() const { return object_space()->used_in_words(); }
178 size_t free_in_words() const { return object_space()->free_in_words(); }
179
180 // Includes uncommitted memory
181 size_t contiguous_available() const;
182
183 bool is_maximal_no_gc() const {
184 return virtual_space()->uncommitted_size() == 0;
185 }
186
187 // Calculating new sizes
188 void resize(size_t desired_free_space);
189
|