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

Unused parameters in MethodHandleNatives linking methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • 18
    • hotspot
    • b01
    • 11
    • b21

      The constant dynamic changes in JDK-8186209 updated MethodHandleNatives.linkCallSite to take an int parameter `indexInCP` that is passed up from the VM, but it is not actually used:

      From: http://hg.openjdk.java.net/jdk/jdk/rev/c4d9d1b08e2e

      @@ -228,6 +234,7 @@
            * The JVM is linking an invokedynamic instruction. Create a reified call site for it.
            */
           static MemberName linkCallSite(Object callerObj,
      + int indexInCP,
                                          Object bootstrapMethodObj,
                                          Object nameObj, Object typeObj,
                                          Object staticArguments,

      @@ -268,9 +275,7 @@
                                                 Object[] appendixResult) {
               Object bsmReference = bootstrapMethod.internalMemberName();
               if (bsmReference == null) bsmReference = bootstrapMethod;
      - Object staticArglist = (staticArguments instanceof Object[] ?
      - java.util.Arrays.asList((Object[]) staticArguments) :
      - staticArguments);
      + String staticArglist = staticArglistForTrace(staticArguments);
               System.out.println("linkCallSite "+caller.getName()+" "+
                                  bsmReference+" "+
                                  name+type+"/"+staticArglist);

      @@ -280,11 +285,89 @@
                   System.out.println("linkCallSite => "+res+" + "+appendixResult[0]);
                   return res;
               } catch (Throwable ex) {
      + ex.printStackTrace(); // print now in case exception is swallowed
                   System.out.println("linkCallSite => throw "+ex);
                   throw ex;
               }
           }
       
      + // this implements the upcall from the JVM, MethodHandleNatives.linkDynamicConstant:
      + static Object linkDynamicConstant(Object callerObj,
      + int indexInCP,
      + Object bootstrapMethodObj,
      + Object nameObj, Object typeObj,
      + Object staticArguments) {
      + MethodHandle bootstrapMethod = (MethodHandle)bootstrapMethodObj;
      + Class<?> caller = (Class<?>)callerObj;
      + String name = nameObj.toString().intern();
      + Class<?> type = (Class<?>)typeObj;
      + if (!TRACE_METHOD_LINKAGE)
      + return linkDynamicConstantImpl(caller, bootstrapMethod, name, type, staticArguments);
      + return linkDynamicConstantTracing(caller, bootstrapMethod, name, type, staticArguments);
      + }

      The new indexInCP parameter is not used; nor is it used in the newly added linkDynamicConstant method.

            hseigel Harold Seigel (Inactive)
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: