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

Incorrect return processing for the LF editor of MethodHandles.permuteArguments

XMLWordPrintable

        The following code crashes the VM:

        import java.lang.invoke.*;
        import static java.lang.invoke.MethodType.*;
        import static java.lang.invoke.MethodHandles.*;

        class Crash {
         public static void main(String[] args) throws Throwable {
           MethodHandle crash = permuteArguments(foldArguments(
             dropArguments(identity(int[].class), 1, int.class, int.class),
             arrayElementSetter(int[].class)
           ), methodType(int[].class, int.class, int[].class, int.class), 1, 2, 0);
           int[] arr = new int[1];
           arr = (int[])crash.invokeExact(1, arr, 0);
           System.out.println(arr);
         }
        }

        Also reproducible with -Xint.

        See also email thread:

          http://mail.openjdk.java.net/pipermail/jdk9-dev/2017-July/005915.html

              psandoz Paul Sandoz
              psandoz Paul Sandoz
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: