8205607: Use oop_iterate instead of oop_iterate_no_header

Reviewed-by: pliden, kbarrett
This commit is contained in:
Stefan Karlsson 2018-06-26 13:54:19 +02:00
parent 35a9c52708
commit 5012044e63
15 changed files with 22 additions and 55 deletions

View File

@ -2435,7 +2435,7 @@ class VerifyAllBlksClosure: public BlkClosure {
}
};
class VerifyAllOopsClosure: public OopClosure {
class VerifyAllOopsClosure: public BasicOopIterateClosure {
private:
const CMSCollector* _collector;
const CompactibleFreeListSpace* _sp;
@ -2524,9 +2524,8 @@ void CompactibleFreeListSpace::verify() const {
VerifyAllOopsClosure cl(_collector, this, span, past_remark,
_collector->markBitMap());
// Iterate over all oops in the heap. Uses the _no_header version
// since we are not interested in following the klass pointers.
CMSHeap::heap()->oop_iterate_no_header(&cl);
// Iterate over all oops in the heap.
CMSHeap::heap()->oop_iterate(&cl);
}
if (VerifyObjectStartArray) {

View File

@ -120,8 +120,7 @@ void G1FullGCMarker::follow_array_chunk(objArrayOop array, int index) {
if (VerifyDuringGC) {
_verify_closure.set_containing_obj(array);
NoHeaderExtendedOopClosure no(&_verify_closure);
array->oop_iterate_range(&no, beg_index, end_index);
array->oop_iterate_range(&_verify_closure, beg_index, end_index);
if (_verify_closure.failures()) {
assert(false, "Failed");
}
@ -141,7 +140,7 @@ inline void G1FullGCMarker::follow_object(oop obj) {
return;
}
_verify_closure.set_containing_obj(obj);
obj->oop_iterate_no_header(&_verify_closure);
obj->oop_iterate(&_verify_closure);
if (_verify_closure.failures()) {
log_warning(gc, verify)("Failed after %d", _verify_closure._cc);
assert(false, "Failed");

View File

@ -84,7 +84,7 @@ public:
virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
};
class G1VerifyOopClosure: public OopClosure {
class G1VerifyOopClosure: public BasicOopIterateClosure {
private:
G1CollectedHeap* _g1h;
bool _failures;

View File

@ -180,7 +180,7 @@ class VerifyCLDClosure: public CLDClosure {
}
};
class VerifyLivenessOopClosure: public OopClosure {
class VerifyLivenessOopClosure: public BasicOopIterateClosure {
G1CollectedHeap* _g1h;
VerifyOption _vo;
public:
@ -226,7 +226,7 @@ public:
guarantee(!_g1h->is_obj_dead(o), "Full GC marking and concurrent mark mismatch");
}
o->oop_iterate_no_header(&isLive);
o->oop_iterate(&isLive);
if (!_hr->obj_allocated_since_prev_marking(o)) {
size_t obj_size = o->size(); // Make sure we don't overflow
_live_bytes += (obj_size * HeapWordSize);
@ -236,7 +236,7 @@ public:
size_t live_bytes() { return _live_bytes; }
};
class VerifyArchiveOopClosure: public OopClosure {
class VerifyArchiveOopClosure: public BasicOopIterateClosure {
HeapRegion* _hr;
public:
VerifyArchiveOopClosure(HeapRegion *hr)
@ -269,7 +269,7 @@ public:
void do_object(oop o) {
VerifyArchiveOopClosure checkOop(_hr);
assert(o != NULL, "Should not be here for NULL oops");
o->oop_iterate_no_header(&checkOop);
o->oop_iterate(&checkOop);
}
};

View File

@ -215,12 +215,12 @@ bool MutableSpace::cas_deallocate(HeapWord *obj, size_t size) {
return Atomic::cmpxchg(obj, top_addr(), expected_top) == expected_top;
}
void MutableSpace::oop_iterate_no_header(OopClosure* cl) {
void MutableSpace::oop_iterate(OopIterateClosure* cl) {
HeapWord* obj_addr = bottom();
HeapWord* t = top();
// Could call objects iterate, but this is easier.
while (obj_addr < t) {
obj_addr += oop(obj_addr)->oop_iterate_no_header(cl);
obj_addr += oop(obj_addr)->oop_iterate_size(cl);
}
}

View File

@ -134,7 +134,7 @@ class MutableSpace: public ImmutableSpace {
bool cas_deallocate(HeapWord *obj, size_t size);
// Iteration.
void oop_iterate_no_header(OopClosure* cl);
void oop_iterate(OopIterateClosure* cl);
void object_iterate(ObjectClosure* cl);
// Debugging

View File

@ -39,7 +39,7 @@
// Checks an individual oop for missing precise marks. Mark
// may be either dirty or newgen.
class CheckForUnmarkedOops : public OopClosure {
class CheckForUnmarkedOops : public BasicOopIterateClosure {
private:
PSYoungGen* _young_gen;
PSCardTable* _card_table;
@ -89,7 +89,7 @@ class CheckForUnmarkedObjects : public ObjectClosure {
// fail unless the object head is also unmarked.
virtual void do_object(oop obj) {
CheckForUnmarkedOops object_check(_young_gen, _card_table);
obj->oop_iterate_no_header(&object_check);
obj->oop_iterate(&object_check);
if (object_check.has_unmarked_oop()) {
guarantee(_card_table->addr_is_marked_imprecise(obj), "Found unmarked young_gen object");
}
@ -97,7 +97,7 @@ class CheckForUnmarkedObjects : public ObjectClosure {
};
// Checks for precise marking of oops as newgen.
class CheckForPreciseMarks : public OopClosure {
class CheckForPreciseMarks : public BasicOopIterateClosure {
private:
PSYoungGen* _young_gen;
PSCardTable* _card_table;
@ -336,7 +336,7 @@ void PSCardTable::verify_all_young_refs_precise() {
CheckForPreciseMarks check(heap->young_gen(), this);
old_gen->oop_iterate_no_header(&check);
old_gen->oop_iterate(&check);
verify_all_young_refs_precise_helper(old_gen->object_space()->used_region());
}

View File

@ -192,7 +192,7 @@ class PSOldGen : public CHeapObj<mtGC> {
HeapWord* allocate(size_t word_size);
// Iteration.
void oop_iterate_no_header(OopClosure* cl) { object_space()->oop_iterate_no_header(cl); }
void oop_iterate(OopIterateClosure* cl) { object_space()->oop_iterate(cl); }
void object_iterate(ObjectClosure* cl) { object_space()->object_iterate(cl); }
// Debugging - do not use for time critical operations

View File

@ -330,7 +330,7 @@ void CardTableRS::invalidate_or_clear(Generation* old_gen) {
}
class VerifyCleanCardClosure: public OopClosure {
class VerifyCleanCardClosure: public BasicOopIterateClosure {
private:
HeapWord* _boundary;
HeapWord* _begin;
@ -430,7 +430,7 @@ void CardTableRS::verify_space(Space* s, HeapWord* gen_boundary) {
VerifyCleanCardClosure verify_blk(gen_boundary, begin, end);
for (HeapWord* cur = start_block; cur < end; cur += s->block_size(cur)) {
if (s->block_is_obj(cur) && s->obj_is_alive(cur)) {
oop(cur)->oop_iterate_no_header(&verify_blk, mr);
oop(cur)->oop_iterate(&verify_blk, mr);
}
}
}

View File

@ -1042,11 +1042,6 @@ bool GenCollectedHeap::is_in_partial_collection(const void* p) {
}
#endif
void GenCollectedHeap::oop_iterate_no_header(OopClosure* cl) {
NoHeaderExtendedOopClosure no_header_cl(cl);
oop_iterate(&no_header_cl);
}
void GenCollectedHeap::oop_iterate(OopIterateClosure* cl) {
_young_gen->oop_iterate(cl);
_old_gen->oop_iterate(cl);

View File

@ -258,7 +258,6 @@ public:
virtual void verify_nmethod(nmethod* nmethod);
// Iteration functions.
void oop_iterate_no_header(OopClosure* cl);
void oop_iterate(OopIterateClosure* cl);
void object_iterate(ObjectClosure* cl);
void safe_object_iterate(ObjectClosure* cl);

View File

@ -117,16 +117,6 @@ public:
virtual void do_cld(ClassLoaderData* cld) { ShouldNotReachHere(); }
};
// Wrapper closure only used to implement oop_iterate_no_header().
class NoHeaderExtendedOopClosure : public BasicOopIterateClosure {
OopClosure* _wrapped_closure;
public:
NoHeaderExtendedOopClosure(OopClosure* cl) : _wrapped_closure(cl) {}
// Warning: this calls the virtual version do_oop in the the wrapped closure.
virtual void do_oop(oop* p) { _wrapped_closure->do_oop(p); }
virtual void do_oop(narrowOop* p) { _wrapped_closure->do_oop(p); }
};
class KlassClosure : public Closure {
public:
virtual void do_klass(Klass* k) = 0;

View File

@ -3430,7 +3430,7 @@ void InstanceKlass::collect_statistics(KlassSizeStats *sz) const {
// Verification
class VerifyFieldClosure: public OopClosure {
class VerifyFieldClosure: public BasicOopIterateClosure {
protected:
template <class T> void do_oop_work(T* p) {
oop obj = RawAccess<>::oop_load(p);
@ -3578,7 +3578,7 @@ void InstanceKlass::verify_on(outputStream* st) {
void InstanceKlass::oop_verify_on(oop obj, outputStream* st) {
Klass::oop_verify_on(obj, st);
VerifyFieldClosure blk;
obj->oop_iterate_no_header(&blk);
obj->oop_iterate(&blk);
}

View File

@ -302,9 +302,6 @@ class oopDesc {
template <typename OopClosureType>
inline void oop_iterate_backwards(OopClosureType* cl);
inline int oop_iterate_no_header(OopClosure* bk);
inline int oop_iterate_no_header(OopClosure* bk, MemRegion mr);
inline static bool is_instanceof_or_null(oop obj, Klass* klass);
// identity hash; returns the identity hash key (computes it if necessary)

View File

@ -463,18 +463,6 @@ void oopDesc::oop_iterate_backwards(OopClosureType* cl) {
OopIteratorClosureDispatch::oop_oop_iterate_backwards(cl, this, klass());
}
int oopDesc::oop_iterate_no_header(OopClosure* blk) {
// The NoHeaderExtendedOopClosure wraps the OopClosure and proxies all
// the do_oop calls, but turns off all other features in OopIterateClosure.
NoHeaderExtendedOopClosure cl(blk);
return oop_iterate_size(&cl);
}
int oopDesc::oop_iterate_no_header(OopClosure* blk, MemRegion mr) {
NoHeaderExtendedOopClosure cl(blk);
return oop_iterate_size(&cl, mr);
}
bool oopDesc::is_instanceof_or_null(oop obj, Klass* klass) {
return obj == NULL || obj->klass()->is_subtype_of(klass);
}