< prev index next >
src/share/vm/gc/shared/genCollectedHeap.cpp
Print this page
@@ -28,10 +28,11 @@
#include "classfile/vmSymbols.hpp"
#include "code/codeCache.hpp"
#include "code/icBuffer.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
#include "gc/shared/collectorCounters.hpp"
+#include "gc/shared/gcId.hpp"
#include "gc/shared/gcLocker.inline.hpp"
#include "gc/shared/gcTrace.hpp"
#include "gc/shared/gcTraceTime.hpp"
#include "gc/shared/genCollectedHeap.hpp"
#include "gc/shared/genOopClosures.inline.hpp"
@@ -313,13 +314,11 @@
void GenCollectedHeap::collect_generation(Generation* gen, bool full, size_t size,
bool is_tlab, bool run_verification, bool clear_soft_refs,
bool restore_marks_for_biased_locking) {
// Timer for individual generations. Last argument is false: no CR
// FIXME: We should try to start the timing earlier to cover more of the GC pause
- // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
- // so we can assume here that the next GC id is what we want.
- GCTraceTime t1(gen->short_name(), PrintGCDetails, false, NULL, GCId::peek());
+ GCTraceTime t1(gen->short_name(), PrintGCDetails, false, NULL);
TraceCollectorStats tcs(gen->counters());
TraceMemoryManagerStats tmms(gen->kind(),gc_cause());
size_t prev_used = gen->used();
gen->stat_record()->invocations++;
@@ -432,10 +431,12 @@
if (GC_locker::check_active_before_gc()) {
return; // GC is disabled (e.g. JNI GetXXXCritical operation)
}
+ GCIdMark gc_id_mark;
+
const bool do_clear_all_soft_refs = clear_all_soft_refs ||
collector_policy()->should_clear_all_soft_refs();
ClearedAllSoftRefs casr(do_clear_all_soft_refs, collector_policy());
@@ -447,13 +448,11 @@
FlagSetting fl(_is_gc_active, true);
bool complete = full && (max_generation == OldGen);
const char* gc_cause_prefix = complete ? "Full GC" : "GC";
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
- // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
- // so we can assume here that the next GC id is what we want.
- GCTraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, NULL, GCId::peek());
+ GCTraceTime t(GCCauseString(gc_cause_prefix, gc_cause()), PrintGCDetails, false, NULL);
gc_prologue(complete);
increment_total_collections(complete);
size_t gch_prev_used = used();
@@ -487,10 +486,11 @@
}
bool must_restore_marks_for_biased_locking = false;
if (max_generation == OldGen && _old_gen->should_collect(full, size, is_tlab)) {
+ GCIdMark gc_id_mark;
if (!complete) {
// The full_collections increment was missed above.
increment_total_full_collections();
}
< prev index next >