[OpenJDK 2D-Dev] RFR 8144445: Maximum size checking in Marlin ArrayCache utility methods is not optimal
Phil Race
philip.race at oracle.com
Fri Dec 4 22:47:13 UTC 2015
Looks good to me.
-phil.
On 12/03/2015 01:23 PM, Laurent Bourgès wrote:
>
> 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/
> <http://cr.openjdk.java.net/%7Elbourges/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
More information about the 2d-dev
mailing list