RFR: 8329194: Cleanup Type::cmp definition and usage

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Thu Mar 28 15:18:40 UTC 2024


Hi all, this patch aims to cleanup `Type::cmp` by changing it from returning a `0` when types are equal and `1` when they are not, to it returning a boolean denoting equality. This makes its usages at various callsites more intuitive. However, as it is passed to the type dictionary as a comparator, a lambda is needed to map the boolean to a comparison value. 

I was also considering changing the name to `Type::equals` as it's not really returning a comparison value anymore, but I felt it would be too similar to `Type::eq`. If this would be preferred though, I can change it.

Tier 1 testing passes on my machine. Reviews and thoughts would be appreciated!

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

Commit messages:
 - Cleanup Type::cmp

Changes: https://git.openjdk.org/jdk/pull/18533/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18533&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8329194
  Stats: 34 lines in 9 files changed: 6 ins; 0 del; 28 mod
  Patch: https://git.openjdk.org/jdk/pull/18533.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18533/head:pull/18533

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


More information about the hotspot-compiler-dev mailing list