Skip to content

Commit

Permalink
Merge pull request #18192 from tajila/issue2
Browse files Browse the repository at this point in the history
Remove redundant register native call
  • Loading branch information
babsingh committed Sep 26, 2023
2 parents 252a6dd + d23cb46 commit f24c6d5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
12 changes: 2 additions & 10 deletions runtime/jcl/common/stdinit.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions runtime/jcl/common/sun_reflect_ConstantPool.c
Expand Up @@ -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[] = {
{
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion runtime/oti/j9consts.h
Expand Up @@ -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 */
Expand Down

0 comments on commit f24c6d5

Please sign in to comment.