mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8222484: Specialize generation of simple String concatenation expressions
Reviewed-by: jrose, jlaskey
This commit is contained in:
parent
7d9e7e1e0b
commit
781fb29580
5 changed files with 177 additions and 96 deletions
|
@ -1965,20 +1965,7 @@ public final class String
|
|||
if (str.isEmpty()) {
|
||||
return this;
|
||||
}
|
||||
if (coder() == str.coder()) {
|
||||
byte[] val = this.value;
|
||||
byte[] oval = str.value;
|
||||
int len = val.length + oval.length;
|
||||
byte[] buf = Arrays.copyOf(val, len);
|
||||
System.arraycopy(oval, 0, buf, val.length, oval.length);
|
||||
return new String(buf, coder);
|
||||
}
|
||||
int len = length();
|
||||
int olen = str.length();
|
||||
byte[] buf = StringUTF16.newBytesFor(len + olen);
|
||||
getBytes(buf, 0, UTF16);
|
||||
str.getBytes(buf, len, UTF16);
|
||||
return new String(buf, UTF16);
|
||||
return StringConcatHelper.simpleConcat(this, str);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue