[lworld] RFR: Implement code generation support for value classes

Srikanth Adayapalam sadayapalam at openjdk.java.net
Mon Jan 17 10:44:15 UTC 2022


On Mon, 17 Jan 2022 10:37:57 GMT, Srikanth Adayapalam <sadayapalam at openjdk.org> wrote:

> Push code code generation tactics and strategies from B3 to B2 classes.

Notes for the reviewer:


This patch implements the code generation support for value classes.

    - Much of this functionality already exists in the Valhalla code base, but
      were implemented at the level of B3 (primitive) classes. What this change
      set does therefore is to push these code generation tactcs and strategies
      down to B2 (value) classes.

    - Rename defaultvalue opcode to aconst_init
    - Transate value class constructors to static factory methods of the name
      <init> with the return type of the class type.
    - Translate source level value instantiation attempts via new into calls to
      the static value factory method.
    - Translate assignments to fields with withfield rather than putfield.
    - In the class reader recognize value class factory methods and massage them
      and internalize them as normal constrctors - This is to minimize changes to
      the other phases of the compiler. A value class constrctor is treated as
      plain constrctor by javac but during class file emission, we do as mandated
      by JVMS.
      
Deferred

    - <init> to be renamed to <new>
    - Emission of Preload attribute
    - Marking stateless abstract classes as value supers.

-------------

PR: https://git.openjdk.java.net/valhalla/pull/604



More information about the valhalla-dev mailing list