Skip to content

Commit

Permalink
[GR-50942] Update labsjdk to 23+14-jvmci-b01
Browse files Browse the repository at this point in the history
PullRequest: graal/17274
  • Loading branch information
OracleLabsAutomation authored and zapster committed Mar 20, 2024
2 parents 3fbd6f8 + 94743b8 commit fa877ae
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 63 deletions.
14 changes: 7 additions & 7 deletions common.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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); }
Expand Down Expand Up @@ -313,17 +322,13 @@ void run(Callable<?> c, Runnable sameResultAction, Runnable changeResultAction)
/**
* Tests this sequence:
*
* <pre>
* 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)}
* </pre>
* <ol>
* <li>{@code res1 = c()}</li>
* <li>Compile c.</li>
* <li>Change stable array element read by c.</li>
* <li>{@code res2 = c()}</li>
* <li>{@code assert Objects.equals(res1, res2)}</li>
* </ol>
*
* That is, tests that compiling a method with an unsafe read of a stable array element folds
* the element value into the compiled code.
Expand Down Expand Up @@ -363,17 +368,13 @@ void testMatchedSubInt(Callable<?> c, Runnable setDefaultAction, int nonDefaultV
/**
* Tests this sequence:
*
* <pre>
* 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)}
* </pre>
* <ol>
* <li>{@code res1 = c()}</li>
* <li>Compile c.</li>
* <li>Change stable array element read by c.</li>
* <li>{@code res2 = c()}</li>
* <li>{@code assert !Objects.equals(res1, res2)}</li>
* </ol>
*
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public final class JVMCIVersionCheck {
private static final Map<String, Map<String, Version>> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import java.util.Objects;
import java.util.function.BiFunction;

import jdk.graal.compiler.nodes.spi.TrackedUnsafeAccess;
import org.graalvm.word.LocationIdentity;

import jdk.graal.compiler.api.directives.GraalDirectives;
Expand Down Expand Up @@ -171,6 +170,7 @@
import jdk.graal.compiler.nodes.memory.address.IndexAddressNode;
import jdk.graal.compiler.nodes.spi.LoweringProvider;
import jdk.graal.compiler.nodes.spi.Replacements;
import jdk.graal.compiler.nodes.spi.TrackedUnsafeAccess;
import jdk.graal.compiler.nodes.type.StampTool;
import jdk.graal.compiler.nodes.util.ConstantFoldUtil;
import jdk.graal.compiler.nodes.util.ConstantReflectionUtil;
Expand Down Expand Up @@ -212,6 +212,7 @@
import jdk.graal.compiler.replacements.nodes.arithmetic.IntegerSubExactOverflowNode;
import jdk.graal.compiler.replacements.nodes.arithmetic.IntegerSubExactSplitNode;
import jdk.graal.compiler.replacements.nodes.arithmetic.UnsignedMulHighNode;
import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
import jdk.graal.compiler.serviceprovider.SpeculationReasonGroup;
import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.BytecodePosition;
Expand Down Expand Up @@ -559,7 +560,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()};
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -298,6 +298,10 @@ public interface CPUFeatures extends PointerBase {
@AllowNarrowingCast
@CField
boolean fAVX512_IFMA();

@AllowNarrowingCast
@CField
boolean fAVX_IFMA();
}
// Checkstyle: resume
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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()
Expand All @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ public LazyFinalReference(Supplier<T> 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")
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ typedef struct {
uint8_t fCET_SS;
uint8_t fF16C;
uint8_t fAVX512_IFMA;
uint8_t fAVX_IFMA;
} CPUFeatures;
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit fa877ae

Please sign in to comment.