summaryrefslogtreecommitdiff
path: root/src/jit/ee_il_dll.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jit/ee_il_dll.cpp')
-rwxr-xr-xsrc/jit/ee_il_dll.cpp776
1 files changed, 393 insertions, 383 deletions
diff --git a/src/jit/ee_il_dll.cpp b/src/jit/ee_il_dll.cpp
index 896c4013b5..527244221e 100755
--- a/src/jit/ee_il_dll.cpp
+++ b/src/jit/ee_il_dll.cpp
@@ -30,33 +30,31 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
FILE* jitstdout = nullptr;
-ICorJitHost* g_jitHost = nullptr;
-static CILJit* ILJitter = 0; // The one and only JITTER I return
-bool g_jitInitialized = false;
+ICorJitHost* g_jitHost = nullptr;
+static CILJit* ILJitter = nullptr; // The one and only JITTER I return
+bool g_jitInitialized = false;
#ifndef FEATURE_MERGE_JIT_AND_ENGINE
-HINSTANCE g_hInst = NULL;
+HINSTANCE g_hInst = nullptr;
#endif // FEATURE_MERGE_JIT_AND_ENGINE
/*****************************************************************************/
-#ifdef DEBUG
+#ifdef DEBUG
-JitOptions jitOpts =
-{
- NULL, // methodName
- NULL, // className
- 0.1, // CGknob
- 0, // testMask
+JitOptions jitOpts = {
+ nullptr, // methodName
+ nullptr, // className
+ 0.1, // CGknob
+ 0, // testMask
- (JitOptions *)NULL // lastDummyField.
+ (JitOptions*)nullptr // lastDummyField.
};
#endif // DEBUG
/*****************************************************************************/
-extern "C"
-void __stdcall jitStartup(ICorJitHost* jitHost)
+extern "C" void __stdcall jitStartup(ICorJitHost* jitHost)
{
if (g_jitInitialized)
{
@@ -132,8 +130,7 @@ void jitShutdown()
#ifndef FEATURE_MERGE_JIT_AND_ENGINE
-extern "C"
-BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved)
+extern "C" BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
@@ -156,8 +153,7 @@ HINSTANCE GetModuleInst()
return (g_hInst);
}
-extern "C"
-void __stdcall sxsJitStartup(CoreClrCallbacks const & cccallbacks)
+extern "C" void __stdcall sxsJitStartup(CoreClrCallbacks const& cccallbacks)
{
#ifndef SELF_NO_HOST
InitUtilcode(cccallbacks);
@@ -172,10 +168,13 @@ void __stdcall sxsJitStartup(CoreClrCallbacks const & cccallbacks)
/*****************************************************************************/
-struct CILJitSingletonAllocator { int x; };
-const CILJitSingletonAllocator CILJitSingleton = { 0 };
+struct CILJitSingletonAllocator
+{
+ int x;
+};
+const CILJitSingletonAllocator CILJitSingleton = {0};
-void *__cdecl operator new(size_t, const CILJitSingletonAllocator&)
+void* __cdecl operator new(size_t, const CILJitSingletonAllocator&)
{
static char CILJitBuff[sizeof(CILJit)];
return CILJitBuff;
@@ -185,11 +184,11 @@ ICorJitCompiler* g_realJitCompiler = nullptr;
ICorJitCompiler* __stdcall getJit()
{
- if (ILJitter == 0)
+ if (ILJitter == nullptr)
{
ILJitter = new (CILJitSingleton) CILJit();
}
- return(ILJitter);
+ return (ILJitter);
}
/*****************************************************************************/
@@ -215,8 +214,7 @@ void SetJitTls(void* value)
#else // !defined(FEATURE_MERGE_JIT_AND_ENGINE) || !defined(FEATURE_IMPLICIT_TLS)
-extern "C"
-{
+extern "C" {
void* GetJitTls();
void SetJitTls(void* value);
}
@@ -225,9 +223,7 @@ void SetJitTls(void* value);
#if defined(DEBUG)
-JitTls::JitTls(ICorJitInfo* jitInfo)
- : m_compiler(nullptr)
- , m_logEnv(jitInfo)
+JitTls::JitTls(ICorJitInfo* jitInfo) : m_compiler(nullptr), m_logEnv(jitInfo)
{
m_next = reinterpret_cast<JitTls*>(GetJitTls());
SetJitTls(this);
@@ -278,21 +274,17 @@ void JitTls::SetCompiler(Compiler* compiler)
//****************************************************************************
// The main JIT function for the 32 bit JIT. See code:ICorJitCompiler#EEToJitInterface for more on the EE-JIT
// interface. Things really don't get going inside the JIT until the code:Compiler::compCompile#Phases
-// method. Usually that is where you want to go.
+// method. Usually that is where you want to go.
-CorJitResult CILJit::compileMethod (
- ICorJitInfo* compHnd,
- CORINFO_METHOD_INFO* methodInfo,
- unsigned flags,
- BYTE ** entryAddress,
- ULONG * nativeSizeOfCode)
+CorJitResult CILJit::compileMethod(
+ ICorJitInfo* compHnd, CORINFO_METHOD_INFO* methodInfo, unsigned flags, BYTE** entryAddress, ULONG* nativeSizeOfCode)
{
if (g_realJitCompiler != nullptr)
{
return g_realJitCompiler->compileMethod(compHnd, methodInfo, flags, entryAddress, nativeSizeOfCode);
}
- CORJIT_FLAGS jitFlags = { 0 };
+ CORJIT_FLAGS jitFlags = {0};
DWORD jitFlagsSize = 0;
#if COR_JIT_EE_VERSION > 460
@@ -308,25 +300,21 @@ CorJitResult CILJit::compileMethod (
jitFlags.corJitFlags = flags;
}
- int result;
- void * methodCodePtr = NULL;
- CORINFO_METHOD_HANDLE methodHandle = methodInfo->ftn;
+ int result;
+ void* methodCodePtr = nullptr;
+ CORINFO_METHOD_HANDLE methodHandle = methodInfo->ftn;
JitTls jitTls(compHnd); // Initialize any necessary thread-local state
assert(methodInfo->ILCode);
- result = jitNativeCode(methodHandle,
- methodInfo->scope,
- compHnd,
- methodInfo,
- &methodCodePtr,
- nativeSizeOfCode,
- &jitFlags,
- NULL);
+ result = jitNativeCode(methodHandle, methodInfo->scope, compHnd, methodInfo, &methodCodePtr, nativeSizeOfCode,
+ &jitFlags, nullptr);
if (result == CORJIT_OK)
+ {
*entryAddress = (BYTE*)methodCodePtr;
+ }
return CorJitResult(result);
}
@@ -334,7 +322,7 @@ CorJitResult CILJit::compileMethod (
/*****************************************************************************
* Notification from VM to clear any caches
*/
-void CILJit::clearCache ( void )
+void CILJit::clearCache(void)
{
if (g_realJitCompiler != nullptr)
{
@@ -348,14 +336,16 @@ void CILJit::clearCache ( void )
/*****************************************************************************
* Notify vm that we have something to clean up
*/
-BOOL CILJit::isCacheCleanupRequired ( void )
+BOOL CILJit::isCacheCleanupRequired(void)
{
BOOL doCleanup;
if (g_realJitCompiler != nullptr)
{
if (g_realJitCompiler->isCacheCleanupRequired())
+ {
return TRUE;
+ }
// Continue...
}
@@ -404,8 +394,7 @@ unsigned CILJit::getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags)
#ifdef _TARGET_AMD64_
#ifdef FEATURE_AVX_SUPPORT
- if (((cpuCompileFlags & CORJIT_FLG_PREJIT) == 0) &&
- ((cpuCompileFlags & CORJIT_FLG_FEATURE_SIMD) != 0) &&
+ if (((cpuCompileFlags & CORJIT_FLG_PREJIT) == 0) && ((cpuCompileFlags & CORJIT_FLG_FEATURE_SIMD) != 0) &&
((cpuCompileFlags & CORJIT_FLG_USE_AVX2) != 0))
{
if (JitConfig.EnableAVX() != 0)
@@ -415,7 +404,7 @@ unsigned CILJit::getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags)
}
#endif // FEATURE_AVX_SUPPORT
return 16;
-#else // !_TARGET_AMD64_
+#else // !_TARGET_AMD64_
return 0;
#endif // !_TARGET_AMD64_
}
@@ -425,45 +414,44 @@ void CILJit::setRealJit(ICorJitCompiler* realJitCompiler)
g_realJitCompiler = realJitCompiler;
}
-
/*****************************************************************************
* Returns the number of bytes required for the given type argument
*/
-unsigned Compiler::eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_SIG_INFO* sig)
+unsigned Compiler::eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_SIG_INFO* sig)
{
-#if defined(_TARGET_AMD64_)
+#if defined(_TARGET_AMD64_)
// Everything fits into a single 'slot' size
// to accommodate irregular sized structs, they are passed byref
CLANG_FORMAT_COMMENT_ANCHOR;
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
- CORINFO_CLASS_HANDLE argClass;
- CorInfoType argTypeJit = strip(info.compCompHnd->getArgType(sig, list, &argClass));
- var_types argType = JITtype2varType(argTypeJit);
+ CORINFO_CLASS_HANDLE argClass;
+ CorInfoType argTypeJit = strip(info.compCompHnd->getArgType(sig, list, &argClass));
+ var_types argType = JITtype2varType(argTypeJit);
if (varTypeIsStruct(argType))
{
unsigned structSize = info.compCompHnd->getClassSize(argClass);
- return structSize; // TODO: roundUp() needed here?
+ return structSize; // TODO: roundUp() needed here?
}
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
return sizeof(size_t);
-#else // !_TARGET_AMD64_
+#else // !_TARGET_AMD64_
- CORINFO_CLASS_HANDLE argClass;
- CorInfoType argTypeJit = strip(info.compCompHnd->getArgType(sig, list, &argClass));
- var_types argType = JITtype2varType(argTypeJit);
+ CORINFO_CLASS_HANDLE argClass;
+ CorInfoType argTypeJit = strip(info.compCompHnd->getArgType(sig, list, &argClass));
+ var_types argType = JITtype2varType(argTypeJit);
if (varTypeIsStruct(argType))
{
unsigned structSize = info.compCompHnd->getClassSize(argClass);
// make certain the EE passes us back the right thing for refanys
- assert(argTypeJit != CORINFO_TYPE_REFANY || structSize == 2*sizeof(void*));
+ assert(argTypeJit != CORINFO_TYPE_REFANY || structSize == 2 * sizeof(void*));
- // For each target that supports passing struct args in multiple registers
+ // For each target that supports passing struct args in multiple registers
// apply the target specific rules for them here:
CLANG_FORMAT_COMMENT_ANCHOR;
@@ -480,8 +468,8 @@ unsigned Compiler::eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_
// Is the struct larger than 16 bytes
if (structSize > (2 * TARGET_POINTER_SIZE))
{
- var_types hfaType = GetHfaType(argClass); // set to float or double if it is an HFA, otherwise TYP_UNDEF
- bool isHfa = (hfaType != TYP_UNDEF);
+ var_types hfaType = GetHfaType(argClass); // set to float or double if it is an HFA, otherwise TYP_UNDEF
+ bool isHfa = (hfaType != TYP_UNDEF);
if (!isHfa)
{
// This struct is passed by reference using a single 'slot'
@@ -491,7 +479,7 @@ unsigned Compiler::eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_
// otherwise will we pass this struct by value in multiple registers
}
#elif defined(_TARGET_ARM_)
- // otherwise will we pass this struct by value in multiple registers
+// otherwise will we pass this struct by value in multiple registers
#else
NYI("unknown target");
#endif // defined(_TARGET_XXX_)
@@ -502,7 +490,7 @@ unsigned Compiler::eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_
}
else
{
- unsigned argSize = sizeof(int) * genTypeStSz(argType);
+ unsigned argSize = sizeof(int) * genTypeStSz(argType);
assert(0 < argSize && argSize <= sizeof(__int64));
return (unsigned)roundUp(argSize, TARGET_POINTER_SIZE);
}
@@ -511,11 +499,11 @@ unsigned Compiler::eeGetArgSize(CORINFO_ARG_LIST_HANDLE list, CORINFO_
/*****************************************************************************/
-GenTreePtr Compiler::eeGetPInvokeCookie(CORINFO_SIG_INFO *szMetaSig)
+GenTreePtr Compiler::eeGetPInvokeCookie(CORINFO_SIG_INFO* szMetaSig)
{
- void * cookie, * pCookie;
+ void *cookie, *pCookie;
cookie = info.compCompHnd->GetCookieForPInvokeCalliSig(szMetaSig, &pCookie);
- assert((cookie == NULL) != (pCookie == NULL));
+ assert((cookie == nullptr) != (pCookie == nullptr));
return gtNewIconEmbHndNode(cookie, pCookie, GTF_ICON_PINVKI_HDL);
}
@@ -527,12 +515,11 @@ GenTreePtr Compiler::eeGetPInvokeCookie(CORINFO_SIG_INFO *szMetaSig)
// type - The array element type
//
// Return Value:
-// The offset to the first array element.
+// The offset to the first array element.
-unsigned Compiler::eeGetArrayDataOffset(var_types type)
+unsigned Compiler::eeGetArrayDataOffset(var_types type)
{
- return varTypeIsGC(type) ? eeGetEEInfo()->offsetOfObjArrayData
- : offsetof(CORINFO_Array, u1Elems);
+ return varTypeIsGC(type) ? eeGetEEInfo()->offsetOfObjArrayData : offsetof(CORINFO_Array, u1Elems);
}
//------------------------------------------------------------------------
@@ -548,26 +535,23 @@ unsigned Compiler::eeGetArrayDataOffset(var_types type)
// Assumptions:
// The rank should be greater than 0.
-unsigned Compiler::eeGetMDArrayDataOffset(var_types type, unsigned rank)
+unsigned Compiler::eeGetMDArrayDataOffset(var_types type, unsigned rank)
{
assert(rank > 0);
- // Note that below we're specifically using genTypeSize(TYP_INT) because array
+ // Note that below we're specifically using genTypeSize(TYP_INT) because array
// indices are not native int.
return eeGetArrayDataOffset(type) + 2 * genTypeSize(TYP_INT) * rank;
}
/*****************************************************************************/
-void Compiler::eeGetStmtOffsets()
+void Compiler::eeGetStmtOffsets()
{
ULONG32 offsetsCount;
- DWORD * offsets;
+ DWORD* offsets;
ICorDebugInfo::BoundaryTypes offsetsImplicit;
- info.compCompHnd->getBoundaries(info.compMethodHnd,
- &offsetsCount,
- &offsets,
- &offsetsImplicit);
+ info.compCompHnd->getBoundaries(info.compMethodHnd, &offsetsCount, &offsets, &offsetsImplicit);
/* Set the implicit boundaries */
@@ -578,14 +562,18 @@ void Compiler::eeGetStmtOffsets()
info.compStmtOffsetsCount = 0;
if (offsetsCount == 0)
+ {
return;
+ }
info.compStmtOffsets = new (this, CMK_DebugInfo) IL_OFFSET[offsetsCount];
for (unsigned i = 0; i < offsetsCount; i++)
{
if (offsets[i] > info.compILCodeSize)
+ {
continue;
+ }
info.compStmtOffsets[info.compStmtOffsetsCount] = offsets[i];
info.compStmtOffsetsCount++;
@@ -599,28 +587,31 @@ void Compiler::eeGetStmtOffsets()
* Debugging support - Local var info
*/
-void Compiler::eeSetLVcount (unsigned count)
+void Compiler::eeSetLVcount(unsigned count)
{
assert(opts.compScopeInfo);
-
+
JITDUMP("VarLocInfo count is %d\n", count);
eeVarsCount = count;
if (eeVarsCount)
- eeVars = (VarResultInfo *)info.compCompHnd->allocateArray(eeVarsCount * sizeof(eeVars[0]));
+ {
+ eeVars = (VarResultInfo*)info.compCompHnd->allocateArray(eeVarsCount * sizeof(eeVars[0]));
+ }
else
- eeVars = NULL;
+ {
+ eeVars = nullptr;
+ }
}
-void Compiler::eeSetLVinfo
- (unsigned which,
- UNATIVE_OFFSET startOffs,
- UNATIVE_OFFSET length,
- unsigned varNum,
- unsigned LVnum,
- VarName name,
- bool avail,
- const Compiler::siVarLoc & varLoc)
+void Compiler::eeSetLVinfo(unsigned which,
+ UNATIVE_OFFSET startOffs,
+ UNATIVE_OFFSET length,
+ unsigned varNum,
+ unsigned LVnum,
+ VarName name,
+ bool avail,
+ const Compiler::siVarLoc& varLoc)
{
// ICorDebugInfo::VarLoc and Compiler::siVarLoc have to overlap
// This is checked in siInit()
@@ -629,16 +620,16 @@ void Compiler::eeSetLVinfo
assert(eeVarsCount > 0);
assert(which < eeVarsCount);
- if (eeVars != NULL)
+ if (eeVars != nullptr)
{
- eeVars[which].startOffset = startOffs;
- eeVars[which].endOffset = startOffs + length;
- eeVars[which].varNumber = varNum;
- eeVars[which].loc = varLoc;
+ eeVars[which].startOffset = startOffs;
+ eeVars[which].endOffset = startOffs + length;
+ eeVars[which].varNumber = varNum;
+ eeVars[which].loc = varLoc;
}
}
-void Compiler::eeSetLVdone()
+void Compiler::eeSetLVdone()
{
// necessary but not sufficient condition that the 2 struct definitions overlap
assert(sizeof(eeVars[0]) == sizeof(ICorDebugInfo::NativeVarInfo));
@@ -647,62 +638,64 @@ void Compiler::eeSetLVdone()
#ifdef DEBUG
if (verbose)
{
- eeDispVars(info.compMethodHnd,
- eeVarsCount,
- (ICorDebugInfo::NativeVarInfo *) eeVars);
+ eeDispVars(info.compMethodHnd, eeVarsCount, (ICorDebugInfo::NativeVarInfo*)eeVars);
}
#endif // DEBUG
- info.compCompHnd->setVars(info.compMethodHnd,
- eeVarsCount,
- (ICorDebugInfo::NativeVarInfo *) eeVars);
+ info.compCompHnd->setVars(info.compMethodHnd, eeVarsCount, (ICorDebugInfo::NativeVarInfo*)eeVars);
- eeVars = NULL; // We give up ownership after setVars()
+ eeVars = nullptr; // We give up ownership after setVars()
}
-void Compiler::eeGetVars()
+void Compiler::eeGetVars()
{
- ICorDebugInfo::ILVarInfo * varInfoTable;
- ULONG32 varInfoCount;
- bool extendOthers;
+ ICorDebugInfo::ILVarInfo* varInfoTable;
+ ULONG32 varInfoCount;
+ bool extendOthers;
- info.compCompHnd->getVars(info.compMethodHnd,
- &varInfoCount, &varInfoTable, &extendOthers);
+ info.compCompHnd->getVars(info.compMethodHnd, &varInfoCount, &varInfoTable, &extendOthers);
#ifdef DEBUG
if (verbose)
+ {
printf("getVars() returned cVars = %d, extendOthers = %s\n", varInfoCount, extendOthers ? "true" : "false");
+ }
#endif
// Over allocate in case extendOthers is set.
- SIZE_T varInfoCountExtra = varInfoCount;
+ SIZE_T varInfoCountExtra = varInfoCount;
if (extendOthers)
+ {
varInfoCountExtra += info.compLocalsCount;
+ }
if (varInfoCountExtra == 0)
+ {
return;
+ }
info.compVarScopes = new (this, CMK_DebugInfo) VarScopeDsc[varInfoCountExtra];
- VarScopeDsc* localVarPtr = info.compVarScopes;
- ICorDebugInfo::ILVarInfo *v = varInfoTable;
+ VarScopeDsc* localVarPtr = info.compVarScopes;
+ ICorDebugInfo::ILVarInfo* v = varInfoTable;
for (unsigned i = 0; i < varInfoCount; i++, v++)
{
#ifdef DEBUG
if (verbose)
- printf("var:%d start:%d end:%d\n",
- v->varNumber,
- v->startOffset,
- v->endOffset);
+ {
+ printf("var:%d start:%d end:%d\n", v->varNumber, v->startOffset, v->endOffset);
+ }
#endif
if (v->startOffset >= v->endOffset)
+ {
continue;
+ }
assert(v->startOffset <= info.compILCodeSize);
- assert(v->endOffset <= info.compILCodeSize);
+ assert(v->endOffset <= info.compILCodeSize);
localVarPtr->vsdLifeBeg = v->startOffset;
localVarPtr->vsdLifeEnd = v->endOffset;
@@ -710,7 +703,7 @@ void Compiler::eeGetVars()
localVarPtr->vsdVarNum = compMapILvarNum(v->varNumber);
#ifdef DEBUG
- localVarPtr->vsdName = gtGetLclVarName(localVarPtr->vsdVarNum);
+ localVarPtr->vsdName = gtGetLclVarName(localVarPtr->vsdVarNum);
#endif
localVarPtr++;
@@ -722,27 +715,32 @@ void Compiler::eeGetVars()
to zero-initalize all of them. This will be expensive if it's used
for too many variables.
*/
- if (extendOthers)
+ if (extendOthers)
{
// Allocate a bit-array for all the variables and initialize to false
- bool * varInfoProvided = (bool *)compGetMemA(info.compLocalsCount *
- sizeof(varInfoProvided[0]));
+ bool* varInfoProvided = (bool*)compGetMemA(info.compLocalsCount * sizeof(varInfoProvided[0]));
unsigned i;
for (i = 0; i < info.compLocalsCount; i++)
+ {
varInfoProvided[i] = false;
+ }
// Find which vars have absolutely no varInfo provided
for (i = 0; i < info.compVarScopesCount; i++)
+ {
varInfoProvided[info.compVarScopes[i].vsdVarNum] = true;
+ }
// Create entries for the variables with no varInfo
for (unsigned varNum = 0; varNum < info.compLocalsCount; varNum++)
{
if (varInfoProvided[varNum])
+ {
continue;
+ }
// Create a varInfo with scope over the entire method
@@ -752,7 +750,7 @@ void Compiler::eeGetVars()
localVarPtr->vsdLVnum = info.compVarScopesCount;
#ifdef DEBUG
- localVarPtr->vsdName = gtGetLclVarName(localVarPtr->vsdVarNum);
+ localVarPtr->vsdName = gtGetLclVarName(localVarPtr->vsdVarNum);
#endif
localVarPtr++;
@@ -763,116 +761,116 @@ void Compiler::eeGetVars()
assert(localVarPtr <= info.compVarScopes + varInfoCountExtra);
if (varInfoCount != 0)
+ {
info.compCompHnd->freeArray(varInfoTable);
+ }
#ifdef DEBUG
if (verbose)
+ {
compDispLocalVars();
+ }
#endif // DEBUG
}
#ifdef DEBUG
-void Compiler::eeDispVar(ICorDebugInfo::NativeVarInfo* var)
+void Compiler::eeDispVar(ICorDebugInfo::NativeVarInfo* var)
{
- const char* name = NULL;
+ const char* name = nullptr;
if (var->varNumber == (DWORD)ICorDebugInfo::VARARGS_HND_ILNUM)
+ {
name = "varargsHandle";
+ }
else if (var->varNumber == (DWORD)ICorDebugInfo::RETBUF_ILNUM)
+ {
name = "retBuff";
+ }
else if (var->varNumber == (DWORD)ICorDebugInfo::TYPECTXT_ILNUM)
+ {
name = "typeCtx";
-
- printf("%3d(%10s) : From %08Xh to %08Xh, in ",
- var->varNumber,
- (VarNameToStr(name) == NULL) ? "UNKNOWN" : VarNameToStr(name),
- var->startOffset,
- var->endOffset);
+ }
+ printf("%3d(%10s) : From %08Xh to %08Xh, in ", var->varNumber,
+ (VarNameToStr(name) == nullptr) ? "UNKNOWN" : VarNameToStr(name), var->startOffset, var->endOffset);
switch (var->loc.vlType)
{
- case VLT_REG:
- case VLT_REG_BYREF:
- case VLT_REG_FP:
- printf("%s", getRegName(var->loc.vlReg.vlrReg));
- if (var->loc.vlType == (ICorDebugInfo::VarLocType)VLT_REG_BYREF)
- {
- printf(" byref");
- }
- break;
+ case VLT_REG:
+ case VLT_REG_BYREF:
+ case VLT_REG_FP:
+ printf("%s", getRegName(var->loc.vlReg.vlrReg));
+ if (var->loc.vlType == (ICorDebugInfo::VarLocType)VLT_REG_BYREF)
+ {
+ printf(" byref");
+ }
+ break;
- case VLT_STK:
- case VLT_STK_BYREF:
- if ((int) var->loc.vlStk.vlsBaseReg != (int) ICorDebugInfo::REGNUM_AMBIENT_SP)
- {
- printf("%s[%d] (1 slot)", getRegName(var->loc.vlStk.vlsBaseReg),
- var->loc.vlStk.vlsOffset);
- }
- else
- {
- printf(STR_SPBASE "'[%d] (1 slot)", var->loc.vlStk.vlsOffset);
- }
- if (var->loc.vlType == (ICorDebugInfo::VarLocType)VLT_REG_BYREF)
- {
- printf(" byref");
- }
- break;
+ case VLT_STK:
+ case VLT_STK_BYREF:
+ if ((int)var->loc.vlStk.vlsBaseReg != (int)ICorDebugInfo::REGNUM_AMBIENT_SP)
+ {
+ printf("%s[%d] (1 slot)", getRegName(var->loc.vlStk.vlsBaseReg), var->loc.vlStk.vlsOffset);
+ }
+ else
+ {
+ printf(STR_SPBASE "'[%d] (1 slot)", var->loc.vlStk.vlsOffset);
+ }
+ if (var->loc.vlType == (ICorDebugInfo::VarLocType)VLT_REG_BYREF)
+ {
+ printf(" byref");
+ }
+ break;
#ifndef _TARGET_AMD64_
- case VLT_REG_REG:
- printf("%s-%s", getRegName(var->loc.vlRegReg.vlrrReg1),
- getRegName(var->loc.vlRegReg.vlrrReg2));
- break;
+ case VLT_REG_REG:
+ printf("%s-%s", getRegName(var->loc.vlRegReg.vlrrReg1), getRegName(var->loc.vlRegReg.vlrrReg2));
+ break;
- case VLT_REG_STK:
- if ((int) var->loc.vlRegStk.vlrsStk.vlrssBaseReg != (int) ICorDebugInfo::REGNUM_AMBIENT_SP)
- {
- printf("%s-%s[%d]", getRegName(var->loc.vlRegStk.vlrsReg),
- getRegName(var->loc.vlRegStk.vlrsStk.vlrssBaseReg),
- var->loc.vlRegStk.vlrsStk.vlrssOffset);
- }
- else
- {
- printf("%s-" STR_SPBASE "'[%d]", getRegName(var->loc.vlRegStk.vlrsReg),
- var->loc.vlRegStk.vlrsStk.vlrssOffset);
- }
- break;
+ case VLT_REG_STK:
+ if ((int)var->loc.vlRegStk.vlrsStk.vlrssBaseReg != (int)ICorDebugInfo::REGNUM_AMBIENT_SP)
+ {
+ printf("%s-%s[%d]", getRegName(var->loc.vlRegStk.vlrsReg),
+ getRegName(var->loc.vlRegStk.vlrsStk.vlrssBaseReg), var->loc.vlRegStk.vlrsStk.vlrssOffset);
+ }
+ else
+ {
+ printf("%s-" STR_SPBASE "'[%d]", getRegName(var->loc.vlRegStk.vlrsReg),
+ var->loc.vlRegStk.vlrsStk.vlrssOffset);
+ }
+ break;
- case VLT_STK_REG:
- unreached(); // unexpected
+ case VLT_STK_REG:
+ unreached(); // unexpected
- case VLT_STK2:
- if ((int) var->loc.vlStk2.vls2BaseReg != (int) ICorDebugInfo::REGNUM_AMBIENT_SP)
- {
- printf("%s[%d] (2 slots)", getRegName(var->loc.vlStk2.vls2BaseReg),
- var->loc.vlStk2.vls2Offset);
- }
- else
- {
- printf(STR_SPBASE "'[%d] (2 slots)", var->loc.vlStk2.vls2Offset);
- }
- break;
+ case VLT_STK2:
+ if ((int)var->loc.vlStk2.vls2BaseReg != (int)ICorDebugInfo::REGNUM_AMBIENT_SP)
+ {
+ printf("%s[%d] (2 slots)", getRegName(var->loc.vlStk2.vls2BaseReg), var->loc.vlStk2.vls2Offset);
+ }
+ else
+ {
+ printf(STR_SPBASE "'[%d] (2 slots)", var->loc.vlStk2.vls2Offset);
+ }
+ break;
- case VLT_FPSTK:
- printf("ST(L-%d)", var->loc.vlFPstk.vlfReg);
- break;
+ case VLT_FPSTK:
+ printf("ST(L-%d)", var->loc.vlFPstk.vlfReg);
+ break;
- case VLT_FIXED_VA:
- printf("fxd_va[%d]", var->loc.vlFixedVarArg.vlfvOffset);
- break;
+ case VLT_FIXED_VA:
+ printf("fxd_va[%d]", var->loc.vlFixedVarArg.vlfvOffset);
+ break;
#endif // !_TARGET_AMD64_
- default:
- unreached(); // unexpected
+ default:
+ unreached(); // unexpected
}
printf("\n");
}
// Same parameters as ICorStaticInfo::setVars().
-void Compiler::eeDispVars(CORINFO_METHOD_HANDLE ftn,
- ULONG32 cVars,
- ICorDebugInfo::NativeVarInfo* vars)
+void Compiler::eeDispVars(CORINFO_METHOD_HANDLE ftn, ULONG32 cVars, ICorDebugInfo::NativeVarInfo* vars)
{
printf("*************** Variable debug info\n");
printf("%d vars\n", cVars);
@@ -888,37 +886,38 @@ void Compiler::eeDispVars(CORINFO_METHOD_HANDLE ftn,
* Debugging support - Line number info
*/
-void Compiler::eeSetLIcount (unsigned count)
+void Compiler::eeSetLIcount(unsigned count)
{
assert(opts.compDbgInfo);
-
+
eeBoundariesCount = count;
if (eeBoundariesCount)
- eeBoundaries = (boundariesDsc *) info.compCompHnd->allocateArray(eeBoundariesCount * sizeof(eeBoundaries[0]));
+ {
+ eeBoundaries = (boundariesDsc*)info.compCompHnd->allocateArray(eeBoundariesCount * sizeof(eeBoundaries[0]));
+ }
else
- eeBoundaries = NULL;
+ {
+ eeBoundaries = nullptr;
+ }
}
-void Compiler::eeSetLIinfo (unsigned which,
- UNATIVE_OFFSET nativeOffset,
- IL_OFFSET ilOffset,
- bool stkEmpty,
- bool callInstruction)
+void Compiler::eeSetLIinfo(
+ unsigned which, UNATIVE_OFFSET nativeOffset, IL_OFFSET ilOffset, bool stkEmpty, bool callInstruction)
{
assert(opts.compDbgInfo);
assert(eeBoundariesCount > 0);
assert(which < eeBoundariesCount);
- if (eeBoundaries != NULL)
+ if (eeBoundaries != nullptr)
{
- eeBoundaries[which].nativeIP = nativeOffset;
- eeBoundaries[which].ilOffset = ilOffset;
+ eeBoundaries[which].nativeIP = nativeOffset;
+ eeBoundaries[which].ilOffset = ilOffset;
eeBoundaries[which].sourceReason = stkEmpty ? ICorDebugInfo::STACK_EMPTY : 0;
eeBoundaries[which].sourceReason |= callInstruction ? ICorDebugInfo::CALL_INSTRUCTION : 0;
}
}
-void Compiler::eeSetLIdone()
+void Compiler::eeSetLIdone()
{
assert(opts.compDbgInfo);
@@ -932,38 +931,36 @@ void Compiler::eeSetLIdone()
// necessary but not sufficient condition that the 2 struct definitions overlap
assert(sizeof(eeBoundaries[0]) == sizeof(ICorDebugInfo::OffsetMapping));
- info.compCompHnd->setBoundaries(info.compMethodHnd,
- eeBoundariesCount,
- (ICorDebugInfo::OffsetMapping *) eeBoundaries);
+ info.compCompHnd->setBoundaries(info.compMethodHnd, eeBoundariesCount, (ICorDebugInfo::OffsetMapping*)eeBoundaries);
- eeBoundaries = NULL; // we give up ownership after setBoundaries();
+ eeBoundaries = nullptr; // we give up ownership after setBoundaries();
}
#if defined(DEBUG)
/* static */
-void Compiler::eeDispILOffs(IL_OFFSET offs)
+void Compiler::eeDispILOffs(IL_OFFSET offs)
{
- const char * specialOffs[] = { "EPILOG", "PROLOG", "NO_MAP" };
+ const char* specialOffs[] = {"EPILOG", "PROLOG", "NO_MAP"};
switch ((int)offs) // Need the cast since offs is unsigned and the case statements are comparing to signed.
{
- case ICorDebugInfo::EPILOG:
- case ICorDebugInfo::PROLOG:
- case ICorDebugInfo::NO_MAPPING:
- assert(DWORD(ICorDebugInfo::EPILOG) + 1 == (unsigned)ICorDebugInfo::PROLOG);
- assert(DWORD(ICorDebugInfo::EPILOG) + 2 == (unsigned)ICorDebugInfo::NO_MAPPING);
- int specialOffsNum;
- specialOffsNum = offs - DWORD(ICorDebugInfo::EPILOG);
- printf("%s", specialOffs[specialOffsNum]);
- break;
- default:
- printf("0x%04X", offs);
+ case ICorDebugInfo::EPILOG:
+ case ICorDebugInfo::PROLOG:
+ case ICorDebugInfo::NO_MAPPING:
+ assert(DWORD(ICorDebugInfo::EPILOG) + 1 == (unsigned)ICorDebugInfo::PROLOG);
+ assert(DWORD(ICorDebugInfo::EPILOG) + 2 == (unsigned)ICorDebugInfo::NO_MAPPING);
+ int specialOffsNum;
+ specialOffsNum = offs - DWORD(ICorDebugInfo::EPILOG);
+ printf("%s", specialOffs[specialOffsNum]);
+ break;
+ default:
+ printf("0x%04X", offs);
}
}
/* static */
-void Compiler::eeDispLineInfo(const boundariesDsc* line)
+void Compiler::eeDispLineInfo(const boundariesDsc* line)
{
printf("IL offs ");
@@ -996,7 +993,7 @@ void Compiler::eeDispLineInfo(const boundariesDsc* line)
assert((line->sourceReason & ~(ICorDebugInfo::STACK_EMPTY | ICorDebugInfo::CALL_INSTRUCTION)) == 0);
}
-void Compiler::eeDispLineInfos()
+void Compiler::eeDispLineInfos()
{
printf("IP mapping count : %d\n", eeBoundariesCount); // this might be zero
for (unsigned i = 0; i < eeBoundariesCount; i++)
@@ -1016,17 +1013,13 @@ void Compiler::eeDispLineInfos()
* (e.g., host AMD64, target ARM64), then VM will get confused anyway.
*/
-void Compiler::eeReserveUnwindInfo(BOOL isFunclet,
- BOOL isColdCode,
- ULONG unwindSize)
+void Compiler::eeReserveUnwindInfo(BOOL isFunclet, BOOL isColdCode, ULONG unwindSize)
{
#ifdef DEBUG
if (verbose)
{
- printf("reserveUnwindInfo(isFunclet=%s, isColdCode=%s, unwindSize=0x%x)\n",
- isFunclet ? "TRUE" : "FALSE",
- isColdCode ? "TRUE" : "FALSE",
- unwindSize);
+ printf("reserveUnwindInfo(isFunclet=%s, isColdCode=%s, unwindSize=0x%x)\n", isFunclet ? "TRUE" : "FALSE",
+ isColdCode ? "TRUE" : "FALSE", unwindSize);
}
#endif // DEBUG
@@ -1036,31 +1029,34 @@ void Compiler::eeReserveUnwindInfo(BOOL isFunclet,
}
}
-void Compiler::eeAllocUnwindInfo(BYTE* pHotCode,
- BYTE* pColdCode,
- ULONG startOffset,
- ULONG endOffset,
- ULONG unwindSize,
- BYTE* pUnwindBlock,
- CorJitFuncKind funcKind)
+void Compiler::eeAllocUnwindInfo(BYTE* pHotCode,
+ BYTE* pColdCode,
+ ULONG startOffset,
+ ULONG endOffset,
+ ULONG unwindSize,
+ BYTE* pUnwindBlock,
+ CorJitFuncKind funcKind)
{
#ifdef DEBUG
if (verbose)
{
- printf("allocUnwindInfo(pHotCode=0x%p, pColdCode=0x%p, startOffset=0x%x, endOffset=0x%x, unwindSize=0x%x, pUnwindBlock=0x%p, funKind=%d",
- dspPtr(pHotCode),
- dspPtr(pColdCode),
- startOffset,
- endOffset,
- unwindSize,
- dspPtr(pUnwindBlock),
- funcKind);
+ printf("allocUnwindInfo(pHotCode=0x%p, pColdCode=0x%p, startOffset=0x%x, endOffset=0x%x, unwindSize=0x%x, "
+ "pUnwindBlock=0x%p, funKind=%d",
+ dspPtr(pHotCode), dspPtr(pColdCode), startOffset, endOffset, unwindSize, dspPtr(pUnwindBlock), funcKind);
switch (funcKind)
{
- case CORJIT_FUNC_ROOT: printf(" (main function)"); break;
- case CORJIT_FUNC_HANDLER: printf(" (handler)"); break;
- case CORJIT_FUNC_FILTER: printf(" (filter)"); break;
- default: printf(" (ILLEGAL)"); break;
+ case CORJIT_FUNC_ROOT:
+ printf(" (main function)");
+ break;
+ case CORJIT_FUNC_HANDLER:
+ printf(" (handler)");
+ break;
+ case CORJIT_FUNC_FILTER:
+ printf(" (filter)");
+ break;
+ default:
+ printf(" (ILLEGAL)");
+ break;
}
printf(")\n");
}
@@ -1068,18 +1064,12 @@ void Compiler::eeAllocUnwindInfo(BYTE* pHotCode,
if (info.compMatchedVM)
{
- info.compCompHnd->allocUnwindInfo(
- pHotCode,
- pColdCode,
- startOffset,
- endOffset,
- unwindSize,
- pUnwindBlock,
- funcKind);
+ info.compCompHnd->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock,
+ funcKind);
}
}
-void Compiler::eeSetEHcount(unsigned cEH)
+void Compiler::eeSetEHcount(unsigned cEH)
{
#ifdef DEBUG
if (verbose)
@@ -1094,8 +1084,7 @@ void Compiler::eeSetEHcount(unsigned cEH)
}
}
-void Compiler::eeSetEHinfo(unsigned EHnumber,
- const CORINFO_EH_CLAUSE *clause)
+void Compiler::eeSetEHinfo(unsigned EHnumber, const CORINFO_EH_CLAUSE* clause)
{
#ifdef DEBUG
if (opts.dspEHTable)
@@ -1110,7 +1099,7 @@ void Compiler::eeSetEHinfo(unsigned EHnumber,
}
}
-WORD Compiler::eeGetRelocTypeHint(void * target)
+WORD Compiler::eeGetRelocTypeHint(void* target)
{
if (info.compMatchedVM)
{
@@ -1123,7 +1112,6 @@ WORD Compiler::eeGetRelocTypeHint(void * target)
}
}
-
CORINFO_FIELD_HANDLE Compiler::eeFindJitDataOffs(unsigned dataOffs)
{
// Data offsets are marked by the fact that the low two bits are 0b01 0x1
@@ -1137,14 +1125,14 @@ bool Compiler::eeIsJitDataOffs(CORINFO_FIELD_HANDLE field)
unsigned value = static_cast<unsigned>(reinterpret_cast<uintptr_t>(field));
if (((CORINFO_FIELD_HANDLE)(size_t)value) != field)
{
- return false; // upper bits were set, not a jit data offset
+ return false; // upper bits were set, not a jit data offset
}
// Data offsets are marked by the fact that the low two bits are 0b01 0x1
return (value & iaut_MASK) == iaut_DATA_OFFSET;
}
-int Compiler::eeGetJitDataOffs(CORINFO_FIELD_HANDLE field)
+int Compiler::eeGetJitDataOffs(CORINFO_FIELD_HANDLE field)
{
// Data offsets are marked by the fact that the low two bits are 0b01 0x1
if (eeIsJitDataOffs(field))
@@ -1160,7 +1148,6 @@ int Compiler::eeGetJitDataOffs(CORINFO_FIELD_HANDLE field)
}
}
-
/*****************************************************************************
*
* ICorStaticInfo wrapper functions
@@ -1173,21 +1160,40 @@ void Compiler::dumpSystemVClassificationType(SystemVClassificationType ct)
{
switch (ct)
{
- case SystemVClassificationTypeUnknown: printf("UNKNOWN"); break;
- case SystemVClassificationTypeStruct: printf("Struct"); break;
- case SystemVClassificationTypeNoClass: printf("NoClass"); break;
- case SystemVClassificationTypeMemory: printf("Memory"); break;
- case SystemVClassificationTypeInteger: printf("Integer"); break;
- case SystemVClassificationTypeIntegerReference: printf("IntegerReference"); break;
- case SystemVClassificationTypeIntegerByRef: printf("IntegerByReference"); break;
- case SystemVClassificationTypeSSE: printf("SSE"); break;
- default: printf("ILLEGAL"); break;
+ case SystemVClassificationTypeUnknown:
+ printf("UNKNOWN");
+ break;
+ case SystemVClassificationTypeStruct:
+ printf("Struct");
+ break;
+ case SystemVClassificationTypeNoClass:
+ printf("NoClass");
+ break;
+ case SystemVClassificationTypeMemory:
+ printf("Memory");
+ break;
+ case SystemVClassificationTypeInteger:
+ printf("Integer");
+ break;
+ case SystemVClassificationTypeIntegerReference:
+ printf("IntegerReference");
+ break;
+ case SystemVClassificationTypeIntegerByRef:
+ printf("IntegerByReference");
+ break;
+ case SystemVClassificationTypeSSE:
+ printf("SSE");
+ break;
+ default:
+ printf("ILLEGAL");
+ break;
}
}
#endif // DEBUG
-void Compiler::eeGetSystemVAmd64PassStructInRegisterDescriptor(/*IN*/ CORINFO_CLASS_HANDLE structHnd,
- /*OUT*/ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
+void Compiler::eeGetSystemVAmd64PassStructInRegisterDescriptor(
+ /*IN*/ CORINFO_CLASS_HANDLE structHnd,
+ /*OUT*/ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
{
bool ok = info.compCompHnd->getSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr);
noway_assert(ok);
@@ -1195,7 +1201,8 @@ void Compiler::eeGetSystemVAmd64PassStructInRegisterDescriptor(/*IN*/ CORINFO_C
#ifdef DEBUG
if (verbose)
{
- printf("**** getSystemVAmd64PassStructInRegisterDescriptor(0x%x (%s), ...) =>\n", dspPtr(structHnd), eeGetClassName(structHnd));
+ printf("**** getSystemVAmd64PassStructInRegisterDescriptor(0x%x (%s), ...) =>\n", dspPtr(structHnd),
+ eeGetClassName(structHnd));
printf(" passedInRegisters = %s\n", dspBool(structPassInRegDescPtr->passedInRegisters));
if (structPassInRegDescPtr->passedInRegisters)
{
@@ -1204,9 +1211,8 @@ void Compiler::eeGetSystemVAmd64PassStructInRegisterDescriptor(/*IN*/ CORINFO_C
{
printf(" eightByte #%d -- classification: ", i);
dumpSystemVClassificationType(structPassInRegDescPtr->eightByteClassifications[i]);
- printf(", byteSize: %d, byteOffset: %d\n",
- structPassInRegDescPtr->eightByteSizes[i],
- structPassInRegDescPtr->eightByteOffsets[i]);
+ printf(", byteSize: %d, byteOffset: %d\n", structPassInRegDescPtr->eightByteSizes[i],
+ structPassInRegDescPtr->eightByteOffsets[i]);
}
}
}
@@ -1227,32 +1233,32 @@ static bool isValidTokenForTryResolveToken(ICorJitInfo* corInfo, CORINFO_RESOLVE
CorInfoTokenKind tokenType = resolvedToken->tokenType;
switch (TypeFromToken(resolvedToken->token))
{
- case mdtModuleRef:
- case mdtTypeDef:
- case mdtTypeRef:
- case mdtTypeSpec:
- if ((tokenType & CORINFO_TOKENKIND_Class) == 0)
- return false;
- break;
-
- case mdtMethodDef:
- case mdtMethodSpec:
- if ((tokenType & CORINFO_TOKENKIND_Method) == 0)
- return false;
- break;
-
- case mdtFieldDef:
- if ((tokenType & CORINFO_TOKENKIND_Field) == 0)
+ case mdtModuleRef:
+ case mdtTypeDef:
+ case mdtTypeRef:
+ case mdtTypeSpec:
+ if ((tokenType & CORINFO_TOKENKIND_Class) == 0)
+ return false;
+ break;
+
+ case mdtMethodDef:
+ case mdtMethodSpec:
+ if ((tokenType & CORINFO_TOKENKIND_Method) == 0)
+ return false;
+ break;
+
+ case mdtFieldDef:
+ if ((tokenType & CORINFO_TOKENKIND_Field) == 0)
+ return false;
+ break;
+
+ case mdtMemberRef:
+ if ((tokenType & (CORINFO_TOKENKIND_Method | CORINFO_TOKENKIND_Field)) == 0)
+ return false;
+ break;
+
+ default:
return false;
- break;
-
- case mdtMemberRef:
- if ((tokenType & (CORINFO_TOKENKIND_Method | CORINFO_TOKENKIND_Field)) == 0)
- return false;
- break;
-
- default:
- return false;
}
return true;
@@ -1262,10 +1268,10 @@ static bool isValidTokenForTryResolveToken(ICorJitInfo* corInfo, CORINFO_RESOLVE
// `eeTryResolveToken` below.
struct TryResolveTokenFilterParam
{
- ICorJitInfo* m_corInfo;
+ ICorJitInfo* m_corInfo;
CORINFO_RESOLVED_TOKEN* m_resolvedToken;
- EXCEPTION_POINTERS m_exceptionPointers;
- bool m_success;
+ EXCEPTION_POINTERS m_exceptionPointers;
+ bool m_success;
};
LONG TryResolveTokenFilter(struct _EXCEPTION_POINTERS* exceptionPointers, void* theParam)
@@ -1292,9 +1298,9 @@ LONG TryResolveTokenFilter(struct _EXCEPTION_POINTERS* exceptionPointers, void*
bool Compiler::eeTryResolveToken(CORINFO_RESOLVED_TOKEN* resolvedToken)
{
TryResolveTokenFilterParam param;
- param.m_corInfo = info.compCompHnd;
+ param.m_corInfo = info.compCompHnd;
param.m_resolvedToken = resolvedToken;
- param.m_success = true;
+ param.m_success = true;
PAL_TRY(TryResolveTokenFilterParam*, pParam, &param)
{
@@ -1316,17 +1322,17 @@ bool Compiler::eeTryResolveToken(CORINFO_RESOLVED_TOKEN* resolvedToken)
struct TrapParam
{
- ICorJitInfo* m_corInfo;
+ ICorJitInfo* m_corInfo;
EXCEPTION_POINTERS m_exceptionPointers;
void (*m_function)(void*);
void* m_param;
- bool m_success;
+ bool m_success;
};
static LONG __EEFilter(PEXCEPTION_POINTERS exceptionPointers, void* param)
{
- auto* trapParam = reinterpret_cast<TrapParam*>(param);
+ auto* trapParam = reinterpret_cast<TrapParam*>(param);
trapParam->m_exceptionPointers = *exceptionPointers;
return trapParam->m_corInfo->FilterException(exceptionPointers);
}
@@ -1334,10 +1340,10 @@ static LONG __EEFilter(PEXCEPTION_POINTERS exceptionPointers, void* param)
bool Compiler::eeRunWithErrorTrapImp(void (*function)(void*), void* param)
{
TrapParam trapParam;
- trapParam.m_corInfo = info.compCompHnd;
+ trapParam.m_corInfo = info.compCompHnd;
trapParam.m_function = function;
- trapParam.m_param = param;
- trapParam.m_success = true;
+ trapParam.m_param = param;
+ trapParam.m_success = true;
PAL_TRY(TrapParam*, __trapParam, &trapParam)
{
@@ -1354,7 +1360,7 @@ bool Compiler::eeRunWithErrorTrapImp(void (*function)(void*), void* param)
}
#else // CORJIT_EE_VER <= 460
-
+
bool Compiler::eeTryResolveToken(CORINFO_RESOLVED_TOKEN* resolvedToken)
{
return info.compCompHnd->tryResolveToken(resolvedToken);
@@ -1377,10 +1383,9 @@ bool Compiler::eeRunWithErrorTrapImp(void (*function)(void*), void* param)
/*****************************************************************************/
// static helper names - constant array
-const char* jitHlpFuncTable[CORINFO_HELP_COUNT] =
-{
-#define JITHELPER(code, pfnHelper, sig) #code,
-#define DYNAMICJITHELPER(code, pfnHelper,sig) #code,
+const char* jitHlpFuncTable[CORINFO_HELP_COUNT] = {
+#define JITHELPER(code, pfnHelper, sig) #code,
+#define DYNAMICJITHELPER(code, pfnHelper, sig) #code,
#include "jithelpers.h"
};
@@ -1392,42 +1397,42 @@ const char* jitHlpFuncTable[CORINFO_HELP_COUNT] =
struct FilterSuperPMIExceptionsParam_ee_il
{
- Compiler* pThis;
- Compiler::Info* pJitInfo;
- CORINFO_FIELD_HANDLE field;
- CORINFO_METHOD_HANDLE method;
- CORINFO_CLASS_HANDLE clazz;
- const char** classNamePtr;
- const char* fieldOrMethodOrClassNamePtr;
- EXCEPTION_POINTERS exceptionPointers;
+ Compiler* pThis;
+ Compiler::Info* pJitInfo;
+ CORINFO_FIELD_HANDLE field;
+ CORINFO_METHOD_HANDLE method;
+ CORINFO_CLASS_HANDLE clazz;
+ const char** classNamePtr;
+ const char* fieldOrMethodOrClassNamePtr;
+ EXCEPTION_POINTERS exceptionPointers;
};
static LONG FilterSuperPMIExceptions_ee_il(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam)
{
- FilterSuperPMIExceptionsParam_ee_il *pSPMIEParam =
- (FilterSuperPMIExceptionsParam_ee_il *)lpvParam;
- pSPMIEParam->exceptionPointers = *pExceptionPointers;
+ FilterSuperPMIExceptionsParam_ee_il* pSPMIEParam = (FilterSuperPMIExceptionsParam_ee_il*)lpvParam;
+ pSPMIEParam->exceptionPointers = *pExceptionPointers;
if (pSPMIEParam->pThis->IsSuperPMIException(pExceptionPointers->ExceptionRecord->ExceptionCode))
+ {
return EXCEPTION_EXECUTE_HANDLER;
-
+ }
+
return EXCEPTION_CONTINUE_SEARCH;
}
-const char* Compiler::eeGetMethodName(CORINFO_METHOD_HANDLE method,
- const char** classNamePtr)
+const char* Compiler::eeGetMethodName(CORINFO_METHOD_HANDLE method, const char** classNamePtr)
{
- if (eeGetHelperNum(method))
+ if (eeGetHelperNum(method))
{
- if (classNamePtr != 0)
+ if (classNamePtr != nullptr)
+ {
*classNamePtr = "HELPER";
-
+ }
CorInfoHelpFunc ftnNum = eeGetHelperNum(method);
- const char* name = info.compCompHnd->getHelperName(ftnNum);
+ const char* name = info.compCompHnd->getHelperName(ftnNum);
// If it's something unknown from a RET VM, or from SuperPMI, then use our own helper name table.
- if ((strcmp(name, "AnyJITHelper") == 0) ||
- (strcmp(name, "Yickish helper name") == 0))
+ if ((strcmp(name, "AnyJITHelper") == 0) || (strcmp(name, "Yickish helper name") == 0))
{
if (ftnNum < CORINFO_HELP_COUNT)
{
@@ -1439,21 +1444,24 @@ const char* Compiler::eeGetMethodName(CORINFO_METHOD_HANDLE method
if (eeIsNativeMethod(method))
{
- if (classNamePtr != 0)
- *classNamePtr = "NATIVE";
+ if (classNamePtr != nullptr)
+ {
+ *classNamePtr = "NATIVE";
+ }
method = eeGetMethodHandleForNative(method);
}
FilterSuperPMIExceptionsParam_ee_il param;
- param.pThis = this;
- param.pJitInfo = &info;
- param.method = method;
+ param.pThis = this;
+ param.pJitInfo = &info;
+ param.method = method;
param.classNamePtr = classNamePtr;
- PAL_TRY(FilterSuperPMIExceptionsParam_ee_il *, pParam, &param)
+ PAL_TRY(FilterSuperPMIExceptionsParam_ee_il*, pParam, &param)
{
- pParam->fieldOrMethodOrClassNamePtr = pParam->pJitInfo->compCompHnd->getMethodName(pParam->method, pParam->classNamePtr);
+ pParam->fieldOrMethodOrClassNamePtr =
+ pParam->pJitInfo->compCompHnd->getMethodName(pParam->method, pParam->classNamePtr);
}
PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_ee_il)
{
@@ -1469,19 +1477,19 @@ const char* Compiler::eeGetMethodName(CORINFO_METHOD_HANDLE method
return param.fieldOrMethodOrClassNamePtr;
}
-const char * Compiler::eeGetFieldName (CORINFO_FIELD_HANDLE field,
- const char * * classNamePtr)
+const char* Compiler::eeGetFieldName(CORINFO_FIELD_HANDLE field, const char** classNamePtr)
{
FilterSuperPMIExceptionsParam_ee_il param;
- param.pThis = this;
- param.pJitInfo = &info;
- param.field = field;
+ param.pThis = this;
+ param.pJitInfo = &info;
+ param.field = field;
param.classNamePtr = classNamePtr;
- PAL_TRY(FilterSuperPMIExceptionsParam_ee_il *, pParam, &param)
+ PAL_TRY(FilterSuperPMIExceptionsParam_ee_il*, pParam, &param)
{
- pParam->fieldOrMethodOrClassNamePtr = pParam->pJitInfo->compCompHnd->getFieldName(pParam->field, pParam->classNamePtr);
+ pParam->fieldOrMethodOrClassNamePtr =
+ pParam->pJitInfo->compCompHnd->getFieldName(pParam->field, pParam->classNamePtr);
}
PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_ee_il)
{
@@ -1492,15 +1500,15 @@ const char * Compiler::eeGetFieldName (CORINFO_FIELD_HANDLE field,
return param.fieldOrMethodOrClassNamePtr;
}
-const char* Compiler::eeGetClassName(CORINFO_CLASS_HANDLE clsHnd)
+const char* Compiler::eeGetClassName(CORINFO_CLASS_HANDLE clsHnd)
{
FilterSuperPMIExceptionsParam_ee_il param;
- param.pThis = this;
+ param.pThis = this;
param.pJitInfo = &info;
- param.clazz = clsHnd;
+ param.clazz = clsHnd;
- PAL_TRY(FilterSuperPMIExceptionsParam_ee_il *, pParam, &param)
+ PAL_TRY(FilterSuperPMIExceptionsParam_ee_il*, pParam, &param)
{
pParam->fieldOrMethodOrClassNamePtr = pParam->pJitInfo->compCompHnd->getClassName(pParam->clazz);
}
@@ -1514,29 +1522,31 @@ const char* Compiler::eeGetClassName(CORINFO_CLASS_HANDLE clsHnd)
#endif // DEBUG || FEATURE_JIT_METHOD_PERF
-
#ifdef DEBUG
-const wchar_t * Compiler::eeGetCPString (size_t strHandle)
+const wchar_t* Compiler::eeGetCPString(size_t strHandle)
{
char buff[512 + sizeof(CORINFO_String)];
- // make this bulletproof, so it works even if we are wrong.
- if (ReadProcessMemory(GetCurrentProcess(), (void*) strHandle, buff, 4, 0) == 0)
- return(0);
+ // make this bulletproof, so it works even if we are wrong.
+ if (ReadProcessMemory(GetCurrentProcess(), (void*)strHandle, buff, 4, nullptr) == 0)
+ {
+ return (nullptr);
+ }
- CORINFO_String* asString = *((CORINFO_String**) strHandle);
+ CORINFO_String* asString = *((CORINFO_String**)strHandle);
- if (ReadProcessMemory(GetCurrentProcess(), asString, buff, sizeof(buff), 0) == 0)
- return(0);
+ if (ReadProcessMemory(GetCurrentProcess(), asString, buff, sizeof(buff), nullptr) == 0)
+ {
+ return (nullptr);
+ }
- if (asString->stringLen >= 255 ||
- asString->chars[asString->stringLen] != 0 )
+ if (asString->stringLen >= 255 || asString->chars[asString->stringLen] != 0)
{
- return 0;
+ return nullptr;
}
- return(asString->chars);
+ return (asString->chars);
}
#endif // DEBUG