Accommodate changes in Java 15 object layout #2057
Labels
area/java9
This belongs to the java9 compatibility theme
area/performance
This belongs to the performance theme
type/enhancement
A general enhancement
Milestone
The way fields are laid out is changing in Java 15, allowing fields from a sub-class to be stored in the unused space of a super-class's field (and breaking the assumption that fields of a sub-class are always laid out after all the fields of the super class).
See https://bugs.openjdk.java.net/browse/JDK-8237767
This can have an impact on the low-level classes that introduce artificial padding to avoid false sharing, like
QueueDrainSubscriber
or most classes in thereactor.util.concurrent
package.Note that the behavior in question can be manually disabled using a new VM option
-XX:-UseEmptySlotsInSupers
.@Contested
isn't an option as of JDK 9 due to itssun.misc
nature.The only current durable solution on our side to ensure no false sharing seems to be using the inheritance of padding classes trick, but with
boolean
padding fields instead oflong
. This is because on aboolean
, you cannot have "unused" space, as the smallest boolean takes as much space as the largest.The text was updated successfully, but these errors were encountered: