From 24f5d3f0aa252bec344432efd6434333d9fa28b9 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Mon, 11 Mar 2024 21:23:41 +0100 Subject: [PATCH 1/5] svm: adopt "JDK-8325991: Accelerate Poly1305 on x86_64 using AVX2 instructions" --- .../com/oracle/svm/core/amd64/AMD64LibCHelper.java | 6 +++++- .../include/amd64hotspotcpuinfo.h | 14 +++++++++++++- .../com.oracle.svm.native.libchelper/src/cpuid.c | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/amd64/AMD64LibCHelper.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/amd64/AMD64LibCHelper.java index 78fbddc017a2..5f50f2fc8310 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/amd64/AMD64LibCHelper.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/amd64/AMD64LibCHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -298,6 +298,10 @@ public interface CPUFeatures extends PointerBase { @AllowNarrowingCast @CField boolean fAVX512_IFMA(); + + @AllowNarrowingCast + @CField + boolean fAVX_IFMA(); } // Checkstyle: resume } diff --git a/substratevm/src/com.oracle.svm.native.libchelper/include/amd64hotspotcpuinfo.h b/substratevm/src/com.oracle.svm.native.libchelper/include/amd64hotspotcpuinfo.h index ac7d2cc7c505..83c9c1dba88f 100644 --- a/substratevm/src/com.oracle.svm.native.libchelper/include/amd64hotspotcpuinfo.h +++ b/substratevm/src/com.oracle.svm.native.libchelper/include/amd64hotspotcpuinfo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -271,6 +271,16 @@ typedef union { } bits; } SefCpuid7Edx; +typedef union { + uint32_t value; + struct { + uint32_t : 23, + avx_ifma : 1, + : 8; + } bits; +} SefCpuid7Ecx1Eax; + + typedef union { uint32_t value; struct { @@ -325,6 +335,8 @@ typedef struct { SefCpuid7Ebx sef_cpuid7_ebx; SefCpuid7Ecx sef_cpuid7_ecx; SefCpuid7Edx sef_cpuid7_edx; + // ECX = 1 before calling cpuid() + SefCpuid7Ecx1Eax sef_cpuid7_ecx1_eax; // cpuid function 0xB (processor topology) // ecx = 0 diff --git a/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c b/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c index 1ae435454f44..788cbd597fe4 100644 --- a/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c +++ b/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it From 788e8edb0ec60ffeaa30b8100e7baa3cc52b7fae Mon Sep 17 00:00:00 2001 From: Tom Shull Date: Tue, 12 Mar 2024 16:50:45 +0100 Subject: [PATCH 2/5] additional logic for avx ifma feature detection. --- .../include/amd64cpufeatures.h | 1 + .../com.oracle.svm.native.libchelper/src/cpuid.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/substratevm/src/com.oracle.svm.native.libchelper/include/amd64cpufeatures.h b/substratevm/src/com.oracle.svm.native.libchelper/include/amd64cpufeatures.h index 7acd85f69515..f0812b7ebe4d 100644 --- a/substratevm/src/com.oracle.svm.native.libchelper/include/amd64cpufeatures.h +++ b/substratevm/src/com.oracle.svm.native.libchelper/include/amd64cpufeatures.h @@ -85,4 +85,5 @@ typedef struct { uint8_t fCET_SS; uint8_t fF16C; uint8_t fAVX512_IFMA; + uint8_t fAVX_IFMA; } CPUFeatures; diff --git a/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c b/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c index 788cbd597fe4..2f1f40e08371 100644 --- a/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c +++ b/substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c @@ -67,6 +67,10 @@ int get_cpuid (unsigned int leaf, unsigned int *eax, unsigned int *ebx, unsigned return (get_cpuid_count(leaf, 0, eax, ebx, ecx, edx)); } +int get_cpuid_ecx_1 (unsigned int leaf, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { + return (get_cpuid_count(leaf, 1, eax, ebx, ecx, edx)); +} + #else #include @@ -105,6 +109,10 @@ int get_cpuid (unsigned int leaf, unsigned int *eax, unsigned int *ebx, unsigned return (get_cpuid_count(leaf, 0, eax, ebx, ecx, edx)); } +int get_cpuid_ecx_1 (unsigned int leaf, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { + return (get_cpuid_count(leaf, 1, eax, ebx, ecx, edx)); +} + #endif static uint32_t extended_cpu_model(CpuidInfo *_cpuid_info) { @@ -301,6 +309,9 @@ static void initialize_cpuinfo(CpuidInfo *_cpuid_info) _cpuid_info->sef_cpuid7_ebx.value = ebx; _cpuid_info->sef_cpuid7_ecx.value = ecx; _cpuid_info->sef_cpuid7_edx.value = edx; + + get_cpuid_ecx_1(7, &eax, &ebx, &ecx, &edx); + _cpuid_info->sef_cpuid7_ecx1_eax.value = eax; } // topology @@ -430,6 +441,8 @@ NO_INLINE static void set_cpufeatures(CPUFeatures *features, CpuidInfo *_cpuid_i features->fF16C = 1; if (_cpuid_info->sef_cpuid7_ebx.bits.avx2 != 0) features->fAVX2 = 1; + if (_cpuid_info->sef_cpuid7_ecx1_eax.bits.avx_ifma != 0) + features->fAVX_IFMA = 1; if (_cpuid_info->sef_cpuid7_ebx.bits.avx512f != 0 && _cpuid_info->xem_xcr0_eax.bits.opmask != 0 && _cpuid_info->xem_xcr0_eax.bits.zmm512 != 0 && From bb42c5ddfe5ff6ac71156c53edaa2c6c3131418b Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Wed, 13 Mar 2024 11:21:06 +0100 Subject: [PATCH 3/5] adopt "JDK-8327729: Remove deprecated xxxObject methods from jdk.internal.misc.Unsafe" --- .../core/test/ReadConstantFoldingTest.java | 2 +- .../test/UnsafeGetStableArrayElement.java | 47 ++++++++++--------- .../test/UnsafeObjectReplacementsTest.java | 20 ++++---- .../StandardGraphBuilderPlugins.java | 6 +++ .../svm/core/handles/ObjectHandlesImpl.java | 12 ++--- .../svm/core/jdk/UninterruptibleUtils.java | 4 +- .../monitor/MultiThreadedMonitorSupport.java | 2 +- .../oracle/svm/core/thread/ThreadData.java | 4 +- .../svm/core/util/LazyFinalReference.java | 8 ++-- 9 files changed, 56 insertions(+), 49 deletions(-) diff --git a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ReadConstantFoldingTest.java b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ReadConstantFoldingTest.java index 793693075532..9f9528b7996d 100644 --- a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ReadConstantFoldingTest.java +++ b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ReadConstantFoldingTest.java @@ -308,7 +308,7 @@ private static double getDouble(Object object, long offset) { } private static Object getObject(Object object, long offset) { - return U.getObject(object, offset); + return U.getReference(object, offset); } public boolean readBooleanFromBooleanCastBoolean() { diff --git a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/UnsafeGetStableArrayElement.java b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/UnsafeGetStableArrayElement.java index 6e8368ea3e5f..f49a7c836e3f 100644 --- a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/UnsafeGetStableArrayElement.java +++ b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/UnsafeGetStableArrayElement.java @@ -87,6 +87,15 @@ public class UnsafeGetStableArrayElement extends GraalCompilerTest { STABLE_CHAR_ARRAY[1] = 0x10; STABLE_BOOLEAN_ARRAY[1] = true; Setter.reset(); + + // Ensure boxing caches are initialized + Byte.valueOf((byte)0); + Short.valueOf((short)0); + Character.valueOf('0'); + Integer.valueOf(0); + Long.valueOf(0); + Float.valueOf(0.0F); + Double.valueOf(0.0F); } static final Unsafe U = Unsafe.getUnsafe(); @@ -211,7 +220,7 @@ static class Test { static double testD_D() { return U.getDouble( STABLE_DOUBLE_ARRAY, ARRAY_DOUBLE_BASE_OFFSET); } @SuppressWarnings("removal") - static Object testL_L() { return U.getObject( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } + static Object testL_L() { return U.getReference(STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static boolean testL_Z() { return U.getBoolean(STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static byte testL_B() { return U.getByte( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } static short testL_S() { return U.getShort( STABLE_OBJECT_ARRAY, ARRAY_OBJECT_BASE_OFFSET); } @@ -313,17 +322,13 @@ void run(Callable c, Runnable sameResultAction, Runnable changeResultAction) /** * Tests this sequence: * - *
-     * 1. {@code
-     * res1 = c()
-     * }
-     * 2. Compile c.
-     * 3. Change stable array element read by c.
-     * 4. {@code
-     * res2 = c()
-     * }
-     * 5. {@code assert Objects.equals(res1, res2)}
-     * 
+ *
    + *
  1. {@code res1 = c()}
  2. + *
  3. Compile c.
  4. + *
  5. Change stable array element read by c.
  6. + *
  7. {@code res2 = c()}
  8. + *
  9. {@code assert Objects.equals(res1, res2)}
  10. + *
* * That is, tests that compiling a method with an unsafe read of a stable array element folds * the element value into the compiled code. @@ -363,17 +368,13 @@ void testMatchedSubInt(Callable c, Runnable setDefaultAction, int nonDefaultV /** * Tests this sequence: * - *
-     * 1. {@code
-     * res1 = c()
-     * }
-     * 2. Compile c.
-     * 3. Change stable array element read by c.
-     * 4. {@code
-     * res2 = c()
-     * }
-     * 5. {@code assert !Objects.equals(res1, res2)}
-     * 
+ *
    + *
  1. {@code res1 = c()}
  2. + *
  3. Compile c.
  4. + *
  5. Change stable array element read by c.
  6. + *
  7. {@code res2 = c()}
  8. + *
  9. {@code assert !Objects.equals(res1, res2)}
  10. + *
* * That is, tests that compiling a method with an unsafe read of a stable array element does not * fold the element value into the compiled code. diff --git a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/replacements/test/UnsafeObjectReplacementsTest.java b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/replacements/test/UnsafeObjectReplacementsTest.java index 0027661876a9..1cfefda2bc0e 100644 --- a/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/replacements/test/UnsafeObjectReplacementsTest.java +++ b/compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/replacements/test/UnsafeObjectReplacementsTest.java @@ -71,38 +71,38 @@ public static class Container { static class Methods { public static Object unsafeGetPutObject() { Container container = new Container(); - unsafe.putObject(container, objectOffset, "Hello there"); - return unsafe.getObject(container, objectOffset); + unsafe.putReference(container, objectOffset, "Hello there"); + return unsafe.getReference(container, objectOffset); } public static Object unsafeGetPutObjectOpaque() { Container container = new Container(); - unsafe.putObjectOpaque(container, objectOffset, "Hello there"); - return unsafe.getObjectOpaque(container, objectOffset); + unsafe.putReferenceOpaque(container, objectOffset, "Hello there"); + return unsafe.getReferenceOpaque(container, objectOffset); } public static Object unsafeGetPutObjectRA() { Container container = new Container(); - unsafe.putObjectRelease(container, objectOffset, "Hello there"); - return unsafe.getObjectAcquire(container, objectOffset); + unsafe.putReferenceRelease(container, objectOffset, "Hello there"); + return unsafe.getReferenceAcquire(container, objectOffset); } public static Object unsafeGetPutObjectVolatile() { Container container = new Container(); - unsafe.putObjectVolatile(container, objectOffset, "Hello there"); - return unsafe.getObjectVolatile(container, objectOffset); + unsafe.putReferenceVolatile(container, objectOffset, "Hello there"); + return unsafe.getReferenceVolatile(container, objectOffset); } public static Object unsafeCompareAndExchangeObject() { Container container = new Container(); - return unsafe.compareAndExchangeObject(container, objectOffset, dummyValue, newDummyValue); + return unsafe.compareAndExchangeReference(container, objectOffset, dummyValue, newDummyValue); } public static Object unsafeGetAndSetObject() { Container container = new Container(); container.objectField = null; Container other = new Container(); - return unsafe.getAndSetObject(container, objectOffset, other); + return unsafe.getAndSetReference(container, objectOffset, other); } } diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/StandardGraphBuilderPlugins.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/StandardGraphBuilderPlugins.java index 5fe16c068cc4..a90d19cf88f5 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/StandardGraphBuilderPlugins.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/replacements/StandardGraphBuilderPlugins.java @@ -49,6 +49,7 @@ import java.util.Objects; import java.util.function.BiFunction; +import jdk.graal.compiler.serviceprovider.JavaVersionUtil; import org.graalvm.word.LocationIdentity; import jdk.graal.compiler.api.directives.GraalDirectives; @@ -558,7 +559,12 @@ private static String[] getKindNames(boolean isSunMiscUnsafe, JavaKind kind) { * "Object" to "Reference", but kept the "Object" version as deprecated. We want to * intrinsify both variants, to avoid problems with Uninterruptible methods in Native * Image. + * + * As of JDK-8327729 (resolved in JDK 23), the "Object" versions have been removed. */ + if (JavaVersionUtil.JAVA_SPEC >= 23) { + return new String[]{"Reference"}; + } return new String[]{"Object", "Reference"}; } else { return new String[]{kind.name()}; diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/handles/ObjectHandlesImpl.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/handles/ObjectHandlesImpl.java index eb22f645ea6c..259bb3068b16 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/handles/ObjectHandlesImpl.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/handles/ObjectHandlesImpl.java @@ -132,7 +132,7 @@ private Object[] getBucket(int bucketIndex) { // buckets[i] is changed only once from null to its final value: try without volatile first Object[] bucket = buckets[bucketIndex]; if (bucket == null) { - bucket = (Object[]) Unsafe.getUnsafe().getObjectVolatile(buckets, getObjectArrayByteOffset(bucketIndex)); + bucket = (Object[]) Unsafe.getUnsafe().getReferenceVolatile(buckets, getObjectArrayByteOffset(bucketIndex)); } return bucket; } @@ -161,7 +161,7 @@ public ObjectHandle create(Object obj) { for (;;) { while (indexInBucket < bucket.length) { if (bucket[indexInBucket] == null) { - if (Unsafe.getUnsafe().compareAndSetObject(bucket, getObjectArrayByteOffset(indexInBucket), null, obj)) { + if (Unsafe.getUnsafe().compareAndSetReference(bucket, getObjectArrayByteOffset(indexInBucket), null, obj)) { int newSearchIndexInBucket = (indexInBucket + 1 < bucket.length) ? (indexInBucket + 1) : indexInBucket; unusedHandleSearchIndex = toIndex(bucketIndex, newSearchIndexInBucket); // (if the next index is in another bucket, we let the next create() @@ -188,8 +188,8 @@ public ObjectHandle create(Object obj) { newBucketCapacity = getIndexInBucket(maxIndex) + 1; } Object[] newBucket = new Object[newBucketCapacity]; - Unsafe.getUnsafe().putObjectVolatile(newBucket, getObjectArrayByteOffset(0), obj); - if (Unsafe.getUnsafe().compareAndSetObject(buckets, getObjectArrayByteOffset(newBucketIndex), null, newBucket)) { + Unsafe.getUnsafe().putReferenceVolatile(newBucket, getObjectArrayByteOffset(0), obj); + if (Unsafe.getUnsafe().compareAndSetReference(buckets, getObjectArrayByteOffset(newBucketIndex), null, newBucket)) { unusedHandleSearchIndex = toIndex(newBucketIndex, 1); return toHandle(newBucketIndex, 0); } @@ -237,7 +237,7 @@ private Object doGet(ObjectHandle handle) { throw new IllegalArgumentException("Invalid handle"); } int indexInBucket = getIndexInBucket(index); - return Unsafe.getUnsafe().getObjectVolatile(bucket, getObjectArrayByteOffset(indexInBucket)); + return Unsafe.getUnsafe().getReferenceVolatile(bucket, getObjectArrayByteOffset(indexInBucket)); } public boolean isWeak(ObjectHandle handle) { @@ -258,7 +258,7 @@ public void destroy(ObjectHandle handle) { throw new IllegalArgumentException("Invalid handle"); } int indexInBucket = getIndexInBucket(index); - Unsafe.getUnsafe().putObjectRelease(bucket, getObjectArrayByteOffset(indexInBucket), null); + Unsafe.getUnsafe().putReferenceRelease(bucket, getObjectArrayByteOffset(indexInBucket), null); } public void destroyWeak(ObjectHandle handle) { diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/UninterruptibleUtils.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/UninterruptibleUtils.java index 2645c1f7cab0..dc09522f592a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/UninterruptibleUtils.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/UninterruptibleUtils.java @@ -391,13 +391,13 @@ public void set(T newValue) { @Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true) public boolean compareAndSet(T expected, T update) { - return UNSAFE.compareAndSetObject(this, VALUE_OFFSET, expected, update); + return UNSAFE.compareAndSetReference(this, VALUE_OFFSET, expected, update); } @Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true) @SuppressWarnings("unchecked") public final T getAndSet(T newValue) { - return (T) UNSAFE.getAndSetObject(this, VALUE_OFFSET, newValue); + return (T) UNSAFE.getAndSetReference(this, VALUE_OFFSET, newValue); } } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/monitor/MultiThreadedMonitorSupport.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/monitor/MultiThreadedMonitorSupport.java index bd477fb4ae6d..387ccfeee58c 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/monitor/MultiThreadedMonitorSupport.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/monitor/MultiThreadedMonitorSupport.java @@ -468,7 +468,7 @@ protected JavaMonitor getOrCreateMonitorFromObject(Object obj, boolean createIfN long startTicks = JfrTicks.elapsedTicks(); /* Atomically put a new lock in place of the null at the monitorOffset. */ JavaMonitor newMonitor = newMonitorLock(); - if (UNSAFE.compareAndSetObject(obj, monitorOffset, null, newMonitor)) { + if (UNSAFE.compareAndSetReference(obj, monitorOffset, null, newMonitor)) { JavaMonitorInflateEvent.emit(obj, startTicks, cause); return newMonitor; } diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ThreadData.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ThreadData.java index 24dec1244287..29cb44bf846f 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ThreadData.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/ThreadData.java @@ -178,10 +178,10 @@ private void initializeParker(long offset, boolean isSleepEvent) { private boolean tryToStoreParker(long offset, Parker newEvent) { JavaSpinLockUtils.lockNoTransition(this, LOCK_OFFSET); try { - if (U.getObject(this, offset) != null) { + if (U.getReference(this, offset) != null) { return false; } - U.putObjectVolatile(this, offset, newEvent); + U.putReferenceVolatile(this, offset, newEvent); return true; } finally { JavaSpinLockUtils.unlock(this, LOCK_OFFSET); diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/util/LazyFinalReference.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/util/LazyFinalReference.java index 5f2a049f9eb2..19bacbeaac2b 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/util/LazyFinalReference.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/util/LazyFinalReference.java @@ -58,7 +58,7 @@ public LazyFinalReference(Supplier supplier) { } public boolean isPresent() { - return value != UNINITIALIZED || Unsafe.getUnsafe().getObjectVolatile(this, VALUE_OFFSET) != UNINITIALIZED; + return value != UNINITIALIZED || Unsafe.getUnsafe().getReferenceVolatile(this, VALUE_OFFSET) != UNINITIALIZED; } @SuppressWarnings("unchecked") @@ -66,14 +66,14 @@ public T get() { T v = value; if (v == UNINITIALIZED) { // Try volatile read first in case of memory inconsistency to avoid Supplier call - v = (T) Unsafe.getUnsafe().getObjectVolatile(this, VALUE_OFFSET); + v = (T) Unsafe.getUnsafe().getReferenceVolatile(this, VALUE_OFFSET); if (v == UNINITIALIZED) { T obj = supplier.get(); - if (Unsafe.getUnsafe().compareAndSetObject(this, VALUE_OFFSET, UNINITIALIZED, obj)) { + if (Unsafe.getUnsafe().compareAndSetReference(this, VALUE_OFFSET, UNINITIALIZED, obj)) { v = obj; } else { - v = (T) Unsafe.getUnsafe().getObjectVolatile(this, VALUE_OFFSET); + v = (T) Unsafe.getUnsafe().getReferenceVolatile(this, VALUE_OFFSET); } assert v != UNINITIALIZED; } From b1a34d6b84dec5a64eb178afbd2d3404b6d134a2 Mon Sep 17 00:00:00 2001 From: ol-automation_ww Date: Thu, 14 Mar 2024 17:53:36 +0000 Subject: [PATCH 4/5] update JVMCI to 23+14-jvmci-b01 --- common.json | 14 +++++++------- .../graal/compiler/hotspot/JVMCIVersionCheck.java | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common.json b/common.json index 7f23ab6a9765..9386f3d21f9b 100644 --- a/common.json +++ b/common.json @@ -44,13 +44,13 @@ "labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33-debug", "platformspecific": true }, "labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21.0.2+13-jvmci-23.1-b33-sulong", "platformspecific": true }, - "oraclejdk-latest": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+13", "platformspecific": true, "extrabundles": ["static-libs"]}, - "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-23+13-jvmci-b01", "platformspecific": true }, - "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-23+13-jvmci-b01-debug", "platformspecific": true }, - "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-23+13-jvmci-b01-sulong", "platformspecific": true }, - "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-23+13-jvmci-b01", "platformspecific": true }, - "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-23+13-jvmci-b01-debug", "platformspecific": true }, - "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-23+13-jvmci-b01-sulong", "platformspecific": true } + "oraclejdk-latest": {"name": "jpg-jdk", "version": "23", "build_id": "jdk-23+14", "platformspecific": true, "extrabundles": ["static-libs"]}, + "labsjdk-ce-latest": {"name": "labsjdk", "version": "ce-23+14-jvmci-b01", "platformspecific": true }, + "labsjdk-ce-latestDebug": {"name": "labsjdk", "version": "ce-23+14-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ce-latest-llvm": {"name": "labsjdk", "version": "ce-23+14-jvmci-b01-sulong", "platformspecific": true }, + "labsjdk-ee-latest": {"name": "labsjdk", "version": "ee-23+14-jvmci-b01", "platformspecific": true }, + "labsjdk-ee-latestDebug": {"name": "labsjdk", "version": "ee-23+14-jvmci-b01-debug", "platformspecific": true }, + "labsjdk-ee-latest-llvm": {"name": "labsjdk", "version": "ee-23+14-jvmci-b01-sulong", "platformspecific": true } }, "eclipse": { diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java index 21be61dabb75..976e8dcfcab1 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/JVMCIVersionCheck.java @@ -54,8 +54,8 @@ public final class JVMCIVersionCheck { private static final Map> JVMCI_MIN_VERSIONS = Map.of( "21", Map.of(DEFAULT_VENDOR_ENTRY, new Version(23, 1, 33)), "23", Map.of( - "Oracle Corporation", new Version("23+13", 1), - DEFAULT_VENDOR_ENTRY, new Version("23+13", 1))); + "Oracle Corporation", new Version("23+14", 1), + DEFAULT_VENDOR_ENTRY, new Version("23+14", 1))); private static final int NA = 0; /** * Minimum Java release supported by Graal. From 94743b86329f15361237ede9befaa18353f6ff72 Mon Sep 17 00:00:00 2001 From: Josef Eisl Date: Fri, 15 Mar 2024 12:18:29 +0100 Subject: [PATCH 5/5] svm: update AMD64LibCHelper @BasedOnJDKFile annotation (JDK-8325991) JDK-8325991: Accelerate Poly1305 on x86_64 using AVX2 instructions --- .../src/com/oracle/svm/core/amd64/AMD64LibCHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/amd64/AMD64LibCHelper.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/amd64/AMD64LibCHelper.java index 5f50f2fc8310..80dd89604edf 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/amd64/AMD64LibCHelper.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/amd64/AMD64LibCHelper.java @@ -43,7 +43,7 @@ * - substratevm/src/com.oracle.svm.native.libchelper/include/amd64hotspotcpuinfo.h * - substratevm/src/com.oracle.svm.native.libchelper/src/cpuid.c */ -@BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-23+10/src/hotspot/cpu/x86/vm_version_x86.hpp#L40-L304") +@BasedOnJDKFile("https://github.com/openjdk/jdk/blob/jdk-23+14/src/hotspot/cpu/x86/vm_version_x86.hpp#L40-L313") @CLibrary(value = "libchelper", requireStatic = true) public class AMD64LibCHelper { @Platforms(Platform.AMD64.class)