On Thu, 1 Dec 2022 04:10:32 GMT, Anthony Scarpino <ascarp...@openjdk.org> wrote:

>> src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java 
>> line 778:
>> 
>>> 776:                             gctr, ghash);
>>> 777:                     } else {
>>> 778:                         int ofs = src.arrayOffset() + src.position();
>> 
>> Isn't this also used on line 774? Why not move this up and directly refer to 
>> it for both places?
>
> The line 774 case only uses the calculated value once.  I'm avoiding the 
> unnecessary store & load operations when it is set the value to a variable. I 
> see it when I run  javap -c to view the bytecode.  It's purely an 
> optimization for performance.   I do set it to the variable in the line 778 
> case because calculating the value twice is probably more expensive than once 
> with the store & load operations.

I see.

-------------

PR: https://git.openjdk.org/jdk/pull/11121

Reply via email to