Regression: javac generates redundant bytecode in assignop involving arrays

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 8
    • Affects Version/s: 8, 8-repo-lambda
    • Component/s: 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


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

              Created:
              Updated:
              Resolved: