[Exp] Experimenting with "value-based" classes and oop testing

David Simms david.simms at oracle.com
Wed Jan 17 12:26:33 UTC 2018

So to lay some ground-work for testing value oops versus reference oops, 
I've created the following patch "Value based classes" (VBC) for the 
experimental branch (exp):



  * Added "INCLUDE_VBC" feature macro to clearly identify "Value-based
    class" feature
  * klass.hpp:572 Klass may be marked as "value-based" via a new access flag
      o systemDictionary.cpp:2053 uses the flag "ValueBasedClasses" to
        mark the current JDK value-based classes, or the user may
        specify their own
  * Prototype of efficient "oopDesc::klass_is_value_based()" test has
    been implemented by encoding "odd/even" klass ptr into the
    "oop._metadata" (i.e. oop klass ptr)
      o klass.cpp:174 affectively double the klass ptr alignment (from 8
        to 16 bytes), and ensures value classes are aligned "odd" (or to
        8 bytes), and regular classes to 16 bytes
      o Wastes a little memory, but given that instanceKlass weigh
        around 460 bytes, an extra 8 bytes seemed like a small price...
      o ...testing for value classes simply involves test the effective
        least significant bit in the oop metadata field, should work for
        both compressed (lsbit) and uncompress klass ptr (is 8 byte
          + klass.inline.hpp:74 should be relatively simple to implement
            in both JIT and template assembler

One can use this as basis for building experiments with alternative 
behaviour for L-World proposal, e.g. monitor operations involving values.

Comments ?

More information about the valhalla-dev mailing list