8284653: Serial: Inline GenCollectedHeap::collect_locked
Reviewed-by: kbarrett, tschatzl
This commit is contained in:
parent
9545ba7dd9
commit
4cd0921cf6
@ -843,28 +843,24 @@ void GenCollectedHeap::collect(GCCause::Cause cause) {
|
|||||||
void GenCollectedHeap::collect(GCCause::Cause cause, GenerationType max_generation) {
|
void GenCollectedHeap::collect(GCCause::Cause cause, GenerationType max_generation) {
|
||||||
// The caller doesn't have the Heap_lock
|
// The caller doesn't have the Heap_lock
|
||||||
assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock");
|
assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock");
|
||||||
|
|
||||||
|
unsigned int gc_count_before;
|
||||||
|
unsigned int full_gc_count_before;
|
||||||
|
|
||||||
|
{
|
||||||
MutexLocker ml(Heap_lock);
|
MutexLocker ml(Heap_lock);
|
||||||
collect_locked(cause, max_generation);
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is the private collection interface
|
|
||||||
// The Heap_lock is expected to be held on entry.
|
|
||||||
|
|
||||||
void GenCollectedHeap::collect_locked(GCCause::Cause cause, GenerationType max_generation) {
|
|
||||||
// Read the GC count while holding the Heap_lock
|
// Read the GC count while holding the Heap_lock
|
||||||
unsigned int gc_count_before = total_collections();
|
gc_count_before = total_collections();
|
||||||
unsigned int full_gc_count_before = total_full_collections();
|
full_gc_count_before = total_full_collections();
|
||||||
|
}
|
||||||
|
|
||||||
if (GCLocker::should_discard(cause, gc_count_before)) {
|
if (GCLocker::should_discard(cause, gc_count_before)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
MutexUnlocker mu(Heap_lock); // give up heap lock, execute gets it back
|
|
||||||
VM_GenCollectFull op(gc_count_before, full_gc_count_before,
|
VM_GenCollectFull op(gc_count_before, full_gc_count_before,
|
||||||
cause, max_generation);
|
cause, max_generation);
|
||||||
VMThread::execute(&op);
|
VMThread::execute(&op);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs) {
|
void GenCollectedHeap::do_full_collection(bool clear_all_soft_refs) {
|
||||||
|
@ -417,11 +417,6 @@ private:
|
|||||||
void prepare_for_compaction();
|
void prepare_for_compaction();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Perform a full collection of the generations up to and including max_generation.
|
|
||||||
// This is the low level interface used by the public versions of
|
|
||||||
// collect() and collect_locked(). Caller holds the Heap_lock on entry.
|
|
||||||
void collect_locked(GCCause::Cause cause, GenerationType max_generation);
|
|
||||||
|
|
||||||
// Save the tops of the spaces in all generations
|
// Save the tops of the spaces in all generations
|
||||||
void record_gen_tops_before_GC() PRODUCT_RETURN;
|
void record_gen_tops_before_GC() PRODUCT_RETURN;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user