170 return max;
171 }
172
173 bool Generation::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
174 size_t available = max_contiguous_available();
175 bool res = (available >= max_promotion_in_bytes);
176 if (PrintGC && Verbose) {
177 gclog_or_tty->print_cr(
178 "Generation: promo attempt is%s safe: available("SIZE_FORMAT") %s max_promo("SIZE_FORMAT")",
179 res? "":" not", available, res? ">=":"<",
180 max_promotion_in_bytes);
181 }
182 return res;
183 }
184
185 // Ignores "ref" and calls allocate().
186 oop Generation::promote(oop obj, size_t obj_size) {
187 assert(obj_size == (size_t)obj->size(), "bad obj_size passed in");
188
189 #ifndef PRODUCT
190 if (Universe::heap()->promotion_should_fail()) {
191 return NULL;
192 }
193 #endif // #ifndef PRODUCT
194
195 HeapWord* result = allocate(obj_size, false);
196 if (result != NULL) {
197 Copy::aligned_disjoint_words((HeapWord*)obj, result, obj_size);
198 return oop(result);
199 } else {
200 GenCollectedHeap* gch = GenCollectedHeap::heap();
201 return gch->handle_failed_promotion(this, obj, obj_size);
202 }
203 }
204
205 oop Generation::par_promote(int thread_num,
206 oop obj, markOop m, size_t word_sz) {
207 // Could do a bad general impl here that gets a lock. But no.
208 ShouldNotCallThis();
209 return NULL;
210 }
|
170 return max;
171 }
172
173 bool Generation::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
174 size_t available = max_contiguous_available();
175 bool res = (available >= max_promotion_in_bytes);
176 if (PrintGC && Verbose) {
177 gclog_or_tty->print_cr(
178 "Generation: promo attempt is%s safe: available("SIZE_FORMAT") %s max_promo("SIZE_FORMAT")",
179 res? "":" not", available, res? ">=":"<",
180 max_promotion_in_bytes);
181 }
182 return res;
183 }
184
185 // Ignores "ref" and calls allocate().
186 oop Generation::promote(oop obj, size_t obj_size) {
187 assert(obj_size == (size_t)obj->size(), "bad obj_size passed in");
188
189 #ifndef PRODUCT
190 if (GenCollectedHeap::heap()->promotion_should_fail()) {
191 return NULL;
192 }
193 #endif // #ifndef PRODUCT
194
195 HeapWord* result = allocate(obj_size, false);
196 if (result != NULL) {
197 Copy::aligned_disjoint_words((HeapWord*)obj, result, obj_size);
198 return oop(result);
199 } else {
200 GenCollectedHeap* gch = GenCollectedHeap::heap();
201 return gch->handle_failed_promotion(this, obj, obj_size);
202 }
203 }
204
205 oop Generation::par_promote(int thread_num,
206 oop obj, markOop m, size_t word_sz) {
207 // Could do a bad general impl here that gets a lock. But no.
208 ShouldNotCallThis();
209 return NULL;
210 }
|