Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
70c5ce63
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看板
提交
70c5ce63
编写于
1月 16, 2015
作者:
A
asiebenborn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8068909: SIGSEGV in c2 compiled code with OptimizeStringConcat
Reviewed-by: kvn
上级
bdff0f83
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
97 addition
and
3 deletion
+97
-3
src/share/vm/opto/stringopts.cpp
src/share/vm/opto/stringopts.cpp
+8
-3
test/compiler/stringopts/TestOptimizeStringConcat.java
test/compiler/stringopts/TestOptimizeStringConcat.java
+89
-0
未找到文件。
src/share/vm/opto/stringopts.cpp
浏览文件 @
70c5ce63
...
...
@@ -1507,10 +1507,12 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
}
case
StringConcat
::
StringMode
:
{
const
Type
*
type
=
kit
.
gvn
().
type
(
arg
);
Node
*
count
=
NULL
;
if
(
type
==
TypePtr
::
NULL_PTR
)
{
// replace the argument with the null checked version
arg
=
null_string
;
sc
->
set_argument
(
argi
,
arg
);
count
=
kit
.
load_String_length
(
kit
.
control
(),
arg
);
}
else
if
(
!
type
->
higher_equal
(
TypeInstPtr
::
NOTNULL
))
{
// s = s != null ? s : "null";
// length = length + (s.count - s.offset);
...
...
@@ -1533,10 +1535,13 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
// replace the argument with the null checked version
arg
=
phi
;
sc
->
set_argument
(
argi
,
arg
);
count
=
kit
.
load_String_length
(
kit
.
control
(),
arg
);
}
else
{
// A corresponding nullcheck will be connected during IGVN MemNode::Ideal_common_DU_postCCP
// kit.control might be a different test, that can be hoisted above the actual nullcheck
// in case, that the control input is not null, Ideal_common_DU_postCCP will not look for a nullcheck.
count
=
kit
.
load_String_length
(
NULL
,
arg
);
}
Node
*
count
=
kit
.
load_String_length
(
kit
.
control
(),
arg
);
length
=
__
AddI
(
length
,
count
);
string_sizes
->
init_req
(
argi
,
NULL
);
break
;
...
...
test/compiler/stringopts/TestOptimizeStringConcat.java
0 → 100644
浏览文件 @
70c5ce63
/*
* Copyright 2015 SAP AG. 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 8068909
* @key regression
* @summary test that string optimizations produce code, that doesn't lead to a crash.
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestOptimizeStringConcat
* @author axel.siebenborn@sap.com
*/
public
class
TestOptimizeStringConcat
{
static
boolean
checkArgumentSyntax
(
String
value
,
String
allowedchars
,
String
notallowedchars
,
String
logmsg
)
{
String
rc
=
null
;
int
maxchar
=
99999
;
int
minchar
=
1
;
if
((
allowedchars
!=
null
&&
notallowedchars
!=
null
)
||
minchar
>
maxchar
)
{
rc
=
"internal error"
;
}
else
{
if
(
value
==
null
)
{
rc
=
"the value null is not allowed, it is missing"
;
}
else
if
(
value
!=
null
&&
minchar
>
0
&&
value
.
trim
().
equals
(
""
))
{
rc
=
"the value must not be empty"
;
}
else
if
(
value
!=
null
)
{
if
(
value
.
length
()
<
minchar
||
value
.
length
()
>
maxchar
)
{
if
(
rc
==
null
)
{
rc
=
"the value length must be between +minchar+ and +maxchar"
;
}
}
char
[]
_value
=
value
.
toCharArray
();
boolean
dotfound
=
false
;
int
i
=
1
;
if
(
_value
[
i
]
==
'.'
&&
!
dotfound
)
{
dotfound
=
true
;
}
else
if
(
allowedchars
!=
null
&&
allowedchars
.
indexOf
(
_value
[
i
])
==
-
1
)
{
if
(
rc
==
null
)
{
rc
=
"the value contains an illegal character: '"
+
_value
[
i
]
+
"', only following characters are allowed: '+allowedchars+'"
;
}
else
{
rc
+=
" / the value contains an illegal character: '"
+
_value
[
i
]
+
"', only following characters are allowed: '+allowedchars+'"
;
}
}
else
if
(
notallowedchars
!=
null
&&
notallowedchars
.
indexOf
(
_value
[
i
])
!=
-
1
)
{
if
(
rc
==
null
)
{
rc
=
"the value contains an illegal character: '"
+
_value
[
i
]
+
"', following characters are not allowed '+notallowedchars+'"
;
}
else
{
rc
+=
" / the value contains an illegal character: '"
+
_value
[
i
]
+
"', following characters are not allowed '+notallowedchars+'"
;
}
}
}
}
if
(
rc
!=
null
)
{
System
.
out
.
println
(
logmsg
+
" ==> "
+
rc
);
return
false
;
}
return
true
;
}
public
static
void
main
(
String
[]
args
)
{
boolean
failed
=
false
;
for
(
int
i
=
0
;
i
<
10000
;
i
++)
{
failed
|=
!
checkArgumentSyntax
(
"theName"
,
null
,
"\"<&"
,
"Error consistencyCheck: name in component definition"
);
failed
|=
!
checkArgumentSyntax
(
null
,
null
,
"\"<&"
,
"Error consistencyCheck: name in component definition"
);
failed
|=
!
checkArgumentSyntax
(
"42"
,
"0123456789."
,
null
,
"Error consistencyCheck: counter in component definition"
);
}
System
.
out
.
println
(
failed
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录