RFR: 8247740: Inline derived CollectedHeap access for G1 and ParallelGC

Stefan Karlsson stefan.karlsson at oracle.com
Wed Jun 17 17:38:15 UTC 2020

Looks good.

Some nits that you might want to consider:

- Extraneous new line. Other places in the file don't add a newline 
after public:, private:, or protected:.

181 protected:
183 // Must follow Name enum. C++11 forward declaration of enum.

- I'm not sure the last part is complete. I do understand what it tries 
to say, but I just don't think it's necessary, or that helpful. A 
descriptive comment about the function would be more helpful, IMHO.

// Must follow Name enum. C++11 forward declaration of enum.


On 2020-06-17 14:32, Kim Barrett wrote:
> Please review this change to derived CollectedHeap access for the
> various collectors.  Most of the collectors have a heap() function
> that returns the derived CollectedHeap object, with the definitions of
> these functions being nearly identical.  This change adds a helper
> function in CollectedHeap for use by these derived heap() functions.
> This change also inlines the heap() functions for G1 and ParallelGC.
> These functions have a very simple definition in a release build.
> Since both of these collectors have calls in relatively performance
> critical places, inlining should be (a little bit) helpful, though I
> haven't tried to measure it.  In some cases it may be better to get
> the heap once and cache it in a variable or data member; indeed,
> that's often done, but not always, and tracking down all the cases
> that matter isn't a small task.
> This change only does the inlining for G1 and ParallelGC.  Performance
> of Serial and Epsilon is less critical, and ZGC does a good job of
> avoiding hot calls.  Shenandoah doesn't have a corresponding function;
> it seems to have not conformed to the JDK-8077415 change.
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8247740
> Webrev:
> https://cr.openjdk.java.net/~kbarrett/8247740/open.00/
> Testing:
> mach5 tier1

More information about the hotspot-gc-dev mailing list