JDK-8200729 : Conditional compilation of GCs
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-04-04
  • Updated: 2018-11-07
  • Resolved: 2018-05-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b13Fixed
Related Reports
Blocks :  
Blocks :  
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Today we can select two sets of GCs to include in HotSpot builds:
1) Only the Serial GC - used by the Minimal VM
2) All GCs - today this means Serial, Parallel, CMS, G1

As we are developing new GCs (ZGC and Shenandoah), and deprecating old GCs (CMS), it might be useful to select the GCs to compile into a build of HotSpot.

The RFE proposes that all occurrences of INCLUDE_ALL_GCS get replaced by either of INCLUDE_CMSGC, INCLUDE_G1GC, INCLUDE_PARALLELGC, and/or INCLUDE_SERIALGC, depending on what's appropriate for the code in question.

Our configure scripts will be changed to allow the flags --enable-cmsgc, --enable-g1gc, --enable-parallelgc, --enable-serialgc.

Some examples:

Compile with only G1:
--enable-cmsgc=no --enable-g1gc=yes --enable-parallelgc=no --enable-serialgc=no.

Stop compiling with CMS:
--enable-cmsgc=no

This compiles out PSMarkSweep
--enable-parallelgc=yes --enable-serialgc=no 

This gets a configure error since CMS requires Serial:
--enable-cmsgc=yes --enable-serialgc=no

Note this RFE is somewhat related to the recent cleanups that has been going on in both the 'JDK-8163329 - JEP 304: Garbage Collector Interface' JEP, and as separate RFEs. All that work, and future work in this area, is going to help use minimize the usages of #if INCLUDE_<GC>.

A prototype for this can be found at:
http://cr.openjdk.java.net/~stefank/8200729/prototype/webrev.01/

Currently, this patch contains the configure and INCLUDE_<GC> changes, plus work to move CG specific code out from non-GC code into the GC specific directories. As much as possible of the work to move code to GC specific files should be pushed as separate RFEs, but they help show where the direction I want to take the code.
Comments
This is nice! I'd like to discuss the implications for the build system. For instance, I think it will be clearer for both the user and the configure logic if we did something like this instead: --with-gc=g1,parallel
05-04-2018