mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
Merge
This commit is contained in:
commit
8cdd97938c
33 changed files with 779 additions and 196 deletions
|
@ -57,24 +57,27 @@ SA_LFLAGS += -mt -xnolib -norunpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# The libproc Pstack_iter() interface changed in Nevada-B159.
|
# The libproc Pstack_iter() interface changed in Nevada-B159.
|
||||||
# This logic needs to match
|
# Use 'uname -r -v' to determine the Solaris version as per
|
||||||
|
# Solaris Nevada team request. This logic needs to match:
|
||||||
# agent/src/os/solaris/proc/saproc.cpp: set_has_newer_Pstack_iter():
|
# agent/src/os/solaris/proc/saproc.cpp: set_has_newer_Pstack_iter():
|
||||||
# - skip SunOS 4 or older
|
# - skip SunOS 4 or older
|
||||||
# - skip Solaris 10 or older
|
# - skip Solaris 10 or older
|
||||||
# - skip two digit Nevada builds
|
# - skip two digit internal Nevada builds
|
||||||
# - skip three digit Nevada builds thru 149
|
# - skip three digit internal Nevada builds thru 149
|
||||||
# - skip Nevada builds 150-158
|
# - skip internal Nevada builds 150-158
|
||||||
|
# - if not skipped, print define for Nevada-B159 or later
|
||||||
SOLARIS_11_B159_OR_LATER := \
|
SOLARIS_11_B159_OR_LATER := \
|
||||||
$(shell uname -r -v \
|
$(shell uname -r -v \
|
||||||
| sed -n ' \
|
| sed -n \
|
||||||
/^[0-3]\. /b \
|
-e '/^[0-4]\. /b' \
|
||||||
/^5\.[0-9] /b \
|
-e '/^5\.[0-9] /b' \
|
||||||
/^5\.10 /b \
|
-e '/^5\.10 /b' \
|
||||||
/ snv_[0-9][0-9]$/b \
|
-e '/ snv_[0-9][0-9]$/b' \
|
||||||
/ snv_[01][0-4][0-9]$/b \
|
-e '/ snv_[01][0-4][0-9]$/b' \
|
||||||
/ snv_15[0-8]$/b \
|
-e '/ snv_15[0-8]$/b' \
|
||||||
s/.*/-DSOLARIS_11_B159_OR_LATER/p \
|
-e 's/.*/-DSOLARIS_11_B159_OR_LATER/' \
|
||||||
')
|
-e 'p' \
|
||||||
|
)
|
||||||
|
|
||||||
# Uncomment the following to simulate building on Nevada-B159 or later
|
# Uncomment the following to simulate building on Nevada-B159 or later
|
||||||
# when actually building on Nevada-B158 or earlier:
|
# when actually building on Nevada-B158 or earlier:
|
||||||
|
|
|
@ -2850,7 +2850,7 @@ bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) {
|
||||||
char chars[257];
|
char chars[257];
|
||||||
long x = 0;
|
long x = 0;
|
||||||
if (fgets(chars, sizeof(chars), fp)) {
|
if (fgets(chars, sizeof(chars), fp)) {
|
||||||
if (sscanf(chars, "%lx-%*lx", &x) == 1
|
if (sscanf(chars, "%lx-%*x", &x) == 1
|
||||||
&& x == (long)p) {
|
&& x == (long)p) {
|
||||||
if (strstr (chars, "hugepage")) {
|
if (strstr (chars, "hugepage")) {
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -473,6 +473,13 @@
|
||||||
template(sun_management_ManagementFactory, "sun/management/ManagementFactory") \
|
template(sun_management_ManagementFactory, "sun/management/ManagementFactory") \
|
||||||
template(sun_management_Sensor, "sun/management/Sensor") \
|
template(sun_management_Sensor, "sun/management/Sensor") \
|
||||||
template(sun_management_Agent, "sun/management/Agent") \
|
template(sun_management_Agent, "sun/management/Agent") \
|
||||||
|
template(sun_management_GarbageCollectorImpl, "sun/management/GarbageCollectorImpl") \
|
||||||
|
template(getGcInfoBuilder_name, "getGcInfoBuilder") \
|
||||||
|
template(getGcInfoBuilder_signature, "()Lsun/management/GcInfoBuilder;") \
|
||||||
|
template(com_sun_management_GcInfo, "com/sun/management/GcInfo") \
|
||||||
|
template(com_sun_management_GcInfo_constructor_signature, "(Lsun/management/GcInfoBuilder;JJJ[Ljava/lang/management/MemoryUsage;[Ljava/lang/management/MemoryUsage;[Ljava/lang/Object;)V") \
|
||||||
|
template(createGCNotification_name, "createGCNotification") \
|
||||||
|
template(createGCNotification_signature, "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/sun/management/GcInfo;)V") \
|
||||||
template(createMemoryPoolMBean_name, "createMemoryPoolMBean") \
|
template(createMemoryPoolMBean_name, "createMemoryPoolMBean") \
|
||||||
template(createMemoryManagerMBean_name, "createMemoryManagerMBean") \
|
template(createMemoryManagerMBean_name, "createMemoryManagerMBean") \
|
||||||
template(createGarbageCollectorMBean_name, "createGarbageCollectorMBean") \
|
template(createGarbageCollectorMBean_name, "createGarbageCollectorMBean") \
|
||||||
|
@ -490,6 +497,7 @@
|
||||||
template(java_lang_management_MemoryPoolMXBean, "java/lang/management/MemoryPoolMXBean") \
|
template(java_lang_management_MemoryPoolMXBean, "java/lang/management/MemoryPoolMXBean") \
|
||||||
template(java_lang_management_MemoryManagerMXBean, "java/lang/management/MemoryManagerMXBean") \
|
template(java_lang_management_MemoryManagerMXBean, "java/lang/management/MemoryManagerMXBean") \
|
||||||
template(java_lang_management_GarbageCollectorMXBean,"java/lang/management/GarbageCollectorMXBean") \
|
template(java_lang_management_GarbageCollectorMXBean,"java/lang/management/GarbageCollectorMXBean") \
|
||||||
|
template(gcInfoBuilder_name, "gcInfoBuilder") \
|
||||||
template(createMemoryPool_name, "createMemoryPool") \
|
template(createMemoryPool_name, "createMemoryPool") \
|
||||||
template(createMemoryManager_name, "createMemoryManager") \
|
template(createMemoryManager_name, "createMemoryManager") \
|
||||||
template(createGarbageCollector_name, "createGarbageCollector") \
|
template(createGarbageCollector_name, "createGarbageCollector") \
|
||||||
|
|
|
@ -2026,7 +2026,7 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TraceCMSMemoryManagerStats();
|
TraceCMSMemoryManagerStats tmms(gch->gc_cause());
|
||||||
}
|
}
|
||||||
GenMarkSweep::invoke_at_safepoint(_cmsGen->level(),
|
GenMarkSweep::invoke_at_safepoint(_cmsGen->level(),
|
||||||
ref_processor(), clear_all_soft_refs);
|
ref_processor(), clear_all_soft_refs);
|
||||||
|
@ -3479,7 +3479,7 @@ CMSPhaseAccounting::~CMSPhaseAccounting() {
|
||||||
void CMSCollector::checkpointRootsInitial(bool asynch) {
|
void CMSCollector::checkpointRootsInitial(bool asynch) {
|
||||||
assert(_collectorState == InitialMarking, "Wrong collector state");
|
assert(_collectorState == InitialMarking, "Wrong collector state");
|
||||||
check_correct_thread_executing();
|
check_correct_thread_executing();
|
||||||
TraceCMSMemoryManagerStats tms(_collectorState);
|
TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
|
||||||
|
|
||||||
ReferenceProcessor* rp = ref_processor();
|
ReferenceProcessor* rp = ref_processor();
|
||||||
SpecializationStats::clear();
|
SpecializationStats::clear();
|
||||||
|
@ -4858,7 +4858,8 @@ void CMSCollector::checkpointRootsFinal(bool asynch,
|
||||||
// world is stopped at this checkpoint
|
// world is stopped at this checkpoint
|
||||||
assert(SafepointSynchronize::is_at_safepoint(),
|
assert(SafepointSynchronize::is_at_safepoint(),
|
||||||
"world should be stopped");
|
"world should be stopped");
|
||||||
TraceCMSMemoryManagerStats tms(_collectorState);
|
TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
|
||||||
|
|
||||||
verify_work_stacks_empty();
|
verify_work_stacks_empty();
|
||||||
verify_overflow_empty();
|
verify_overflow_empty();
|
||||||
|
|
||||||
|
@ -5993,7 +5994,7 @@ void CMSCollector::sweep(bool asynch) {
|
||||||
verify_work_stacks_empty();
|
verify_work_stacks_empty();
|
||||||
verify_overflow_empty();
|
verify_overflow_empty();
|
||||||
increment_sweep_count();
|
increment_sweep_count();
|
||||||
TraceCMSMemoryManagerStats tms(_collectorState);
|
TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
|
||||||
|
|
||||||
_inter_sweep_timer.stop();
|
_inter_sweep_timer.stop();
|
||||||
_inter_sweep_estimate.sample(_inter_sweep_timer.seconds());
|
_inter_sweep_estimate.sample(_inter_sweep_timer.seconds());
|
||||||
|
@ -9235,11 +9236,12 @@ size_t MarkDeadObjectsClosure::do_blk(HeapWord* addr) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorState phase): TraceMemoryManagerStats() {
|
TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorState phase, GCCause::Cause cause): TraceMemoryManagerStats() {
|
||||||
|
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case CMSCollector::InitialMarking:
|
case CMSCollector::InitialMarking:
|
||||||
initialize(true /* fullGC */ ,
|
initialize(true /* fullGC */ ,
|
||||||
|
cause /* cause of the GC */,
|
||||||
true /* recordGCBeginTime */,
|
true /* recordGCBeginTime */,
|
||||||
true /* recordPreGCUsage */,
|
true /* recordPreGCUsage */,
|
||||||
false /* recordPeakUsage */,
|
false /* recordPeakUsage */,
|
||||||
|
@ -9251,6 +9253,7 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt
|
||||||
|
|
||||||
case CMSCollector::FinalMarking:
|
case CMSCollector::FinalMarking:
|
||||||
initialize(true /* fullGC */ ,
|
initialize(true /* fullGC */ ,
|
||||||
|
cause /* cause of the GC */,
|
||||||
false /* recordGCBeginTime */,
|
false /* recordGCBeginTime */,
|
||||||
false /* recordPreGCUsage */,
|
false /* recordPreGCUsage */,
|
||||||
false /* recordPeakUsage */,
|
false /* recordPeakUsage */,
|
||||||
|
@ -9262,6 +9265,7 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt
|
||||||
|
|
||||||
case CMSCollector::Sweeping:
|
case CMSCollector::Sweeping:
|
||||||
initialize(true /* fullGC */ ,
|
initialize(true /* fullGC */ ,
|
||||||
|
cause /* cause of the GC */,
|
||||||
false /* recordGCBeginTime */,
|
false /* recordGCBeginTime */,
|
||||||
false /* recordPreGCUsage */,
|
false /* recordPreGCUsage */,
|
||||||
true /* recordPeakUsage */,
|
true /* recordPeakUsage */,
|
||||||
|
@ -9277,8 +9281,9 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt
|
||||||
}
|
}
|
||||||
|
|
||||||
// when bailing out of cms in concurrent mode failure
|
// when bailing out of cms in concurrent mode failure
|
||||||
TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(): TraceMemoryManagerStats() {
|
TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(GCCause::Cause cause): TraceMemoryManagerStats() {
|
||||||
initialize(true /* fullGC */ ,
|
initialize(true /* fullGC */ ,
|
||||||
|
cause /* cause of the GC */,
|
||||||
true /* recordGCBeginTime */,
|
true /* recordGCBeginTime */,
|
||||||
true /* recordPreGCUsage */,
|
true /* recordPreGCUsage */,
|
||||||
true /* recordPeakUsage */,
|
true /* recordPeakUsage */,
|
||||||
|
|
|
@ -1895,8 +1895,8 @@ public:
|
||||||
class TraceCMSMemoryManagerStats : public TraceMemoryManagerStats {
|
class TraceCMSMemoryManagerStats : public TraceMemoryManagerStats {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TraceCMSMemoryManagerStats(CMSCollector::CollectorState phase);
|
TraceCMSMemoryManagerStats(CMSCollector::CollectorState phase, GCCause::Cause cause);
|
||||||
TraceCMSMemoryManagerStats();
|
TraceCMSMemoryManagerStats(GCCause::Cause cause);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1162,7 +1162,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
|
||||||
PrintGC, true, gclog_or_tty);
|
PrintGC, true, gclog_or_tty);
|
||||||
|
|
||||||
TraceCollectorStats tcs(g1mm()->full_collection_counters());
|
TraceCollectorStats tcs(g1mm()->full_collection_counters());
|
||||||
TraceMemoryManagerStats tms(true /* fullGC */);
|
TraceMemoryManagerStats tms(true /* fullGC */, gc_cause());
|
||||||
|
|
||||||
double start = os::elapsedTime();
|
double start = os::elapsedTime();
|
||||||
g1_policy()->record_full_collection_start();
|
g1_policy()->record_full_collection_start();
|
||||||
|
@ -3202,7 +3202,7 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||||
TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty);
|
TraceTime t(verbose_str, PrintGC && !PrintGCDetails, true, gclog_or_tty);
|
||||||
|
|
||||||
TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
|
TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
|
||||||
TraceMemoryManagerStats tms(false /* fullGC */);
|
TraceMemoryManagerStats tms(false /* fullGC */, gc_cause());
|
||||||
|
|
||||||
// If the secondary_free_list is not empty, append it to the
|
// If the secondary_free_list is not empty, append it to the
|
||||||
// free_list. No need to wait for the cleanup operation to finish;
|
// free_list. No need to wait for the cleanup operation to finish;
|
||||||
|
|
|
@ -29,13 +29,14 @@
|
||||||
#include "memory/sharedHeap.hpp"
|
#include "memory/sharedHeap.hpp"
|
||||||
#include "memory/space.inline.hpp"
|
#include "memory/space.inline.hpp"
|
||||||
#include "memory/universe.hpp"
|
#include "memory/universe.hpp"
|
||||||
|
#include "oops/oop.inline.hpp"
|
||||||
#include "runtime/java.hpp"
|
#include "runtime/java.hpp"
|
||||||
#include "runtime/mutexLocker.hpp"
|
#include "runtime/mutexLocker.hpp"
|
||||||
#include "runtime/virtualspace.hpp"
|
#include "runtime/virtualspace.hpp"
|
||||||
|
|
||||||
void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
|
void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
|
||||||
DirtyCardToOopClosure* dcto_cl,
|
OopsInGenClosure* cl,
|
||||||
ClearNoncleanCardWrapper* cl,
|
CardTableRS* ct,
|
||||||
int n_threads) {
|
int n_threads) {
|
||||||
assert(n_threads > 0, "Error: expected n_threads > 0");
|
assert(n_threads > 0, "Error: expected n_threads > 0");
|
||||||
assert((n_threads == 1 && ParallelGCThreads == 0) ||
|
assert((n_threads == 1 && ParallelGCThreads == 0) ||
|
||||||
|
@ -49,14 +50,14 @@ void CardTableModRefBS::non_clean_card_iterate_parallel_work(Space* sp, MemRegio
|
||||||
lowest_non_clean_base_chunk_index,
|
lowest_non_clean_base_chunk_index,
|
||||||
lowest_non_clean_chunk_size);
|
lowest_non_clean_chunk_size);
|
||||||
|
|
||||||
int n_strides = n_threads * StridesPerThread;
|
int n_strides = n_threads * ParGCStridesPerThread;
|
||||||
SequentialSubTasksDone* pst = sp->par_seq_tasks();
|
SequentialSubTasksDone* pst = sp->par_seq_tasks();
|
||||||
pst->set_n_threads(n_threads);
|
pst->set_n_threads(n_threads);
|
||||||
pst->set_n_tasks(n_strides);
|
pst->set_n_tasks(n_strides);
|
||||||
|
|
||||||
int stride = 0;
|
int stride = 0;
|
||||||
while (!pst->is_task_claimed(/* reference */ stride)) {
|
while (!pst->is_task_claimed(/* reference */ stride)) {
|
||||||
process_stride(sp, mr, stride, n_strides, dcto_cl, cl,
|
process_stride(sp, mr, stride, n_strides, cl, ct,
|
||||||
lowest_non_clean,
|
lowest_non_clean,
|
||||||
lowest_non_clean_base_chunk_index,
|
lowest_non_clean_base_chunk_index,
|
||||||
lowest_non_clean_chunk_size);
|
lowest_non_clean_chunk_size);
|
||||||
|
@ -79,13 +80,13 @@ CardTableModRefBS::
|
||||||
process_stride(Space* sp,
|
process_stride(Space* sp,
|
||||||
MemRegion used,
|
MemRegion used,
|
||||||
jint stride, int n_strides,
|
jint stride, int n_strides,
|
||||||
DirtyCardToOopClosure* dcto_cl,
|
OopsInGenClosure* cl,
|
||||||
ClearNoncleanCardWrapper* cl,
|
CardTableRS* ct,
|
||||||
jbyte** lowest_non_clean,
|
jbyte** lowest_non_clean,
|
||||||
uintptr_t lowest_non_clean_base_chunk_index,
|
uintptr_t lowest_non_clean_base_chunk_index,
|
||||||
size_t lowest_non_clean_chunk_size) {
|
size_t lowest_non_clean_chunk_size) {
|
||||||
// We don't have to go downwards here; it wouldn't help anyway,
|
// We go from higher to lower addresses here; it wouldn't help that much
|
||||||
// because of parallelism.
|
// because of the strided parallelism pattern used here.
|
||||||
|
|
||||||
// Find the first card address of the first chunk in the stride that is
|
// Find the first card address of the first chunk in the stride that is
|
||||||
// at least "bottom" of the used region.
|
// at least "bottom" of the used region.
|
||||||
|
@ -98,25 +99,35 @@ process_stride(Space* sp,
|
||||||
if ((uintptr_t)stride >= start_chunk_stride_num) {
|
if ((uintptr_t)stride >= start_chunk_stride_num) {
|
||||||
chunk_card_start = (jbyte*)(start_card +
|
chunk_card_start = (jbyte*)(start_card +
|
||||||
(stride - start_chunk_stride_num) *
|
(stride - start_chunk_stride_num) *
|
||||||
CardsPerStrideChunk);
|
ParGCCardsPerStrideChunk);
|
||||||
} else {
|
} else {
|
||||||
// Go ahead to the next chunk group boundary, then to the requested stride.
|
// Go ahead to the next chunk group boundary, then to the requested stride.
|
||||||
chunk_card_start = (jbyte*)(start_card +
|
chunk_card_start = (jbyte*)(start_card +
|
||||||
(n_strides - start_chunk_stride_num + stride) *
|
(n_strides - start_chunk_stride_num + stride) *
|
||||||
CardsPerStrideChunk);
|
ParGCCardsPerStrideChunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (chunk_card_start < end_card) {
|
while (chunk_card_start < end_card) {
|
||||||
// We don't have to go downwards here; it wouldn't help anyway,
|
// Even though we go from lower to higher addresses below, the
|
||||||
// because of parallelism. (We take care with "min_done"; see below.)
|
// strided parallelism can interleave the actual processing of the
|
||||||
|
// dirty pages in various ways. For a specific chunk within this
|
||||||
|
// stride, we take care to avoid double scanning or missing a card
|
||||||
|
// by suitably initializing the "min_done" field in process_chunk_boundaries()
|
||||||
|
// below, together with the dirty region extension accomplished in
|
||||||
|
// DirtyCardToOopClosure::do_MemRegion().
|
||||||
|
jbyte* chunk_card_end = chunk_card_start + ParGCCardsPerStrideChunk;
|
||||||
// Invariant: chunk_mr should be fully contained within the "used" region.
|
// Invariant: chunk_mr should be fully contained within the "used" region.
|
||||||
jbyte* chunk_card_end = chunk_card_start + CardsPerStrideChunk;
|
|
||||||
MemRegion chunk_mr = MemRegion(addr_for(chunk_card_start),
|
MemRegion chunk_mr = MemRegion(addr_for(chunk_card_start),
|
||||||
chunk_card_end >= end_card ?
|
chunk_card_end >= end_card ?
|
||||||
used.end() : addr_for(chunk_card_end));
|
used.end() : addr_for(chunk_card_end));
|
||||||
assert(chunk_mr.word_size() > 0, "[chunk_card_start > used_end)");
|
assert(chunk_mr.word_size() > 0, "[chunk_card_start > used_end)");
|
||||||
assert(used.contains(chunk_mr), "chunk_mr should be subset of used");
|
assert(used.contains(chunk_mr), "chunk_mr should be subset of used");
|
||||||
|
|
||||||
|
DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(),
|
||||||
|
cl->gen_boundary());
|
||||||
|
ClearNoncleanCardWrapper clear_cl(dcto_cl, ct);
|
||||||
|
|
||||||
|
|
||||||
// Process the chunk.
|
// Process the chunk.
|
||||||
process_chunk_boundaries(sp,
|
process_chunk_boundaries(sp,
|
||||||
dcto_cl,
|
dcto_cl,
|
||||||
|
@ -126,17 +137,30 @@ process_stride(Space* sp,
|
||||||
lowest_non_clean_base_chunk_index,
|
lowest_non_clean_base_chunk_index,
|
||||||
lowest_non_clean_chunk_size);
|
lowest_non_clean_chunk_size);
|
||||||
|
|
||||||
|
// We want the LNC array updates above in process_chunk_boundaries
|
||||||
|
// to be visible before any of the card table value changes as a
|
||||||
|
// result of the dirty card iteration below.
|
||||||
|
OrderAccess::storestore();
|
||||||
|
|
||||||
// We do not call the non_clean_card_iterate_serial() version because
|
// We do not call the non_clean_card_iterate_serial() version because
|
||||||
// we want to clear the cards, and the ClearNoncleanCardWrapper closure
|
// we want to clear the cards: clear_cl here does the work of finding
|
||||||
// itself does the work of finding contiguous dirty ranges of cards to
|
// contiguous dirty ranges of cards to process and clear.
|
||||||
// process (and clear).
|
clear_cl.do_MemRegion(chunk_mr);
|
||||||
cl->do_MemRegion(chunk_mr);
|
|
||||||
|
|
||||||
// Find the next chunk of the stride.
|
// Find the next chunk of the stride.
|
||||||
chunk_card_start += CardsPerStrideChunk * n_strides;
|
chunk_card_start += ParGCCardsPerStrideChunk * n_strides;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// If you want a talkative process_chunk_boundaries,
|
||||||
|
// then #define NOISY(x) x
|
||||||
|
#ifdef NOISY
|
||||||
|
#error "Encountered a global preprocessor flag, NOISY, which might clash with local definition to follow"
|
||||||
|
#else
|
||||||
|
#define NOISY(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
CardTableModRefBS::
|
CardTableModRefBS::
|
||||||
process_chunk_boundaries(Space* sp,
|
process_chunk_boundaries(Space* sp,
|
||||||
|
@ -147,127 +171,233 @@ process_chunk_boundaries(Space* sp,
|
||||||
uintptr_t lowest_non_clean_base_chunk_index,
|
uintptr_t lowest_non_clean_base_chunk_index,
|
||||||
size_t lowest_non_clean_chunk_size)
|
size_t lowest_non_clean_chunk_size)
|
||||||
{
|
{
|
||||||
// We must worry about the chunk boundaries.
|
// We must worry about non-array objects that cross chunk boundaries,
|
||||||
|
// because such objects are both precisely and imprecisely marked:
|
||||||
|
// .. if the head of such an object is dirty, the entire object
|
||||||
|
// needs to be scanned, under the interpretation that this
|
||||||
|
// was an imprecise mark
|
||||||
|
// .. if the head of such an object is not dirty, we can assume
|
||||||
|
// precise marking and it's efficient to scan just the dirty
|
||||||
|
// cards.
|
||||||
|
// In either case, each scanned reference must be scanned precisely
|
||||||
|
// once so as to avoid cloning of a young referent. For efficiency,
|
||||||
|
// our closures depend on this property and do not protect against
|
||||||
|
// double scans.
|
||||||
|
|
||||||
// First, set our max_to_do:
|
|
||||||
HeapWord* max_to_do = NULL;
|
|
||||||
uintptr_t cur_chunk_index = addr_to_chunk_index(chunk_mr.start());
|
uintptr_t cur_chunk_index = addr_to_chunk_index(chunk_mr.start());
|
||||||
cur_chunk_index = cur_chunk_index - lowest_non_clean_base_chunk_index;
|
cur_chunk_index = cur_chunk_index - lowest_non_clean_base_chunk_index;
|
||||||
|
|
||||||
if (chunk_mr.end() < used.end()) {
|
NOISY(tty->print_cr("===========================================================================");)
|
||||||
// This is not the last chunk in the used region. What is the last
|
NOISY(tty->print_cr(" process_chunk_boundary: Called with [" PTR_FORMAT "," PTR_FORMAT ")",
|
||||||
// object?
|
chunk_mr.start(), chunk_mr.end());)
|
||||||
HeapWord* last_block = sp->block_start(chunk_mr.end());
|
|
||||||
assert(last_block <= chunk_mr.end(), "In case this property changes.");
|
|
||||||
if (last_block == chunk_mr.end()
|
|
||||||
|| !sp->block_is_obj(last_block)) {
|
|
||||||
max_to_do = chunk_mr.end();
|
|
||||||
|
|
||||||
|
// First, set "our" lowest_non_clean entry, which would be
|
||||||
|
// used by the thread scanning an adjoining left chunk with
|
||||||
|
// a non-array object straddling the mutual boundary.
|
||||||
|
// Find the object that spans our boundary, if one exists.
|
||||||
|
// first_block is the block possibly straddling our left boundary.
|
||||||
|
HeapWord* first_block = sp->block_start(chunk_mr.start());
|
||||||
|
assert((chunk_mr.start() != used.start()) || (first_block == chunk_mr.start()),
|
||||||
|
"First chunk should always have a co-initial block");
|
||||||
|
// Does the block straddle the chunk's left boundary, and is it
|
||||||
|
// a non-array object?
|
||||||
|
if (first_block < chunk_mr.start() // first block straddles left bdry
|
||||||
|
&& sp->block_is_obj(first_block) // first block is an object
|
||||||
|
&& !(oop(first_block)->is_objArray() // first block is not an array (arrays are precisely dirtied)
|
||||||
|
|| oop(first_block)->is_typeArray())) {
|
||||||
|
// Find our least non-clean card, so that a left neighbour
|
||||||
|
// does not scan an object straddling the mutual boundary
|
||||||
|
// too far to the right, and attempt to scan a portion of
|
||||||
|
// that object twice.
|
||||||
|
jbyte* first_dirty_card = NULL;
|
||||||
|
jbyte* last_card_of_first_obj =
|
||||||
|
byte_for(first_block + sp->block_size(first_block) - 1);
|
||||||
|
jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start());
|
||||||
|
jbyte* last_card_of_cur_chunk = byte_for(chunk_mr.last());
|
||||||
|
jbyte* last_card_to_check =
|
||||||
|
(jbyte*) MIN2((intptr_t) last_card_of_cur_chunk,
|
||||||
|
(intptr_t) last_card_of_first_obj);
|
||||||
|
// Note that this does not need to go beyond our last card
|
||||||
|
// if our first object completely straddles this chunk.
|
||||||
|
for (jbyte* cur = first_card_of_cur_chunk;
|
||||||
|
cur <= last_card_to_check; cur++) {
|
||||||
|
jbyte val = *cur;
|
||||||
|
if (card_will_be_scanned(val)) {
|
||||||
|
first_dirty_card = cur; break;
|
||||||
|
} else {
|
||||||
|
assert(!card_may_have_been_dirty(val), "Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (first_dirty_card != NULL) {
|
||||||
|
NOISY(tty->print_cr(" LNC: Found a dirty card at " PTR_FORMAT " in current chunk",
|
||||||
|
first_dirty_card);)
|
||||||
|
assert(0 <= cur_chunk_index && cur_chunk_index < lowest_non_clean_chunk_size,
|
||||||
|
"Bounds error.");
|
||||||
|
assert(lowest_non_clean[cur_chunk_index] == NULL,
|
||||||
|
"Write exactly once : value should be stable hereafter for this round");
|
||||||
|
lowest_non_clean[cur_chunk_index] = first_dirty_card;
|
||||||
|
} NOISY(else {
|
||||||
|
tty->print_cr(" LNC: Found no dirty card in current chunk; leaving LNC entry NULL");
|
||||||
|
// In the future, we could have this thread look for a non-NULL value to copy from its
|
||||||
|
// right neighbour (up to the end of the first object).
|
||||||
|
if (last_card_of_cur_chunk < last_card_of_first_obj) {
|
||||||
|
tty->print_cr(" LNC: BEWARE!!! first obj straddles past right end of chunk:\n"
|
||||||
|
" might be efficient to get value from right neighbour?");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
// In this case we can help our neighbour by just asking them
|
||||||
|
// to stop at our first card (even though it may not be dirty).
|
||||||
|
NOISY(tty->print_cr(" LNC: first block is not a non-array object; setting LNC to first card of current chunk");)
|
||||||
|
assert(lowest_non_clean[cur_chunk_index] == NULL, "Write once : value should be stable hereafter");
|
||||||
|
jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start());
|
||||||
|
lowest_non_clean[cur_chunk_index] = first_card_of_cur_chunk;
|
||||||
|
}
|
||||||
|
NOISY(tty->print_cr(" process_chunk_boundary: lowest_non_clean[" INTPTR_FORMAT "] = " PTR_FORMAT
|
||||||
|
" which corresponds to the heap address " PTR_FORMAT,
|
||||||
|
cur_chunk_index, lowest_non_clean[cur_chunk_index],
|
||||||
|
(lowest_non_clean[cur_chunk_index] != NULL)
|
||||||
|
? addr_for(lowest_non_clean[cur_chunk_index])
|
||||||
|
: NULL);)
|
||||||
|
NOISY(tty->print_cr("---------------------------------------------------------------------------");)
|
||||||
|
|
||||||
|
// Next, set our own max_to_do, which will strictly/exclusively bound
|
||||||
|
// the highest address that we will scan past the right end of our chunk.
|
||||||
|
HeapWord* max_to_do = NULL;
|
||||||
|
if (chunk_mr.end() < used.end()) {
|
||||||
|
// This is not the last chunk in the used region.
|
||||||
|
// What is our last block? We check the first block of
|
||||||
|
// the next (right) chunk rather than strictly check our last block
|
||||||
|
// because it's potentially more efficient to do so.
|
||||||
|
HeapWord* const last_block = sp->block_start(chunk_mr.end());
|
||||||
|
assert(last_block <= chunk_mr.end(), "In case this property changes.");
|
||||||
|
if ((last_block == chunk_mr.end()) // our last block does not straddle boundary
|
||||||
|
|| !sp->block_is_obj(last_block) // last_block isn't an object
|
||||||
|
|| oop(last_block)->is_objArray() // last_block is an array (precisely marked)
|
||||||
|
|| oop(last_block)->is_typeArray()) {
|
||||||
|
max_to_do = chunk_mr.end();
|
||||||
|
NOISY(tty->print_cr(" process_chunk_boundary: Last block on this card is not a non-array object;\n"
|
||||||
|
" max_to_do left at " PTR_FORMAT, max_to_do);)
|
||||||
} else {
|
} else {
|
||||||
// It is an object and starts before the end of the current chunk.
|
assert(last_block < chunk_mr.end(), "Tautology");
|
||||||
|
// It is a non-array object that straddles the right boundary of this chunk.
|
||||||
// last_obj_card is the card corresponding to the start of the last object
|
// last_obj_card is the card corresponding to the start of the last object
|
||||||
// in the chunk. Note that the last object may not start in
|
// in the chunk. Note that the last object may not start in
|
||||||
// the chunk.
|
// the chunk.
|
||||||
jbyte* last_obj_card = byte_for(last_block);
|
jbyte* const last_obj_card = byte_for(last_block);
|
||||||
if (!card_may_have_been_dirty(*last_obj_card)) {
|
const jbyte val = *last_obj_card;
|
||||||
// The card containing the head is not dirty. Any marks in
|
if (!card_will_be_scanned(val)) {
|
||||||
|
assert(!card_may_have_been_dirty(val), "Error");
|
||||||
|
// The card containing the head is not dirty. Any marks on
|
||||||
// subsequent cards still in this chunk must have been made
|
// subsequent cards still in this chunk must have been made
|
||||||
// precisely; we can cap processing at the end.
|
// precisely; we can cap processing at the end of our chunk.
|
||||||
max_to_do = chunk_mr.end();
|
max_to_do = chunk_mr.end();
|
||||||
|
NOISY(tty->print_cr(" process_chunk_boundary: Head of last object on this card is not dirty;\n"
|
||||||
|
" max_to_do left at " PTR_FORMAT,
|
||||||
|
max_to_do);)
|
||||||
} else {
|
} else {
|
||||||
// The last object must be considered dirty, and extends onto the
|
// The last object must be considered dirty, and extends onto the
|
||||||
// following chunk. Look for a dirty card in that chunk that will
|
// following chunk. Look for a dirty card in that chunk that will
|
||||||
// bound our processing.
|
// bound our processing.
|
||||||
jbyte* limit_card = NULL;
|
jbyte* limit_card = NULL;
|
||||||
size_t last_block_size = sp->block_size(last_block);
|
const size_t last_block_size = sp->block_size(last_block);
|
||||||
jbyte* last_card_of_last_obj =
|
jbyte* const last_card_of_last_obj =
|
||||||
byte_for(last_block + last_block_size - 1);
|
byte_for(last_block + last_block_size - 1);
|
||||||
jbyte* first_card_of_next_chunk = byte_for(chunk_mr.end());
|
jbyte* const first_card_of_next_chunk = byte_for(chunk_mr.end());
|
||||||
// This search potentially goes a long distance looking
|
// This search potentially goes a long distance looking
|
||||||
// for the next card that will be scanned. For example,
|
// for the next card that will be scanned, terminating
|
||||||
// an object that is an array of primitives will not
|
// at the end of the last_block, if no earlier dirty card
|
||||||
// have any cards covering regions interior to the array
|
// is found.
|
||||||
// that will need to be scanned. The scan can be terminated
|
assert(byte_for(chunk_mr.end()) - byte_for(chunk_mr.start()) == ParGCCardsPerStrideChunk,
|
||||||
// at the last card of the next chunk. That would leave
|
"last card of next chunk may be wrong");
|
||||||
// limit_card as NULL and would result in "max_to_do"
|
|
||||||
// being set with the LNC value or with the end
|
|
||||||
// of the last block.
|
|
||||||
jbyte* last_card_of_next_chunk = first_card_of_next_chunk +
|
|
||||||
CardsPerStrideChunk;
|
|
||||||
assert(byte_for(chunk_mr.end()) - byte_for(chunk_mr.start())
|
|
||||||
== CardsPerStrideChunk, "last card of next chunk may be wrong");
|
|
||||||
jbyte* last_card_to_check = (jbyte*) MIN2(last_card_of_last_obj,
|
|
||||||
last_card_of_next_chunk);
|
|
||||||
for (jbyte* cur = first_card_of_next_chunk;
|
for (jbyte* cur = first_card_of_next_chunk;
|
||||||
cur <= last_card_to_check; cur++) {
|
cur <= last_card_of_last_obj; cur++) {
|
||||||
if (card_will_be_scanned(*cur)) {
|
const jbyte val = *cur;
|
||||||
|
if (card_will_be_scanned(val)) {
|
||||||
|
NOISY(tty->print_cr(" Found a non-clean card " PTR_FORMAT " with value 0x%x",
|
||||||
|
cur, (int)val);)
|
||||||
limit_card = cur; break;
|
limit_card = cur; break;
|
||||||
|
} else {
|
||||||
|
assert(!card_may_have_been_dirty(val), "Error: card can't be skipped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(0 <= cur_chunk_index+1 &&
|
|
||||||
cur_chunk_index+1 < lowest_non_clean_chunk_size,
|
|
||||||
"Bounds error.");
|
|
||||||
// LNC for the next chunk
|
|
||||||
jbyte* lnc_card = lowest_non_clean[cur_chunk_index+1];
|
|
||||||
if (limit_card == NULL) {
|
|
||||||
limit_card = lnc_card;
|
|
||||||
}
|
|
||||||
if (limit_card != NULL) {
|
if (limit_card != NULL) {
|
||||||
if (lnc_card != NULL) {
|
|
||||||
limit_card = (jbyte*)MIN2((intptr_t)limit_card,
|
|
||||||
(intptr_t)lnc_card);
|
|
||||||
}
|
|
||||||
max_to_do = addr_for(limit_card);
|
max_to_do = addr_for(limit_card);
|
||||||
|
assert(limit_card != NULL && max_to_do != NULL, "Error");
|
||||||
|
NOISY(tty->print_cr(" process_chunk_boundary: Found a dirty card at " PTR_FORMAT
|
||||||
|
" max_to_do set at " PTR_FORMAT " which is before end of last block in chunk: "
|
||||||
|
PTR_FORMAT " + " PTR_FORMAT " = " PTR_FORMAT,
|
||||||
|
limit_card, max_to_do, last_block, last_block_size, (last_block+last_block_size));)
|
||||||
} else {
|
} else {
|
||||||
|
// The following is a pessimistic value, because it's possible
|
||||||
|
// that a dirty card on a subsequent chunk has been cleared by
|
||||||
|
// the time we get to look at it; we'll correct for that further below,
|
||||||
|
// using the LNC array which records the least non-clean card
|
||||||
|
// before cards were cleared in a particular chunk.
|
||||||
|
limit_card = last_card_of_last_obj;
|
||||||
max_to_do = last_block + last_block_size;
|
max_to_do = last_block + last_block_size;
|
||||||
|
assert(limit_card != NULL && max_to_do != NULL, "Error");
|
||||||
|
NOISY(tty->print_cr(" process_chunk_boundary: Found no dirty card before end of last block in chunk\n"
|
||||||
|
" Setting limit_card to " PTR_FORMAT
|
||||||
|
" and max_to_do " PTR_FORMAT " + " PTR_FORMAT " = " PTR_FORMAT,
|
||||||
|
limit_card, last_block, last_block_size, max_to_do);)
|
||||||
}
|
}
|
||||||
|
assert(0 < cur_chunk_index+1 && cur_chunk_index+1 < lowest_non_clean_chunk_size,
|
||||||
|
"Bounds error.");
|
||||||
|
// It is possible that a dirty card for the last object may have been
|
||||||
|
// cleared before we had a chance to examine it. In that case, the value
|
||||||
|
// will have been logged in the LNC for that chunk.
|
||||||
|
// We need to examine as many chunks to the right as this object
|
||||||
|
// covers.
|
||||||
|
const uintptr_t last_chunk_index_to_check = addr_to_chunk_index(last_block + last_block_size - 1)
|
||||||
|
- lowest_non_clean_base_chunk_index;
|
||||||
|
DEBUG_ONLY(const uintptr_t last_chunk_index = addr_to_chunk_index(used.last())
|
||||||
|
- lowest_non_clean_base_chunk_index;)
|
||||||
|
assert(last_chunk_index_to_check <= last_chunk_index,
|
||||||
|
err_msg("Out of bounds: last_chunk_index_to_check " INTPTR_FORMAT
|
||||||
|
" exceeds last_chunk_index " INTPTR_FORMAT,
|
||||||
|
last_chunk_index_to_check, last_chunk_index));
|
||||||
|
for (uintptr_t lnc_index = cur_chunk_index + 1;
|
||||||
|
lnc_index <= last_chunk_index_to_check;
|
||||||
|
lnc_index++) {
|
||||||
|
jbyte* lnc_card = lowest_non_clean[lnc_index];
|
||||||
|
if (lnc_card != NULL) {
|
||||||
|
// we can stop at the first non-NULL entry we find
|
||||||
|
if (lnc_card <= limit_card) {
|
||||||
|
NOISY(tty->print_cr(" process_chunk_boundary: LNC card " PTR_FORMAT " is lower than limit_card " PTR_FORMAT,
|
||||||
|
" max_to_do will be lowered to " PTR_FORMAT " from " PTR_FORMAT,
|
||||||
|
lnc_card, limit_card, addr_for(lnc_card), max_to_do);)
|
||||||
|
limit_card = lnc_card;
|
||||||
|
max_to_do = addr_for(limit_card);
|
||||||
|
assert(limit_card != NULL && max_to_do != NULL, "Error");
|
||||||
|
}
|
||||||
|
// In any case, we break now
|
||||||
|
break;
|
||||||
|
} // else continue to look for a non-NULL entry if any
|
||||||
|
}
|
||||||
|
assert(limit_card != NULL && max_to_do != NULL, "Error");
|
||||||
}
|
}
|
||||||
|
assert(max_to_do != NULL, "OOPS 1 !");
|
||||||
}
|
}
|
||||||
assert(max_to_do != NULL, "OOPS!");
|
assert(max_to_do != NULL, "OOPS 2!");
|
||||||
} else {
|
} else {
|
||||||
max_to_do = used.end();
|
max_to_do = used.end();
|
||||||
|
NOISY(tty->print_cr(" process_chunk_boundary: Last chunk of this space;\n"
|
||||||
|
" max_to_do left at " PTR_FORMAT,
|
||||||
|
max_to_do);)
|
||||||
}
|
}
|
||||||
|
assert(max_to_do != NULL, "OOPS 3!");
|
||||||
// Now we can set the closure we're using so it doesn't to beyond
|
// Now we can set the closure we're using so it doesn't to beyond
|
||||||
// max_to_do.
|
// max_to_do.
|
||||||
dcto_cl->set_min_done(max_to_do);
|
dcto_cl->set_min_done(max_to_do);
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
dcto_cl->set_last_bottom(max_to_do);
|
dcto_cl->set_last_bottom(max_to_do);
|
||||||
#endif
|
#endif
|
||||||
|
NOISY(tty->print_cr("===========================================================================\n");)
|
||||||
// Now we set *our" lowest_non_clean entry.
|
|
||||||
// Find the object that spans our boundary, if one exists.
|
|
||||||
// Nothing to do on the first chunk.
|
|
||||||
if (chunk_mr.start() > used.start()) {
|
|
||||||
// first_block is the block possibly spanning the chunk start
|
|
||||||
HeapWord* first_block = sp->block_start(chunk_mr.start());
|
|
||||||
// Does the block span the start of the chunk and is it
|
|
||||||
// an object?
|
|
||||||
if (first_block < chunk_mr.start() &&
|
|
||||||
sp->block_is_obj(first_block)) {
|
|
||||||
jbyte* first_dirty_card = NULL;
|
|
||||||
jbyte* last_card_of_first_obj =
|
|
||||||
byte_for(first_block + sp->block_size(first_block) - 1);
|
|
||||||
jbyte* first_card_of_cur_chunk = byte_for(chunk_mr.start());
|
|
||||||
jbyte* last_card_of_cur_chunk = byte_for(chunk_mr.last());
|
|
||||||
jbyte* last_card_to_check =
|
|
||||||
(jbyte*) MIN2((intptr_t) last_card_of_cur_chunk,
|
|
||||||
(intptr_t) last_card_of_first_obj);
|
|
||||||
for (jbyte* cur = first_card_of_cur_chunk;
|
|
||||||
cur <= last_card_to_check; cur++) {
|
|
||||||
if (card_will_be_scanned(*cur)) {
|
|
||||||
first_dirty_card = cur; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (first_dirty_card != NULL) {
|
|
||||||
assert(0 <= cur_chunk_index &&
|
|
||||||
cur_chunk_index < lowest_non_clean_chunk_size,
|
|
||||||
"Bounds error.");
|
|
||||||
lowest_non_clean[cur_chunk_index] = first_dirty_card;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef NOISY
|
||||||
|
|
||||||
void
|
void
|
||||||
CardTableModRefBS::
|
CardTableModRefBS::
|
||||||
get_LNC_array_for_space(Space* sp,
|
get_LNC_array_for_space(Space* sp,
|
||||||
|
@ -283,8 +413,8 @@ get_LNC_array_for_space(Space* sp,
|
||||||
// LNC array for the covered region. Any later expansion can't affect
|
// LNC array for the covered region. Any later expansion can't affect
|
||||||
// the used_at_save_marks region.
|
// the used_at_save_marks region.
|
||||||
// (I observed a bug in which the first thread to execute this would
|
// (I observed a bug in which the first thread to execute this would
|
||||||
// resize, and then it would cause "expand_and_allocates" that would
|
// resize, and then it would cause "expand_and_allocate" that would
|
||||||
// Increase the number of chunks in the covered region. Then a second
|
// increase the number of chunks in the covered region. Then a second
|
||||||
// thread would come and execute this, see that the size didn't match,
|
// thread would come and execute this, see that the size didn't match,
|
||||||
// and free and allocate again. So the first thread would be using a
|
// and free and allocate again. So the first thread would be using a
|
||||||
// freed "_lowest_non_clean" array.)
|
// freed "_lowest_non_clean" array.)
|
||||||
|
|
|
@ -77,7 +77,23 @@ inline void ParScanClosure::do_oop_work(T* p,
|
||||||
if (!oopDesc::is_null(heap_oop)) {
|
if (!oopDesc::is_null(heap_oop)) {
|
||||||
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
|
oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
|
||||||
if ((HeapWord*)obj < _boundary) {
|
if ((HeapWord*)obj < _boundary) {
|
||||||
assert(!_g->to()->is_in_reserved(obj), "Scanning field twice?");
|
#ifndef PRODUCT
|
||||||
|
if (_g->to()->is_in_reserved(obj)) {
|
||||||
|
tty->print_cr("Scanning field (" PTR_FORMAT ") twice?", p);
|
||||||
|
GenCollectedHeap* gch = (GenCollectedHeap*)Universe::heap();
|
||||||
|
Space* sp = gch->space_containing(p);
|
||||||
|
oop obj = oop(sp->block_start(p));
|
||||||
|
assert((HeapWord*)obj < (HeapWord*)p, "Error");
|
||||||
|
tty->print_cr("Object: " PTR_FORMAT, obj);
|
||||||
|
tty->print_cr("-------");
|
||||||
|
obj->print();
|
||||||
|
tty->print_cr("-----");
|
||||||
|
tty->print_cr("Heap:");
|
||||||
|
tty->print_cr("-----");
|
||||||
|
gch->print();
|
||||||
|
ShouldNotReachHere();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// OK, we need to ensure that it is copied.
|
// OK, we need to ensure that it is copied.
|
||||||
// We read the klass and mark in this order, so that we can reliably
|
// We read the klass and mark in this order, so that we can reliably
|
||||||
// get the size of the object: if the mark we read is not a
|
// get the size of the object: if the mark we read is not a
|
||||||
|
|
|
@ -173,7 +173,7 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
|
||||||
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
|
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
|
||||||
TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
|
TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
|
||||||
TraceCollectorStats tcs(counters());
|
TraceCollectorStats tcs(counters());
|
||||||
TraceMemoryManagerStats tms(true /* Full GC */);
|
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
|
||||||
|
|
||||||
if (TraceGen1Time) accumulated_time()->start();
|
if (TraceGen1Time) accumulated_time()->start();
|
||||||
|
|
||||||
|
|
|
@ -2057,7 +2057,7 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
|
||||||
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
|
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
|
||||||
TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
|
TraceTime t1(gc_cause_str, PrintGC, !PrintGCDetails, gclog_or_tty);
|
||||||
TraceCollectorStats tcs(counters());
|
TraceCollectorStats tcs(counters());
|
||||||
TraceMemoryManagerStats tms(true /* Full GC */);
|
TraceMemoryManagerStats tms(true /* Full GC */,gc_cause);
|
||||||
|
|
||||||
if (TraceGen1Time) accumulated_time()->start();
|
if (TraceGen1Time) accumulated_time()->start();
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,7 @@ bool PSScavenge::invoke_no_policy() {
|
||||||
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
|
TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
|
||||||
TraceTime t1("GC", PrintGC, !PrintGCDetails, gclog_or_tty);
|
TraceTime t1("GC", PrintGC, !PrintGCDetails, gclog_or_tty);
|
||||||
TraceCollectorStats tcs(counters());
|
TraceCollectorStats tcs(counters());
|
||||||
TraceMemoryManagerStats tms(false /* not full GC */);
|
TraceMemoryManagerStats tms(false /* not full GC */,gc_cause);
|
||||||
|
|
||||||
if (TraceGen0Time) accumulated_time()->start();
|
if (TraceGen0Time) accumulated_time()->start();
|
||||||
|
|
||||||
|
|
|
@ -541,20 +541,33 @@ HeapWord* BlockOffsetArrayNonContigSpace::block_start_unsafe(
|
||||||
// to go back by.
|
// to go back by.
|
||||||
size_t n_cards_back = entry_to_cards_back(offset);
|
size_t n_cards_back = entry_to_cards_back(offset);
|
||||||
q -= (N_words * n_cards_back);
|
q -= (N_words * n_cards_back);
|
||||||
assert(q >= _sp->bottom(), "Went below bottom!");
|
assert(q >= _sp->bottom(),
|
||||||
|
err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
|
||||||
|
q, _sp->bottom()));
|
||||||
|
assert(q < _sp->end(),
|
||||||
|
err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
|
||||||
|
q, _sp->end()));
|
||||||
index -= n_cards_back;
|
index -= n_cards_back;
|
||||||
offset = _array->offset_array(index);
|
offset = _array->offset_array(index);
|
||||||
}
|
}
|
||||||
assert(offset < N_words, "offset too large");
|
assert(offset < N_words, "offset too large");
|
||||||
index--;
|
index--;
|
||||||
q -= offset;
|
q -= offset;
|
||||||
|
assert(q >= _sp->bottom(),
|
||||||
|
err_msg("q = " PTR_FORMAT " crossed below bottom = " PTR_FORMAT,
|
||||||
|
q, _sp->bottom()));
|
||||||
|
assert(q < _sp->end(),
|
||||||
|
err_msg("q = " PTR_FORMAT " crossed above end = " PTR_FORMAT,
|
||||||
|
q, _sp->end()));
|
||||||
HeapWord* n = q;
|
HeapWord* n = q;
|
||||||
|
|
||||||
while (n <= addr) {
|
while (n <= addr) {
|
||||||
debug_only(HeapWord* last = q); // for debugging
|
debug_only(HeapWord* last = q); // for debugging
|
||||||
q = n;
|
q = n;
|
||||||
n += _sp->block_size(n);
|
n += _sp->block_size(n);
|
||||||
assert(n > q, err_msg("Looping at: " INTPTR_FORMAT, n));
|
assert(n > q,
|
||||||
|
err_msg("Looping at n = " PTR_FORMAT " with last = " PTR_FORMAT " _sp = [" PTR_FORMAT "," PTR_FORMAT ")",
|
||||||
|
n, last, _sp->bottom(), _sp->end()));
|
||||||
}
|
}
|
||||||
assert(q <= addr, err_msg("wrong order for current (" INTPTR_FORMAT ") <= arg (" INTPTR_FORMAT ")", q, addr));
|
assert(q <= addr, err_msg("wrong order for current (" INTPTR_FORMAT ") <= arg (" INTPTR_FORMAT ")", q, addr));
|
||||||
assert(addr <= n, err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", addr, n));
|
assert(addr <= n, err_msg("wrong order for arg (" INTPTR_FORMAT ") <= next (" INTPTR_FORMAT ")", addr, n));
|
||||||
|
|
|
@ -455,25 +455,29 @@ bool CardTableModRefBS::mark_card_deferred(size_t card_index) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
|
void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
|
||||||
MemRegion mr,
|
MemRegion mr,
|
||||||
DirtyCardToOopClosure* dcto_cl,
|
OopsInGenClosure* cl,
|
||||||
ClearNoncleanCardWrapper* cl) {
|
CardTableRS* ct) {
|
||||||
if (!mr.is_empty()) {
|
if (!mr.is_empty()) {
|
||||||
int n_threads = SharedHeap::heap()->n_par_threads();
|
int n_threads = SharedHeap::heap()->n_par_threads();
|
||||||
if (n_threads > 0) {
|
if (n_threads > 0) {
|
||||||
#ifndef SERIALGC
|
#ifndef SERIALGC
|
||||||
non_clean_card_iterate_parallel_work(sp, mr, dcto_cl, cl, n_threads);
|
non_clean_card_iterate_parallel_work(sp, mr, cl, ct, n_threads);
|
||||||
#else // SERIALGC
|
#else // SERIALGC
|
||||||
fatal("Parallel gc not supported here.");
|
fatal("Parallel gc not supported here.");
|
||||||
#endif // SERIALGC
|
#endif // SERIALGC
|
||||||
} else {
|
} else {
|
||||||
// We do not call the non_clean_card_iterate_serial() version below because
|
// We do not call the non_clean_card_iterate_serial() version below because
|
||||||
// we want to clear the cards (which non_clean_card_iterate_serial() does not
|
// we want to clear the cards (which non_clean_card_iterate_serial() does not
|
||||||
// do for us), and the ClearNoncleanCardWrapper closure itself does the work
|
// do for us): clear_cl here does the work of finding contiguous dirty ranges
|
||||||
// of finding contiguous dirty ranges of cards to process (and clear).
|
// of cards to process and clear.
|
||||||
cl->do_MemRegion(mr);
|
|
||||||
|
DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, precision(),
|
||||||
|
cl->gen_boundary());
|
||||||
|
ClearNoncleanCardWrapper clear_cl(dcto_cl, ct);
|
||||||
|
|
||||||
|
clear_cl.do_MemRegion(mr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,9 @@ class CardTableModRefBS: public ModRefBarrierSet {
|
||||||
// Mapping from address to card marking array entry
|
// Mapping from address to card marking array entry
|
||||||
jbyte* byte_for(const void* p) const {
|
jbyte* byte_for(const void* p) const {
|
||||||
assert(_whole_heap.contains(p),
|
assert(_whole_heap.contains(p),
|
||||||
"out of bounds access to card marking array");
|
err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
|
||||||
|
" card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
|
||||||
|
p, _whole_heap.start(), _whole_heap.end()));
|
||||||
jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
|
jbyte* result = &byte_map_base[uintptr_t(p) >> card_shift];
|
||||||
assert(result >= _byte_map && result < _byte_map + _byte_map_size,
|
assert(result >= _byte_map && result < _byte_map + _byte_map_size,
|
||||||
"out of bounds accessor for card marking array");
|
"out of bounds accessor for card marking array");
|
||||||
|
@ -173,18 +175,17 @@ class CardTableModRefBS: public ModRefBarrierSet {
|
||||||
// A variant of the above that will operate in a parallel mode if
|
// A variant of the above that will operate in a parallel mode if
|
||||||
// worker threads are available, and clear the dirty cards as it
|
// worker threads are available, and clear the dirty cards as it
|
||||||
// processes them.
|
// processes them.
|
||||||
// ClearNoncleanCardWrapper cl must wrap the DirtyCardToOopClosure dcto_cl,
|
// XXX ??? MemRegionClosure above vs OopsInGenClosure below XXX
|
||||||
// which may itself be modified by the method.
|
// XXX some new_dcto_cl's take OopClosure's, plus as above there are
|
||||||
|
// some MemRegionClosures. Clean this up everywhere. XXX
|
||||||
void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr,
|
void non_clean_card_iterate_possibly_parallel(Space* sp, MemRegion mr,
|
||||||
DirtyCardToOopClosure* dcto_cl,
|
OopsInGenClosure* cl, CardTableRS* ct);
|
||||||
ClearNoncleanCardWrapper* cl);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Work method used to implement non_clean_card_iterate_possibly_parallel()
|
// Work method used to implement non_clean_card_iterate_possibly_parallel()
|
||||||
// above in the parallel case.
|
// above in the parallel case.
|
||||||
void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
|
void non_clean_card_iterate_parallel_work(Space* sp, MemRegion mr,
|
||||||
DirtyCardToOopClosure* dcto_cl,
|
OopsInGenClosure* cl, CardTableRS* ct,
|
||||||
ClearNoncleanCardWrapper* cl,
|
|
||||||
int n_threads);
|
int n_threads);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -198,11 +199,6 @@ class CardTableModRefBS: public ModRefBarrierSet {
|
||||||
|
|
||||||
// *** Support for parallel card scanning.
|
// *** Support for parallel card scanning.
|
||||||
|
|
||||||
enum SomeConstantsForParallelism {
|
|
||||||
StridesPerThread = 2,
|
|
||||||
CardsPerStrideChunk = 256
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is an array, one element per covered region of the card table.
|
// This is an array, one element per covered region of the card table.
|
||||||
// Each entry is itself an array, with one element per chunk in the
|
// Each entry is itself an array, with one element per chunk in the
|
||||||
// covered region. Each entry of these arrays is the lowest non-clean
|
// covered region. Each entry of these arrays is the lowest non-clean
|
||||||
|
@ -235,7 +231,7 @@ class CardTableModRefBS: public ModRefBarrierSet {
|
||||||
// covers the given address.
|
// covers the given address.
|
||||||
uintptr_t addr_to_chunk_index(const void* addr) {
|
uintptr_t addr_to_chunk_index(const void* addr) {
|
||||||
uintptr_t card = (uintptr_t) byte_for(addr);
|
uintptr_t card = (uintptr_t) byte_for(addr);
|
||||||
return card / CardsPerStrideChunk;
|
return card / ParGCCardsPerStrideChunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply cl, which must either itself apply dcto_cl or be dcto_cl,
|
// Apply cl, which must either itself apply dcto_cl or be dcto_cl,
|
||||||
|
@ -243,8 +239,8 @@ class CardTableModRefBS: public ModRefBarrierSet {
|
||||||
void process_stride(Space* sp,
|
void process_stride(Space* sp,
|
||||||
MemRegion used,
|
MemRegion used,
|
||||||
jint stride, int n_strides,
|
jint stride, int n_strides,
|
||||||
DirtyCardToOopClosure* dcto_cl,
|
OopsInGenClosure* cl,
|
||||||
ClearNoncleanCardWrapper* cl,
|
CardTableRS* ct,
|
||||||
jbyte** lowest_non_clean,
|
jbyte** lowest_non_clean,
|
||||||
uintptr_t lowest_non_clean_base_chunk_index,
|
uintptr_t lowest_non_clean_base_chunk_index,
|
||||||
size_t lowest_non_clean_chunk_size);
|
size_t lowest_non_clean_chunk_size);
|
||||||
|
@ -457,14 +453,18 @@ public:
|
||||||
size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte));
|
size_t delta = pointer_delta(p, byte_map_base, sizeof(jbyte));
|
||||||
HeapWord* result = (HeapWord*) (delta << card_shift);
|
HeapWord* result = (HeapWord*) (delta << card_shift);
|
||||||
assert(_whole_heap.contains(result),
|
assert(_whole_heap.contains(result),
|
||||||
"out of bounds accessor from card marking array");
|
err_msg("Returning result = "PTR_FORMAT" out of bounds of "
|
||||||
|
" card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
|
||||||
|
result, _whole_heap.start(), _whole_heap.end()));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mapping from address to card marking array index.
|
// Mapping from address to card marking array index.
|
||||||
size_t index_for(void* p) {
|
size_t index_for(void* p) {
|
||||||
assert(_whole_heap.contains(p),
|
assert(_whole_heap.contains(p),
|
||||||
"out of bounds access to card marking array");
|
err_msg("Attempt to access p = "PTR_FORMAT" out of bounds of "
|
||||||
|
" card marking array's _whole_heap = ["PTR_FORMAT","PTR_FORMAT")",
|
||||||
|
p, _whole_heap.start(), _whole_heap.end()));
|
||||||
return byte_for(p) - _byte_map;
|
return byte_for(p) - _byte_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,7 +482,7 @@ public:
|
||||||
void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
|
void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
|
||||||
|
|
||||||
static size_t par_chunk_heapword_alignment() {
|
static size_t par_chunk_heapword_alignment() {
|
||||||
return CardsPerStrideChunk * card_size_in_words;
|
return ParGCCardsPerStrideChunk * card_size_in_words;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -162,7 +162,7 @@ inline bool ClearNoncleanCardWrapper::clear_card_serial(jbyte* entry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearNoncleanCardWrapper::ClearNoncleanCardWrapper(
|
ClearNoncleanCardWrapper::ClearNoncleanCardWrapper(
|
||||||
MemRegionClosure* dirty_card_closure, CardTableRS* ct) :
|
DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct) :
|
||||||
_dirty_card_closure(dirty_card_closure), _ct(ct) {
|
_dirty_card_closure(dirty_card_closure), _ct(ct) {
|
||||||
_is_par = (SharedHeap::heap()->n_par_threads() > 0);
|
_is_par = (SharedHeap::heap()->n_par_threads() > 0);
|
||||||
}
|
}
|
||||||
|
@ -246,10 +246,6 @@ void CardTableRS::write_ref_field_gc_par(void* field, oop new_val) {
|
||||||
|
|
||||||
void CardTableRS::younger_refs_in_space_iterate(Space* sp,
|
void CardTableRS::younger_refs_in_space_iterate(Space* sp,
|
||||||
OopsInGenClosure* cl) {
|
OopsInGenClosure* cl) {
|
||||||
DirtyCardToOopClosure* dcto_cl = sp->new_dcto_cl(cl, _ct_bs->precision(),
|
|
||||||
cl->gen_boundary());
|
|
||||||
ClearNoncleanCardWrapper clear_cl(dcto_cl, this);
|
|
||||||
|
|
||||||
const MemRegion urasm = sp->used_region_at_save_marks();
|
const MemRegion urasm = sp->used_region_at_save_marks();
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
// Convert the assertion check to a warning if we are running
|
// Convert the assertion check to a warning if we are running
|
||||||
|
@ -275,10 +271,10 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp,
|
||||||
if (!urasm.equals(urasm2)) {
|
if (!urasm.equals(urasm2)) {
|
||||||
warning("CMS+ParNew: Flickering used_region_at_save_marks()!!");
|
warning("CMS+ParNew: Flickering used_region_at_save_marks()!!");
|
||||||
}
|
}
|
||||||
|
ShouldNotReachHere();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
_ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm,
|
_ct_bs->non_clean_card_iterate_possibly_parallel(sp, urasm, cl, this);
|
||||||
dcto_cl, &clear_cl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardTableRS::clear_into_younger(Generation* gen, bool clear_perm) {
|
void CardTableRS::clear_into_younger(Generation* gen, bool clear_perm) {
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
|
|
||||||
class Space;
|
class Space;
|
||||||
class OopsInGenClosure;
|
class OopsInGenClosure;
|
||||||
class DirtyCardToOopClosure;
|
|
||||||
|
|
||||||
// This kind of "GenRemSet" uses a card table both as shared data structure
|
// This kind of "GenRemSet" uses a card table both as shared data structure
|
||||||
// for a mod ref barrier set and for the rem set information.
|
// for a mod ref barrier set and for the rem set information.
|
||||||
|
@ -167,7 +166,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClearNoncleanCardWrapper: public MemRegionClosure {
|
class ClearNoncleanCardWrapper: public MemRegionClosure {
|
||||||
MemRegionClosure* _dirty_card_closure;
|
DirtyCardToOopClosure* _dirty_card_closure;
|
||||||
CardTableRS* _ct;
|
CardTableRS* _ct;
|
||||||
bool _is_par;
|
bool _is_par;
|
||||||
private:
|
private:
|
||||||
|
@ -179,7 +178,7 @@ private:
|
||||||
inline bool clear_card_parallel(jbyte* entry);
|
inline bool clear_card_parallel(jbyte* entry);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClearNoncleanCardWrapper(MemRegionClosure* dirty_card_closure, CardTableRS* ct);
|
ClearNoncleanCardWrapper(DirtyCardToOopClosure* dirty_card_closure, CardTableRS* ct);
|
||||||
void do_MemRegion(MemRegion mr);
|
void do_MemRegion(MemRegion mr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -537,7 +537,7 @@ void GenCollectedHeap::do_collection(bool full,
|
||||||
// Timer for individual generations. Last argument is false: no CR
|
// Timer for individual generations. Last argument is false: no CR
|
||||||
TraceTime t1(_gens[i]->short_name(), PrintGCDetails, false, gclog_or_tty);
|
TraceTime t1(_gens[i]->short_name(), PrintGCDetails, false, gclog_or_tty);
|
||||||
TraceCollectorStats tcs(_gens[i]->counters());
|
TraceCollectorStats tcs(_gens[i]->counters());
|
||||||
TraceMemoryManagerStats tmms(_gens[i]->kind());
|
TraceMemoryManagerStats tmms(_gens[i]->kind(),gc_cause());
|
||||||
|
|
||||||
size_t prev_used = _gens[i]->used();
|
size_t prev_used = _gens[i]->used();
|
||||||
_gens[i]->stat_record()->invocations++;
|
_gens[i]->stat_record()->invocations++;
|
||||||
|
|
|
@ -97,6 +97,14 @@ void DirtyCardToOopClosure::walk_mem_region(MemRegion mr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We get called with "mr" representing the dirty region
|
||||||
|
// that we want to process. Because of imprecise marking,
|
||||||
|
// we may need to extend the incoming "mr" to the right,
|
||||||
|
// and scan more. However, because we may already have
|
||||||
|
// scanned some of that extended region, we may need to
|
||||||
|
// trim its right-end back some so we do not scan what
|
||||||
|
// we (or another worker thread) may already have scanned
|
||||||
|
// or planning to scan.
|
||||||
void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) {
|
void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) {
|
||||||
|
|
||||||
// Some collectors need to do special things whenever their dirty
|
// Some collectors need to do special things whenever their dirty
|
||||||
|
@ -148,7 +156,7 @@ void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) {
|
||||||
// e.g. the dirty card region is entirely in a now free object
|
// e.g. the dirty card region is entirely in a now free object
|
||||||
// -- something that could happen with a concurrent sweeper.
|
// -- something that could happen with a concurrent sweeper.
|
||||||
bottom = MIN2(bottom, top);
|
bottom = MIN2(bottom, top);
|
||||||
mr = MemRegion(bottom, top);
|
MemRegion extended_mr = MemRegion(bottom, top);
|
||||||
assert(bottom <= top &&
|
assert(bottom <= top &&
|
||||||
(_precision != CardTableModRefBS::ObjHeadPreciseArray ||
|
(_precision != CardTableModRefBS::ObjHeadPreciseArray ||
|
||||||
_min_done == NULL ||
|
_min_done == NULL ||
|
||||||
|
@ -156,8 +164,8 @@ void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) {
|
||||||
"overlap!");
|
"overlap!");
|
||||||
|
|
||||||
// Walk the region if it is not empty; otherwise there is nothing to do.
|
// Walk the region if it is not empty; otherwise there is nothing to do.
|
||||||
if (!mr.is_empty()) {
|
if (!extended_mr.is_empty()) {
|
||||||
walk_mem_region(mr, bottom_obj, top);
|
walk_mem_region(extended_mr, bottom_obj, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
// An idempotent closure might be applied in any order, so we don't
|
// An idempotent closure might be applied in any order, so we don't
|
||||||
|
|
|
@ -1,7 +1,26 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*/
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "runtime/advancedThresholdPolicy.hpp"
|
#include "runtime/advancedThresholdPolicy.hpp"
|
||||||
|
|
|
@ -1,7 +1,26 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*/
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef SHARE_VM_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
|
#ifndef SHARE_VM_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
|
||||||
#define SHARE_VM_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
|
#define SHARE_VM_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
|
||||||
|
|
|
@ -1460,8 +1460,10 @@ class CommandLineFlags {
|
||||||
product(intx, ParallelGCBufferWastePct, 10, \
|
product(intx, ParallelGCBufferWastePct, 10, \
|
||||||
"wasted fraction of parallel allocation buffer.") \
|
"wasted fraction of parallel allocation buffer.") \
|
||||||
\
|
\
|
||||||
product(bool, ParallelGCRetainPLAB, true, \
|
diagnostic(bool, ParallelGCRetainPLAB, false, \
|
||||||
"Retain parallel allocation buffers across scavenges.") \
|
"Retain parallel allocation buffers across scavenges; " \
|
||||||
|
" -- disabled because this currently conflicts with " \
|
||||||
|
" parallel card scanning under certain conditions ") \
|
||||||
\
|
\
|
||||||
product(intx, TargetPLABWastePct, 10, \
|
product(intx, TargetPLABWastePct, 10, \
|
||||||
"target wasted space in last buffer as pct of overall allocation")\
|
"target wasted space in last buffer as pct of overall allocation")\
|
||||||
|
@ -1495,7 +1497,15 @@ class CommandLineFlags {
|
||||||
product(uintx, ParGCDesiredObjsFromOverflowList, 20, \
|
product(uintx, ParGCDesiredObjsFromOverflowList, 20, \
|
||||||
"The desired number of objects to claim from the overflow list") \
|
"The desired number of objects to claim from the overflow list") \
|
||||||
\
|
\
|
||||||
product(uintx, CMSParPromoteBlocksToClaim, 16, \
|
diagnostic(intx, ParGCStridesPerThread, 2, \
|
||||||
|
"The number of strides per worker thread that we divide up the " \
|
||||||
|
"card table scanning work into") \
|
||||||
|
\
|
||||||
|
diagnostic(intx, ParGCCardsPerStrideChunk, 256, \
|
||||||
|
"The number of cards in each chunk of the parallel chunks used " \
|
||||||
|
"during card table scanning") \
|
||||||
|
\
|
||||||
|
product(uintx, CMSParPromoteBlocksToClaim, 16, \
|
||||||
"Number of blocks to attempt to claim when refilling CMS LAB for "\
|
"Number of blocks to attempt to claim when refilling CMS LAB for "\
|
||||||
"parallel GC.") \
|
"parallel GC.") \
|
||||||
\
|
\
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "runtime/serviceThread.hpp"
|
#include "runtime/serviceThread.hpp"
|
||||||
#include "runtime/mutexLocker.hpp"
|
#include "runtime/mutexLocker.hpp"
|
||||||
#include "prims/jvmtiImpl.hpp"
|
#include "prims/jvmtiImpl.hpp"
|
||||||
|
#include "services/gcNotifier.hpp"
|
||||||
|
|
||||||
ServiceThread* ServiceThread::_instance = NULL;
|
ServiceThread* ServiceThread::_instance = NULL;
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||||
while (true) {
|
while (true) {
|
||||||
bool sensors_changed = false;
|
bool sensors_changed = false;
|
||||||
bool has_jvmti_events = false;
|
bool has_jvmti_events = false;
|
||||||
|
bool has_gc_notification_event = false;
|
||||||
JvmtiDeferredEvent jvmti_event;
|
JvmtiDeferredEvent jvmti_event;
|
||||||
{
|
{
|
||||||
// Need state transition ThreadBlockInVM so that this thread
|
// Need state transition ThreadBlockInVM so that this thread
|
||||||
|
@ -95,9 +97,10 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||||
|
|
||||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||||
while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
|
while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
|
||||||
!(has_jvmti_events = JvmtiDeferredEventQueue::has_events())) {
|
!(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
|
||||||
|
!(has_gc_notification_event = GCNotifier::has_event())) {
|
||||||
// wait until one of the sensors has pending requests, or there is a
|
// wait until one of the sensors has pending requests, or there is a
|
||||||
// pending JVMTI event to post
|
// pending JVMTI event or JMX GC notification to post
|
||||||
Service_lock->wait(Mutex::_no_safepoint_check_flag);
|
Service_lock->wait(Mutex::_no_safepoint_check_flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,6 +116,10 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
|
||||||
if (sensors_changed) {
|
if (sensors_changed) {
|
||||||
LowMemoryDetector::process_sensor_changes(jt);
|
LowMemoryDetector::process_sensor_changes(jt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(has_gc_notification_event) {
|
||||||
|
GCNotifier::sendNotification(CHECK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
|
216
hotspot/src/share/vm/services/gcNotifier.cpp
Normal file
216
hotspot/src/share/vm/services/gcNotifier.cpp
Normal file
|
@ -0,0 +1,216 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precompiled.hpp"
|
||||||
|
#include "classfile/systemDictionary.hpp"
|
||||||
|
#include "classfile/vmSymbols.hpp"
|
||||||
|
#include "oops/oop.inline.hpp"
|
||||||
|
#include "runtime/interfaceSupport.hpp"
|
||||||
|
#include "runtime/java.hpp"
|
||||||
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/mutex.hpp"
|
||||||
|
#include "runtime/mutexLocker.hpp"
|
||||||
|
#include "services/gcNotifier.hpp"
|
||||||
|
#include "services/management.hpp"
|
||||||
|
#include "services/memoryService.hpp"
|
||||||
|
#include "memoryManager.hpp"
|
||||||
|
#include "memory/oopFactory.hpp"
|
||||||
|
|
||||||
|
GCNotificationRequest *GCNotifier::first_request = NULL;
|
||||||
|
GCNotificationRequest *GCNotifier::last_request = NULL;
|
||||||
|
|
||||||
|
void GCNotifier::pushNotification(GCMemoryManager *mgr, const char *action, const char *cause) {
|
||||||
|
// Make a copy of the last GC statistics
|
||||||
|
// GC may occur between now and the creation of the notification
|
||||||
|
int num_pools = MemoryService::num_memory_pools();
|
||||||
|
GCStatInfo* stat = new GCStatInfo(num_pools);
|
||||||
|
mgr->get_last_gc_stat(stat);
|
||||||
|
GCNotificationRequest *request = new GCNotificationRequest(os::javaTimeMillis(),mgr,action,cause,stat);
|
||||||
|
addRequest(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCNotifier::addRequest(GCNotificationRequest *request) {
|
||||||
|
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||||
|
if(first_request == NULL) {
|
||||||
|
first_request = request;
|
||||||
|
} else {
|
||||||
|
last_request->next = request;
|
||||||
|
}
|
||||||
|
last_request = request;
|
||||||
|
Service_lock->notify_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
GCNotificationRequest *GCNotifier::getRequest() {
|
||||||
|
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||||
|
GCNotificationRequest *request = first_request;
|
||||||
|
if(first_request != NULL) {
|
||||||
|
first_request = first_request->next;
|
||||||
|
}
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GCNotifier::has_event() {
|
||||||
|
return first_request != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Handle getGcInfoBuilder(GCMemoryManager *gcManager,TRAPS) {
|
||||||
|
|
||||||
|
klassOop k = Management::sun_management_GarbageCollectorImpl_klass(CHECK_NH);
|
||||||
|
instanceKlassHandle gcMBeanKlass (THREAD, k);
|
||||||
|
|
||||||
|
instanceOop i = gcManager->get_memory_manager_instance(THREAD);
|
||||||
|
instanceHandle ih(THREAD, i);
|
||||||
|
|
||||||
|
JavaValue result(T_OBJECT);
|
||||||
|
JavaCallArguments args(ih);
|
||||||
|
|
||||||
|
JavaCalls::call_virtual(&result,
|
||||||
|
gcMBeanKlass,
|
||||||
|
vmSymbols::getGcInfoBuilder_name(),
|
||||||
|
vmSymbols::getGcInfoBuilder_signature(),
|
||||||
|
&args,
|
||||||
|
CHECK_NH);
|
||||||
|
return Handle(THREAD,(oop)result.get_jobject());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static Handle createGcInfo(GCMemoryManager *gcManager, GCStatInfo *gcStatInfo,TRAPS) {
|
||||||
|
|
||||||
|
// Fill the arrays of MemoryUsage objects with before and after GC
|
||||||
|
// per pool memory usage
|
||||||
|
|
||||||
|
klassOop muKlass = Management::java_lang_management_MemoryUsage_klass(CHECK_NH); objArrayOop bu = oopFactory::new_objArray( muKlass,MemoryService::num_memory_pools(), CHECK_NH);
|
||||||
|
objArrayHandle usage_before_gc_ah(THREAD, bu);
|
||||||
|
objArrayOop au = oopFactory::new_objArray(muKlass,MemoryService::num_memory_pools(), CHECK_NH);
|
||||||
|
objArrayHandle usage_after_gc_ah(THREAD, au);
|
||||||
|
|
||||||
|
for (int i = 0; i < MemoryService::num_memory_pools(); i++) {
|
||||||
|
Handle before_usage = MemoryService::create_MemoryUsage_obj(gcStatInfo->before_gc_usage_for_pool(i), CHECK_NH);
|
||||||
|
Handle after_usage;
|
||||||
|
|
||||||
|
MemoryUsage u = gcStatInfo->after_gc_usage_for_pool(i);
|
||||||
|
if (u.max_size() == 0 && u.used() > 0) {
|
||||||
|
// If max size == 0, this pool is a survivor space.
|
||||||
|
// Set max size = -1 since the pools will be swapped after GC.
|
||||||
|
MemoryUsage usage(u.init_size(), u.used(), u.committed(), (size_t)-1);
|
||||||
|
after_usage = MemoryService::create_MemoryUsage_obj(usage, CHECK_NH);
|
||||||
|
} else {
|
||||||
|
after_usage = MemoryService::create_MemoryUsage_obj(u, CHECK_NH);
|
||||||
|
}
|
||||||
|
usage_before_gc_ah->obj_at_put(i, before_usage());
|
||||||
|
usage_after_gc_ah->obj_at_put(i, after_usage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Current implementation only has 1 attribute (number of GC threads)
|
||||||
|
// The type is 'I'
|
||||||
|
objArrayOop extra_args_array = oopFactory::new_objArray(SystemDictionary::Integer_klass(), 1, CHECK_NH);
|
||||||
|
objArrayHandle extra_array (THREAD, extra_args_array);
|
||||||
|
klassOop itKlass= SystemDictionary::Integer_klass();
|
||||||
|
instanceKlassHandle intK(THREAD, itKlass);
|
||||||
|
|
||||||
|
instanceHandle extra_arg_val = intK->allocate_instance_handle(CHECK_NH);
|
||||||
|
|
||||||
|
{
|
||||||
|
JavaValue res(T_VOID);
|
||||||
|
JavaCallArguments argsInt;
|
||||||
|
argsInt.push_oop(extra_arg_val);
|
||||||
|
argsInt.push_int(gcManager->num_gc_threads());
|
||||||
|
|
||||||
|
JavaCalls::call_special(&res,
|
||||||
|
intK,
|
||||||
|
vmSymbols::object_initializer_name(),
|
||||||
|
vmSymbols::int_void_signature(),
|
||||||
|
&argsInt,
|
||||||
|
CHECK_NH);
|
||||||
|
}
|
||||||
|
extra_array->obj_at_put(0,extra_arg_val());
|
||||||
|
|
||||||
|
klassOop gcInfoklass = Management::com_sun_management_GcInfo_klass(CHECK_NH);
|
||||||
|
instanceKlassHandle ik (THREAD,gcInfoklass);
|
||||||
|
|
||||||
|
Handle gcInfo_instance = ik->allocate_instance_handle(CHECK_NH);
|
||||||
|
|
||||||
|
JavaValue constructor_result(T_VOID);
|
||||||
|
JavaCallArguments constructor_args(16);
|
||||||
|
constructor_args.push_oop(gcInfo_instance);
|
||||||
|
constructor_args.push_oop(getGcInfoBuilder(gcManager,THREAD));
|
||||||
|
constructor_args.push_long(gcStatInfo->gc_index());
|
||||||
|
constructor_args.push_long(gcStatInfo->start_time());
|
||||||
|
constructor_args.push_long(gcStatInfo->end_time());
|
||||||
|
constructor_args.push_oop(usage_before_gc_ah);
|
||||||
|
constructor_args.push_oop(usage_after_gc_ah);
|
||||||
|
constructor_args.push_oop(extra_array);
|
||||||
|
|
||||||
|
JavaCalls::call_special(&constructor_result,
|
||||||
|
ik,
|
||||||
|
vmSymbols::object_initializer_name(),
|
||||||
|
vmSymbols::com_sun_management_GcInfo_constructor_signature(),
|
||||||
|
&constructor_args,
|
||||||
|
CHECK_NH);
|
||||||
|
|
||||||
|
return Handle(gcInfo_instance());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GCNotifier::sendNotification(TRAPS) {
|
||||||
|
ResourceMark rm(THREAD);
|
||||||
|
GCNotificationRequest *request = getRequest();
|
||||||
|
if(request != NULL) {
|
||||||
|
Handle objGcInfo = createGcInfo(request->gcManager,request->gcStatInfo,THREAD);
|
||||||
|
|
||||||
|
Handle objName = java_lang_String::create_from_platform_dependent_str(request->gcManager->name(), CHECK);
|
||||||
|
Handle objAction = java_lang_String::create_from_platform_dependent_str(request->gcAction, CHECK);
|
||||||
|
Handle objCause = java_lang_String::create_from_platform_dependent_str(request->gcCause, CHECK);
|
||||||
|
|
||||||
|
klassOop k = Management::sun_management_GarbageCollectorImpl_klass(CHECK);
|
||||||
|
instanceKlassHandle gc_mbean_klass (THREAD, k);
|
||||||
|
|
||||||
|
instanceOop gc_mbean = request->gcManager->get_memory_manager_instance(THREAD);
|
||||||
|
instanceHandle gc_mbean_h(THREAD, gc_mbean);
|
||||||
|
if (!gc_mbean_h->is_a(k)) {
|
||||||
|
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
|
||||||
|
"This GCMemoryManager doesn't have a GarbageCollectorMXBean");
|
||||||
|
}
|
||||||
|
|
||||||
|
JavaValue result(T_VOID);
|
||||||
|
JavaCallArguments args(gc_mbean_h);
|
||||||
|
args.push_long(request->timestamp);
|
||||||
|
args.push_oop(objName);
|
||||||
|
args.push_oop(objAction);
|
||||||
|
args.push_oop(objCause);
|
||||||
|
args.push_oop(objGcInfo);
|
||||||
|
|
||||||
|
JavaCalls::call_virtual(&result,
|
||||||
|
gc_mbean_klass,
|
||||||
|
vmSymbols::createGCNotification_name(),
|
||||||
|
vmSymbols::createGCNotification_signature(),
|
||||||
|
&args,
|
||||||
|
CHECK);
|
||||||
|
if (HAS_PENDING_EXCEPTION) {
|
||||||
|
CLEAR_PENDING_EXCEPTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete request;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
69
hotspot/src/share/vm/services/gcNotifier.hpp
Normal file
69
hotspot/src/share/vm/services/gcNotifier.hpp
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_VM_SERVICES_GCNOTIFIER_HPP
|
||||||
|
#define SHARE_VM_SERVICES_GCNOTIFIER_HPP
|
||||||
|
|
||||||
|
#include "memory/allocation.hpp"
|
||||||
|
#include "services/memoryPool.hpp"
|
||||||
|
#include "services/memoryService.hpp"
|
||||||
|
#include "services/memoryManager.hpp"
|
||||||
|
|
||||||
|
class GCNotificationRequest : public CHeapObj {
|
||||||
|
friend class GCNotifier;
|
||||||
|
GCNotificationRequest *next;
|
||||||
|
jlong timestamp;
|
||||||
|
GCMemoryManager *gcManager;
|
||||||
|
const char *gcAction;
|
||||||
|
const char *gcCause;
|
||||||
|
GCStatInfo *gcStatInfo;
|
||||||
|
public:
|
||||||
|
GCNotificationRequest(jlong ts, GCMemoryManager *manager, const char*action, const char *cause,GCStatInfo *info) {
|
||||||
|
next = NULL;
|
||||||
|
timestamp = ts;
|
||||||
|
gcManager = manager;
|
||||||
|
gcAction = action;
|
||||||
|
gcCause = cause;
|
||||||
|
gcStatInfo = info;
|
||||||
|
}
|
||||||
|
|
||||||
|
~GCNotificationRequest() {
|
||||||
|
delete gcStatInfo;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class GCNotifier : public AllStatic {
|
||||||
|
friend class ServiceThread;
|
||||||
|
private:
|
||||||
|
static GCNotificationRequest *first_request;
|
||||||
|
static GCNotificationRequest *last_request;
|
||||||
|
static void addRequest(GCNotificationRequest *request);
|
||||||
|
static GCNotificationRequest *getRequest();
|
||||||
|
public:
|
||||||
|
static void pushNotification(GCMemoryManager *manager, const char *action, const char *cause);
|
||||||
|
static bool has_event();
|
||||||
|
static void sendNotification(TRAPS);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SHARE_VM_SERVICES_GCNOTIFIER_HPP
|
|
@ -48,7 +48,7 @@ enum {
|
||||||
JMM_VERSION_1_0 = 0x20010000,
|
JMM_VERSION_1_0 = 0x20010000,
|
||||||
JMM_VERSION_1_1 = 0x20010100, // JDK 6
|
JMM_VERSION_1_1 = 0x20010100, // JDK 6
|
||||||
JMM_VERSION_1_2 = 0x20010200, // JDK 7
|
JMM_VERSION_1_2 = 0x20010200, // JDK 7
|
||||||
JMM_VERSION = 0x20010200
|
JMM_VERSION = 0x20010201
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -293,6 +293,9 @@ typedef struct jmmInterface_1_ {
|
||||||
jlongArray ids,
|
jlongArray ids,
|
||||||
jboolean lockedMonitors,
|
jboolean lockedMonitors,
|
||||||
jboolean lockedSynchronizers);
|
jboolean lockedSynchronizers);
|
||||||
|
void (JNICALL *SetGCNotificationEnabled) (JNIEnv *env,
|
||||||
|
jobject mgr,
|
||||||
|
jboolean enabled);
|
||||||
} JmmInterface;
|
} JmmInterface;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "services/classLoadingService.hpp"
|
#include "services/classLoadingService.hpp"
|
||||||
#include "services/heapDumper.hpp"
|
#include "services/heapDumper.hpp"
|
||||||
#include "services/lowMemoryDetector.hpp"
|
#include "services/lowMemoryDetector.hpp"
|
||||||
|
#include "services/gcNotifier.hpp"
|
||||||
#include "services/management.hpp"
|
#include "services/management.hpp"
|
||||||
#include "services/memoryManager.hpp"
|
#include "services/memoryManager.hpp"
|
||||||
#include "services/memoryPool.hpp"
|
#include "services/memoryPool.hpp"
|
||||||
|
@ -60,6 +61,8 @@ klassOop Management::_memoryPoolMXBean_klass = NULL;
|
||||||
klassOop Management::_memoryManagerMXBean_klass = NULL;
|
klassOop Management::_memoryManagerMXBean_klass = NULL;
|
||||||
klassOop Management::_garbageCollectorMXBean_klass = NULL;
|
klassOop Management::_garbageCollectorMXBean_klass = NULL;
|
||||||
klassOop Management::_managementFactory_klass = NULL;
|
klassOop Management::_managementFactory_klass = NULL;
|
||||||
|
klassOop Management::_garbageCollectorImpl_klass = NULL;
|
||||||
|
klassOop Management::_gcInfo_klass = NULL;
|
||||||
|
|
||||||
jmmOptionalSupport Management::_optional_support = {0};
|
jmmOptionalSupport Management::_optional_support = {0};
|
||||||
TimeStamp Management::_stamp;
|
TimeStamp Management::_stamp;
|
||||||
|
@ -179,6 +182,8 @@ void Management::oops_do(OopClosure* f) {
|
||||||
f->do_oop((oop*) &_memoryManagerMXBean_klass);
|
f->do_oop((oop*) &_memoryManagerMXBean_klass);
|
||||||
f->do_oop((oop*) &_garbageCollectorMXBean_klass);
|
f->do_oop((oop*) &_garbageCollectorMXBean_klass);
|
||||||
f->do_oop((oop*) &_managementFactory_klass);
|
f->do_oop((oop*) &_managementFactory_klass);
|
||||||
|
f->do_oop((oop*) &_garbageCollectorImpl_klass);
|
||||||
|
f->do_oop((oop*) &_gcInfo_klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
klassOop Management::java_lang_management_ThreadInfo_klass(TRAPS) {
|
klassOop Management::java_lang_management_ThreadInfo_klass(TRAPS) {
|
||||||
|
@ -230,6 +235,20 @@ klassOop Management::sun_management_ManagementFactory_klass(TRAPS) {
|
||||||
return _managementFactory_klass;
|
return _managementFactory_klass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
klassOop Management::sun_management_GarbageCollectorImpl_klass(TRAPS) {
|
||||||
|
if (_garbageCollectorImpl_klass == NULL) {
|
||||||
|
_garbageCollectorImpl_klass = load_and_initialize_klass(vmSymbols::sun_management_GarbageCollectorImpl(), CHECK_NULL);
|
||||||
|
}
|
||||||
|
return _garbageCollectorImpl_klass;
|
||||||
|
}
|
||||||
|
|
||||||
|
klassOop Management::com_sun_management_GcInfo_klass(TRAPS) {
|
||||||
|
if (_gcInfo_klass == NULL) {
|
||||||
|
_gcInfo_klass = load_and_initialize_klass(vmSymbols::com_sun_management_GcInfo(), CHECK_NULL);
|
||||||
|
}
|
||||||
|
return _gcInfo_klass;
|
||||||
|
}
|
||||||
|
|
||||||
static void initialize_ThreadInfo_constructor_arguments(JavaCallArguments* args, ThreadSnapshot* snapshot, TRAPS) {
|
static void initialize_ThreadInfo_constructor_arguments(JavaCallArguments* args, ThreadSnapshot* snapshot, TRAPS) {
|
||||||
Handle snapshot_thread(THREAD, snapshot->threadObj());
|
Handle snapshot_thread(THREAD, snapshot->threadObj());
|
||||||
|
|
||||||
|
@ -2056,6 +2075,13 @@ JVM_ENTRY(void, jmm_GetLastGCStat(JNIEnv *env, jobject obj, jmmGCStat *gc_stat))
|
||||||
}
|
}
|
||||||
JVM_END
|
JVM_END
|
||||||
|
|
||||||
|
JVM_ENTRY(void, jmm_SetGCNotificationEnabled(JNIEnv *env, jobject obj, jboolean enabled))
|
||||||
|
ResourceMark rm(THREAD);
|
||||||
|
// Get the GCMemoryManager
|
||||||
|
GCMemoryManager* mgr = get_gc_memory_manager_from_jobject(obj, CHECK);
|
||||||
|
mgr->set_notification_enabled(enabled?true:false);
|
||||||
|
JVM_END
|
||||||
|
|
||||||
// Dump heap - Returns 0 if succeeds.
|
// Dump heap - Returns 0 if succeeds.
|
||||||
JVM_ENTRY(jint, jmm_DumpHeap0(JNIEnv *env, jstring outputfile, jboolean live))
|
JVM_ENTRY(jint, jmm_DumpHeap0(JNIEnv *env, jstring outputfile, jboolean live))
|
||||||
#ifndef SERVICES_KERNEL
|
#ifndef SERVICES_KERNEL
|
||||||
|
@ -2122,7 +2148,8 @@ const struct jmmInterface_1_ jmm_interface = {
|
||||||
jmm_FindDeadlockedThreads,
|
jmm_FindDeadlockedThreads,
|
||||||
jmm_SetVMGlobal,
|
jmm_SetVMGlobal,
|
||||||
NULL,
|
NULL,
|
||||||
jmm_DumpThreads
|
jmm_DumpThreads,
|
||||||
|
jmm_SetGCNotificationEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
void* Management::get_jmm_interface(int version) {
|
void* Management::get_jmm_interface(int version) {
|
||||||
|
|
|
@ -49,6 +49,8 @@ private:
|
||||||
static klassOop _memoryManagerMXBean_klass;
|
static klassOop _memoryManagerMXBean_klass;
|
||||||
static klassOop _garbageCollectorMXBean_klass;
|
static klassOop _garbageCollectorMXBean_klass;
|
||||||
static klassOop _managementFactory_klass;
|
static klassOop _managementFactory_klass;
|
||||||
|
static klassOop _garbageCollectorImpl_klass;
|
||||||
|
static klassOop _gcInfo_klass;
|
||||||
|
|
||||||
static klassOop load_and_initialize_klass(Symbol* sh, TRAPS);
|
static klassOop load_and_initialize_klass(Symbol* sh, TRAPS);
|
||||||
|
|
||||||
|
@ -86,6 +88,8 @@ public:
|
||||||
static klassOop java_lang_management_GarbageCollectorMXBean_klass(TRAPS);
|
static klassOop java_lang_management_GarbageCollectorMXBean_klass(TRAPS);
|
||||||
static klassOop sun_management_Sensor_klass(TRAPS);
|
static klassOop sun_management_Sensor_klass(TRAPS);
|
||||||
static klassOop sun_management_ManagementFactory_klass(TRAPS);
|
static klassOop sun_management_ManagementFactory_klass(TRAPS);
|
||||||
|
static klassOop sun_management_GarbageCollectorImpl_klass(TRAPS);
|
||||||
|
static klassOop com_sun_management_GcInfo_klass(TRAPS);
|
||||||
|
|
||||||
static instanceOop create_thread_info_instance(ThreadSnapshot* snapshot, TRAPS);
|
static instanceOop create_thread_info_instance(ThreadSnapshot* snapshot, TRAPS);
|
||||||
static instanceOop create_thread_info_instance(ThreadSnapshot* snapshot, objArrayHandle monitors_array, typeArrayHandle depths_array, objArrayHandle synchronizers_array, TRAPS);
|
static instanceOop create_thread_info_instance(ThreadSnapshot* snapshot, objArrayHandle monitors_array, typeArrayHandle depths_array, objArrayHandle synchronizers_array, TRAPS);
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "services/memoryManager.hpp"
|
#include "services/memoryManager.hpp"
|
||||||
#include "services/memoryPool.hpp"
|
#include "services/memoryPool.hpp"
|
||||||
#include "services/memoryService.hpp"
|
#include "services/memoryService.hpp"
|
||||||
|
#include "services/gcNotifier.hpp"
|
||||||
#include "utilities/dtrace.hpp"
|
#include "utilities/dtrace.hpp"
|
||||||
|
|
||||||
HS_DTRACE_PROBE_DECL8(hotspot, mem__pool__gc__begin, char*, int, char*, int,
|
HS_DTRACE_PROBE_DECL8(hotspot, mem__pool__gc__begin, char*, int, char*, int,
|
||||||
|
@ -202,6 +203,7 @@ GCMemoryManager::GCMemoryManager() : MemoryManager() {
|
||||||
_last_gc_lock = new Mutex(Mutex::leaf, "_last_gc_lock", true);
|
_last_gc_lock = new Mutex(Mutex::leaf, "_last_gc_lock", true);
|
||||||
_current_gc_stat = NULL;
|
_current_gc_stat = NULL;
|
||||||
_num_gc_threads = 1;
|
_num_gc_threads = 1;
|
||||||
|
_notification_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GCMemoryManager::~GCMemoryManager() {
|
GCMemoryManager::~GCMemoryManager() {
|
||||||
|
@ -250,7 +252,8 @@ void GCMemoryManager::gc_begin(bool recordGCBeginTime, bool recordPreGCUsage,
|
||||||
// to ensure the current gc stat is placed in _last_gc_stat.
|
// to ensure the current gc stat is placed in _last_gc_stat.
|
||||||
void GCMemoryManager::gc_end(bool recordPostGCUsage,
|
void GCMemoryManager::gc_end(bool recordPostGCUsage,
|
||||||
bool recordAccumulatedGCTime,
|
bool recordAccumulatedGCTime,
|
||||||
bool recordGCEndTime, bool countCollection) {
|
bool recordGCEndTime, bool countCollection,
|
||||||
|
GCCause::Cause cause) {
|
||||||
if (recordAccumulatedGCTime) {
|
if (recordAccumulatedGCTime) {
|
||||||
_accumulated_timer.stop();
|
_accumulated_timer.stop();
|
||||||
}
|
}
|
||||||
|
@ -283,6 +286,11 @@ void GCMemoryManager::gc_end(bool recordPostGCUsage,
|
||||||
pool->set_last_collection_usage(usage);
|
pool->set_last_collection_usage(usage);
|
||||||
LowMemoryDetector::detect_after_gc_memory(pool);
|
LowMemoryDetector::detect_after_gc_memory(pool);
|
||||||
}
|
}
|
||||||
|
if(is_notification_enabled()) {
|
||||||
|
bool isMajorGC = this == MemoryService::get_major_gc_manager();
|
||||||
|
GCNotifier::pushNotification(this, isMajorGC ? "end of major GC" : "end of minor GC",
|
||||||
|
GCCause::to_string(cause));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (countCollection) {
|
if (countCollection) {
|
||||||
_num_collections++;
|
_num_collections++;
|
||||||
|
|
|
@ -166,6 +166,7 @@ private:
|
||||||
Mutex* _last_gc_lock;
|
Mutex* _last_gc_lock;
|
||||||
GCStatInfo* _current_gc_stat;
|
GCStatInfo* _current_gc_stat;
|
||||||
int _num_gc_threads;
|
int _num_gc_threads;
|
||||||
|
volatile bool _notification_enabled;
|
||||||
public:
|
public:
|
||||||
GCMemoryManager();
|
GCMemoryManager();
|
||||||
~GCMemoryManager();
|
~GCMemoryManager();
|
||||||
|
@ -181,7 +182,7 @@ public:
|
||||||
void gc_begin(bool recordGCBeginTime, bool recordPreGCUsage,
|
void gc_begin(bool recordGCBeginTime, bool recordPreGCUsage,
|
||||||
bool recordAccumulatedGCTime);
|
bool recordAccumulatedGCTime);
|
||||||
void gc_end(bool recordPostGCUsage, bool recordAccumulatedGCTime,
|
void gc_end(bool recordPostGCUsage, bool recordAccumulatedGCTime,
|
||||||
bool recordGCEndTime, bool countCollection);
|
bool recordGCEndTime, bool countCollection, GCCause::Cause cause);
|
||||||
|
|
||||||
void reset_gc_stat() { _num_collections = 0; _accumulated_timer.reset(); }
|
void reset_gc_stat() { _num_collections = 0; _accumulated_timer.reset(); }
|
||||||
|
|
||||||
|
@ -189,6 +190,8 @@ public:
|
||||||
// the collection count. Zero signifies no gc has taken place.
|
// the collection count. Zero signifies no gc has taken place.
|
||||||
size_t get_last_gc_stat(GCStatInfo* dest);
|
size_t get_last_gc_stat(GCStatInfo* dest);
|
||||||
|
|
||||||
|
void set_notification_enabled(bool enabled) { _notification_enabled = enabled; }
|
||||||
|
bool is_notification_enabled() { return _notification_enabled; }
|
||||||
virtual MemoryManager::Name kind() = 0;
|
virtual MemoryManager::Name kind() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -565,7 +565,8 @@ void MemoryService::gc_begin(bool fullGC, bool recordGCBeginTime,
|
||||||
|
|
||||||
void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage,
|
void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage,
|
||||||
bool recordAccumulatedGCTime,
|
bool recordAccumulatedGCTime,
|
||||||
bool recordGCEndTime, bool countCollection) {
|
bool recordGCEndTime, bool countCollection,
|
||||||
|
GCCause::Cause cause) {
|
||||||
|
|
||||||
GCMemoryManager* mgr;
|
GCMemoryManager* mgr;
|
||||||
if (fullGC) {
|
if (fullGC) {
|
||||||
|
@ -577,7 +578,7 @@ void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage,
|
||||||
|
|
||||||
// register the GC end statistics and memory usage
|
// register the GC end statistics and memory usage
|
||||||
mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
|
mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
|
||||||
countCollection);
|
countCollection, cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryService::oops_do(OopClosure* f) {
|
void MemoryService::oops_do(OopClosure* f) {
|
||||||
|
@ -633,7 +634,7 @@ Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) {
|
||||||
// gc manager (so _fullGC is set to false ) and for other generation kinds
|
// gc manager (so _fullGC is set to false ) and for other generation kinds
|
||||||
// doing mark-sweep-compact uses major gc manager (so _fullGC is set
|
// doing mark-sweep-compact uses major gc manager (so _fullGC is set
|
||||||
// to true).
|
// to true).
|
||||||
TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind) {
|
TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) {
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case Generation::DefNew:
|
case Generation::DefNew:
|
||||||
#ifndef SERIALGC
|
#ifndef SERIALGC
|
||||||
|
@ -654,9 +655,10 @@ TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind) {
|
||||||
}
|
}
|
||||||
// this has to be called in a stop the world pause and represent
|
// this has to be called in a stop the world pause and represent
|
||||||
// an entire gc pause, start to finish:
|
// an entire gc pause, start to finish:
|
||||||
initialize(_fullGC, true, true, true, true, true, true, true);
|
initialize(_fullGC, cause,true, true, true, true, true, true, true);
|
||||||
}
|
}
|
||||||
TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
|
TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
|
||||||
|
GCCause::Cause cause,
|
||||||
bool recordGCBeginTime,
|
bool recordGCBeginTime,
|
||||||
bool recordPreGCUsage,
|
bool recordPreGCUsage,
|
||||||
bool recordPeakUsage,
|
bool recordPeakUsage,
|
||||||
|
@ -664,7 +666,7 @@ TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
|
||||||
bool recordAccumulatedGCTime,
|
bool recordAccumulatedGCTime,
|
||||||
bool recordGCEndTime,
|
bool recordGCEndTime,
|
||||||
bool countCollection) {
|
bool countCollection) {
|
||||||
initialize(fullGC, recordGCBeginTime, recordPreGCUsage, recordPeakUsage,
|
initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage,
|
||||||
recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
|
recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
|
||||||
countCollection);
|
countCollection);
|
||||||
}
|
}
|
||||||
|
@ -672,6 +674,7 @@ TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
|
||||||
// for a subclass to create then initialize an instance before invoking
|
// for a subclass to create then initialize an instance before invoking
|
||||||
// the MemoryService
|
// the MemoryService
|
||||||
void TraceMemoryManagerStats::initialize(bool fullGC,
|
void TraceMemoryManagerStats::initialize(bool fullGC,
|
||||||
|
GCCause::Cause cause,
|
||||||
bool recordGCBeginTime,
|
bool recordGCBeginTime,
|
||||||
bool recordPreGCUsage,
|
bool recordPreGCUsage,
|
||||||
bool recordPeakUsage,
|
bool recordPeakUsage,
|
||||||
|
@ -687,6 +690,7 @@ void TraceMemoryManagerStats::initialize(bool fullGC,
|
||||||
_recordAccumulatedGCTime = recordAccumulatedGCTime;
|
_recordAccumulatedGCTime = recordAccumulatedGCTime;
|
||||||
_recordGCEndTime = recordGCEndTime;
|
_recordGCEndTime = recordGCEndTime;
|
||||||
_countCollection = countCollection;
|
_countCollection = countCollection;
|
||||||
|
_cause = cause;
|
||||||
|
|
||||||
MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime,
|
MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime,
|
||||||
_recordPreGCUsage, _recordPeakUsage);
|
_recordPreGCUsage, _recordPeakUsage);
|
||||||
|
@ -694,6 +698,6 @@ void TraceMemoryManagerStats::initialize(bool fullGC,
|
||||||
|
|
||||||
TraceMemoryManagerStats::~TraceMemoryManagerStats() {
|
TraceMemoryManagerStats::~TraceMemoryManagerStats() {
|
||||||
MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime,
|
MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime,
|
||||||
_recordGCEndTime, _countCollection);
|
_recordGCEndTime, _countCollection, _cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "memory/generation.hpp"
|
#include "memory/generation.hpp"
|
||||||
#include "runtime/handles.hpp"
|
#include "runtime/handles.hpp"
|
||||||
#include "services/memoryUsage.hpp"
|
#include "services/memoryUsage.hpp"
|
||||||
|
#include "gc_interface/gcCause.hpp"
|
||||||
|
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
class MemoryPool;
|
class MemoryPool;
|
||||||
|
@ -162,7 +163,8 @@ public:
|
||||||
bool recordPreGCUsage, bool recordPeakUsage);
|
bool recordPreGCUsage, bool recordPeakUsage);
|
||||||
static void gc_end(bool fullGC, bool recordPostGCUsage,
|
static void gc_end(bool fullGC, bool recordPostGCUsage,
|
||||||
bool recordAccumulatedGCTime,
|
bool recordAccumulatedGCTime,
|
||||||
bool recordGCEndTime, bool countCollection);
|
bool recordGCEndTime, bool countCollection,
|
||||||
|
GCCause::Cause cause);
|
||||||
|
|
||||||
|
|
||||||
static void oops_do(OopClosure* f);
|
static void oops_do(OopClosure* f);
|
||||||
|
@ -172,6 +174,14 @@ public:
|
||||||
|
|
||||||
// Create an instance of java/lang/management/MemoryUsage
|
// Create an instance of java/lang/management/MemoryUsage
|
||||||
static Handle create_MemoryUsage_obj(MemoryUsage usage, TRAPS);
|
static Handle create_MemoryUsage_obj(MemoryUsage usage, TRAPS);
|
||||||
|
|
||||||
|
static const GCMemoryManager* get_minor_gc_manager() {
|
||||||
|
return _minor_gc_manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const GCMemoryManager* get_major_gc_manager() {
|
||||||
|
return _major_gc_manager;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TraceMemoryManagerStats : public StackObj {
|
class TraceMemoryManagerStats : public StackObj {
|
||||||
|
@ -184,10 +194,11 @@ private:
|
||||||
bool _recordAccumulatedGCTime;
|
bool _recordAccumulatedGCTime;
|
||||||
bool _recordGCEndTime;
|
bool _recordGCEndTime;
|
||||||
bool _countCollection;
|
bool _countCollection;
|
||||||
|
GCCause::Cause _cause;
|
||||||
public:
|
public:
|
||||||
TraceMemoryManagerStats() {}
|
TraceMemoryManagerStats() {}
|
||||||
TraceMemoryManagerStats(bool fullGC,
|
TraceMemoryManagerStats(bool fullGC,
|
||||||
|
GCCause::Cause cause,
|
||||||
bool recordGCBeginTime = true,
|
bool recordGCBeginTime = true,
|
||||||
bool recordPreGCUsage = true,
|
bool recordPreGCUsage = true,
|
||||||
bool recordPeakUsage = true,
|
bool recordPeakUsage = true,
|
||||||
|
@ -197,6 +208,7 @@ public:
|
||||||
bool countCollection = true);
|
bool countCollection = true);
|
||||||
|
|
||||||
void initialize(bool fullGC,
|
void initialize(bool fullGC,
|
||||||
|
GCCause::Cause cause,
|
||||||
bool recordGCBeginTime,
|
bool recordGCBeginTime,
|
||||||
bool recordPreGCUsage,
|
bool recordPreGCUsage,
|
||||||
bool recordPeakUsage,
|
bool recordPeakUsage,
|
||||||
|
@ -205,7 +217,7 @@ public:
|
||||||
bool recordGCEndTime,
|
bool recordGCEndTime,
|
||||||
bool countCollection);
|
bool countCollection);
|
||||||
|
|
||||||
TraceMemoryManagerStats(Generation::Name kind);
|
TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause);
|
||||||
~TraceMemoryManagerStats();
|
~TraceMemoryManagerStats();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue