Skip to content

8365994: ZGC: Incorrect type signature in ZMappedCache comparator #26904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/hotspot/share/gc/z/zMappedCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zMappedCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down