RFR JDK-8207197: [lworld] VarHandle array support for value types

mandy chung mandy.chung at oracle.com
Tue Jul 17 17:33:27 UTC 2018

On 7/17/18 4:18 AM, David Simms wrote:
> Looks good, some minor suggestions (don't need follow up RFR)...
> unsafe.cpp:315 :324 :360 :369
>      Suggest moving the "index" calculation into a new method in 
> valueArrayKlass.hpp so any size related calculations are encapsulated in 
> the same place. ("jint ValueArrayKlass::index_at_offset(jlong)" ?)

The index calculation here is for assert and logging which is
temporary to aid troubleshooting.  I don't see the need for
ValueArrayKlass::index_at_offset and I would leave it as is.
If we add it, it should probably detect invalid offset where
possible and return -1.

I move the assert and logging code in its function.

> unsafe.cpp:319 :364
>      Add a final condition "else { ShouldNotReachHere(); }" in the 
> ASSERT block, just in case

Good suggestion.  I added that.

> ArrayElementVarHandleTest.java
>      Run this tests with array flattening explicitly disabled via 
> "-XX:-ValueArrayFlatten", and explicitly enabled 
> "-XX:+ValueArrayFlatten" (i.e. 2 jteg @run lines)

Thanks for the flag.  I added Unsafe::isFlattenedArray to detect
if an array is flattened. We will revisit the Unsafe API after LW1.



More information about the valhalla-dev mailing list