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 err_msg("new region is not in covered_region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
69 "new region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
70 "object space [ " PTR_FORMAT ", " PTR_FORMAT " ]",
71 p2i(covered_region.start()),
72 p2i(covered_region.end()),
73 p2i(new_memregion.start()),
74 p2i(new_memregion.end()),
75 p2i(this->object_space()->used_region().start()),
76 p2i(this->object_space()->used_region().end())));
77 }
78 #endif
79
80 HeapWord* allocate_noexpand(size_t word_size) {
81 // We assume the heap lock is held here.
82 assert_locked_or_safepoint(Heap_lock);
83 HeapWord* res = object_space()->allocate(word_size);
84 if (res != NULL) {
85 DEBUG_ONLY(assert_block_in_covered_region(MemRegion(res, word_size)));
86 _start_array.allocate_block(res);
87 }
88 return res;
89 }
90
91 // Support for MT garbage collection. CAS allocation is lower overhead than grabbing
92 // and releasing the heap lock, which is held during gc's anyway. This method is not
93 // safe for use at the same time as allocate_noexpand()!
94 HeapWord* cas_allocate_noexpand(size_t word_size) {
95 assert(SafepointSynchronize::is_at_safepoint(), "Must only be called at safepoint");
96 HeapWord* res = object_space()->cas_allocate(word_size);
|
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 " ], "
69 "new region [ " PTR_FORMAT ", " PTR_FORMAT " ], "
70 "object space [ " PTR_FORMAT ", " PTR_FORMAT " ]",
71 p2i(covered_region.start()),
72 p2i(covered_region.end()),
73 p2i(new_memregion.start()),
74 p2i(new_memregion.end()),
75 p2i(this->object_space()->used_region().start()),
76 p2i(this->object_space()->used_region().end()));
77 }
78 #endif
79
80 HeapWord* allocate_noexpand(size_t word_size) {
81 // We assume the heap lock is held here.
82 assert_locked_or_safepoint(Heap_lock);
83 HeapWord* res = object_space()->allocate(word_size);
84 if (res != NULL) {
85 DEBUG_ONLY(assert_block_in_covered_region(MemRegion(res, word_size)));
86 _start_array.allocate_block(res);
87 }
88 return res;
89 }
90
91 // Support for MT garbage collection. CAS allocation is lower overhead than grabbing
92 // and releasing the heap lock, which is held during gc's anyway. This method is not
93 // safe for use at the same time as allocate_noexpand()!
94 HeapWord* cas_allocate_noexpand(size_t word_size) {
95 assert(SafepointSynchronize::is_at_safepoint(), "Must only be called at safepoint");
96 HeapWord* res = object_space()->cas_allocate(word_size);
|