Skip to content

Commit

Permalink
Fix string literal conversion warnings in runtime/compiler/optimizer
Browse files Browse the repository at this point in the history
Fix string literal conversion warnings in runtime/compiler/optimizer

Signed-off-by: Dylan Tuttle <[email protected]>
  • Loading branch information
dylanjtuttle committed Dec 13, 2023
1 parent c2585de commit 3bf8f94
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 208 deletions.
296 changes: 148 additions & 148 deletions runtime/compiler/optimizer/DataAccessAccelerator.cpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions runtime/compiler/optimizer/EscapeAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8226,7 +8226,7 @@ void TR_EscapeAnalysis::scanForExtraCallsToInline()

TR::TreeTop *callTreeToInline = NULL;
TR::Node *callNode = NULL;
char *reason = "??";
const char *reason = "??";
if ( tt->getNode()->getNumChildren() >= 1
&& tt->getNode()->getFirstChild()->getOpCode().isCall()
&& tt->getNode()->getFirstChild()->getSymbol()->isResolvedMethod())
Expand Down Expand Up @@ -8360,7 +8360,7 @@ FieldInfo& Candidate::findOrSetFieldInfo(TR::Node *fieldRefNode, TR::SymbolRefer
}


void TR_EscapeAnalysis::printCandidates(char *title)
void TR_EscapeAnalysis::printCandidates(const char *title)
{
if (title)
traceMsg(comp(), "\n%s\n", title);
Expand All @@ -8376,7 +8376,7 @@ void TR_EscapeAnalysis::printCandidates(char *title)
static void printSymRefList(TR_ScratchList<TR::SymbolReference> *list, TR::Compilation *comp)
{
ListIterator<TR::SymbolReference> iter(list);
char *sep = "";
const char *sep = "";
for (TR::SymbolReference *symRef = iter.getFirst(); symRef; symRef = iter.getNext())
{
traceMsg(comp, "%s#%d", sep, symRef->getReferenceNumber());
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/optimizer/EscapeAnalysis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ class TR_EscapeAnalysis : public TR::Optimization
void setHasFlushOnEntry(int32_t blockNum) {_blocksWithFlushOnEntry->set(blockNum);}
void rememoize(Candidate *c, bool mayDememoizeNextTime=false);

void printCandidates(char *);
void printCandidates(const char *);

char *getClassName(TR::Node *classNode);

Expand Down
12 changes: 6 additions & 6 deletions runtime/compiler/optimizer/IdiomRecognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3363,13 +3363,13 @@ TR_CISCTransformer::isBlockInLoopBody(TR::Block *block)


void
TR_CISCTransformer::showEmbeddedData(char *title, uint8_t *data)
TR_CISCTransformer::showEmbeddedData(const char *title, uint8_t *data)
{
int32_t i, j;
traceMsg(comp(), "%s\n ",title);
traceMsg(comp(), "%s\n ", title);
for (j = 0; j < _numPNodes; j++)
{
traceMsg(comp(), "%3d",j);
traceMsg(comp(), "%3d", j);
}
traceMsg(comp(), "\n --");
for (j = 0; j < _numPNodes; j++)
Expand All @@ -3386,7 +3386,7 @@ TR_CISCTransformer::showEmbeddedData(char *title, uint8_t *data)
if (this_result == _Unknown || this_result == _NotEmbed)
traceMsg(comp(), "| ");
else
traceMsg(comp(), "| %X",data[idx(j, i)]);
traceMsg(comp(), "| %X", data[idx(j, i)]);
}
traceMsg(comp(), "\n");
}
Expand Down Expand Up @@ -5144,7 +5144,7 @@ TR_CISCTransformer::moveCISCNodesInList(List<TR_CISCNode> *l, TR_CISCNode *from,
// * _T->_orderByData
//*****************************************************************************
void
TR_CISCTransformer::moveCISCNodes(TR_CISCNode *from, TR_CISCNode *to, TR_CISCNode *moveTo, char *debugStr)
TR_CISCTransformer::moveCISCNodes(TR_CISCNode *from, TR_CISCNode *to, TR_CISCNode *moveTo, const char *debugStr)
{
if (showMesssagesStdout())
{
Expand Down Expand Up @@ -7665,7 +7665,7 @@ TR_CISCTransformer::computeTopologicalEmbedding(TR_CISCGraph *P, TR_CISCGraph *T

if (trace() || showMesssagesStdout())
{
char *bcinfo = "";
char *bcinfo = (char *)"";
#if SHOW_BCINDICES
char tmpbuf[256];
int32_t minIndex, maxIndex;
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/IdiomRecognition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ class TR_CISCTransformer : public TR_LoopTransformer

bool computeTopologicalEmbedding(TR_CISCGraph *P, TR_CISCGraph *T);
bool embeddingHasConflictingBranches();
void showEmbeddedData(char *title, uint8_t *data);
void showEmbeddedData(const char *title, uint8_t *data);
bool computeEmbeddedForData();
bool computeEmbeddedForCFG();
bool dagEmbed(TR_CISCNode *, TR_CISCNode*);
Expand Down Expand Up @@ -1452,7 +1452,7 @@ class TR_CISCTransformer : public TR_LoopTransformer
void showCandidates();
void registerCandidates();
void moveCISCNodesInList(List<TR_CISCNode> *l, TR_CISCNode *from, TR_CISCNode *to, TR_CISCNode *moveTo);
void moveCISCNodes(TR_CISCNode *from, TR_CISCNode *to, TR_CISCNode *moveTo, char *debugStr = NULL);
void moveCISCNodes(TR_CISCNode *from, TR_CISCNode *to, TR_CISCNode *moveTo, const char *debugStr = NULL);
TR::Block *searchPredecessorOfBlock(TR::Block *block);
TR::Block *modifyBlockByVersioningCheck(TR::Block *block, TR::TreeTop *startTop, TR::Node *lengthNode, List<TR::Node> *guardList = NULL);
TR::Block *modifyBlockByVersioningCheck(TR::Block *block, TR::TreeTop *startTop, List<TR::Node> *guardList);
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/InlinerTempForJ9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int32_t getJ9InitialBytecodeSize(TR_ResolvedMethod * feMethod, TR::Resolv

static bool insideIntPipelineForEach(TR_ResolvedMethod *method, TR::Compilation *comp)
{
char *sig = "accept";
const char *sig = "accept";
bool returnValue = true; //default is true since if first method is IntPipeline.forEach true is returned

//Searches up the owning method chain until IntPipeline.forEach is found
Expand Down Expand Up @@ -3490,7 +3490,7 @@ void TR_MultipleCallTargetInliner::weighCallSite( TR_CallStack * callStack , TR_
if (isHot(comp()))
{
TR_ResolvedMethod *m = calltarget->_calleeSymbol->getResolvedMethod();
char *sig = "toString";
const char *sig = "toString";
if (strncmp(m->nameChars(), sig, strlen(sig)) == 0)
{
size >>= 1;
Expand Down
4 changes: 2 additions & 2 deletions runtime/compiler/optimizer/J9Inliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ extern int32_t *InlinedSizes; // Defined in Inliner.cpp


//duplicated as long as there are two versions of findInlineTargets
static uintptr_t *failMCS(char *reason, TR_CallSite *callSite, TR_InlinerBase* inliner)
static uintptr_t *failMCS(const char *reason, TR_CallSite *callSite, TR_InlinerBase* inliner)
{
debugTrace(inliner->tracer()," Fail isMutableCallSiteTargetInvokeExact(%p): %s", callSite, reason);
return NULL;
Expand Down Expand Up @@ -440,7 +440,7 @@ bool TR_InlinerBase::inlineCallTarget(TR_CallStack *callStack, TR_CallTarget *ca

TR_InlinerDelimiter delimiter(tracer(),"TR_InlinerBase::inlineCallTarget");

char *sig = "multiLeafArrayCopy";
const char *sig = "multiLeafArrayCopy";
if (strncmp(calltarget->_calleeMethod->nameChars(), sig, strlen(sig)) == 0)
{
_nodeCountThreshold = 8192;
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/optimizer/J9ValuePropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3542,7 +3542,7 @@ bool J9::ValuePropagation::isUnreliableSignatureType(
return true;
}

static void getHelperSymRefs(OMR::ValuePropagation *vp, TR::Node *curCallNode, TR::SymbolReference *&getHelpersSymRef, TR::SymbolReference *&helperSymRef, char *helperSig, int32_t helperSigLen, TR::MethodSymbol::Kinds helperCallKind)
static void getHelperSymRefs(OMR::ValuePropagation *vp, TR::Node *curCallNode, TR::SymbolReference *&getHelpersSymRef, TR::SymbolReference *&helperSymRef, const char *helperSig, int32_t helperSigLen, TR::MethodSymbol::Kinds helperCallKind)
{
//Function to retrieve the JITHelpers.getHelpers and JITHelpers.<helperSig> method symbol references.
//
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/optimizer/SignExtendLoads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
// -------------------------------------------------------------------------------------------
bool shouldEnableSEL(TR::Compilation *comp)
{
static char * enableSEL = feGetEnv("TR_SIGNEXTENDLOADS");
static const char *enableSEL = feGetEnv("TR_SIGNEXTENDLOADS");
if (comp->target().cpu.isZ())
{
// enable only for 390
static char * nenableSEL = feGetEnv("TR_NSIGNEXTENDLOADS");
if(nenableSEL ==NULL) enableSEL = "enable";
static const char *nenableSEL = feGetEnv("TR_NSIGNEXTENDLOADS");
if (nenableSEL == NULL) enableSEL = "enable";
}
return ((enableSEL != NULL) &&
comp->target().is64Bit());
Expand Down
72 changes: 36 additions & 36 deletions runtime/compiler/optimizer/StringPeepholes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,41 +161,41 @@ TR::SymbolReference* TR_StringPeepholes::MethodEnumToArgsForMethodSymRefFromName
m != END_STRINGPEEPHOLES_METHODS , "wrong constant!!");


static char* classNames [] = {"java/math/BigDecimal",
"java/math/BigDecimal",
"java/math/BigDecimal",
"java/math/BigDecimal",
NULL,
"java/lang/String",
"java/lang/String",
"java/lang/String",
"java/lang/String",
"java/lang/String",
"java/lang/String"};

static char* methodNames [] = {"SMAAMSS",
"SMSS",
"AAMSS",
"MSS",
NULL,
"<init>",
"<init>",
"<init>",
"<init>",
"<init>",
"<init>"};

static char* signatures [] = { "(Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;IIII)Ljava/math/BigDecimal;",
"(Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;II)Ljava/math/BigDecimal;",
"(Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;III)Ljava/math/BigDecimal;",
"(Ljava/math/BigDecimal;Ljava/math/BigDecimal;I)Ljava/math/BigDecimal;",
NULL,
"(Ljava/lang/String;C)V",
"(Ljava/lang/String;Ljava/lang/String;)V",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
"(Ljava/lang/String;I)V",
"([BIIZ)V",
"(ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;)V"};
static const char* classNames [] = {"java/math/BigDecimal",
"java/math/BigDecimal",
"java/math/BigDecimal",
"java/math/BigDecimal",
NULL,
"java/lang/String",
"java/lang/String",
"java/lang/String",
"java/lang/String",
"java/lang/String",
"java/lang/String"};

static const char* methodNames [] = {"SMAAMSS",
"SMSS",
"AAMSS",
"MSS",
NULL,
"<init>",
"<init>",
"<init>",
"<init>",
"<init>",
"<init>"};

static const char* signatures [] = {"(Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;IIII)Ljava/math/BigDecimal;",
"(Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;II)Ljava/math/BigDecimal;",
"(Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;Ljava/math/BigDecimal;III)Ljava/math/BigDecimal;",
"(Ljava/math/BigDecimal;Ljava/math/BigDecimal;I)Ljava/math/BigDecimal;",
NULL,
"(Ljava/lang/String;C)V",
"(Ljava/lang/String;Ljava/lang/String;)V",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
"(Ljava/lang/String;I)V",
"([BIIZ)V",
"(ILjava/lang/String;ILjava/lang/String;Ljava/lang/String;)V"};

// TODO: This is a workaround as we switched to using a byte[] backing array in String*. Remove this workaround once obsolete.
if (m == SPH_String_init_AIIZ)
Expand Down Expand Up @@ -2088,7 +2088,7 @@ TR::TreeTop *TR_StringPeepholes::searchForStringAppend(const char *sig, TR::Tree
}
else
{
char *sig2 = "java/lang/Integer.toString(I)";
const char *sig2 = "java/lang/Integer.toString(I)";

// Expected reference count for the Integer.toString may change if pending pushes are being
// generated
Expand Down
2 changes: 1 addition & 1 deletion runtime/compiler/optimizer/VPBCDConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TR::VP_BCDValue *TR::VP_BCDValue::asBCDValue() { return
TR::VP_BCDSign *TR::VP_BCDSign::asBCDSign() { return this; }


char *TR::VP_BCDSign::TR_BCDSignConstraintNames[TR_Sign_Num_Types] =
const char *TR::VP_BCDSign::TR_BCDSignConstraintNames[TR_Sign_Num_Types] =
{
"<unknown_sign_state>",
"<clean>",
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/optimizer/VPBCDConstraint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ class VP_BCDSign : public TR::VPConstraint

static bool signsAreConsistent(TR_BCDSignConstraint signOne, TR_BCDSignConstraint signTwo);

char *getName()
const char *getName()
{ return getName(_sign); }

static char *getName(TR_BCDSignConstraint sign)
static const char *getName(TR_BCDSignConstraint sign)
{ return ((sign < TR_Sign_Num_Types) ? TR_BCDSignConstraintNames[sign] : (char*)"invalid_sign_constraint"); }

static TR_BCDSignConstraint getSignConstraintFromBCDSign(TR_BCDSignCode bcdSign)
Expand Down Expand Up @@ -147,7 +147,7 @@ class VP_BCDSign : public TR::VPConstraint
TR::DataType _dataType;

private:
static char *TR_BCDSignConstraintNames[TR_Sign_Num_Types];
static const char *TR_BCDSignConstraintNames[TR_Sign_Num_Types];
};

class VP_BCDValue : public TR::VP_BCDSign
Expand Down

0 comments on commit 3bf8f94

Please sign in to comment.