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

Support pattern switching classes in AOT cache

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • hotspot

      Example:

      public class Test {
          public static void main(String ... args) {
              System.out.println(test((Integer)1234));
          }

          static int test(Number n) {
              return switch (n) {
                  case Integer in -> {
                      yield 1;
                  }
                  default -> {
                      yield 0;
                  }
              };
          }
      }

      This will be the starting point.

      https://github.com/openjdk/jdk/blob/8b16897b74cfdc3c2693e3ae7e05f3d8c6468ebe/src/hotspot/share/cds/aotConstantPoolResolver.cpp#L465-L489

      The bootstrap method to check is java/lang/runtime/SwitchBootstraps::typeSwitch

            Unassigned Unassigned
            iklam Ioi Lam
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: