Bounds checks with unsafe array access

Paul Sandoz paul.sandoz at
Wed Sep 10 13:16:42 UTC 2014

On Sep 10, 2014, at 2:41 PM, Vitaly Davidovich <vitalyd at> wrote:
> One thing that bothers me is that even fields marked final aren't really treated as such by compiler because it's paranoid of things like reflection.  If there was some way to reassure it that final fields aren't modified behind its back, then more type info can be captured at init time (e.g. array is not null and length is captured as a constant).

In general i agree.

However, in the particular cases i am looking at, an array field is unlikely to be final since it can be updated with a larger array (e.g. the node table in HashMap or the task queue in ForkJoinPool.WorkQueue), and it's about somehow conveying/expressing the constraint that the array length is always > 0.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <>

More information about the hotspot-compiler-dev mailing list