Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
e4baf3d5
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看板
提交
e4baf3d5
编写于
2月 06, 2019
作者:
R
roland
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8213419: C2 may hang in MulLNode::Ideal()/MulINode::Ideal() with gcc 8.2.1
Reviewed-by: kvn, dlong, aph
上级
c6d33699
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
146 addition
and
43 deletion
+146
-43
src/share/vm/opto/mulnode.cpp
src/share/vm/opto/mulnode.cpp
+39
-39
src/share/vm/utilities/globalDefinitions.hpp
src/share/vm/utilities/globalDefinitions.hpp
+43
-4
test/compiler/integerArithmetic/MultiplyByIntegerMinHang.java
.../compiler/integerArithmetic/MultiplyByIntegerMinHang.java
+64
-0
未找到文件。
src/share/vm/opto/mulnode.cpp
浏览文件 @
e4baf3d5
...
...
@@ -169,7 +169,6 @@ const Type *MulNode::Value( PhaseTransform *phase ) const {
return
mul_ring
(
t1
,
t2
);
// Local flavor of type multiplication
}
//=============================================================================
//------------------------------Ideal------------------------------------------
// Check for power-of-2 multiply, then try the regular MulNode::Ideal
...
...
@@ -184,42 +183,43 @@ Node *MulINode::Ideal(PhaseGVN *phase, bool can_reshape) {
}
// Now we have a constant Node on the right and the constant in con
if
(
con
==
0
)
return
NULL
;
// By zero is handled by Value call
if
(
con
==
1
)
return
NULL
;
// By one is handled by Identity call
if
(
con
==
0
)
return
NULL
;
// By zero is handled by Value call
if
(
con
==
1
)
return
NULL
;
// By one is handled by Identity call
// Check for negative constant; if so negate the final result
bool
sign_flip
=
false
;
if
(
con
<
0
)
{
con
=
-
con
;
unsigned
int
abs_con
=
uabs
(
con
);
if
(
abs_con
!=
(
unsigned
int
)
con
)
{
sign_flip
=
true
;
}
// Get low bit; check for being the only bit
Node
*
res
=
NULL
;
jint
bit1
=
con
&
-
con
;
// Extract low bit
if
(
bit1
==
con
)
{
// Found a power of 2?
res
=
new
(
phase
->
C
)
LShiftINode
(
in
(
1
),
phase
->
intcon
(
log2_intptr
(
bit1
))
);
unsigned
int
bit1
=
abs_con
&
(
0
-
abs_con
)
;
// Extract low bit
if
(
bit1
==
abs_con
)
{
// Found a power of 2?
res
=
new
(
phase
->
C
)
LShiftINode
(
in
(
1
),
phase
->
intcon
(
log2_intptr
(
bit1
))
);
}
else
{
// Check for constant with 2 bits set
jint
bit2
=
con
-
bit1
;
bit2
=
bit2
&
-
bit2
;
// Extract 2nd bit
if
(
bit2
+
bit1
==
con
)
{
// Found all bits in con?
Node
*
n1
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftINode
(
in
(
1
),
phase
->
intcon
(
log2_intptr
(
bit1
))
)
);
Node
*
n2
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftINode
(
in
(
1
),
phase
->
intcon
(
log2_intptr
(
bit2
))
)
);
res
=
new
(
phase
->
C
)
AddINode
(
n2
,
n1
);
}
else
if
(
is_power_of_2
(
con
+
1
))
{
unsigned
int
bit2
=
abs_
con
-
bit1
;
bit2
=
bit2
&
(
0
-
bit2
)
;
// Extract 2nd bit
if
(
bit2
+
bit1
==
abs_con
)
{
// Found all bits in con?
Node
*
n1
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftINode
(
in
(
1
),
phase
->
intcon
(
log2_intptr
(
bit1
)))
);
Node
*
n2
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftINode
(
in
(
1
),
phase
->
intcon
(
log2_intptr
(
bit2
)))
);
res
=
new
(
phase
->
C
)
AddINode
(
n2
,
n1
);
}
else
if
(
is_power_of_2
(
abs_
con
+
1
))
{
// Sleezy: power-of-2 -1. Next time be generic.
jint
temp
=
(
jint
)
(
con
+
1
)
;
Node
*
n1
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftINode
(
in
(
1
),
phase
->
intcon
(
log2_intptr
(
temp
))
)
);
res
=
new
(
phase
->
C
)
SubINode
(
n1
,
in
(
1
)
);
unsigned
int
temp
=
abs_con
+
1
;
Node
*
n1
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftINode
(
in
(
1
),
phase
->
intcon
(
log2_intptr
(
temp
)))
);
res
=
new
(
phase
->
C
)
SubINode
(
n1
,
in
(
1
)
);
}
else
{
return
MulNode
::
Ideal
(
phase
,
can_reshape
);
}
}
if
(
sign_flip
)
{
// Need to negate result?
if
(
sign_flip
)
{
// Need to negate result?
res
=
phase
->
transform
(
res
);
// Transform, before making the zero con
res
=
new
(
phase
->
C
)
SubINode
(
phase
->
intcon
(
0
),
res
);
}
...
...
@@ -280,42 +280,42 @@ Node *MulLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
}
// Now we have a constant Node on the right and the constant in con
if
(
con
==
CONST64
(
0
)
)
return
NULL
;
// By zero is handled by Value call
if
(
con
==
CONST64
(
1
)
)
return
NULL
;
// By one is handled by Identity call
if
(
con
==
CONST64
(
0
)
)
return
NULL
;
// By zero is handled by Value call
if
(
con
==
CONST64
(
1
)
)
return
NULL
;
// By one is handled by Identity call
// Check for negative constant; if so negate the final result
bool
sign_flip
=
false
;
if
(
con
<
0
)
{
con
=
-
con
;
unsigned
long
abs_con
=
uabs
(
con
);
if
(
abs_con
!=
(
unsigned
long
)
con
)
{
sign_flip
=
true
;
}
// Get low bit; check for being the only bit
Node
*
res
=
NULL
;
jlong
bit1
=
con
&
-
con
;
// Extract low bit
if
(
bit1
==
con
)
{
// Found a power of 2?
res
=
new
(
phase
->
C
)
LShiftLNode
(
in
(
1
),
phase
->
intcon
(
log2_long
(
bit1
))
);
unsigned
long
bit1
=
abs_con
&
(
0
-
abs_con
)
;
// Extract low bit
if
(
bit1
==
abs_con
)
{
// Found a power of 2?
res
=
new
(
phase
->
C
)
LShiftLNode
(
in
(
1
),
phase
->
intcon
(
log2_long
(
bit1
))
);
}
else
{
// Check for constant with 2 bits set
jlong
bit2
=
con
-
bit1
;
bit2
=
bit2
&
-
bit2
;
// Extract 2nd bit
if
(
bit2
+
bit1
==
con
)
{
// Found all bits in con?
Node
*
n1
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftLNode
(
in
(
1
),
phase
->
intcon
(
log2_long
(
bit1
))
)
);
Node
*
n2
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftLNode
(
in
(
1
),
phase
->
intcon
(
log2_long
(
bit2
))
)
);
res
=
new
(
phase
->
C
)
AddLNode
(
n2
,
n1
);
}
else
if
(
is_power_of_2_long
(
con
+
1
))
{
unsigned
long
bit2
=
abs_
con
-
bit1
;
bit2
=
bit2
&
(
0
-
bit2
)
;
// Extract 2nd bit
if
(
bit2
+
bit1
==
abs_con
)
{
// Found all bits in con?
Node
*
n1
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftLNode
(
in
(
1
),
phase
->
intcon
(
log2_long
(
bit1
)))
);
Node
*
n2
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftLNode
(
in
(
1
),
phase
->
intcon
(
log2_long
(
bit2
)))
);
res
=
new
(
phase
->
C
)
AddLNode
(
n2
,
n1
);
}
else
if
(
is_power_of_2_long
(
abs_
con
+
1
))
{
// Sleezy: power-of-2 -1. Next time be generic.
jlong
temp
=
(
jlong
)
(
con
+
1
)
;
Node
*
n1
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftLNode
(
in
(
1
),
phase
->
intcon
(
log2_long
(
temp
))
)
);
res
=
new
(
phase
->
C
)
SubLNode
(
n1
,
in
(
1
)
);
unsigned
long
temp
=
abs_con
+
1
;
Node
*
n1
=
phase
->
transform
(
new
(
phase
->
C
)
LShiftLNode
(
in
(
1
),
phase
->
intcon
(
log2_long
(
temp
)))
);
res
=
new
(
phase
->
C
)
SubLNode
(
n1
,
in
(
1
)
);
}
else
{
return
MulNode
::
Ideal
(
phase
,
can_reshape
);
}
}
if
(
sign_flip
)
{
// Need to negate result?
if
(
sign_flip
)
{
// Need to negate result?
res
=
phase
->
transform
(
res
);
// Transform, before making the zero con
res
=
new
(
phase
->
C
)
SubLNode
(
phase
->
longcon
(
0
),
res
);
}
...
...
src/share/vm/utilities/globalDefinitions.hpp
浏览文件 @
e4baf3d5
...
...
@@ -1136,10 +1136,10 @@ inline bool is_power_of_2_long(jlong x) {
//* largest i such that 2^i <= x
// A negative value of 'x' will return '31'
inline
int
log2_intptr
(
intptr_t
x
)
{
inline
int
log2_intptr
(
u
intptr_t
x
)
{
int
i
=
-
1
;
uintptr_t
p
=
1
;
while
(
p
!=
0
&&
p
<=
(
uintptr_t
)
x
)
{
while
(
p
!=
0
&&
p
<=
x
)
{
// p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x)
i
++
;
p
*=
2
;
}
...
...
@@ -1150,10 +1150,10 @@ inline int log2_intptr(intptr_t x) {
//* largest i such that 2^i <= x
// A negative value of 'x' will return '63'
inline
int
log2_long
(
j
long
x
)
{
inline
int
log2_long
(
unsigned
long
x
)
{
int
i
=
-
1
;
julong
p
=
1
;
while
(
p
!=
0
&&
p
<=
(
julong
)
x
)
{
while
(
p
!=
0
&&
p
<=
x
)
{
// p = 2^(i+1) && p <= x (i.e., 2^(i+1) <= x)
i
++
;
p
*=
2
;
}
...
...
@@ -1162,6 +1162,22 @@ inline int log2_long(jlong x) {
return
i
;
}
inline
int
log2_intptr
(
intptr_t
x
)
{
return
log2_intptr
((
uintptr_t
)
x
);
}
inline
int
log2_intptr
(
int
x
)
{
return
log2_intptr
((
uintptr_t
)
x
);
}
inline
int
log2_intptr
(
uint
x
)
{
return
log2_intptr
((
uintptr_t
)
x
);
}
inline
int
log2_long
(
jlong
x
)
{
return
log2_long
((
unsigned
long
)
x
);
}
//* the argument must be exactly a power of 2
inline
int
exact_log2
(
intptr_t
x
)
{
#ifdef ASSERT
...
...
@@ -1201,6 +1217,29 @@ inline intptr_t round_down(intptr_t x, uintx s) {
inline
bool
is_odd
(
intx
x
)
{
return
x
&
1
;
}
inline
bool
is_even
(
intx
x
)
{
return
!
is_odd
(
x
);
}
// abs methods which cannot overflow and so are well-defined across
// the entire domain of integer types.
static
inline
unsigned
int
uabs
(
unsigned
int
n
)
{
union
{
unsigned
int
result
;
int
value
;
};
result
=
n
;
if
(
value
<
0
)
result
=
0
-
result
;
return
result
;
}
static
inline
unsigned
long
uabs
(
unsigned
long
n
)
{
union
{
unsigned
long
result
;
long
value
;
};
result
=
n
;
if
(
value
<
0
)
result
=
0
-
result
;
return
result
;
}
static
inline
unsigned
long
uabs
(
jlong
n
)
{
return
uabs
((
unsigned
long
)
n
);
}
static
inline
unsigned
int
uabs
(
int
n
)
{
return
uabs
((
unsigned
int
)
n
);
}
// "to" should be greater than "from."
inline
intx
byte_size
(
void
*
from
,
void
*
to
)
{
return
(
address
)
to
-
(
address
)
from
;
...
...
test/compiler/integerArithmetic/MultiplyByIntegerMinHang.java
0 → 100644
浏览文件 @
e4baf3d5
/*
* Copyright (c) 2018, Red Hat, Inc. 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 8213419
* @summary C2 may hang in MulLNode::Ideal()/MulINode::Ideal() with gcc 8.2.1
*
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement MultiplyByIntegerMinHang
*
*/
public
class
MultiplyByIntegerMinHang
{
public
static
void
main
(
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
20_000
;
i
++)
{
if
(
test1
(
0
)
!=
0
)
{
throw
new
RuntimeException
(
"incorrect result"
);
}
if
(
test1
(
1
)
!=
Integer
.
MIN_VALUE
)
{
throw
new
RuntimeException
(
"incorrect result"
);
}
if
(
test1
(
2
)
!=
0
)
{
throw
new
RuntimeException
(
"incorrect result"
);
}
if
(
test2
(
0
)
!=
0
)
{
throw
new
RuntimeException
(
"incorrect result"
);
}
if
(
test2
(
1
)
!=
Long
.
MIN_VALUE
)
{
throw
new
RuntimeException
(
"incorrect result"
);
}
if
(
test2
(
2
)
!=
0
)
{
throw
new
RuntimeException
(
"incorrect result"
);
}
}
}
private
static
int
test1
(
int
v
)
{
return
v
*
Integer
.
MIN_VALUE
;
}
private
static
long
test2
(
long
v
)
{
return
v
*
Long
.
MIN_VALUE
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录