Closed franz1981 closed 5 months ago
https://github.com/eclipse-vertx/vert.x/blob/d21c6b5b6a9e2cb02110769fa635958fc2bccb34/src/main/java/io/vertx/core/spi/context/storage/AccessMode.java#L27 in theory is used on the CONCURRENT instance which is stored in a static final-like (in term of semantic) field within AccessMode, but still IDK if the JIT trust transitively the final fields within the CONCURRENT class, so, this can cause a severe performance penalty while using its VarHandle.
CONCURRENT
AccessMode
VarHandle
It means it would be better to have a JMH benchmark to prove that everything it's fine there OR at just move VarHandle LOCALS_UPDATER into some proper static final declaration. See https://shipilev.net/jvm/anatomy-quarks/17-trust-nonstatic-final-fields/#_observations which is indeed related VarHandle.
VarHandle LOCALS_UPDATER
https://github.com/eclipse-vertx/vert.x/blob/d21c6b5b6a9e2cb02110769fa635958fc2bccb34/src/main/java/io/vertx/core/spi/context/storage/AccessMode.java#L27 in theory is used on the
CONCURRENT
instance which is stored in a static final-like (in term of semantic) field withinAccessMode
, but still IDK if the JIT trust transitively the final fields within theCONCURRENT
class, so, this can cause a severe performance penalty while using itsVarHandle
.It means it would be better to have a JMH benchmark to prove that everything it's fine there OR at just move
VarHandle LOCALS_UPDATER
into some proper static final declaration. See https://shipilev.net/jvm/anatomy-quarks/17-trust-nonstatic-final-fields/#_observations which is indeed relatedVarHandle
.