Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
f6e0fc38
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看板
提交
f6e0fc38
编写于
10月 19, 2013
作者:
I
iignatyev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8026414: [TESTBUG] Tests for Tiered/NonTiered levels
Reviewed-by: twisti, iveresov
上级
751cd1f9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
259 addition
and
0 deletion
+259
-0
test/compiler/tiered/CompLevelsTest.java
test/compiler/tiered/CompLevelsTest.java
+75
-0
test/compiler/tiered/NonTieredLevelsTest.java
test/compiler/tiered/NonTieredLevelsTest.java
+96
-0
test/compiler/tiered/TieredLevelsTest.java
test/compiler/tiered/TieredLevelsTest.java
+88
-0
未找到文件。
test/compiler/tiered/CompLevelsTest.java
0 → 100644
浏览文件 @
f6e0fc38
/*
* 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.
*/
/**
* Abstract class for testing of used compilation levels correctness.
*
* @author igor.ignatyev@oracle.com
*/
public
abstract
class
CompLevelsTest
extends
CompilerWhiteBoxTest
{
protected
CompLevelsTest
(
TestCase
testCase
)
{
super
(
testCase
);
// to prevent inlining of #method
WHITE_BOX
.
testSetDontInlineMethod
(
method
,
true
);
}
/**
* Checks that level is available.
* @param compLevel level to check
*/
protected
void
testAvailableLevel
(
int
compLevel
,
int
bci
)
{
if
(
IS_VERBOSE
)
{
System
.
out
.
printf
(
"testAvailableLevel(level = %d, bci = %d)%n"
,
compLevel
,
bci
);
}
WHITE_BOX
.
enqueueMethodForCompilation
(
method
,
compLevel
,
bci
);
checkCompiled
();
checkLevel
(
compLevel
,
getCompLevel
());
deoptimize
();
}
/**
* Checks that level is unavailable.
* @param compLevel level to check
*/
protected
void
testUnavailableLevel
(
int
compLevel
,
int
bci
)
{
if
(
IS_VERBOSE
)
{
System
.
out
.
printf
(
"testUnavailableLevel(level = %d, bci = %d)%n"
,
compLevel
,
bci
);
}
WHITE_BOX
.
enqueueMethodForCompilation
(
method
,
compLevel
,
bci
);
checkNotCompiled
();
}
/**
* Checks validity of compilation level.
* @param expected expected level
* @param actual actually level
*/
protected
void
checkLevel
(
int
expected
,
int
actual
)
{
if
(
expected
!=
actual
)
{
throw
new
RuntimeException
(
"expected["
+
expected
+
"] != actual["
+
actual
+
"]"
);
}
}
}
test/compiler/tiered/NonTieredLevelsTest.java
0 → 100644
浏览文件 @
f6e0fc38
/*
* 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
java.util.function.IntPredicate
;
/**
* @test NonTieredLevelsTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build NonTieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:-TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:CompileCommand=compileonly,TestCase$Helper::*
* NonTieredLevelsTest
* @summary Verify that only one level can be used
* @author igor.ignatyev@oracle.com
*/
public
class
NonTieredLevelsTest
extends
CompLevelsTest
{
private
static
final
int
AVAILABLE_COMP_LEVEL
;
private
static
final
IntPredicate
IS_AVAILABLE_COMPLEVEL
;
static
{
String
vmName
=
System
.
getProperty
(
"java.vm.name"
);
if
(
vmName
.
endsWith
(
" Server VM"
))
{
AVAILABLE_COMP_LEVEL
=
COMP_LEVEL_FULL_OPTIMIZATION
;
IS_AVAILABLE_COMPLEVEL
=
x
->
x
==
COMP_LEVEL_FULL_OPTIMIZATION
;
}
else
if
(
vmName
.
endsWith
(
" Client VM"
)
||
vmName
.
endsWith
(
" Minimal VM"
))
{
AVAILABLE_COMP_LEVEL
=
COMP_LEVEL_SIMPLE
;
IS_AVAILABLE_COMPLEVEL
=
x
->
x
>=
COMP_LEVEL_SIMPLE
&&
x
<=
COMP_LEVEL_FULL_PROFILE
;
}
else
{
throw
new
RuntimeException
(
"Unknown VM: "
+
vmName
);
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
TIERED_COMPILATION
)
{
System
.
err
.
println
(
"Test isn't applicable w/ enabled "
+
"TieredCompilation. Skip test."
);
return
;
}
for
(
TestCase
test
:
TestCase
.
values
())
{
new
NonTieredLevelsTest
(
test
).
runTest
();
}
}
private
NonTieredLevelsTest
(
TestCase
testCase
)
{
super
(
testCase
);
// to prevent inlining of #method
WHITE_BOX
.
testSetDontInlineMethod
(
method
,
true
);
}
@Override
protected
void
test
()
throws
Exception
{
checkNotCompiled
();
compile
();
checkCompiled
();
int
compLevel
=
getCompLevel
();
checkLevel
(
AVAILABLE_COMP_LEVEL
,
compLevel
);
int
bci
=
WHITE_BOX
.
getMethodEntryBci
(
method
);
deoptimize
();
if
(!
testCase
.
isOsr
)
{
for
(
int
level
=
1
;
level
<=
COMP_LEVEL_MAX
;
++
level
)
{
if
(
IS_AVAILABLE_COMPLEVEL
.
test
(
level
))
{
testAvailableLevel
(
level
,
bci
);
}
else
{
testUnavailableLevel
(
level
,
bci
);
}
}
}
else
{
System
.
out
.
println
(
"skip other levels testing in OSR"
);
testAvailableLevel
(
AVAILABLE_COMP_LEVEL
,
bci
);
}
}
}
test/compiler/tiered/TieredLevelsTest.java
0 → 100644
浏览文件 @
f6e0fc38
/*
* 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.
*/
/**
* @test TieredLevelsTest
* @library /testlibrary /testlibrary/whitebox /compiler/whitebox
* @build TieredLevelsTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* -XX:CompileCommand=compileonly,TestCase$Helper::*
* TieredLevelsTest
* @summary Verify that all levels < 'TieredStopAtLevel' can be used
* @author igor.ignatyev@oracle.com
*/
public
class
TieredLevelsTest
extends
CompLevelsTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(!
TIERED_COMPILATION
)
{
System
.
err
.
println
(
"Test isn't applicable w/ disabled "
+
"TieredCompilation. Skip test."
);
return
;
}
for
(
TestCase
test
:
TestCase
.
values
())
{
new
TieredLevelsTest
(
test
).
runTest
();
}
}
private
TieredLevelsTest
(
TestCase
testCase
)
{
super
(
testCase
);
// to prevent inlining of #method
WHITE_BOX
.
testSetDontInlineMethod
(
method
,
true
);
}
@Override
protected
void
test
()
throws
Exception
{
checkNotCompiled
();
compile
();
checkCompiled
();
int
compLevel
=
getCompLevel
();
if
(
compLevel
>
TIERED_STOP_AT_LEVEL
)
{
throw
new
RuntimeException
(
"method.compLevel["
+
compLevel
+
"] > TieredStopAtLevel ["
+
TIERED_STOP_AT_LEVEL
+
"]"
);
}
int
bci
=
WHITE_BOX
.
getMethodEntryBci
(
method
);
deoptimize
();
for
(
int
testedTier
=
1
;
testedTier
<=
TIERED_STOP_AT_LEVEL
;
++
testedTier
)
{
testAvailableLevel
(
testedTier
,
bci
);
}
for
(
int
testedTier
=
TIERED_STOP_AT_LEVEL
+
1
;
testedTier
<=
COMP_LEVEL_MAX
;
++
testedTier
)
{
testUnavailableLevel
(
testedTier
,
bci
);
}
}
@Override
protected
void
checkLevel
(
int
expected
,
int
actual
)
{
if
(
expected
==
COMP_LEVEL_FULL_PROFILE
&&
actual
==
COMP_LEVEL_LIMITED_PROFILE
)
{
// for simple method full_profile may be replaced by limited_profile
return
;
}
super
.
checkLevel
(
expected
,
actual
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录