8324636: Serial: Remove Generation::block_is_obj

Reviewed-by: stefank, ysr
This commit is contained in:
Albert Mingkun Yang 2024-01-25 14:25:45 +00:00
parent 7a798d3ceb
commit e709842eae
6 changed files with 13 additions and 24 deletions

View File

@ -723,6 +723,12 @@ void DefNewGeneration::adjust_desired_tenuring_threshold() {
age_table()->print_age_table(_tenuring_threshold);
}
bool DefNewGeneration::block_is_obj(const HeapWord* addr) const {
return eden()->is_in(addr)
|| from()->is_in(addr)
|| to() ->is_in(addr);
}
void DefNewGeneration::collect(bool full,
bool clear_all_soft_refs,
size_t size,

View File

@ -257,6 +257,10 @@ class DefNewGeneration: public Generation {
// at some additional cost.
bool collection_attempt_is_safe();
// Requires "addr" to be the start of a block, and returns "TRUE" iff
// the block is an object.
bool block_is_obj(const HeapWord* addr) const;
virtual void collect(bool full,
bool clear_all_soft_refs,
size_t size,

View File

@ -164,22 +164,3 @@ HeapWord* Generation::block_start(const void* p) const {
((Generation*)this)->space_iterate(&blk);
return blk._start;
}
class GenerationBlockIsObjClosure : public SpaceClosure {
public:
const HeapWord* _p;
bool is_obj;
virtual void do_space(Space* s) {
if (!is_obj && s->is_in_reserved(_p)) {
is_obj |= s->block_is_obj(_p);
}
}
GenerationBlockIsObjClosure(const HeapWord* p) { _p = p; is_obj = false; }
};
bool Generation::block_is_obj(const HeapWord* p) const {
GenerationBlockIsObjClosure blk(p);
// Cast away const
((Generation*)this)->space_iterate(&blk);
return blk.is_obj;
}

View File

@ -234,10 +234,6 @@ class Generation: public CHeapObj<mtGC> {
// non-object.
virtual HeapWord* block_start(const void* addr) const;
// Requires "addr" to be the start of a block, and returns "TRUE" iff
// the block is an object.
virtual bool block_is_obj(const HeapWord* addr) const;
virtual void print() const;
virtual void print_on(outputStream* st) const;

View File

@ -129,6 +129,8 @@ class TenuredGeneration: public Generation {
bool no_allocs_since_save_marks();
// Requires "addr" to be the start of a block, and returns "TRUE" iff
// the block is an object.
inline bool block_is_obj(const HeapWord* addr) const;
virtual void collect(bool full,

View File

@ -62,7 +62,7 @@ HeapWord* TenuredGeneration::par_allocate(size_t word_size,
}
bool TenuredGeneration::block_is_obj(const HeapWord* addr) const {
return addr < _the_space ->top();
return addr < _the_space->top();
}
template <typename OopClosureType>