Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
982e99c5
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
982e99c5
编写于
5月 12, 2011
作者:
N
never
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
f2f1643e
49ccbd3b
变更
33
展开全部
隐藏空白更改
内联
并排
Showing
33 changed file
with
777 addition
and
194 deletion
+777
-194
make/solaris/makefiles/saproc.make
make/solaris/makefiles/saproc.make
+16
-13
src/os/linux/vm/os_linux.cpp
src/os/linux/vm/os_linux.cpp
+1
-1
src/share/vm/classfile/vmSymbols.hpp
src/share/vm/classfile/vmSymbols.hpp
+8
-0
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
...ion/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+11
-6
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
...ion/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+2
-2
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+2
-2
src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
...hare/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
+229
-99
src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp
...are/vm/gc_implementation/parNew/parOopClosures.inline.hpp
+17
-1
src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
...are/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
+1
-1
src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
.../gc_implementation/parallelScavenge/psParallelCompact.cpp
+1
-1
src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
...hare/vm/gc_implementation/parallelScavenge/psScavenge.cpp
+1
-1
src/share/vm/memory/blockOffsetTable.cpp
src/share/vm/memory/blockOffsetTable.cpp
+15
-2
src/share/vm/memory/cardTableModRefBS.cpp
src/share/vm/memory/cardTableModRefBS.cpp
+11
-7
src/share/vm/memory/cardTableModRefBS.hpp
src/share/vm/memory/cardTableModRefBS.hpp
+18
-18
src/share/vm/memory/cardTableRS.cpp
src/share/vm/memory/cardTableRS.cpp
+3
-7
src/share/vm/memory/cardTableRS.hpp
src/share/vm/memory/cardTableRS.hpp
+2
-3
src/share/vm/memory/genCollectedHeap.cpp
src/share/vm/memory/genCollectedHeap.cpp
+1
-1
src/share/vm/memory/space.cpp
src/share/vm/memory/space.cpp
+11
-3
src/share/vm/runtime/advancedThresholdPolicy.cpp
src/share/vm/runtime/advancedThresholdPolicy.cpp
+22
-3
src/share/vm/runtime/advancedThresholdPolicy.hpp
src/share/vm/runtime/advancedThresholdPolicy.hpp
+22
-3
src/share/vm/runtime/globals.hpp
src/share/vm/runtime/globals.hpp
+13
-3
src/share/vm/runtime/serviceThread.cpp
src/share/vm/runtime/serviceThread.cpp
+9
-2
src/share/vm/runtime/simpleThresholdPolicy.cpp
src/share/vm/runtime/simpleThresholdPolicy.cpp
+1
-1
src/share/vm/runtime/simpleThresholdPolicy.hpp
src/share/vm/runtime/simpleThresholdPolicy.hpp
+1
-1
src/share/vm/services/gcNotifier.cpp
src/share/vm/services/gcNotifier.cpp
+216
-0
src/share/vm/services/gcNotifier.hpp
src/share/vm/services/gcNotifier.hpp
+69
-0
src/share/vm/services/jmm.h
src/share/vm/services/jmm.h
+4
-1
src/share/vm/services/management.cpp
src/share/vm/services/management.cpp
+28
-1
src/share/vm/services/management.hpp
src/share/vm/services/management.hpp
+4
-0
src/share/vm/services/memoryManager.cpp
src/share/vm/services/memoryManager.cpp
+9
-1
src/share/vm/services/memoryManager.hpp
src/share/vm/services/memoryManager.hpp
+4
-1
src/share/vm/services/memoryService.cpp
src/share/vm/services/memoryService.cpp
+10
-6
src/share/vm/services/memoryService.hpp
src/share/vm/services/memoryService.hpp
+15
-3
未找到文件。
make/solaris/makefiles/saproc.make
浏览文件 @
982e99c5
...
...
@@ -57,24 +57,27 @@ SA_LFLAGS += -mt -xnolib -norunpath
endif
# 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():
# - skip SunOS 4 or older
# - skip Solaris 10 or older
# - skip two digit Nevada builds
# - skip three digit Nevada builds thru 149
# - skip Nevada builds 150-158
# - skip two digit internal Nevada builds
# - skip three digit internal Nevada builds thru 149
# - skip internal Nevada builds 150-158
# - if not skipped, print define for Nevada-B159 or later
SOLARIS_11_B159_OR_LATER
:=
\
$(
shell
uname
-r
-v
\
|
sed
-n
' \
/^[0-3]\. /b \
/^5\.[0-9] /b \
/^5\.10 /b \
/ snv_[0-9][0-9]$/b \
/ snv_[01][0-4][0-9]$/b \
/ snv_15[0-8]$/b \
s/.*/-DSOLARIS_11_B159_OR_LATER/p \
'
)
|
sed
-n
\
-e
'/^[0-4]\. /b'
\
-e
'/^5\.[0-9] /b'
\
-e
'/^5\.10 /b'
\
-e
'/ snv_[0-9][0-9]$/b'
\
-e
'/ snv_[01][0-4][0-9]$/b'
\
-e
'/ snv_15[0-8]$/b'
\
-e
's/.*/-DSOLARIS_11_B159_OR_LATER/'
\
-e
'p'
\
)
# Uncomment the following to simulate building on Nevada-B159 or later
# when actually building on Nevada-B158 or earlier:
...
...
src/os/linux/vm/os_linux.cpp
浏览文件 @
982e99c5
...
...
@@ -2850,7 +2850,7 @@ bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) {
char
chars
[
257
];
long
x
=
0
;
if
(
fgets
(
chars
,
sizeof
(
chars
),
fp
))
{
if
(
sscanf
(
chars
,
"%lx-%*
l
x"
,
&
x
)
==
1
if
(
sscanf
(
chars
,
"%lx-%*x"
,
&
x
)
==
1
&&
x
==
(
long
)
p
)
{
if
(
strstr
(
chars
,
"hugepage"
))
{
result
=
true
;
...
...
src/share/vm/classfile/vmSymbols.hpp
浏览文件 @
982e99c5
...
...
@@ -473,6 +473,13 @@
template(sun_management_ManagementFactory, "sun/management/ManagementFactory") \
template(sun_management_Sensor, "sun/management/Sensor") \
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(createMemoryManagerMBean_name, "createMemoryManagerMBean") \
template(createGarbageCollectorMBean_name, "createGarbageCollectorMBean") \
...
...
@@ -490,6 +497,7 @@
template(java_lang_management_MemoryPoolMXBean, "java/lang/management/MemoryPoolMXBean") \
template(java_lang_management_MemoryManagerMXBean, "java/lang/management/MemoryManagerMXBean") \
template(java_lang_management_GarbageCollectorMXBean,"java/lang/management/GarbageCollectorMXBean") \
template(gcInfoBuilder_name, "gcInfoBuilder") \
template(createMemoryPool_name, "createMemoryPool") \
template(createMemoryManager_name, "createMemoryManager") \
template(createGarbageCollector_name, "createGarbageCollector") \
...
...
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
浏览文件 @
982e99c5
...
...
@@ -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
(),
ref_processor
(),
clear_all_soft_refs
);
...
...
@@ -3479,7 +3479,7 @@ CMSPhaseAccounting::~CMSPhaseAccounting() {
void
CMSCollector
::
checkpointRootsInitial
(
bool
asynch
)
{
assert
(
_collectorState
==
InitialMarking
,
"Wrong collector state"
);
check_correct_thread_executing
();
TraceCMSMemoryManagerStats
tms
(
_collectorState
);
TraceCMSMemoryManagerStats
tms
(
_collectorState
,
GenCollectedHeap
::
heap
()
->
gc_cause
()
);
ReferenceProcessor
*
rp
=
ref_processor
();
SpecializationStats
::
clear
();
...
...
@@ -4858,7 +4858,8 @@ void CMSCollector::checkpointRootsFinal(bool asynch,
// world is stopped at this checkpoint
assert
(
SafepointSynchronize
::
is_at_safepoint
(),
"world should be stopped"
);
TraceCMSMemoryManagerStats
tms
(
_collectorState
);
TraceCMSMemoryManagerStats
tms
(
_collectorState
,
GenCollectedHeap
::
heap
()
->
gc_cause
());
verify_work_stacks_empty
();
verify_overflow_empty
();
...
...
@@ -5993,7 +5994,7 @@ void CMSCollector::sweep(bool asynch) {
verify_work_stacks_empty
();
verify_overflow_empty
();
increment_sweep_count
();
TraceCMSMemoryManagerStats
tms
(
_collectorState
);
TraceCMSMemoryManagerStats
tms
(
_collectorState
,
GenCollectedHeap
::
heap
()
->
gc_cause
()
);
_inter_sweep_timer
.
stop
();
_inter_sweep_estimate
.
sample
(
_inter_sweep_timer
.
seconds
());
...
...
@@ -9235,11 +9236,12 @@ size_t MarkDeadObjectsClosure::do_blk(HeapWord* addr) {
return
res
;
}
TraceCMSMemoryManagerStats
::
TraceCMSMemoryManagerStats
(
CMSCollector
::
CollectorState
phase
)
:
TraceMemoryManagerStats
()
{
TraceCMSMemoryManagerStats
::
TraceCMSMemoryManagerStats
(
CMSCollector
::
CollectorState
phase
,
GCCause
::
Cause
cause
)
:
TraceMemoryManagerStats
()
{
switch
(
phase
)
{
case
CMSCollector
::
InitialMarking
:
initialize
(
true
/* fullGC */
,
cause
/* cause of the GC */
,
true
/* recordGCBeginTime */
,
true
/* recordPreGCUsage */
,
false
/* recordPeakUsage */
,
...
...
@@ -9251,6 +9253,7 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt
case
CMSCollector
::
FinalMarking
:
initialize
(
true
/* fullGC */
,
cause
/* cause of the GC */
,
false
/* recordGCBeginTime */
,
false
/* recordPreGCUsage */
,
false
/* recordPeakUsage */
,
...
...
@@ -9262,6 +9265,7 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt
case
CMSCollector
::
Sweeping
:
initialize
(
true
/* fullGC */
,
cause
/* cause of the GC */
,
false
/* recordGCBeginTime */
,
false
/* recordPreGCUsage */
,
true
/* recordPeakUsage */
,
...
...
@@ -9277,8 +9281,9 @@ TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorSt
}
// when bailing out of cms in concurrent mode failure
TraceCMSMemoryManagerStats
::
TraceCMSMemoryManagerStats
()
:
TraceMemoryManagerStats
()
{
TraceCMSMemoryManagerStats
::
TraceCMSMemoryManagerStats
(
GCCause
::
Cause
cause
)
:
TraceMemoryManagerStats
()
{
initialize
(
true
/* fullGC */
,
cause
/* cause of the GC */
,
true
/* recordGCBeginTime */
,
true
/* recordPreGCUsage */
,
true
/* recordPeakUsage */
,
...
...
src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
浏览文件 @
982e99c5
...
...
@@ -1895,8 +1895,8 @@ public:
class
TraceCMSMemoryManagerStats
:
public
TraceMemoryManagerStats
{
public:
TraceCMSMemoryManagerStats
(
CMSCollector
::
CollectorState
phase
);
TraceCMSMemoryManagerStats
();
TraceCMSMemoryManagerStats
(
CMSCollector
::
CollectorState
phase
,
GCCause
::
Cause
cause
);
TraceCMSMemoryManagerStats
(
GCCause
::
Cause
cause
);
};
...
...
src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
浏览文件 @
982e99c5
...
...
@@ -1162,7 +1162,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
PrintGC
,
true
,
gclog_or_tty
);
TraceCollectorStats
tcs
(
g1mm
()
->
full_collection_counters
());
TraceMemoryManagerStats
tms
(
true
/* fullGC */
);
TraceMemoryManagerStats
tms
(
true
/* fullGC */
,
gc_cause
()
);
double
start
=
os
::
elapsedTime
();
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
);
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
// free_list. No need to wait for the cleanup operation to finish;
...
...
src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
浏览文件 @
982e99c5
此差异已折叠。
点击以展开。
src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp
浏览文件 @
982e99c5
...
...
@@ -77,7 +77,23 @@ inline void ParScanClosure::do_oop_work(T* p,
if
(
!
oopDesc
::
is_null
(
heap_oop
))
{
oop
obj
=
oopDesc
::
decode_heap_oop_not_null
(
heap_oop
);
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.
// 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
...
...
src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
浏览文件 @
982e99c5
...
...
@@ -173,7 +173,7 @@ void PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
TraceCPUTime
tcpu
(
PrintGCDetails
,
true
,
gclog_or_tty
);
TraceTime
t1
(
gc_cause_str
,
PrintGC
,
!
PrintGCDetails
,
gclog_or_tty
);
TraceCollectorStats
tcs
(
counters
());
TraceMemoryManagerStats
tms
(
true
/* Full GC */
);
TraceMemoryManagerStats
tms
(
true
/* Full GC */
,
gc_cause
);
if
(
TraceGen1Time
)
accumulated_time
()
->
start
();
...
...
src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
浏览文件 @
982e99c5
...
...
@@ -2057,7 +2057,7 @@ void PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
TraceCPUTime
tcpu
(
PrintGCDetails
,
true
,
gclog_or_tty
);
TraceTime
t1
(
gc_cause_str
,
PrintGC
,
!
PrintGCDetails
,
gclog_or_tty
);
TraceCollectorStats
tcs
(
counters
());
TraceMemoryManagerStats
tms
(
true
/* Full GC */
);
TraceMemoryManagerStats
tms
(
true
/* Full GC */
,
gc_cause
);
if
(
TraceGen1Time
)
accumulated_time
()
->
start
();
...
...
src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
浏览文件 @
982e99c5
...
...
@@ -322,7 +322,7 @@ bool PSScavenge::invoke_no_policy() {
TraceCPUTime
tcpu
(
PrintGCDetails
,
true
,
gclog_or_tty
);
TraceTime
t1
(
"GC"
,
PrintGC
,
!
PrintGCDetails
,
gclog_or_tty
);
TraceCollectorStats
tcs
(
counters
());
TraceMemoryManagerStats
tms
(
false
/* not full GC */
);
TraceMemoryManagerStats
tms
(
false
/* not full GC */
,
gc_cause
);
if
(
TraceGen0Time
)
accumulated_time
()
->
start
();
...
...
src/share/vm/memory/blockOffsetTable.cpp
浏览文件 @
982e99c5
...
...
@@ -541,20 +541,33 @@ HeapWord* BlockOffsetArrayNonContigSpace::block_start_unsafe(
// to go back by.
size_t
n_cards_back
=
entry_to_cards_back
(
offset
);
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
;
offset
=
_array
->
offset_array
(
index
);
}
assert
(
offset
<
N_words
,
"offset too large"
);
index
--
;
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
;
while
(
n
<=
addr
)
{
debug_only
(
HeapWord
*
last
=
q
);
// for debugging
q
=
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
(
addr
<=
n
,
err_msg
(
"wrong order for arg ("
INTPTR_FORMAT
") <= next ("
INTPTR_FORMAT
")"
,
addr
,
n
));
...
...
src/share/vm/memory/cardTableModRefBS.cpp
浏览文件 @
982e99c5
...
...
@@ -455,25 +455,29 @@ bool CardTableModRefBS::mark_card_deferred(size_t card_index) {
return
true
;
}
void
CardTableModRefBS
::
non_clean_card_iterate_possibly_parallel
(
Space
*
sp
,
MemRegion
mr
,
DirtyCardToOopClosure
*
dcto_
cl
,
C
learNoncleanCardWrapper
*
cl
)
{
OopsInGenClosure
*
cl
,
C
ardTableRS
*
ct
)
{
if
(
!
mr
.
is_empty
())
{
int
n_threads
=
SharedHeap
::
heap
()
->
n_par_threads
();
if
(
n_threads
>
0
)
{
#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
fatal
(
"Parallel gc not supported here."
);
#endif // SERIALGC
}
else
{
// 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
// do for us), and the ClearNoncleanCardWrapper closure itself does the work
// of finding contiguous dirty ranges of cards to process (and clear).
cl
->
do_MemRegion
(
mr
);
// do for us): clear_cl here does the work of finding contiguous dirty ranges
// of cards to process and clear.
DirtyCardToOopClosure
*
dcto_cl
=
sp
->
new_dcto_cl
(
cl
,
precision
(),
cl
->
gen_boundary
());
ClearNoncleanCardWrapper
clear_cl
(
dcto_cl
,
ct
);
clear_cl
.
do_MemRegion
(
mr
);
}
}
}
...
...
src/share/vm/memory/cardTableModRefBS.hpp
浏览文件 @
982e99c5
...
...
@@ -150,7 +150,9 @@ class CardTableModRefBS: public ModRefBarrierSet {
// Mapping from address to card marking array entry
jbyte
*
byte_for
(
const
void
*
p
)
const
{
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
];
assert
(
result
>=
_byte_map
&&
result
<
_byte_map
+
_byte_map_size
,
"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
// worker threads are available, and clear the dirty cards as it
// processes them.
// ClearNoncleanCardWrapper cl must wrap the DirtyCardToOopClosure dcto_cl,
// which may itself be modified by the method.
// XXX ??? MemRegionClosure above vs OopsInGenClosure below XXX
// 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
,
DirtyCardToOopClosure
*
dcto_cl
,
ClearNoncleanCardWrapper
*
cl
);
OopsInGenClosure
*
cl
,
CardTableRS
*
ct
);
private:
// Work method used to implement non_clean_card_iterate_possibly_parallel()
// above in the parallel case.
void
non_clean_card_iterate_parallel_work
(
Space
*
sp
,
MemRegion
mr
,
DirtyCardToOopClosure
*
dcto_cl
,
ClearNoncleanCardWrapper
*
cl
,
OopsInGenClosure
*
cl
,
CardTableRS
*
ct
,
int
n_threads
);
protected:
...
...
@@ -198,11 +199,6 @@ class CardTableModRefBS: public ModRefBarrierSet {
// *** Support for parallel card scanning.
enum
SomeConstantsForParallelism
{
StridesPerThread
=
2
,
CardsPerStrideChunk
=
256
};
// 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
// covered region. Each entry of these arrays is the lowest non-clean
...
...
@@ -235,7 +231,7 @@ class CardTableModRefBS: public ModRefBarrierSet {
// covers the given address.
uintptr_t
addr_to_chunk_index
(
const
void
*
addr
)
{
uintptr_t
card
=
(
uintptr_t
)
byte_for
(
addr
);
return
card
/
CardsPerStrideChunk
;
return
card
/
ParGC
CardsPerStrideChunk
;
}
// 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
,
MemRegion
used
,
jint
stride
,
int
n_strides
,
DirtyCardToOopClosure
*
dcto_
cl
,
C
learNoncleanCardWrapper
*
cl
,
OopsInGenClosure
*
cl
,
C
ardTableRS
*
ct
,
jbyte
**
lowest_non_clean
,
uintptr_t
lowest_non_clean_base_chunk_index
,
size_t
lowest_non_clean_chunk_size
);
...
...
@@ -457,14 +453,18 @@ public:
size_t
delta
=
pointer_delta
(
p
,
byte_map_base
,
sizeof
(
jbyte
));
HeapWord
*
result
=
(
HeapWord
*
)
(
delta
<<
card_shift
);
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
;
}
// Mapping from address to card marking array index.
size_t
index_for
(
void
*
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
;
}
...
...
@@ -482,7 +482,7 @@ public:
void
verify_dirty_region
(
MemRegion
mr
)
PRODUCT_RETURN
;
static
size_t
par_chunk_heapword_alignment
()
{
return
CardsPerStrideChunk
*
card_size_in_words
;
return
ParGC
CardsPerStrideChunk
*
card_size_in_words
;
}
};
...
...
src/share/vm/memory/cardTableRS.cpp
浏览文件 @
982e99c5
...
...
@@ -162,7 +162,7 @@ inline bool ClearNoncleanCardWrapper::clear_card_serial(jbyte* entry) {
}
ClearNoncleanCardWrapper
::
ClearNoncleanCardWrapper
(
MemRegion
Closure
*
dirty_card_closure
,
CardTableRS
*
ct
)
:
DirtyCardToOop
Closure
*
dirty_card_closure
,
CardTableRS
*
ct
)
:
_dirty_card_closure
(
dirty_card_closure
),
_ct
(
ct
)
{
_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
,
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
();
#ifdef ASSERT
// 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
))
{
warning
(
"CMS+ParNew: Flickering used_region_at_save_marks()!!"
);
}
ShouldNotReachHere
();
}
#endif
_ct_bs
->
non_clean_card_iterate_possibly_parallel
(
sp
,
urasm
,
dcto_cl
,
&
clear_cl
);
_ct_bs
->
non_clean_card_iterate_possibly_parallel
(
sp
,
urasm
,
cl
,
this
);
}
void
CardTableRS
::
clear_into_younger
(
Generation
*
gen
,
bool
clear_perm
)
{
...
...
src/share/vm/memory/cardTableRS.hpp
浏览文件 @
982e99c5
...
...
@@ -31,7 +31,6 @@
class
Space
;
class
OopsInGenClosure
;
class
DirtyCardToOopClosure
;
// 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.
...
...
@@ -167,7 +166,7 @@ public:
};
class
ClearNoncleanCardWrapper
:
public
MemRegionClosure
{
MemRegion
Closure
*
_dirty_card_closure
;
DirtyCardToOop
Closure
*
_dirty_card_closure
;
CardTableRS
*
_ct
;
bool
_is_par
;
private:
...
...
@@ -179,7 +178,7 @@ private:
inline
bool
clear_card_parallel
(
jbyte
*
entry
);
public:
ClearNoncleanCardWrapper
(
MemRegion
Closure
*
dirty_card_closure
,
CardTableRS
*
ct
);
ClearNoncleanCardWrapper
(
DirtyCardToOop
Closure
*
dirty_card_closure
,
CardTableRS
*
ct
);
void
do_MemRegion
(
MemRegion
mr
);
};
...
...
src/share/vm/memory/genCollectedHeap.cpp
浏览文件 @
982e99c5
...
...
@@ -537,7 +537,7 @@ void GenCollectedHeap::do_collection(bool full,
// Timer for individual generations. Last argument is false: no CR
TraceTime
t1
(
_gens
[
i
]
->
short_name
(),
PrintGCDetails
,
false
,
gclog_or_tty
);
TraceCollectorStats
tcs
(
_gens
[
i
]
->
counters
());
TraceMemoryManagerStats
tmms
(
_gens
[
i
]
->
kind
());
TraceMemoryManagerStats
tmms
(
_gens
[
i
]
->
kind
()
,
gc_cause
()
);
size_t
prev_used
=
_gens
[
i
]
->
used
();
_gens
[
i
]
->
stat_record
()
->
invocations
++
;
...
...
src/share/vm/memory/space.cpp
浏览文件 @
982e99c5
...
...
@@ -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
)
{
// 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
// -- something that could happen with a concurrent sweeper.
bottom
=
MIN2
(
bottom
,
top
);
mr
=
MemRegion
(
bottom
,
top
);
MemRegion
extended_mr
=
MemRegion
(
bottom
,
top
);
assert
(
bottom
<=
top
&&
(
_precision
!=
CardTableModRefBS
::
ObjHeadPreciseArray
||
_min_done
==
NULL
||
...
...
@@ -156,8 +164,8 @@ void DirtyCardToOopClosure::do_MemRegion(MemRegion mr) {
"overlap!"
);
// Walk the region if it is not empty; otherwise there is nothing to do.
if
(
!
mr
.
is_empty
())
{
walk_mem_region
(
mr
,
bottom_obj
,
top
);
if
(
!
extended_
mr
.
is_empty
())
{
walk_mem_region
(
extended_
mr
,
bottom_obj
,
top
);
}
// An idempotent closure might be applied in any order, so we don't
...
...
src/share/vm/runtime/advancedThresholdPolicy.cpp
浏览文件 @
982e99c5
/*
* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
* Copyright (c) 2010, 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 "runtime/advancedThresholdPolicy.hpp"
...
...
src/share/vm/runtime/advancedThresholdPolicy.hpp
浏览文件 @
982e99c5
/*
* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
* Copyright (c) 2010, 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_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
#define SHARE_VM_RUNTIME_ADVANCEDTHRESHOLDPOLICY_HPP
...
...
src/share/vm/runtime/globals.hpp
浏览文件 @
982e99c5
...
...
@@ -1460,8 +1460,10 @@ class CommandLineFlags {
product(intx, ParallelGCBufferWastePct, 10, \
"wasted fraction of parallel allocation buffer.") \
\
product(bool, ParallelGCRetainPLAB, true, \
"Retain parallel allocation buffers across scavenges.") \
diagnostic(bool, ParallelGCRetainPLAB, false, \
"Retain parallel allocation buffers across scavenges; " \
" -- disabled because this currently conflicts with " \
" parallel card scanning under certain conditions ") \
\
product(intx, TargetPLABWastePct, 10, \
"target wasted space in last buffer as pct of overall allocation")\
...
...
@@ -1495,7 +1497,15 @@ class CommandLineFlags {
product(uintx, ParGCDesiredObjsFromOverflowList, 20, \
"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 "\
"parallel GC.") \
\
...
...
src/share/vm/runtime/serviceThread.cpp
浏览文件 @
982e99c5
...
...
@@ -28,6 +28,7 @@
#include "runtime/serviceThread.hpp"
#include "runtime/mutexLocker.hpp"
#include "prims/jvmtiImpl.hpp"
#include "services/gcNotifier.hpp"
ServiceThread
*
ServiceThread
::
_instance
=
NULL
;
...
...
@@ -81,6 +82,7 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
while
(
true
)
{
bool
sensors_changed
=
false
;
bool
has_jvmti_events
=
false
;
bool
has_gc_notification_event
=
false
;
JvmtiDeferredEvent
jvmti_event
;
{
// 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
);
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
// pending JVMTI event to post
// pending JVMTI event
or JMX GC notification
to post
Service_lock
->
wait
(
Mutex
::
_no_safepoint_check_flag
);
}
...
...
@@ -113,6 +116,10 @@ void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
if
(
sensors_changed
)
{
LowMemoryDetector
::
process_sensor_changes
(
jt
);
}
if
(
has_gc_notification_event
)
{
GCNotifier
::
sendNotification
(
CHECK
);
}
}
}
...
...
src/share/vm/runtime/simpleThresholdPolicy.cpp
浏览文件 @
982e99c5
/*
* Copyright (c) 20
01
, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 20
10
, 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
...
...
src/share/vm/runtime/simpleThresholdPolicy.hpp
浏览文件 @
982e99c5
/*
* Copyright (c) 20
01
, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 20
10
, 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
...
...
src/share/vm/services/gcNotifier.cpp
0 → 100644
浏览文件 @
982e99c5
/*
* 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
;
}
}
src/share/vm/services/gcNotifier.hpp
0 → 100644
浏览文件 @
982e99c5
/*
* 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
src/share/vm/services/jmm.h
浏览文件 @
982e99c5
...
...
@@ -48,7 +48,7 @@ enum {
JMM_VERSION_1_0
=
0x20010000
,
JMM_VERSION_1_1
=
0x20010100
,
// JDK 6
JMM_VERSION_1_2
=
0x20010200
,
// JDK 7
JMM_VERSION
=
0x2001020
0
JMM_VERSION
=
0x2001020
1
};
typedef
struct
{
...
...
@@ -293,6 +293,9 @@ typedef struct jmmInterface_1_ {
jlongArray
ids
,
jboolean
lockedMonitors
,
jboolean
lockedSynchronizers
);
void
(
JNICALL
*
SetGCNotificationEnabled
)
(
JNIEnv
*
env
,
jobject
mgr
,
jboolean
enabled
);
}
JmmInterface
;
#ifdef __cplusplus
...
...
src/share/vm/services/management.cpp
浏览文件 @
982e99c5
...
...
@@ -42,6 +42,7 @@
#include "services/classLoadingService.hpp"
#include "services/heapDumper.hpp"
#include "services/lowMemoryDetector.hpp"
#include "services/gcNotifier.hpp"
#include "services/management.hpp"
#include "services/memoryManager.hpp"
#include "services/memoryPool.hpp"
...
...
@@ -60,6 +61,8 @@ klassOop Management::_memoryPoolMXBean_klass = NULL;
klassOop
Management
::
_memoryManagerMXBean_klass
=
NULL
;
klassOop
Management
::
_garbageCollectorMXBean_klass
=
NULL
;
klassOop
Management
::
_managementFactory_klass
=
NULL
;
klassOop
Management
::
_garbageCollectorImpl_klass
=
NULL
;
klassOop
Management
::
_gcInfo_klass
=
NULL
;
jmmOptionalSupport
Management
::
_optional_support
=
{
0
};
TimeStamp
Management
::
_stamp
;
...
...
@@ -179,6 +182,8 @@ void Management::oops_do(OopClosure* f) {
f
->
do_oop
((
oop
*
)
&
_memoryManagerMXBean_klass
);
f
->
do_oop
((
oop
*
)
&
_garbageCollectorMXBean_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
)
{
...
...
@@ -230,6 +235,20 @@ klassOop Management::sun_management_ManagementFactory_klass(TRAPS) {
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
)
{
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_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.
JVM_ENTRY
(
jint
,
jmm_DumpHeap0
(
JNIEnv
*
env
,
jstring
outputfile
,
jboolean
live
))
#ifndef SERVICES_KERNEL
...
...
@@ -2122,7 +2148,8 @@ const struct jmmInterface_1_ jmm_interface = {
jmm_FindDeadlockedThreads
,
jmm_SetVMGlobal
,
NULL
,
jmm_DumpThreads
jmm_DumpThreads
,
jmm_SetGCNotificationEnabled
};
void
*
Management
::
get_jmm_interface
(
int
version
)
{
...
...
src/share/vm/services/management.hpp
浏览文件 @
982e99c5
...
...
@@ -49,6 +49,8 @@ private:
static
klassOop
_memoryManagerMXBean_klass
;
static
klassOop
_garbageCollectorMXBean_klass
;
static
klassOop
_managementFactory_klass
;
static
klassOop
_garbageCollectorImpl_klass
;
static
klassOop
_gcInfo_klass
;
static
klassOop
load_and_initialize_klass
(
Symbol
*
sh
,
TRAPS
);
...
...
@@ -86,6 +88,8 @@ public:
static
klassOop
java_lang_management_GarbageCollectorMXBean_klass
(
TRAPS
);
static
klassOop
sun_management_Sensor_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
,
objArrayHandle
monitors_array
,
typeArrayHandle
depths_array
,
objArrayHandle
synchronizers_array
,
TRAPS
);
...
...
src/share/vm/services/memoryManager.cpp
浏览文件 @
982e99c5
...
...
@@ -33,6 +33,7 @@
#include "services/memoryManager.hpp"
#include "services/memoryPool.hpp"
#include "services/memoryService.hpp"
#include "services/gcNotifier.hpp"
#include "utilities/dtrace.hpp"
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
);
_current_gc_stat
=
NULL
;
_num_gc_threads
=
1
;
_notification_enabled
=
false
;
}
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.
void
GCMemoryManager
::
gc_end
(
bool
recordPostGCUsage
,
bool
recordAccumulatedGCTime
,
bool
recordGCEndTime
,
bool
countCollection
)
{
bool
recordGCEndTime
,
bool
countCollection
,
GCCause
::
Cause
cause
)
{
if
(
recordAccumulatedGCTime
)
{
_accumulated_timer
.
stop
();
}
...
...
@@ -283,6 +286,11 @@ void GCMemoryManager::gc_end(bool recordPostGCUsage,
pool
->
set_last_collection_usage
(
usage
);
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
)
{
_num_collections
++
;
...
...
src/share/vm/services/memoryManager.hpp
浏览文件 @
982e99c5
...
...
@@ -166,6 +166,7 @@ private:
Mutex
*
_last_gc_lock
;
GCStatInfo
*
_current_gc_stat
;
int
_num_gc_threads
;
volatile
bool
_notification_enabled
;
public:
GCMemoryManager
();
~
GCMemoryManager
();
...
...
@@ -181,7 +182,7 @@ public:
void
gc_begin
(
bool
recordGCBeginTime
,
bool
recordPreGCUsage
,
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
();
}
...
...
@@ -189,6 +190,8 @@ public:
// the collection count. Zero signifies no gc has taken place.
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
;
};
...
...
src/share/vm/services/memoryService.cpp
浏览文件 @
982e99c5
...
...
@@ -565,7 +565,8 @@ void MemoryService::gc_begin(bool fullGC, bool recordGCBeginTime,
void
MemoryService
::
gc_end
(
bool
fullGC
,
bool
recordPostGCUsage
,
bool
recordAccumulatedGCTime
,
bool
recordGCEndTime
,
bool
countCollection
)
{
bool
recordGCEndTime
,
bool
countCollection
,
GCCause
::
Cause
cause
)
{
GCMemoryManager
*
mgr
;
if
(
fullGC
)
{
...
...
@@ -577,7 +578,7 @@ void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage,
// register the GC end statistics and memory usage
mgr
->
gc_end
(
recordPostGCUsage
,
recordAccumulatedGCTime
,
recordGCEndTime
,
countCollection
);
countCollection
,
cause
);
}
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
// doing mark-sweep-compact uses major gc manager (so _fullGC is set
// to true).
TraceMemoryManagerStats
::
TraceMemoryManagerStats
(
Generation
::
Name
kind
)
{
TraceMemoryManagerStats
::
TraceMemoryManagerStats
(
Generation
::
Name
kind
,
GCCause
::
Cause
cause
)
{
switch
(
kind
)
{
case
Generation
::
DefNew
:
#ifndef SERIALGC
...
...
@@ -654,9 +655,10 @@ TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind) {
}
// this has to be called in a stop the world pause and represent
// 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
,
GCCause
::
Cause
cause
,
bool
recordGCBeginTime
,
bool
recordPreGCUsage
,
bool
recordPeakUsage
,
...
...
@@ -664,7 +666,7 @@ TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
bool
recordAccumulatedGCTime
,
bool
recordGCEndTime
,
bool
countCollection
)
{
initialize
(
fullGC
,
recordGCBeginTime
,
recordPreGCUsage
,
recordPeakUsage
,
initialize
(
fullGC
,
cause
,
recordGCBeginTime
,
recordPreGCUsage
,
recordPeakUsage
,
recordPostGCUsage
,
recordAccumulatedGCTime
,
recordGCEndTime
,
countCollection
);
}
...
...
@@ -672,6 +674,7 @@ TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
// for a subclass to create then initialize an instance before invoking
// the MemoryService
void
TraceMemoryManagerStats
::
initialize
(
bool
fullGC
,
GCCause
::
Cause
cause
,
bool
recordGCBeginTime
,
bool
recordPreGCUsage
,
bool
recordPeakUsage
,
...
...
@@ -687,6 +690,7 @@ void TraceMemoryManagerStats::initialize(bool fullGC,
_recordAccumulatedGCTime
=
recordAccumulatedGCTime
;
_recordGCEndTime
=
recordGCEndTime
;
_countCollection
=
countCollection
;
_cause
=
cause
;
MemoryService
::
gc_begin
(
_fullGC
,
_recordGCBeginTime
,
_recordAccumulatedGCTime
,
_recordPreGCUsage
,
_recordPeakUsage
);
...
...
@@ -694,6 +698,6 @@ void TraceMemoryManagerStats::initialize(bool fullGC,
TraceMemoryManagerStats
::~
TraceMemoryManagerStats
()
{
MemoryService
::
gc_end
(
_fullGC
,
_recordPostGCUsage
,
_recordAccumulatedGCTime
,
_recordGCEndTime
,
_countCollection
);
_recordGCEndTime
,
_countCollection
,
_cause
);
}
src/share/vm/services/memoryService.hpp
浏览文件 @
982e99c5
...
...
@@ -29,6 +29,7 @@
#include "memory/generation.hpp"
#include "runtime/handles.hpp"
#include "services/memoryUsage.hpp"
#include "gc_interface/gcCause.hpp"
// Forward declaration
class
MemoryPool
;
...
...
@@ -162,7 +163,8 @@ public:
bool
recordPreGCUsage
,
bool
recordPeakUsage
);
static
void
gc_end
(
bool
fullGC
,
bool
recordPostGCUsage
,
bool
recordAccumulatedGCTime
,
bool
recordGCEndTime
,
bool
countCollection
);
bool
recordGCEndTime
,
bool
countCollection
,
GCCause
::
Cause
cause
);
static
void
oops_do
(
OopClosure
*
f
);
...
...
@@ -172,6 +174,14 @@ public:
// Create an instance of java/lang/management/MemoryUsage
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
{
...
...
@@ -184,10 +194,11 @@ private:
bool
_recordAccumulatedGCTime
;
bool
_recordGCEndTime
;
bool
_countCollection
;
GCCause
::
Cause
_cause
;
public:
TraceMemoryManagerStats
()
{}
TraceMemoryManagerStats
(
bool
fullGC
,
GCCause
::
Cause
cause
,
bool
recordGCBeginTime
=
true
,
bool
recordPreGCUsage
=
true
,
bool
recordPeakUsage
=
true
,
...
...
@@ -197,6 +208,7 @@ public:
bool
countCollection
=
true
);
void
initialize
(
bool
fullGC
,
GCCause
::
Cause
cause
,
bool
recordGCBeginTime
,
bool
recordPreGCUsage
,
bool
recordPeakUsage
,
...
...
@@ -205,7 +217,7 @@ public:
bool
recordGCEndTime
,
bool
countCollection
);
TraceMemoryManagerStats
(
Generation
::
Name
kind
);
TraceMemoryManagerStats
(
Generation
::
Name
kind
,
GCCause
::
Cause
cause
);
~
TraceMemoryManagerStats
();
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录