1579 void ShenandoahHeap::set_evacuation_in_progress_at_safepoint(bool in_progress) {
1580 assert(SafepointSynchronize::is_at_safepoint(), "Only call this at safepoint");
1581 set_evacuation_in_progress(in_progress);
1582 JavaThread::set_evacuation_in_progress_all_threads(in_progress);
1583 }
1584
1585 void ShenandoahHeap::set_evacuation_in_progress(bool in_progress) {
1586 _evacuation_in_progress = in_progress ? 1 : 0;
1587 OrderAccess::fence();
1588 }
1589
1590 void ShenandoahHeap::oom_during_evacuation() {
1591 log_develop_trace(gc)("Out of memory during evacuation, cancel evacuation, schedule full GC by thread %d",
1592 Thread::current()->osthread()->thread_id());
1593
1594 // We ran out of memory during evacuation. Cancel evacuation, and schedule a full-GC.
1595 collector_policy()->set_should_clear_all_soft_refs(true);
1596 concurrent_thread()->try_set_full_gc();
1597 cancel_concgc(_oom_evacuation);
1598
1599 if ((! Thread::current()->is_GC_task_thread()) && (! Thread::current()->is_ConcurrentGC_thread())) {
1600 assert(! Threads_lock->owned_by_self()
1601 || SafepointSynchronize::is_at_safepoint(), "must not hold Threads_lock here");
1602 log_warning(gc)("OOM during evacuation. Let Java thread wait until evacuation finishes.");
1603 while (_evacuation_in_progress) { // wait.
1604 Thread::current()->_ParkEvent->park(1);
1605 }
1606 }
1607
1608 }
1609
1610 HeapWord* ShenandoahHeap::tlab_post_allocation_setup(HeapWord* obj) {
1611 // Initialize Brooks pointer for the next object
1612 HeapWord* result = obj + BrooksPointer::word_size();
1613 BrooksPointer::initialize(oop(result));
1614 return result;
1615 }
1616
1617 uint ShenandoahHeap::oop_extra_words() {
1618 return BrooksPointer::word_size();
1619 }
|
1579 void ShenandoahHeap::set_evacuation_in_progress_at_safepoint(bool in_progress) {
1580 assert(SafepointSynchronize::is_at_safepoint(), "Only call this at safepoint");
1581 set_evacuation_in_progress(in_progress);
1582 JavaThread::set_evacuation_in_progress_all_threads(in_progress);
1583 }
1584
1585 void ShenandoahHeap::set_evacuation_in_progress(bool in_progress) {
1586 _evacuation_in_progress = in_progress ? 1 : 0;
1587 OrderAccess::fence();
1588 }
1589
1590 void ShenandoahHeap::oom_during_evacuation() {
1591 log_develop_trace(gc)("Out of memory during evacuation, cancel evacuation, schedule full GC by thread %d",
1592 Thread::current()->osthread()->thread_id());
1593
1594 // We ran out of memory during evacuation. Cancel evacuation, and schedule a full-GC.
1595 collector_policy()->set_should_clear_all_soft_refs(true);
1596 concurrent_thread()->try_set_full_gc();
1597 cancel_concgc(_oom_evacuation);
1598
1599 if (!ShenandoahSafeOOMDuringEvac &&
1600 (! Thread::current()->is_GC_task_thread()) && (! Thread::current()->is_ConcurrentGC_thread())) {
1601 assert(! Threads_lock->owned_by_self()
1602 || SafepointSynchronize::is_at_safepoint(), "must not hold Threads_lock here");
1603 log_warning(gc)("OOM during evacuation. Let Java thread wait until evacuation finishes.");
1604 while (_evacuation_in_progress) { // wait.
1605 Thread::current()->_ParkEvent->park(1);
1606 }
1607 }
1608
1609 }
1610
1611 HeapWord* ShenandoahHeap::tlab_post_allocation_setup(HeapWord* obj) {
1612 // Initialize Brooks pointer for the next object
1613 HeapWord* result = obj + BrooksPointer::word_size();
1614 BrooksPointer::initialize(oop(result));
1615 return result;
1616 }
1617
1618 uint ShenandoahHeap::oop_extra_words() {
1619 return BrooksPointer::word_size();
1620 }
|