[External] : Re: String concatenation order of operations
cushon at google.com
Sun Sep 19 01:50:28 UTC 2021
Thanks for the clarification!
I think that's what the patch is doing, then, aside from using
String.valueOf instead of Object.toString.
On Sat, Sep 18, 2021 at 6:12 PM Brian Goetz <brian.goetz at oracle.com> wrote:
> On 9/18/2021 6:34 PM, Liam Miller-Cushon wrote:
> On Wed, Sep 8, 2021 at 3:01 PM Brian Goetz <brian.goetz at oracle.com> wrote:
>> The natural way to do this is to have the various arguments passed as
>> real stack arguments, causing them to all be evaluated before being pushed
>> through the MH nest
> I'm not sure I understand this part. Aren't non-constant arguments already
> being evaluated and passed as stack arguments to the invokedynamic?
> Yes, they are being evaluated, but not toString'ed. So the compiler
> generates code to evaluate and push all the arguments, and then the
> bootstrap does the toString'ing. That means that arg #2 is evaluated
> before arg #1 is toString'ed. For non-string / primitive arguments, the
> compiler would have to emit `invokevirtual Object::toString` for each
> argument as it is pushed.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the compiler-dev