Flattened value type field support for C2

Zoltán Majó zoltan.majo at oracle.com
Tue Nov 15 16:36:38 UTC 2016

Hi Tobias,

On 11/11/2016 12:00 PM, Tobias Hartmann wrote:
> Hi,
> here's my implementation of (flattened) value type field support for C2:
> http://cr.openjdk.java.net/~thartmann/valhalla/vt_prototype/webrev.03/
> The patch contains the following changes:
> - Support for flattened value type fields in regular objects and value types
>    - field list in ciInstanceKlass now contains flattened value type fields (recursively)
>    - fixed instanceOopDesc::contains_field_offset() to account for different alignment of value type fields
>    - fixed alias analysis to support value type fields
>    - fixed deoptimization to correctly reassign flattened value type fields
> - Improved ValueKlass::first_field_offset() to not iterate over all fields but compute the offset
> - Improved ValueTypeNode::make_scalar_in_safepoints() and added support for value type fields
> - Added new tests, increased coverage of existing tests and fixed test bench to support product builds
> - Lots of refactoring, added more comments and more asserts
> I also tried to make it more clear/explicit in the code that ciValueKlass translates between the following field indexes:
> 1) Value type factory parameter index: The index of the value type factory parameter that corresponds to a field index 2) in the valueKlass. The value of that field can be obtained by the value input edge of the ValueTypeNode in C2 IR with the same index.
> 2) Field index in the valueKlass.

your change looks good to me -- thank you for the clarifications off-line!

I've spotted a small issue with ValueTypeTestBench.java at line 547:

547 "-XX:CompileCommand=inline,java.lang.Object::<init>",

You might have left that in by accident.

Thank you!

Best regards,


> I'll write up a more detailed documentation in the next days.
> Please have a look at the code and let me know if you spot any problems.
> Thanks,
> Tobias

More information about the valhalla-dev mailing list