JDK-8317784 : -XX:+PrintFlagsFinal prints wrong value for EnableVectorReboxing
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21,22
  • Priority: P5
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2023-10-10
  • Updated: 2023-11-10
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.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
$> myjava --add-modules=jdk.incubator.vector -XX:+UnlockExperimentalVMOptions -XX:+EnableVectorSupport -XX:+PrintFlagsFinal -version | grep "EnableVectorReboxing"
     bool EnableVectorReboxing                     = false                             {C2 experimental} {default}
WARNING: Using incubator modules: jdk.incubator.vector
openjdk version "21-internal" 2023-09-19
OpenJDK Runtime Environment (fastdebug build 21-internal-git-d67bfe21a23)
OpenJDK 64-Bit Server VM (fastdebug build 21-internal-git-d67bfe21a23, mixed mode, sharing)

PrintFlagsFinal prints false for EnableVectorReboxing, which actually is true during runtime. It is changed at https://github.com/openjdk/jdk/blob/49ff52087be8b95cbf369518281312ecc9d83618/src/hotspot/share/classfile/modules.cpp#L463 . 
Comments
[~psandoz] Do you think we should disable this unusual usage of setting VM flags now?
10-11-2023

We have been enabling -XX:+EnableVectorSupport in develop and testing since --add-modules=jdk.incubator.vector enables it always. JDK-8319764 is bug when using -XX:-EnableVectorSupport. That blocks this issue.
10-11-2023

VM flags should not behave this way. Having VM flags tied to JDK modules being loaded is not the norm.
07-11-2023

Since "--add-modules" is not the only way loading modules, which can also be loaded during runtime, that means these four flags EnableVectorSupport, EnableVectorReboxing, EnableVectorAggressiveReboxing and UseVectorStubs can be changed at runtime as well. That's weird. I'm not sure if there is any other flag has the same behavior.
06-11-2023

The flag logic in modules.cpp is in the wrong place. VM flags should hit their final values before the end of VM initialization, but that logic will only be executed when the jdk.incubator.vector module is loaded. That is after PrintFlagsFinal prints the flags.
16-10-2023

ILW = Incorrect flag value reported by PrintFlagsFinal, single flag, no workaround = LLH = P5
10-10-2023