-
Enhancement
-
Resolution: Fixed
-
P4
-
16
-
b15
Similar to JDK-8244733, we should add an add_if_absent to speed up code like this:
http://hg.openjdk.java.net/jdk/jdk/file/f25a5b35e983/src/hotspot/share/memory/metaspaceClosure.cpp#l86
bool UniqueMetaspaceClosure::do_ref(MetaspaceClosure::Ref* ref, bool read_only) {
bool* found = _has_been_visited.lookup(ref->obj());
if (found != NULL) {
assert(*found == read_only, "must be");
return false; // Already visited: no need to iterate embedded pointers.
} else {
_has_been_visited.add(ref->obj(), read_only);
...
(It would be more ideal to add BasicHashtable::add_if_absent, but the BasicHashtable is so convoluted which makes this difficult).
http://hg.openjdk.java.net/jdk/jdk/file/f25a5b35e983/src/hotspot/share/memory/metaspaceClosure.cpp#l86
bool UniqueMetaspaceClosure::do_ref(MetaspaceClosure::Ref* ref, bool read_only) {
bool* found = _has_been_visited.lookup(ref->obj());
if (found != NULL) {
assert(*found == read_only, "must be");
return false; // Already visited: no need to iterate embedded pointers.
} else {
_has_been_visited.add(ref->obj(), read_only);
...
(It would be more ideal to add BasicHashtable::add_if_absent, but the BasicHashtable is so convoluted which makes this difficult).
- relates to
-
JDK-8244733 Add ResourceHashtable::xxx_if_absent
- Resolved