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

Warnings Cleanup #20039

Merged
merged 5 commits into from
Sep 27, 2024
Merged
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
4 changes: 2 additions & 2 deletions runtime/compiler/runtime/SymbolValidationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1321,10 +1321,10 @@ TR::SymbolValidationManager::validateDeclaringClassFromFieldOrStaticRecord(uint1
{
TR::VMAccessCriticalSection getDeclaringClassFromFieldOrStatic(_fej9);

int32_t fieldLen;
int32_t fieldLen = 0;
char *field = cpIndex >= 0 ? utf8Data(J9ROMNAMEANDSIGNATURE_NAME(J9ROMFIELDREF_NAMEANDSIGNATURE(&romCPBase[cpIndex])), fieldLen) : 0;

int32_t sigLen;
int32_t sigLen = 0;
char *sig = cpIndex >= 0 ? utf8Data(J9ROMNAMEANDSIGNATURE_SIGNATURE(J9ROMFIELDREF_NAMEANDSIGNATURE(&romCPBase[cpIndex])), sigLen) : 0;

_vmThread->javaVM->internalVMFunctions->instanceFieldOffset(
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/z/codegen/InMemoryLoadStoreMarking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void InMemoryLoadStoreMarking::clearLoadLists()
_BCDConditionalCleanLoadList.deleteAll();
}

char *InMemoryLoadStoreMarking::_TR_NodeListTypeNames[NodeList_NumTypes] =
const char *InMemoryLoadStoreMarking::_TR_NodeListTypeNames[NodeList_NumTypes] =
{
"LoadList",
"ConditionalCleanLoadList",
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/z/codegen/InMemoryLoadStoreMarking.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ class InMemoryLoadStoreMarking
void clearAllLists();
void clearLoadLists();

static char *getName(TR_NodeListTypes s)
static const char *getName(TR_NodeListTypes s)
{
if (s < NodeList_NumTypes)
return _TR_NodeListTypeNames[s];
else
return (char*)"UnknownNodeListType";
return "UnknownNodeListType";
}

static char *_TR_NodeListTypeNames[NodeList_NumTypes];
static const char *_TR_NodeListTypeNames[NodeList_NumTypes];
};

#endif
2 changes: 1 addition & 1 deletion runtime/compiler/z/codegen/J9BCDTreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5522,7 +5522,7 @@ TR::Register *
J9::Z::TreeEvaluator::pddivremVectorEvaluatorHelper(TR::Node * node, TR::CodeGenerator * cg)
{
TR::Register* vTargetReg = NULL;
TR::InstOpCode::Mnemonic opCode;
TR::InstOpCode::Mnemonic opCode = TR::InstOpCode::bad;
switch(node->getOpCodeValue())
{
case TR::pddiv:
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/z/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ J9::Z::CodeGenerator::callUsesHelperImplementation(TR::Symbol *sym)
TR::Linkage *
J9::Z::CodeGenerator::createLinkage(TR_LinkageConventions lc)
{
TR::Linkage * linkage;
TR::Linkage * linkage = NULL;
switch (lc)
{
case TR_CHelper:
Expand Down Expand Up @@ -3263,9 +3263,9 @@ J9::Z::CodeGenerator::checkFieldAlignmentForAtomicLong()
if (!classBlock)
return false;

char* fieldName = "value";
const char * fieldName = "value";
int32_t fieldNameLen = 5;
char * fieldSig = "J";
const char * fieldSig = "J";
int32_t fieldSigLen = 1;
int32_t intOrBoolOffset = self()->fe()->getObjectHeaderSizeInBytes() + self()->fej9()->getInstanceFieldOffset(classBlock, fieldName, fieldNameLen, fieldSig, fieldSigLen);
return (intOrBoolOffset & 0x3) == 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Given the name of the function, I suspect 0x3 ought to be 0x07 (that the offset is a multiple of 8).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this part of code needs some investigation - Looking at the places where we would use this query will be while inlining method from AtomicLong and the value (confirmed with sig is long), Sincename intOrBoolOffset sounds contradictory to the name of the function, and change this as a separate PR if Keith you are OK with it, I would like @matthewhall2 to verify and fix this as a separate PR ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@keithc-ca ping to see what you think about above ? As I said what you pointed out is correct, but given that the this code is there since long I think a verification from @matthewhall2 is warranted on places where this query is used, so I think this can be done as a separate change (As original purpose of this PR from @matthewhall2 was to clean-up some of the warnings we saw with OpenXL compiles).

@matthewhall2 can open up the issue and get started on it to keep track of this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think it makes sense to investigate and make any necessary changes for that mask separately.

Expand Down
22 changes: 15 additions & 7 deletions runtime/compiler/z/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3533,7 +3533,7 @@ generateTestBitFlag(
int32_t size,
uint64_t bitFlag)
{
TR::MemoryReference * tempMR;
TR::MemoryReference * tempMR = NULL;
int shiftForFlag = TR::TreeEvaluator::checkNonNegativePowerOfTwo((int64_t) bitFlag);
TR_ASSERT(shiftForFlag > 0, "generateTestBitFlag: flag is assumed to be power of 2\n");

Expand Down Expand Up @@ -3822,7 +3822,7 @@ VMCardCheckEvaluator(
uintptr_t cardSize = comp->getOptions()->getGcCardSize();
int32_t shiftValue = TR::TreeEvaluator::checkNonNegativePowerOfTwo((int32_t) cardSize);

TR::Register * cardOffReg;
TR::Register * cardOffReg = NULL;
TR::Register * mdReg = cg->getMethodMetaDataRealRegister();

if (!clobberDstReg)
Expand Down Expand Up @@ -5304,6 +5304,8 @@ J9::Z::TreeEvaluator::DIVCHKEvaluator(TR::Node * node, TR::CodeGenerator * cg)
case TR::irem:
iDivRemGenericEvaluator(node->getFirstChild(), cg, false, divisorMr);
break;
default:
break;
}
divisorMr->stopUsingMemRefRegister(cg);
}
Expand Down Expand Up @@ -5690,7 +5692,7 @@ J9::Z::TreeEvaluator::ArrayCopyBNDCHKEvaluator(TR::Node * node, TR::CodeGenerato
}

bool disableS390CompareAndTrap = comp->getOption(TR_DisableTraps);
static const char*disableS390CompareAndBranch = feGetEnv("TR_DISABLES390CompareAndBranch");
static const char * disableS390CompareAndBranch = feGetEnv("TR_DISABLES390CompareAndBranch");
if (cg->getHasResumableTrapHandler() &&
!disableS390CompareAndTrap &&
arrayTargetLengthReg != NULL &&
Expand Down Expand Up @@ -9544,7 +9546,7 @@ J9::Z::TreeEvaluator::VMmonentEvaluator(TR::Node * node, TR::CodeGenerator * cg)
lockPreservingReg = cg->allocateRegister();
conditions->addPostCondition(lockPreservingReg, TR::RealRegister::AssignAny);
}
const char* debugCounterNamePrefix = normalLockWithReservationPreserving? "LockEnt/Preserving": "LockEnt/Normal";
const char * debugCounterNamePrefix = normalLockWithReservationPreserving? "LockEnt/Preserving": "LockEnt/Normal";
// Opcodes:
bool use64b = true;
if (cg->comp()->target().is64Bit() && fej9->generateCompressedLockWord())
Expand Down Expand Up @@ -10689,7 +10691,7 @@ J9::Z::TreeEvaluator::VMnewEvaluator(TR::Node * node, TR::CodeGenerator * cg)
bool isArray = false, isDoubleArray = false;
bool isVariableLen;
int32_t litPoolRegTotalUse, temp2RegTotalUse;
int32_t elementSize;
int32_t elementSize = 0;
TR::Compilation *comp = cg->comp();
TR_J9VMBase *fej9 = comp->fej9();

Expand Down Expand Up @@ -11647,6 +11649,8 @@ J9::Z::TreeEvaluator::VMinlineCallEvaluator(TR::Node * node, bool indirect, TR::
callWasInlined = inlineIsAssignableFrom(node, cg);
break;
}
default:
break;
}
}

Expand Down Expand Up @@ -12457,6 +12461,8 @@ J9::Z::TreeEvaluator::inlineAtomicOps(TR::Node *node, TR::CodeGenerator *cg, int
delta = (int64_t)-1;
break;
}
default:
break;
}

//Determine the offset of the value field
Expand All @@ -12470,7 +12476,7 @@ J9::Z::TreeEvaluator::inlineAtomicOps(TR::Node *node, TR::CodeGenerator *cg, int
if (!isArray)
{
TR_OpaqueClassBlock * bdClass;
char *className, *fieldSig;
const char * className, * fieldSig;
int32_t classNameLen, fieldSigLen;

fieldSigLen = 1;
Expand Down Expand Up @@ -12761,7 +12767,7 @@ J9::Z::TreeEvaluator::inlineAtomicFieldUpdater(TR::Node *node, TR::CodeGenerator
bool isGetAndOp = true;
bool isArgConstant = false;
int32_t delta = 1;
char* className = "java/util/concurrent/atomic/AtomicIntegerFieldUpdater$AtomicIntegerFieldUpdaterImpl";
const char * className = "java/util/concurrent/atomic/AtomicIntegerFieldUpdater$AtomicIntegerFieldUpdaterImpl";
int32_t classNameLen = 83;

switch (currentMethod)
Expand All @@ -12779,6 +12785,8 @@ J9::Z::TreeEvaluator::inlineAtomicFieldUpdater(TR::Node *node, TR::CodeGenerator
case TR::java_util_concurrent_atomic_AtomicIntegerFieldUpdater_addAndGet:
isGetAndOp = false;
break;
default:
break;
}

// getting the offsets to various fields: tclass, class, offset
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/z/codegen/S390J9CallSnippet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TR::S390J9CallSnippet::generateVIThunk(TR::Node * callNode, int32_t argSize, TR:
// make it double-word aligned
codeSize = (codeSize + 7) / 8 * 8 + 8; // Additional 4 bytes to hold size of thunk
uint8_t * thunk, * cursor, * returnValue;
TR::SymbolReference *dispatcherSymbol;
TR::SymbolReference *dispatcherSymbol = NULL;

if (fej9->storeOffsetToArgumentsInVirtualIndirectThunks())
thunk = (uint8_t *)comp->trMemory()->allocateMemory(codeSize, heapAlloc);
Expand Down Expand Up @@ -151,7 +151,7 @@ TR::S390J9CallSnippet::generateInvokeExactJ2IThunk(TR::Node * callNode, int32_t
TR_MHJ2IThunk *thunk = TR_MHJ2IThunk::allocate(codeSize, signature, cg, thunkTable);
uint8_t *cursor = thunk->entryPoint();

TR::SymbolReference *dispatcherSymbol;
TR::SymbolReference *dispatcherSymbol = NULL;
switch (callNode->getDataType())
{
case TR::NoType:
Expand Down Expand Up @@ -201,7 +201,7 @@ TR::S390J9CallSnippet::generateInvokeExactJ2IThunk(TR::Node * callNode, int32_t
*(uint32_t *) cursor = 0xe3000006 + finalCallLength + (rEP << 12) + (rEP << 20); // LG rEP,8(,rEP)
cursor += 4;
*(uint16_t *) cursor = 0x0004;
cursor += 2;sizeof(int16_t);
cursor += sizeof(int16_t);
}
else
{
Expand Down
14 changes: 8 additions & 6 deletions runtime/compiler/z/codegen/S390PrivateLinkage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ J9::Z::PrivateLinkage::mapCompactedStack(TR::ResolvedMethodSymbol * method)
{
if (localCursor->getGCMapIndex() >= 0)
{
TR_IGNode *igNode;
if (igNode = cg()->getLocalsIG()->getIGNodeForEntity(localCursor))
TR_IGNode *igNode = cg()->getLocalsIG()->getIGNodeForEntity(localCursor);
if (NULL != igNode)
{
IGNodeColour colour = igNode->getColour();

Expand Down Expand Up @@ -447,8 +447,8 @@ J9::Z::PrivateLinkage::mapCompactedStack(TR::ResolvedMethodSymbol * method)
for (localCursor = automaticIterator.getFirst(); localCursor; localCursor = automaticIterator.getNext())
if (localCursor->getGCMapIndex() < 0)
{
TR_IGNode *igNode;
if (igNode = cg()->getLocalsIG()->getIGNodeForEntity(localCursor))
TR_IGNode *igNode = cg()->getLocalsIG()->getIGNodeForEntity(localCursor);
if (NULL != igNode)
{
IGNodeColour colour = igNode->getColour();

Expand Down Expand Up @@ -520,8 +520,8 @@ J9::Z::PrivateLinkage::mapCompactedStack(TR::ResolvedMethodSymbol * method)
for (localCursor = automaticIterator.getFirst(); localCursor; localCursor = automaticIterator.getNext())
if (localCursor->getGCMapIndex() < 0)
{
TR_IGNode *igNode;
if (igNode = cg()->getLocalsIG()->getIGNodeForEntity(localCursor))
TR_IGNode *igNode = igNode = cg()->getLocalsIG()->getIGNodeForEntity(localCursor);
if (NULL != igNode)
{
IGNodeColour colour = igNode->getColour();

Expand Down Expand Up @@ -3120,6 +3120,8 @@ J9::Z::PrivateLinkage::addSpecialRegDepsForBuildArgs(TR::Node * callNode, TR::Re
case TR::com_ibm_jit_JITHelpers_dispatchVirtual:
specialArgReg = getVTableIndexArgumentRegister();
break;
default:
break;
}

if (specialArgReg != TR::RealRegister::NoReg)
Expand Down