Skip to content

Commit

Permalink
Clean up ConstantPoolClassSlotIterator class
Browse files Browse the repository at this point in the history
Use consistent data types and code formatting

Signed-off-by: lhu <linhu@ca.ibm.com>
  • Loading branch information
LinHu2016 committed Nov 8, 2024
1 parent 1fb0961 commit c1c5ec7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions runtime/gc_structs/ConstantPoolClassSlotIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ GC_ConstantPoolClassSlotIterator::nextSlot()
_cpDescriptionIndex = J9_CP_DESCRIPTIONS_PER_U32;
}

U_32 slotType = _cpDescription & J9_CP_DESCRIPTION_MASK;
uint32_t slotType = _cpDescription & J9_CP_DESCRIPTION_MASK;
J9Object **slotPtr = _cpEntry;

/* Adjust the CP slot and description information */
_cpEntry = (J9Object **)( ((U_8 *)_cpEntry) + sizeof(J9RAMConstantPoolItem) );
_cpEntry = (J9Object **)( ((uint8_t *)_cpEntry) + sizeof(J9RAMConstantPoolItem));
_cpEntryCount -= 1;

_cpDescription >>= J9_CP_BITS_PER_DESCRIPTION;
Expand Down
23 changes: 11 additions & 12 deletions runtime/gc_structs/ConstantPoolClassSlotIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,30 @@ class GC_ConstantPoolClassSlotIterator
{

J9Object **_cpEntry;
U_32 _cpEntryCount;
U_32 _cpEntryTotal;
U_32 *_cpDescriptionSlots;
U_32 _cpDescription;
UDATA _cpDescriptionIndex;
uint32_t _cpEntryCount;
uint32_t _cpEntryTotal;
uint32_t *_cpDescriptionSlots;
uint32_t _cpDescription;
uintptr_t _cpDescriptionIndex;

public:
GC_ConstantPoolClassSlotIterator(J9Class *clazz) :
_cpEntry((J9Object **)J9_CP_FROM_CLASS(clazz)),
_cpEntryCount(clazz->romClass->ramConstantPoolCount)
GC_ConstantPoolClassSlotIterator(J9Class *clazz)
: _cpEntry((J9Object **)J9_CP_FROM_CLASS(clazz))
, _cpEntryCount(clazz->romClass->ramConstantPoolCount)
{
_cpEntryTotal = _cpEntryCount;
if(_cpEntryCount) {
_cpDescriptionSlots = SRP_PTR_GET(&clazz->romClass->cpShapeDescription, U_32 *);
if (_cpEntryCount) {
_cpDescriptionSlots = SRP_PTR_GET(&clazz->romClass->cpShapeDescription, uint32_t *);
_cpDescriptionIndex = 0;
}

};

/**
* Gets the current constant pool index.
* @return zero based constant pool index of the entry returned by the last call of nextSlot.
* @return -1 if nextSlot has yet to be called.
*/
MMINLINE IDATA getIndex() {
MMINLINE intptr_t getIndex() {
return _cpEntryTotal - _cpEntryCount - 1;
}

Expand Down

0 comments on commit c1c5ec7

Please sign in to comment.