RFR: 8298281: Serial: Refactor MarkAndPushClosure
    Albert Mingkun Yang 
    ayang at openjdk.org
       
    Wed Dec  7 20:32:07 UTC 2022
    
    
  
On Wed, 7 Dec 2022 17:00:43 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
>> Simple change of removing some redundant code in oop-iteration.
>> 
>> Test: hotspot_gc
>
> 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?
I didn't think too much on this. Having all claim flags in one place does seem desirable, but either approach sounds OK IMO.
> 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?
No particular reason other than copying it from `G1CMOopClosure`. This is a `hpp` file; callers need to include `inline.hpp` anyway.
-------------
PR: https://git.openjdk.org/jdk/pull/11562
    
    
More information about the hotspot-gc-dev
mailing list