RFR: 8259882: Reduce the inclusion of perfData.hpp

Coleen Phillimore coleenp at openjdk.java.net
Thu Jan 21 13:55:28 UTC 2021


On Mon, 18 Jan 2021 04:24:27 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> perfData.hpp is about 1000 lines long, and is included by 829 out of about 1000 HotSpot .o files.
> 
> Several popular headers (such as synchronizer.hpp, objectMonitor.hpp, threadLocalAllocBuffer.hpp) include perfData.hpp. However, since these headers just declare pointers like
> 
> PerfCounter* foo;
> 
> there's no need to include perfData.hpp. A forward declaration of the PerfCount type would suffice.
> 
> With forward declaration, we can remove perfData.hpp from these headers. This reduces the number of .o files that include perfData.hpp to 183. Build time of HotSpot is reduced by about 0.4%.
> 
> **Note:** the forward declaration is in the new file perfDataTypes.hpp. It contains typedefs to make "aliases" of the types. These are probably relics from the past, where new classes like`PerfIntConstant` were to be added but that never happened.
> 
> typedef PerfLongSampleHelper PerfSampleHelper;
> typedef PerfLongConstant PerfConstant;
> typedef PerfLongCounter PerfCounter;
> typedef PerfLongVariable PerfVariable;
> 
> The HotSpot code uses both the "real" type and the "alias" type (mostly the latter). I don't want to deal with the alises for now, so I just moved them from perfData.hpp to perfDataTypes.hpp. We should probably just rename `PerfLongConstant` to `PerfConstant` in a future RFE.
> 
> Tested with mach5: tier1, builds-tier2, builds-tier3, builds-tier4 and builds-tier5. Also locally: aarch64, arm, ppc64, s390, x86, and zero.

Ok.

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

Marked as reviewed by coleenp (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/2123


More information about the hotspot-dev mailing list