RFR: 8224980: FLAG_SET_ERGO silently ignores invalid values

David Holmes dholmes at openjdk.org
Tue Feb 14 04:53:39 UTC 2023


On Tue, 14 Feb 2023 04:03:36 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> Clarify the `FLAG_SET_ERGO` API - the caller must ensure that a valid value is passed. Added an assert to check this.
> 
> Fixed two issues found by the assert:
> 
> - `NonNMethodCodeHeapSize`
> - `XXXThreshold` and `XXXNotifyFreqLog` flags in `CompilerConfig::set_compilation_policy_flags()`

src/hotspot/share/runtime/flags/jvmFlagAccess.cpp line 70:

> 68:       if (err != JVMFlag::SUCCESS) {
> 69:         if (origin == JVMFlagOrigin::ERGONOMIC) {
> 70:           fatal("FLAG_SET_ERGO cannot be used to set an invalid value for %s", flag->name());

This would be okay if we are guaranteed to see the `printError` message from the constraint function, but I don't think we are. If I'm reading things correctly we need `verbose` to be true to get the error message, but `verbose` comes from `AtParse` which seems to be set to 0 and never modified. ??
I think we need to force `verbose` to be true if `origin == JVMFlagOrigin::ERGONOMIC)`.

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

PR: https://git.openjdk.org/jdk/pull/12549


More information about the hotspot-dev mailing list