[OpenJDK 2D-Dev] RFR 8144445: Maximum size checking in Marlin ArrayCache utility methods is not optimal

Jim Graham james.graham at oracle.com
Fri Dec 4 23:13:30 UTC 2015


ArrayCache.java line 214 - was that supposed to be size or needSize on 
that line?

Stroker.java line 1276 - "numCurves >= curveTypes.length" would also 
work...?

In the test cases that expect an exception, if no exception is thrown 
then you pass the test.  Is that right?

			...jim

On 12/3/15 1: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/
>
> 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