Skip to content

Commit

Permalink
Merge pull request #20912 from keithc-ca/dead
Browse files Browse the repository at this point in the history
Remove dead code for obsolete Java versions
  • Loading branch information
babsingh authored Jan 13, 2025
2 parents 292a13b + c7075e6 commit 8a2ed5a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 129 deletions.
8 changes: 4 additions & 4 deletions runtime/exelib/common/libargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ vmOptionsTableAddOptionWithCopy(void **vmOptionsTable, char *optionString, void
#if defined(WIN32)
/* On Windows, the subdirectory containing the redirector hasn't changed with Java versions. */
#define J9JAVA_REDIRECTOR_SUBDIR "\\bin\\j9vm\\"
#elif (JAVA_SPEC_VERSION >= 10) || ((JAVA_SPEC_VERSION == 9) && defined(OPENJ9_BUILD)) || defined(OSX)
#elif (JAVA_SPEC_VERSION >= 10) || defined(OSX) /* defined(WIN32) */
/* On other platforms, the subdirectory containing the redirector is common in recent Java versions. */
#define J9JAVA_REDIRECTOR_SUBDIR "/lib/j9vm/"
#else /* WIN32 */
#else /* defined(WIN32) */
/* In Java 8 and early versions of Java 9, the path depends on the platform architecture. */
#if defined(J9HAMMER)
#define JVM_ARCH_DIR "amd64"
Expand All @@ -337,12 +337,12 @@ vmOptionsTableAddOptionWithCopy(void **vmOptionsTable, char *optionString, void
#define JVM_ARCH_DIR "ppc64"
#endif /* PPC64 */
#elif defined(RISCV64)
#define JVM_ARCH_DIR "riscv64"
#define JVM_ARCH_DIR "riscv64"
#else
#error "Must define an architecture"
#endif
#define J9JAVA_REDIRECTOR_SUBDIR "/lib/" JVM_ARCH_DIR "/j9vm/"
#endif /* WIN32 */
#endif /* defined(WIN32) */

#define JAVAHOMEDIR "-Djava.home="
#define JAVAHOMEDIR_LEN (sizeof(JAVAHOMEDIR) - 1)
Expand Down
8 changes: 0 additions & 8 deletions runtime/j9vm/exports.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,6 @@ if(NOT JAVA_SPEC_VERSION LESS 19)
JVM_LoadZipLibrary
JVM_RegisterContinuationMethods
)
if(JAVA_SPEC_VERSION LESS 21)
jvm_add_exports(jvm
JVM_VirtualThreadMountBegin
JVM_VirtualThreadMountEnd
JVM_VirtualThreadUnmountBegin
JVM_VirtualThreadUnmountEnd
)
endif()
endif()

if(JAVA_SPEC_VERSION LESS 20)
Expand Down
16 changes: 8 additions & 8 deletions runtime/j9vm/j9scar.tdf
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,17 @@ TraceEvent=Trc_SC_LoadLibrary_OpenShared_Decorate NoEnv Overhead=1 Level=3 Templ

TraceExit=Trc_SC_LoadLibrary_Exit NoEnv Overhead=1 Level=2 Template="JVM_LoadLibrary -- return 0x%zx"

TraceEntry=Trc_SC_VirtualThreadMountBegin_Entry Overhead=1 Level=3 Template="thread = %p, firstMount = %d"
TraceExit=Trc_SC_VirtualThreadMountBegin_Exit Overhead=1 Level=3 Template="thread = %p, firstMount = %d"
TraceEntry=Trc_SC_VirtualThreadMountBegin_Entry Obsolete Overhead=1 Level=3 Template="thread = %p, firstMount = %d"
TraceExit=Trc_SC_VirtualThreadMountBegin_Exit Obsolete Overhead=1 Level=3 Template="thread = %p, firstMount = %d"

TraceEntry=Trc_SC_VirtualThreadMountEnd_Entry Overhead=1 Level=3 Template="thread = %p, firstMount = %d"
TraceExit=Trc_SC_VirtualThreadMountEnd_Exit Overhead=1 Level=3 Template="thread = %p, firstMount = %d"
TraceEntry=Trc_SC_VirtualThreadMountEnd_Entry Obsolete Overhead=1 Level=3 Template="thread = %p, firstMount = %d"
TraceExit=Trc_SC_VirtualThreadMountEnd_Exit Obsolete Overhead=1 Level=3 Template="thread = %p, firstMount = %d"

TraceEntry=Trc_SC_VirtualThreadUnmountBegin_Entry Overhead=1 Level=3 Template="thread = %p, lastUnmount = %d"
TraceExit=Trc_SC_VirtualThreadUnmountBegin_Exit Overhead=1 Level=3 Template="thread = %p, lastUnmount = %d"
TraceEntry=Trc_SC_VirtualThreadUnmountBegin_Entry Obsolete Overhead=1 Level=3 Template="thread = %p, lastUnmount = %d"
TraceExit=Trc_SC_VirtualThreadUnmountBegin_Exit Obsolete Overhead=1 Level=3 Template="thread = %p, lastUnmount = %d"

TraceEntry=Trc_SC_VirtualThreadUnmountEnd_Entry Overhead=1 Level=3 Template="thread = %p, lastUnmount = %d"
TraceExit=Trc_SC_VirtualThreadUnmountEnd_Exit Overhead=1 Level=3 Template="thread = %p, lastUnmount = %d"
TraceEntry=Trc_SC_VirtualThreadUnmountEnd_Entry Obsolete Overhead=1 Level=3 Template="thread = %p, lastUnmount = %d"
TraceExit=Trc_SC_VirtualThreadUnmountEnd_Exit Obsolete Overhead=1 Level=3 Template="thread = %p, lastUnmount = %d"

TraceEvent=Trc_SC_VirtualThread_Info Overhead=1 Level=3 Test Template="virtualThreadObj = %p, virtualThreadState = %p, virtualThreadInspectorCount = %lld, carrierThreadObj = %p, continuationObj = %p, J9VMContinuation = %p"

Expand Down
13 changes: 0 additions & 13 deletions runtime/j9vm/j9vmnatives.xml
Original file line number Diff line number Diff line change
Expand Up @@ -440,19 +440,6 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
<export name="JVM_IsContinuationsSupported"/>
<export name="JVM_IsPreviewEnabled"/>
<export name="JVM_RegisterContinuationMethods"/>
<!-- Removed in Java 21. -->
<export name="JVM_VirtualThreadMountBegin">
<exclude-if condition="spec.java21"/>
</export>
<export name="JVM_VirtualThreadMountEnd">
<exclude-if condition="spec.java21"/>
</export>
<export name="JVM_VirtualThreadUnmountBegin">
<exclude-if condition="spec.java21"/>
</export>
<export name="JVM_VirtualThreadUnmountEnd">
<exclude-if condition="spec.java21"/>
</export>
</exports>

<exports group="jdk20">
Expand Down
6 changes: 1 addition & 5 deletions runtime/j9vm/java11vmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1829,11 +1829,7 @@ JVM_RegisterLambdaProxyClassForArchiving(JNIEnv *env, jclass arg1, jstring arg2,
}

JNIEXPORT jclass JNICALL
JVM_LookupLambdaProxyClassFromArchive(JNIEnv *env, jclass arg1, jstring arg2, jobject arg3, jobject arg4, jobject arg5, jobject arg6
#if JAVA_SPEC_VERSION == 15
, jboolean arg7
#endif /* JAVA_SPEC_VERSION == 15 */
)
JVM_LookupLambdaProxyClassFromArchive(JNIEnv *env, jclass arg1, jstring arg2, jobject arg3, jobject arg4, jobject arg5, jobject arg6)
{
assert(!"JVM_LookupLambdaProxyClassFromArchive unimplemented");
return NULL;
Expand Down
81 changes: 0 additions & 81 deletions runtime/j9vm/javanextvmi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,87 +482,6 @@ virtualThreadUnmountEnd(JNIEnv *env, jobject thread)
}
#endif /* JAVA_SPEC_VERSION >= 19 */

#if (19 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION < 21)
JNIEXPORT void JNICALL
JVM_VirtualThreadMountBegin(JNIEnv *env, jobject thread, jboolean firstMount)
{
J9VMThread *currentThread = (J9VMThread *)env;
J9JavaVM *vm = currentThread->javaVM;
J9InternalVMFunctions *vmFuncs = vm->internalVMFunctions;

Trc_SC_VirtualThreadMountBegin_Entry(currentThread, thread, firstMount);

vmFuncs->internalEnterVMFromJNI(currentThread);

virtualThreadMountBegin(env, thread);

vmFuncs->internalExitVMToJNI(currentThread);

Trc_SC_VirtualThreadMountBegin_Exit(currentThread, thread, firstMount);
}

JNIEXPORT void JNICALL
JVM_VirtualThreadMountEnd(JNIEnv *env, jobject thread, jboolean firstMount)
{
J9VMThread *currentThread = (J9VMThread *)env;
J9JavaVM *vm = currentThread->javaVM;
J9InternalVMFunctions *vmFuncs = vm->internalVMFunctions;

Trc_SC_VirtualThreadMountEnd_Entry(currentThread, thread, firstMount);

vmFuncs->internalEnterVMFromJNI(currentThread);

virtualThreadMountEnd(env, thread);
if (firstMount) {
TRIGGER_J9HOOK_VM_VIRTUAL_THREAD_STARTED(vm->hookInterface, currentThread);
}

vmFuncs->internalExitVMToJNI(currentThread);

Trc_SC_VirtualThreadMountEnd_Exit(currentThread, thread, firstMount);
}

JNIEXPORT void JNICALL
JVM_VirtualThreadUnmountBegin(JNIEnv *env, jobject thread, jboolean lastUnmount)
{
J9VMThread *currentThread = (J9VMThread *)env;
J9JavaVM *vm = currentThread->javaVM;
J9InternalVMFunctions *vmFuncs = vm->internalVMFunctions;

Trc_SC_VirtualThreadUnmountBegin_Entry(currentThread, thread, lastUnmount);

vmFuncs->internalEnterVMFromJNI(currentThread);

if (lastUnmount) {
TRIGGER_J9HOOK_VM_VIRTUAL_THREAD_END(vm->hookInterface, currentThread);
setContinuationStateToLastUnmount((J9VMThread *)env, thread);
}
virtualThreadUnmountBegin(env, thread);

vmFuncs->internalExitVMToJNI(currentThread);

Trc_SC_VirtualThreadUnmountBegin_Exit(currentThread, thread,lastUnmount);
}

JNIEXPORT void JNICALL
JVM_VirtualThreadUnmountEnd(JNIEnv *env, jobject thread, jboolean lastUnmount)
{
J9VMThread *currentThread = (J9VMThread *)env;
J9JavaVM *vm = currentThread->javaVM;
J9InternalVMFunctions *vmFuncs = vm->internalVMFunctions;

Trc_SC_VirtualThreadUnmountEnd_Entry(currentThread, thread, lastUnmount);

vmFuncs->internalEnterVMFromJNI(currentThread);

virtualThreadUnmountEnd(env, thread);

vmFuncs->internalExitVMToJNI(currentThread);

Trc_SC_VirtualThreadUnmountEnd_Exit(currentThread, thread, lastUnmount);
}
#endif /* (19 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION < 21) */

#if JAVA_SPEC_VERSION >= 20
JNIEXPORT jint JNICALL
JVM_GetClassFileVersion(JNIEnv *env, jclass cls)
Expand Down
10 changes: 0 additions & 10 deletions runtime/redirector/forwarders.m4
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ _IF([JAVA_SPEC_VERSION >= 16],
[_X(JVM_GetRandomSeedForDumping, JNICALL, false, jlong)])
_IF([JAVA_SPEC_VERSION >= 15],
[_X(JVM_RegisterLambdaProxyClassForArchiving, JNICALL, false, void, JNIEnv *env, jclass arg1, jstring arg2, jobject arg3, jobject arg4, jobject arg5, jobject arg6, jclass arg7)])
_IF([JAVA_SPEC_VERSION == 15],
[_X(JVM_LookupLambdaProxyClassFromArchive, JNICALL, false, jclass, JNIEnv *env, jclass arg1, jstring arg2, jobject arg3, jobject arg4, jobject arg5, jobject arg6, jboolean arg7)])
_IF([JAVA_SPEC_VERSION >= 16],
[_X(JVM_LookupLambdaProxyClassFromArchive, JNICALL, false, jclass, JNIEnv *env, jclass arg1, jstring arg2, jobject arg3, jobject arg4, jobject arg5, jobject arg6)])
_IF([(15 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION < 23)],
Expand Down Expand Up @@ -403,14 +401,6 @@ _IF([JAVA_SPEC_VERSION >= 19],
[_X(JVM_IsContinuationsSupported, JNICALL, false, void, void)])
_IF([JAVA_SPEC_VERSION >= 19],
[_X(JVM_IsPreviewEnabled, JNICALL, false, void, void)])
_IF([(19 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION < 21)],
[_X(JVM_VirtualThreadMountBegin, JNICALL, false, void, JNIEnv *env, jobject thread, jboolean firstMount)])
_IF([(19 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION < 21)],
[_X(JVM_VirtualThreadMountEnd, JNICALL, false, void, JNIEnv *env, jobject thread, jboolean firstMount)])
_IF([(19 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION < 21)],
[_X(JVM_VirtualThreadUnmountBegin, JNICALL, false, void, JNIEnv *env, jobject thread, jboolean lastUnmount)])
_IF([(19 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION < 21)],
[_X(JVM_VirtualThreadUnmountEnd, JNICALL, false, void, JNIEnv *env, jobject thread, jboolean lastUnmount)])
_IF([JAVA_SPEC_VERSION >= 20],
[_X(JVM_GetClassFileVersion, JNICALL, false, jint, JNIEnv *env, jclass cls)])
_IF([(20 <= JAVA_SPEC_VERSION) && (JAVA_SPEC_VERSION < 23)],
Expand Down

0 comments on commit 8a2ed5a

Please sign in to comment.