Skip to content

Commit

Permalink
Merge pull request #7186 from dylanjtuttle/constCharStep2
Browse files Browse the repository at this point in the history
Fix string literal conversion warnings in env
  • Loading branch information
hzongaro authored Dec 8, 2023
2 parents e5e7d55 + d9016be commit 137778a
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion compiler/codegen/CodeGenPrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ OMR::CodeGenerator::insertDebugCounters()
else
{
int32_t length;
char *className = TR::Compiler->cls.classNameChars(self()->comp(), (TR_OpaqueClassBlock*)classChild->getSymbol()->castToStaticSymbol()->getStaticAddress(), length);
const char *className = TR::Compiler->cls.classNameChars(self()->comp(), (TR_OpaqueClassBlock*)classChild->getSymbol()->castToStaticSymbol()->getStaticAddress(), length);
TR::DebugCounter::prependDebugCounter(self()->comp(), TR::DebugCounter::debugCounterName(self()->comp(),
"allocations/%s/(%.*s)", opName, length, className
), tt);
Expand Down
4 changes: 2 additions & 2 deletions compiler/codegen/OMRCodeGenPhase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ OMR::CodeGenPhase::performProcessRelocationsPhase(TR::CodeGenerator * cg, TR::Co
{
if (cg->comp()->target().is64Bit())
{
setDllSlip((char*)cg->getCodeStart(), (char*)cg->getCodeStart() + cg->getCodeLength(), "SLIPDLL64", comp);
setDllSlip((const char *)cg->getCodeStart(), (const char *)cg->getCodeStart() + cg->getCodeLength(), "SLIPDLL64", comp);
}
else
{
setDllSlip((char*)cg->getCodeStart(), (char*)cg->getCodeStart() + cg->getCodeLength(), "SLIPDLL31", comp);
setDllSlip((const char *)cg->getCodeStart(), (const char *)cg->getCodeStart() + cg->getCodeLength(), "SLIPDLL31", comp);
}
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/env/FEBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ TR::OptionTable OMR::Options::_feOptions[] =

// S390 specific fucntion - FIXME: make this only be a problem when HOST is s390. Also, use a better
// name for this
void setDllSlip(char*CodeStart,char*CodeEnd,char*dllName, TR::Compilation *comp) { TR_UNIMPLEMENTED(); }
void setDllSlip(const char *CodeStart, const char *CodeEnd, const char *dllName, TR::Compilation *comp) { TR_UNIMPLEMENTED(); }

// runtime assumptions
#ifdef J9_PROJECT_SPECIFIC
Expand All @@ -146,7 +146,7 @@ void TR::PatchNOPedGuardSite::compensate(TR_FrontEnd *fe, bool isSMP, uint8_t *l
void TR_PersistentClassInfo::removeASubClass(TR_PersistentClassInfo *) { TR_UNIMPLEMENTED(); }
bool isOrderedPair(uint8_t recordType) { TR_UNIMPLEMENTED(); return false; }
void OMR::RuntimeAssumption::addToRAT(TR_PersistentMemory * persistentMemory, TR_RuntimeAssumptionKind kind, TR_FrontEnd *fe, OMR::RuntimeAssumption** sentinel) { TR_UNIMPLEMENTED(); }
void OMR::RuntimeAssumption::dumpInfo(char *subclassName) { TR_UNIMPLEMENTED(); }
void OMR::RuntimeAssumption::dumpInfo(const char *subclassName) { TR_UNIMPLEMENTED(); }
void TR_PatchJNICallSite::compensate(TR_FrontEnd*, bool, void *) { TR_UNIMPLEMENTED(); }
void TR_PreXRecompile::compensate(TR_FrontEnd*, bool, void *) { TR_UNIMPLEMENTED(); }
TR_PatchNOPedGuardSiteOnClassPreInitialize *TR_PatchNOPedGuardSiteOnClassPreInitialize::make(TR_FrontEnd *fe, TR_PersistentMemory *, char*, unsigned int, unsigned char*, unsigned char*, OMR::RuntimeAssumption**) { TR_UNIMPLEMENTED(); return 0; }
Expand Down
2 changes: 1 addition & 1 deletion compiler/env/FrontEnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ TR_FrontEnd::getFormattedName(


TR_OpaqueMethodBlock*
TR_FrontEnd::getMethodFromName(char * className, char *methodName, char *signature)
TR_FrontEnd::getMethodFromName(const char *className, const char *methodName, const char *signature)
{
TR_UNIMPLEMENTED();
return 0;
Expand Down
2 changes: 1 addition & 1 deletion compiler/env/FrontEnd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class TR_FrontEnd : private TR::Uncopyable
virtual TR_ResolvedMethod * createResolvedMethod(TR_Memory *, TR_OpaqueMethodBlock *, TR_ResolvedMethod * = 0, TR_OpaqueClassBlock * = 0);
virtual OMR::MethodMetaDataPOD *createMethodMetaData(TR::Compilation *comp) { return NULL; }

virtual TR_OpaqueMethodBlock * getMethodFromName(char * className, char *methodName, char *signature);
virtual TR_OpaqueMethodBlock * getMethodFromName(const char *className, const char *methodName, const char *signature);
virtual uint32_t offsetOfIsOverriddenBit();

// Needs VMThread
Expand Down
10 changes: 5 additions & 5 deletions compiler/env/OMRClassEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ OMR::ClassEnv::self()
return static_cast<TR::ClassEnv *>(this);
}

char *
OMR::ClassEnv::classNameChars(TR::Compilation *comp, TR::SymbolReference *symRef, int32_t & len)
const char *
OMR::ClassEnv::classNameChars(TR::Compilation *comp, TR::SymbolReference *symRef, int32_t &len)
{
char *name = "<no class name>";
const char *name = "<no class name>";
len = static_cast<int32_t>(strlen(name));
return name;
}

uintptr_t
OMR::ClassEnv::getArrayElementWidthInBytes(TR::Compilation *comp, TR_OpaqueClassBlock* arrayClass)
OMR::ClassEnv::getArrayElementWidthInBytes(TR::Compilation *comp, TR_OpaqueClassBlock *arrayClass)
{
TR_UNIMPLEMENTED();
return 0;
}

intptr_t
OMR::ClassEnv::getVFTEntry(TR::Compilation *comp, TR_OpaqueClassBlock* clazz, int32_t offset)
OMR::ClassEnv::getVFTEntry(TR::Compilation *comp, TR_OpaqueClassBlock *clazz, int32_t offset)
{
// There is no project-agnostic way to determine whether or not offset is a
// valid VFT offset for clazz, so return 0 to be safe. If offset were valid,
Expand Down
4 changes: 2 additions & 2 deletions compiler/env/OMRClassEnv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ class OMR_EXTENSIBLE ClassEnv
int32_t flagValueForArrayCheck(TR::Compilation *comp) { return 0; }
int32_t flagValueForFinalizerCheck(TR::Compilation *comp) { return 0; }

char *classNameChars(TR::Compilation *, TR::SymbolReference *symRef, int32_t & length);
char *classNameChars(TR::Compilation *, TR_OpaqueClassBlock * clazz, int32_t & length) { return NULL; }
const char *classNameChars(TR::Compilation *, TR::SymbolReference *symRef, int32_t &length);
const char *classNameChars(TR::Compilation *, TR_OpaqueClassBlock *clazz, int32_t &length) { return NULL; }

char *classSignature_DEPRECATED(TR::Compilation *comp, TR_OpaqueClassBlock * clazz, int32_t & length, TR_Memory *) { return NULL; }
char *classSignature(TR::Compilation *comp, TR_OpaqueClassBlock * clazz, TR_Memory *) { return NULL; }
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/Inliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5729,7 +5729,7 @@ TR_CallSite::calleeClass()
TR::StackMemoryRegion stackMemoryRegion(*_comp->trMemory());

int32_t len = _interfaceMethod->classNameLength();
char * s = TR::Compiler->cls.classNameToSignature(_interfaceMethod->classNameChars(), len, _comp, stackAlloc);
char *s = TR::Compiler->cls.classNameToSignature(_interfaceMethod->classNameChars(), len, _comp, stackAlloc);
TR_OpaqueClassBlock *result = _comp->fe()->getClassFromSignature(s, len, _callerResolvedMethod, true);

return result;
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/LocalOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8680,7 +8680,7 @@ TR_ColdBlockMarker::hasNotYetRun(TR::Node *node)
node->getOpCodeValue() == TR::loadaddr)
{
int32_t len;
char *name = TR::Compiler->cls.classNameChars(comp(), node->getSymbolReference(), len);
const char *name = TR::Compiler->cls.classNameChars(comp(), node->getSymbolReference(), len);
if (name)
{
TR::HeuristicRegion heuristicRegion(comp());
Expand Down
2 changes: 1 addition & 1 deletion compiler/optimizer/VPConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ TR::VPClassType *TR::VPClassType::create(OMR::ValuePropagation *vp, TR::SymbolRe
}

int32_t len;
char *name = TR::Compiler->cls.classNameChars(vp->comp(), symRef, len);
const char *name = TR::Compiler->cls.classNameChars(vp->comp(), symRef, len);
TR_ASSERT(name, "can't get class name from symbol reference");
char *sig = TR::Compiler->cls.classNameToSignature(name, len, vp->comp());
//return TR::VPUnresolvedClass::create(vp, sig, len, symRef->getOwningMethod(vp->comp()));
Expand Down
4 changes: 2 additions & 2 deletions compiler/optimizer/ValuePropagationCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3908,7 +3908,7 @@ void OMR::ValuePropagation::transformObjectCloneCall(TR::TreeTop *callTree, OMR:

TR::DebugCounter::prependDebugCounter(comp(), TR::DebugCounter::debugCounterName(comp(), "inlineClone.location/object/(%s)", comp()->signature()), callTree);
int32_t classNameLength;
char *className = TR::Compiler->cls.classNameChars(comp(), j9class, classNameLength);
const char *className = TR::Compiler->cls.classNameChars(comp(), j9class, classNameLength);
TR::DebugCounter::prependDebugCounter(comp(), TR::DebugCounter::debugCounterName(comp(), "inlineClone.type/(%s)/(%s)/%s", className, comp()->signature(), comp()->getHotnessName(comp()->getMethodHotness())), callTree);

// Preserve children for callNode
Expand Down Expand Up @@ -4031,7 +4031,7 @@ void OMR::ValuePropagation::transformArrayCloneCall(TR::TreeTop *callTree, OMR::

TR::DebugCounter::prependDebugCounter(comp(), TR::DebugCounter::debugCounterName(comp(), "inlineClone.location/array/(%s)", comp()->signature()), callTree);
int32_t classNameLength;
char *className = TR::Compiler->cls.classNameChars(comp(), j9arrayClass, classNameLength);
const char *className = TR::Compiler->cls.classNameChars(comp(), j9arrayClass, classNameLength);
TR::DebugCounter::prependDebugCounter(comp(), TR::DebugCounter::debugCounterName(comp(), "inlineClone.type/(%s)/(%s)/%s", className, comp()->signature(), comp()->getHotnessName(comp()->getMethodHotness())), callTree);
TR::Node *lenNode = TR::Node::create(callNode, TR::arraylength, 1, objNode);
// Preserve children for callNode
Expand Down
8 changes: 4 additions & 4 deletions compiler/p/codegen/PPCTableOfConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ int32_t TR_PPCTableOfConstants::lookUp(TR::SymbolReference *symRef, TR::CodeGene

if (sym->isClassObject())
{
int8_t *className;
const char *className;
if (sym->addressIsCPIndexOfStatic())
{
struct TR_tocHashEntry st2cEntry;
Expand All @@ -541,16 +541,16 @@ int32_t TR_PPCTableOfConstants::lookUp(TR::SymbolReference *symRef, TR::CodeGene
}
else
{
className = (int8_t *)TR::Compiler->cls.classNameChars(comp, symRef, nlen);
className = TR::Compiler->cls.classNameChars(comp, symRef, nlen);
}

TR_ASSERT(className!=NULL, "Class object name is expected");
TR_ASSERT(className != NULL, "Class object name is expected");

if (nlen >= 1024)
{
name = (int8_t *)cg->trMemory()->allocateHeapMemory(nlen+1);
}
strncpy((char *)name, (char *)className, nlen);
strncpy((char *)name, className, nlen);
name[nlen] = 0;
}
else
Expand Down
4 changes: 2 additions & 2 deletions compiler/ras/Debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ TR_Debug::getStaticName(TR::SymbolReference * symRef)
if (!sym->addressIsCPIndexOfStatic() && staticAddress)
{
int32_t len;
char * name = TR::Compiler->cls.classNameChars(comp(), symRef, len);
const char *name = TR::Compiler->cls.classNameChars(comp(), symRef, len);
if (name)
{
char * s = (char *)_comp->trMemory()->allocateHeapMemory(len+1);
Expand Down Expand Up @@ -3624,7 +3624,7 @@ TR_Debug::dump(TR::FILE *pOutFile, TR_CHTable * chTable)
TR_OpaqueClassBlock * clazz = chTable->_classes->element(i);
int32_t len;

char *sig = TR::Compiler->cls.classNameChars(comp(), clazz, len);
const char *sig = TR::Compiler->cls.classNameChars(comp(), clazz, len);

if (len>255) len = 255;
strncpy(buf, sig, len);
Expand Down
2 changes: 1 addition & 1 deletion compiler/ras/Tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ TR_Debug::printLoadConst(TR::Node *node, TR_PrettyPrinterString& output)
if (node->isClassPointerConstant())
{
TR_OpaqueClassBlock *clazz = (TR_OpaqueClassBlock*)node->getAddress();
int32_t len; char *sig = TR::Compiler->cls.classNameChars(_comp, clazz, len);
int32_t len; const char *sig = TR::Compiler->cls.classNameChars(_comp, clazz, len);
if (clazz)
{
if (TR::Compiler->cls.isInterfaceClass(_comp, clazz))
Expand Down
2 changes: 1 addition & 1 deletion compiler/runtime/Runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void s390zLinux64CodeCacheParameters(int32_t *, void **, int32_t *, int32_t*);

uint32_t getPPCCacheLineSize();

extern void setDllSlip(char* codeStart,char* codeEnd,char* dllName, TR::Compilation *);
extern void setDllSlip(const char *codeStart, const char *codeEnd, const char *dllName, TR::Compilation *);

void initializeJitRuntimeHelperTable(char jvmpi);

Expand Down

0 comments on commit 137778a

Please sign in to comment.