RFR: 7903448: JMH: Override the use of compiler hints using a system property

Aleksey Shipilev shade at openjdk.org
Thu Mar 23 10:19:13 UTC 2023


On Tue, 7 Mar 2023 16:37:01 GMT, Gilles Duboscq <gdub at openjdk.org> wrote:

> Using `-Djmh.compilerhints.mode=true` will force the use of compiler hints. `-Djmh.compilerhints.mode=false` will prevent the use of compiler hints. When the system property is not set, the current beahviour based on vm name and version will be used by default.
> 
> This is especially useful when working with uncommon / rare JVMs or when adding compiler hints support to a new JVM.
> 
> I considered auto-detecting support for compiler hints but that didn't fit very well in the current code and required much more intrusive changes.

Okay, I understand the use case. But I also think that accepting a boolean as `jmh.compilerhints.mode` is ambiguous, especially if we ask questions about defaults :) It would be cleaner to do it like we do it for Blackholes:


public enum CompilerHintsMode {
   FORCE_ON("Forced on"),
   FORCE_OFF("Forced off"),
   AUTO("Automatically selected"),
}


Then parse that enum off the `jmh.compilerhints.mode`, default to `AUTO`.

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

PR Review: https://git.openjdk.org/jmh/pull/96#pullrequestreview-1354264175


More information about the jmh-dev mailing list