[External] : Re: String concatenation order of operations
Brian Goetz
brian.goetz at oracle.com
Sun Sep 19 01:11:50 UTC 2021
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
> <mailto: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...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20210918/ce664de5/attachment-0001.htm>
More information about the compiler-dev
mailing list