Skip to content

Commit

Permalink
Fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
EgorBo committed Aug 4, 2022
1 parent 0dfb332 commit 98a2a9d
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 60 deletions.
31 changes: 5 additions & 26 deletions src/coreclr/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3070,36 +3070,15 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
s_pJitFunctionFileInitialized = true;
}
#else // DEBUG
if (!jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT))
if (!JitConfig.JitDisasm().isEmpty())
{
if (!JitConfig.JitDisasm().isEmpty())
const char* methodName = info.compCompHnd->getMethodName(info.compMethodHnd, nullptr);
const char* className = info.compCompHnd->getClassName(info.compClassHnd);
if (JitConfig.JitDisasm().contains(methodName, className, &info.compMethodInfo->args))
{
const char* methodName = info.compCompHnd->getMethodName(info.compMethodHnd, nullptr);
const char* className = info.compCompHnd->getClassName(info.compClassHnd);

if (JitConfig.JitDisasm().contains(methodName, className, &info.compMethodInfo->args))
{
opts.disAsm = true;
}
}
}
else
{
if (!JitConfig.NgenDisasm().isEmpty())
{
const char* methodName = info.compCompHnd->getMethodName(info.compMethodHnd, nullptr);
const char* className = info.compCompHnd->getClassName(info.compClassHnd);

if (JitConfig.NgenDisasm().contains(methodName, className, &info.compMethodInfo->args))
{
opts.disAsm = true;
}
opts.disAsm = true;
}
}

bool diffable = JitConfig.DiffableDasm();
opts.disDiffable = diffable;
opts.dspDiffable = diffable;
#endif // !DEBUG

//-------------------------------------------------------------------------
Expand Down
20 changes: 18 additions & 2 deletions src/coreclr/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -9296,7 +9296,6 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

static bool s_pJitFunctionFileInitialized;
static MethodSet* s_pJitMethodSet;
#endif // DEBUG

// silence warning of cast to greater size. It is easier to silence than construct code the compiler is happy with, and
// it is safe in this case
Expand All @@ -9315,6 +9314,23 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
return (o == ZERO) ? ZERO : (opts.dspDiffable ? T(0xD1FFAB1E) : o);
}
#pragma warning(pop)
#else
#pragma warning(push)
#pragma warning(disable : 4312)
template <typename T>
T dspPtr(T p)
{
return p;
}

template <typename T>
T dspOffset(T o)
{
return o;
}
#pragma warning(pop)
#endif

#ifdef DEBUG

static int dspTreeID(GenTree* tree)
Expand Down Expand Up @@ -9787,12 +9803,12 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#endif

public:
LONG compMethodID;
#ifdef DEBUG
unsigned compGenTreeID;
unsigned compStatementID;
unsigned compBasicBlockID;
#endif
LONG compMethodID;

BasicBlock* compCurBB; // the current basic block in process
Statement* compCurStmt; // the current statement in process
Expand Down
24 changes: 15 additions & 9 deletions src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,6 @@ void* emitter::emitAllocAnyInstr(size_t sz, emitAttr opsz)

emitInsCount++;

/* In debug mode we clear/set some additional fields */

instrDescDebugInfo* info = (instrDescDebugInfo*)emitGetMem(sizeof(*info));

info->idNum = emitInsCount;
Expand Down Expand Up @@ -2654,11 +2652,7 @@ const char* emitter::emitLabelString(insGroup* ig)
static char buf[4][TEMP_BUFFER_LEN];
const char* retbuf;

#ifdef DEBUG
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "G_M%03u_IG%02u", emitComp->compMethodID, ig->igNum);
#else
sprintf_s(buf[curBuf], TEMP_BUFFER_LEN, "IG_%02u", ig->igNum);
#endif
retbuf = buf[curBuf];
curBuf = (curBuf + 1) % 4;
return retbuf;
Expand Down Expand Up @@ -4060,7 +4054,6 @@ void emitter::emitRecomputeIGoffsets()
//
void emitter::emitDispCommentForHandle(size_t handle, size_t cookie, GenTreeFlags flag)
{
#ifdef DEBUG
#ifdef TARGET_XARCH
const char* commentPrefix = " ;";
#else
Expand Down Expand Up @@ -4099,6 +4092,7 @@ void emitter::emitDispCommentForHandle(size_t handle, size_t cookie, GenTreeFlag
const char* str = nullptr;
if (flag == GTF_ICON_STR_HDL)
{
#ifdef DEBUG
const WCHAR* wstr = emitComp->eeGetCPString(handle);
// NOTE: eGetCPString always returns nullptr on Linux/ARM
if (wstr == nullptr)
Expand Down Expand Up @@ -4131,6 +4125,9 @@ void emitter::emitDispCommentForHandle(size_t handle, size_t cookie, GenTreeFlag
}
printf("%s \"%S\"", commentPrefix, buf);
}
#else
str = "string handle";
#endif
}
else if (flag == GTF_ICON_CLASS_HDL)
{
Expand Down Expand Up @@ -4169,7 +4166,6 @@ void emitter::emitDispCommentForHandle(size_t handle, size_t cookie, GenTreeFlag
{
printf("%s %s", commentPrefix, str);
}
#endif // DEBUG
}

//****************************************************************************
Expand Down Expand Up @@ -6671,6 +6667,10 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
if (emitComp->opts.disAsm)
{
printf("\n%s:", emitLabelString(ig));
if (!emitComp->opts.disDiffable)
{
printf(" ;; offset=%04XH", emitCurCodeOffs(cp));
}
printf("\n");
}
#endif // !DEBUG
Expand Down Expand Up @@ -6914,7 +6914,13 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
ig->igPerfScore);
}
*instrCount += ig->igInsCnt;
#endif // DEBUG
#else // DEBUG
if (emitComp->opts.disAsm)
{
// Separate IGs with a blank line
printf(" ");
}
#endif // !DEBUG

emitCurIG = nullptr;

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9125,11 +9125,11 @@ void emitter::emitDispIns(
}
else if ((val > 0) || (val < -0xFFFFFF))
{
printf("0x%IX", (INT64)val);
printf("0x%IX", (ssize_t)val);
}
else
{ // (val < 0)
printf("-0x%IX", (INT64)-val);
printf("-0x%IX", (ssize_t)-val);
}
emitDispCommentForHandle(srcVal, id->idDebugOnlyInfo()->idMemCookie, id->idDebugOnlyInfo()->idFlags);
}
Expand Down
20 changes: 19 additions & 1 deletion src/coreclr/jit/jit.h
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,6 @@ inline bool IsUninitialized(T data)
{
return data == UninitializedWord<T>(JitTls::GetCompiler());
}
#else // !defined(DEBUG)

#pragma warning(push)
#pragma warning(disable : 4312)
Expand All @@ -820,6 +819,25 @@ T dspOffset(T o)
}
#pragma warning(pop)

#else // !defined(DEBUG)

//****************************************************************************
//
// Non-Debug template definitions for dspPtr, dspOffset
// - This is a nop in non-Debug builds
//
template <typename T>
T dspPtr(T p)
{
return p;
}

template <typename T>
T dspOffset(T o)
{
return o;
}

#endif // !defined(DEBUG)

struct LikelyClassMethodRecord
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/jit/jitconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ CONFIG_METHODSET(JitUnwindDump, W("JitUnwindDump")) // Dump the unwind codes for
///
/// NGEN
///
CONFIG_METHODSET(NgenDisasm, W("NgenDisasm")) // Same as JitDisasm, but for ngen
CONFIG_METHODSET(NgenDump, W("NgenDump")) // Same as JitDump, but for ngen
CONFIG_METHODSET(NgenEHDump, W("NgenEHDump")) // Dump the EH table for the method, as reported to the VM
CONFIG_METHODSET(NgenGCDump, W("NgenGCDump"))
Expand Down
20 changes: 0 additions & 20 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10421,26 +10421,6 @@ void Compiler::fgValueNumberAddExceptionSetForIndirection(GenTree* tree, GenTree
vnStore->VNExcSetSingleton(vnStore->VNForFunc(TYP_REF, VNF_NullPtrExc, vnpBaseNorm.GetConservative())));
}

VNFuncApp func;
if (vnStore->GetVNFunc(vnpBaseNorm.GetConservative(), &func) &&
(func.m_func == VNF_GetsharedGcthreadstaticBaseNoctor))
{
switch (func.m_func)
{
case VNF_GetgenericsGcthreadstaticBase:
case VNF_GetgenericsNongcthreadstaticBase:
case VNF_GetsharedGcthreadstaticBase:
case VNF_GetsharedNongcthreadstaticBase:
case VNF_GetsharedGcthreadstaticBaseNoctor:
case VNF_GetsharedNongcthreadstaticBaseNoctor:
case VNF_GetsharedGcthreadstaticBaseDynamicclass:
case VNF_GetsharedNongcthreadstaticBaseDynamicclass:
tree->gtVNPair.SetConservative(tree->gtVNPair.GetLiberal());
break;
default:
break;
}
}
// Add the NullPtrExc to "tree"'s value numbers.
tree->gtVNPair = vnStore->VNPWithExc(tree->gtVNPair, excChkSet);
}
Expand Down

0 comments on commit 98a2a9d

Please sign in to comment.