You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Welcome to the Minimal Value Types early adopter's project !

What is the  Minimal Value Types (MVT) project?

  • The Minimal Value Types project is an early prototype for Value Types
    • provides initial subset of Value Type functionality
    • provides a new type which is:
      • immutable, identity-agnostic, non-nullable, non-synchronizable, final
      • does not inherit from java.lang.Object
    • Arrays of value types are flattened
    • Can contain primitives or references

Target Audience

  • Power users  - Java/JVM Language, Framework, Library authors/exports
    • who are comfortable with early experimental software
    • who recognize that everything in the experiment - the model, the classfile extensions, the byte codes is likely to change
    • who want to contribute to early exploration of Value Types
    • who will not build any products based on these prototypes
  • Who are willing to provide feedback to the developers on a subset of Value Type features
  • Who will provide use cases for the development team to experiment with optimizations

How to Try Minimal Value Types:

Repository and Build Instructions

To create a new mvt branch:

hg clone http://hg.openjdk.java.net/valhalla/valhalla valhalla

cd valhalla

sh get_source.sh

sh common/bin/hgforest.sh update -r mvt

To update repository: 

cd valhalla

sh common/bin/hgforest.sh pull

sh common/bin/hgforest.sh update -r mvt

To build repository

bash configure

make images

http://cr.openjdk.java.net/~chegar/docs/sandbox.html // instructions for working with branch repositories

Note: Valhalla is a child of the jdk10/hs repository, to keep current with latest hotspot development.

Programming Model

  • Create a POJO using an experimental javac, with an annotation ValueCapableClass (jvm.internal.value.ValueCapableClass)
    • JVM will derive a Derived Value Class (DVC) from this defined "box" which we call the Value Capable Class (VCC)
    • DVC contains an immutable copy of the instance fields from the VCC
  • Work with MethodHandles and experimental reflection package ValueType (jdk.experimental.value.ValueType)
  • Or spin your own byte codes
    • experimental MethodBuilder (jdk/experimental/value.MethodHandleBuilder)
    • future: ASM support is planned
  • Code samples
    • See directory jdk/test/valhalla/mvt in your repository
      • e.g. MethodHandlesTest

Run Experimental MVT

Filing Bugs

  • Send email to valhalla-dev@openjdk.java.net

Limitations

  • platforms: x64 Linux, x64 Mac OS X
  • no verifier (work-in-progress)
  • no VarHandles
  • no support for atomic fields containing value types
  • no JNI, unsafe, redefineclasses, reflection
  • -Xint and C2 only, no C1, no tiered-compilation
  • interpreter is not optimized, focus is on JIT optimization
  • Need additional USE CASES for optimizations
  • Working on additional test cases

References

  • No labels