RFR: JDK-8273914: Indy string concat changes order of operations [v3]

Liam Miller-Cushon cushon at openjdk.java.net
Tue Oct 12 16:26:25 UTC 2021


On Fri, 8 Oct 2021 18:22:42 GMT, Liam Miller-Cushon <cushon at openjdk.org> wrote:

>> This change makes string concatenation call `toString` on the arguments eagerly, to preserve the correct evaluation order of the arguments and the calls to `toString`.
>
> Liam Miller-Cushon has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Document the rationale for the jasm changes

> > ```
> >         StringBuilder builder2 = new StringBuilder("foo");
> >         Object oo = builder2;
> >         oo += "" + builder2.append("bar"); 
> > ```
> >   
> > Should that be covered as well? From looking at the patch (not really trying it), it does not seem to be covered?
> 
> Tried it, still not correct:
> 
> I believe `if (shouldConvertToStringEagerly(argType))` branch should be handled for first argument as well, i.e. code should be shaped as:
> 
> @cushon, could you do this change and add a relevant test case?

Fixed, thanks!

-------------

PR: https://git.openjdk.java.net/jdk/pull/5844


More information about the hotspot-runtime-dev mailing list