Hi Alan,

Thanks for the comment. I added these checks for caution but on further 
analysis it appears that these checks are not needed.

1)  For PrimitiveRightShift, we have the input array and its length passed as 
arguments. Since the input array, result[], is copied using arraycopy, we know 
that IOOBE will be thrown.  Therefore, it is safe to remove the checkIndex 
condition. 
         int result[] = new int[nInts+len+1]; 
         System.arraycopy(a, 0, result, 0, len);
         primitiveRightShift(result, result.length, 32 - nBits);

2) In case of PrimitiveLeftShift, I checked the call stack and verified that 
the length passed to the method is same as the length of the array. Therefore, 
the check is not necessary in this scenario.

3) In case of shiftLeft and shiftRight,  the number of iterations (numIter) is 
computed from the mag.length. The newMag array length is also computed and 
adjusted based on mag.length. 

If these changes look fine, I can send an updated webrev removing these checks. 
Please let me know.  

Thanks and Regards,
Smita Kamath

-----Original Message-----
From: Alan Bateman <alan.bate...@oracle.com> 
Sent: Saturday, December 28, 2019 12:22 AM
To: Vladimir Kozlov <vladimir.koz...@oracle.com>; Kamath, Smita 
<smita.kam...@intel.com>
Cc: core-libs-dev@openjdk.java.net; 'hotspot compiler' 
<hotspot-compiler-...@openjdk.java.net>
Subject: Re: RFR(M):8167065: Add intrinsic support for double precision 
shifting on x86_64

On 20/12/2019 22:19, Vladimir Kozlov wrote:
> We should have added core-libs to review since you modified 
> BigInteger.java.
>
This adds Objects.checkFromToIndex checks in the middle of several supporting 
methods. Is IOOBE really possible in these cases or are these stand in for 
always-on asserts to ensure the instrinic is never used when the preconditions 
aren't satisfied?

-Alan

Reply via email to