Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Project Valhalla Update - JVMLS Feedback

Project Valhalla Update - JVMLS Feedback

This material was used at JVMLS feedback in Tokyo, Osaka, and Fukuoka (August 9, 23, and 30).

Akihiro Nishikawa

August 30, 2019
Tweet

More Decks by Akihiro Nishikawa

Other Decks in Technology

Transcript

  1. Project Valhalla - Reboot JVM relationship with data in memory

     Value Types  Generic Specialization
  2. Why are flatter and denser memory layouts required? e.g. Intel

    Broadwell-EP L1 L2 Main Memory Intel® 64 and IA-32 Architectures Optimization Reference Manual https://software.intel.com/sites/default/files/managed/9e/bc/64-ia-32-architectures-optimization-manual.pdf L3 Cache
  3. For example... class Point { int x; int y; }

    public class App { ... Point[] points = new Point[5]; points[0] = new Point(); ... }
  4. As is... header x y header x y header x

    y header x y header x y header
  5. To be... header x y header x y header x

    y header x y header x y header header x y x y x y x y x y
  6. Drilling from JVM side and programming model side L World

    Early prototypes (M1-M3) Compiler-only Exploring language side • Specialized generics, wildcards • Informed VM requirements • Many of these problems still require considerable work “MVT” prototype VM-only Exploring the “Q-World” model For more detail, check the JVMLS 2018 video! Current prototype VM and compiler support No support yet for specialized generics or migration Still drilling...
  7. Inline class value class Point { int x; int y;

    } inline class Point { int x; int y; }
  8. class Point { int x; int y; Point() { this.x

    = 0; this.y = 0; } Point(int x, int y) { this.x = x; this.y = y; } } Point(int, int); descriptor: (II)V flags: (0x0000) Code: stack=2, locals=3, args_size=3 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: aload_0 5: iload_1 6: putfield #7 // Field x:I 9: aload_0 10: iload_2 11: putfield #13 // Field y:I 14: return LineNumberTable: line 10: 0 line 11: 4 line 12: 9 line 13: 14
  9. inline class Point { final int x; final int y;

    Point() { this.x = 0; this.y = 0; } Point(int x, int y) { this.x = x; this.y = y; } } static Point Point(int, int); descriptor: (II)QPoint; flags: (0x0008) ACC_STATIC Code: stack=2, locals=3, args_size=2 0: defaultvalue #1 // class Point 3: astore_2 4: iload_0 5: aload_2 6: swap 7: withfield #3 // Field x:I 10: astore_2 11: iload_1 12: aload_2 13: swap 14: withfield #7 // Field y:I 17: astore_2 18: aload_2 19: areturn LineNumberTable: line 10: 0 line 11: 4 line 12: 11 line 13: 18 }
  10. Flattening V? ( http://hg.openjdk.java.net/valhalla/valhalla/file/a32457198d 3e/test/jdk/valhalla/valuetypes/NonFlattenValue.java public inline class NonFlattenValue {

    Point? nfp; NonFlattenValue() { this.nfp = Point.makePoint(0,0); } NonFlattenValue(Point p) { this.nfp = p; } public Point? point() { return nfp; } public Point pointValue() { return (Point) nfp; } ... }
  11. New top types (not yet in LW2, under discussion) By

    bringing ref-ness and val-ness into the type system x instance of RefObject RefObject m() { ... } void m(RefObject o) { … } class Foo<T extents RefObject> { ... }