First C2 prototype for value types

Tobias Hartmann tobias.hartmann at oracle.com
Fri Oct 7 14:11:44 UTC 2016


Hi,

I implemented a first very basic C2 prototype implementation of value types:
http://cr.openjdk.java.net/~thartmann/valhalla/vt_prototype/webrev.00/

The changes mostly affect the C2 frontend and do not affect any non VT (byte-)code or other VM functionality.

Here's a summary:
- Introduced ciValueKlass to represent a valueKlass in C2 and provide access to the value type field layout.
- Introduced a new Type TypeValueType and TypeValueTypePtr to represent a value type and a corresponding oop to the heap allocated value type in C2's type system.
- Introduced a ValueTypeNode to represent a value type in the C2 IR. It's a TypeNode with type TypeValueType and has the oop and the field values as input nodes.
- Support for vnew, vreturn, vgetfield, vload, vstore.
- Support for passing value types from interpreter to C2 compiled code and vice versa. This is done via oops.
- Other VT bytecodes are treated as corresponding Java object bytecodes (just for now, so we know where we need to make future changes)
- No support for VT arrays and flattening yet.
- No "real" optimizations.

I implemented a jtreg test suite to ease testing of the C2 implementation:
http://cr.openjdk.java.net/~thartmann/valhalla/vt_prototype/webrev.00/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java.html

It supports basic matching on the C2 IR. The tests under
// ========== Test definitions ==========
work and C2 generates code for them. The C2 IR is printed for each test.

Please be aware that this implementation is *very* limited and the only thing that should work are the tests in the suite. There are sill lot's of TODOs and FIXMEs but I would like to push this early version to allow other team members to build upon.

I need a sponsor for this since I'm not Valhalla author/committer.

Best regards,
Tobias


More information about the valhalla-dev mailing list