提交 bdd04bef 编写于 作者: M mgerdin

8038399: Remove dead oop_iterate MemRegion variants from SharedHeap, Generation and Space classes

Reviewed-by: tschatzl, stefank
上级 5f2ab917
......@@ -795,53 +795,6 @@ void CompactibleFreeListSpace::oop_iterate(ExtendedOopClosure* cl) {
}
}
// Apply the given closure to each oop in the space \intersect memory region.
void CompactibleFreeListSpace::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) {
assert_lock_strong(freelistLock());
if (is_empty()) {
return;
}
MemRegion cur = MemRegion(bottom(), end());
mr = mr.intersection(cur);
if (mr.is_empty()) {
return;
}
if (mr.equals(cur)) {
oop_iterate(cl);
return;
}
assert(mr.end() <= end(), "just took an intersection above");
HeapWord* obj_addr = block_start(mr.start());
HeapWord* t = mr.end();
SpaceMemRegionOopsIterClosure smr_blk(cl, mr);
if (block_is_obj(obj_addr)) {
// Handle first object specially.
oop obj = oop(obj_addr);
obj_addr += adjustObjectSize(obj->oop_iterate(&smr_blk));
} else {
FreeChunk* fc = (FreeChunk*)obj_addr;
obj_addr += fc->size();
}
while (obj_addr < t) {
HeapWord* obj = obj_addr;
obj_addr += block_size(obj_addr);
// If "obj_addr" is not greater than top, then the
// entire object "obj" is within the region.
if (obj_addr <= t) {
if (block_is_obj(obj)) {
oop(obj)->oop_iterate(cl);
}
} else {
// "obj" extends beyond end of region
if (block_is_obj(obj)) {
oop(obj)->oop_iterate(&smr_blk);
}
break;
}
}
}
// NOTE: In the following methods, in order to safely be able to
// apply the closure to an object, we need to be sure that the
// object has been initialized. We are guaranteed that an object
......
......@@ -350,7 +350,6 @@ class CompactibleFreeListSpace: public CompactibleSpace {
Mutex* freelistLock() const { return &_freelistLock; }
// Iteration support
void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
void oop_iterate(ExtendedOopClosure* cl);
void object_iterate(ObjectClosure* blk);
......
......@@ -3167,16 +3167,6 @@ ConcurrentMarkSweepGeneration::younger_refs_iterate(OopsInGenClosure* cl) {
cl->reset_generation();
}
void
ConcurrentMarkSweepGeneration::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) {
if (freelistLock()->owned_by_self()) {
Generation::oop_iterate(mr, cl);
} else {
MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
Generation::oop_iterate(mr, cl);
}
}
void
ConcurrentMarkSweepGeneration::oop_iterate(ExtendedOopClosure* cl) {
if (freelistLock()->owned_by_self()) {
......
......@@ -1285,7 +1285,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
void save_sweep_limit();
// More iteration support
virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
virtual void oop_iterate(ExtendedOopClosure* cl);
virtual void safe_object_iterate(ObjectClosure* cl);
virtual void object_iterate(ObjectClosure* cl);
......
......@@ -846,12 +846,6 @@ void GenCollectedHeap::oop_iterate(ExtendedOopClosure* cl) {
}
}
void GenCollectedHeap::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->oop_iterate(mr, cl);
}
}
void GenCollectedHeap::object_iterate(ObjectClosure* cl) {
for (int i = 0; i < _n_gens; i++) {
_gens[i]->object_iterate(cl);
......
......@@ -220,7 +220,6 @@ public:
// Iteration functions.
void oop_iterate(ExtendedOopClosure* cl);
void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
void object_iterate(ObjectClosure* cl);
void safe_object_iterate(ObjectClosure* cl);
Space* space_containing(const void* addr) const;
......
......@@ -297,22 +297,16 @@ bool Generation::block_is_obj(const HeapWord* p) const {
class GenerationOopIterateClosure : public SpaceClosure {
public:
ExtendedOopClosure* cl;
MemRegion mr;
ExtendedOopClosure* _cl;
virtual void do_space(Space* s) {
s->oop_iterate(mr, cl);
s->oop_iterate(_cl);
}
GenerationOopIterateClosure(ExtendedOopClosure* _cl, MemRegion _mr) :
cl(_cl), mr(_mr) {}
GenerationOopIterateClosure(ExtendedOopClosure* cl) :
_cl(cl) {}
};
void Generation::oop_iterate(ExtendedOopClosure* cl) {
GenerationOopIterateClosure blk(cl, _reserved);
space_iterate(&blk);
}
void Generation::oop_iterate(MemRegion mr, ExtendedOopClosure* cl) {
GenerationOopIterateClosure blk(cl, mr);
GenerationOopIterateClosure blk(cl);
space_iterate(&blk);
}
......
......@@ -543,10 +543,6 @@ class Generation: public CHeapObj<mtGC> {
// generation, calling "cl.do_oop" on each.
virtual void oop_iterate(ExtendedOopClosure* cl);
// Same as above, restricted to the intersection of a memory region and
// the generation.
virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
// Iterate over all objects in the generation, calling "cl.do_object" on
// each.
virtual void object_iterate(ObjectClosure* cl);
......
......@@ -163,9 +163,6 @@ public:
// Iteration functions.
void oop_iterate(ExtendedOopClosure* cl) = 0;
// Same as above, restricted to a memory region.
virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl) = 0;
// Iterate over all spaces in use in the heap, in an undefined order.
virtual void space_iterate(SpaceClosure* cl) = 0;
......
......@@ -44,9 +44,6 @@
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
void SpaceMemRegionOopsIterClosure::do_oop(oop* p) { SpaceMemRegionOopsIterClosure::do_oop_work(p); }
void SpaceMemRegionOopsIterClosure::do_oop(narrowOop* p) { SpaceMemRegionOopsIterClosure::do_oop_work(p); }
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
HeapWord* DirtyCardToOopClosure::get_actual_top(HeapWord* top,
......@@ -690,43 +687,6 @@ void ContiguousSpace::oop_iterate(ExtendedOopClosure* blk) {
}
}
void ContiguousSpace::oop_iterate(MemRegion mr, ExtendedOopClosure* blk) {
if (is_empty()) {
return;
}
MemRegion cur = MemRegion(bottom(), top());
mr = mr.intersection(cur);
if (mr.is_empty()) {
return;
}
if (mr.equals(cur)) {
oop_iterate(blk);
return;
}
assert(mr.end() <= top(), "just took an intersection above");
HeapWord* obj_addr = block_start(mr.start());
HeapWord* t = mr.end();
// Handle first object specially.
oop obj = oop(obj_addr);
SpaceMemRegionOopsIterClosure smr_blk(blk, mr);
obj_addr += obj->oop_iterate(&smr_blk);
while (obj_addr < t) {
oop obj = oop(obj_addr);
assert(obj->is_oop(), "expected an oop");
obj_addr += obj->size();
// If "obj_addr" is not greater than top, then the
// entire object "obj" is within the region.
if (obj_addr <= t) {
obj->oop_iterate(blk);
} else {
// "obj" extends beyond end of region
obj->oop_iterate(&smr_blk);
break;
}
};
}
void ContiguousSpace::object_iterate(ObjectClosure* blk) {
if (is_empty()) return;
WaterMark bm = bottom_mark();
......
......@@ -65,31 +65,6 @@ class GenRemSet;
class CardTableRS;
class DirtyCardToOopClosure;
// An oop closure that is circumscribed by a filtering memory region.
class SpaceMemRegionOopsIterClosure: public ExtendedOopClosure {
private:
ExtendedOopClosure* _cl;
MemRegion _mr;
protected:
template <class T> void do_oop_work(T* p) {
if (_mr.contains(p)) {
_cl->do_oop(p);
}
}
public:
SpaceMemRegionOopsIterClosure(ExtendedOopClosure* cl, MemRegion mr):
_cl(cl), _mr(mr) {}
virtual void do_oop(oop* p);
virtual void do_oop(narrowOop* p);
virtual bool do_metadata() {
// _cl is of type ExtendedOopClosure instead of OopClosure, so that we can check this.
assert(!_cl->do_metadata(), "I've checked all call paths, this shouldn't happen.");
return false;
}
virtual void do_klass(Klass* k) { ShouldNotReachHere(); }
virtual void do_class_loader_data(ClassLoaderData* cld) { ShouldNotReachHere(); }
};
// A Space describes a heap area. Class Space is an abstract
// base class.
//
......@@ -205,11 +180,6 @@ class Space: public CHeapObj<mtGC> {
// applications of the closure are not included in the iteration.
virtual void oop_iterate(ExtendedOopClosure* cl);
// Same as above, restricted to the intersection of a memory region and
// the space. Fields in objects allocated by applications of the closure
// are not included in the iteration.
virtual void oop_iterate(MemRegion mr, ExtendedOopClosure* cl) = 0;
// Iterate over all objects in the space, calling "cl.do_object" on
// each. Objects allocated by applications of the closure are not
// included in the iteration.
......@@ -584,7 +554,6 @@ class ContiguousSpace: public CompactibleSpace {
// Iteration
void oop_iterate(ExtendedOopClosure* cl);
void oop_iterate(MemRegion mr, ExtendedOopClosure* cl);
void object_iterate(ObjectClosure* blk);
// For contiguous spaces this method will iterate safely over objects
// in the space (i.e., between bottom and top) when at a safepoint.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册