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

Damon Fenacci dfenacci at openjdk.org
Fri Apr 12 07:07:42 UTC 2024


On Thu, 11 Apr 2024 13:29:05 GMT, Jasmine Karthikeyan <jkarthikeyan at openjdk.org> wrote:

>> src/hotspot/share/opto/type.cpp line 441:
>> 
>>> 439:   // Map the boolean result of Type::cmp into a comparator result that CmpKey expects.
>>> 440:   auto type_cmp = [](const void* t1, const void* t2) -> int32_t {
>>> 441:     return Type::cmp((Type*) t1, (Type*) t2) ? 0 : 1;
>> 
>> Wouldn't `return !Type::cmp((Type*) t1, (Type*) t2);` be enough? (though it might actually result in the same compiled code)
>
> I think this would work too, but I wanted to avoid the implicit boolean to integer conversion. I can make this change if it would be fine, though.

Fair point.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18533#discussion_r1562109544


More information about the hotspot-compiler-dev mailing list