Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8261998: Remove unused shared entry support from utilities/hashtable
Reviewed-by: coleenp, iklam
  • Loading branch information
Kim Barrett committed Feb 20, 2021
1 parent 4755958 commit 5a25cea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/prims/jvmtiTagMapTable.cpp
Expand Up @@ -215,7 +215,7 @@ void JvmtiTagMapTable::remove_dead_entries(JvmtiEnv* env, bool post_object_free)

}
// get next entry
entry = (JvmtiTagMapEntry*)HashtableEntry<WeakHandle, mtServiceability>::make_ptr(*p);
entry = *p;
}
}

Expand Down Expand Up @@ -252,7 +252,7 @@ void JvmtiTagMapTable::rehash() {
p = entry->next_addr();
}
// get next entry
entry = (JvmtiTagMapEntry*)HashtableEntry<WeakHandle, mtServiceability>::make_ptr(*p);
entry = *p;
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/utilities/hashtable.cpp
Expand Up @@ -179,15 +179,10 @@ template <MEMFLAGS F> bool BasicHashtable<F>::resize(int new_size) {
for (int index_old = 0; index_old < table_size_old; index_old++) {
for (BasicHashtableEntry<F>* p = _buckets[index_old].get_entry(); p != NULL; ) {
BasicHashtableEntry<F>* next = p->next();
bool keep_shared = p->is_shared();
int index_new = hash_to_index(p->hash());

p->set_next(buckets_new[index_new].get_entry());
buckets_new[index_new].set_entry(p);

if (keep_shared) {
p->set_shared();
}
p = next;
}
}
Expand Down
24 changes: 3 additions & 21 deletions src/hotspot/share/utilities/hashtable.hpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -47,13 +47,7 @@ template <MEMFLAGS F> class BasicHashtableEntry : public CHeapObj<F> {
private:
unsigned int _hash; // 32-bit hash for item

// Link to next element in the linked list for this bucket. EXCEPT
// bit 0 set indicates that this entry is shared and must not be
// unlinked from the table. Bit 0 is set during the dumping of the
// archive. Since shared entries are immutable, _next fields in the
// shared entries will not change. New entries will always be
// unshared and since pointers are align, bit 0 will always remain 0
// with no extra effort.
// Link to next element in the linked list for this bucket.
BasicHashtableEntry<F>* _next;

// Windows IA64 compiler requires subclasses to be able to access these
Expand All @@ -71,12 +65,8 @@ template <MEMFLAGS F> class BasicHashtableEntry : public CHeapObj<F> {
void set_hash(unsigned int hash) { _hash = hash; }
unsigned int* hash_addr() { return &_hash; }

static BasicHashtableEntry<F>* make_ptr(BasicHashtableEntry<F>* p) {
return (BasicHashtableEntry*)((intptr_t)p & -2);
}

BasicHashtableEntry<F>* next() const {
return make_ptr(_next);
return _next;
}

void set_next(BasicHashtableEntry<F>* next) {
Expand All @@ -86,14 +76,6 @@ template <MEMFLAGS F> class BasicHashtableEntry : public CHeapObj<F> {
BasicHashtableEntry<F>** next_addr() {
return &_next;
}

bool is_shared() const {
return ((intptr_t)_next & 1) != 0;
}

void set_shared() {
_next = (BasicHashtableEntry<F>*)((intptr_t)_next | 1);
}
};


Expand Down

1 comment on commit 5a25cea

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.