235 hr->memProtectionOff();
236 required = BrooksPointer::word_size() + p->size();
237 hr->memProtectionOn();
238 }
239 } else {
240 required = BrooksPointer::word_size() + p->size();
241 }
242 #else
243 required = BrooksPointer::word_size() + p->size();
244 #endif
245
246 assert(! heap_region_containing(p)->is_humongous(), "never evacuate humongous objects");
247
248 bool alloc_from_gclab = true;
249 HeapWord* filler = allocate_from_gclab(thread, required);
250 if (filler == NULL) {
251 filler = allocate_memory(required, true);
252 alloc_from_gclab = false;
253 }
254
255 if (filler == NULL) {
256 oom_during_evacuation();
257 // If this is a Java thread, it should have waited
258 // until all GC threads are done, and then we
259 // return the forwardee.
260 oop resolved = ShenandoahBarrierSet::resolve_oop_static(p);
261 return resolved;
262 }
263
264 HeapWord* copy = filler + BrooksPointer::word_size();
265
266 #ifdef ASSERT
267 if (ShenandoahVerifyReadsToFromSpace) {
268 hr->memProtectionOff();
269 copy_object(p, filler, required - BrooksPointer::word_size());
270 hr->memProtectionOn();
271 } else {
272 copy_object(p, filler, required - BrooksPointer::word_size());
273 }
274 #else
|
235 hr->memProtectionOff();
236 required = BrooksPointer::word_size() + p->size();
237 hr->memProtectionOn();
238 }
239 } else {
240 required = BrooksPointer::word_size() + p->size();
241 }
242 #else
243 required = BrooksPointer::word_size() + p->size();
244 #endif
245
246 assert(! heap_region_containing(p)->is_humongous(), "never evacuate humongous objects");
247
248 bool alloc_from_gclab = true;
249 HeapWord* filler = allocate_from_gclab(thread, required);
250 if (filler == NULL) {
251 filler = allocate_memory(required, true);
252 alloc_from_gclab = false;
253 }
254
255 #ifdef ASSERT
256 // Checking that current Java thread does not hold Threads_lock when we get here.
257 // If that ever be the case, we'd deadlock in oom_during_evacuation.
258 if ((! Thread::current()->is_GC_task_thread()) && (! Thread::current()->is_ConcurrentGC_thread())) {
259 assert(! Threads_lock->owned_by_self(), "must not hold Threads_lock here");
260 }
261 #endif
262
263 if (filler == NULL) {
264 oom_during_evacuation();
265 // If this is a Java thread, it should have waited
266 // until all GC threads are done, and then we
267 // return the forwardee.
268 oop resolved = ShenandoahBarrierSet::resolve_oop_static(p);
269 return resolved;
270 }
271
272 HeapWord* copy = filler + BrooksPointer::word_size();
273
274 #ifdef ASSERT
275 if (ShenandoahVerifyReadsToFromSpace) {
276 hr->memProtectionOff();
277 copy_object(p, filler, required - BrooksPointer::word_size());
278 hr->memProtectionOn();
279 } else {
280 copy_object(p, filler, required - BrooksPointer::word_size());
281 }
282 #else
|