mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-16 16:39:48 +00:00
8384143: ZGC: Add minor performance improvment to oop iteration during flip promotion
Reviewed-by: ayang, sjohanss
This commit is contained in:
parent
a81d029399
commit
f60cf5832e
@ -31,11 +31,14 @@ class ZIterator : AllStatic {
|
||||
private:
|
||||
static bool is_invisible_object(oop obj);
|
||||
static bool is_invisible_object_array(oop obj);
|
||||
static bool is_invisible_object_array(oop obj, Klass* klass);
|
||||
|
||||
public:
|
||||
// This iterator skips invisible roots
|
||||
template <typename OopClosureT>
|
||||
static void oop_iterate_safe(oop obj, OopClosureT* cl);
|
||||
template <typename OopClosureT>
|
||||
static void oop_iterate_safe(oop obj, Klass* klass, OopClosureT* cl);
|
||||
|
||||
template <typename OopClosureT>
|
||||
static void oop_iterate(oop obj, OopClosureT* cl);
|
||||
@ -46,6 +49,8 @@ public:
|
||||
// This function skips invisible roots
|
||||
template <typename Function>
|
||||
static void basic_oop_iterate_safe(oop obj, Function function);
|
||||
template <typename Function>
|
||||
static void basic_oop_iterate_safe(oop obj, Klass* klass, Function function);
|
||||
|
||||
template <typename Function>
|
||||
static void basic_oop_iterate(oop obj, Function function);
|
||||
|
||||
@ -45,17 +45,27 @@ inline bool ZIterator::is_invisible_object(oop obj) {
|
||||
}
|
||||
|
||||
inline bool ZIterator::is_invisible_object_array(oop obj) {
|
||||
return obj->klass()->is_objArray_klass() && is_invisible_object(obj);
|
||||
return is_invisible_object_array(obj, obj->klass());
|
||||
}
|
||||
|
||||
// This iterator skips invisible object arrays
|
||||
inline bool ZIterator::is_invisible_object_array(oop obj, Klass* klass) {
|
||||
return klass->is_objArray_klass() && is_invisible_object(obj);
|
||||
}
|
||||
|
||||
// These iterators skips invisible object arrays
|
||||
|
||||
template <typename OopClosureT>
|
||||
void ZIterator::oop_iterate_safe(oop obj, OopClosureT* cl) {
|
||||
oop_iterate_safe(obj, obj->klass(), cl);
|
||||
}
|
||||
|
||||
template <typename OopClosureT>
|
||||
void ZIterator::oop_iterate_safe(oop obj, Klass* klass, OopClosureT* cl) {
|
||||
// Skip invisible object arrays - we only filter out *object* arrays,
|
||||
// because that check is arguably faster than the is_invisible_object
|
||||
// check, and primitive arrays are cheap to call oop_iterate on.
|
||||
if (!is_invisible_object_array(obj)) {
|
||||
obj->oop_iterate(cl);
|
||||
if (!is_invisible_object_array(obj, klass)) {
|
||||
OopIteratorClosureDispatch::oop_oop_iterate(cl, obj, klass);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,11 +99,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// This function skips invisible roots
|
||||
// These functions skip invisible roots
|
||||
|
||||
template <typename Function>
|
||||
void ZIterator::basic_oop_iterate_safe(oop obj, Function function) {
|
||||
basic_oop_iterate_safe(obj, obj->klass(), function);
|
||||
}
|
||||
|
||||
template <typename Function>
|
||||
void ZIterator::basic_oop_iterate_safe(oop obj, Klass* klass, Function function) {
|
||||
ZBasicOopIterateClosure<Function> cl(function);
|
||||
oop_iterate_safe(obj, &cl);
|
||||
oop_iterate_safe(obj, klass, &cl);
|
||||
}
|
||||
|
||||
template <typename Function>
|
||||
|
||||
@ -1272,7 +1272,7 @@ public:
|
||||
for (ZPage* page; _iter.next(&page);) {
|
||||
page->object_iterate([&](oop obj) {
|
||||
// Remap oops and add remset if needed
|
||||
ZIterator::basic_oop_iterate_safe(obj, remap_and_maybe_add_remset);
|
||||
ZIterator::basic_oop_iterate_safe(obj, obj->klass(), remap_and_maybe_add_remset);
|
||||
|
||||
// String dedup
|
||||
string_dedup_context.request(obj);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user