Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
59d84932
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
59d84932
编写于
4月 11, 2013
作者:
B
bharadwaj
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
f99a0088
9f7883f3
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
545 addition
and
133 deletion
+545
-133
src/share/vm/adlc/output_c.cpp
src/share/vm/adlc/output_c.cpp
+56
-44
src/share/vm/adlc/output_h.cpp
src/share/vm/adlc/output_h.cpp
+15
-3
src/share/vm/c1/c1_ValueMap.cpp
src/share/vm/c1/c1_ValueMap.cpp
+4
-2
src/share/vm/classfile/classFileParser.cpp
src/share/vm/classfile/classFileParser.cpp
+0
-3
src/share/vm/classfile/classFileParser.hpp
src/share/vm/classfile/classFileParser.hpp
+0
-1
src/share/vm/compiler/compileBroker.cpp
src/share/vm/compiler/compileBroker.cpp
+2
-5
src/share/vm/interpreter/linkResolver.cpp
src/share/vm/interpreter/linkResolver.cpp
+7
-1
src/share/vm/oops/method.hpp
src/share/vm/oops/method.hpp
+13
-9
src/share/vm/oops/methodData.cpp
src/share/vm/oops/methodData.cpp
+21
-21
src/share/vm/oops/methodData.hpp
src/share/vm/oops/methodData.hpp
+4
-3
src/share/vm/prims/whitebox.cpp
src/share/vm/prims/whitebox.cpp
+61
-7
src/share/vm/runtime/compilationPolicy.cpp
src/share/vm/runtime/compilationPolicy.cpp
+2
-1
src/share/vm/runtime/compilationPolicy.hpp
src/share/vm/runtime/compilationPolicy.hpp
+1
-1
src/share/vm/utilities/accessFlags.hpp
src/share/vm/utilities/accessFlags.hpp
+3
-0
src/share/vm/utilities/globalDefinitions.hpp
src/share/vm/utilities/globalDefinitions.hpp
+4
-0
test/compiler/6863420/Test.java
test/compiler/6863420/Test.java
+21
-3
test/compiler/8011706/Test8011706.java
test/compiler/8011706/Test8011706.java
+65
-0
test/compiler/whitebox/ClearMethodStateTest.java
test/compiler/whitebox/ClearMethodStateTest.java
+71
-0
test/compiler/whitebox/CompilerWhiteBoxTest.java
test/compiler/whitebox/CompilerWhiteBoxTest.java
+9
-1
test/compiler/whitebox/DeoptimizeAllTest.java
test/compiler/whitebox/DeoptimizeAllTest.java
+1
-1
test/compiler/whitebox/DeoptimizeMethodTest.java
test/compiler/whitebox/DeoptimizeMethodTest.java
+1
-1
test/compiler/whitebox/EnqueueMethodForCompilationTest.java
test/compiler/whitebox/EnqueueMethodForCompilationTest.java
+74
-0
test/compiler/whitebox/IsMethodCompilableTest.java
test/compiler/whitebox/IsMethodCompilableTest.java
+36
-15
test/compiler/whitebox/MakeMethodNotCompilableTest.java
test/compiler/whitebox/MakeMethodNotCompilableTest.java
+1
-4
test/compiler/whitebox/SetDontInlineMethodTest.java
test/compiler/whitebox/SetDontInlineMethodTest.java
+5
-5
test/compiler/whitebox/SetForceInlineMethodTest.java
test/compiler/whitebox/SetForceInlineMethodTest.java
+60
-0
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+8
-2
未找到文件。
src/share/vm/adlc/output_c.cpp
浏览文件 @
59d84932
...
...
@@ -63,11 +63,10 @@ static void defineRegNames(FILE *fp, RegisterForm *registers) {
RegDef
*
reg_def
=
NULL
;
RegDef
*
next
=
NULL
;
registers
->
reset_RegDefs
();
for
(
reg_def
=
registers
->
iter_RegDefs
();
reg_def
!=
NULL
;
reg_def
=
next
)
{
for
(
reg_def
=
registers
->
iter_RegDefs
();
reg_def
!=
NULL
;
reg_def
=
next
)
{
next
=
registers
->
iter_RegDefs
();
const
char
*
comma
=
(
next
!=
NULL
)
?
","
:
" // no trailing comma"
;
fprintf
(
fp
,
"
\"
%s
\"
%s
\n
"
,
reg_def
->
_regname
,
comma
);
fprintf
(
fp
,
"
\"
%s
\"
%s
\n
"
,
reg_def
->
_regname
,
comma
);
}
// Finish defining enumeration
...
...
@@ -79,10 +78,10 @@ static void defineRegNames(FILE *fp, RegisterForm *registers) {
reg_def
=
NULL
;
next
=
NULL
;
registers
->
reset_RegDefs
();
for
(
reg_def
=
registers
->
iter_RegDefs
();
reg_def
!=
NULL
;
reg_def
=
next
)
{
for
(
reg_def
=
registers
->
iter_RegDefs
();
reg_def
!=
NULL
;
reg_def
=
next
)
{
next
=
registers
->
iter_RegDefs
();
const
char
*
comma
=
(
next
!=
NULL
)
?
","
:
" // no trailing comma"
;
fprintf
(
fp
,
"
\t
%s%s
\n
"
,
reg_def
->
_concrete
,
comma
);
fprintf
(
fp
,
"
\t
%s%s
\n
"
,
reg_def
->
_concrete
,
comma
);
}
// Finish defining array
fprintf
(
fp
,
"
\t
};
\n
"
);
...
...
@@ -104,19 +103,17 @@ static void defineRegEncodes(FILE *fp, RegisterForm *registers) {
RegDef
*
reg_def
=
NULL
;
RegDef
*
next
=
NULL
;
registers
->
reset_RegDefs
();
for
(
reg_def
=
registers
->
iter_RegDefs
();
reg_def
!=
NULL
;
reg_def
=
next
)
{
for
(
reg_def
=
registers
->
iter_RegDefs
();
reg_def
!=
NULL
;
reg_def
=
next
)
{
next
=
registers
->
iter_RegDefs
();
const
char
*
register_encode
=
reg_def
->
register_encode
();
const
char
*
comma
=
(
next
!=
NULL
)
?
","
:
" // no trailing comma"
;
int
encval
;
if
(
!
ADLParser
::
is_int_token
(
register_encode
,
encval
))
{
fprintf
(
fp
,
" %s%s // %s
\n
"
,
register_encode
,
comma
,
reg_def
->
_regname
);
fprintf
(
fp
,
" %s%s // %s
\n
"
,
register_encode
,
comma
,
reg_def
->
_regname
);
}
else
{
// Output known constants in hex char format (backward compatibility).
assert
(
encval
<
256
,
"Exceeded supported width for register encoding"
);
fprintf
(
fp
,
" (unsigned char)'
\\
x%X'%s // %s
\n
"
,
encval
,
comma
,
reg_def
->
_regname
);
fprintf
(
fp
,
" (unsigned char)'
\\
x%X'%s // %s
\n
"
,
encval
,
comma
,
reg_def
->
_regname
);
}
}
// Finish defining enumeration
...
...
@@ -133,9 +130,10 @@ static void defineRegClassEnum(FILE *fp, RegisterForm *registers) {
fprintf
(
fp
,
"// Enumeration of register class names
\n
"
);
fprintf
(
fp
,
"enum machRegisterClass {
\n
"
);
registers
->
_rclasses
.
reset
();
for
(
const
char
*
class_name
=
NULL
;
(
class_name
=
registers
->
_rclasses
.
iter
())
!=
NULL
;
)
{
fprintf
(
fp
,
" %s,
\n
"
,
toUpper
(
class_name
));
for
(
const
char
*
class_name
=
NULL
;
(
class_name
=
registers
->
_rclasses
.
iter
())
!=
NULL
;)
{
const
char
*
class_name_to_upper
=
toUpper
(
class_name
);
fprintf
(
fp
,
" %s,
\n
"
,
class_name_to_upper
);
delete
[]
class_name_to_upper
;
}
// Finish defining enumeration
fprintf
(
fp
,
" _last_Mach_Reg_Class
\n
"
);
...
...
@@ -148,7 +146,7 @@ static void defineRegClassEnum(FILE *fp, RegisterForm *registers) {
void
ArchDesc
::
declare_register_masks
(
FILE
*
fp_hpp
)
{
const
char
*
rc_name
;
if
(
_register
)
{
if
(
_register
)
{
// Build enumeration of user-defined register classes.
defineRegClassEnum
(
fp_hpp
,
_register
);
...
...
@@ -156,24 +154,27 @@ void ArchDesc::declare_register_masks(FILE *fp_hpp) {
fprintf
(
fp_hpp
,
"
\n
"
);
fprintf
(
fp_hpp
,
"// Register masks, one for each register class.
\n
"
);
_register
->
_rclasses
.
reset
();
for
(
rc_name
=
NULL
;
(
rc_name
=
_register
->
_rclasses
.
iter
())
!=
NULL
;
)
{
const
char
*
prefix
=
""
;
RegClass
*
reg_class
=
_register
->
getRegClass
(
rc_name
);
assert
(
reg_class
,
"Using an undefined register class"
);
for
(
rc_name
=
NULL
;
(
rc_name
=
_register
->
_rclasses
.
iter
())
!=
NULL
;)
{
const
char
*
prefix
=
""
;
RegClass
*
reg_class
=
_register
->
getRegClass
(
rc_name
);
assert
(
reg_class
,
"Using an undefined register class"
);
const
char
*
rc_name_to_upper
=
toUpper
(
rc_name
);
if
(
reg_class
->
_user_defined
==
NULL
)
{
fprintf
(
fp_hpp
,
"extern const RegMask _%s%s_mask;
\n
"
,
prefix
,
toUpper
(
rc_name
)
);
fprintf
(
fp_hpp
,
"inline const RegMask &%s%s_mask() { return _%s%s_mask; }
\n
"
,
prefix
,
toUpper
(
rc_name
),
prefix
,
toUpper
(
rc_name
)
);
fprintf
(
fp_hpp
,
"extern const RegMask _%s%s_mask;
\n
"
,
prefix
,
rc_name_to_upper
);
fprintf
(
fp_hpp
,
"inline const RegMask &%s%s_mask() { return _%s%s_mask; }
\n
"
,
prefix
,
rc_name_to_upper
,
prefix
,
rc_name_to_upper
);
}
else
{
fprintf
(
fp_hpp
,
"inline const RegMask &%s%s_mask() { %s }
\n
"
,
prefix
,
toUpper
(
rc_name
)
,
reg_class
->
_user_defined
);
fprintf
(
fp_hpp
,
"inline const RegMask &%s%s_mask() { %s }
\n
"
,
prefix
,
rc_name_to_upper
,
reg_class
->
_user_defined
);
}
if
(
reg_class
->
_stack_or_reg
)
{
if
(
reg_class
->
_stack_or_reg
)
{
assert
(
reg_class
->
_user_defined
==
NULL
,
"no user defined reg class here"
);
fprintf
(
fp_hpp
,
"extern const RegMask _%sSTACK_OR_%s_mask;
\n
"
,
prefix
,
toUpper
(
rc_name
)
);
fprintf
(
fp_hpp
,
"inline const RegMask &%sSTACK_OR_%s_mask() { return _%sSTACK_OR_%s_mask; }
\n
"
,
prefix
,
toUpper
(
rc_name
),
prefix
,
toUpper
(
rc_name
)
);
fprintf
(
fp_hpp
,
"extern const RegMask _%sSTACK_OR_%s_mask;
\n
"
,
prefix
,
rc_name_to_upper
);
fprintf
(
fp_hpp
,
"inline const RegMask &%sSTACK_OR_%s_mask() { return _%sSTACK_OR_%s_mask; }
\n
"
,
prefix
,
rc_name_to_upper
,
prefix
,
rc_name_to_upper
);
}
delete
[]
rc_name_to_upper
;
}
}
}
...
...
@@ -183,34 +184,41 @@ void ArchDesc::declare_register_masks(FILE *fp_hpp) {
void
ArchDesc
::
build_register_masks
(
FILE
*
fp_cpp
)
{
const
char
*
rc_name
;
if
(
_register
)
{
if
(
_register
)
{
// Generate a list of register masks, one for each class.
fprintf
(
fp_cpp
,
"
\n
"
);
fprintf
(
fp_cpp
,
"// Register masks, one for each register class.
\n
"
);
_register
->
_rclasses
.
reset
();
for
(
rc_name
=
NULL
;
(
rc_name
=
_register
->
_rclasses
.
iter
())
!=
NULL
;
)
{
const
char
*
prefix
=
""
;
RegClass
*
reg_class
=
_register
->
getRegClass
(
rc_name
);
assert
(
reg_class
,
"Using an undefined register class"
);
for
(
rc_name
=
NULL
;
(
rc_name
=
_register
->
_rclasses
.
iter
())
!=
NULL
;)
{
const
char
*
prefix
=
""
;
RegClass
*
reg_class
=
_register
->
getRegClass
(
rc_name
);
assert
(
reg_class
,
"Using an undefined register class"
);
if
(
reg_class
->
_user_defined
!=
NULL
)
continue
;
if
(
reg_class
->
_user_defined
!=
NULL
)
{
continue
;
}
int
len
=
RegisterForm
::
RegMask_Size
();
fprintf
(
fp_cpp
,
"const RegMask _%s%s_mask("
,
prefix
,
toUpper
(
rc_name
)
);
{
int
i
;
for
(
i
=
0
;
i
<
len
-
1
;
i
++
)
fprintf
(
fp_cpp
,
" 0x%x,"
,
reg_class
->
regs_in_word
(
i
,
false
));
fprintf
(
fp_cpp
,
" 0x%x );
\n
"
,
reg_class
->
regs_in_word
(
i
,
false
));
const
char
*
rc_name_to_upper
=
toUpper
(
rc_name
);
fprintf
(
fp_cpp
,
"const RegMask _%s%s_mask("
,
prefix
,
rc_name_to_upper
);
{
int
i
;
for
(
i
=
0
;
i
<
len
-
1
;
i
++
)
{
fprintf
(
fp_cpp
,
" 0x%x,"
,
reg_class
->
regs_in_word
(
i
,
false
));
}
fprintf
(
fp_cpp
,
" 0x%x );
\n
"
,
reg_class
->
regs_in_word
(
i
,
false
));
}
if
(
reg_class
->
_stack_or_reg
)
{
if
(
reg_class
->
_stack_or_reg
)
{
int
i
;
fprintf
(
fp_cpp
,
"const RegMask _%sSTACK_OR_%s_mask("
,
prefix
,
toUpper
(
rc_name
)
);
for
(
i
=
0
;
i
<
len
-
1
;
i
++
)
fprintf
(
fp_cpp
,
" 0x%x,"
,
reg_class
->
regs_in_word
(
i
,
true
));
fprintf
(
fp_cpp
,
" 0x%x );
\n
"
,
reg_class
->
regs_in_word
(
i
,
true
));
fprintf
(
fp_cpp
,
"const RegMask _%sSTACK_OR_%s_mask("
,
prefix
,
rc_name_to_upper
);
for
(
i
=
0
;
i
<
len
-
1
;
i
++
)
{
fprintf
(
fp_cpp
,
" 0x%x,"
,
reg_class
->
regs_in_word
(
i
,
true
));
}
fprintf
(
fp_cpp
,
" 0x%x );
\n
"
,
reg_class
->
regs_in_word
(
i
,
true
));
}
delete
[]
rc_name_to_upper
;
}
}
}
...
...
@@ -2676,7 +2684,9 @@ static void defineIn_RegMask(FILE *fp, FormDict &globals, OperandForm &oper) {
if
(
strcmp
(
first_reg_class
,
"stack_slots"
)
==
0
)
{
fprintf
(
fp
,
" return &(Compile::current()->FIRST_STACK_mask());
\n
"
);
}
else
{
fprintf
(
fp
,
" return &%s_mask();
\n
"
,
toUpper
(
first_reg_class
));
const
char
*
first_reg_class_to_upper
=
toUpper
(
first_reg_class
);
fprintf
(
fp
,
" return &%s_mask();
\n
"
,
first_reg_class_to_upper
);
delete
[]
first_reg_class_to_upper
;
}
}
else
{
// Build a switch statement to return the desired mask.
...
...
@@ -2688,7 +2698,9 @@ static void defineIn_RegMask(FILE *fp, FormDict &globals, OperandForm &oper) {
if
(
!
strcmp
(
reg_class
,
"stack_slots"
)
)
{
fprintf
(
fp
,
" case %d: return &(Compile::current()->FIRST_STACK_mask());
\n
"
,
index
);
}
else
{
fprintf
(
fp
,
" case %d: return &%s_mask();
\n
"
,
index
,
toUpper
(
reg_class
));
const
char
*
reg_class_to_upper
=
toUpper
(
reg_class
);
fprintf
(
fp
,
" case %d: return &%s_mask();
\n
"
,
index
,
reg_class_to_upper
);
delete
[]
reg_class_to_upper
;
}
}
fprintf
(
fp
,
" }
\n
"
);
...
...
src/share/vm/adlc/output_h.cpp
浏览文件 @
59d84932
...
...
@@ -2069,9 +2069,21 @@ public:
void
closing
()
{
fprintf
(
_cpp
,
" _LAST_MACH_OPER
\n
"
);
OutputMap
::
closing
();
}
void
map
(
OpClassForm
&
opc
)
{
fprintf
(
_cpp
,
" %s"
,
_AD
.
machOperEnum
(
opc
.
_ident
)
);
}
void
map
(
OperandForm
&
oper
)
{
fprintf
(
_cpp
,
" %s"
,
_AD
.
machOperEnum
(
oper
.
_ident
)
);
}
void
map
(
char
*
name
)
{
fprintf
(
_cpp
,
" %s"
,
_AD
.
machOperEnum
(
name
));
}
void
map
(
OpClassForm
&
opc
)
{
const
char
*
opc_ident_to_upper
=
_AD
.
machOperEnum
(
opc
.
_ident
);
fprintf
(
_cpp
,
" %s"
,
opc_ident_to_upper
);
delete
[]
opc_ident_to_upper
;
}
void
map
(
OperandForm
&
oper
)
{
const
char
*
oper_ident_to_upper
=
_AD
.
machOperEnum
(
oper
.
_ident
);
fprintf
(
_cpp
,
" %s"
,
oper_ident_to_upper
);
delete
[]
oper_ident_to_upper
;
}
void
map
(
char
*
name
)
{
const
char
*
name_to_upper
=
_AD
.
machOperEnum
(
name
);
fprintf
(
_cpp
,
" %s"
,
name_to_upper
);
delete
[]
name_to_upper
;
}
bool
do_instructions
()
{
return
false
;
}
void
map
(
InstructForm
&
inst
){
assert
(
false
,
"ShouldNotCallThis()"
);
}
...
...
src/share/vm/c1/c1_ValueMap.cpp
浏览文件 @
59d84932
...
...
@@ -316,6 +316,7 @@ class LoopInvariantCodeMotion : public StackObj {
ShortLoopOptimizer
*
_short_loop_optimizer
;
Instruction
*
_insertion_point
;
ValueStack
*
_state
;
bool
_insert_is_pred
;
void
set_invariant
(
Value
v
)
const
{
_gvn
->
set_processed
(
v
);
}
bool
is_invariant
(
Value
v
)
const
{
return
_gvn
->
is_processed
(
v
);
}
...
...
@@ -339,6 +340,7 @@ LoopInvariantCodeMotion::LoopInvariantCodeMotion(ShortLoopOptimizer *slo, Global
assert
(
insertion_block
->
end
()
->
as_Base
()
==
NULL
,
"cannot insert into entry block"
);
_insertion_point
=
insertion_block
->
end
()
->
prev
();
_insert_is_pred
=
loop_header
->
is_predecessor
(
insertion_block
);
BlockEnd
*
block_end
=
insertion_block
->
end
();
_state
=
block_end
->
state_before
();
...
...
@@ -379,13 +381,13 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
}
else
if
(
cur
->
as_LoadField
()
!=
NULL
)
{
LoadField
*
lf
=
(
LoadField
*
)
cur
;
// deoptimizes on NullPointerException
cur_invariant
=
!
lf
->
needs_patching
()
&&
!
lf
->
field
()
->
is_volatile
()
&&
!
_short_loop_optimizer
->
has_field_store
(
lf
->
field
()
->
type
()
->
basic_type
())
&&
is_invariant
(
lf
->
obj
());
cur_invariant
=
!
lf
->
needs_patching
()
&&
!
lf
->
field
()
->
is_volatile
()
&&
!
_short_loop_optimizer
->
has_field_store
(
lf
->
field
()
->
type
()
->
basic_type
())
&&
is_invariant
(
lf
->
obj
())
&&
_insert_is_pred
;
}
else
if
(
cur
->
as_ArrayLength
()
!=
NULL
)
{
ArrayLength
*
length
=
cur
->
as_ArrayLength
();
cur_invariant
=
is_invariant
(
length
->
array
());
}
else
if
(
cur
->
as_LoadIndexed
()
!=
NULL
)
{
LoadIndexed
*
li
=
(
LoadIndexed
*
)
cur
->
as_LoadIndexed
();
cur_invariant
=
!
_short_loop_optimizer
->
has_indexed_store
(
as_BasicType
(
cur
->
type
()))
&&
is_invariant
(
li
->
array
())
&&
is_invariant
(
li
->
index
());
cur_invariant
=
!
_short_loop_optimizer
->
has_indexed_store
(
as_BasicType
(
cur
->
type
()))
&&
is_invariant
(
li
->
array
())
&&
is_invariant
(
li
->
index
())
&&
_insert_is_pred
;
}
if
(
cur_invariant
)
{
...
...
src/share/vm/classfile/classFileParser.cpp
浏览文件 @
59d84932
...
...
@@ -1723,9 +1723,6 @@ void ClassFileParser::parse_annotations(u1* buffer, int limit,
}
else
{
coll
->
set_contended_group
(
0
);
// default contended group
}
coll
->
set_contended
(
true
);
}
else
{
coll
->
set_contended
(
false
);
}
}
}
...
...
src/share/vm/classfile/classFileParser.hpp
浏览文件 @
59d84932
...
...
@@ -150,7 +150,6 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
void
set_contended_group
(
u2
group
)
{
_contended_group
=
group
;
}
u2
contended_group
()
{
return
_contended_group
;
}
void
set_contended
(
bool
contended
)
{
set_annotation
(
_sun_misc_Contended
);
}
bool
is_contended
()
{
return
has_annotation
(
_sun_misc_Contended
);
}
};
...
...
src/share/vm/compiler/compileBroker.cpp
浏览文件 @
59d84932
...
...
@@ -1206,11 +1206,8 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
assert
(
osr_bci
==
InvocationEntryBci
||
(
0
<=
osr_bci
&&
osr_bci
<
method
->
code_size
()),
"bci out of range"
);
assert
(
!
method
->
is_abstract
()
&&
(
osr_bci
==
InvocationEntryBci
||
!
method
->
is_native
()),
"cannot compile abstract/native methods"
);
assert
(
!
method
->
method_holder
()
->
is_not_initialized
(),
"method holder must be initialized"
);
if
(
!
TieredCompilation
)
{
comp_level
=
CompLevel_highest_tier
;
}
// allow any levels for WhiteBox
assert
(
WhiteBoxAPI
||
TieredCompilation
||
comp_level
==
CompLevel_highest_tier
,
"only CompLevel_highest_tier must be used in non-tiered"
);
// return quickly if possible
// lock, make sure that the compilation
...
...
src/share/vm/interpreter/linkResolver.cpp
浏览文件 @
59d84932
...
...
@@ -217,6 +217,7 @@ void LinkResolver::lookup_polymorphic_method(methodHandle& result,
TRAPS
)
{
vmIntrinsics
::
ID
iid
=
MethodHandles
::
signature_polymorphic_name_id
(
name
);
if
(
TraceMethodHandles
)
{
ResourceMark
rm
(
THREAD
);
tty
->
print_cr
(
"lookup_polymorphic_method iid=%s %s.%s%s"
,
vmIntrinsics
::
name_at
(
iid
),
klass
->
external_name
(),
name
->
as_C_string
(),
full_signature
->
as_C_string
());
...
...
@@ -231,6 +232,7 @@ void LinkResolver::lookup_polymorphic_method(methodHandle& result,
TempNewSymbol
basic_signature
=
MethodHandles
::
lookup_basic_type_signature
(
full_signature
,
keep_last_arg
,
CHECK
);
if
(
TraceMethodHandles
)
{
ResourceMark
rm
(
THREAD
);
tty
->
print_cr
(
"lookup_polymorphic_method %s %s => basic %s"
,
name
->
as_C_string
(),
full_signature
->
as_C_string
(),
...
...
@@ -283,6 +285,8 @@ void LinkResolver::lookup_polymorphic_method(methodHandle& result,
}
if
(
result
.
not_null
())
{
#ifdef ASSERT
ResourceMark
rm
(
THREAD
);
TempNewSymbol
basic_signature
=
MethodHandles
::
lookup_basic_type_signature
(
full_signature
,
CHECK
);
int
actual_size_of_params
=
result
->
size_of_parameters
();
...
...
@@ -1222,8 +1226,10 @@ void LinkResolver::resolve_invokehandle(CallInfo& result, constantPoolHandle poo
Symbol
*
method_signature
=
NULL
;
KlassHandle
current_klass
;
resolve_pool
(
resolved_klass
,
method_name
,
method_signature
,
current_klass
,
pool
,
index
,
CHECK
);
if
(
TraceMethodHandles
)
if
(
TraceMethodHandles
)
{
ResourceMark
rm
(
THREAD
);
tty
->
print_cr
(
"resolve_invokehandle %s %s"
,
method_name
->
as_C_string
(),
method_signature
->
as_C_string
());
}
resolve_handle_call
(
result
,
resolved_klass
,
method_name
,
method_signature
,
current_klass
,
CHECK
);
}
...
...
src/share/vm/oops/method.hpp
浏览文件 @
59d84932
...
...
@@ -758,15 +758,19 @@ class Method : public Metadata {
void
print_made_not_compilable
(
int
comp_level
,
bool
is_osr
,
bool
report
,
const
char
*
reason
);
public:
bool
is_not_c1_compilable
()
const
{
return
access_flags
().
is_not_c1_compilable
();
}
void
set_not_c1_compilable
()
{
_access_flags
.
set_not_c1_compilable
();
}
bool
is_not_c2_compilable
()
const
{
return
access_flags
().
is_not_c2_compilable
();
}
void
set_not_c2_compilable
()
{
_access_flags
.
set_not_c2_compilable
();
}
bool
is_not_c1_osr_compilable
()
const
{
return
is_not_c1_compilable
();
}
// don't waste an accessFlags bit
void
set_not_c1_osr_compilable
()
{
set_not_c1_compilable
();
}
// don't waste an accessFlags bit
bool
is_not_c2_osr_compilable
()
const
{
return
access_flags
().
is_not_c2_osr_compilable
();
}
void
set_not_c2_osr_compilable
()
{
_access_flags
.
set_not_c2_osr_compilable
();
}
bool
is_not_c1_compilable
()
const
{
return
access_flags
().
is_not_c1_compilable
();
}
void
set_not_c1_compilable
()
{
_access_flags
.
set_not_c1_compilable
();
}
void
clear_not_c1_compilable
()
{
_access_flags
.
clear_not_c1_compilable
();
}
bool
is_not_c2_compilable
()
const
{
return
access_flags
().
is_not_c2_compilable
();
}
void
set_not_c2_compilable
()
{
_access_flags
.
set_not_c2_compilable
();
}
void
clear_not_c2_compilable
()
{
_access_flags
.
clear_not_c2_compilable
();
}
bool
is_not_c1_osr_compilable
()
const
{
return
is_not_c1_compilable
();
}
// don't waste an accessFlags bit
void
set_not_c1_osr_compilable
()
{
set_not_c1_compilable
();
}
// don't waste an accessFlags bit
void
clear_not_c1_osr_compilable
()
{
clear_not_c1_compilable
();
}
// don't waste an accessFlags bit
bool
is_not_c2_osr_compilable
()
const
{
return
access_flags
().
is_not_c2_osr_compilable
();
}
void
set_not_c2_osr_compilable
()
{
_access_flags
.
set_not_c2_osr_compilable
();
}
void
clear_not_c2_osr_compilable
()
{
_access_flags
.
clear_not_c2_osr_compilable
();
}
// Background compilation support
bool
queued_for_compilation
()
const
{
return
access_flags
().
queued_for_compilation
();
}
...
...
src/share/vm/oops/methodData.cpp
浏览文件 @
59d84932
...
...
@@ -660,29 +660,9 @@ MethodData::MethodData(methodHandle method, int size, TRAPS) {
// Set the method back-pointer.
_method
=
method
();
_invocation_counter
.
init
();
_backedge_counter
.
init
();
_invocation_counter_start
=
0
;
_backedge_counter_start
=
0
;
_num_loops
=
0
;
_num_blocks
=
0
;
_highest_comp_level
=
0
;
_highest_osr_comp_level
=
0
;
_would_profile
=
true
;
init
();
set_creation_mileage
(
mileage_of
(
method
()));
// Initialize flags and trap history.
_nof_decompiles
=
0
;
_nof_overflow_recompiles
=
0
;
_nof_overflow_traps
=
0
;
_eflags
=
0
;
_arg_local
=
0
;
_arg_stack
=
0
;
_arg_returned
=
0
;
assert
(
sizeof
(
_trap_hist
)
%
sizeof
(
HeapWord
)
==
0
,
"align"
);
Copy
::
zero_to_words
((
HeapWord
*
)
&
_trap_hist
,
sizeof
(
_trap_hist
)
/
sizeof
(
HeapWord
));
// Go through the bytecodes and allocate and initialize the
// corresponding data cells.
int
data_size
=
0
;
...
...
@@ -721,7 +701,27 @@ MethodData::MethodData(methodHandle method, int size, TRAPS) {
post_initialize
(
&
stream
);
set_size
(
object_size
);
}
void
MethodData
::
init
()
{
_invocation_counter
.
init
();
_backedge_counter
.
init
();
_invocation_counter_start
=
0
;
_backedge_counter_start
=
0
;
_num_loops
=
0
;
_num_blocks
=
0
;
_highest_comp_level
=
0
;
_highest_osr_comp_level
=
0
;
_would_profile
=
true
;
// Initialize flags and trap history.
_nof_decompiles
=
0
;
_nof_overflow_recompiles
=
0
;
_nof_overflow_traps
=
0
;
clear_escape_info
();
assert
(
sizeof
(
_trap_hist
)
%
sizeof
(
HeapWord
)
==
0
,
"align"
);
Copy
::
zero_to_words
((
HeapWord
*
)
&
_trap_hist
,
sizeof
(
_trap_hist
)
/
sizeof
(
HeapWord
));
}
// Get a measure of how much mileage the method has on it.
...
...
src/share/vm/oops/methodData.hpp
浏览文件 @
59d84932
...
...
@@ -1284,8 +1284,8 @@ public:
return
bytecode_cell_count
(
code
)
!=
no_profile_data
;
}
//
Perform initialization of a new MethodData*
void
init
ialize
(
methodHandle
method
);
//
reset into original state
void
init
(
);
// My size
int
size_in_bytes
()
const
{
return
_size
;
}
...
...
@@ -1365,6 +1365,7 @@ public:
intx
arg_stack
()
{
return
_arg_stack
;
}
intx
arg_returned
()
{
return
_arg_returned
;
}
uint
arg_modified
(
int
a
)
{
ArgInfoData
*
aid
=
arg_info
();
assert
(
aid
!=
NULL
,
"arg_info must be not null"
);
assert
(
a
>=
0
&&
a
<
aid
->
number_of_args
(),
"valid argument number"
);
return
aid
->
arg_modified
(
a
);
}
...
...
@@ -1373,8 +1374,8 @@ public:
void
set_arg_stack
(
intx
v
)
{
_arg_stack
=
v
;
}
void
set_arg_returned
(
intx
v
)
{
_arg_returned
=
v
;
}
void
set_arg_modified
(
int
a
,
uint
v
)
{
ArgInfoData
*
aid
=
arg_info
();
assert
(
aid
!=
NULL
,
"arg_info must be not null"
);
assert
(
a
>=
0
&&
a
<
aid
->
number_of_args
(),
"valid argument number"
);
aid
->
set_arg_modified
(
a
,
v
);
}
void
clear_escape_info
()
{
_eflags
=
_arg_local
=
_arg_stack
=
_arg_returned
=
0
;
}
...
...
src/share/vm/prims/whitebox.cpp
浏览文件 @
59d84932
...
...
@@ -49,6 +49,7 @@
#endif // INCLUDE_NMT
#include "compiler/compileBroker.hpp"
#include "runtime/compilationPolicy.hpp"
bool
WhiteBox
::
_used
=
false
;
...
...
@@ -214,11 +215,11 @@ WB_ENTRY(jboolean, WB_IsMethodCompiled(JNIEnv* env, jobject o, jobject method))
return
(
code
->
is_alive
()
&&
!
code
->
is_marked_for_deoptimization
());
WB_END
WB_ENTRY
(
jboolean
,
WB_IsMethodCompilable
(
JNIEnv
*
env
,
jobject
o
,
jobject
method
))
WB_ENTRY
(
jboolean
,
WB_IsMethodCompilable
(
JNIEnv
*
env
,
jobject
o
,
jobject
method
,
jint
comp_level
))
jmethodID
jmid
=
reflected_method_to_jmid
(
thread
,
env
,
method
);
MutexLockerEx
mu
(
Compile_lock
);
methodHandle
mh
(
THREAD
,
Method
::
checked_resolve_jmethod_id
(
jmid
));
return
!
mh
->
is_not_compilable
(
);
return
CompilationPolicy
::
can_be_compiled
(
mh
,
comp_level
);
WB_END
WB_ENTRY
(
jboolean
,
WB_IsMethodQueuedForCompilation
(
JNIEnv
*
env
,
jobject
o
,
jobject
method
))
...
...
@@ -242,7 +243,7 @@ WB_ENTRY(void, WB_MakeMethodNotCompilable(JNIEnv* env, jobject o, jobject method
mh
->
set_not_compilable
();
WB_END
WB_ENTRY
(
jboolean
,
WB_SetDontInlineMethod
(
JNIEnv
*
env
,
jobject
o
,
jobject
method
,
jboolean
value
))
WB_ENTRY
(
jboolean
,
WB_
Test
SetDontInlineMethod
(
JNIEnv
*
env
,
jobject
o
,
jobject
method
,
jboolean
value
))
jmethodID
jmid
=
reflected_method_to_jmid
(
thread
,
env
,
method
);
methodHandle
mh
(
THREAD
,
Method
::
checked_resolve_jmethod_id
(
jmid
));
bool
result
=
mh
->
dont_inline
();
...
...
@@ -255,6 +256,54 @@ WB_ENTRY(jint, WB_GetCompileQueuesSize(JNIEnv* env, jobject o))
CompileBroker
::
queue_size
(
CompLevel_full_profile
)
/* C1 */
;
WB_END
WB_ENTRY
(
jboolean
,
WB_TestSetForceInlineMethod
(
JNIEnv
*
env
,
jobject
o
,
jobject
method
,
jboolean
value
))
jmethodID
jmid
=
reflected_method_to_jmid
(
thread
,
env
,
method
);
methodHandle
mh
(
THREAD
,
Method
::
checked_resolve_jmethod_id
(
jmid
));
bool
result
=
mh
->
force_inline
();
mh
->
set_force_inline
(
value
==
JNI_TRUE
);
return
result
;
WB_END
WB_ENTRY
(
jboolean
,
WB_EnqueueMethodForCompilation
(
JNIEnv
*
env
,
jobject
o
,
jobject
method
,
jint
comp_level
))
jmethodID
jmid
=
reflected_method_to_jmid
(
thread
,
env
,
method
);
methodHandle
mh
(
THREAD
,
Method
::
checked_resolve_jmethod_id
(
jmid
));
nmethod
*
nm
=
CompileBroker
::
compile_method
(
mh
,
InvocationEntryBci
,
comp_level
,
mh
,
mh
->
invocation_count
(),
"WhiteBox"
,
THREAD
);
MutexLockerEx
mu
(
Compile_lock
);
return
(
mh
->
queued_for_compilation
()
||
nm
!=
NULL
);
WB_END
WB_ENTRY
(
void
,
WB_ClearMethodState
(
JNIEnv
*
env
,
jobject
o
,
jobject
method
))
jmethodID
jmid
=
reflected_method_to_jmid
(
thread
,
env
,
method
);
methodHandle
mh
(
THREAD
,
Method
::
checked_resolve_jmethod_id
(
jmid
));
MutexLockerEx
mu
(
Compile_lock
);
MethodData
*
mdo
=
mh
->
method_data
();
if
(
mdo
!=
NULL
)
{
mdo
->
init
();
ResourceMark
rm
;
int
arg_count
=
mdo
->
method
()
->
size_of_parameters
();
for
(
int
i
=
0
;
i
<
arg_count
;
i
++
)
{
mdo
->
set_arg_modified
(
i
,
0
);
}
}
mh
->
backedge_counter
()
->
init
();
mh
->
invocation_counter
()
->
init
();
mh
->
set_interpreter_invocation_count
(
0
);
mh
->
set_interpreter_throwout_count
(
0
);
mh
->
clear_not_c1_compilable
();
mh
->
clear_not_c2_compilable
();
mh
->
clear_not_c2_osr_compilable
();
NOT_PRODUCT
(
mh
->
set_compiled_invocation_count
(
0
));
#ifdef TIERED
mh
->
set_rate
(
0.0
F
);
mh
->
set_prev_event_count
(
0
);
mh
->
set_prev_time
(
0
);
#endif
WB_END
WB_ENTRY
(
jboolean
,
WB_IsInStringTable
(
JNIEnv
*
env
,
jobject
o
,
jstring
javaString
))
ResourceMark
rm
(
THREAD
);
int
len
;
...
...
@@ -272,7 +321,6 @@ WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o))
Universe
::
heap
()
->
collect
(
GCCause
::
_last_ditch_collection
);
WB_END
//Some convenience methods to deal with objects from java
int
WhiteBox
::
offset_for_field
(
const
char
*
field_name
,
oop
object
,
Symbol
*
signature_symbol
)
{
...
...
@@ -354,18 +402,24 @@ static JNINativeMethod methods[] = {
(
void
*
)
&
WB_DeoptimizeMethod
},
{
CC
"isMethodCompiled"
,
CC
"(Ljava/lang/reflect/Method;)Z"
,
(
void
*
)
&
WB_IsMethodCompiled
},
{
CC
"isMethodCompilable"
,
CC
"(Ljava/lang/reflect/Method;)Z"
,
{
CC
"isMethodCompilable"
,
CC
"(Ljava/lang/reflect/Method;
I
)Z"
,
(
void
*
)
&
WB_IsMethodCompilable
},
{
CC
"isMethodQueuedForCompilation"
,
CC
"(Ljava/lang/reflect/Method;)Z"
,
(
void
*
)
&
WB_IsMethodQueuedForCompilation
},
{
CC
"makeMethodNotCompilable"
,
CC
"(Ljava/lang/reflect/Method;)V"
,
(
void
*
)
&
WB_MakeMethodNotCompilable
},
{
CC
"
s
etDontInlineMethod"
,
CC
"(Ljava/lang/reflect/Method;Z)Z"
,
(
void
*
)
&
WB_SetDontInlineMethod
},
{
CC
"
testS
etDontInlineMethod"
,
CC
"(Ljava/lang/reflect/Method;Z)Z"
,
(
void
*
)
&
WB_
Test
SetDontInlineMethod
},
{
CC
"getMethodCompilationLevel"
,
CC
"(Ljava/lang/reflect/Method;)I"
,
(
void
*
)
&
WB_GetMethodCompilationLevel
},
{
CC
"getCompileQueuesSize"
,
CC
"()I"
,
(
void
*
)
&
WB_GetCompileQueuesSize
},
{
CC
"testSetForceInlineMethod"
,
CC
"(Ljava/lang/reflect/Method;Z)Z"
,
(
void
*
)
&
WB_TestSetForceInlineMethod
},
{
CC
"enqueueMethodForCompilation"
,
CC
"(Ljava/lang/reflect/Method;I)Z"
,
(
void
*
)
&
WB_EnqueueMethodForCompilation
},
{
CC
"clearMethodState"
,
CC
"(Ljava/lang/reflect/Method;)V"
,
(
void
*
)
&
WB_ClearMethodState
},
{
CC
"isInStringTable"
,
CC
"(Ljava/lang/String;)Z"
,
(
void
*
)
&
WB_IsInStringTable
},
{
CC
"fullGC"
,
CC
"()V"
,
(
void
*
)
&
WB_FullGC
},
};
...
...
src/share/vm/runtime/compilationPolicy.cpp
浏览文件 @
59d84932
...
...
@@ -123,9 +123,10 @@ bool CompilationPolicy::can_be_compiled(methodHandle m, int comp_level) {
}
if
(
comp_level
==
CompLevel_all
)
{
return
!
m
->
is_not_compilable
(
CompLevel_simple
)
&&
!
m
->
is_not_compilable
(
CompLevel_full_optimization
);
}
else
{
}
else
if
(
is_compile
(
comp_level
))
{
return
!
m
->
is_not_compilable
(
comp_level
);
}
return
false
;
}
bool
CompilationPolicy
::
is_compilation_enabled
()
{
...
...
src/share/vm/runtime/compilationPolicy.hpp
浏览文件 @
59d84932
...
...
@@ -96,7 +96,7 @@ protected:
void
reset_counter_for_back_branch_event
(
methodHandle
method
);
public:
NonTieredCompPolicy
()
:
_compiler_count
(
0
)
{
}
virtual
CompLevel
initial_compile_level
()
{
return
CompLevel_
initial_compile
;
}
virtual
CompLevel
initial_compile_level
()
{
return
CompLevel_
highest_tier
;
}
virtual
int
compiler_count
(
CompLevel
comp_level
);
virtual
void
do_safepoint_work
();
virtual
void
reprofile
(
ScopeDesc
*
trap_scope
,
bool
is_osr
);
...
...
src/share/vm/utilities/accessFlags.hpp
浏览文件 @
59d84932
...
...
@@ -194,6 +194,9 @@ class AccessFlags VALUE_OBJ_CLASS_SPEC {
void
set_is_obsolete
()
{
atomic_set_bits
(
JVM_ACC_IS_OBSOLETE
);
}
void
set_is_prefixed_native
()
{
atomic_set_bits
(
JVM_ACC_IS_PREFIXED_NATIVE
);
}
void
clear_not_c1_compilable
()
{
atomic_clear_bits
(
JVM_ACC_NOT_C1_COMPILABLE
);
}
void
clear_not_c2_compilable
()
{
atomic_clear_bits
(
JVM_ACC_NOT_C2_COMPILABLE
);
}
void
clear_not_c2_osr_compilable
()
{
atomic_clear_bits
(
JVM_ACC_NOT_C2_OSR_COMPILABLE
);
}
// Klass* flags
void
set_has_vanilla_constructor
()
{
atomic_set_bits
(
JVM_ACC_HAS_VANILLA_CONSTRUCTOR
);
}
void
set_has_finalizer
()
{
atomic_set_bits
(
JVM_ACC_HAS_FINALIZER
);
}
...
...
src/share/vm/utilities/globalDefinitions.hpp
浏览文件 @
59d84932
...
...
@@ -845,6 +845,10 @@ inline bool is_highest_tier_compile(int comp_level) {
return
comp_level
==
CompLevel_highest_tier
;
}
inline
bool
is_compile
(
int
comp_level
)
{
return
is_c1_compile
(
comp_level
)
||
is_c2_compile
(
comp_level
);
}
//----------------------------------------------------------------------------------------------------
// 'Forward' declarations of frequently used classes
// (in order to reduce interface dependencies & reduce
...
...
test/compiler/6863420/Test.java
浏览文件 @
59d84932
...
...
@@ -27,17 +27,35 @@
* @bug 6863420
* @summary os::javaTimeNanos() go backward on Solaris x86
*
* @run main/othervm Test
* Notice the internal timeout in timeout thread Test.TOT.
* @run main/othervm/timeout=300 Test
*/
public
class
Test
{
static
final
int
INTERNAL_TIMEOUT
=
240
;
static
class
TOT
extends
Thread
{
public
void
run
()
{
try
{
Thread
.
sleep
(
INTERNAL_TIMEOUT
*
1000
);
}
catch
(
InterruptedException
ex
)
{
}
done
=
true
;
}
}
static
long
value
=
0
;
static
boolean
got_backward_time
=
false
;
static
volatile
boolean
done
=
false
;
public
static
void
main
(
String
args
[])
{
final
int
count
=
100000
;
for
(
int
numThreads
=
1
;
numThreads
<=
32
;
numThreads
++)
{
TOT
tot
=
new
TOT
();
tot
.
setDaemon
(
true
);
tot
.
start
();
for
(
int
numThreads
=
1
;
!
done
&&
numThreads
<=
32
;
numThreads
++)
{
final
int
numRuns
=
1
;
for
(
int
t
=
1
;
t
<=
numRuns
;
t
++)
{
final
int
curRun
=
t
;
...
...
@@ -48,7 +66,7 @@ public class Test {
Runnable
thread
=
new
Runnable
()
{
public
void
run
()
{
for
(
long
l
=
0
;
l
<
100000
;
l
++)
{
for
(
long
l
=
0
;
!
done
&&
l
<
100000
;
l
++)
{
final
long
start
=
System
.
nanoTime
();
if
(
value
==
12345678
)
{
System
.
out
.
println
(
"Wow!"
);
...
...
test/compiler/8011706/Test8011706.java
0 → 100644
浏览文件 @
59d84932
/*
* 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
* @bug 8011706
* @summary loop invariant code motion may move load before store to the same field
* @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8011706
*
*/
public
class
Test8011706
{
int
[]
array
;
void
m
(
boolean
test
,
int
[]
array1
,
int
[]
array2
)
{
int
i
=
0
;
if
(
test
)
{
array
=
array1
;
}
else
{
array
=
array2
;
}
while
(
true
)
{
int
v
=
array
[
i
];
i
++;
if
(
i
>=
10
)
return
;
}
}
static
public
void
main
(
String
[]
args
)
{
int
[]
new_array
=
new
int
[
10
];
Test8011706
ti
=
new
Test8011706
();
boolean
failed
=
false
;
try
{
for
(
int
i
=
0
;
i
<
10000
;
i
++)
{
ti
.
array
=
null
;
ti
.
m
(
true
,
new_array
,
new_array
);
}
}
catch
(
NullPointerException
ex
)
{
throw
new
RuntimeException
(
"TEST FAILED"
,
ex
);
}
System
.
out
.
println
(
"TEST PASSED"
);
}
}
test/compiler/whitebox/ClearMethodStateTest.java
0 → 100644
浏览文件 @
59d84932
/*
* 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 ClearMethodStateTest
* @library /testlibrary /testlibrary/whitebox
* @build ClearMethodStateTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest
* @author igor.ignatyev@oracle.com
*/
public
class
ClearMethodStateTest
extends
CompilerWhiteBoxTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// to prevent inlining #method into #compile() and #test()
WHITE_BOX
.
testSetDontInlineMethod
(
METHOD
,
true
);
new
ClearMethodStateTest
().
runTest
();
}
protected
void
test
()
throws
Exception
{
checkNotCompiled
(
METHOD
);
compile
();
checkCompiled
(
METHOD
);
WHITE_BOX
.
clearMethodState
(
METHOD
);
WHITE_BOX
.
deoptimizeMethod
(
METHOD
);
checkNotCompiled
(
METHOD
);
if
(!
TIERED_COMPILATION
)
{
WHITE_BOX
.
clearMethodState
(
METHOD
);
compile
(
COMPILE_THRESHOLD
);
checkCompiled
(
METHOD
);
WHITE_BOX
.
deoptimizeMethod
(
METHOD
);
checkNotCompiled
(
METHOD
);
WHITE_BOX
.
clearMethodState
(
METHOD
);
if
(
COMPILE_THRESHOLD
>
1
)
{
compile
(
COMPILE_THRESHOLD
-
1
);
checkNotCompiled
(
METHOD
);
}
else
{
System
.
err
.
println
(
"Warning: 'CompileThreshold' <= 1"
);
}
method
();
checkCompiled
(
METHOD
);
}
else
{
System
.
err
.
println
(
"Warning: part of test is not applicable in Tiered"
);
}
}
}
test/compiler/whitebox/CompilerWhiteBoxTest.java
浏览文件 @
59d84932
...
...
@@ -37,6 +37,8 @@ public abstract class CompilerWhiteBoxTest {
=
Integer
.
parseInt
(
getVMOption
(
"CompileThreshold"
,
"10000"
));
protected
static
final
boolean
BACKGROUND_COMPILATION
=
Boolean
.
valueOf
(
getVMOption
(
"BackgroundCompilation"
,
"true"
));
protected
static
final
boolean
TIERED_COMPILATION
=
Boolean
.
valueOf
(
getVMOption
(
"TieredCompilation"
,
"false"
));
protected
static
Method
getMethod
(
String
name
)
{
try
{
...
...
@@ -81,6 +83,9 @@ public abstract class CompilerWhiteBoxTest {
}
protected
static
void
checkNotCompiled
(
Method
method
)
{
if
(
WHITE_BOX
.
isMethodQueuedForCompilation
(
method
))
{
throw
new
RuntimeException
(
method
+
" must not be in queue"
);
}
if
(
WHITE_BOX
.
isMethodCompiled
(
method
))
{
throw
new
RuntimeException
(
method
+
" must be not compiled"
);
}
...
...
@@ -139,8 +144,11 @@ public abstract class CompilerWhiteBoxTest {
protected
abstract
void
test
()
throws
Exception
;
protected
final
int
compile
()
{
return
compile
(
Math
.
max
(
COMPILE_THRESHOLD
,
150000
));
}
protected
final
int
compile
(
int
count
)
{
int
result
=
0
;
int
count
=
Math
.
max
(
COMPILE_THRESHOLD
,
150000
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
result
+=
method
();
}
...
...
test/compiler/whitebox/DeoptimizeAllTest.java
浏览文件 @
59d84932
...
...
@@ -33,7 +33,7 @@ public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// to prevent inlining #method into #compile()
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
true
);
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
true
);
new
DeoptimizeAllTest
().
runTest
();
}
...
...
test/compiler/whitebox/DeoptimizeMethodTest.java
浏览文件 @
59d84932
...
...
@@ -33,7 +33,7 @@ public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// to prevent inlining #method into #compile()
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
true
);
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
true
);
new
DeoptimizeMethodTest
().
runTest
();
}
...
...
test/compiler/whitebox/EnqueueMethodForCompilationTest.java
0 → 100644
浏览文件 @
59d84932
/*
* 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 EnqueueMethodForCompilationTest
* @library /testlibrary /testlibrary/whitebox
* @build EnqueueMethodForCompilationTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest
* @author igor.ignatyev@oracle.com
*/
public
class
EnqueueMethodForCompilationTest
extends
CompilerWhiteBoxTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// to prevent inlining #method into #compile()
WHITE_BOX
.
testSetDontInlineMethod
(
METHOD
,
true
);
new
EnqueueMethodForCompilationTest
().
runTest
();
}
protected
void
test
()
throws
Exception
{
checkNotCompiled
(
METHOD
);
WHITE_BOX
.
enqueueMethodForCompilation
(
METHOD
,
0
);
if
(
WHITE_BOX
.
isMethodCompilable
(
METHOD
,
0
))
{
throw
new
RuntimeException
(
METHOD
+
" is compilable at level 0"
);
}
checkNotCompiled
(
METHOD
);
WHITE_BOX
.
enqueueMethodForCompilation
(
METHOD
,
-
1
);
checkNotCompiled
(
METHOD
);
WHITE_BOX
.
enqueueMethodForCompilation
(
METHOD
,
5
);
if
(!
WHITE_BOX
.
isMethodCompilable
(
METHOD
,
5
))
{
checkNotCompiled
(
METHOD
);
compile
();
checkCompiled
(
METHOD
);
}
else
{
checkCompiled
(
METHOD
);
}
int
compLevel
=
WHITE_BOX
.
getMethodCompilationLevel
(
METHOD
);
WHITE_BOX
.
deoptimizeMethod
(
METHOD
);
checkNotCompiled
(
METHOD
);
WHITE_BOX
.
enqueueMethodForCompilation
(
METHOD
,
compLevel
);
checkCompiled
(
METHOD
);
WHITE_BOX
.
deoptimizeMethod
(
METHOD
);
checkNotCompiled
(
METHOD
);
compile
();
checkCompiled
(
METHOD
);
WHITE_BOX
.
deoptimizeMethod
(
METHOD
);
checkNotCompiled
(
METHOD
);
}
}
test/compiler/whitebox/IsMethodCompilableTest.java
浏览文件 @
59d84932
...
...
@@ -45,7 +45,7 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// to prevent inlining #method into #compile()
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
true
);
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
true
);
new
IsMethodCompilableTest
().
runTest
();
}
...
...
@@ -60,26 +60,47 @@ public class IsMethodCompilableTest extends CompilerWhiteBoxTest {
"Warning: test is not applicable if PerMethodRecompilationCutoff == Inf"
);
return
;
}
boolean
madeNotCompilable
=
false
;
for
(
long
i
=
0
;
i
<
PER_METHOD_RECOMPILATION_CUTOFF
;
++
i
)
{
compile
();
waitBackgroundCompilation
(
METHOD
);
WHITE_BOX
.
deoptimizeMethod
(
METHOD
);
if
(!
WHITE_BOX
.
isMethodCompilable
(
METHOD
))
{
madeNotCompilable
=
true
;
break
;
}
// deoptimze 'PerMethodRecompilationCutoff' times and clear state
for
(
long
i
=
0L
,
n
=
PER_METHOD_RECOMPILATION_CUTOFF
-
1
;
i
<
n
;
++
i
)
{
compileAndDeoptimaze
();
}
if
(!
madeNotCompilable
)
{
if
(!
WHITE_BOX
.
isMethodCompilable
(
METHOD
))
{
throw
new
RuntimeException
(
METHOD
+
" is not compilable after "
+
(
PER_METHOD_RECOMPILATION_CUTOFF
-
1
)
+
" iterations"
);
}
WHITE_BOX
.
clearMethodState
(
METHOD
);
// deoptimze 'PerMethodRecompilationCutoff' + 1 times
long
i
;
for
(
i
=
0L
;
i
<
PER_METHOD_RECOMPILATION_CUTOFF
&&
WHITE_BOX
.
isMethodCompilable
(
METHOD
);
++
i
)
{
compileAndDeoptimaze
();
}
if
(
i
!=
PER_METHOD_RECOMPILATION_CUTOFF
)
{
throw
new
RuntimeException
(
METHOD
+
" is not compilable after "
+
i
+
" iterations, but must only after "
+
PER_METHOD_RECOMPILATION_CUTOFF
);
}
if
(
WHITE_BOX
.
isMethodCompilable
(
METHOD
))
{
throw
new
RuntimeException
(
METHOD
+
" is still compilable after "
+
PER_METHOD_RECOMPILATION_CUTOFF
+
" iterations"
);
}
compile
();
if
(
WHITE_BOX
.
isMethodCompiled
(
METHOD
))
{
printInfo
(
METHOD
);
throw
new
RuntimeException
(
METHOD
+
" is not compilable but compiled"
);
checkNotCompiled
(
METHOD
);
WHITE_BOX
.
clearMethodState
(
METHOD
);
if
(!
WHITE_BOX
.
isMethodCompilable
(
METHOD
))
{
throw
new
RuntimeException
(
METHOD
+
" is compilable after clearMethodState()"
);
}
compile
();
checkCompiled
(
METHOD
);
}
private
void
compileAndDeoptimaze
()
throws
Exception
{
compile
();
waitBackgroundCompilation
(
METHOD
);
WHITE_BOX
.
deoptimizeMethod
(
METHOD
);
}
}
test/compiler/whitebox/MakeMethodNotCompilableTest.java
浏览文件 @
59d84932
...
...
@@ -33,7 +33,7 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// to prevent inlining #method into #compile()
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
true
);
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
true
);
new
MakeMethodNotCompilableTest
().
runTest
();
}
...
...
@@ -46,9 +46,6 @@ public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
throw
new
RuntimeException
(
METHOD
+
" must be not compilable"
);
}
compile
();
if
(
WHITE_BOX
.
isMethodQueuedForCompilation
(
METHOD
))
{
throw
new
RuntimeException
(
METHOD
+
" must not be in queue"
);
}
checkNotCompiled
(
METHOD
);
if
(
WHITE_BOX
.
isMethodCompilable
(
METHOD
))
{
throw
new
RuntimeException
(
METHOD
+
" must be not compilable"
);
...
...
test/compiler/whitebox/SetDontInlineMethodTest.java
浏览文件 @
59d84932
...
...
@@ -36,23 +36,23 @@ public class SetDontInlineMethodTest extends CompilerWhiteBoxTest {
}
protected
void
test
()
throws
Exception
{
if
(
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
true
))
{
if
(
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
true
))
{
throw
new
RuntimeException
(
"on start "
+
METHOD
+
" must be inlineable"
);
}
if
(!
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
true
))
{
if
(!
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
true
))
{
throw
new
RuntimeException
(
"after first change to true "
+
METHOD
+
" must be not inlineable"
);
}
if
(!
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
false
))
{
if
(!
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
false
))
{
throw
new
RuntimeException
(
"after second change to true "
+
METHOD
+
" must be still not inlineable"
);
}
if
(
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
false
))
{
if
(
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
false
))
{
throw
new
RuntimeException
(
"after first change to false"
+
METHOD
+
" must be inlineable"
);
}
if
(
WHITE_BOX
.
s
etDontInlineMethod
(
METHOD
,
false
))
{
if
(
WHITE_BOX
.
testS
etDontInlineMethod
(
METHOD
,
false
))
{
throw
new
RuntimeException
(
"after second change to false "
+
METHOD
+
" must be inlineable"
);
}
...
...
test/compiler/whitebox/SetForceInlineMethodTest.java
0 → 100644
浏览文件 @
59d84932
/*
* 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 SetForceInlineMethodTest
* @library /testlibrary /testlibrary/whitebox
* @build SetForceInlineMethodTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SetForceInlineMethodTest
* @author igor.ignatyev@oracle.com
*/
public
class
SetForceInlineMethodTest
extends
CompilerWhiteBoxTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
new
SetForceInlineMethodTest
().
runTest
();
}
protected
void
test
()
throws
Exception
{
if
(
WHITE_BOX
.
testSetForceInlineMethod
(
METHOD
,
true
))
{
throw
new
RuntimeException
(
"on start "
+
METHOD
+
" must be not force inlineable"
);
}
if
(!
WHITE_BOX
.
testSetForceInlineMethod
(
METHOD
,
true
))
{
throw
new
RuntimeException
(
"after first change to true "
+
METHOD
+
" must be force inlineable"
);
}
if
(!
WHITE_BOX
.
testSetForceInlineMethod
(
METHOD
,
false
))
{
throw
new
RuntimeException
(
"after second change to true "
+
METHOD
+
" must be still force inlineable"
);
}
if
(
WHITE_BOX
.
testSetForceInlineMethod
(
METHOD
,
false
))
{
throw
new
RuntimeException
(
"after first change to false"
+
METHOD
+
" must be not force inlineable"
);
}
if
(
WHITE_BOX
.
testSetForceInlineMethod
(
METHOD
,
false
))
{
throw
new
RuntimeException
(
"after second change to false "
+
METHOD
+
" must be not force inlineable"
);
}
}
}
test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
浏览文件 @
59d84932
...
...
@@ -91,13 +91,19 @@ public class WhiteBox {
// Compiler
public
native
void
deoptimizeAll
();
public
native
boolean
isMethodCompiled
(
Method
method
);
public
native
boolean
isMethodCompilable
(
Method
method
);
public
boolean
isMethodCompilable
(
Method
method
)
{
return
isMethodCompilable
(
method
,
-
1
/*any*/
);
}
public
native
boolean
isMethodCompilable
(
Method
method
,
int
compLevel
);
public
native
boolean
isMethodQueuedForCompilation
(
Method
method
);
public
native
int
deoptimizeMethod
(
Method
method
);
public
native
void
makeMethodNotCompilable
(
Method
method
);
public
native
int
getMethodCompilationLevel
(
Method
method
);
public
native
boolean
s
etDontInlineMethod
(
Method
method
,
boolean
value
);
public
native
boolean
testS
etDontInlineMethod
(
Method
method
,
boolean
value
);
public
native
int
getCompileQueuesSize
();
public
native
boolean
testSetForceInlineMethod
(
Method
method
,
boolean
value
);
public
native
boolean
enqueueMethodForCompilation
(
Method
method
,
int
compLevel
);
public
native
void
clearMethodState
(
Method
method
);
//Intered strings
public
native
boolean
isInStringTable
(
String
str
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录