JDK-8205109 : Fail immediately if an unavailable GC is selected
  • Type: CSR
  • Component: hotspot
  • Sub-Component: gc
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11
  • Submitted: 2018-06-15
  • Updated: 2018-06-19
  • Resolved: 2018-06-18
Related Reports
CSR :  
Description
Summary
-------

To avoid unexpected behavior, fail immediately if an unavailable GC is selected by the user on the command line.


Problem
-------

If an unavailable GC (e.g. the G1 GC is not present in "minimal" VM builds) is selected by the user on the command line, then the VM issues a warning and continues execution by silently selecting a different/available GC. It's easy to miss the warning and this behavior is bound to cause unnecessary confusion. I propose that we instead fail immediately with an appropriate error message.

This has not been a very big problem so far (essentially only affecting minimal VMs). However, we've recently made it possible to configure which GCs to included/exclude in a VM (using the `--with-jvm-features=cmsgc/epsilongc/g1gc/parallelgc/serialgc/zgc` option). Some of these GCs are also "experimental" and some vendors might choose to build them and some might choose not to. As a result, it might become more common to see VMs with different sets of supported GCs built in.


Solution
--------

Instead of silently selecting one of the available GCs, fail immediately with an appropriate error message. E.g. "Option -XX:+UseG1GC not supported".


Specification
-------------

I'm essentially suggesting changing a call to:

 `warning("....");`

to instead be a call to:

`vm_exit_during_initialization(".....");`.

Webrev: http://cr.openjdk.java.net/~pliden/8205064/webrev.1/

Comments
Approved contingent on a release note being created for this change in behavior.
18-06-2018