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

[lworld] JVM should be enhanced to work with static <init> factory methods for inline types

XMLWordPrintable

    • generic
    • generic

      For JDK-8222711, I have pushed an initial implementation here:
      http://hg.openjdk.java.net/valhalla/valhalla/rev/cc473d393abf.

      Basically, instead of generating synthetic static factory methods of the name $makeValue$ as was the case with LW1, javac now under the option -XDstaticInitValueFactory emits source level constructors into class file level static factories that
          - have the name <init>
          - are static methods
          - have a return type that matches the class
          - are invoked via invokestatic at the new V() construction site.

      Given the following program:

      public value class X {

          int x = 10;
          public X(String s) {
          }

          public static void main(String [] args) {
              X x = new X("");
          }

      If I compile as:
      valhalla/valhalla/build/linux-x86_64-server-release/jdk/bin/javac -XDstaticInitValueFactory -g X.java

      and attempt to run it as:
      valhalla/valhalla/build/linux-x86_64-server-release/images/jdk/bin/java -XX:+EnableValhalla X

      I get:

      Error: LinkageError occurred while loading main class X
      java.lang.ClassFormatError: Method "<init>" in class X has illegal signature "(Ljava/lang/String;)QX;"

      All the 4 changes listed are potential irritants for the VM and need to be addressed.

            hseigel Harold Seigel (Inactive)
            sadayapalam Srikanth Adayapalam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: