RFR: 8243205: Modularize JVM flags declaration

Stefan Karlsson stefank at openjdk.java.net
Mon Dec 7 08:38:15 UTC 2020


On Thu, 3 Dec 2020 21:51:42 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> This is the first step for modularizing the xxx_globals.hpp. The goals are
> 
> - Improve modularization of HotSpot source
> - Reduce JVM build time
> 
> To prove that this works,  I have moved compiler_globals.hpp outside of the monolithic globals.hpp. Before this fix, compiler_globals.hpp was included by 922 HotSpot .o files. After this fix, it's included by 283 .o files.
> 
> I plan to do more refactoring later, such as:
> 
> - move gc_globals.hpp out of globals.hpp
> - move the flags related to tiered compilation (about 40 flags) out of globals.hpp
> - move the platform-specific flags outside of globals.hpp
>   - these flags should be used only by platform-specific files. They shouldn't be used by shared files.
> 
> Note: this is target for JDK 17.
> 
> Testing: I've tested tier1, builds-tier2, builds-tier3, builds-tier4 and builds-tier5 on mach5, plus locally building arm, aarch64, s390, ppc64, and zero.

Thanks for tackling this.

src/hotspot/share/compiler/compiler_globals_pd.hpp line 26:

> 24: 
> 25: #ifndef SHARE_COMPILER_COMPILER_GLOBALS_DEF_HPP
> 26: #define SHARE_COMPILER_COMPILER_GLOBALS_DEF_HPP

Should this be SHARE_COMPILER_COMPILER_GLOBALS_PD_HPP

src/hotspot/share/compiler/compiler_globals_pd.hpp line 44:

> 42: // JVMCI has no platform-specific global definitions
> 43: //#if INCLUDE_JVMCI
> 44: //#include "jvmci/jvmci_globals_def.hpp"

jvmci_globals_def.hpp => jvmci_globals_pd.hpp ?

src/hotspot/share/runtime/flags/allFlags.hpp line 112:

> 110:     notproduct,               \
> 111:     range,                    \
> 112:     constraint)

RUNTIME / GC / RUNTIME_OS : Could the order be changed so that the RUNTIME macros are grouped together?

src/hotspot/share/runtime/globals.hpp line 2502:

> 2500: DECLARE_FLAGS(RUNTIME_OS_FLAGS)
> 2501: DECLARE_FLAGS(RUNTIME_FLAGS)
> 2502: DECLARE_ARCH_FLAGS(ARCH_FLAGS)

This order is different to the one in allFlags.hpp. Maybe use the same order?

src/hotspot/share/runtime/globals_shared.hpp line 101:

> 99:                DECLARE_NOTPRODUCT_FLAG, \
> 100:                IGNORE_RANGE, \
> 101:                IGNORE_CONSTRAINT)

Suggestion:

#define DECLARE_FLAGS(flag_group)          \
  flag_group(DECLARE_DEVELOPER_FLAG,     \
             DECLARE_PD_DEVELOPER_FLAG,  \
             DECLARE_PRODUCT_FLAG,       \
             DECLARE_PD_PRODUCT_FLAG,    \
             DECLARE_NOTPRODUCT_FLAG,    \
             IGNORE_RANGE,               \
             IGNORE_CONSTRAINT)

src/hotspot/share/runtime/globals_shared.hpp line 108:

> 106:                DECLARE_NOTPRODUCT_FLAG, \
> 107:                IGNORE_RANGE, \
> 108:                IGNORE_CONSTRAINT)

Suggestion:

#define DECLARE_ARCH_FLAGS(flag_group)  \
  flag_group(DECLARE_DEVELOPER_FLAG,    \
             DECLARE_PRODUCT_FLAG,      \
             DECLARE_NOTPRODUCT_FLAG,   \
             IGNORE_RANGE,              \
             IGNORE_CONSTRAINT)

src/hotspot/share/runtime/flags/allFlags.hpp line 117:

> 115:   COMPILER_CONSTRAINTS(f)     \
> 116:   RUNTIME_CONSTRAINTS(f)      \
> 117:   GC_CONSTRAINTS(f)

Suggestion:

#define ALL_CONSTRAINTS(f)  \
  COMPILER_CONSTRAINTS(f)   \
  RUNTIME_CONSTRAINTS(f)    \
  GC_CONSTRAINTS(f)

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

Changes requested by stefank (Reviewer).

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


More information about the hotspot-dev mailing list