Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.annotate.TargetElement;
import com.oracle.svm.core.jdk.JDK21OrEarlier;
import com.oracle.svm.core.jdk.JDK22OrLater;
import com.oracle.svm.core.jdk.JDKLatest;

import jdk.internal.foreign.MemorySessionImpl;

Expand Down Expand Up @@ -68,7 +68,7 @@ static void registerNatives() {
* As one might notice, what is not supported is not creating shared arenas, but closing them.
*/
@Substitute
@TargetElement(onlyWith = JDK22OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
void closeScope0(MemorySessionImpl session, Target_jdk_internal_misc_ScopedMemoryAccess_ScopedAccessError error) {
throw unsupportedFeature("GR-52276: Arena.ofShared not supported");
}
Expand All @@ -80,6 +80,6 @@ boolean closeScope0(MemorySessionImpl session) {
}
}

@TargetClass(className = "jdk.internal.misc.ScopedMemoryAccess$ScopedAccessError", onlyWith = {JDK22OrLater.class, ForeignFunctionsEnabled.class})
@TargetClass(className = "jdk.internal.misc.ScopedMemoryAccess$ScopedAccessError", onlyWith = {JDKLatest.class, ForeignFunctionsEnabled.class})
final class Target_jdk_internal_misc_ScopedMemoryAccess_ScopedAccessError {
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@
import com.oracle.svm.core.heap.UnknownObjectField;
import com.oracle.svm.core.heap.UnknownPrimitiveField;
import com.oracle.svm.core.jdk.JDK21OrEarlier;
import com.oracle.svm.core.jdk.JDK22OrLater;
import com.oracle.svm.core.jdk.JDK23OrLater;
import com.oracle.svm.core.jdk.JDKLatest;
import com.oracle.svm.core.jdk.Resources;
import com.oracle.svm.core.meta.SharedType;
import com.oracle.svm.core.reflect.MissingReflectionRegistrationUtils;
Expand Down Expand Up @@ -1495,7 +1494,7 @@ private static Class<?> forName(String name, boolean initialize, ClassLoader loa
}

@KeepOriginal
@TargetElement(onlyWith = JDK22OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
public static native Class<?> forPrimitiveName(String primitiveName);

@KeepOriginal
Expand Down Expand Up @@ -1540,11 +1539,11 @@ public String toString() {
public native String toGenericString();

@KeepOriginal
@TargetElement(onlyWith = JDK23OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
private native void addSealingInfo(int modifiersParam, StringBuilder sb);

@KeepOriginal
@TargetElement(onlyWith = JDK23OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
private native boolean hasSealedAncestor(Class<?> clazz);

@KeepOriginal
Expand Down Expand Up @@ -1870,7 +1869,7 @@ private Class<?>[] getPermittedSubclasses0() {
private native GenericsFactory getFactory();

@KeepOriginal
@TargetElement(onlyWith = JDK22OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
native Method findMethod(boolean publicOnly, String nameParam, Class<?>... parameterTypes);

@KeepOriginal
Expand All @@ -1884,7 +1883,7 @@ private Class<?>[] getPermittedSubclasses0() {
private native Target_java_lang_PublicMethods_MethodList getMethodsRecursive(String methodName, Class<?>[] parameterTypes, boolean includeStatic);

@KeepOriginal
@TargetElement(onlyWith = JDK22OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
private native Target_java_lang_PublicMethods_MethodList getMethodsRecursive(String methodName, Class<?>[] parameterTypes, boolean includeStatic, boolean publicOnly);

@KeepOriginal
Expand Down Expand Up @@ -2137,7 +2136,7 @@ public FieldAccessor newFieldAccessor(Field field0, boolean override) {
* @see Target_jdk_internal_reflect_DirectConstructorHandleAccessor
*/
@Substitute
@TargetElement(onlyWith = JDK22OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
@Fold // cut off the alternative branch, already during analysis
static boolean useOldSerializableConstructor() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ final class Target_jdk_internal_foreign_FunctionDescriptorImpl {
final class Target_java_lang_foreign_FunctionDescriptor {
}

@TargetClass(className = "jdk.internal.foreign.SegmentFactories", onlyWith = {ForeignDisabled.class, JDK22OrLater.class})
@TargetClass(className = "jdk.internal.foreign.SegmentFactories", onlyWith = {ForeignDisabled.class, JDKLatest.class})
final class Target_jdk_internal_foreign_SegmentFactories {
@Substitute
@AlwaysInline("Make remaining code in callers unreachable.")
Expand All @@ -143,7 +143,7 @@ final class Target_jdk_internal_foreign_LayoutPath {
final class Target_java_lang_foreign_MemoryLayout_PathElement {
}

@TargetClass(className = "jdk.internal.foreign.layout.AbstractLayout", onlyWith = {ForeignDisabled.class, JDK22OrLater.class})
@TargetClass(className = "jdk.internal.foreign.layout.AbstractLayout", onlyWith = {ForeignDisabled.class, JDKLatest.class})
final class Target_jdk_internal_foreign_layout_AbstractLayout {
@Substitute
@AlwaysInline("Make remaining code in callers unreachable.")
Expand All @@ -153,7 +153,7 @@ VarHandle varHandle(Target_java_lang_foreign_MemoryLayout_PathElement... element
}

@Substitute
@TargetElement(onlyWith = JDK23OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
@SuppressWarnings({"unused", "static-method"})
VarHandle varHandleInternal(Target_java_lang_foreign_MemoryLayout_PathElement... elements) {
throw ForeignDisabledSubstitutions.fail();
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@

import jdk.graal.compiler.serviceprovider.JavaVersionUtil;

public class JDK22OrEarlier implements BooleanSupplier {
/**
* Denotes the latest supported JDK version. It corresponds to the highest key in the
* {@code JVMCI_MIN_VERSIONS} map in {@link jdk.graal.compiler.hotspot.JVMCIVersionCheck}.
Comment on lines +32 to +33
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to move this map in a package that is accessible here and actually reference the highest key instead of hardcoding the check to 21?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package is accessible, it is just the field that is private. The LTS version change so seldomly that IMHO it is fine to have a few references to it.

*/
public class JDKLatest implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
return JavaVersionUtil.JAVA_SPEC <= 22;
return JavaVersionUtil.JAVA_SPEC > 21;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I understand that 21 is used here to avoid having to update the code with each STS JDK release, but this doesn't match the javadoc, nor represents the latest JDK.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my perspective, that is just an implementation detail. 21 is the most stable version we have and it only changes once every few years.

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ final class Target_java_lang_StringUTF16 {
final class Target_java_lang_Throwable {

@Alias //
@TargetElement(onlyWith = JDK22OrLater.class) //
@TargetElement(onlyWith = JDKLatest.class) //
@RecomputeFieldValue(kind = Kind.FromAlias, isFinal = true) //
static boolean jfrTracing = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ private static synchronized ForkJoinPool initializeCommonPool() {
}
}

@TargetClass(value = java.util.concurrent.ForkJoinPool.class, innerClass = "DefaultForkJoinWorkerThreadFactory", onlyWith = JDK23OrLater.class)
@TargetClass(value = java.util.concurrent.ForkJoinPool.class, innerClass = "DefaultForkJoinWorkerThreadFactory", onlyWith = JDKLatest.class)
@SuppressWarnings("removal")
final class Target_java_util_concurrent_ForkJoinPool_DefaultForkJoinWorkerThreadFactory {
@Alias @RecomputeFieldValue(kind = Reset) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public boolean isNativeAccessEnabled() {
public native void ensureNativeAccess(Class<?> owner, String methodName);

@Alias
@TargetElement(onlyWith = JDK22OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
public native void ensureNativeAccess(Class<?> owner, String methodName, Class<?> currentClass);

@Substitute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ final class Target_java_lang_invoke_DirectMethodHandle_StaticAccessor {
long staticOffset;
}

@TargetClass(className = "java.lang.invoke.LazyInitializingVarHandle", onlyWith = JDK23OrLater.class)
@TargetClass(className = "java.lang.invoke.LazyInitializingVarHandle", onlyWith = JDKLatest.class)
final class Target_java_lang_invoke_LazyInitializingVarHandle {
@Alias @RecomputeFieldValue(isFinal = true, kind = RecomputeFieldValue.Kind.None) //
Class<?> refc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.jdk.JDK22OrLater;
import com.oracle.svm.core.jdk.JDKLatest;
import com.oracle.svm.util.ReflectionUtil;

/**
Expand All @@ -46,7 +46,7 @@
* Ideally, we would initialize all of {@code jdk.xml} at run time, but that is too intrusive at the
* current point in time (GR-50683).
*/
@TargetClass(className = "jdk.xml.internal.JdkCatalog", onlyWith = JDK22OrLater.class)
@TargetClass(className = "jdk.xml.internal.JdkCatalog", onlyWith = JDKLatest.class)
public final class Target_jdk_xml_internal_JdkCatalog {
@Alias //
@RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Custom, declClass = JdkCatalogSupplier.class, isFinal = true) //
Expand All @@ -59,7 +59,7 @@ public static void init(String resolve) {
}
}

@TargetClass(className = "javax.xml.catalog.Catalog", onlyWith = JDK22OrLater.class)
@TargetClass(className = "javax.xml.catalog.Catalog", onlyWith = JDKLatest.class)
final class Target_javax_xml_catalog_Catalog {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.annotate.TargetElement;
import com.oracle.svm.core.jdk.JDK21OrEarlier;
import com.oracle.svm.core.jdk.JDK22OrEarlier;
import com.oracle.svm.core.jdk.JDK22OrLater;
import com.oracle.svm.core.jdk.JDK23OrLater;
import com.oracle.svm.core.jdk.JDKLatest;
import com.oracle.svm.core.util.VMError;
import com.oracle.svm.util.ReflectionUtil;

Expand Down Expand Up @@ -135,13 +133,13 @@ final class Target_jdk_jfr_internal_Utils {
public static native String formatTimespan(Duration dValue, String separation);
}

@TargetClass(className = "jdk.jfr.internal.JVMSupport", onlyWith = {JDK22OrLater.class, HasJfrSupport.class})
@TargetClass(className = "jdk.jfr.internal.JVMSupport", onlyWith = {JDKLatest.class, HasJfrSupport.class})
final class Target_jdk_jfr_internal_JVMSupport {
@Alias
public static native String makeFilename(Recording recording);
}

@TargetClass(className = "jdk.jfr.internal.util.ValueFormatter", onlyWith = {JDK22OrLater.class, HasJfrSupport.class})
@TargetClass(className = "jdk.jfr.internal.util.ValueFormatter", onlyWith = {JDKLatest.class, HasJfrSupport.class})
final class Target_jdk_jfr_internal_util_ValueFormatter {
@Alias
public static native String formatTimespan(Duration dValue, String separation);
Expand All @@ -150,10 +148,10 @@ final class Target_jdk_jfr_internal_util_ValueFormatter {
@TargetClass(className = "jdk.jfr.internal.PlatformRecording")
final class Target_jdk_jfr_internal_PlatformRecording {
@Alias
@TargetElement(onlyWith = JDK23OrLater.class)
@TargetElement(onlyWith = JDKLatest.class)
public native void setDumpDirectory(SecuritySupport.SafePath directory);

@Alias
@TargetElement(onlyWith = JDK22OrEarlier.class)
@TargetElement(onlyWith = JDK21OrEarlier.class)
public native void setDumpOnExitDirectory(SecuritySupport.SafePath directory);
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
package com.oracle.svm.core.jfr;

import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.jdk.JDK23OrLater;
import com.oracle.svm.core.jdk.JDKLatest;

@TargetClass(className = "jdk.jfr.internal.HiddenWait", onlyWith = {HasJfrSupport.class, JDK23OrLater.class})
@TargetClass(className = "jdk.jfr.internal.HiddenWait", onlyWith = {HasJfrSupport.class, JDKLatest.class})
public final class Target_jdk_jfr_internal_HiddenWait {
}
Loading