src/share/vm/opto/stringopts.cpp
Print this page
@@ -1574,14 +1574,20 @@
Deoptimization::Action_make_not_entrant);
}
Node* result;
if (!kit.stopped()) {
-
+ Node* char_array = NULL;
+ if (sc->num_arguments() == 1 &&
+ (sc->mode(0) == StringConcat::StringMode ||
+ sc->mode(0) == StringConcat::StringNullCheckMode)) {
+ // Handle the case when there is only a single String argument.
+ // In this case, we can just pull the value from the String itself.
+ char_array = kit.load_String_value(kit.control(), sc->argument(0));
+ } else {
// length now contains the number of characters needed for the
// char[] so create a new AllocateArray for the char[]
- Node* char_array = NULL;
{
PreserveReexecuteState preexecs(&kit);
// The original jvms is for an allocation of either a String or
// StringBuffer so no stack adjustment is necessary for proper
// reexecution. If we deoptimize in the slow path the bytecode
@@ -1621,10 +1627,11 @@
}
default:
ShouldNotReachHere();
}
}
+ }
// If we're not reusing an existing String allocation then allocate one here.
result = sc->string_alloc();
if (result == NULL) {
PreserveReexecuteState preexecs(&kit);