RFR: 8183137: [MVT] C2 doesn't eliminate redundant value type allocations inside loops

Roland Westrelin rwestrel at redhat.com
Mon Jul 10 16:28:15 UTC 2017


This change adds a new ValueTypePtrNode that behaves similarly to
ValueTypeNode. A ValueTypePtrNode is added to the graph where we're
forced to allocate because C2 expects an __Value. That ValueTypePtrNode
has all the fields of the value as input (like ValueTypeNode) and its
oop input is the new allocation. Like ValueTypeNode, a
Phi(ValueTypePtrNode#1 ValueTypePtrNode#2 ...) is transformed to
ValueTypePtrNode(Phi(Oop#1, Oop#2 ..) Phi(Field#1, Field#2 ...)). Like
ValueTypeNode, a ValueTypePtrNode referenced in the debug info at a
safepoint is converted to a SafePointScalarObjectNode and field
values. A Load of a field from a ValueTypePtrNode is optimized to that
field from the ValueTypePtrNode.

The implementation of the new node shares a lot of code with the
existing ValueTypeNode so most of that change is refactoring, boiler
plate code and new tests.

There are tests such as test95/test96 for which the allocation is still
not eliminated but could be by improving this further.


More information about the valhalla-dev mailing list