From 0fbea67cf4f30041bc107cbe6f1fa3c575e66694 Mon Sep 17 00:00:00 2001 From: lhu Date: Tue, 5 Nov 2024 10:37:58 -0500 Subject: [PATCH] Clean up ConstantPoolObjectSlotIterator class Use consistent data types and code formatting Signed-off-by: lhu --- .../ConstantPoolObjectSlotIterator.cpp | 12 ++++----- .../ConstantPoolObjectSlotIterator.hpp | 26 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/runtime/gc_structs/ConstantPoolObjectSlotIterator.cpp b/runtime/gc_structs/ConstantPoolObjectSlotIterator.cpp index b5eb8eae4bd..ffb14376f9d 100644 --- a/runtime/gc_structs/ConstantPoolObjectSlotIterator.cpp +++ b/runtime/gc_structs/ConstantPoolObjectSlotIterator.cpp @@ -40,8 +40,8 @@ */ j9object_t * GC_ConstantPoolObjectSlotIterator::nextSlot() { - U_32 slotType; - j9object_t *slotPtr; + uint32_t slotType = 0; + j9object_t *slotPtr = NULL; j9object_t *result = NULL; while (_cpEntryCount) { @@ -58,13 +58,13 @@ GC_ConstantPoolObjectSlotIterator::nextSlot() { switch (slotType) { case J9CPTYPE_STRING: /* fall through */ case J9CPTYPE_ANNOTATION_UTF8: - result = &(((J9RAMStringRef *) slotPtr)->stringObject); + result = &(((J9RAMStringRef *)slotPtr)->stringObject); break; case J9CPTYPE_METHOD_TYPE: - result = &(((J9RAMMethodTypeRef *) slotPtr)->type); + result = &(((J9RAMMethodTypeRef *)slotPtr)->type); break; case J9CPTYPE_METHODHANDLE: - result = &(((J9RAMMethodHandleRef *) slotPtr)->methodHandle); + result = &(((J9RAMMethodHandleRef *)slotPtr)->methodHandle); break; case J9CPTYPE_CONSTANT_DYNAMIC: if (NULL != (result = _constantDynamicSlotIterator.nextSlot(slotPtr))) { @@ -78,7 +78,7 @@ GC_ConstantPoolObjectSlotIterator::nextSlot() { } /* Adjust the CP slot and description information */ - _cpEntry = (j9object_t *) (((U_8 *) _cpEntry) + _cpEntry = (j9object_t *)(((uint8_t *)_cpEntry) + sizeof(J9RAMConstantPoolItem)); _cpEntryCount -= 1; diff --git a/runtime/gc_structs/ConstantPoolObjectSlotIterator.hpp b/runtime/gc_structs/ConstantPoolObjectSlotIterator.hpp index a60cbc6a4c2..838ae965657 100644 --- a/runtime/gc_structs/ConstantPoolObjectSlotIterator.hpp +++ b/runtime/gc_structs/ConstantPoolObjectSlotIterator.hpp @@ -29,11 +29,11 @@ #if !defined(CONSTANTPOOLOBJECTSLOTITERATOR_HPP_) #define CONSTANTPOOLOBJECTSLOTITERATOR_HPP_ +#include "j2sever.h" #include "j9.h" #include "j9cfg.h" #include "j9cp.h" #include "modron.h" -#include "j2sever.h" #include "ModronAssertions.h" @@ -48,26 +48,26 @@ class GC_ConstantPoolObjectSlotIterator { j9object_t *_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; GC_ConstantDynamicSlotIterator _constantDynamicSlotIterator; public: - GC_ConstantPoolObjectSlotIterator(J9JavaVM *vm, J9Class *clazz) : - _cpEntry((j9object_t *)J9_CP_FROM_CLASS(clazz)), - _cpEntryCount(clazz->romClass->ramConstantPoolCount), - _constantDynamicSlotIterator() + GC_ConstantPoolObjectSlotIterator(J9JavaVM *vm, J9Class *clazz) + : _cpEntry((j9object_t *)J9_CP_FROM_CLASS(clazz)) + , _cpEntryCount(clazz->romClass->ramConstantPoolCount) + , _constantDynamicSlotIterator() { _cpEntryTotal = _cpEntryCount; - if(_cpEntryCount) { - _cpDescriptionSlots = SRP_PTR_GET(&clazz->romClass->cpShapeDescription, U_32 *); + if (0 != _cpEntryCount) { + _cpDescriptionSlots = SRP_PTR_GET(&clazz->romClass->cpShapeDescription, uint32_t *); _cpDescriptionIndex = 0; } - }; + } /** * Gets the current constant pool index.