RFR (S) 8150465: Unsafe methods to produce uninitialized arrays

Vladimir Kozlov vladimir.kozlov at oracle.com
Thu Feb 25 00:20:24 UTC 2016


On 2/24/16 3:51 PM, Aleksey Shipilev wrote:
> On 02/25/2016 02:21 AM, Vladimir Kozlov wrote:
>> What is your story for GC? When an array become visible and GC happens,
>> it will expect only initialized arrays.
>
> New method allows primitive arrays only, and its headers should be
> intact. This is corroborated by the new jtreg test (and benchmarks!)
> that allocate lots of uninitialized arrays, and obviously they get GCed.

Yes, primitive arrays are fine if the header is correct. In this case 
changes are fine but you may need to add a check in 
inline_unsafe_newArray() that it is only primitive types.

testIAE() should throw exception if IllegalArgumentException is not thrown.

Thanks,
Vladimir

>
> Are there specific concerns about GC seeing an uninitialized primitive
> array?
>
> Thanks,
> -Aleksey
>


More information about the jdk9-dev mailing list