Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
b017ad88
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看板
提交
b017ad88
编写于
2月 27, 2020
作者:
V
vlivanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8181872: C1: possible overflow when strength reducing integer multiply by constant
Reviewed-by: kvn, andrew
上级
2f597675
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
61 addition
and
8 deletion
+61
-8
src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
+4
-4
src/share/vm/c1/c1_LIRGenerator.cpp
src/share/vm/c1/c1_LIRGenerator.cpp
+3
-3
src/share/vm/c1/c1_LIRGenerator.hpp
src/share/vm/c1/c1_LIRGenerator.hpp
+1
-1
test/compiler/c1/MultiplyByMaxInt.java
test/compiler/c1/MultiplyByMaxInt.java
+53
-0
未找到文件。
src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
浏览文件 @
b017ad88
...
...
@@ -233,8 +233,8 @@ void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr bas
}
bool
LIRGenerator
::
strength_reduce_multiply
(
LIR_Opr
left
,
int
c
,
LIR_Opr
result
,
LIR_Opr
tmp
)
{
if
(
tmp
->
is_valid
())
{
bool
LIRGenerator
::
strength_reduce_multiply
(
LIR_Opr
left
,
j
int
c
,
LIR_Opr
result
,
LIR_Opr
tmp
)
{
if
(
tmp
->
is_valid
()
&&
c
>
0
&&
c
<
max_jint
)
{
if
(
is_power_of_2
(
c
+
1
))
{
__
move
(
left
,
tmp
);
__
shift_left
(
left
,
log2_jint
(
c
+
1
),
left
);
...
...
@@ -602,8 +602,8 @@ void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) {
bool
use_constant
=
false
;
bool
use_tmp
=
false
;
if
(
right_arg
->
is_constant
())
{
int
iconst
=
right_arg
->
get_jint_constant
();
if
(
iconst
>
0
)
{
j
int
iconst
=
right_arg
->
get_jint_constant
();
if
(
iconst
>
0
&&
iconst
<
max_jint
)
{
if
(
is_power_of_2
(
iconst
))
{
use_constant
=
true
;
}
else
if
(
is_power_of_2
(
iconst
-
1
)
||
is_power_of_2
(
iconst
+
1
))
{
...
...
src/share/vm/c1/c1_LIRGenerator.cpp
浏览文件 @
b017ad88
...
...
@@ -542,8 +542,8 @@ void LIRGenerator::arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr l
bool
did_strength_reduce
=
false
;
if
(
right
->
is_constant
())
{
int
c
=
right
->
as_jint
();
if
(
is_power_of_2
(
c
))
{
j
int
c
=
right
->
as_jint
();
if
(
c
>
0
&&
is_power_of_2
(
c
))
{
// do not need tmp here
__
shift_left
(
left_op
,
exact_log2
(
c
),
result_op
);
did_strength_reduce
=
true
;
...
...
src/share/vm/c1/c1_LIRGenerator.hpp
浏览文件 @
b017ad88
...
...
@@ -308,7 +308,7 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
// is_strictfp is only needed for mul and div (and only generates different code on i486)
void
arithmetic_op
(
Bytecodes
::
Code
code
,
LIR_Opr
result
,
LIR_Opr
left
,
LIR_Opr
right
,
bool
is_strictfp
,
LIR_Opr
tmp
,
CodeEmitInfo
*
info
=
NULL
);
// machine dependent. returns true if it emitted code for the multiply
bool
strength_reduce_multiply
(
LIR_Opr
left
,
int
constant
,
LIR_Opr
result
,
LIR_Opr
tmp
);
bool
strength_reduce_multiply
(
LIR_Opr
left
,
j
int
constant
,
LIR_Opr
result
,
LIR_Opr
tmp
);
void
store_stack_parameter
(
LIR_Opr
opr
,
ByteSize
offset_from_sp_in_bytes
);
...
...
test/compiler/c1/MultiplyByMaxInt.java
0 → 100644
浏览文件 @
b017ad88
/*
* Copyright (c) 2017, 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 8181872
*
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions
* -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1
* -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
* compiler.c1.MultiplyByMaxInt
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation
* -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=3
* -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test
* compiler.c1.MultiplyByMaxInt
*/
package
compiler.c1
;
public
class
MultiplyByMaxInt
{
static
int
test
(
int
x
)
{
int
loops
=
(
x
>>>
4
)
&
7
;
while
(
loops
--
>
0
)
{
x
=
(
x
*
2147483647
)
%
16807
;
}
return
x
;
}
public
static
void
main
(
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
20000
;
i
++)
{
test
(
i
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录