diff --git a/src/hotspot/share/gc/z/zMappedCache.cpp b/src/hotspot/share/gc/z/zMappedCache.cpp index 173adfbc010a6..ad02d265e93ec 100644 --- a/src/hotspot/share/gc/z/zMappedCache.cpp +++ b/src/hotspot/share/gc/z/zMappedCache.cpp @@ -118,14 +118,11 @@ static ZMappedCacheEntry* create_entry(const ZVirtualMemory& vmem) { return entry; } -int ZMappedCache::EntryCompare::cmp(const IntrusiveRBNode* a, const IntrusiveRBNode* b) { +bool ZMappedCache::EntryCompare::cmp(const IntrusiveRBNode* a, const IntrusiveRBNode* b) { const ZVirtualMemory vmem_a = ZMappedCacheEntry::cast_to_entry(a)->vmem(); const ZVirtualMemory vmem_b = ZMappedCacheEntry::cast_to_entry(b)->vmem(); - if (vmem_a.end() < vmem_b.start()) { return -1; } - if (vmem_b.end() < vmem_a.start()) { return 1; } - - return 0; // Overlapping + return vmem_a.end() < vmem_b.start(); } int ZMappedCache::EntryCompare::cmp(zoffset key, const IntrusiveRBNode* node) { @@ -171,12 +168,12 @@ void ZMappedCache::Tree::insert(TreeNode* node, const TreeCursor& cursor) { // Insert in tree TreeImpl::insert_at_cursor(node, cursor); - if (_left_most == nullptr || EntryCompare::cmp(node, _left_most) < 0) { + if (_left_most == nullptr || EntryCompare::cmp(node, _left_most)) { // Keep track of left most node _left_most = node; } - if (_right_most == nullptr || EntryCompare::cmp(_right_most, node) < 0) { + if (_right_most == nullptr || EntryCompare::cmp(_right_most, node)) { // Keep track of right most node _right_most = node; } diff --git a/src/hotspot/share/gc/z/zMappedCache.hpp b/src/hotspot/share/gc/z/zMappedCache.hpp index cf1ddbc7289d5..28f37de0de1c2 100644 --- a/src/hotspot/share/gc/z/zMappedCache.hpp +++ b/src/hotspot/share/gc/z/zMappedCache.hpp @@ -41,7 +41,7 @@ class ZMappedCache { private: struct EntryCompare { static int cmp(zoffset a, const IntrusiveRBNode* b); - static int cmp(const IntrusiveRBNode* a, const IntrusiveRBNode* b); + static bool cmp(const IntrusiveRBNode* a, const IntrusiveRBNode* b); }; struct ZSizeClassListNode {