Skip to content

Commit 3641c32

Browse files
committed
8365994: ZGC: Incorrect type signature in ZMappedCache comparator
Reviewed-by: cnorrbin, aboldtch
1 parent 2ae3ea2 commit 3641c32

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/hotspot/share/gc/z/zMappedCache.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,11 @@ static ZMappedCacheEntry* create_entry(const ZVirtualMemory& vmem) {
118118
return entry;
119119
}
120120

121-
int ZMappedCache::EntryCompare::cmp(const IntrusiveRBNode* a, const IntrusiveRBNode* b) {
121+
bool ZMappedCache::EntryCompare::cmp(const IntrusiveRBNode* a, const IntrusiveRBNode* b) {
122122
const ZVirtualMemory vmem_a = ZMappedCacheEntry::cast_to_entry(a)->vmem();
123123
const ZVirtualMemory vmem_b = ZMappedCacheEntry::cast_to_entry(b)->vmem();
124124

125-
if (vmem_a.end() < vmem_b.start()) { return -1; }
126-
if (vmem_b.end() < vmem_a.start()) { return 1; }
127-
128-
return 0; // Overlapping
125+
return vmem_a.end() < vmem_b.start();
129126
}
130127

131128
int ZMappedCache::EntryCompare::cmp(zoffset key, const IntrusiveRBNode* node) {
@@ -171,12 +168,12 @@ void ZMappedCache::Tree::insert(TreeNode* node, const TreeCursor& cursor) {
171168
// Insert in tree
172169
TreeImpl::insert_at_cursor(node, cursor);
173170

174-
if (_left_most == nullptr || EntryCompare::cmp(node, _left_most) < 0) {
171+
if (_left_most == nullptr || EntryCompare::cmp(node, _left_most)) {
175172
// Keep track of left most node
176173
_left_most = node;
177174
}
178175

179-
if (_right_most == nullptr || EntryCompare::cmp(_right_most, node) < 0) {
176+
if (_right_most == nullptr || EntryCompare::cmp(_right_most, node)) {
180177
// Keep track of right most node
181178
_right_most = node;
182179
}

src/hotspot/share/gc/z/zMappedCache.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class ZMappedCache {
4141
private:
4242
struct EntryCompare {
4343
static int cmp(zoffset a, const IntrusiveRBNode* b);
44-
static int cmp(const IntrusiveRBNode* a, const IntrusiveRBNode* b);
44+
static bool cmp(const IntrusiveRBNode* a, const IntrusiveRBNode* b);
4545
};
4646

4747
struct ZSizeClassListNode {

0 commit comments

Comments
 (0)