Skip to content

Commit

Permalink
Merge pull request #20513 from LinHu2016/coding-std-update1
Browse files Browse the repository at this point in the history
Clean up ConstantPoolObjectSlotIterator class
  • Loading branch information
amicic authored Nov 22, 2024
2 parents ff43532 + 0fbea67 commit 1f5ad00
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions runtime/gc_structs/ConstantPoolObjectSlotIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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))) {
Expand All @@ -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;

Expand Down
26 changes: 13 additions & 13 deletions runtime/gc_structs/ConstantPoolObjectSlotIterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand All @@ -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.
Expand Down

0 comments on commit 1f5ad00

Please sign in to comment.