From ab39b18a78863d9994108bfbe03a95be63728b0b Mon Sep 17 00:00:00 2001 From: Julien Ponge Date: Fri, 26 Jan 2024 15:28:05 +0100 Subject: [PATCH] Simplify Netty unsafe build item configuration for the shaded JCTools queues GraalVM now seems to have good heuristics to spot the classic Unsafe usage patterns. I removed some UnsafeAccessedFieldBuildItem and added one for UnsafeRefArrayAccess as this class has a problematic static field (REF_ELEMENT_SHIFT). For there record I found about this while working on https://github.com/smallrye/smallrye-mutiny/pull/1434 --- .../netty/deployment/NettyProcessor.java | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java index 11801f0547d60..bb5370075c04c 100644 --- a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java +++ b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java @@ -254,23 +254,8 @@ public List unsafeAccessedFields() { return Arrays.asList( new UnsafeAccessedFieldBuildItem("sun.nio.ch.SelectorImpl", "selectedKeys"), new UnsafeAccessedFieldBuildItem("sun.nio.ch.SelectorImpl", "publicSelectedKeys"), - - new UnsafeAccessedFieldBuildItem( - "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField", "producerIndex"), - new UnsafeAccessedFieldBuildItem( - "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField", "producerLimit"), - new UnsafeAccessedFieldBuildItem( - "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField", "consumerIndex"), - - new UnsafeAccessedFieldBuildItem( - "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields", - "producerIndex"), - new UnsafeAccessedFieldBuildItem( - "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields", - "producerLimit"), - new UnsafeAccessedFieldBuildItem( - "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields", - "consumerIndex")); + new UnsafeAccessedFieldBuildItem("io.netty.util.internal.shaded.org.jctools.util.UnsafeRefArrayAccess", + "REF_ELEMENT_SHIFT")); } @BuildStep