JDK-8228750 : Deprecate product flag -XX:CompactFields
  • Type: CSR
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 14
  • Submitted: 2019-07-29
  • Updated: 2019-08-15
  • Resolved: 2019-08-05
Related Reports
CSR :  
Description
Summary
-------

Deprecate the option -XX:CompactFields.  By default it is true, and setting to false will not lead to better performance or any observable benefits.

Problem
-------

Flags allowing users to affect the layout of fields in Java classes give users unwelcome control over internal implementation details.  This option causes fields smaller than long/double to be packed in the gap before the first long/double field in an object.  There are no reasonable use cases to not do this.  With @contended, padding can be added to prevent false sharing, if needed.

Deprecating and removing this option will allow for efficient implementation of inline types for valhalla.

Solution
--------

Deprecate the option and continue affect layout with the option.

Users will now get the following message when running: 'java -XX:+CompactFields ...'

Java HotSpot(TM) 64-Bit Server VM warning: Option CompactFields was deprecated in version 14.0 and will likely be removed in a future release.

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

Deprecate the -XX:CompactFields option in JDK-14 and issue the above warning message when the option is used.


Comments
Approving the deprecation.
05-08-2019

I agree with deprecating CompactFields product flag.
30-07-2019

I'd like to skip the deprecation step and make this option obsolete. This means we would accept the option with a warning, only it has no effect.
29-07-2019