105 ObjectStartArray* _start_array;
106
107 public:
108 PSOldPromotionLAB() : _start_array(NULL) { }
109 PSOldPromotionLAB(ObjectStartArray* start_array) : _start_array(start_array) { }
110
111 void set_start_array(ObjectStartArray* start_array) { _start_array = start_array; }
112
113 void flush();
114
115 // Not MT safe
116 HeapWord* allocate(size_t size) {
117 // Cannot test for this now that we're doing promotion failures
118 // assert(_state != flushed, "Sanity");
119 assert(_start_array != NULL, "Sanity");
120 HeapWord* obj = top();
121 HeapWord* new_top = obj + size;
122 // The 'new_top>obj' check is needed to detect overflow of obj+size.
123 if (new_top > obj && new_top <= end()) {
124 set_top(new_top);
125 assert(is_object_aligned((intptr_t)obj) && is_object_aligned((intptr_t)new_top),
126 "checking alignment");
127 _start_array->allocate_block(obj);
128 return obj;
129 }
130
131 return NULL;
132 }
133
134 debug_only(virtual bool lab_is_valid(MemRegion lab));
135 };
136
137 #endif // SHARE_VM_GC_PARALLEL_PSPROMOTIONLAB_HPP
|
105 ObjectStartArray* _start_array;
106
107 public:
108 PSOldPromotionLAB() : _start_array(NULL) { }
109 PSOldPromotionLAB(ObjectStartArray* start_array) : _start_array(start_array) { }
110
111 void set_start_array(ObjectStartArray* start_array) { _start_array = start_array; }
112
113 void flush();
114
115 // Not MT safe
116 HeapWord* allocate(size_t size) {
117 // Cannot test for this now that we're doing promotion failures
118 // assert(_state != flushed, "Sanity");
119 assert(_start_array != NULL, "Sanity");
120 HeapWord* obj = top();
121 HeapWord* new_top = obj + size;
122 // The 'new_top>obj' check is needed to detect overflow of obj+size.
123 if (new_top > obj && new_top <= end()) {
124 set_top(new_top);
125 assert(is_ptr_object_aligned(obj) && is_ptr_object_aligned(new_top),
126 "checking alignment");
127 _start_array->allocate_block(obj);
128 return obj;
129 }
130
131 return NULL;
132 }
133
134 debug_only(virtual bool lab_is_valid(MemRegion lab));
135 };
136
137 #endif // SHARE_VM_GC_PARALLEL_PSPROMOTIONLAB_HPP
|