< prev index next >
src/share/vm/gc/shared/genCollectedHeap.cpp
Print this page
@@ -461,14 +461,13 @@
size_t gch_prev_used = used();
bool run_verification = total_collections() >= VerifyGCStartAt;
bool prepared_for_verification = false;
bool collected_old = false;
- bool old_collects_young = complete &&
- _old_gen->full_collects_young_generation();
- if (!old_collects_young &&
- _young_gen->should_collect(full, size, is_tlab)) {
+ bool old_collects_young = complete && !ScavengeBeforeFullGC;
+
+ if (!old_collects_young && _young_gen->should_collect(full, size, is_tlab)) {
if (run_verification && VerifyGCLevel <= 0 && VerifyBeforeGC) {
prepare_for_verify();
prepared_for_verification = true;
}
@@ -664,56 +663,61 @@
DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations));
DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
}
}
-void GenCollectedHeap::gen_process_roots(StrongRootsScope* scope,
- GenerationType type,
+void GenCollectedHeap::young_process_roots(StrongRootsScope* scope,
+ OopsInGenClosure* young_gen_closure,
+ OopsInGenClosure* old_gen_closure,
+ CLDClosure* cld_closure) {
+ MarkingCodeBlobClosure mark_code_closure(young_gen_closure, true /* young collections are always moving */);
+
+ process_roots(scope, SO_ScavengeCodeCache, young_gen_closure, young_gen_closure,
+ cld_closure, cld_closure, &mark_code_closure);
+
+ if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
+ young_gen_closure->reset_generation();
+ }
+
+ // When collection is parallel, all threads get to cooperate to do
+ // old generation scanning.
+ old_gen_closure->set_generation(_old_gen);
+ rem_set()->younger_refs_iterate(_old_gen, old_gen_closure, scope->n_threads());
+ old_gen_closure->reset_generation();
+
+ _process_strong_tasks->all_tasks_completed(scope->n_threads());
+}
+
+void GenCollectedHeap::old_process_roots(StrongRootsScope* scope,
bool young_gen_as_roots,
ScanningOption so,
bool only_strong_roots,
- OopsInGenClosure* not_older_gens,
- OopsInGenClosure* older_gens,
+ OopsInGenClosure* young_gen_closure,
CLDClosure* cld_closure) {
const bool is_adjust_phase = !only_strong_roots && !young_gen_as_roots;
bool is_moving_collection = false;
- if (type == YoungGen || is_adjust_phase) {
- // young collections are always moving
+ if (is_adjust_phase) {
is_moving_collection = true;
}
- MarkingCodeBlobClosure mark_code_closure(not_older_gens, is_moving_collection);
- OopsInGenClosure* weak_roots = only_strong_roots ? NULL : not_older_gens;
+ MarkingCodeBlobClosure mark_code_closure(young_gen_closure, is_moving_collection);
+ OopsInGenClosure* weak_roots = only_strong_roots ? NULL : young_gen_closure;
CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
- process_roots(scope, so,
- not_older_gens, weak_roots,
- cld_closure, weak_cld_closure,
- &mark_code_closure);
-
- if (young_gen_as_roots) {
- if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
- if (type == OldGen) {
- not_older_gens->set_generation(_young_gen);
- _young_gen->oop_iterate(not_older_gens);
- }
- not_older_gens->reset_generation();
- }
- }
- // When collection is parallel, all threads get to cooperate to do
- // old generation scanning.
- if (type == YoungGen) {
- older_gens->set_generation(_old_gen);
- rem_set()->younger_refs_iterate(_old_gen, older_gens, scope->n_threads());
- older_gens->reset_generation();
+ process_roots(scope, so, young_gen_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
+
+ if (young_gen_as_roots &&
+ !_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
+ young_gen_closure->set_generation(_young_gen);
+ _young_gen->oop_iterate(young_gen_closure);
+ young_gen_closure->reset_generation();
}
_process_strong_tasks->all_tasks_completed(scope->n_threads());
}
-
class AlwaysTrueClosure: public BoolObjectClosure {
public:
bool do_object_b(oop p) { return true; }
};
static AlwaysTrueClosure always_true;
@@ -1106,14 +1110,10 @@
CompactPoint cp(_old_gen);
_old_gen->prepare_for_compaction(&cp);
_young_gen->prepare_for_compaction(&cp);
}
-GCStats* GenCollectedHeap::gc_stats(Generation* gen) const {
- return gen->gc_stats();
-}
-
void GenCollectedHeap::verify(bool silent, VerifyOption option /* ignored */) {
if (!silent) {
gclog_or_tty->print("%s", _old_gen->name());
gclog_or_tty->print(" ");
}
< prev index next >