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

Regression in LambdaFormBuffer.replaceFunctions

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10
    • Component/s: core-libs

      Description

      JDK-8184777 accidentally changed semantics of replaceFunctions from checking identity to equality, and in addition the use of List.indexOf methods caused a small startup regression on some sensitive benchmarks.

      diff -r 2ac93efc62ed src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java
      --- a/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java Thu Nov 16 20:25:45 2017 +0000
      +++ b/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java Fri Nov 17 00:30:29 2017 +0100
      @@ -115,9 +115,9 @@
               return true;
           }
       
      - private static int indexOf(NamedFunction fn, NamedFunction[] fns) {
      - for (int i = 0; i < fns.length; i++) {
      - if (fns[i] == fn) return i;
      + private static int indexOf(NamedFunction fn, List<NamedFunction> fns) {
      + for (int i = 0; i < fns.size(); i++) {
      + if (fns.get(i) == fn) return i;
               }
               return -1;
           }
      @@ -333,7 +333,7 @@
               if (oldFns.isEmpty()) return this;
               for (int i = arity; i < length; i++) {
                   Name n = names[i];
      - int nfi = oldFns.indexOf(n.function);
      + int nfi = indexOf(n.function, oldFns);
                   if (nfi >= 0 && Arrays.equals(n.arguments, forArguments)) {
                       changeName(i, new Name(newFns.get(nfi), n.arguments));
                   }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                redestad Claes Redestad
                Reporter:
                redestad Claes Redestad
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: