mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 04:24:49 +02:00
8068909: SIGSEGV in c2 compiled code with OptimizeStringConcat
Reviewed-by: kvn
This commit is contained in:
parent
2bd7efd60e
commit
0520df8a92
2 changed files with 97 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue