Bounds checks with unsafe array access
Paul Sandoz
paul.sandoz at oracle.com
Wed Sep 10 13:16:42 UTC 2014
On Sep 10, 2014, at 2:41 PM, Vitaly Davidovich <vitalyd at gmail.com> 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.
Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140910/d3853935/attachment.html>
-------------- 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: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140910/d3853935/signature.asc>
More information about the hotspot-compiler-dev
mailing list