Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
89037d56
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看板
提交
89037d56
编写于
9月 04, 2014
作者:
J
jcoomes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8057531: refactor gc argument processing code slightly
Reviewed-by: mgerdin, tschatzl, jmasa
上级
a69a7e6b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
52 deletion
+66
-52
src/share/vm/runtime/arguments.cpp
src/share/vm/runtime/arguments.cpp
+57
-52
src/share/vm/runtime/arguments.hpp
src/share/vm/runtime/arguments.hpp
+9
-0
未找到文件。
src/share/vm/runtime/arguments.cpp
浏览文件 @
89037d56
...
...
@@ -1532,24 +1532,25 @@ void Arguments::set_conservative_max_heap_alignment() {
CollectorPolicy
::
compute_heap_alignment
());
}
void
Arguments
::
set_ergonomics_flags
()
{
void
Arguments
::
select_gc_ergonomically
()
{
if
(
os
::
is_server_class_machine
())
{
// If no other collector is requested explicitly,
// let the VM select the collector based on
// machine class and automatic selection policy.
if
(
!
UseSerialGC
&&
!
UseConcMarkSweepGC
&&
!
UseG1GC
&&
!
UseParNewGC
&&
FLAG_IS_DEFAULT
(
UseParallelGC
))
{
if
(
should_auto_select_low_pause_collector
())
{
FLAG_SET_ERGO
(
bool
,
UseConcMarkSweepGC
,
true
);
}
else
{
FLAG_SET_ERGO
(
bool
,
UseParallelGC
,
true
);
}
if
(
should_auto_select_low_pause_collector
())
{
FLAG_SET_ERGO
(
bool
,
UseConcMarkSweepGC
,
true
);
}
else
{
FLAG_SET_ERGO
(
bool
,
UseParallelGC
,
true
);
}
}
}
void
Arguments
::
select_gc
()
{
if
(
!
gc_selected
())
{
select_gc_ergonomically
();
}
}
void
Arguments
::
set_ergonomics_flags
()
{
select_gc
();
#ifdef COMPILER2
// Shared spaces work fine with other GCs but causes bytecode rewriting
// to be disabled, which hurts interpreter performance and decreases
...
...
@@ -1669,6 +1670,46 @@ void Arguments::set_g1_gc_flags() {
}
}
#if !INCLUDE_ALL_GCS
#ifdef ASSERT
static
bool
verify_serial_gc_flags
()
{
return
(
UseSerialGC
&&
!
(
UseParNewGC
||
(
UseConcMarkSweepGC
||
CMSIncrementalMode
)
||
UseG1GC
||
UseParallelGC
||
UseParallelOldGC
));
}
#endif // ASSERT
#endif // INCLUDE_ALL_GCS
void
Arguments
::
set_gc_specific_flags
()
{
#if INCLUDE_ALL_GCS
// Set per-collector flags
if
(
UseParallelGC
||
UseParallelOldGC
)
{
set_parallel_gc_flags
();
}
else
if
(
UseConcMarkSweepGC
)
{
// Should be done before ParNew check below
set_cms_and_parnew_gc_flags
();
}
else
if
(
UseParNewGC
)
{
// Skipped if CMS is set above
set_parnew_gc_flags
();
}
else
if
(
UseG1GC
)
{
set_g1_gc_flags
();
}
check_deprecated_gcs
();
check_deprecated_gc_flags
();
if
(
AssumeMP
&&
!
UseSerialGC
)
{
if
(
FLAG_IS_DEFAULT
(
ParallelGCThreads
)
&&
ParallelGCThreads
==
1
)
{
warning
(
"If the number of processors is expected to increase from one, then"
" you should configure the number of parallel GC threads appropriately"
" using -XX:ParallelGCThreads=N"
);
}
}
if
(
MinHeapFreeRatio
==
100
)
{
// Keeping the heap 100% free is hard ;-) so limit it to 99%.
FLAG_SET_ERGO
(
uintx
,
MinHeapFreeRatio
,
99
);
}
#else // INCLUDE_ALL_GCS
assert
(
verify_serial_gc_flags
(),
"SerialGC unset"
);
#endif // INCLUDE_ALL_GCS
}
julong
Arguments
::
limit_by_allocatable_memory
(
julong
limit
)
{
julong
max_allocatable
;
julong
result
=
limit
;
...
...
@@ -1892,16 +1933,6 @@ bool Arguments::verify_percentage(uintx value, const char* name) {
return
false
;
}
#if !INCLUDE_ALL_GCS
#ifdef ASSERT
static
bool
verify_serial_gc_flags
()
{
return
(
UseSerialGC
&&
!
(
UseParNewGC
||
(
UseConcMarkSweepGC
||
CMSIncrementalMode
)
||
UseG1GC
||
UseParallelGC
||
UseParallelOldGC
));
}
#endif // ASSERT
#endif // INCLUDE_ALL_GCS
// check if do gclog rotation
// +UseGCLogFileRotation is a must,
// no gc log rotation when log file not supplied or
...
...
@@ -3784,33 +3815,7 @@ jint Arguments::apply_ergo() {
// Set heap size based on available physical memory
set_heap_size
();
#if INCLUDE_ALL_GCS
// Set per-collector flags
if
(
UseParallelGC
||
UseParallelOldGC
)
{
set_parallel_gc_flags
();
}
else
if
(
UseConcMarkSweepGC
)
{
// Should be done before ParNew check below
set_cms_and_parnew_gc_flags
();
}
else
if
(
UseParNewGC
)
{
// Skipped if CMS is set above
set_parnew_gc_flags
();
}
else
if
(
UseG1GC
)
{
set_g1_gc_flags
();
}
check_deprecated_gcs
();
check_deprecated_gc_flags
();
if
(
AssumeMP
&&
!
UseSerialGC
)
{
if
(
FLAG_IS_DEFAULT
(
ParallelGCThreads
)
&&
ParallelGCThreads
==
1
)
{
warning
(
"If the number of processors is expected to increase from one, then"
" you should configure the number of parallel GC threads appropriately"
" using -XX:ParallelGCThreads=N"
);
}
}
if
(
MinHeapFreeRatio
==
100
)
{
// Keeping the heap 100% free is hard ;-) so limit it to 99%.
FLAG_SET_ERGO
(
uintx
,
MinHeapFreeRatio
,
99
);
}
#else // INCLUDE_ALL_GCS
assert
(
verify_serial_gc_flags
(),
"SerialGC unset"
);
#endif // INCLUDE_ALL_GCS
set_gc_specific_flags
();
// Initialize Metaspace flags and alignments.
Metaspace
::
ergo_initialize
();
...
...
src/share/vm/runtime/arguments.hpp
浏览文件 @
89037d56
...
...
@@ -338,8 +338,10 @@ class Arguments : AllStatic {
static
void
set_conservative_max_heap_alignment
();
static
void
set_use_compressed_oops
();
static
void
set_use_compressed_klass_ptrs
();
static
void
select_gc
();
static
void
set_ergonomics_flags
();
static
void
set_shared_spaces_flags
();
static
void
set_gc_specific_flags
();
// limits the given memory size by the maximum amount of memory this process is
// currently allowed to allocate or reserve.
static
julong
limit_by_allocatable_memory
(
julong
size
);
...
...
@@ -451,6 +453,9 @@ class Arguments : AllStatic {
// Adjusts the arguments after the OS have adjusted the arguments
static
jint
adjust_after_os
();
static
inline
bool
gc_selected
();
// whether a gc has been selected
static
void
select_gc_ergonomically
();
// Verifies that the given value will fit as a MinHeapFreeRatio. If not, an error
// message is returned in the provided buffer.
static
bool
verify_MinHeapFreeRatio
(
FormatBuffer
<
80
>&
err_msg
,
uintx
min_heap_free_ratio
);
...
...
@@ -602,4 +607,8 @@ class Arguments : AllStatic {
static
bool
copy_expand_pid
(
const
char
*
src
,
size_t
srclen
,
char
*
buf
,
size_t
buflen
);
};
bool
Arguments
::
gc_selected
()
{
return
UseConcMarkSweepGC
||
UseG1GC
||
UseParallelGC
||
UseParallelOldGC
||
UseParNewGC
||
UseSerialGC
;
}
#endif // SHARE_VM_RUNTIME_ARGUMENTS_HPP
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录