Skip to content

Commit

Permalink
8281035: Serial: Move RemoveForwardedPointerClosure to local scope
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, tschatzl
  • Loading branch information
albertnetymk committed Feb 2, 2022
1 parent ae2504b commit 4ea6037
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
18 changes: 15 additions & 3 deletions src/hotspot/share/gc/serial/defNewGeneration.cpp
Expand Up @@ -669,9 +669,21 @@ void DefNewGeneration::init_assuming_no_promotion_failure() {
}

void DefNewGeneration::remove_forwarding_pointers() {
RemoveForwardedPointerClosure rspc;
eden()->object_iterate(&rspc);
from()->object_iterate(&rspc);
assert(_promotion_failed, "precondition");

// Will enter Full GC soon due to failed promotion. Must reset the mark word
// of objs in young-gen so that no objs are marked (forwarded) when Full GC
// starts. (The mark word is overloaded: `is_marked()` == `is_forwarded()`.)
struct ResetForwardedMarkWord : ObjectClosure {
void do_object(oop obj) override {
if (obj->is_forwarded()) {
obj->init_mark();
}
}
} cl;
eden()->object_iterate(&cl);
from()->object_iterate(&cl);

restore_preserved_marks();
}

Expand Down
6 changes: 0 additions & 6 deletions src/hotspot/share/gc/shared/preservedMarks.cpp
Expand Up @@ -71,12 +71,6 @@ void PreservedMarks::assert_empty() {
}
#endif // ndef PRODUCT

void RemoveForwardedPointerClosure::do_object(oop obj) {
if (obj->is_forwarded()) {
PreservedMarks::init_forwarded_mark(obj);
}
}

void PreservedMarksSet::init(uint num) {
assert(_stacks == nullptr && _num == 0, "do not re-initialize");
assert(num > 0, "pre-condition");
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/gc/shared/preservedMarks.hpp
Expand Up @@ -75,11 +75,6 @@ class PreservedMarks {
~PreservedMarks() { assert_empty(); }
};

class RemoveForwardedPointerClosure: public ObjectClosure {
public:
virtual void do_object(oop obj);
};

class PreservedMarksSet : public CHeapObj<mtGC> {
private:
// true -> _stacks will be allocated in the C heap
Expand Down

1 comment on commit 4ea6037

@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.