Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8074484

More aggressive value discarding

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • core-libs
    • b55
    • generic
    • generic

        CodeGenerator code for loading a JoinPredecessorExpression (JPE) ignores whether it is the current discard. Combined with the fact that for loop's modify expressions are now JPEs this causes a typical postincrement in them to have unnecessary DUP/POP pairs, e.g. a typical for-loop "++i" will now be

          iload 3
          iconst_1
          invokedynamic iadd(II)I
          dup
          istore 3
          pop

        The issue is bit more widespread than that, though -- there's a lot of other expressions that could also better discard their subexpressions, e.g. COMMARIGHT. Even if the JPE is fixed, a for loop having "++i, ++j" will not do a discard on ++j as COMMARIGHT doesn't do loadAndDiscard on its RHS regardless of wether it itself should be discarded. Basically, a review of discard logic would be in order.

              attila Attila Szegedi
              attila Attila Szegedi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: