Skip to content

Commit

Permalink
line endings and name updates
Browse files Browse the repository at this point in the history
  • Loading branch information
h3110n3rv3 committed Dec 17, 2024
1 parent 2e22055 commit 131afed
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 47 deletions.
8 changes: 4 additions & 4 deletions runtime/jcl/common/mgmtmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ Java_com_ibm_java_lang_management_internal_MemoryMXBeanImpl_getNonHeapMemoryUsag
omrthread_monitor_enter(javaVM->classTableMutex);
classLoader = javaVM->internalVMFunctions->allClassLoadersStartDo(&walkState, javaVM, 0);
while (NULL != classLoader) {
RamClassUDATABlockFreelist *udataFreeListBlock = &classLoader->ramClassUDATABlocks;
J9RAMClassFreeListBlockType *sub4gFreeListBlock = &classLoader->sub4gBlock;
J9RAMClassFreeListBlockType *freqFreeListBlock = &classLoader->frequentlyAccessedBlock;
J9RAMClassFreeListBlockType *InFreqFreeListBlock = &classLoader->inFrequentlyAccessedBlock;
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;
Expand Down
20 changes: 10 additions & 10 deletions runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -3569,17 +3569,17 @@ typedef struct J9HookedNative {
} J9HookedNative;

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

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

typedef struct J9ClassLoader {
struct J9Pool* sharedLibraries;
Expand All @@ -3600,10 +3600,10 @@ typedef struct J9ClassLoader {
#endif /* defined(J9VM_NEEDS_JNI_REDIRECTION) */
struct J9JITExceptionTable* jitMetaDataList;
struct J9MemorySegment* classSegments;
struct J9RAMClassFreeListBlockType sub4gBlock;
struct J9RAMClassFreeListBlockType frequentlyAccessedBlock;
struct J9RAMClassFreeListBlockType inFrequentlyAccessedBlock;
struct RamClassUDATABlockFreelist ramClassUDATABlocks;
struct J9RAMClassFreeLists sub4gBlock;
struct J9RAMClassFreeLists frequentlyAccessedBlock;
struct J9RAMClassFreeLists inFrequentlyAccessedBlock;
struct J9RAMClassUDATABlockFreeList ramClassUDATABlocks;
struct J9HashTable* redefinedClasses;
struct J9NativeLibrary* librariesHead;
struct J9NativeLibrary* librariesTail;
Expand Down
54 changes: 21 additions & 33 deletions runtime/vm/createramclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ typedef struct J9RAMClassFreeListLargeBlock {
UDATA maxSizeInList;
} J9RAMClassFreeListLargeBlock;

enum SegmentType {
enum SegmentKind {
SUB4G = 0,
FREQUENTLY_ACCESSED,
INFREQUENTLY_ACCESSED
Expand All @@ -121,7 +121,7 @@ typedef struct RAMClassAllocationRequest {
UDATA *address;
UDATA index;
UDATA fragmentSize;
SegmentType segmentType;
SegmentKind segmentType;
struct RAMClassAllocationRequest *next;
} RAMClassAllocationRequest;

Expand Down Expand Up @@ -3738,7 +3738,7 @@ internalCreateRAMClassFromROMClass(J9VMThread *vmThread, J9ClassLoader *classLoa
}

static VMINLINE void
addBlockToLargeFreeList(J9ClassLoader *classLoader, J9RAMClassFreeListLargeBlock *block, J9RAMClassFreeListBlockType *blockType)
addBlockToLargeFreeList(J9ClassLoader *classLoader, J9RAMClassFreeListLargeBlock *block, J9RAMClassFreeLists *blockType)
{
J9RAMClassFreeListLargeBlock *tailBlock = (J9RAMClassFreeListLargeBlock *) blockType->ramClassLargeBlockFreeList;

Expand All @@ -3753,7 +3753,7 @@ addBlockToLargeFreeList(J9ClassLoader *classLoader, J9RAMClassFreeListLargeBlock
}

static void
addBlockToFreeList(J9ClassLoader *classLoader, UDATA address, UDATA size, J9RAMClassFreeListBlockType *blockType, UDATA *ramClassUDATABlockFreelist)
addBlockToFreeList(J9ClassLoader *classLoader, UDATA address, UDATA size, J9RAMClassFreeLists *blockType, UDATA *ramClassUDATABlockFreelist)
{
if (J9_ARE_ANY_BITS_SET(classLoader->flags, J9CLASSLOADER_ANON_CLASS_LOADER)) {
/* We support individual class unloading for anonymous classes, so each anonymous class
Expand All @@ -3763,7 +3763,7 @@ addBlockToFreeList(J9ClassLoader *classLoader, UDATA address, UDATA size, J9RAMC
}
if (sizeof(UDATA) == size) {
UDATA *block = (UDATA *) address;
*block = (UDATA) ramClassUDATABlockFreelist;
*block = (UDATA)ramClassUDATABlockFreelist;
ramClassUDATABlockFreelist = block;
} else if (sizeof(J9RAMClassFreeListBlock) <= size) {
J9RAMClassFreeListBlock *block = (J9RAMClassFreeListBlock *) address;
Expand All @@ -3786,7 +3786,7 @@ addBlockToFreeList(J9ClassLoader *classLoader, UDATA address, UDATA size, J9RAMC
* list to update their maxSizeInList values.
*/
static void
removeBlockFromLargeFreeList(J9ClassLoader *classLoader, J9RAMClassFreeListLargeBlock **freeListBlockPtr, J9RAMClassFreeListLargeBlock *freeListBlock, J9RAMClassFreeListBlockType *blockType)
removeBlockFromLargeFreeList(J9ClassLoader *classLoader, J9RAMClassFreeListLargeBlock **freeListBlockPtr, J9RAMClassFreeListLargeBlock *freeListBlock, J9RAMClassFreeLists *blockType)
{
J9RAMClassFreeListLargeBlock *nextBlock = freeListBlock->nextFreeListBlock;

Expand Down Expand Up @@ -3816,7 +3816,7 @@ removeBlockFromLargeFreeList(J9ClassLoader *classLoader, J9RAMClassFreeListLarge
* Returns TRUE if the fragment was allocated.
*/
static BOOLEAN
allocateRAMClassFragmentFromFreeList(RAMClassAllocationRequest *request, J9RAMClassFreeListBlock **freeList, J9ClassLoader *classLoader, UDATA *ramClassUDATABlockFreelist, J9RAMClassFreeListBlockType *blockType)
allocateRAMClassFragmentFromFreeList(RAMClassAllocationRequest *request, J9RAMClassFreeListBlock **freeList, J9ClassLoader *classLoader, UDATA *ramClassUDATABlockFreelist, J9RAMClassFreeLists *blockType)
{
J9RAMClassFreeListBlock **freeListBlockPtr = freeList;
J9RAMClassFreeListBlock *freeListBlock = *freeListBlockPtr;
Expand All @@ -3837,7 +3837,7 @@ allocateRAMClassFragmentFromFreeList(RAMClassAllocationRequest *request, J9RAMCl

while (NULL != freeListBlock) {
/* Allocate from the start of the block */
UDATA addressForAlignedArea = ((UDATA) freeListBlock) + prefixSize;
UDATA addressForAlignedArea = ((UDATA)freeListBlock) + prefixSize;
UDATA alignmentMod = addressForAlignedArea & alignmentMask;
UDATA alignmentShift = (0 == alignmentMod) ? 0 : (alignment - alignmentMod);

Expand All @@ -3857,12 +3857,12 @@ allocateRAMClassFragmentFromFreeList(RAMClassAllocationRequest *request, J9RAMCl

/* Add a new block with the remaining space at the start of this block, if any, to an appropriate free list */
if (0 != alignmentShift) {
addBlockToFreeList(classLoader, (UDATA) freeListBlock, alignmentShift, blockType, ramClassUDATABlockFreelist);
addBlockToFreeList(classLoader, (UDATA)freeListBlock, alignmentShift, blockType, ramClassUDATABlockFreelist);
}

/* Add a new block with the remaining space at the end of this block, if any, to an appropriate free list */
if (0 != newBlockSize) {
addBlockToFreeList(classLoader, ((UDATA) freeListBlock) + alignmentShift + request->fragmentSize, newBlockSize, blockType, ramClassUDATABlockFreelist);
addBlockToFreeList(classLoader, ((UDATA)freeListBlock) + alignmentShift + request->fragmentSize, newBlockSize, blockType, ramClassUDATABlockFreelist);
}

return TRUE;
Expand All @@ -3880,7 +3880,7 @@ allocateRAMClassFragmentFromFreeList(RAMClassAllocationRequest *request, J9RAMCl
* Allocates fragments from free list.
*/
static void
allocateFreeListBlock (RAMClassAllocationRequest *request, J9ClassLoader *classLoader, RAMClassAllocationRequest *prev, J9RAMClassFreeListBlockType *blockType, UDATA *ramClassUDATABlockFreelist)
allocateFreeListBlock (RAMClassAllocationRequest *request, J9ClassLoader *classLoader, RAMClassAllocationRequest *prev, J9RAMClassFreeLists *blockType, UDATA *ramClassUDATABlockFreelist)
{
if ((sizeof(UDATA) == request->fragmentSize)
&& (NULL != ramClassUDATABlockFreelist)
Expand All @@ -3893,10 +3893,10 @@ allocateFreeListBlock (RAMClassAllocationRequest *request, J9ClassLoader *classL
UDATA **blockPtr = &ramClassUDATABlockFreelist;
while (NULL != block) {
/* Check alignment constraint */
if (0 == (((UDATA) block) & (request->alignment - 1))) {
if (0 == (((UDATA)block) & (request->alignment - 1))) {
/* Unhook block from list */
*blockPtr = *(UDATA **) block;
*block = (UDATA) NULL;
*block = (UDATA)NULL;

/* Record allocation & adjust for alignment */
request->address = block;
Expand Down Expand Up @@ -4049,7 +4049,7 @@ internalAllocateRAMClass(J9JavaVM *javaVM, J9ClassLoader *classLoader, RAMClassA
/* TODO attempt to coalesce free blocks? */
for (i = 0; i < allocationRequestCount; i++) {
if (NULL != allocationRequests[i].address) {
UDATA fragmentAddress = ((UDATA) allocationRequests[i].address) - allocationRequests[i].prefixSize;
UDATA fragmentAddress = ((UDATA)allocationRequests[i].address) - allocationRequests[i].prefixSize;
if(SUB4G == allocationRequests[i].segmentType)
{
addBlockToFreeList(classLoader, fragmentAddress, allocationRequests[i].fragmentSize, &classLoader->sub4gBlock, classLoader->ramClassUDATABlocks.ramClassSub4gUDATABlockFreeList);
Expand All @@ -4073,7 +4073,7 @@ internalAllocateRAMClass(J9JavaVM *javaVM, J9ClassLoader *classLoader, RAMClassA
newSegment->heapAlloc = newSegment->heapTop;

/* Allocate the remaining fragments in the new segment, adding holes to the free list */
allocAddress = ((UDATA) newSegment->heapBase) + sizeof(UDATA);
allocAddress = ((UDATA)newSegment->heapBase) + sizeof(UDATA);
for (request = requests; NULL != request; request = request->next) {
/* Allocate from the start of the segment */
UDATA addressForAlignedArea = allocAddress + request->prefixSize;
Expand All @@ -4088,33 +4088,21 @@ internalAllocateRAMClass(J9JavaVM *javaVM, J9ClassLoader *classLoader, RAMClassA
if (0 != alignmentShift) {
if(SUB4G == request->segmentType)
{
addBlockToFreeList(classLoader, (UDATA) allocAddress, alignmentShift, &classLoader->sub4gBlock, classLoader->ramClassUDATABlocks.ramClassSub4gUDATABlockFreeList);
addBlockToFreeList(classLoader, (UDATA)allocAddress, alignmentShift, &classLoader->sub4gBlock, classLoader->ramClassUDATABlocks.ramClassSub4gUDATABlockFreeList);
} else if (FREQUENTLY_ACCESSED == request->segmentType) {
addBlockToFreeList(classLoader, (UDATA) allocAddress, alignmentShift, &classLoader->frequentlyAccessedBlock, classLoader->ramClassUDATABlocks.ramClassFreqUDATABlockFreeList);
addBlockToFreeList(classLoader, (UDATA)allocAddress, alignmentShift, &classLoader->frequentlyAccessedBlock, classLoader->ramClassUDATABlocks.ramClassFreqUDATABlockFreeList);
} else if (INFREQUENTLY_ACCESSED == request->segmentType) {
addBlockToFreeList(classLoader, (UDATA) allocAddress, alignmentShift, &classLoader->inFrequentlyAccessedBlock, classLoader->ramClassUDATABlocks.ramClassInFreqUDATABlockFreeList);
addBlockToFreeList(classLoader, (UDATA)allocAddress, alignmentShift, &classLoader->inFrequentlyAccessedBlock, classLoader->ramClassUDATABlocks.ramClassInFreqUDATABlockFreeList);
}
}

allocAddress += alignmentShift + request->fragmentSize;

fragmentsLeftToAllocate--;
}

/* Add a new block with the remaining space at the end of this segment, if any, to an appropriate free list */
if (allocAddress != (UDATA) newSegment->heapTop) {
if (allocAddress != (UDATA)newSegment->heapTop) {
addBlockToFreeList(classLoader, (UDATA)allocAddress, ((UDATA)newSegment->heapTop) - allocAddress, &classLoader->inFrequentlyAccessedBlock, classLoader->ramClassUDATABlocks.ramClassInFreqUDATABlockFreeList);
/*if(SUB4G == request->segmentType)
{
addBlockToFreeList(classLoader, (UDATA) allocAddress, ((UDATA) newSegment->heapTop) - allocAddress, &classLoader->sub4gBlock, classLoader->ramClassUDATABlocks.ramClassSub4gUDATABlockFreeList);
} else if (FREQUENTLY_ACCESSED == request->segmentType)
{
addBlockToFreeList(classLoader, (UDATA) allocAddress, ((UDATA) newSegment->heapTop) - allocAddress, &classLoader->frequentlyAccessedBlock, classLoader->ramClassUDATABlocks.ramClassFreqUDATABlockFreeList);
} else if (INFREQUENTLY_ACCESSED == request->segmentType)
{
addBlockToFreeList(classLoader, (UDATA) allocAddress, ((UDATA) newSegment->heapTop) - allocAddress, &classLoader->inFrequentlyAccessedBlock, classLoader->ramClassUDATABlocks.ramClassInFreqUDATABlockFreeList);
}*/
}
}
}

/* Clear all allocated fragments */
Expand Down

0 comments on commit 131afed

Please sign in to comment.