Summary
-------
Add an experimental flag -XX:[+|-]UseCompactObjectHeaders that enables compact object headers.
Problem
-------
Compact Object Headers (JDK-8294992) implement a new, smaller object header layout, which significantly reduces memory requirements of Java applications running in the HotSpot JVM. In order to provide extra safety in the evolution of the HotSpot JVM, the new header layout should be guarded by an experimental flag, and the existing header layout retained when that flag is turned off.
Solution
--------
Add an experimental flag -XX:[+|-]CompactObjectHeaders, which is off by default. By enabling the feature, users can benefit from reduced memory requirements for their Java applications. When the flag is turned off, the existing legacy header layout is used. We plan to enable the flag by default in a future release once we are sufficiently confident in its stability, feature completeness, and benefits. Eventually, in an even more distant release, the flag will get removed, together with the legacy implementation.
Specification
-------------
```
diff a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -123,14 +123,17 @@
\
product(bool, UseCompressedOops, false, \
"Use 32-bit object references in 64-bit VM. " \
"lp64_product means flag is always constant in 32 bit VM") \
\
product(bool, UseCompressedClassPointers, false, \
"Use 32-bit class pointers in 64-bit VM. " \
"lp64_product means flag is always constant in 32 bit VM") \
\
+ product(bool, UseCompactObjectHeaders, false, EXPERIMENTAL, \
+ "Use compact 64-bit object headers in 64-bit VM") \
+ \
product(int, ObjectAlignmentInBytes, 8, \
"Default object alignment in bytes, 8 is minimum") \
range(8, 256) \
constraint(ObjectAlignmentInBytesConstraintFunc, AtParse)
```