Unsafe API and explicit VT allocation

Roland Westrelin rwestrel at redhat.com
Fri Jul 20 09:53:02 UTC 2018


Hi John,

In the current code, Unsafe.getX on a value type argument either
retrieves the corresponding field from the ValueTypeNode or if that
can't work triggers an allocation:

http://hg.openjdk.java.net/valhalla/valhalla/file/d6e90a7411bb/src/hotspot/share/opto/library_call.cpp#l2356

(that code should also check that the access size matches the field
size)

Unsafe.putX has not special logic for ValueTypeNode so using it would
crash C2 but it could be modified with similar logic. We would create a
new ValueTypeNode with an updated field.

In your example the allocation is only useless, if we can tell what
field of the value type is updated, right?

So what is the benefit of having the allocation be explicit with a new
unsafe rather than implicit like we have today?

(I'm on PTO for 2 weeks starting tomorrow)

Roland.




More information about the valhalla-dev mailing list