Review request for JDK-8024130

Marcus Lagergren marcus.lagergren at oracle.com
Mon Sep 2 09:48:12 PDT 2013


+1

On Sep 2, 2013, at 5:10 PM, Attila Szegedi <attila.szegedi at oracle.com> wrote:

> Please review JDK-8024130 at http://cr.openjdk.java.net/~attila/8024130/webrev.00
> 
> I noticed that we no longer need to store indexes of self-assignments in local variables, e.g.
> 
> x[y()] += z
> 
> now compiles to:
> 
>    ALOAD 1
>    DUP
>    ALOAD 2
>    ACONST_NULL
>    INVOKEDYNAMIC dyn:call
> 
>    ASTORE 5
>    ALOAD 5
> 
>    DUP_X1
>    INVOKEDYNAMIC dyn:getElem
>    ALOAD 3
>    INVOKEDYNAMIC ADD:OOO_I
>    INVOKEDYNAMIC dyn:setElem
> 
> Note how the ASTORE 5/ALOAD 5 are completely unnecessary, since we're using DUP_X1 to store the index value for subsequent use. We would only need the local variable storage if we didn't use DUP_X1. 
> 
> Thanks,
>  Attila.



More information about the nashorn-dev mailing list