8294059: Serial: Refactor GenCollectedHeap::collect
Reviewed-by: sjohanss, tschatzl
This commit is contained in:
parent
ea6167104e
commit
60616f243f
@ -813,29 +813,7 @@ bool GenCollectedHeap::no_allocs_since_save_marks() {
|
||||
}
|
||||
|
||||
// public collection interfaces
|
||||
|
||||
void GenCollectedHeap::collect(GCCause::Cause cause) {
|
||||
if ((cause == GCCause::_wb_young_gc) ||
|
||||
(cause == GCCause::_gc_locker)) {
|
||||
// Young collection for WhiteBox or GCLocker.
|
||||
collect(cause, YoungGen);
|
||||
} else {
|
||||
#ifdef ASSERT
|
||||
if (cause == GCCause::_scavenge_alot) {
|
||||
// Young collection only.
|
||||
collect(cause, YoungGen);
|
||||
} else {
|
||||
// Stop-the-world full collection.
|
||||
collect(cause, OldGen);
|
||||
}
|
||||
#else
|
||||
// Stop-the-world full collection.
|
||||
collect(cause, OldGen);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void GenCollectedHeap::collect(GCCause::Cause cause, GenerationType max_generation) {
|
||||
// The caller doesn't have the Heap_lock
|
||||
assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock");
|
||||
|
||||
@ -853,6 +831,14 @@ void GenCollectedHeap::collect(GCCause::Cause cause, GenerationType max_generati
|
||||
return;
|
||||
}
|
||||
|
||||
bool should_run_young_gc = (cause == GCCause::_wb_young_gc)
|
||||
|| (cause == GCCause::_gc_locker)
|
||||
DEBUG_ONLY(|| (cause == GCCause::_scavenge_alot));
|
||||
|
||||
const GenerationType max_generation = should_run_young_gc
|
||||
? YoungGen
|
||||
: OldGen;
|
||||
|
||||
VM_GenCollectFull op(gc_count_before, full_gc_count_before,
|
||||
cause, max_generation);
|
||||
VMThread::execute(&op);
|
||||
|
@ -186,10 +186,6 @@ public:
|
||||
// supports. Caller does not hold the Heap_lock on entry.
|
||||
virtual void collect(GCCause::Cause cause);
|
||||
|
||||
// Perform a full collection of generations up to and including max_generation.
|
||||
// Mostly used for testing purposes. Caller does not hold the Heap_lock on entry.
|
||||
void collect(GCCause::Cause cause, GenerationType max_generation);
|
||||
|
||||
// Returns "TRUE" iff "p" points into the committed areas of the heap.
|
||||
// The methods is_in() and is_in_youngest() may be expensive to compute
|
||||
// in general, so, to prevent their inadvertent use in product jvm's, we
|
||||
|
Loading…
Reference in New Issue
Block a user