Review request for JDK-8024130

Attila Szegedi attila.szegedi at oracle.com
Mon Sep 2 08:10:23 PDT 2013


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