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

Regression: javac generates redundant bytecode in assignop involving arrays

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 8
    • 8, 8-repo-lambda
    • tools
    • b82
    • Verified

      The following code:

      class Test {
          void test(int[] ary, int p, int inc) {
              ary[p]+= inc;
          }
      }

      Used to generate this bytecode:

      void test(int[], int, int);
        Code:
         Stack=4, Locals=4, Args_size=4
         0: aload_1
         1: iload_2
         2: dup2
         3: iaload
         4: iload_3
         5: iadd
         6: iastore
         7: return


      Now it generates this:

      void test(int[], int, int);
        Code:
         Stack=4, Locals=6, Args_size=4
         0: aload_1
         1: astore 4
         3: iload_2
         4: istore 5
         6: aload 4
         8: iload 5
         10: aload 4
         12: iload 5
         14: iaload
         15: iload_3
         16: iadd
         17: dup_x2
         18: iastore
         19: pop
         20: return


            vromero Vicente Arturo Romero Zaldivar
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: