Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
d78dd3b2
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看板
提交
d78dd3b2
编写于
3月 05, 2013
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
57034afa
4459ddcc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
61 addition
and
7 deletion
+61
-7
src/share/vm/opto/c2_globals.hpp
src/share/vm/opto/c2_globals.hpp
+6
-0
src/share/vm/opto/compile.cpp
src/share/vm/opto/compile.cpp
+35
-0
src/share/vm/opto/compile.hpp
src/share/vm/opto/compile.hpp
+3
-0
src/share/vm/opto/gcm.cpp
src/share/vm/opto/gcm.cpp
+8
-2
src/share/vm/opto/lcm.cpp
src/share/vm/opto/lcm.cpp
+9
-5
未找到文件。
src/share/vm/opto/c2_globals.hpp
浏览文件 @
d78dd3b2
...
...
@@ -54,6 +54,12 @@
#define C2_FLAGS(develop, develop_pd, product, product_pd, diagnostic, experimental, notproduct) \
\
develop(bool, StressLCM, false, \
"Randomize instruction scheduling in LCM") \
\
develop(bool, StressGCM, false, \
"Randomize instruction scheduling in GCM") \
\
notproduct(intx, CompileZapFirst, 0, \
"If +ZapDeadCompiledLocals, " \
"skip this many before compiling in zap calls") \
...
...
src/share/vm/opto/compile.cpp
浏览文件 @
d78dd3b2
...
...
@@ -3669,3 +3669,38 @@ void Compile::add_expensive_node(Node * n) {
n
->
set_req
(
0
,
NULL
);
}
}
// Auxiliary method to support randomized stressing/fuzzing.
//
// This method can be called the arbitrary number of times, with current count
// as the argument. The logic allows selecting a single candidate from the
// running list of candidates as follows:
// int count = 0;
// Cand* selected = null;
// while(cand = cand->next()) {
// if (randomized_select(++count)) {
// selected = cand;
// }
// }
//
// Including count equalizes the chances any candidate is "selected".
// This is useful when we don't have the complete list of candidates to choose
// from uniformly. In this case, we need to adjust the randomicity of the
// selection, or else we will end up biasing the selection towards the latter
// candidates.
//
// Quick back-envelope calculation shows that for the list of n candidates
// the equal probability for the candidate to persist as "best" can be
// achieved by replacing it with "next" k-th candidate with the probability
// of 1/k. It can be easily shown that by the end of the run, the
// probability for any candidate is converged to 1/n, thus giving the
// uniform distribution among all the candidates.
//
// We don't care about the domain size as long as (RANDOMIZED_DOMAIN / count) is large.
#define RANDOMIZED_DOMAIN_POW 29
#define RANDOMIZED_DOMAIN (1 << RANDOMIZED_DOMAIN_POW)
#define RANDOMIZED_DOMAIN_MASK ((1 << (RANDOMIZED_DOMAIN_POW + 1)) - 1)
bool
Compile
::
randomized_select
(
int
count
)
{
assert
(
count
>
0
,
"only positive"
);
return
(
os
::
random
()
&
RANDOMIZED_DOMAIN_MASK
)
<
(
RANDOMIZED_DOMAIN
/
count
);
}
src/share/vm/opto/compile.hpp
浏览文件 @
d78dd3b2
...
...
@@ -1086,6 +1086,9 @@ class Compile : public Phase {
// Definitions of pd methods
static
void
pd_compiler2_init
();
// Auxiliary method for randomized fuzzing/stressing
static
bool
randomized_select
(
int
count
);
};
#endif // SHARE_VM_OPTO_COMPILE_HPP
src/share/vm/opto/gcm.cpp
浏览文件 @
d78dd3b2
...
...
@@ -1046,6 +1046,8 @@ Block* PhaseCFG::hoist_to_cheaper_block(Block* LCA, Block* early, Node* self) {
}
#endif
int
cand_cnt
=
0
;
// number of candidates tried
// Walk up the dominator tree from LCA (Lowest common ancestor) to
// the earliest legal location. Capture the least execution frequency.
while
(
LCA
!=
early
)
{
...
...
@@ -1071,8 +1073,11 @@ Block* PhaseCFG::hoist_to_cheaper_block(Block* LCA, Block* early, Node* self) {
LCA
->
_pre_order
,
LCA
->
_nodes
[
0
]
->
_idx
,
start_lat
,
end_idx
,
end_lat
,
LCA_freq
);
}
#endif
cand_cnt
++
;
if
(
LCA_freq
<
least_freq
||
// Better Frequency
(
!
in_latency
&&
// No block containing latency
(
StressGCM
&&
Compile
::
randomized_select
(
cand_cnt
))
||
// Should be randomly accepted in stress mode
(
!
StressGCM
&&
// Otherwise, choose with latency
!
in_latency
&&
// No block containing latency
LCA_freq
<
least_freq
*
delta
&&
// No worse frequency
target
>=
end_lat
&&
// within latency range
!
self
->
is_iteratively_computed
()
)
// But don't hoist IV increments
...
...
@@ -1210,7 +1215,8 @@ void PhaseCFG::schedule_late(VectorSet &visited, Node_List &stack) {
}
// If there is no opportunity to hoist, then we're done.
bool
try_to_hoist
=
(
LCA
!=
early
);
// In stress mode, try to hoist even the single operations.
bool
try_to_hoist
=
StressGCM
||
(
LCA
!=
early
);
// Must clone guys stay next to use; no hoisting allowed.
// Also cannot hoist guys that alter memory or are otherwise not
...
...
src/share/vm/opto/lcm.cpp
浏览文件 @
d78dd3b2
...
...
@@ -421,6 +421,7 @@ Node *Block::select(PhaseCFG *cfg, Node_List &worklist, GrowableArray<int> &read
uint
latency
=
0
;
// Bigger is scheduled first
uint
score
=
0
;
// Bigger is better
int
idx
=
-
1
;
// Index in worklist
int
cand_cnt
=
0
;
// Candidate count
for
(
uint
i
=
0
;
i
<
cnt
;
i
++
)
{
// Inspect entire worklist
// Order in worklist is used to break ties.
...
...
@@ -503,11 +504,14 @@ Node *Block::select(PhaseCFG *cfg, Node_List &worklist, GrowableArray<int> &read
uint
n_score
=
n
->
req
();
// Many inputs get high score to break ties
// Keep best latency found
if
(
choice
<
n_choice
||
(
choice
==
n_choice
&&
(
latency
<
n_latency
||
(
latency
==
n_latency
&&
(
score
<
n_score
)))))
{
cand_cnt
++
;
if
(
choice
<
n_choice
||
(
choice
==
n_choice
&&
((
StressLCM
&&
Compile
::
randomized_select
(
cand_cnt
))
||
(
!
StressLCM
&&
(
latency
<
n_latency
||
(
latency
==
n_latency
&&
(
score
<
n_score
)))))))
{
choice
=
n_choice
;
latency
=
n_latency
;
score
=
n_score
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录