RFR: 8284742: x86: Handle integral division overflow during parsing [v7]

Quan Anh Mai duke at openjdk.java.net
Tue Apr 19 15:58:26 UTC 2022


On Tue, 19 Apr 2022 09:06:34 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   x86 fix
>
> This doesn't regress on AArch64, so I'm happy. For the record, my benchmark is this, which does BCD conversion by repeated division.
> 
> 
>     public int base;
>     public long nn = 0x124_6456_efab_8679l;
> 
>     @Benchmark
>     public long BCDConversion() {
>         nn++;
>         long tmp = nn;
>         long result = 0;
>         for (int i = 0; i < 16; i++) {
>             result = (result << 4) + tmp % base;
>             tmp /= base;
>         }
>         return result;
>     }
> 
>     @Benchmark
>     public long unsignedBCDConversion() {
>         nn++;
>         long tmp = nn;
>         long result = 0;
>         for (int i = 0; i < 16; i++) {
>             result = (result << 4) + Long.remainderUnsigned(tmp, base);
>             tmp = Long.divideUnsigned(tmp, base);
>         }
>         return result;
>     }

@theRealAph Thanks a lot for your measure.
@TheRealMDoerr The DivNodes created in places other than the parser have constant divisors, so they are transformed into other nodes immediately. As a result, during matching, there should be no `DivINode` and the likes. So, I intentionally omit those from the matcher on x86.

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

PR: https://git.openjdk.java.net/jdk/pull/8206


More information about the hotspot-compiler-dev mailing list