String concatenation tweaks

Aleksey Shipilev aleksey.shipilev at
Mon Jun 1 07:49:19 UTC 2015

Hi Peter,

On 06/01/2015 12:33 AM, Peter Levart wrote:
> On 05/31/2015 11:06 PM, Peter Levart wrote:
>> On 05/31/2015 10:58 PM, Peter Levart wrote:
>>> This is a noble goal. I will just warn you about the possible
>>> initialization problems. String concatenation is a very rudimentary
>>> operation and might be used very early in the startup of the JVM. If
>>> it is used before the system class loader is initialized (before the
>>> main method is executed), you will be faced with the following issue
>>> at least:
>>> we might need to fix these early java.lang.invoke
>>> initialization problems 1st.
>> Not to mention that java.lang.invoke infrastructure (at least the part
>> that is used to support invokedynamic etc.) should then *not* use
>> string concatenation...
> One way to tackle this is to have a javac option to emit classical
> StringBuilder-based code and then build the (java.base module at least)
> with this option. So only other modules and user code would use indy
> based concatenation. 

If you read my notes about this:

You will see the mention of "java.base is exempt from indy string
concat, otherwise the initialization circularity ensues". Indeed, there
is a patch that disables indy string concat for java.base:

> This will also eliminate worries about startup time.

It would not, because, as I was saying in the notes, the significant
time is spent dealing with indy infrastructure for every user string
concat. In other words, a simple smoke test with HelloWorld concating a
simple string suffers quite a bit.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the compiler-dev mailing list