mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8375040: Clearer names for non-metadata oop iterators in ObjArrayKlass
Reviewed-by: tschatzl, kbarrett, aboldtch
This commit is contained in:
parent
f6d26c6b32
commit
bf0da3dd5c
@ -108,7 +108,7 @@ void G1FullGCMarker::follow_array_chunk(objArrayOop array, int index) {
|
||||
push_objarray(array, end_index);
|
||||
}
|
||||
|
||||
array->oop_iterate_range(mark_closure(), beg_index, end_index);
|
||||
array->oop_iterate_elements_range(mark_closure(), beg_index, end_index);
|
||||
}
|
||||
|
||||
inline void G1FullGCMarker::follow_object(oop obj) {
|
||||
|
||||
@ -238,9 +238,9 @@ void G1ParScanThreadState::do_partial_array(PartialArrayState* state, bool stole
|
||||
G1HeapRegionAttr dest_attr = _g1h->region_attr(to_array);
|
||||
G1SkipCardMarkSetter x(&_scanner, dest_attr.is_new_survivor());
|
||||
// Process claimed task.
|
||||
to_array->oop_iterate_range(&_scanner,
|
||||
checked_cast<int>(claim._start),
|
||||
checked_cast<int>(claim._end));
|
||||
to_array->oop_iterate_elements_range(&_scanner,
|
||||
checked_cast<int>(claim._start),
|
||||
checked_cast<int>(claim._end));
|
||||
}
|
||||
|
||||
MAYBE_INLINE_EVACUATION
|
||||
@ -260,7 +260,7 @@ void G1ParScanThreadState::start_partial_objarray(oop from_obj,
|
||||
// Process the initial chunk. No need to process the type in the
|
||||
// klass, as it will already be handled by processing the built-in
|
||||
// module.
|
||||
to_array->oop_iterate_range(&_scanner, 0, checked_cast<int>(initial_chunk_size));
|
||||
to_array->oop_iterate_elements_range(&_scanner, 0, checked_cast<int>(initial_chunk_size));
|
||||
}
|
||||
|
||||
MAYBE_INLINE_EVACUATION
|
||||
|
||||
@ -412,7 +412,7 @@ void SerialFullGC::follow_array_chunk(objArrayOop array, int index) {
|
||||
const int stride = MIN2(len - beg_index, (int) ObjArrayMarkingStride);
|
||||
const int end_index = beg_index + stride;
|
||||
|
||||
array->oop_iterate_range(&mark_and_push_closure, beg_index, end_index);
|
||||
array->oop_iterate_elements_range(&mark_and_push_closure, beg_index, end_index);
|
||||
|
||||
if (end_index < len) {
|
||||
SerialFullGC::push_objarray(array, end_index); // Push the continuation.
|
||||
|
||||
@ -167,7 +167,7 @@ inline void ShenandoahMark::do_chunked_array_start(ShenandoahObjToScanQueue* q,
|
||||
|
||||
if (len <= (int) ObjArrayMarkingStride*2) {
|
||||
// A few slices only, process directly
|
||||
array->oop_iterate_range(cl, 0, len);
|
||||
array->oop_iterate_elements_range(cl, 0, len);
|
||||
} else {
|
||||
int bits = log2i_graceful(len);
|
||||
// Compensate for non-power-of-two arrays, cover the array in excess:
|
||||
@ -216,7 +216,7 @@ inline void ShenandoahMark::do_chunked_array_start(ShenandoahObjToScanQueue* q,
|
||||
// Process the irregular tail, if present
|
||||
int from = last_idx;
|
||||
if (from < len) {
|
||||
array->oop_iterate_range(cl, from, len);
|
||||
array->oop_iterate_elements_range(cl, from, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ inline void ShenandoahMark::do_chunked_array(ShenandoahObjToScanQueue* q, T* cl,
|
||||
assert (0 < to && to <= len, "to is sane: %d/%d", to, len);
|
||||
#endif
|
||||
|
||||
array->oop_iterate_range(cl, from, to);
|
||||
array->oop_iterate_elements_range(cl, from, to);
|
||||
}
|
||||
|
||||
template <ShenandoahGenerationType GENERATION>
|
||||
|
||||
@ -456,7 +456,7 @@ void ZHeapIterator::follow_array_chunk(const ZHeapIteratorContext& context, cons
|
||||
|
||||
// Follow array chunk
|
||||
ZHeapIteratorOopClosure<false /* VisitReferents */> cl(this, context, obj);
|
||||
ZIterator::oop_iterate_range(obj, &cl, start, end);
|
||||
ZIterator::oop_iterate_elements_range(obj, &cl, start, end);
|
||||
}
|
||||
|
||||
template <bool VisitWeaks>
|
||||
|
||||
@ -41,7 +41,7 @@ public:
|
||||
static void oop_iterate(oop obj, OopClosureT* cl);
|
||||
|
||||
template <typename OopClosureT>
|
||||
static void oop_iterate_range(objArrayOop obj, OopClosureT* cl, int start, int end);
|
||||
static void oop_iterate_elements_range(objArrayOop obj, OopClosureT* cl, int start, int end);
|
||||
|
||||
// This function skips invisible roots
|
||||
template <typename Function>
|
||||
|
||||
@ -66,9 +66,9 @@ void ZIterator::oop_iterate(oop obj, OopClosureT* cl) {
|
||||
}
|
||||
|
||||
template <typename OopClosureT>
|
||||
void ZIterator::oop_iterate_range(objArrayOop obj, OopClosureT* cl, int start, int end) {
|
||||
void ZIterator::oop_iterate_elements_range(objArrayOop obj, OopClosureT* cl, int start, int end) {
|
||||
assert(!is_invisible_object_array(obj), "not safe");
|
||||
obj->oop_iterate_range(cl, start, end);
|
||||
obj->oop_iterate_elements_range(cl, start, end);
|
||||
}
|
||||
|
||||
template <typename Function>
|
||||
|
||||
@ -135,17 +135,16 @@ class ObjArrayKlass : public ArrayKlass {
|
||||
template <typename T, typename OopClosureType>
|
||||
inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
|
||||
|
||||
// Iterate over oop elements within [start, end), and metadata.
|
||||
template <typename T, class OopClosureType>
|
||||
inline void oop_oop_iterate_range(objArrayOop a, OopClosureType* closure, int start, int end);
|
||||
|
||||
public:
|
||||
// Iterate over all oop elements.
|
||||
// Iterate over all oop elements, and no metadata.
|
||||
template <typename T, class OopClosureType>
|
||||
inline void oop_oop_iterate_elements(objArrayOop a, OopClosureType* closure);
|
||||
|
||||
// Iterate over oop elements within index range [start, end), and no metadata.
|
||||
template <typename T, class OopClosureType>
|
||||
inline void oop_oop_iterate_elements_range(objArrayOop a, OopClosureType* closure, int start, int end);
|
||||
|
||||
private:
|
||||
// Iterate over all oop elements with indices within mr.
|
||||
// Iterate over all oop elements bounded by addresses [low, high), and no metadata.
|
||||
template <typename T, class OopClosureType>
|
||||
inline void oop_oop_iterate_elements_bounded(objArrayOop a, OopClosureType* closure, void* low, void* high);
|
||||
|
||||
|
||||
@ -38,10 +38,18 @@
|
||||
|
||||
template <typename T, class OopClosureType>
|
||||
void ObjArrayKlass::oop_oop_iterate_elements(objArrayOop a, OopClosureType* closure) {
|
||||
T* p = (T*)a->base();
|
||||
T* const end = p + a->length();
|
||||
oop_oop_iterate_elements_range<T>(a, closure, 0, a->length());
|
||||
}
|
||||
|
||||
for (;p < end; p++) {
|
||||
// Like oop_oop_iterate but only iterates over a specified range and only used
|
||||
// for objArrayOops.
|
||||
template <typename T, class OopClosureType>
|
||||
void ObjArrayKlass::oop_oop_iterate_elements_range(objArrayOop a, OopClosureType* closure, int start, int end) {
|
||||
T* base = (T*)a->base();
|
||||
T* p = base + start;
|
||||
T* const end_p = base + end;
|
||||
|
||||
for (;p < end_p; ++p) {
|
||||
Devirtualizer::do_oop(closure, p);
|
||||
}
|
||||
}
|
||||
@ -98,24 +106,4 @@ void ObjArrayKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, Me
|
||||
oop_oop_iterate_elements_bounded<T>(a, closure, mr.start(), mr.end());
|
||||
}
|
||||
|
||||
// Like oop_oop_iterate but only iterates over a specified range and only used
|
||||
// for objArrayOops.
|
||||
template <typename T, class OopClosureType>
|
||||
void ObjArrayKlass::oop_oop_iterate_range(objArrayOop a, OopClosureType* closure, int start, int end) {
|
||||
T* low = (T*)a->base() + start;
|
||||
T* high = (T*)a->base() + end;
|
||||
|
||||
oop_oop_iterate_elements_bounded<T>(a, closure, low, high);
|
||||
}
|
||||
|
||||
// Placed here to resolve include cycle between objArrayKlass.inline.hpp and objArrayOop.inline.hpp
|
||||
template <typename OopClosureType>
|
||||
void objArrayOopDesc::oop_iterate_range(OopClosureType* blk, int start, int end) {
|
||||
if (UseCompressedOops) {
|
||||
((ObjArrayKlass*)klass())->oop_oop_iterate_range<narrowOop>(this, blk, start, end);
|
||||
} else {
|
||||
((ObjArrayKlass*)klass())->oop_oop_iterate_range<oop>(this, blk, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SHARE_OOPS_OBJARRAYKLASS_INLINE_HPP
|
||||
|
||||
@ -83,9 +83,9 @@ class objArrayOopDesc : public arrayOopDesc {
|
||||
Klass* element_klass();
|
||||
|
||||
public:
|
||||
// special iterators for index ranges, returns size of object
|
||||
// Special iterators for an element index range.
|
||||
template <typename OopClosureType>
|
||||
void oop_iterate_range(OopClosureType* blk, int start, int end);
|
||||
void oop_iterate_elements_range(OopClosureType* blk, int start, int end);
|
||||
};
|
||||
|
||||
// See similar requirement for oopDesc.
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
#include "oops/access.hpp"
|
||||
#include "oops/arrayOop.hpp"
|
||||
#include "oops/objArrayKlass.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
|
||||
@ -51,4 +52,13 @@ inline void objArrayOopDesc::obj_at_put(int index, oop value) {
|
||||
HeapAccess<IS_ARRAY>::oop_store_at(as_oop(), offset, value);
|
||||
}
|
||||
|
||||
template <typename OopClosureType>
|
||||
void objArrayOopDesc::oop_iterate_elements_range(OopClosureType* blk, int start, int end) {
|
||||
if (UseCompressedOops) {
|
||||
((ObjArrayKlass*)klass())->oop_oop_iterate_elements_range<narrowOop>(this, blk, start, end);
|
||||
} else {
|
||||
((ObjArrayKlass*)klass())->oop_oop_iterate_elements_range<oop>(this, blk, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SHARE_OOPS_OBJARRAYOOP_INLINE_HPP
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user