Skip to content

Commit

Permalink
8319724: [Lilliput] ParallelGC: Forwarded objects found during heap i…
Browse files Browse the repository at this point in the history
…nspection

Reviewed-by: shade
  • Loading branch information
rkennke committed Nov 9, 2023
1 parent 3f73f01 commit 0568386
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
31 changes: 28 additions & 3 deletions src/hotspot/share/gc/parallel/mutableSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,36 @@ void MutableSpace::oop_iterate(OopIterateClosure* cl) {
}
}

void MutableSpace::object_iterate(ObjectClosure* cl) {
template<bool COMPACT_HEADERS>
void MutableSpace::object_iterate_impl(ObjectClosure* cl) {
HeapWord* p = bottom();
while (p < top()) {
cl->do_object(cast_to_oop(p));
p += cast_to_oop(p)->size();
oop obj = cast_to_oop(p);
// When promotion-failure occurs during Young GC, eden/from space is not cleared,
// so we can encounter objects with "forwarded" markword.
// They are essentially dead, so skipping them
if (!obj->is_forwarded()) {
cl->do_object(obj);
p += obj->size();
} else {
assert(obj->forwardee() != obj, "must not be self-forwarded");
if (COMPACT_HEADERS) {
// It is safe to use the forwardee here. Parallel GC only uses
// header-based forwarding during promotion. Full GC doesn't
// use the object header for forwarding at all.
p += obj->forwardee()->size();
} else {
p += obj->size();
}
}
}
}

void MutableSpace::object_iterate(ObjectClosure* cl) {
if (UseCompactObjectHeaders) {
object_iterate_impl<true>(cl);
} else {
object_iterate_impl<false>(cl);
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/gc/parallel/mutableSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class MutableSpace: public CHeapObj<mtGC> {
void set_last_setup_region(MemRegion mr) { _last_setup_region = mr; }
MemRegion last_setup_region() const { return _last_setup_region; }

template<bool COMPACT_HEADERS>
void object_iterate_impl(ObjectClosure* cl);

public:
virtual ~MutableSpace();
MutableSpace(size_t page_size);
Expand Down

4 comments on commit 0568386

@rkennke
Copy link
Collaborator Author

@rkennke rkennke commented on 0568386 Nov 9, 2023

Choose a reason for hiding this comment

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

/backport lilliput-jdk21u

@openjdk
Copy link

@openjdk openjdk bot commented on 0568386 Nov 9, 2023

Choose a reason for hiding this comment

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

@rkennke the backport was successfully created on the branch rkennke-backport-0568386e in my personal fork of openjdk/lilliput-jdk21u. To create a pull request with this backport targeting openjdk/lilliput-jdk21u:lilliput, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 0568386e from the openjdk/lilliput repository.

The commit being backported was authored by Roman Kennke on 9 Nov 2023 and was reviewed by Aleksey Shipilev.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/lilliput-jdk21u:

$ git fetch https://github.com/openjdk-bots/lilliput-jdk21u.git rkennke-backport-0568386e:rkennke-backport-0568386e
$ git checkout rkennke-backport-0568386e
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/lilliput-jdk21u.git rkennke-backport-0568386e

@rkennke
Copy link
Collaborator Author

@rkennke rkennke commented on 0568386 Nov 9, 2023

Choose a reason for hiding this comment

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

/backport lilliput-jdk17u

@openjdk
Copy link

@openjdk openjdk bot commented on 0568386 Nov 9, 2023

Choose a reason for hiding this comment

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

@rkennke the backport was successfully created on the branch rkennke-backport-0568386e in my personal fork of openjdk/lilliput-jdk17u. To create a pull request with this backport targeting openjdk/lilliput-jdk17u:lilliput, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 0568386e from the openjdk/lilliput repository.

The commit being backported was authored by Roman Kennke on 9 Nov 2023 and was reviewed by Aleksey Shipilev.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/lilliput-jdk17u:

$ git fetch https://github.com/openjdk-bots/lilliput-jdk17u.git rkennke-backport-0568386e:rkennke-backport-0568386e
$ git checkout rkennke-backport-0568386e
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/lilliput-jdk17u.git rkennke-backport-0568386e

Please sign in to comment.