Conditional compilation of ZGC

Stefan Karlsson stefan.karlsson at
Wed May 9 16:58:07 UTC 2018

Hi Stuart,

On 2018-05-09 18:16, Stuart Monteith wrote:
> Hi,
>     I'm not a reviewer. I only have a couple of observations to make,
> it otherwise looks OK, AFAICT.

Thanks for taking a look at this!

Hopefully it's straight forward to enable compilation of ZGC on AArch64 
by adding a line to the section that sets up JVM_FEATURES_zgc.

> src/hotspot/cpu/x86/
>    Did you intend on changing all of the occurrences of "
> predicate(UseAVX == 3); " into "predicate((UseAVX == 3));" in this
> patch?

IIRC, this was necessary to get the code to compile on OSX. I probably 
should have extracted it as a separate patch.

> src/hotspot/share/gc/shared/collectedHeap.hpp:
>   You excluded "Z" from the enum here;
> src/hotspot/share/gc/shared/gcName.hpp, should you do the same for
> line 201 in src/hotspot/share/gc/shared/collectedHeap.hpp ?

There is a hard-coded dependency between the C++ enum values in 
CollectedHeap and the Java enum values in, 
so I've left Z in CollectedHeap, at least for now.

Regarding the gcName.hpp. I think I might have to change that to always 
include Z. There might be some interaction with JFR that requires all 
values to be present. It's at least a bit odd that the other GC names 
are not guarded by their respective INCLUDE_<GC> defines. I'll take a 
look at this when I get back to the office next week.


> BR,
>     Stuart
> On 9 May 2018 at 14:15, Stefan Karlsson <stefan.karlsson at> wrote:
>> Hi all,
>> This is the first version of the patch to allow the compilation of ZGC to be
>> turned on and off. This patch passes tier1, tier2, and hs-tier3 (except for
>> the test in gcbarriers that need to be updated). This mostly shows that we
>> can build ZGC on Linux x86_64 and Solaris Sparc, and that the other
>> platforms still build without ZGC. It also shows that we don't break the
>> other GCs.
>> There are a few changes that we want to do for next version:
>> 1) .ad file replace the fatal("ZGC specific code") with
>> ShouldNotReachHere(), and maybe assert that we are running with ZGC.
>> 2) Remove the INCLUDE_ZGC from gcCause and gcName, or add INCLUDE_<GC>
>> guards for the other GCs.
>> 3) c2_globals.hpp further cleanup. Probably move these flags into a gc/z/c2
>> directory.
>> Cheers,
>> StefanK

More information about the zgc-dev mailing list