8324513: Inline ContiguousSpace::object_iterate_from

Reviewed-by: stefank
This commit is contained in:
Albert Mingkun Yang 2024-01-23 15:51:58 +00:00
parent fbaaac63d4
commit 2a01c798d3
2 changed files with 5 additions and 13 deletions

View File

@ -146,14 +146,11 @@ bool Space::obj_is_alive(const HeapWord* p) const {
} }
void ContiguousSpace::object_iterate(ObjectClosure* blk) { void ContiguousSpace::object_iterate(ObjectClosure* blk) {
if (is_empty()) return; HeapWord* addr = bottom();
object_iterate_from(bottom(), blk); while (addr < top()) {
} oop obj = cast_to_oop(addr);
blk->do_object(obj);
void ContiguousSpace::object_iterate_from(HeapWord* mark, ObjectClosure* blk) { addr += obj->size();
while (mark < top()) {
blk->do_object(cast_to_oop(mark));
mark += cast_to_oop(mark)->size();
} }
} }

View File

@ -283,11 +283,6 @@ protected:
template <typename OopClosureType> template <typename OopClosureType>
void oop_since_save_marks_iterate(OopClosureType* blk); void oop_since_save_marks_iterate(OopClosureType* blk);
// Same as object_iterate, but starting from "mark", which is required
// to denote the start of an object. Objects allocated by
// applications of the closure *are* included in the iteration.
virtual void object_iterate_from(HeapWord* mark, ObjectClosure* blk);
// Very inefficient implementation. // Very inefficient implementation.
HeapWord* block_start_const(const void* p) const override; HeapWord* block_start_const(const void* p) const override;
size_t block_size(const HeapWord* p) const override; size_t block_size(const HeapWord* p) const override;