8073543: Circular include dependency between psScavenge.inline.hpp and psPromotionManager.inline.hpp
Reviewed-by: brutisso, mgerdin
This commit is contained in:
parent
5cc358251f
commit
cd997db44d
@ -26,6 +26,8 @@
|
||||
#include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
|
||||
#include "gc_implementation/parallelScavenge/gcTaskManager.hpp"
|
||||
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psTasks.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psYoungGen.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
|
@ -66,6 +66,15 @@ void PSPromotionManager::initialize() {
|
||||
// for work stealing.
|
||||
}
|
||||
|
||||
// Helper functions to get around the circular dependency between
|
||||
// psScavenge.inline.hpp and psPromotionManager.inline.hpp.
|
||||
bool PSPromotionManager::should_scavenge(oop* p, bool check_to_space) {
|
||||
return PSScavenge::should_scavenge(p, check_to_space);
|
||||
}
|
||||
bool PSPromotionManager::should_scavenge(narrowOop* p, bool check_to_space) {
|
||||
return PSScavenge::should_scavenge(p, check_to_space);
|
||||
}
|
||||
|
||||
PSPromotionManager* PSPromotionManager::gc_thread_promotion_manager(int index) {
|
||||
assert(index >= 0 && index < (int)ParallelGCThreads, "index out of range");
|
||||
assert(_manager_array != NULL, "Sanity");
|
||||
|
@ -203,6 +203,12 @@ class PSPromotionManager VALUE_OBJ_CLASS_SPEC {
|
||||
|
||||
inline void process_popped_location_depth(StarTask p);
|
||||
|
||||
static bool should_scavenge(oop* p, bool check_to_space = false);
|
||||
static bool should_scavenge(narrowOop* p, bool check_to_space = false);
|
||||
|
||||
template <class T, bool promote_immediately>
|
||||
void copy_and_push_safe_barrier(T* p);
|
||||
|
||||
template <class T> inline void claim_or_forward_depth(T* p);
|
||||
|
||||
TASKQUEUE_STATS_ONLY(inline void record_steal(StarTask& p);)
|
||||
|
@ -56,7 +56,7 @@ inline void PSPromotionManager::claim_or_forward_internal_depth(T* p) {
|
||||
|
||||
template <class T>
|
||||
inline void PSPromotionManager::claim_or_forward_depth(T* p) {
|
||||
assert(PSScavenge::should_scavenge(p, true), "revisiting object?");
|
||||
assert(should_scavenge(p, true), "revisiting object?");
|
||||
assert(Universe::heap()->kind() == CollectedHeap::ParallelScavengeHeap,
|
||||
"Sanity");
|
||||
assert(Universe::heap()->is_in(p), "pointer outside heap");
|
||||
@ -98,7 +98,7 @@ inline void PSPromotionManager::promotion_trace_event(oop new_obj, oop old_obj,
|
||||
//
|
||||
template<bool promote_immediately>
|
||||
oop PSPromotionManager::copy_to_survivor_space(oop o) {
|
||||
assert(PSScavenge::should_scavenge(&o), "Sanity");
|
||||
assert(should_scavenge(&o), "Sanity");
|
||||
|
||||
oop new_obj = NULL;
|
||||
|
||||
@ -257,7 +257,7 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) {
|
||||
// information.
|
||||
if (TraceScavenge) {
|
||||
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
|
||||
PSScavenge::should_scavenge(&new_obj) ? "copying" : "tenuring",
|
||||
should_scavenge(&new_obj) ? "copying" : "tenuring",
|
||||
new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
|
||||
}
|
||||
#endif
|
||||
@ -265,6 +265,40 @@ oop PSPromotionManager::copy_to_survivor_space(oop o) {
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
// Attempt to "claim" oop at p via CAS, push the new obj if successful
|
||||
// This version tests the oop* to make sure it is within the heap before
|
||||
// attempting marking.
|
||||
template <class T, bool promote_immediately>
|
||||
inline void PSPromotionManager::copy_and_push_safe_barrier(T* p) {
|
||||
assert(should_scavenge(p, true), "revisiting object?");
|
||||
|
||||
oop o = oopDesc::load_decode_heap_oop_not_null(p);
|
||||
oop new_obj = o->is_forwarded()
|
||||
? o->forwardee()
|
||||
: copy_to_survivor_space<promote_immediately>(o);
|
||||
|
||||
#ifndef PRODUCT
|
||||
// This code must come after the CAS test, or it will print incorrect
|
||||
// information.
|
||||
if (TraceScavenge && o->is_forwarded()) {
|
||||
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
|
||||
"forwarding",
|
||||
new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
|
||||
}
|
||||
#endif
|
||||
|
||||
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
|
||||
|
||||
// We cannot mark without test, as some code passes us pointers
|
||||
// that are outside the heap. These pointers are either from roots
|
||||
// or from metadata.
|
||||
if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) &&
|
||||
Universe::heap()->is_in_reserved(p)) {
|
||||
if (PSScavenge::is_obj_in_young(new_obj)) {
|
||||
PSScavenge::card_table()->inline_write_ref_field_gc(p, new_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
|
||||
if (is_oop_masked(p)) {
|
||||
@ -274,9 +308,9 @@ inline void PSPromotionManager::process_popped_location_depth(StarTask p) {
|
||||
} else {
|
||||
if (p.is_narrow()) {
|
||||
assert(UseCompressedOops, "Error");
|
||||
PSScavenge::copy_and_push_safe_barrier<narrowOop, /*promote_immediately=*/false>(this, p);
|
||||
copy_and_push_safe_barrier<narrowOop, /*promote_immediately=*/false>(p);
|
||||
} else {
|
||||
PSScavenge::copy_and_push_safe_barrier<oop, /*promote_immediately=*/false>(this, p);
|
||||
copy_and_push_safe_barrier<oop, /*promote_immediately=*/false>(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
|
||||
// Weak refs may be visited more than once.
|
||||
if (PSScavenge::should_scavenge(p, _to_space)) {
|
||||
PSScavenge::copy_and_push_safe_barrier<T, /*promote_immediately=*/false>(_promotion_manager, p);
|
||||
_promotion_manager->copy_and_push_safe_barrier<T, /*promote_immediately=*/false>(p);
|
||||
}
|
||||
}
|
||||
virtual void do_oop(oop* p) { PSKeepAliveClosure::do_oop_work(p); }
|
||||
|
@ -144,9 +144,6 @@ class PSScavenge: AllStatic {
|
||||
template <class T> static inline bool should_scavenge(T* p, MutableSpace* to_space);
|
||||
template <class T> static inline bool should_scavenge(T* p, bool check_to_space);
|
||||
|
||||
template <class T, bool promote_immediately>
|
||||
inline static void copy_and_push_safe_barrier(PSPromotionManager* pm, T* p);
|
||||
|
||||
static void copy_and_push_safe_barrier_from_klass(PSPromotionManager* pm, oop* p);
|
||||
|
||||
// Is an object in the young generation
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
#include "gc_implementation/parallelScavenge/cardTableExtension.hpp"
|
||||
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
|
||||
#include "memory/iterator.hpp"
|
||||
@ -63,42 +62,6 @@ inline bool PSScavenge::should_scavenge(T* p, bool check_to_space) {
|
||||
return should_scavenge(p);
|
||||
}
|
||||
|
||||
// Attempt to "claim" oop at p via CAS, push the new obj if successful
|
||||
// This version tests the oop* to make sure it is within the heap before
|
||||
// attempting marking.
|
||||
template <class T, bool promote_immediately>
|
||||
inline void PSScavenge::copy_and_push_safe_barrier(PSPromotionManager* pm,
|
||||
T* p) {
|
||||
assert(should_scavenge(p, true), "revisiting object?");
|
||||
|
||||
oop o = oopDesc::load_decode_heap_oop_not_null(p);
|
||||
oop new_obj = o->is_forwarded()
|
||||
? o->forwardee()
|
||||
: pm->copy_to_survivor_space<promote_immediately>(o);
|
||||
|
||||
#ifndef PRODUCT
|
||||
// This code must come after the CAS test, or it will print incorrect
|
||||
// information.
|
||||
if (TraceScavenge && o->is_forwarded()) {
|
||||
gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
|
||||
"forwarding",
|
||||
new_obj->klass()->internal_name(), p2i((void *)o), p2i((void *)new_obj), new_obj->size());
|
||||
}
|
||||
#endif
|
||||
|
||||
oopDesc::encode_store_heap_oop_not_null(p, new_obj);
|
||||
|
||||
// We cannot mark without test, as some code passes us pointers
|
||||
// that are outside the heap. These pointers are either from roots
|
||||
// or from metadata.
|
||||
if ((!PSScavenge::is_obj_in_young((HeapWord*)p)) &&
|
||||
Universe::heap()->is_in_reserved(p)) {
|
||||
if (PSScavenge::is_obj_in_young(new_obj)) {
|
||||
card_table()->inline_write_ref_field_gc(p, new_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<bool promote_immediately>
|
||||
class PSRootsClosure: public OopClosure {
|
||||
private:
|
||||
@ -108,7 +71,7 @@ class PSRootsClosure: public OopClosure {
|
||||
template <class T> void do_oop_work(T *p) {
|
||||
if (PSScavenge::should_scavenge(p)) {
|
||||
// We never card mark roots, maybe call a func without test?
|
||||
PSScavenge::copy_and_push_safe_barrier<T, promote_immediately>(_promotion_manager, p);
|
||||
_promotion_manager->copy_and_push_safe_barrier<T, promote_immediately>(p);
|
||||
}
|
||||
}
|
||||
public:
|
||||
|
@ -41,7 +41,6 @@
|
||||
#if INCLUDE_ALL_GCS
|
||||
#include "gc_implementation/parNew/parOopClosures.inline.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
|
||||
#include "oops/oop.pcgc.inline.hpp"
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
|
||||
inline void oopDesc::update_contents(ParCompactionManager* cm) {
|
||||
|
@ -29,7 +29,6 @@
|
||||
#if INCLUDE_ALL_GCS
|
||||
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
|
||||
// ParallelScavengeHeap methods
|
||||
|
@ -67,7 +67,6 @@
|
||||
#if INCLUDE_ALL_GCS
|
||||
#include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.hpp"
|
||||
#include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
#ifdef COMPILER1
|
||||
#include "c1/c1_Compiler.hpp"
|
||||
|
Loading…
Reference in New Issue
Block a user