src/share/vm/opto/stringopts.cpp
Print this page
rev 7657 : fix StringOpts
@@ -1505,14 +1505,16 @@
assert(kit.gvn().type(arg)->higher_equal(TypeInstPtr::NOTNULL), "sanity");
// Fallthrough to add string length.
}
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);
RegionNode *r = new RegionNode(3);
kit.gvn().set_type(r, Type::CONTROL);
@@ -1531,14 +1533,14 @@
C->record_for_igvn(r);
C->record_for_igvn(phi);
// replace the argument with the null checked version
arg = phi;
sc->set_argument(argi, arg);
+ count = kit.load_String_length(kit.control(), arg);
+ } else {
+ 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;
}
case StringConcat::CharMode: {