Skip to content

Commit

Permalink
8324636: Serial: Remove Generation::block_is_obj
Browse files Browse the repository at this point in the history
Reviewed-by: stefank, ysr
  • Loading branch information
albertnetymk committed Jan 25, 2024
1 parent 7a798d3 commit e709842
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 24 deletions.
6 changes: 6 additions & 0 deletions src/hotspot/share/gc/serial/defNewGeneration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/share/gc/serial/defNewGeneration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
19 changes: 0 additions & 19 deletions src/hotspot/share/gc/serial/generation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/serial/generation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/gc/serial/tenuredGeneration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/serial/tenuredGeneration.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

1 comment on commit e709842

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.