RFR: 8298281: Serial: Refactor MarkAndPushClosure

Stefan Karlsson stefank at openjdk.org
Wed Dec 7 17:03:10 UTC 2022


On Wed, 7 Dec 2022 15:20:48 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Simple change of removing some redundant code in oop-iteration.
> 
> Test: hotspot_gc

Changes requested by stefank (Reviewer).

src/hotspot/share/gc/serial/markSweep.hpp line 175:

> 173: class MarkAndPushClosure: public ClaimMetadataVisitingOopIterateClosure {
> 174: public:
> 175:   MarkAndPushClosure(int claim) : ClaimMetadataVisitingOopIterateClosure(claim) {}

We always pass in the same value for `claim`. An alternative would be to remove this parameter and pass it to ClaimMetadataVisitingOopIterateClosure here. But maybe you liked having all the claim values together in one location in markSweep.cpp?

src/hotspot/share/gc/serial/markSweep.hpp line 179:

> 177:   template <typename T> void do_oop_work(T* p);
> 178:   virtual void do_oop(      oop* p) { do_oop_work(p); }
> 179:   virtual void do_oop(narrowOop* p) { do_oop_work(p); }

This now uses a function defined in the inline.hpp file, without including it. Is there a reason why the do_oop functions where moved out from the inline.hpp file?

-------------

PR: https://git.openjdk.org/jdk/pull/11562


More information about the hotspot-gc-dev mailing list