Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-45327] Remove JDK 11 support from native image code. #6343

Merged
merged 8 commits into from
Apr 3, 2023
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
68 changes: 1 addition & 67 deletions substratevm/mx.substratevm/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,30 +328,6 @@
},


"com.oracle.svm.core.jdk17": {
"subDir": "src",
"sourceDirs": ["src"],
"dependencies": ["com.oracle.svm.core"],
"requiresConcealed" : {
"java.base" : [
"jdk.internal.access.foreign",
"jdk.internal.loader",
"jdk.internal.misc",
"jdk.internal.platform",
"sun.invoke.util",
],
},
"javaCompliance": "17+",
"annotationProcessors": [
"compiler:GRAAL_PROCESSOR",
"SVM_PROCESSOR",
],
"checkstyle": "com.oracle.svm.core",
"workingSets": "SVM",
"jacoco" : "exclude",
},


"com.oracle.svm.core.genscavenge": {
"subDir": "src",
"sourceDirs": [
Expand Down Expand Up @@ -620,6 +596,7 @@
"java.base" : [
"jdk.internal",
"jdk.internal.event",
"jdk.internal.loader",
"jdk.internal.misc",
"jdk.internal.vm.annotation",
"jdk.internal.org.objectweb.asm",
Expand Down Expand Up @@ -661,26 +638,6 @@
"jacoco" : "include",
},

"com.oracle.svm.hosted.jdk17": {
"subDir": "src",
"sourceDirs": ["src"],
"dependencies": [
"com.oracle.svm.hosted",
],
"requiresConcealed" : {
"java.base" :
["jdk.internal.loader"],
"jdk.internal.vm.ci" :
["jdk.vm.ci.meta"],
},
"javaCompliance": "17+",
"annotationProcessors": [
"compiler:GRAAL_PROCESSOR",
"SVM_PROCESSOR",
],
"workingSets": "SVM",
"jacoco" : "exclude",
},
# Native libraries below explicitly set _FORTIFY_SOURCE to 0. This constant controls how glibc handles some
# functions that can cause a stack overflow like snprintf. If set to 1 or 2, it causes glibc to use internal
# functions with extra checking that are not available in all libc implementations. Different distros use
Expand Down Expand Up @@ -879,26 +836,6 @@
"jacoco" : "exclude",
},

"com.oracle.svm.test.jdk17": {
"subDir": "src",
"sourceDirs": ["src"],
"dependencies": [
"mx:JUNIT_TOOL",
"sdk:GRAAL_SDK",
"SVM",
],
"checkstyle": "com.oracle.svm.test",
"workingSets": "SVM",
"annotationProcessors": [
"compiler:GRAAL_PROCESSOR",
"SVM_PROCESSOR",
],
"javaCompliance": "17+",
"spotbugs": "false",
"testProject": True,
"jacoco" : "exclude",
},

"com.oracle.svm.configure.test": {
"subDir": "src",
"sourceDirs": ["src"],
Expand Down Expand Up @@ -1306,9 +1243,7 @@
"com.oracle.svm.graal",
"com.oracle.svm.truffle",
"com.oracle.svm.hosted",
"com.oracle.svm.hosted.jdk17",
"com.oracle.svm.core",
"com.oracle.svm.core.jdk17",
"com.oracle.svm.core.graal.amd64",
"com.oracle.svm.core.graal.aarch64",
"com.oracle.svm.core.graal.riscv64",
Expand Down Expand Up @@ -1780,7 +1715,6 @@
"relpath" : True,
"dependencies" : [
"com.oracle.svm.test",
"com.oracle.svm.test.jdk17",
"com.oracle.svm.configure.test",
"com.oracle.svm.graal.test",
],
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@
import java.io.FileDescriptor;
import java.io.FileOutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.graalvm.compiler.graph.Node.NodeIntrinsic;
import org.graalvm.compiler.java.LambdaUtils;
import org.graalvm.compiler.nodes.BreakpointNode;
import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
import org.graalvm.nativeimage.Platform;
import org.graalvm.nativeimage.Platforms;
import org.graalvm.nativeimage.c.type.CCharPointer;
Expand All @@ -51,7 +48,6 @@
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.hub.DynamicHub;
import com.oracle.svm.core.util.VMError;
import com.oracle.svm.util.ReflectionUtil;
import com.oracle.svm.util.StringUtil;
Expand Down Expand Up @@ -395,27 +391,6 @@ public static String mangleName(String methodName) {
return mangled;
}

private static final Method isHiddenMethod = JavaVersionUtil.JAVA_SPEC >= 17 ? ReflectionUtil.lookupMethod(Class.class, "isHidden") : null;

public static boolean isHiddenClass(Class<?> javaClass) {
if (JavaVersionUtil.JAVA_SPEC >= 17) {
try {
return (boolean) isHiddenMethod.invoke(javaClass);
} catch (IllegalAccessException | InvocationTargetException e) {
throw VMError.shouldNotReachHere(e);
}
}
return false;
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static boolean isHiddenClass(DynamicHub hub) {
if (JavaVersionUtil.JAVA_SPEC >= 17) {
return hub.isHidden();
}
return false;
}

public static int arrayTypeDimension(Class<?> clazz) {
int dimension = 0;
Class<?> componentType = clazz;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
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.annotate.TargetElement;
import com.oracle.svm.core.jdk.JDK11OrEarlier;
import com.oracle.svm.core.jdk.JDK17OrLater;
import com.oracle.svm.core.thread.VMThreads;

import jdk.internal.misc.InnocuousThread;
Expand Down Expand Up @@ -88,47 +85,15 @@ final class Target_jdk_internal_ref_CleanerImpl {
@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClassName = "jdk.internal.ref.CleanerImpl$PhantomCleanableRef")//
Target_jdk_internal_ref_PhantomCleanable phantomCleanableList;

@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClassName = "jdk.internal.ref.CleanerImpl$WeakCleanableRef")//
@TargetElement(onlyWith = JDK11OrEarlier.class) //
Target_jdk_internal_ref_WeakCleanable weakCleanableList;

@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClassName = "jdk.internal.ref.CleanerImpl$SoftCleanableRef")//
@TargetElement(onlyWith = JDK11OrEarlier.class) //
Target_jdk_internal_ref_SoftCleanable softCleanableList;

@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClassName = "java.lang.ref.ReferenceQueue")//
public ReferenceQueue<Object> queue;

/** @see #run() */
@Substitute
@TargetElement(name = "run", onlyWith = JDK11OrEarlier.class)
public void runJDK11() {
Thread t = Thread.currentThread();
InnocuousThread mlThread = (t instanceof InnocuousThread) ? (InnocuousThread) t : null;
while (!phantomCleanableList.isListEmpty() || !weakCleanableList.isListEmpty() || !softCleanableList.isListEmpty()) {
if (mlThread != null) {
mlThread.eraseThreadLocals();
}
try {
Cleaner.Cleanable ref = (Cleaner.Cleanable) queue.remove(60 * 1000L);
if (ref != null) {
ref.clean();
}
} catch (Throwable e) {
if (VMThreads.isTearingDown()) {
return;
}
}
}
}

/**
* This loop executes in a daemon thread and waits until there are no more cleanables (including
* the {@code Cleaner} itself), ignoring {@link InterruptedException}. This blocks VM tear-down,
* so we add a check if the VM is tearing down here.
*/
@Substitute
@TargetElement(onlyWith = JDK17OrLater.class)
public void run() {
Thread t = Thread.currentThread();
InnocuousThread mlThread = (t instanceof InnocuousThread) ? (InnocuousThread) t : null;
Expand Down Expand Up @@ -173,17 +138,3 @@ public Object transform(Object receiver, Object originalValue) {
return receiver;
}
}

// Removed by JDK-8251861
@TargetClass(className = "jdk.internal.ref.WeakCleanable", onlyWith = JDK11OrEarlier.class)
final class Target_jdk_internal_ref_WeakCleanable {
@Alias
native boolean isListEmpty();
}

// Removed by JDK-8251861
@TargetClass(className = "jdk.internal.ref.SoftCleanable", onlyWith = JDK11OrEarlier.class)
final class Target_jdk_internal_ref_SoftCleanable {
@Alias
native boolean isListEmpty();
}
Loading