RFR: 8276162: Optimise unsigned comparison pattern

Mai Đặng Quân Anh duke at openjdk.java.net
Fri Oct 29 09:48:33 UTC 2021


This patch changes operations in the form `x +- Integer.MIN_VALUE <=> y +- Integer.MIN_VALUE`, which is a pattern used to do unsigned comparisons, into `x u<=> y`.

In addition to being basic operations, they may be utilised to implement range checks such as the methods in `jdk.internal.util.Preconditions`, or in places where the compiler cannot deduce the non-negativeness of the bound as in `java.util.ArrayList`.

Thank you very much.

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

Commit messages:
 - add microbenchmark
 - add long unsigned comparison
 - use min_jint instead of TypeInt::MIN->get_con()
 - remove long optimisation
 - unsigned comparison optimisation

Changes: https://git.openjdk.java.net/jdk/pull/6101/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=6101&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8276162
  Stats: 94 lines in 2 files changed: 93 ins; 1 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/6101.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/6101/head:pull/6101

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


More information about the hotspot-compiler-dev mailing list