Skip to content

Commit

Permalink
Merge pull request #18752 from babsingh/main6
Browse files Browse the repository at this point in the history
Eliminate dark matter before determining classes to recreate
  • Loading branch information
gacholio authored Jan 13, 2024
2 parents a3fd345 + dfb74f5 commit ed3e662
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions runtime/jvmti/jvmtiClass.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@ redefineClassesCommon(jvmtiEnv* env,
J9HashTable * methodEquivalences = NULL;
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
j9object_t memberNamesToFix = NULL;
UDATA savedAllowUserHeapWalkFlag = 0;
#endif /* defined(J9VM_OPT_OPENJDK_METHODHANDLE) */
#ifdef J9VM_INTERP_NATIVE_SUPPORT
J9JVMTIHCRJitEventData jitEventData;
Expand Down Expand Up @@ -1224,28 +1225,29 @@ redefineClassesCommon(jvmtiEnv* env,
}
}

/* Determine all ROM classes which need a new RAM class, and pair them with their current RAM class */

rc = determineClassesToRecreate(currentThread, class_count, specifiedClasses, &classPairs,
&methodPairs, jitEventDataPtr, !extensionsEnabled);
if (rc == JVMTI_ERROR_NONE) {
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
/* Eliminate dark matter so that none will be encountered in prepareToFixMemberNames(). */
UDATA savedAllowUserHeapWalkFlag = vm->requiredDebugAttributes & J9VM_DEBUG_ATTRIBUTE_ALLOW_USER_HEAP_WALK;
vm->requiredDebugAttributes |= J9VM_DEBUG_ATTRIBUTE_ALLOW_USER_HEAP_WALK;
/* Eliminate dark matter so that none will be encountered in prepareToFixMemberNames(). */
savedAllowUserHeapWalkFlag = vm->requiredDebugAttributes & J9VM_DEBUG_ATTRIBUTE_ALLOW_USER_HEAP_WALK;
vm->requiredDebugAttributes |= J9VM_DEBUG_ATTRIBUTE_ALLOW_USER_HEAP_WALK;

/* This is to help with Metronome to avoid requesting Exclusive if we already have SafePoint, which may not look as Exclusive to the requester thread */
vm->alreadyHaveExclusive = TRUE;
/* This is to help with Metronome to avoid requesting Exclusive if we already have SafePoint, which may not look as Exclusive to the requester thread */
vm->alreadyHaveExclusive = TRUE;

vm->memoryManagerFunctions->j9gc_modron_global_collect_with_overrides(currentThread, J9MMCONSTANT_EXPLICIT_GC_EXCLUSIVE_VMACCESS_ALREADY_ACQUIRED);
vm->memoryManagerFunctions->j9gc_modron_global_collect_with_overrides(currentThread, J9MMCONSTANT_EXPLICIT_GC_EXCLUSIVE_VMACCESS_ALREADY_ACQUIRED);

vm->alreadyHaveExclusive = FALSE;
vm->alreadyHaveExclusive = FALSE;

if (0 == savedAllowUserHeapWalkFlag) {
/* Clear the flag to restore its original value. */
vm->requiredDebugAttributes &= ~J9VM_DEBUG_ATTRIBUTE_ALLOW_USER_HEAP_WALK;
}
if (0 == savedAllowUserHeapWalkFlag) {
/* Clear the flag to restore its original value. */
vm->requiredDebugAttributes &= ~J9VM_DEBUG_ATTRIBUTE_ALLOW_USER_HEAP_WALK;
}
#endif /* defined(J9VM_OPT_OPENJDK_METHODHANDLE) */

/* Determine all ROM classes which need a new RAM class, and pair them with their current RAM class. */
rc = determineClassesToRecreate(currentThread, class_count, specifiedClasses, &classPairs,
&methodPairs, jitEventDataPtr, !extensionsEnabled);
if (rc == JVMTI_ERROR_NONE) {
#if defined(J9VM_OPT_OPENJDK_METHODHANDLE)
/* Identify the MemberNames needing fix-up based on classPairs. */
memberNamesToFix = prepareToFixMemberNames(currentThread, classPairs);
#endif /* defined(J9VM_OPT_OPENJDK_METHODHANDLE) */
Expand Down

0 comments on commit ed3e662

Please sign in to comment.