[OpenJDK 2D-Dev] RFR 8144445: Maximum size checking in Marlin ArrayCache utility methods is not optimal
Laurent Bourgès
bourges.laurent at gmail.com
Thu Dec 3 21:23:53 UTC 2015
https://bugs.openjdk.java.net/browse/JDK-8144445
Please review that webrev that improves overflow checks in ArrayCache:
http://cr.openjdk.java.net/~lbourges/marlin/marlin-8144445.0/
Changes
- check 2Gb overflow in both getNewSize() and getNewLargeSize()
- check negative size / needSize (potential integer math overflow)
- fixed Stroker to use substraction and avoid integer overflow
- added ArrayCacheSizeTest class which now passes in jtreg
Jim's previous comments:
The change looks fine.
Are the long modifiers (12L, 1L, etc) really needed on the shift parameters
given that the first operand (needSize) is already a long?
202 size = ((needSize >> 12L) + 1L) << 12L;
I prefer keeping the long modifiers to be more explicit.
Regards,
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20151203/18d81280/attachment.html>
More information about the 2d-dev
mailing list