From d23cb4653346c064bfce504ee50352f37a53da50 Mon Sep 17 00:00:00 2001 From: Tobi Ajila Date: Mon, 25 Sep 2023 15:10:39 -0400 Subject: [PATCH] Remove redundant register native call Completes: https://github.com/eclipse-openj9/openj9/pull/18169 Signed-off-by: Tobi Ajila --- runtime/jcl/common/stdinit.c | 12 ++---------- runtime/jcl/common/sun_reflect_ConstantPool.c | 7 ------- runtime/oti/j9consts.h | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/runtime/jcl/common/stdinit.c b/runtime/jcl/common/stdinit.c index b79275c9eae..1b0f6493a58 100644 --- a/runtime/jcl/common/stdinit.c +++ b/runtime/jcl/common/stdinit.c @@ -231,14 +231,6 @@ standardInit(J9JavaVM *vm, char *dllName) goto _fail; } - if (J2SE_VERSION(vm) >= J2SE_V11) { - result = registerJdkInternalReflectConstantPoolNatives((JNIEnv*)vmThread); - if (JNI_OK != result) { - fprintf(stderr, "Failed to register natives for jdk.internal.reflect.ConstantPool\n"); - goto _fail; - } - } - #ifdef J9VM_OPT_REFLECT if (NULL != vm->reflectFunctions.idToReflectMethod) { jmethodID invokeMethod = NULL; @@ -1033,11 +1025,11 @@ completeInitialization(J9JavaVM * vm) jint result = JNI_OK; J9InternalVMFunctions *vmFuncs = vm->internalVMFunctions; J9VMThread *currentThread = vm->mainThread; - + vmFuncs->internalEnterVMFromJNI(currentThread); vmFuncs->sendCompleteInitialization(currentThread); vmFuncs->internalReleaseVMAccess(currentThread); - + if (NULL == currentThread->currentException) { /* ensure ClassLoader.applicationClassLoader updated via system property java.system.class.loader is updated in VM as well */ internalInitializeJavaLangClassLoader((JNIEnv*)currentThread); diff --git a/runtime/jcl/common/sun_reflect_ConstantPool.c b/runtime/jcl/common/sun_reflect_ConstantPool.c index 0a8fb01c539..5fcd3f1ba72 100644 --- a/runtime/jcl/common/sun_reflect_ConstantPool.c +++ b/runtime/jcl/common/sun_reflect_ConstantPool.c @@ -848,7 +848,6 @@ Java_jdk_internal_reflect_ConstantPool_registerNatives(JNIEnv *env, jclass unuse jint registerJdkInternalReflectConstantPoolNatives(JNIEnv *env) { jint result = 0; - J9JavaVM *vm = ((J9VMThread *)env)->javaVM; JNINativeMethod natives[] = { { @@ -927,12 +926,6 @@ registerJdkInternalReflectConstantPoolNatives(JNIEnv *env) { /* jdk.internal.reflect.ConstantPool is currently cached in CLS_sun_reflect_ConstantPool */ jclass jdk_internal_reflect_ConstantPool = JCL_CACHE_GET(env, CLS_sun_reflect_ConstantPool); - /* This is temporary code, will be removed in the future. */ - if (J9_ARE_ANY_BITS_SET(vm->extendedRuntimeFlags2, J9_EXTENDED_RUNTIME2_REFLECT_CONSTANTPOOL_REGISTER_NATIVES_CALLED)) { - goto _end; - } - vm->extendedRuntimeFlags2 |= J9_EXTENDED_RUNTIME2_REFLECT_CONSTANTPOOL_REGISTER_NATIVES_CALLED; - if (NULL == jdk_internal_reflect_ConstantPool) { BOOLEAN rc = initializeSunReflectConstantPoolIDCache(env); diff --git a/runtime/oti/j9consts.h b/runtime/oti/j9consts.h index 113316ed73e..74572d14962 100644 --- a/runtime/oti/j9consts.h +++ b/runtime/oti/j9consts.h @@ -362,7 +362,7 @@ extern "C" { #define J9_EXTENDED_RUNTIME2_USE_CONTAINER_SUPPORT 0x200000 #define J9_EXTENDED_RUNTIME2_SHOW_CARRIER_FRAMES 0x400000 #define J9_EXTENDED_RUNTIME2_CRIU_SINGLE_THROW_BLOCKING_EXCEPTIONS 0x800000 -#define J9_EXTENDED_RUNTIME2_REFLECT_CONSTANTPOOL_REGISTER_NATIVES_CALLED 0x1000000 +#define J9_EXTENDED_RUNTIME2_UNUSED_0x1000000 0x1000000 #define J9_OBJECT_HEADER_AGE_DEFAULT 0xA /* OBJECT_HEADER_AGE_DEFAULT */ #define J9_OBJECT_HEADER_SHAPE_MASK 0xE /* OBJECT_HEADER_SHAPE_MASK */