Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
426cedd7
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看板
提交
426cedd7
编写于
9月 13, 2013
作者:
S
stefank
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8024650: Don't adjust MaxMetaspaceSize up to MetaspaceSize
Reviewed-by: jwilhelm, brutisso, tschatzl
上级
79e83732
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
178 addition
and
14 deletion
+178
-14
src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp
...vm/gc_implementation/parallelScavenge/generationSizer.hpp
+1
-4
src/share/vm/memory/collectorPolicy.cpp
src/share/vm/memory/collectorPolicy.cpp
+19
-8
test/gc/metaspace/TestMetaspaceSizeFlags.java
test/gc/metaspace/TestMetaspaceSizeFlags.java
+108
-0
test/testlibrary/OutputAnalyzerTest.java
test/testlibrary/OutputAnalyzerTest.java
+17
-0
test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
...stlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
+33
-2
未找到文件。
src/share/vm/gc_implementation/parallelScavenge/generationSizer.hpp
浏览文件 @
426cedd7
/*
/*
* Copyright (c) 2001, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 201
3
, 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
...
@@ -68,9 +68,6 @@ class GenerationSizer : public TwoGenerationCollectorPolicy {
...
@@ -68,9 +68,6 @@ class GenerationSizer : public TwoGenerationCollectorPolicy {
size_t
min_old_gen_size
()
{
return
_min_gen1_size
;
}
size_t
min_old_gen_size
()
{
return
_min_gen1_size
;
}
size_t
old_gen_size
()
{
return
_initial_gen1_size
;
}
size_t
old_gen_size
()
{
return
_initial_gen1_size
;
}
size_t
max_old_gen_size
()
{
return
_max_gen1_size
;
}
size_t
max_old_gen_size
()
{
return
_max_gen1_size
;
}
size_t
metaspace_size
()
{
return
MetaspaceSize
;
}
size_t
max_metaspace_size
()
{
return
MaxMetaspaceSize
;
}
};
};
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GENERATIONSIZER_HPP
#endif // SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_GENERATIONSIZER_HPP
src/share/vm/memory/collectorPolicy.cpp
浏览文件 @
426cedd7
...
@@ -47,6 +47,11 @@
...
@@ -47,6 +47,11 @@
// CollectorPolicy methods.
// CollectorPolicy methods.
// Align down. If the aligning result in 0, return 'alignment'.
static
size_t
restricted_align_down
(
size_t
size
,
size_t
alignment
)
{
return
MAX2
(
alignment
,
align_size_down_
(
size
,
alignment
));
}
void
CollectorPolicy
::
initialize_flags
()
{
void
CollectorPolicy
::
initialize_flags
()
{
assert
(
max_alignment
()
>=
min_alignment
(),
assert
(
max_alignment
()
>=
min_alignment
(),
err_msg
(
"max_alignment: "
SIZE_FORMAT
" less than min_alignment: "
SIZE_FORMAT
,
err_msg
(
"max_alignment: "
SIZE_FORMAT
" less than min_alignment: "
SIZE_FORMAT
,
...
@@ -59,18 +64,24 @@ void CollectorPolicy::initialize_flags() {
...
@@ -59,18 +64,24 @@ void CollectorPolicy::initialize_flags() {
vm_exit_during_initialization
(
"Incompatible initial and maximum heap sizes specified"
);
vm_exit_during_initialization
(
"Incompatible initial and maximum heap sizes specified"
);
}
}
if
(
MetaspaceSize
>
MaxMetaspaceSize
)
{
if
(
!
is_size_aligned
(
MaxMetaspaceSize
,
max_alignment
()))
{
MaxMetaspaceSize
=
MetaspaceSize
;
FLAG_SET_ERGO
(
uintx
,
MaxMetaspaceSize
,
restricted_align_down
(
MaxMetaspaceSize
,
max_alignment
()));
}
}
MetaspaceSize
=
MAX2
(
min_alignment
(),
align_size_down_
(
MetaspaceSize
,
min_alignment
()));
// Don't increase Metaspace size limit above specified.
MaxMetaspaceSize
=
align_size_down
(
MaxMetaspaceSize
,
max_alignment
());
if
(
MetaspaceSize
>
MaxMetaspaceSize
)
{
if
(
MetaspaceSize
>
MaxMetaspaceSize
)
{
MetaspaceSize
=
MaxMetaspaceSize
;
FLAG_SET_ERGO
(
uintx
,
MetaspaceSize
,
MaxMetaspaceSize
)
;
}
}
MinMetaspaceExpansion
=
MAX2
(
min_alignment
(),
align_size_down_
(
MinMetaspaceExpansion
,
min_alignment
()));
if
(
!
is_size_aligned
(
MetaspaceSize
,
min_alignment
()))
{
MaxMetaspaceExpansion
=
MAX2
(
min_alignment
(),
align_size_down_
(
MaxMetaspaceExpansion
,
min_alignment
()));
FLAG_SET_ERGO
(
uintx
,
MetaspaceSize
,
restricted_align_down
(
MetaspaceSize
,
min_alignment
()));
}
assert
(
MetaspaceSize
<=
MaxMetaspaceSize
,
"Must be"
);
MinMetaspaceExpansion
=
restricted_align_down
(
MinMetaspaceExpansion
,
min_alignment
());
MaxMetaspaceExpansion
=
restricted_align_down
(
MaxMetaspaceExpansion
,
min_alignment
());
MinHeapDeltaBytes
=
align_size_up
(
MinHeapDeltaBytes
,
min_alignment
());
MinHeapDeltaBytes
=
align_size_up
(
MinHeapDeltaBytes
,
min_alignment
());
...
...
test/gc/metaspace/TestMetaspaceSizeFlags.java
0 → 100644
浏览文件 @
426cedd7
/*
* Copyright (c) 2013, 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.
*/
import
com.oracle.java.testlibrary.Asserts
;
import
com.oracle.java.testlibrary.OutputAnalyzer
;
import
com.oracle.java.testlibrary.ProcessTools
;
/*
* @test TestMetaspaceSizeFlags
* @key gc
* @bug 8024650
* @summary Test that metaspace size flags can be set correctly
* @library /testlibrary
*/
public
class
TestMetaspaceSizeFlags
{
public
static
final
long
K
=
1024L
;
public
static
final
long
M
=
1024L
*
K
;
// HotSpot uses a number of different values to align memory size flags.
// This is currently the largest alignment (unless huge large pages are used).
public
static
final
long
MAX_ALIGNMENT
=
32
*
M
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
testMaxMetaspaceSizeEQMetaspaceSize
(
MAX_ALIGNMENT
,
MAX_ALIGNMENT
);
// 8024650: MaxMetaspaceSize was adjusted instead of MetaspaceSize.
testMaxMetaspaceSizeLTMetaspaceSize
(
MAX_ALIGNMENT
,
MAX_ALIGNMENT
*
2
);
testMaxMetaspaceSizeGTMetaspaceSize
(
MAX_ALIGNMENT
*
2
,
MAX_ALIGNMENT
);
testTooSmallInitialMetaspace
(
0
,
0
);
testTooSmallInitialMetaspace
(
0
,
MAX_ALIGNMENT
);
testTooSmallInitialMetaspace
(
MAX_ALIGNMENT
,
0
);
}
private
static
void
testMaxMetaspaceSizeEQMetaspaceSize
(
long
maxMetaspaceSize
,
long
metaspaceSize
)
throws
Exception
{
MetaspaceFlags
mf
=
runAndGetValue
(
maxMetaspaceSize
,
metaspaceSize
);
Asserts
.
assertEQ
(
maxMetaspaceSize
,
metaspaceSize
);
Asserts
.
assertEQ
(
mf
.
maxMetaspaceSize
,
maxMetaspaceSize
);
Asserts
.
assertEQ
(
mf
.
metaspaceSize
,
metaspaceSize
);
}
private
static
void
testMaxMetaspaceSizeLTMetaspaceSize
(
long
maxMetaspaceSize
,
long
metaspaceSize
)
throws
Exception
{
MetaspaceFlags
mf
=
runAndGetValue
(
maxMetaspaceSize
,
metaspaceSize
);
Asserts
.
assertEQ
(
mf
.
maxMetaspaceSize
,
maxMetaspaceSize
);
Asserts
.
assertEQ
(
mf
.
metaspaceSize
,
maxMetaspaceSize
);
}
private
static
void
testMaxMetaspaceSizeGTMetaspaceSize
(
long
maxMetaspaceSize
,
long
metaspaceSize
)
throws
Exception
{
MetaspaceFlags
mf
=
runAndGetValue
(
maxMetaspaceSize
,
metaspaceSize
);
Asserts
.
assertGT
(
maxMetaspaceSize
,
metaspaceSize
);
Asserts
.
assertGT
(
mf
.
maxMetaspaceSize
,
mf
.
metaspaceSize
);
Asserts
.
assertEQ
(
mf
.
maxMetaspaceSize
,
maxMetaspaceSize
);
Asserts
.
assertEQ
(
mf
.
metaspaceSize
,
metaspaceSize
);
}
private
static
void
testTooSmallInitialMetaspace
(
long
maxMetaspaceSize
,
long
metaspaceSize
)
throws
Exception
{
OutputAnalyzer
output
=
run
(
maxMetaspaceSize
,
metaspaceSize
);
output
.
shouldContain
(
"Too small initial Metaspace size"
);
}
private
static
MetaspaceFlags
runAndGetValue
(
long
maxMetaspaceSize
,
long
metaspaceSize
)
throws
Exception
{
OutputAnalyzer
output
=
run
(
maxMetaspaceSize
,
metaspaceSize
);
output
.
shouldNotMatch
(
"Error occurred during initialization of VM\n.*"
);
String
stringMaxMetaspaceSize
=
output
.
firstMatch
(
".* MaxMetaspaceSize .* := (\\d+).*"
,
1
);
String
stringMetaspaceSize
=
output
.
firstMatch
(
".* MetaspaceSize .* := (\\d+).*"
,
1
);
return
new
MetaspaceFlags
(
Long
.
parseLong
(
stringMaxMetaspaceSize
),
Long
.
parseLong
(
stringMetaspaceSize
));
}
private
static
OutputAnalyzer
run
(
long
maxMetaspaceSize
,
long
metaspaceSize
)
throws
Exception
{
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-XX:MaxMetaspaceSize="
+
maxMetaspaceSize
,
"-XX:MetaspaceSize="
+
metaspaceSize
,
"-XX:-UseLargePages"
,
// Prevent us from using 2GB large pages on solaris + sparc.
"-XX:+PrintFlagsFinal"
,
"-version"
);
return
new
OutputAnalyzer
(
pb
.
start
());
}
private
static
class
MetaspaceFlags
{
public
long
maxMetaspaceSize
;
public
long
metaspaceSize
;
public
MetaspaceFlags
(
long
maxMetaspaceSize
,
long
metaspaceSize
)
{
this
.
maxMetaspaceSize
=
maxMetaspaceSize
;
this
.
metaspaceSize
=
metaspaceSize
;
}
}
}
test/testlibrary/OutputAnalyzerTest.java
浏览文件 @
426cedd7
...
@@ -172,5 +172,22 @@ public class OutputAnalyzerTest {
...
@@ -172,5 +172,22 @@ public class OutputAnalyzerTest {
}
catch
(
RuntimeException
e
)
{
}
catch
(
RuntimeException
e
)
{
// expected
// expected
}
}
{
String
aaaa
=
"aaaa"
;
String
result
=
output
.
firstMatch
(
aaaa
);
if
(!
aaaa
.
equals
(
result
))
{
throw
new
Exception
(
"firstMatch(String) faild to match. Expected: "
+
aaaa
+
" got: "
+
result
);
}
}
{
String
aa
=
"aa"
;
String
aa_grouped_aa
=
aa
+
"("
+
aa
+
")"
;
String
result
=
output
.
firstMatch
(
aa_grouped_aa
,
1
);
if
(!
aa
.
equals
(
result
))
{
throw
new
Exception
(
"firstMatch(String, int) failed to match. Expected: "
+
aa
+
" got: "
+
result
);
}
}
}
}
}
}
test/testlibrary/com/oracle/java/testlibrary/OutputAnalyzer.java
浏览文件 @
426cedd7
...
@@ -211,13 +211,13 @@ public final class OutputAnalyzer {
...
@@ -211,13 +211,13 @@ public final class OutputAnalyzer {
if
(
matcher
.
find
())
{
if
(
matcher
.
find
())
{
reportDiagnosticSummary
();
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
throw
new
RuntimeException
(
"'"
+
pattern
+
"' found in stdout \n"
);
+
"' found in stdout
: '"
+
matcher
.
group
()
+
"'
\n"
);
}
}
matcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stderr
);
matcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stderr
);
if
(
matcher
.
find
())
{
if
(
matcher
.
find
())
{
reportDiagnosticSummary
();
reportDiagnosticSummary
();
throw
new
RuntimeException
(
"'"
+
pattern
throw
new
RuntimeException
(
"'"
+
pattern
+
"' found in stderr \n"
);
+
"' found in stderr
: '"
+
matcher
.
group
()
+
"'
\n"
);
}
}
}
}
...
@@ -253,6 +253,37 @@ public final class OutputAnalyzer {
...
@@ -253,6 +253,37 @@ public final class OutputAnalyzer {
}
}
}
}
/**
* Get the captured group of the first string matching the pattern.
* stderr is searched before stdout.
*
* @param pattern The multi-line pattern to match
* @param group The group to capture
* @return The matched string or null if no match was found
*/
public
String
firstMatch
(
String
pattern
,
int
group
)
{
Matcher
stderrMatcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stderr
);
Matcher
stdoutMatcher
=
Pattern
.
compile
(
pattern
,
Pattern
.
MULTILINE
).
matcher
(
stdout
);
if
(
stderrMatcher
.
find
())
{
return
stderrMatcher
.
group
(
group
);
}
if
(
stdoutMatcher
.
find
())
{
return
stdoutMatcher
.
group
(
group
);
}
return
null
;
}
/**
* Get the first string matching the pattern.
* stderr is searched before stdout.
*
* @param pattern The multi-line pattern to match
* @return The matched string or null if no match was found
*/
public
String
firstMatch
(
String
pattern
)
{
return
firstMatch
(
pattern
,
0
);
}
/**
/**
* Verify the exit value of the process
* Verify the exit value of the process
*
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录