From 5b44e49e352bd4515996a8ae294af88bd80a9397 Mon Sep 17 00:00:00 2001 From: Karm Michal Babacek Date: Thu, 19 Dec 2024 09:23:57 +0100 Subject: [PATCH] [Backport] commit/369f0ff8, native method deletions This is a partial backport of: "Introudce a mode to unconditionally include classes" oracle/graal@369f0ff to address oracle/graal#9672 Changes from the original commit 369f0ff: Unused substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java Unused substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/FileSystemProviderSupport.java Unused substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/NonWindowsOS.java Unused substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_java_security_AccessControlContext.java Unused substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_loader_BuiltinClassLoader.java Unused substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_vm_vector_VectorSupport.java Unused substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_sun_nio_ch_Net.java Used substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java Used substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java Used substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java Unused substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ClassLoaderSupportImpl.java Unused substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ClassLoaderSupportImpl.java Unused substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageClassLoaderSupport.java Unused substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java Unused substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/JDKInitializationFeature.java --- .../Target_java_lang_invoke_MethodHandleNatives.java | 3 +++ .../Target_java_lang_invoke_MethodHandles_Lookup.java | 3 +++ .../oracle/svm/core/thread/Target_java_lang_Thread.java | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java index e50234f4ac4..2c973ce7d9a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandleNatives.java @@ -219,6 +219,9 @@ static Target_java_lang_invoke_MemberName resolve(Target_java_lang_invoke_Member } return resolved; } + + @Delete + static native MethodHandle linkMethodHandleConstant(Class callerClass, int refKind, Class defc, String name, Object type); } /** diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java index 773038bc8e8..b9e2e0ed759 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/methodhandles/Target_java_lang_invoke_MethodHandles_Lookup.java @@ -86,6 +86,9 @@ private IllegalAccessException makeAccessException(Class targetClass) { return new IllegalAccessException(message); } + @Delete + native MethodHandle linkMethodHandleConstant(byte refKind, Class defc, String name, Object type) throws ReflectiveOperationException; + /** This call is a noop without the security manager. */ @SuppressWarnings("unused") @Substitute diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java index 4783cd3b266..4b47d200984 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/thread/Target_java_lang_Thread.java @@ -623,6 +623,10 @@ private StackTraceElement[] getStackTrace() { return JavaThreads.getStackTrace(false, JavaThreads.fromTarget(this)); } + @Delete + @SuppressWarnings({"static-method"}) + private native Object getStackTrace0(); + /** @see com.oracle.svm.core.jdk.StackTraceUtils#asyncGetStackTrace */ @Delete @TargetElement(onlyWith = JDK19OrLater.class) @@ -798,6 +802,9 @@ boolean isTerminated() { @Alias @TargetElement(onlyWith = JDK19OrLater.class) native long threadId(); + + @Delete + static native long getNextThreadIdOffset(); } @TargetClass(value = Thread.class, innerClass = "Builder", onlyWith = JDK19OrLater.class)