RFR[12] JDK-8179098 "Crypto AES/ECB encryption/decryption performance regression (introduced in jdk9b73)"
Valerie Peng
valerie.peng at oracle.com
Wed Jul 11 23:00:22 UTC 2018
Sure, your suggestion sounds good.
I have updated the webrev accordingly at
http://cr.openjdk.java.net/~valeriep/8179098/webrev.01/
Will integrate after mach5 run is done.
Thanks!
Valerie
On 7/11/2018 11:41 AM, Claes Redestad wrote:
> FWIW, but as we're in java.base there's a way to use the
> jdk.internal.util.Preconditions API backing Objects.checkFrom* methods
> directly, which lets you control the type of exception thrown:
>
> private static final BiFunction<String, List<Integer>,
> ArrayIndexOutOfBoundsException> AIOOBE_SUPPLIER
> =
> Preconditions.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new);
>
> public static void nullAndBoundsCheck(byte[] array, int offset, int
> len) {
> Preconditions.checkFromIndexSize(offset, len, array.length,
> AIOOBE_SUPPLIER); // implicit null check of array
> }
>
> Prior art is really only the
> java.lang.invoke.VarHandle.AIOOBE_SUPPLIER (which is used from
> generated code, e.g. j.l.i.VarHandleInts); maybe it could be
> refactored to some internal package for reuse.
>
> (I'd remove the explicit null check and lower-case the N in
> NullAndBoundsCheck, regardless)
>
> Thanks!
>
> /Claes
>
>
> On 2018-07-10 02:42, Valerie Peng wrote:
>> Hi Tony,
>>
>> The purpose of the if-block is to ensure that
>> ArrayIndexOutOfBoundsException is thrown instead of
>> IndexOutOfBoundsException. Objects.checkFromIndexSize(...) API is
>> specified to throw IndexOutOfBoundsException which is more general
>> and can be thrown when an index of some sort (such as to an array, to
>> a string, or to a vector) is out of range.
>> ArrayIndexOutOfBoundsException is a subclass of
>> IndexOutOfBoundsException and is for array index out of bounds.
>>
>> Thanks,
>> Valerie
>>
>> On 7/9/2018 3:14 PM, Anthony Scarpino wrote:
>>> On 07/03/2018 02:03 PM, Valerie Peng wrote:
>>>> Hi Tony,
>>>>
>>>> Would you have time to review this? Instead of doing the bounds
>>>> check per block, the changes move the bounds check up one level.
>>>>
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8179098
>>>>
>>>> Webrev: http://cr.openjdk.java.net/~valeriep/8179098/webrev.00/
>>>>
>>>> Thanks,
>>>> Valerie
>>>
>>>
>>> ArrayUtil.java: Line 48
>>> - It seems like your not throwing any
>>> ArrayIndexOutOfBoundsExceptions, is that intentional? The method in
>>> the try-catch seems to only throw IndexOutOfBoundsException, whole
>>> if() seems confusing to me.
>>> thanks
>>>
>>> Tony
>>
>
More information about the security-dev
mailing list