JDK-8085866 : There are 99 uses of FLAG_SET_ERGO, should they check the return value?
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2015-06-04
  • Updated: 2023-07-26
  • Resolved: 2023-07-26
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 22
22Resolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
There are 99 uses of FLAG_SET_ERGO in 12 files, should they check the return value like FLAG_SET_CMDLINE?

The initial assumption was that FLAG_SET_ERGO users know what they are doing, but there are bugs. Should we check the return value and assert if range/constraint is invalidated?
Comments
Maybe we should make FLAG_SET_ERGO return "void" after JDK-8224980 is fixed. I am not sure if there's a specification about what the caller should do in response to different return values.
26-07-2023

FLAG_SET_ERGO is changed to return (void) in JDK-8224980, so there's no return value to check anymore. If an invalid value is passed to FLAG_SET_ERGO, the VM will assert.
26-07-2023

The change for JDK-8224980 fixes this silently ignoring errors in FLAG_SET_ERGO problem. There's no reason to check the return value and it'll just be noise. Since we call FLAG_SET_ERGO internally, the fatal assert is fine. Closing as WNF.
14-07-2023