27
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 PSOldGen : public CHeapObj<mtGC> {
36 friend class VMStructs;
37 friend class PSPromotionManager; // Uses the cas_allocate methods
38 friend class ParallelScavengeHeap;
39 friend class AdjoiningGenerations;
40
41 protected:
42 MemRegion _reserved; // Used for simple containment tests
43 PSVirtualSpace* _virtual_space; // Controls mapping and unmapping of virtual mem
44 ObjectStartArray _start_array; // Keeps track of where objects start in a 512b block
45 MutableSpace* _object_space; // Where all the objects live
46
47 const char* const _name; // Name of this generation.
48
49 // Performance Counters
50 PSGenerationCounters* _gen_counters;
51 SpaceCounters* _space_counters;
52
53 // Sizing information, in bytes, set in constructor
54 const size_t _init_gen_size;
55 const size_t _min_gen_size;
56 const size_t _max_gen_size;
57
58 // Used when initializing the _name field.
59 static inline const char* old_gen_name();
60
61 #ifdef ASSERT
62 void assert_block_in_covered_region(MemRegion new_memregion) {
63 // Explictly capture current covered_region in a local
64 MemRegion covered_region = this->start_array()->covered_region();
65 assert(covered_region.contains(new_memregion),
66 "new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
67 "new region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
68 "object space [ " PTR_FORMAT ", " PTR_FORMAT " ]",
69 p2i(covered_region.start()),
70 p2i(covered_region.end()),
71 p2i(new_memregion.start()),
72 p2i(new_memregion.end()),
73 p2i(this->object_space()->used_region().start()),
74 p2i(this->object_space()->used_region().end()));
75 }
76 #endif
77
78 HeapWord* allocate_noexpand(size_t word_size) {
79 // We assume the heap lock is held here.
80 assert_locked_or_safepoint(Heap_lock);
184 // Debugging - do not use for time critical operations
185 virtual void print() const;
186 virtual void print_on(outputStream* st) const;
187
188 void verify();
189 void verify_object_start_array();
190
191 // These should not used
192 virtual void reset_after_change();
193
194 // These should not used
195 virtual size_t available_for_expansion();
196 virtual size_t available_for_contraction();
197
198 void space_invariants() PRODUCT_RETURN;
199
200 // Performance Counter support
201 void update_counters();
202
203 // Printing support
204 virtual const char* name() const { return _name; }
205
206 // Debugging support
207 // Save the tops of all spaces for later use during mangling.
208 void record_spaces_top() PRODUCT_RETURN;
209 };
210
211 #endif // SHARE_GC_PARALLEL_PSOLDGEN_HPP
|
27
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 PSOldGen : public CHeapObj<mtGC> {
36 friend class VMStructs;
37 friend class PSPromotionManager; // Uses the cas_allocate methods
38 friend class ParallelScavengeHeap;
39 friend class AdjoiningGenerations;
40
41 protected:
42 MemRegion _reserved; // Used for simple containment tests
43 PSVirtualSpace* _virtual_space; // Controls mapping and unmapping of virtual mem
44 ObjectStartArray _start_array; // Keeps track of where objects start in a 512b block
45 MutableSpace* _object_space; // Where all the objects live
46
47 // Performance Counters
48 PSGenerationCounters* _gen_counters;
49 SpaceCounters* _space_counters;
50
51 // Sizing information, in bytes, set in constructor
52 const size_t _init_gen_size;
53 const size_t _min_gen_size;
54 const size_t _max_gen_size;
55
56 #ifdef ASSERT
57 void assert_block_in_covered_region(MemRegion new_memregion) {
58 // Explictly capture current covered_region in a local
59 MemRegion covered_region = this->start_array()->covered_region();
60 assert(covered_region.contains(new_memregion),
61 "new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
62 "new region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
63 "object space [ " PTR_FORMAT ", " PTR_FORMAT " ]",
64 p2i(covered_region.start()),
65 p2i(covered_region.end()),
66 p2i(new_memregion.start()),
67 p2i(new_memregion.end()),
68 p2i(this->object_space()->used_region().start()),
69 p2i(this->object_space()->used_region().end()));
70 }
71 #endif
72
73 HeapWord* allocate_noexpand(size_t word_size) {
74 // We assume the heap lock is held here.
75 assert_locked_or_safepoint(Heap_lock);
179 // Debugging - do not use for time critical operations
180 virtual void print() const;
181 virtual void print_on(outputStream* st) const;
182
183 void verify();
184 void verify_object_start_array();
185
186 // These should not used
187 virtual void reset_after_change();
188
189 // These should not used
190 virtual size_t available_for_expansion();
191 virtual size_t available_for_contraction();
192
193 void space_invariants() PRODUCT_RETURN;
194
195 // Performance Counter support
196 void update_counters();
197
198 // Printing support
199 virtual const char* name() const { return "ParOldGen"; }
200
201 // Debugging support
202 // Save the tops of all spaces for later use during mangling.
203 void record_spaces_top() PRODUCT_RETURN;
204 };
205
206 #endif // SHARE_GC_PARALLEL_PSOLDGEN_HPP
|