Karm / mandrel-integration-tests

Integration tests for GraalVM and its Mandrel distribution. Runs Quarkus, Helidon and Micronaut applications and small targeted reproducers. The focus is solely on native-image utility and compilation of Java applications into native executables.
Apache License 2.0
5 stars 3 forks source link

Warning about netty's shaded jctools' usage of Unsafe #260

Closed jerboaa closed 2 weeks ago

jerboaa commented 2 weeks ago

With recent mandrel-integration test runs we see these warnings for Mandrel for JDK 22 and Mandrel for JDK 21 and quarkus main:

Warning: RecomputeFieldValue.ArrayIndexScale automatic substitution failed. The automatic substitution registration was attempted because a call to jdk.internal.misc.Unsafe.arrayIndexScale(Class) was detected in the static initializer of io.netty.util.internal.shaded.org.jctools.util.UnsafeLongArrayAccess. Detailed failure reason(s): Could not determine the field where the value produced by the call to jdk.internal.misc.Unsafe.arrayIndexScale(Class) for the array index scale computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.

This seems concerning and needs to get investigated.

zakkak commented 2 weeks ago

The call to UnsafeAccess.UNSAFE.arrayIndexScale happens in https://github.com/JCTools/JCTools/blob/a17b56f09cc9ec7d773707578c89f3ca9c11f968/jctools-core/src/main/java/org/jctools/util/UnsafeLongArrayAccess.java#L26 and its return value is indeed not stored in any field, it's only used in the static initializer.

~The class needs to be initialized at runtime.~ Working on a Quarkus patch.

jerboaa commented 2 weeks ago

Thanks!