Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: RamClass: Segment allocation enhancements #20831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 68 additions & 16 deletions runtime/jcl/common/mgmtmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,25 +76,77 @@ Java_com_ibm_java_lang_management_internal_MemoryMXBeanImpl_getNonHeapMemoryUsag
omrthread_monitor_enter(javaVM->classTableMutex);
classLoader = javaVM->internalVMFunctions->allClassLoadersStartDo(&walkState, javaVM, 0);
while (NULL != classLoader) {
UDATA *udataFreeListBlock = classLoader->ramClassUDATABlockFreeList;
J9RAMClassFreeListBlock *tinyFreeListBlock = classLoader->ramClassTinyBlockFreeList;
J9RAMClassFreeListBlock *smallFreeListBlock = classLoader->ramClassSmallBlockFreeList;
J9RAMClassFreeListBlock *largeFreeListBlock = classLoader->ramClassLargeBlockFreeList;
while (NULL != udataFreeListBlock) {
used -= sizeof(UDATA);
udataFreeListBlock = *(UDATA **) udataFreeListBlock;
J9RAMClassUDATABlockFreeList *udataFreeListBlock = &classLoader->ramClassUDATABlocks;
J9RAMClassFreeLists *sub4gFreeListBlock = &classLoader->sub4gBlock;
J9RAMClassFreeLists *freqFreeListBlock = &classLoader->frequentlyAccessedBlock;
J9RAMClassFreeLists *InFreqFreeListBlock = &classLoader->inFrequentlyAccessedBlock;
if (NULL != udataFreeListBlock) {
UDATA *sub4gListBlock = udataFreeListBlock->ramClassSub4gUDATABlockFreeList;
UDATA *freqListBlock = udataFreeListBlock->ramClassFreqUDATABlockFreeList;
UDATA *inFreqListBlock = udataFreeListBlock->ramClassInFreqUDATABlockFreeList;
while (NULL != sub4gListBlock) {
used -= sizeof(UDATA);
sub4gListBlock = *(UDATA **) sub4gListBlock;
}
while (NULL != freqListBlock) {
used -= sizeof(UDATA);
freqListBlock = *(UDATA **) freqListBlock;
}
while (NULL != inFreqListBlock) {
used -= sizeof(UDATA);
inFreqListBlock = *(UDATA **) inFreqListBlock;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these spaces. e.g. *(UDATA **) inFreqListBlock; change to *(UDATA **)inFreqListBlock;

}
}
while (NULL != tinyFreeListBlock) {
used -= tinyFreeListBlock->size;
tinyFreeListBlock = tinyFreeListBlock->nextFreeListBlock;
if (NULL != sub4gFreeListBlock) {
J9RAMClassFreeListBlock *tinyFreeListBlock = sub4gFreeListBlock->ramClassTinyBlockFreeList;
J9RAMClassFreeListBlock *smallFreeListBlock = sub4gFreeListBlock->ramClassSmallBlockFreeList;
J9RAMClassFreeListBlock *largeFreeListBlock = sub4gFreeListBlock->ramClassLargeBlockFreeList;
while (NULL != tinyFreeListBlock) {
used -= tinyFreeListBlock->size;
tinyFreeListBlock = tinyFreeListBlock->nextFreeListBlock;
}
while (NULL != smallFreeListBlock) {
used -= smallFreeListBlock->size;
smallFreeListBlock = smallFreeListBlock->nextFreeListBlock;
}
while (NULL != largeFreeListBlock) {
used -= largeFreeListBlock->size;
largeFreeListBlock = largeFreeListBlock->nextFreeListBlock;
}
}
while (NULL != smallFreeListBlock) {
used -= smallFreeListBlock->size;
smallFreeListBlock = smallFreeListBlock->nextFreeListBlock;
if (NULL != freqFreeListBlock) {
J9RAMClassFreeListBlock *tinyFreeListBlock = freqFreeListBlock->ramClassTinyBlockFreeList;
J9RAMClassFreeListBlock *smallFreeListBlock = freqFreeListBlock->ramClassSmallBlockFreeList;
J9RAMClassFreeListBlock *largeFreeListBlock = freqFreeListBlock->ramClassLargeBlockFreeList;
while (NULL != tinyFreeListBlock) {
used -= tinyFreeListBlock->size;
tinyFreeListBlock = tinyFreeListBlock->nextFreeListBlock;
}
while (NULL != smallFreeListBlock) {
used -= smallFreeListBlock->size;
smallFreeListBlock = smallFreeListBlock->nextFreeListBlock;
}
while (NULL != largeFreeListBlock) {
used -= largeFreeListBlock->size;
largeFreeListBlock = largeFreeListBlock->nextFreeListBlock;
}
}
while (NULL != largeFreeListBlock) {
used -= largeFreeListBlock->size;
largeFreeListBlock = largeFreeListBlock->nextFreeListBlock;
if (NULL != InFreqFreeListBlock) {
J9RAMClassFreeListBlock *tinyFreeListBlock = InFreqFreeListBlock->ramClassTinyBlockFreeList;
J9RAMClassFreeListBlock *smallFreeListBlock = InFreqFreeListBlock->ramClassSmallBlockFreeList;
J9RAMClassFreeListBlock *largeFreeListBlock = InFreqFreeListBlock->ramClassLargeBlockFreeList;
while (NULL != tinyFreeListBlock) {
used -= tinyFreeListBlock->size;
tinyFreeListBlock = tinyFreeListBlock->nextFreeListBlock;
}
while (NULL != smallFreeListBlock) {
used -= smallFreeListBlock->size;
smallFreeListBlock = smallFreeListBlock->nextFreeListBlock;
}
while (NULL != largeFreeListBlock) {
used -= largeFreeListBlock->size;
largeFreeListBlock = largeFreeListBlock->nextFreeListBlock;
}
}
classLoader = javaVM->internalVMFunctions->allClassLoadersNextDo(&walkState);
}
Expand Down
26 changes: 17 additions & 9 deletions runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ typedef struct J9ExceptionHandler {
U_32 exceptionClassIndex;
} J9ExceptionHandler;

#if defined(__xlC__) || defined(J9ZOS390) || defined(__open_xl__) /* Covers: AIX, Linux PPC and z/OS. */
#if defined(__xlC__) || defined(J9ZOS390) /* Covers: Z/OS, AIX, Linux PPC*/
#pragma pack(1)
#elif defined(__ibmxl__) || defined(__GNUC__) || defined(_MSC_VER) /* Covers: Linux PPC LE, Windows, Linux x86 */
#pragma pack(push, 1)
Expand All @@ -1641,7 +1641,7 @@ typedef struct J9MethodParametersData {
J9MethodParameter parameters;
} J9MethodParametersData;

#if defined(__xlC__) || defined(__ibmxl__) || defined(__open_xl__) || defined(__GNUC__) || defined(_MSC_VER) || defined(J9ZOS390) || defined(LINUX) || defined(AIXPPC) || defined(WIN32)
#if defined(__xlC__) || defined(__ibmxl__) || defined(__GNUC__) || defined(_MSC_VER) || defined(J9ZOS390) || defined(LINUX) || defined(AIXPPC) || defined(WIN32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to be careful when rebasing. You've accidentally included reverts to recent patches that shouldn't be reverted. Please make sure that only the code that you are wanting to change is included in the PR.

#pragma pack(pop)
#else
#error "Unrecognized compiler. Cannot pack struct J9MethodParameter and J9MethodParametersData."
Expand Down Expand Up @@ -3569,6 +3569,17 @@ typedef struct J9HookedNative {
} J9HookedNative;

/* @ddr_namespace: map_to_type=J9ClassLoader */
typedef struct J9RAMClassFreeLists {
struct J9RAMClassFreeListBlock* ramClassTinyBlockFreeList;
struct J9RAMClassFreeListBlock* ramClassSmallBlockFreeList;
struct J9RAMClassFreeListBlock* ramClassLargeBlockFreeList;
} J9RAMClassFreeLists;

typedef struct J9RAMClassUDATABlockFreeList {
UDATA *ramClassSub4gUDATABlockFreeList;
UDATA *ramClassFreqUDATABlockFreeList;
UDATA *ramClassInFreqUDATABlockFreeList;
} J9RAMClassUDATABlockFreeList;

typedef struct J9ClassLoader {
struct J9Pool* sharedLibraries;
Expand All @@ -3589,10 +3600,10 @@ typedef struct J9ClassLoader {
#endif /* defined(J9VM_NEEDS_JNI_REDIRECTION) */
struct J9JITExceptionTable* jitMetaDataList;
struct J9MemorySegment* classSegments;
struct J9RAMClassFreeListBlock* ramClassLargeBlockFreeList;
struct J9RAMClassFreeListBlock* ramClassSmallBlockFreeList;
struct J9RAMClassFreeListBlock* ramClassTinyBlockFreeList;
UDATA* ramClassUDATABlockFreeList;
struct J9RAMClassFreeLists sub4gBlock;
struct J9RAMClassFreeLists frequentlyAccessedBlock;
struct J9RAMClassFreeLists inFrequentlyAccessedBlock;
struct J9RAMClassUDATABlockFreeList ramClassUDATABlocks;
struct J9HashTable* redefinedClasses;
struct J9NativeLibrary* librariesHead;
struct J9NativeLibrary* librariesTail;
Expand Down Expand Up @@ -4950,9 +4961,6 @@ typedef struct J9InternalVMFunctions {
void ( *printThreadInfo)(struct J9JavaVM *vm, struct J9VMThread *self, char *toFile, BOOLEAN allThreads) ;
void (JNICALL *initializeAttachedThread)(struct J9VMThread *vmContext, const char *name, j9object_t *group, UDATA daemon, struct J9VMThread *initializee) ;
void ( *initializeMethodRunAddressNoHook)(struct J9JavaVM* vm, J9Method *method) ;
#if defined(J9VM_OPT_SNAPSHOTS)
void ( *initializeMethodRunAddressForSnapshot)(struct J9JavaVM *vm, struct J9Method *method) ;
#endif /* defined(J9VM_OPT_SNAPSHOTS) */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same rebasing comment here. This shouldn't be removed.

void (JNICALL *sidecarInvokeReflectMethod)(struct J9VMThread *vmContext, jobject methodRef, jobject recevierRef, jobjectArray argsRef) ;
void (JNICALL *sidecarInvokeReflectConstructor)(struct J9VMThread *vmContext, jobject constructorRef, jobject recevierRef, jobjectArray argsRef) ;
struct J9MemorySegmentList* ( *allocateMemorySegmentListWithSize)(struct J9JavaVM * javaVM, U_32 numberOfMemorySegments, UDATA sizeOfElements, U_32 memoryCategory) ;
Expand Down
Loading