diff options
Diffstat (limited to 'src/ToolBox/superpmi/superpmi-shim-counter')
15 files changed, 546 insertions, 809 deletions
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp index 5b764f2fa5..14a55b5d79 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp @@ -7,17 +7,14 @@ #include "coreclrcallbacks.h" #include "iexecutionengine.h" -typedef LPVOID (__stdcall * pfnEEHeapAllocInProcessHeap)(DWORD dwFlags, SIZE_T dwBytes); -typedef BOOL (__stdcall * pfnEEHeapFreeInProcessHeap)(DWORD dwFlags, LPVOID lpMem); - -CoreClrCallbacks *original_CoreClrCallbacks = nullptr; +CoreClrCallbacks* original_CoreClrCallbacks = nullptr; pfnEEHeapAllocInProcessHeap original_EEHeapAllocInProcessHeap = nullptr; -pfnEEHeapFreeInProcessHeap original_EEHeapFreeInProcessHeap = nullptr; +pfnEEHeapFreeInProcessHeap original_EEHeapFreeInProcessHeap = nullptr; -IExecutionEngine* STDMETHODCALLTYPE IEE_t() +IExecutionEngine* IEE_t() { - interceptor_IEE *iee = new interceptor_IEE(); - iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE(); + interceptor_IEE* iee = new interceptor_IEE(); + iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE(); return iee; } @@ -29,29 +26,29 @@ HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, } */ -LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes) +LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes) { - if(original_EEHeapAllocInProcessHeap == nullptr) + if (original_EEHeapAllocInProcessHeap == nullptr) __debugbreak(); return original_EEHeapAllocInProcessHeap(dwFlags, dwBytes); } -BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem) +BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem) { - if(original_EEHeapFreeInProcessHeap == nullptr) + if (original_EEHeapFreeInProcessHeap == nullptr) __debugbreak(); return original_EEHeapFreeInProcessHeap(dwFlags, lpMem); } -void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName) +void* GetCLRFunction(LPCSTR functionName) { - if(strcmp(functionName, "EEHeapAllocInProcessHeap")==0) + if (strcmp(functionName, "EEHeapAllocInProcessHeap") == 0) { original_EEHeapAllocInProcessHeap = (pfnEEHeapAllocInProcessHeap)original_CoreClrCallbacks->m_pfnGetCLRFunction("EEHeapAllocInProcessHeap"); return (void*)EEHeapAllocInProcessHeap; } - if(strcmp(functionName, "EEHeapFreeInProcessHeap")==0) + if (strcmp(functionName, "EEHeapFreeInProcessHeap") == 0) { original_EEHeapFreeInProcessHeap = (pfnEEHeapFreeInProcessHeap)original_CoreClrCallbacks->m_pfnGetCLRFunction("EEHeapFreeInProcessHeap"); @@ -59,4 +56,3 @@ void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName) } return original_CoreClrCallbacks->m_pfnGetCLRFunction(functionName); } - diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h index c8c3e27c66..a5257422cd 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h +++ b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h @@ -6,14 +6,8 @@ #ifndef _CoreClrCallbacks #define _CoreClrCallbacks -#include "runtimedetails.h" +#include "coreclrcommoncallbacks.h" -IExecutionEngine* STDMETHODCALLTYPE IEE_t(); -HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength); -LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes); -BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem); -void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName); +extern CoreClrCallbacks* original_CoreClrCallbacks; -extern CoreClrCallbacks *original_CoreClrCallbacks; - -#endif
\ No newline at end of file +#endif diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp index 2e088d438c..e0121c34e9 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp @@ -7,25 +7,25 @@ #include "icorjitcompiler.h" #include "icorjitinfo.h" -interceptor_IEEMM *current_IEEMM = nullptr; //we want this to live beyond the scope of a single compileMethodCall +interceptor_IEEMM* current_IEEMM = nullptr; // we want this to live beyond the scope of a single compileMethodCall -CorJitResult __stdcall interceptor_ICJC::compileMethod ( - ICorJitInfo *comp, /* IN */ - struct CORINFO_METHOD_INFO *info, /* IN */ - unsigned /* code:CorJitFlag */ flags, /* IN */ - BYTE **nativeEntry, /* OUT */ - ULONG *nativeSizeOfCode /* OUT */ - ) +CorJitResult __stdcall interceptor_ICJC::compileMethod(ICorJitInfo* comp, /* IN */ + struct CORINFO_METHOD_INFO* info, /* IN */ + unsigned /* code:CorJitFlag */ flags, /* IN */ + BYTE** nativeEntry, /* OUT */ + ULONG* nativeSizeOfCode /* OUT */ + ) { interceptor_ICJI our_ICorJitInfo; our_ICorJitInfo.original_ICorJitInfo = comp; - if(current_IEEMM == nullptr) - current_IEEMM = new interceptor_IEEMM(); + if (current_IEEMM == nullptr) + current_IEEMM = new interceptor_IEEMM(); our_ICorJitInfo.mcs = mcs; mcs->AddCall("compileMethod"); - CorJitResult temp = original_ICorJitCompiler->compileMethod(&our_ICorJitInfo, info, flags, nativeEntry, nativeSizeOfCode); + CorJitResult temp = + original_ICorJitCompiler->compileMethod(&our_ICorJitInfo, info, flags, nativeEntry, nativeSizeOfCode); mcs->SaveTextFile(); return temp; diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h index 1abcd0a77b..5ce4e6324f 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h +++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h @@ -17,10 +17,10 @@ class interceptor_ICJC : public ICorJitCompiler public: // Added to help us track the original icjc and be able to easily indirect to it. - ICorJitCompiler *original_ICorJitCompiler; - MethodCallSummarizer *mcs; + ICorJitCompiler* original_ICorJitCompiler; + MethodCallSummarizer* mcs; }; -extern interceptor_IEEMM *current_IEEMM; //we want this to live beyond the scope of a single compileMethodCall +extern interceptor_IEEMM* current_IEEMM; // we want this to live beyond the scope of a single compileMethodCall #endif diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp index 492d08908d..1d45229655 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp @@ -10,56 +10,52 @@ #include "icorjitcompiler.h" #include "spmiutil.h" -//Stuff on ICorStaticInfo +// Stuff on ICorStaticInfo /**********************************************************************************/ // // ICorMethodInfo // /**********************************************************************************/ // return flags (defined above, CORINFO_FLG_PUBLIC ...) -DWORD interceptor_ICJI::getMethodAttribs (CORINFO_METHOD_HANDLE ftn /* IN */) +DWORD interceptor_ICJI::getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */) { mcs->AddCall("getMethodAttribs"); return original_ICorJitInfo->getMethodAttribs(ftn); } // sets private JIT flags, which can be, retrieved using getAttrib. -void interceptor_ICJI::setMethodAttribs (CORINFO_METHOD_HANDLE ftn,/* IN */ - CorInfoMethodRuntimeFlags attribs/* IN */) +void interceptor_ICJI::setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */ + CorInfoMethodRuntimeFlags attribs /* IN */) { mcs->AddCall("setMethodAttribs"); original_ICorJitInfo->setMethodAttribs(ftn, attribs); } - // Given a method descriptor ftnHnd, extract signature information into sigInfo // // 'memberParent' is typically only set when verifying. It should be the // result of calling getMemberParent. -void interceptor_ICJI::getMethodSig ( - CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_SIG_INFO *sig, /* OUT */ - CORINFO_CLASS_HANDLE memberParent/* IN */ - ) +void interceptor_ICJI::getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */ + CORINFO_SIG_INFO* sig, /* OUT */ + CORINFO_CLASS_HANDLE memberParent /* IN */ + ) { mcs->AddCall("getMethodSig"); original_ICorJitInfo->getMethodSig(ftn, sig, memberParent); } +/********************************************************************* +* Note the following methods can only be used on functions known +* to be IL. This includes the method being compiled and any method +* that 'getMethodInfo' returns true for +*********************************************************************/ - /********************************************************************* - * Note the following methods can only be used on functions known - * to be IL. This includes the method being compiled and any method - * that 'getMethodInfo' returns true for - *********************************************************************/ - - // return information about a method private to the implementation - // returns false if method is not IL, or is otherwise unavailable. - // This method is used to fetch data needed to inline functions - bool interceptor_ICJI::getMethodInfo ( - CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_METHOD_INFO* info /* OUT */ - ) +// return information about a method private to the implementation +// returns false if method is not IL, or is otherwise unavailable. +// This method is used to fetch data needed to inline functions +bool interceptor_ICJI::getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */ + CORINFO_METHOD_INFO* info /* OUT */ + ) { mcs->AddCall("getMethodInfo"); return original_ICorJitInfo->getMethodInfo(ftn, info); @@ -74,11 +70,10 @@ void interceptor_ICJI::getMethodSig ( // // The inlined method need not be verified -CorInfoInline interceptor_ICJI::canInline ( - CORINFO_METHOD_HANDLE callerHnd, /* IN */ - CORINFO_METHOD_HANDLE calleeHnd, /* IN */ - DWORD* pRestrictions /* OUT */ - ) +CorInfoInline interceptor_ICJI::canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */ + CORINFO_METHOD_HANDLE calleeHnd, /* IN */ + DWORD* pRestrictions /* OUT */ + ) { mcs->AddCall("canInline"); return original_ICorJitInfo->canInline(callerHnd, calleeHnd, pRestrictions); @@ -87,25 +82,23 @@ CorInfoInline interceptor_ICJI::canInline ( // Reports whether or not a method can be inlined, and why. canInline is responsible for reporting all // inlining results when it returns INLINE_FAIL and INLINE_NEVER. All other results are reported by the // JIT. -void interceptor_ICJI::reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd, - CORINFO_METHOD_HANDLE inlineeHnd, - CorInfoInline inlineResult, - const char * reason) +void interceptor_ICJI::reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, + CORINFO_METHOD_HANDLE inlineeHnd, + CorInfoInline inlineResult, + const char* reason) { mcs->AddCall("reportInliningDecision"); original_ICorJitInfo->reportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, reason); } - // Returns false if the call is across security boundaries thus we cannot tailcall // // The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls) -bool interceptor_ICJI::canTailCall ( - CORINFO_METHOD_HANDLE callerHnd, /* IN */ - CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */ - CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */ - bool fIsTailPrefix /* IN */ - ) +bool interceptor_ICJI::canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */ + CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */ + CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */ + bool fIsTailPrefix /* IN */ + ) { mcs->AddCall("canTailCall"); return original_ICorJitInfo->canTailCall(callerHnd, declaredCalleeHnd, exactCalleeHnd, fIsTailPrefix); @@ -114,40 +107,35 @@ bool interceptor_ICJI::canTailCall ( // Reports whether or not a method can be tail called, and why. // canTailCall is responsible for reporting all results when it returns // false. All other results are reported by the JIT. -void interceptor_ICJI::reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd, - CORINFO_METHOD_HANDLE calleeHnd, - bool fIsTailPrefix, - CorInfoTailCall tailCallResult, - const char * reason) +void interceptor_ICJI::reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd, + CORINFO_METHOD_HANDLE calleeHnd, + bool fIsTailPrefix, + CorInfoTailCall tailCallResult, + const char* reason) { mcs->AddCall("reportTailCallDecision"); original_ICorJitInfo->reportTailCallDecision(callerHnd, calleeHnd, fIsTailPrefix, tailCallResult, reason); } // get individual exception handler -void interceptor_ICJI::getEHinfo( - CORINFO_METHOD_HANDLE ftn, /* IN */ - unsigned EHnumber, /* IN */ - CORINFO_EH_CLAUSE* clause /* OUT */ - ) +void interceptor_ICJI::getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */ + unsigned EHnumber, /* IN */ + CORINFO_EH_CLAUSE* clause /* OUT */ + ) { mcs->AddCall("getEHinfo"); original_ICorJitInfo->getEHinfo(ftn, EHnumber, clause); } // return class it belongs to -CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass ( - CORINFO_METHOD_HANDLE method - ) +CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass(CORINFO_METHOD_HANDLE method) { mcs->AddCall("getMethodClass"); return original_ICorJitInfo->getMethodClass(method); } // return module it belongs to -CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule ( - CORINFO_METHOD_HANDLE method - ) +CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule(CORINFO_METHOD_HANDLE method) { mcs->AddCall("getMethodModule"); return original_ICorJitInfo->getMethodModule(method); @@ -155,11 +143,10 @@ CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule ( // This function returns the offset of the specified method in the // vtable of it's owning class or interface. -void interceptor_ICJI::getMethodVTableOffset ( - CORINFO_METHOD_HANDLE method, /* IN */ - unsigned* offsetOfIndirection, /* OUT */ - unsigned* offsetAfterIndirection /* OUT */ - ) +void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */ + unsigned* offsetOfIndirection, /* OUT */ + unsigned* offsetAfterIndirection /* OUT */ + ) { mcs->AddCall("getMethodVTableOffset"); original_ICorJitInfo->getMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection); @@ -167,11 +154,9 @@ void interceptor_ICJI::getMethodVTableOffset ( // Find the virtual method in implementingClass that overrides virtualMethod. // Return null if devirtualization is not possible. -CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod( - CORINFO_METHOD_HANDLE virtualMethod, - CORINFO_CLASS_HANDLE implementingClass, - CORINFO_CONTEXT_HANDLE ownerType - ) +CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod, + CORINFO_CLASS_HANDLE implementingClass, + CORINFO_CONTEXT_HANDLE ownerType) { mcs->AddCall("resolveVirtualMethod"); return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType); @@ -179,28 +164,22 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod( // If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set, // getIntrinsicID() returns the intrinsic ID. -CorInfoIntrinsics interceptor_ICJI::getIntrinsicID( - CORINFO_METHOD_HANDLE method, - bool* pMustExpand /* OUT */ - ) +CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */ + ) { mcs->AddCall("getIntrinsicID"); return original_ICorJitInfo->getIntrinsicID(method, pMustExpand); } // Is the given module the System.Numerics.Vectors module? -bool interceptor_ICJI::isInSIMDModule( - CORINFO_CLASS_HANDLE classHnd - ) +bool interceptor_ICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd) { mcs->AddCall("isInSIMDModule"); return original_ICorJitInfo->isInSIMDModule(classHnd); } // return the unmanaged calling convention for a PInvoke -CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv( - CORINFO_METHOD_HANDLE method - ) +CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method) { mcs->AddCall("getUnmanagedCallConv"); return original_ICorJitInfo->getUnmanagedCallConv(method); @@ -208,10 +187,7 @@ CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv( // return if any marshaling is required for PInvoke methods. Note that // method == 0 => calli. The call site sig is only needed for the varargs or calli case -BOOL interceptor_ICJI::pInvokeMarshalingRequired( - CORINFO_METHOD_HANDLE method, - CORINFO_SIG_INFO* callSiteSig - ) +BOOL interceptor_ICJI::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig) { mcs->AddCall("pInvokeMarshalingRequired"); return original_ICorJitInfo->pInvokeMarshalingRequired(method, callSiteSig); @@ -219,10 +195,8 @@ BOOL interceptor_ICJI::pInvokeMarshalingRequired( // Check constraints on method type arguments (only). // The parent class should be checked separately using satisfiesClassConstraints(parent). -BOOL interceptor_ICJI::satisfiesMethodConstraints( - CORINFO_CLASS_HANDLE parent, // the exact parent of the method - CORINFO_METHOD_HANDLE method - ) +BOOL interceptor_ICJI::satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method + CORINFO_METHOD_HANDLE method) { mcs->AddCall("satisfiesMethodConstraints"); return original_ICorJitInfo->satisfiesMethodConstraints(parent, method); @@ -232,33 +206,29 @@ BOOL interceptor_ICJI::satisfiesMethodConstraints( // a delegate class, check if the method signature is compatible with the Invoke method of the delegate // (under the typical instantiation of any free type variables in the memberref signatures). BOOL interceptor_ICJI::isCompatibleDelegate( - CORINFO_CLASS_HANDLE objCls, /* type of the delegate target, if any */ - CORINFO_CLASS_HANDLE methodParentCls, /* exact parent of the target method, if any */ - CORINFO_METHOD_HANDLE method, /* (representative) target method, if any */ - CORINFO_CLASS_HANDLE delegateCls, /* exact type of the delegate */ - BOOL *pfIsOpenDelegate /* is the delegate open */ - ) + CORINFO_CLASS_HANDLE objCls, /* type of the delegate target, if any */ + CORINFO_CLASS_HANDLE methodParentCls, /* exact parent of the target method, if any */ + CORINFO_METHOD_HANDLE method, /* (representative) target method, if any */ + CORINFO_CLASS_HANDLE delegateCls, /* exact type of the delegate */ + BOOL* pfIsOpenDelegate /* is the delegate open */ + ) { mcs->AddCall("isCompatibleDelegate"); return original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate); } // Determines whether the delegate creation obeys security transparency rules -BOOL interceptor_ICJI::isDelegateCreationAllowed ( - CORINFO_CLASS_HANDLE delegateHnd, - CORINFO_METHOD_HANDLE calleeHnd - ) +BOOL interceptor_ICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd) { mcs->AddCall("isDelegateCreationAllowed"); return original_ICorJitInfo->isDelegateCreationAllowed(delegateHnd, calleeHnd); } - // Indicates if the method is an instance of the generic // method that passes (or has passed) verification -CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric ( - CORINFO_METHOD_HANDLE method /* IN */ - ) +CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN + */ + ) { mcs->AddCall("isInstantiationOfVerifiedGeneric"); return original_ICorJitInfo->isInstantiationOfVerifiedGeneric(method); @@ -266,38 +236,32 @@ CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGene // Loads the constraints on a typical method definition, detecting cycles; // for use in verification. -void interceptor_ICJI::initConstraintsForVerification( - CORINFO_METHOD_HANDLE method, /* IN */ - BOOL *pfHasCircularClassConstraints, /* OUT */ - BOOL *pfHasCircularMethodConstraint /* OUT */ - ) +void interceptor_ICJI::initConstraintsForVerification(CORINFO_METHOD_HANDLE method, /* IN */ + BOOL* pfHasCircularClassConstraints, /* OUT */ + BOOL* pfHasCircularMethodConstraint /* OUT */ + ) { mcs->AddCall("initConstraintsForVerification"); - original_ICorJitInfo->initConstraintsForVerification(method, pfHasCircularClassConstraints, pfHasCircularMethodConstraint); + original_ICorJitInfo->initConstraintsForVerification(method, pfHasCircularClassConstraints, + pfHasCircularMethodConstraint); } // Returns enum whether the method does not require verification // Also see ICorModuleInfo::canSkipVerification -CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification ( - CORINFO_METHOD_HANDLE ftnHandle - ) +CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle) { mcs->AddCall("canSkipMethodVerification"); return original_ICorJitInfo->canSkipMethodVerification(ftnHandle); } // load and restore the method -void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun( - CORINFO_METHOD_HANDLE method - ) +void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method) { mcs->AddCall("methodMustBeLoadedBeforeCodeIsRun"); original_ICorJitInfo->methodMustBeLoadedBeforeCodeIsRun(method); } -CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl( - CORINFO_METHOD_HANDLE method - ) +CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method) { mcs->AddCall("mapMethodDeclToMethodImpl"); return original_ICorJitInfo->mapMethodDeclToMethodImpl(method); @@ -305,10 +269,9 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl( // Returns the global cookie for the /GS unsafe buffer checks // The cookie might be a constant value (JIT), or a handle to memory location (Ngen) -void interceptor_ICJI::getGSCookie( - GSCookie * pCookieVal, // OUT - GSCookie ** ppCookieVal // OUT - ) +void interceptor_ICJI::getGSCookie(GSCookie* pCookieVal, // OUT + GSCookie** ppCookieVal // OUT + ) { mcs->AddCall("getGSCookie"); original_ICorJitInfo->getGSCookie(pCookieVal, ppCookieVal); @@ -321,25 +284,24 @@ void interceptor_ICJI::getGSCookie( /**********************************************************************************/ // Resolve metadata token into runtime method handles. -void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) +void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken) { mcs->AddCall("resolveToken"); original_ICorJitInfo->resolveToken(pResolvedToken); } -bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) +bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken) { mcs->AddCall("tryResolveToken"); return original_ICorJitInfo->tryResolveToken(pResolvedToken); } // Signature information about the call sig -void interceptor_ICJI::findSig ( - CORINFO_MODULE_HANDLE module, /* IN */ - unsigned sigTOK, /* IN */ - CORINFO_CONTEXT_HANDLE context, /* IN */ - CORINFO_SIG_INFO *sig /* OUT */ - ) +void interceptor_ICJI::findSig(CORINFO_MODULE_HANDLE module, /* IN */ + unsigned sigTOK, /* IN */ + CORINFO_CONTEXT_HANDLE context, /* IN */ + CORINFO_SIG_INFO* sig /* OUT */ + ) { mcs->AddCall("findSig"); original_ICorJitInfo->findSig(module, sigTOK, context, sig); @@ -348,19 +310,17 @@ void interceptor_ICJI::findSig ( // for Varargs, the signature at the call site may differ from // the signature at the definition. Thus we need a way of // fetching the call site information -void interceptor_ICJI::findCallSiteSig ( - CORINFO_MODULE_HANDLE module, /* IN */ - unsigned methTOK, /* IN */ - CORINFO_CONTEXT_HANDLE context, /* IN */ - CORINFO_SIG_INFO *sig /* OUT */ - ) +void interceptor_ICJI::findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */ + unsigned methTOK, /* IN */ + CORINFO_CONTEXT_HANDLE context, /* IN */ + CORINFO_SIG_INFO* sig /* OUT */ + ) { mcs->AddCall("findCallSiteSig"); original_ICorJitInfo->findCallSiteSig(module, methTOK, context, sig); } -CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle ( - CORINFO_RESOLVED_TOKEN * pResolvedToken /* IN */) +CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */) { mcs->AddCall("getTokenTypeAsHandle"); return original_ICorJitInfo->getTokenTypeAsHandle(pResolvedToken); @@ -377,37 +337,32 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle ( // Returns enum whether the module does not require verification // Also see ICorMethodInfo::canSkipMethodVerification(); -CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipVerification ( - CORINFO_MODULE_HANDLE module /* IN */ - ) +CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipVerification(CORINFO_MODULE_HANDLE module /* IN */ + ) { mcs->AddCall("canSkipVerification"); return original_ICorJitInfo->canSkipVerification(module); } // Checks if the given metadata token is valid -BOOL interceptor_ICJI::isValidToken ( - CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK /* IN */ - ) +BOOL interceptor_ICJI::isValidToken(CORINFO_MODULE_HANDLE module, /* IN */ + unsigned metaTOK /* IN */ + ) { mcs->AddCall("isValidToken"); return original_ICorJitInfo->isValidToken(module, metaTOK); } // Checks if the given metadata token is valid StringRef -BOOL interceptor_ICJI::isValidStringRef ( - CORINFO_MODULE_HANDLE module, /* IN */ - unsigned metaTOK /* IN */ - ) +BOOL interceptor_ICJI::isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */ + unsigned metaTOK /* IN */ + ) { mcs->AddCall("isValidStringRef"); return original_ICorJitInfo->isValidStringRef(module, metaTOK); } -BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction( - CORINFO_MODULE_HANDLE scope - ) +BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope) { mcs->AddCall("shouldEnforceCallvirtRestriction"); return original_ICorJitInfo->shouldEnforceCallvirtRestriction(scope); @@ -421,43 +376,37 @@ BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction( // If the value class 'cls' is isomorphic to a primitive type it will // return that type, otherwise it will return CORINFO_TYPE_VALUECLASS -CorInfoType interceptor_ICJI::asCorInfoType ( - CORINFO_CLASS_HANDLE cls - ) +CorInfoType interceptor_ICJI::asCorInfoType(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("asCorInfoType"); return original_ICorJitInfo->asCorInfoType(cls); } // for completeness -const char* interceptor_ICJI::getClassName ( - CORINFO_CLASS_HANDLE cls - ) +const char* interceptor_ICJI::getClassName(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getClassName"); return original_ICorJitInfo->getClassName(cls); } - // Append a (possibly truncated) representation of the type cls to the preallocated buffer ppBuf of length pnBufLen // If fNamespace=TRUE, include the namespace/enclosing classes // If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters // If fAssembly=TRUE, suffix with a comma and the full assembly qualification // return size of representation -int interceptor_ICJI::appendClassName( - __deref_inout_ecount(*pnBufLen) WCHAR** ppBuf, - int* pnBufLen, - CORINFO_CLASS_HANDLE cls, - BOOL fNamespace, - BOOL fFullInst, - BOOL fAssembly - ) +int interceptor_ICJI::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf, + int* pnBufLen, + CORINFO_CLASS_HANDLE cls, + BOOL fNamespace, + BOOL fFullInst, + BOOL fAssembly) { mcs->AddCall("appendClassName"); return original_ICorJitInfo->appendClassName(ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly); } -// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & CORINFO_FLG_VALUECLASS, except faster. +// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & +// CORINFO_FLG_VALUECLASS, except faster. BOOL interceptor_ICJI::isValueClass(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("isValueClass"); @@ -473,9 +422,7 @@ BOOL interceptor_ICJI::canInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE c } // return flags (defined above, CORINFO_FLG_PUBLIC ...) -DWORD interceptor_ICJI::getClassAttribs ( - CORINFO_CLASS_HANDLE cls - ) +DWORD interceptor_ICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getClassAttribs"); return original_ICorJitInfo->getClassAttribs(cls); @@ -493,27 +440,21 @@ BOOL interceptor_ICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cl return original_ICorJitInfo->isStructRequiringStackAllocRetBuf(cls); } -CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule ( - CORINFO_CLASS_HANDLE cls - ) +CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getClassModule"); return original_ICorJitInfo->getClassModule(cls); } // Returns the assembly that contains the module "mod". -CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly ( - CORINFO_MODULE_HANDLE mod - ) +CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly(CORINFO_MODULE_HANDLE mod) { mcs->AddCall("getModuleAssembly"); return original_ICorJitInfo->getModuleAssembly(mod); } // Returns the name of the assembly "assem". -const char* interceptor_ICJI::getAssemblyName ( - CORINFO_ASSEMBLY_HANDLE assem - ) +const char* interceptor_ICJI::getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem) { mcs->AddCall("getAssemblyName"); return original_ICorJitInfo->getAssemblyName(assem); @@ -535,29 +476,22 @@ void interceptor_ICJI::LongLifetimeFree(void* obj) original_ICorJitInfo->LongLifetimeFree(obj); } -size_t interceptor_ICJI::getClassModuleIdForStatics ( - CORINFO_CLASS_HANDLE cls, - CORINFO_MODULE_HANDLE *pModule, - void **ppIndirection - ) +size_t interceptor_ICJI::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, + CORINFO_MODULE_HANDLE* pModule, + void** ppIndirection) { mcs->AddCall("getClassModuleIdForStatics"); return original_ICorJitInfo->getClassModuleIdForStatics(cls, pModule, ppIndirection); } // return the number of bytes needed by an instance of the class -unsigned interceptor_ICJI::getClassSize ( - CORINFO_CLASS_HANDLE cls - ) +unsigned interceptor_ICJI::getClassSize(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getClassSize"); return original_ICorJitInfo->getClassSize(cls); } -unsigned interceptor_ICJI::getClassAlignmentRequirement ( - CORINFO_CLASS_HANDLE cls, - BOOL fDoubleAlignHint - ) +unsigned interceptor_ICJI::getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint) { mcs->AddCall("getClassAlignmentRequirement"); return original_ICorJitInfo->getClassAlignmentRequirement(cls, fDoubleAlignHint); @@ -572,84 +506,64 @@ unsigned interceptor_ICJI::getClassAlignmentRequirement ( // to one of the CorInfoGCType values which is the GC type of // the i-th machine word of an object of type 'cls' // returns the number of GC pointers in the array -unsigned interceptor_ICJI::getClassGClayout ( - CORINFO_CLASS_HANDLE cls, /* IN */ - BYTE *gcPtrs /* OUT */ - ) +unsigned interceptor_ICJI::getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */ + BYTE* gcPtrs /* OUT */ + ) { mcs->AddCall("getClassGClayout"); return original_ICorJitInfo->getClassGClayout(cls, gcPtrs); } // returns the number of instance fields in a class -unsigned interceptor_ICJI::getClassNumInstanceFields ( - CORINFO_CLASS_HANDLE cls /* IN */ - ) +unsigned interceptor_ICJI::getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */ + ) { mcs->AddCall("getClassNumInstanceFields"); return original_ICorJitInfo->getClassNumInstanceFields(cls); } -CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass( - CORINFO_CLASS_HANDLE clsHnd, - INT num - ) +CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num) { mcs->AddCall("getFieldInClass"); return original_ICorJitInfo->getFieldInClass(clsHnd, num); } -BOOL interceptor_ICJI::checkMethodModifier( - CORINFO_METHOD_HANDLE hMethod, - LPCSTR modifier, - BOOL fOptional - ) +BOOL interceptor_ICJI::checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional) { mcs->AddCall("checkMethodModifier"); return original_ICorJitInfo->checkMethodModifier(hMethod, modifier, fOptional); } // returns the "NEW" helper optimized for "newCls." -CorInfoHelpFunc interceptor_ICJI::getNewHelper( - CORINFO_RESOLVED_TOKEN * pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle - ) +CorInfoHelpFunc interceptor_ICJI::getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, + CORINFO_METHOD_HANDLE callerHandle) { mcs->AddCall("getNewHelper"); return original_ICorJitInfo->getNewHelper(pResolvedToken, callerHandle); } // returns the newArr (1-Dim array) helper optimized for "arrayCls." -CorInfoHelpFunc interceptor_ICJI::getNewArrHelper( - CORINFO_CLASS_HANDLE arrayCls - ) +CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls) { mcs->AddCall("getNewArrHelper"); return original_ICorJitInfo->getNewArrHelper(arrayCls); } // returns the optimized "IsInstanceOf" or "ChkCast" helper -CorInfoHelpFunc interceptor_ICJI::getCastingHelper( - CORINFO_RESOLVED_TOKEN * pResolvedToken, - bool fThrowing - ) +CorInfoHelpFunc interceptor_ICJI::getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing) { mcs->AddCall("getCastingHelper"); return original_ICorJitInfo->getCastingHelper(pResolvedToken, fThrowing); } // returns helper to trigger static constructor -CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper( - CORINFO_CLASS_HANDLE clsHnd - ) +CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd) { mcs->AddCall("getSharedCCtorHelper"); return original_ICorJitInfo->getSharedCCtorHelper(clsHnd); } -CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper( - CORINFO_METHOD_HANDLE ftn - ) +CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(CORINFO_METHOD_HANDLE ftn) { mcs->AddCall("getSecurityPrologHelper"); return original_ICorJitInfo->getSecurityPrologHelper(ftn); @@ -659,9 +573,7 @@ CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper( // a boxed<T> not a boxed Nullable<T>. This call allows the verifier // to call back to the EE on the 'box' instruction and get the transformed // type to use for verification. -CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox( - CORINFO_CLASS_HANDLE cls - ) +CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getTypeForBox"); return original_ICorJitInfo->getTypeForBox(cls); @@ -670,9 +582,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox( // returns the correct box helper for a particular class. Note // that if this returns CORINFO_HELP_BOX, the JIT can assume // 'standard' boxing (allocate object and copy), and optimize -CorInfoHelpFunc interceptor_ICJI::getBoxHelper( - CORINFO_CLASS_HANDLE cls - ) +CorInfoHelpFunc interceptor_ICJI::getBoxHelper(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getBoxHelper"); return original_ICorJitInfo->getBoxHelper(cls); @@ -690,38 +600,30 @@ CorInfoHelpFunc interceptor_ICJI::getBoxHelper( // The EE set 'helperCopies' on return to indicate what kind of // helper has been created. -CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper( - CORINFO_CLASS_HANDLE cls - ) +CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getUnBoxHelper"); return original_ICorJitInfo->getUnBoxHelper(cls); } -bool interceptor_ICJI::getReadyToRunHelper( - CORINFO_RESOLVED_TOKEN * pResolvedToken, - CORINFO_LOOKUP_KIND * pGenericLookupKind, - CorInfoHelpFunc id, - CORINFO_CONST_LOOKUP * pLookup - ) +bool interceptor_ICJI::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, + CORINFO_LOOKUP_KIND* pGenericLookupKind, + CorInfoHelpFunc id, + CORINFO_CONST_LOOKUP* pLookup) { mcs->AddCall("getReadyToRunHelper"); return original_ICorJitInfo->getReadyToRunHelper(pResolvedToken, pGenericLookupKind, id, pLookup); } -void interceptor_ICJI::getReadyToRunDelegateCtorHelper( - CORINFO_RESOLVED_TOKEN * pTargetMethod, - CORINFO_CLASS_HANDLE delegateType, - CORINFO_LOOKUP * pLookup - ) +void interceptor_ICJI::getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, + CORINFO_CLASS_HANDLE delegateType, + CORINFO_LOOKUP* pLookup) { mcs->AddCall("getReadyToRunDelegateCtorHelper"); original_ICorJitInfo->getReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup); } -const char* interceptor_ICJI::getHelperName( - CorInfoHelpFunc funcNum - ) +const char* interceptor_ICJI::getHelperName(CorInfoHelpFunc funcNum) { mcs->AddCall("getHelperName"); return original_ICorJitInfo->getHelperName(funcNum); @@ -733,12 +635,12 @@ const char* interceptor_ICJI::getHelperName( // // See code:ICorClassInfo#ClassConstruction. CorInfoInitClassResult interceptor_ICJI::initClass( - CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access - // nullptr - inquire about cctor trigger in method prolog - CORINFO_METHOD_HANDLE method, // Method referencing the field or prolog - CORINFO_CONTEXT_HANDLE context, // Exact context of method - BOOL speculative // TRUE means don't actually run it - ) + CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access + // nullptr - inquire about cctor trigger in method prolog + CORINFO_METHOD_HANDLE method, // Method referencing the field or prolog + CORINFO_CONTEXT_HANDLE context, // Exact context of method + BOOL speculative // TRUE means don't actually run it + ) { mcs->AddCall("initClass"); return original_ICorJitInfo->initClass(field, method, context, speculative); @@ -754,27 +656,21 @@ CorInfoInitClassResult interceptor_ICJI::initClass( // This is typically used to ensure value types are loaded before zapped // code that manipulates them is executed, so that the GC can access information // about those value types. -void interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun( - CORINFO_CLASS_HANDLE cls - ) +void interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("classMustBeLoadedBeforeCodeIsRun"); original_ICorJitInfo->classMustBeLoadedBeforeCodeIsRun(cls); } // returns the class handle for the special builtin classes -CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass ( - CorInfoClassId classId - ) +CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass(CorInfoClassId classId) { mcs->AddCall("getBuiltinClass"); return original_ICorJitInfo->getBuiltinClass(classId); } // "System.Int32" ==> CORINFO_TYPE_INT.. -CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass( - CORINFO_CLASS_HANDLE cls - ) +CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getTypeForPrimitiveValueClass"); return original_ICorJitInfo->getTypeForPrimitiveValueClass(cls); @@ -782,30 +678,23 @@ CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass( // TRUE if child is a subtype of parent // if parent is an interface, then does child implement / extend parent -BOOL interceptor_ICJI::canCast( - CORINFO_CLASS_HANDLE child, // subtype (extends parent) - CORINFO_CLASS_HANDLE parent // base type - ) +BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent) + CORINFO_CLASS_HANDLE parent // base type + ) { mcs->AddCall("canCast"); return original_ICorJitInfo->canCast(child, parent); } // TRUE if cls1 and cls2 are considered equivalent types. -BOOL interceptor_ICJI::areTypesEquivalent( - CORINFO_CLASS_HANDLE cls1, - CORINFO_CLASS_HANDLE cls2 - ) +BOOL interceptor_ICJI::areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) { mcs->AddCall("areTypesEquivalent"); return original_ICorJitInfo->areTypesEquivalent(cls1, cls2); } // returns is the intersection of cls1 and cls2. -CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses( - CORINFO_CLASS_HANDLE cls1, - CORINFO_CLASS_HANDLE cls2 - ) +CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2) { mcs->AddCall("mergeClasses"); return original_ICorJitInfo->mergeClasses(cls1, cls2); @@ -814,9 +703,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses( // Given a class handle, returns the Parent type. // For COMObjectType, it returns Class Handle of System.Object. // Returns 0 if System.Object is passed in. -CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType ( - CORINFO_CLASS_HANDLE cls - ) +CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getParentType"); return original_ICorJitInfo->getParentType(cls); @@ -826,47 +713,35 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType ( // not a primitive type, *clsRet will be set. // Given an Array of Type Foo, returns Foo. // Given BYREF Foo, returns Foo -CorInfoType interceptor_ICJI::getChildType ( - CORINFO_CLASS_HANDLE clsHnd, - CORINFO_CLASS_HANDLE *clsRet - ) +CorInfoType interceptor_ICJI::getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet) { mcs->AddCall("getChildType"); return original_ICorJitInfo->getChildType(clsHnd, clsRet); } // Check constraints on type arguments of this class and parent classes -BOOL interceptor_ICJI::satisfiesClassConstraints( - CORINFO_CLASS_HANDLE cls - ) +BOOL interceptor_ICJI::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("satisfiesClassConstraints"); return original_ICorJitInfo->satisfiesClassConstraints(cls); } // Check if this is a single dimensional array type -BOOL interceptor_ICJI::isSDArray( - CORINFO_CLASS_HANDLE cls - ) +BOOL interceptor_ICJI::isSDArray(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("isSDArray"); return original_ICorJitInfo->isSDArray(cls); } // Get the numbmer of dimensions in an array -unsigned interceptor_ICJI::getArrayRank( - CORINFO_CLASS_HANDLE cls - ) +unsigned interceptor_ICJI::getArrayRank(CORINFO_CLASS_HANDLE cls) { mcs->AddCall("getArrayRank"); return original_ICorJitInfo->getArrayRank(cls); } // Get static field data for an array -void * interceptor_ICJI::getArrayInitializationData( - CORINFO_FIELD_HANDLE field, - DWORD size - ) +void* interceptor_ICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size) { mcs->AddCall("getArrayInitializationData"); return original_ICorJitInfo->getArrayInitializationData(field, size); @@ -874,11 +749,11 @@ void * interceptor_ICJI::getArrayInitializationData( // Check Visibility rules. CorInfoIsAccessAllowedResult interceptor_ICJI::canAccessClass( - CORINFO_RESOLVED_TOKEN * pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - CORINFO_HELPER_DESC *pAccessHelper /* If canAccessMethod returns something other - than ALLOWED, then this is filled in. */ - ) + CORINFO_RESOLVED_TOKEN* pResolvedToken, + CORINFO_METHOD_HANDLE callerHandle, + CORINFO_HELPER_DESC* pAccessHelper /* If canAccessMethod returns something other + than ALLOWED, then this is filled in. */ + ) { mcs->AddCall("canAccessClass"); return original_ICorJitInfo->canAccessClass(pResolvedToken, callerHandle, pAccessHelper); @@ -893,19 +768,16 @@ CorInfoIsAccessAllowedResult interceptor_ICJI::canAccessClass( // this function is for debugging only. It returns the field name // and if 'moduleName' is non-null, it sets it to something that will // says which method (a class name, or a module name) -const char* interceptor_ICJI::getFieldName ( - CORINFO_FIELD_HANDLE ftn, /* IN */ - const char **moduleName /* OUT */ - ) +const char* interceptor_ICJI::getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */ + const char** moduleName /* OUT */ + ) { mcs->AddCall("getFieldName"); return original_ICorJitInfo->getFieldName(ftn, moduleName); } // return class it belongs to -CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass ( - CORINFO_FIELD_HANDLE field - ) +CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass(CORINFO_FIELD_HANDLE field) { mcs->AddCall("getFieldClass"); return original_ICorJitInfo->getFieldClass(field); @@ -917,20 +789,17 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass ( // // 'memberParent' is typically only set when verifying. It should be the // result of calling getMemberParent. -CorInfoType interceptor_ICJI::getFieldType( - CORINFO_FIELD_HANDLE field, - CORINFO_CLASS_HANDLE *structType, - CORINFO_CLASS_HANDLE memberParent/* IN */ - ) +CorInfoType interceptor_ICJI::getFieldType(CORINFO_FIELD_HANDLE field, + CORINFO_CLASS_HANDLE* structType, + CORINFO_CLASS_HANDLE memberParent /* IN */ + ) { mcs->AddCall("getFieldType"); return original_ICorJitInfo->getFieldType(field, structType, memberParent); } // return the data member's instance offset -unsigned interceptor_ICJI::getFieldOffset( - CORINFO_FIELD_HANDLE field - ) +unsigned interceptor_ICJI::getFieldOffset(CORINFO_FIELD_HANDLE field) { mcs->AddCall("getFieldOffset"); return original_ICorJitInfo->getFieldOffset(field); @@ -939,18 +808,16 @@ unsigned interceptor_ICJI::getFieldOffset( // TODO: jit64 should be switched to the same plan as the i386 jits - use // getClassGClayout to figure out the need for writebarrier helper, and inline the copying. // The interpretted value class copy is slow. Once this happens, USE_WRITE_BARRIER_HELPERS -bool interceptor_ICJI::isWriteBarrierHelperRequired( - CORINFO_FIELD_HANDLE field) +bool interceptor_ICJI::isWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field) { mcs->AddCall("isWriteBarrierHelperRequired"); return original_ICorJitInfo->isWriteBarrierHelperRequired(field); } -void interceptor_ICJI::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, - CORINFO_METHOD_HANDLE callerHandle, - CORINFO_ACCESS_FLAGS flags, - CORINFO_FIELD_INFO *pResult - ) +void interceptor_ICJI::getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken, + CORINFO_METHOD_HANDLE callerHandle, + CORINFO_ACCESS_FLAGS flags, + CORINFO_FIELD_INFO* pResult) { mcs->AddCall("getFieldInfo"); original_ICorJitInfo->getFieldInfo(pResolvedToken, callerHandle, flags, pResult); @@ -976,13 +843,13 @@ bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd) // Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will // be used only as a hint and the native compiler should not change its // code generation. -void interceptor_ICJI::getBoundaries( - CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - unsigned int *cILOffsets, // [OUT] size of pILOffsets - DWORD **pILOffsets, // [OUT] IL offsets of interest - // jit MUST free with freeArray! - ICorDebugInfo::BoundaryTypes *implictBoundaries // [OUT] tell jit, all boundries of this type - ) +void interceptor_ICJI::getBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest + unsigned int* cILOffsets, // [OUT] size of pILOffsets + DWORD** pILOffsets, // [OUT] IL offsets of interest + // jit MUST free with freeArray! + ICorDebugInfo::BoundaryTypes* implictBoundaries // [OUT] tell jit, all boundries of + // this type + ) { mcs->AddCall("getBoundaries"); original_ICorJitInfo->getBoundaries(ftn, cILOffsets, pILOffsets, implictBoundaries); @@ -995,12 +862,12 @@ void interceptor_ICJI::getBoundaries( // Note that debugger (and profiler) is assuming that all of the // offsets form a contiguous block of memory, and that the // OffsetMapping is sorted in order of increasing native offset. -void interceptor_ICJI::setBoundaries( - CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 cMap, // [IN] size of pMap - ICorDebugInfo::OffsetMapping *pMap // [IN] map including all points of interest. - // jit allocated with allocateArray, EE frees - ) +void interceptor_ICJI::setBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest + ULONG32 cMap, // [IN] size of pMap + ICorDebugInfo::OffsetMapping* pMap // [IN] map including all points of interest. + // jit allocated with allocateArray, EE + // frees + ) { mcs->AddCall("setBoundaries"); original_ICorJitInfo->setBoundaries(ftn, cMap, pMap); @@ -1014,14 +881,13 @@ void interceptor_ICJI::setBoundaries( // Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will // be used only as a hint and the native compiler should not change its // code generation. -void interceptor_ICJI::getVars( - CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 *cVars, // [OUT] size of 'vars' - ICorDebugInfo::ILVarInfo **vars, // [OUT] scopes of variables of interest - // jit MUST free with freeArray! - bool *extendOthers // [OUT] it TRUE, then assume the scope - // of unmentioned vars is entire method - ) +void interceptor_ICJI::getVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest + ULONG32* cVars, // [OUT] size of 'vars' + ICorDebugInfo::ILVarInfo** vars, // [OUT] scopes of variables of interest + // jit MUST free with freeArray! + bool* extendOthers // [OUT] it TRUE, then assume the scope + // of unmentioned vars is entire method + ) { mcs->AddCall("getVars"); original_ICorJitInfo->getVars(ftn, cVars, vars, extendOthers); @@ -1031,12 +897,12 @@ void interceptor_ICJI::getVars( // note that the JIT might split lifetimes into different // locations etc. -void interceptor_ICJI::setVars( - CORINFO_METHOD_HANDLE ftn, // [IN] method of interest - ULONG32 cVars, // [IN] size of 'vars' - ICorDebugInfo::NativeVarInfo *vars // [IN] map telling where local vars are stored at what points - // jit allocated with allocateArray, EE frees - ) +void interceptor_ICJI::setVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest + ULONG32 cVars, // [IN] size of 'vars' + ICorDebugInfo::NativeVarInfo* vars // [IN] map telling where local vars are stored at + // what points + // jit allocated with allocateArray, EE frees + ) { mcs->AddCall("setVars"); original_ICorJitInfo->setVars(ftn, cVars, vars); @@ -1047,9 +913,7 @@ void interceptor_ICJI::setVars( // Used to allocate memory that needs to handed to the EE. // For eg, use this to allocated memory for reporting debug info, // which will be handed to the EE by setVars() and setBoundaries() -void * interceptor_ICJI::allocateArray( - ULONG cBytes - ) +void* interceptor_ICJI::allocateArray(ULONG cBytes) { mcs->AddCall("allocateArray"); return original_ICorJitInfo->allocateArray(cBytes); @@ -1059,9 +923,7 @@ void * interceptor_ICJI::allocateArray( // For eg, The EE returns memory in getVars() and getBoundaries() // to the JitCompiler, which the JitCompiler should release using // freeArray() -void interceptor_ICJI::freeArray( - void *array - ) +void interceptor_ICJI::freeArray(void* array) { mcs->AddCall("freeArray"); original_ICorJitInfo->freeArray(array); @@ -1075,9 +937,8 @@ void interceptor_ICJI::freeArray( // advance the pointer to the argument list. // a ptr of 0, is special and always means the first argument -CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext ( - CORINFO_ARG_LIST_HANDLE args /* IN */ - ) +CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */ + ) { mcs->AddCall("getArgNext"); return original_ICorJitInfo->getArgNext(args); @@ -1092,30 +953,26 @@ CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext ( // The return value is the type that is used for calling convention purposes // (Thus if the EE wants a value class to be passed like an int, then it will // return CORINFO_TYPE_INT -CorInfoTypeWithMod interceptor_ICJI::getArgType ( - CORINFO_SIG_INFO* sig, /* IN */ - CORINFO_ARG_LIST_HANDLE args, /* IN */ - CORINFO_CLASS_HANDLE *vcTypeRet /* OUT */ - ) +CorInfoTypeWithMod interceptor_ICJI::getArgType(CORINFO_SIG_INFO* sig, /* IN */ + CORINFO_ARG_LIST_HANDLE args, /* IN */ + CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */ + ) { mcs->AddCall("getArgType"); return original_ICorJitInfo->getArgType(sig, args, vcTypeRet); } // If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it -CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass ( - CORINFO_SIG_INFO* sig, /* IN */ - CORINFO_ARG_LIST_HANDLE args /* IN */ - ) +CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass(CORINFO_SIG_INFO* sig, /* IN */ + CORINFO_ARG_LIST_HANDLE args /* IN */ + ) { mcs->AddCall("getArgClass"); return original_ICorJitInfo->getArgClass(sig, args); } // Returns type of HFA for valuetype -CorInfoType interceptor_ICJI::getHFAType ( - CORINFO_CLASS_HANDLE hClass - ) +CorInfoType interceptor_ICJI::getHFAType(CORINFO_CLASS_HANDLE hClass) { mcs->AddCall("getHFAType"); return original_ICorJitInfo->getHFAType(hClass); @@ -1128,9 +985,7 @@ CorInfoType interceptor_ICJI::getHFAType ( *****************************************************************************/ // Returns the HRESULT of the current exception -HRESULT interceptor_ICJI::GetErrorHRESULT( - struct _EXCEPTION_POINTERS *pExceptionPointers - ) +HRESULT interceptor_ICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers) { mcs->AddCall("GetErrorHRESULT"); return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers); @@ -1139,10 +994,7 @@ HRESULT interceptor_ICJI::GetErrorHRESULT( // Fetches the message of the current exception // Returns the size of the message (including terminating null). This can be // greater than bufferLength if the buffer is insufficient. -ULONG interceptor_ICJI::GetErrorMessage( - __inout_ecount(bufferLength) LPWSTR buffer, - ULONG bufferLength - ) +ULONG interceptor_ICJI::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength) { mcs->AddCall("GetErrorMessage"); return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength); @@ -1154,33 +1006,27 @@ ULONG interceptor_ICJI::GetErrorMessage( // things like ThreadStoppedException ... // returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE -int interceptor_ICJI::FilterException( - struct _EXCEPTION_POINTERS *pExceptionPointers - ) +int interceptor_ICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers) { mcs->AddCall("FilterException"); return original_ICorJitInfo->FilterException(pExceptionPointers); } // Cleans up internal EE tracking when an exception is caught. -void interceptor_ICJI::HandleException( - struct _EXCEPTION_POINTERS *pExceptionPointers - ) +void interceptor_ICJI::HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers) { mcs->AddCall("HandleException"); original_ICorJitInfo->HandleException(pExceptionPointers); } -void interceptor_ICJI::ThrowExceptionForJitResult( - HRESULT result) +void interceptor_ICJI::ThrowExceptionForJitResult(HRESULT result) { mcs->AddCall("ThrowExceptionForJitResult"); original_ICorJitInfo->ThrowExceptionForJitResult(result); } -//Throws an exception defined by the given throw helper. -void interceptor_ICJI::ThrowExceptionForHelper( - const CORINFO_HELPER_DESC * throwHelper) +// Throws an exception defined by the given throw helper. +void interceptor_ICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper) { mcs->AddCall("ThrowExceptionForHelper"); original_ICorJitInfo->ThrowExceptionForHelper(throwHelper); @@ -1194,9 +1040,7 @@ void interceptor_ICJI::ThrowExceptionForHelper( *****************************************************************************/ // Return details about EE internal data structures -void interceptor_ICJI::getEEInfo( - CORINFO_EE_INFO *pEEInfoOut - ) +void interceptor_ICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut) { mcs->AddCall("getEEInfo"); original_ICorJitInfo->getEEInfo(pEEInfoOut); @@ -1206,20 +1050,18 @@ void interceptor_ICJI::getEEInfo( LPCWSTR interceptor_ICJI::getJitTimeLogFilename() { mcs->AddCall("getJitTimeLogFilename"); - return original_ICorJitInfo->getJitTimeLogFilename(); + return original_ICorJitInfo->getJitTimeLogFilename(); } - /*********************************************************************************/ - // - // Diagnostic methods - // - /*********************************************************************************/ +/*********************************************************************************/ +// +// Diagnostic methods +// +/*********************************************************************************/ // this function is for debugging only. Returns method token. // Returns mdMethodDefNil for dynamic methods. -mdMethodDef interceptor_ICJI::getMethodDefFromMethod( - CORINFO_METHOD_HANDLE hMethod - ) +mdMethodDef interceptor_ICJI::getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod) { mcs->AddCall("getMethodDefFromMethod"); return original_ICorJitInfo->getMethodDefFromMethod(hMethod); @@ -1228,10 +1070,9 @@ mdMethodDef interceptor_ICJI::getMethodDefFromMethod( // this function is for debugging only. It returns the method name // and if 'moduleName' is non-null, it sets it to something that will // says which method (a class name, or a module name) -const char* interceptor_ICJI::getMethodName ( - CORINFO_METHOD_HANDLE ftn, /* IN */ - const char **moduleName /* OUT */ - ) +const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */ + const char** moduleName /* OUT */ + ) { mcs->AddCall("getMethodName"); return original_ICorJitInfo->getMethodName(ftn, moduleName); @@ -1240,71 +1081,59 @@ const char* interceptor_ICJI::getMethodName ( // this function is for debugging only. It returns a value that // is will always be the same for a given method. It is used // to implement the 'jitRange' functionality -unsigned interceptor_ICJI::getMethodHash ( - CORINFO_METHOD_HANDLE ftn /* IN */ - ) +unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */ + ) { mcs->AddCall("getMethodHash"); return original_ICorJitInfo->getMethodHash(ftn); } // this function is for debugging only. -size_t interceptor_ICJI::findNameOfToken ( - CORINFO_MODULE_HANDLE module, /* IN */ - mdToken metaTOK, /* IN */ - __out_ecount (FQNameCapacity) char * szFQName, /* OUT */ - size_t FQNameCapacity /* IN */ - ) +size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */ + mdToken metaTOK, /* IN */ + __out_ecount(FQNameCapacity) char* szFQName, /* OUT */ + size_t FQNameCapacity /* IN */ + ) { mcs->AddCall("findNameOfToken"); return original_ICorJitInfo->findNameOfToken(module, metaTOK, szFQName, FQNameCapacity); } bool interceptor_ICJI::getSystemVAmd64PassStructInRegisterDescriptor( - /* IN */ CORINFO_CLASS_HANDLE structHnd, - /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr - ) + /* IN */ CORINFO_CLASS_HANDLE structHnd, + /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr) { mcs->AddCall("getSystemVAmd64PassStructInRegisterDescriptor"); return original_ICorJitInfo->getSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr); } -//Stuff on ICorDynamicInfo -DWORD interceptor_ICJI::getThreadTLSIndex( - void **ppIndirection - ) +// Stuff on ICorDynamicInfo +DWORD interceptor_ICJI::getThreadTLSIndex(void** ppIndirection) { mcs->AddCall("getThreadTLSIndex"); return original_ICorJitInfo->getThreadTLSIndex(ppIndirection); } -const void * interceptor_ICJI::getInlinedCallFrameVptr( - void **ppIndirection - ) +const void* interceptor_ICJI::getInlinedCallFrameVptr(void** ppIndirection) { mcs->AddCall("getInlinedCallFrameVptr"); return original_ICorJitInfo->getInlinedCallFrameVptr(ppIndirection); } -LONG * interceptor_ICJI::getAddrOfCaptureThreadGlobal( - void **ppIndirection - ) +LONG* interceptor_ICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection) { mcs->AddCall("getAddrOfCaptureThreadGlobal"); return original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection); } -SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module) +SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module) { mcs->AddCall("getAddrModuleDomainID"); return original_ICorJitInfo->getAddrModuleDomainID(module); } // return the native entry point to an EE helper (see CorInfoHelpFunc) -void* interceptor_ICJI::getHelperFtn ( - CorInfoHelpFunc ftnNum, - void **ppIndirection - ) +void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection) { mcs->AddCall("getHelperFtn"); return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection); @@ -1313,10 +1142,9 @@ void* interceptor_ICJI::getHelperFtn ( // return a callable address of the function (native code). This function // may return a different value (depending on whether the method has // been JITed or not. -void interceptor_ICJI::getFunctionEntryPoint( - CORINFO_METHOD_HANDLE ftn, /* IN */ - CORINFO_CONST_LOOKUP * pResult, /* OUT */ - CORINFO_ACCESS_FLAGS accessFlags) +void interceptor_ICJI::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */ + CORINFO_CONST_LOOKUP* pResult, /* OUT */ + CORINFO_ACCESS_FLAGS accessFlags) { mcs->AddCall("getFunctionEntryPoint"); original_ICorJitInfo->getFunctionEntryPoint(ftn, pResult, accessFlags); @@ -1325,19 +1153,14 @@ void interceptor_ICJI::getFunctionEntryPoint( // return a directly callable address. This can be used similarly to the // value returned by getFunctionEntryPoint() except that it is // guaranteed to be multi callable entrypoint. -void interceptor_ICJI::getFunctionFixedEntryPoint( - CORINFO_METHOD_HANDLE ftn, - CORINFO_CONST_LOOKUP * pResult) +void interceptor_ICJI::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult) { mcs->AddCall("getFunctionFixedEntryPoint"); original_ICorJitInfo->getFunctionFixedEntryPoint(ftn, pResult); } // get the synchronization handle that is passed to monXstatic function -void* interceptor_ICJI::getMethodSync( - CORINFO_METHOD_HANDLE ftn, - void **ppIndirection - ) +void* interceptor_ICJI::getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection) { mcs->AddCall("getMethodSync"); return original_ICorJitInfo->getMethodSync(ftn, ppIndirection); @@ -1349,45 +1172,31 @@ void* interceptor_ICJI::getMethodSync( // get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*). // Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used. -CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper( - CORINFO_MODULE_HANDLE handle - ) +CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle) { mcs->AddCall("getLazyStringLiteralHelper"); return original_ICorJitInfo->getLazyStringLiteralHelper(handle); } -CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle( - CORINFO_MODULE_HANDLE handle, - void **ppIndirection - ) +CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection) { mcs->AddCall("embedModuleHandle"); return original_ICorJitInfo->embedModuleHandle(handle, ppIndirection); } -CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle( - CORINFO_CLASS_HANDLE handle, - void **ppIndirection - ) +CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection) { mcs->AddCall("embedClassHandle"); return original_ICorJitInfo->embedClassHandle(handle, ppIndirection); } -CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle( - CORINFO_METHOD_HANDLE handle, - void **ppIndirection - ) +CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection) { mcs->AddCall("embedMethodHandle"); return original_ICorJitInfo->embedMethodHandle(handle, ppIndirection); } -CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle( - CORINFO_FIELD_HANDLE handle, - void **ppIndirection - ) +CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection) { mcs->AddCall("embedFieldHandle"); return original_ICorJitInfo->embedFieldHandle(handle, ppIndirection); @@ -1400,10 +1209,10 @@ CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle( // code is shared and the token contains generic parameters) // then indicate how the handle should be looked up at run-time. // -void interceptor_ICJI::embedGenericHandle( - CORINFO_RESOLVED_TOKEN * pResolvedToken, - BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle - CORINFO_GENERICHANDLE_RESULT * pResult) +void interceptor_ICJI::embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, + BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method + // handle + CORINFO_GENERICHANDLE_RESULT* pResult) { mcs->AddCall("embedGenericHandle"); original_ICorJitInfo->embedGenericHandle(pResolvedToken, fEmbedParent, pResult); @@ -1416,39 +1225,28 @@ void interceptor_ICJI::embedGenericHandle( // CORINFO_LOOKUP_THISOBJ use vtable pointer of 'this' param // CORINFO_LOOKUP_CLASSPARAM use vtable hidden param // CORINFO_LOOKUP_METHODPARAM use enclosing type of method-desc hidden param -CORINFO_LOOKUP_KIND interceptor_ICJI::getLocationOfThisType( - CORINFO_METHOD_HANDLE context - ) +CORINFO_LOOKUP_KIND interceptor_ICJI::getLocationOfThisType(CORINFO_METHOD_HANDLE context) { mcs->AddCall("getLocationOfThisType"); return original_ICorJitInfo->getLocationOfThisType(context); } // return the unmanaged target *if method has already been prelinked.* -void* interceptor_ICJI::getPInvokeUnmanagedTarget( - CORINFO_METHOD_HANDLE method, - void **ppIndirection - ) +void* interceptor_ICJI::getPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection) { mcs->AddCall("getPInvokeUnmanagedTarget"); return original_ICorJitInfo->getPInvokeUnmanagedTarget(method, ppIndirection); } // return address of fixup area for late-bound PInvoke calls. -void* interceptor_ICJI::getAddressOfPInvokeFixup( - CORINFO_METHOD_HANDLE method, - void **ppIndirection - ) +void* interceptor_ICJI::getAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection) { mcs->AddCall("getAddressOfPInvokeFixup"); return original_ICorJitInfo->getAddressOfPInvokeFixup(method, ppIndirection); } // return address of fixup area for late-bound PInvoke calls. -void interceptor_ICJI::getAddressOfPInvokeTarget( - CORINFO_METHOD_HANDLE method, - CORINFO_CONST_LOOKUP *pLookup - ) +void interceptor_ICJI::getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup) { mcs->AddCall("getAddressOfPInvokeTarget"); original_ICorJitInfo->getAddressOfPInvokeTarget(method, pLookup); @@ -1456,10 +1254,7 @@ void interceptor_ICJI::getAddressOfPInvokeTarget( // Generate a cookie based on the signature that would needs to be passed // to CORINFO_HELP_PINVOKE_CALLI -LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig( - CORINFO_SIG_INFO* szMetaSig, - void ** ppIndirection - ) +LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection) { mcs->AddCall("GetCookieForPInvokeCalliSig"); return original_ICorJitInfo->GetCookieForPInvokeCalliSig(szMetaSig, ppIndirection); @@ -1467,9 +1262,7 @@ LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig( // returns true if a VM cookie can be generated for it (might be false due to cross-module // inlining, in which case the inlining should be aborted) -bool interceptor_ICJI::canGetCookieForPInvokeCalliSig( - CORINFO_SIG_INFO* szMetaSig - ) +bool interceptor_ICJI::canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig) { mcs->AddCall("canGetCookieForPInvokeCalliSig"); return original_ICorJitInfo->canGetCookieForPInvokeCalliSig(szMetaSig); @@ -1477,10 +1270,8 @@ bool interceptor_ICJI::canGetCookieForPInvokeCalliSig( // Gets a handle that is checked to see if the current method is // included in "JustMyCode" -CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle( - CORINFO_METHOD_HANDLE method, - CORINFO_JUST_MY_CODE_HANDLE**ppIndirection - ) +CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(CORINFO_METHOD_HANDLE method, + CORINFO_JUST_MY_CODE_HANDLE** ppIndirection) { mcs->AddCall("getJustMyCodeHandle"); return original_ICorJitInfo->getJustMyCodeHandle(method, ppIndirection); @@ -1489,11 +1280,7 @@ CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle( // Gets a method handle that can be used to correlate profiling data. // This is the IP of a native method, or the address of the descriptor struct // for IL. Always guaranteed to be unique per process, and not to move. */ -void interceptor_ICJI::GetProfilingHandle( - BOOL *pbHookFunction, - void **pProfilerHandle, - BOOL *pbIndirectedHandles - ) +void interceptor_ICJI::GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles) { mcs->AddCall("GetProfilingHandle"); original_ICorJitInfo->GetProfilingHandle(pbHookFunction, pProfilerHandle, pbIndirectedHandles); @@ -1501,28 +1288,26 @@ void interceptor_ICJI::GetProfilingHandle( // Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values. void interceptor_ICJI::getCallInfo( - // Token info - CORINFO_RESOLVED_TOKEN * pResolvedToken, + // Token info + CORINFO_RESOLVED_TOKEN* pResolvedToken, - //Generics info - CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken, + // Generics info + CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, - //Security info - CORINFO_METHOD_HANDLE callerHandle, + // Security info + CORINFO_METHOD_HANDLE callerHandle, - //Jit info - CORINFO_CALLINFO_FLAGS flags, + // Jit info + CORINFO_CALLINFO_FLAGS flags, - //out params - CORINFO_CALL_INFO *pResult - ) + // out params + CORINFO_CALL_INFO* pResult) { mcs->AddCall("getCallInfo"); original_ICorJitInfo->getCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult); } -BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, - CORINFO_CLASS_HANDLE hInstanceType) +BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType) { mcs->AddCall("canAccessFamily"); @@ -1537,31 +1322,21 @@ BOOL interceptor_ICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls) } // returns the class's domain ID for accessing shared statics -unsigned interceptor_ICJI::getClassDomainID ( - CORINFO_CLASS_HANDLE cls, - void **ppIndirection - ) +unsigned interceptor_ICJI::getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection) { mcs->AddCall("getClassDomainID"); return original_ICorJitInfo->getClassDomainID(cls, ppIndirection); } - // return the data's address (for static fields only) -void* interceptor_ICJI::getFieldAddress( - CORINFO_FIELD_HANDLE field, - void **ppIndirection - ) +void* interceptor_ICJI::getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection) { mcs->AddCall("getFieldAddress"); return original_ICorJitInfo->getFieldAddress(field, ppIndirection); } // registers a vararg sig & returns a VM cookie for it (which can contain other stuff) -CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle( - CORINFO_SIG_INFO *pSig, - void **ppIndirection - ) +CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection) { mcs->AddCall("getVarArgsHandle"); return original_ICorJitInfo->getVarArgsHandle(pSig, ppIndirection); @@ -1569,28 +1344,20 @@ CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle( // returns true if a VM cookie can be generated for it (might be false due to cross-module // inlining, in which case the inlining should be aborted) -bool interceptor_ICJI::canGetVarArgsHandle( - CORINFO_SIG_INFO *pSig - ) +bool interceptor_ICJI::canGetVarArgsHandle(CORINFO_SIG_INFO* pSig) { mcs->AddCall("canGetVarArgsHandle"); return original_ICorJitInfo->canGetVarArgsHandle(pSig); } // Allocate a string literal on the heap and return a handle to it -InfoAccessType interceptor_ICJI::constructStringLiteral( - CORINFO_MODULE_HANDLE module, - mdToken metaTok, - void **ppValue - ) +InfoAccessType interceptor_ICJI::constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue) { mcs->AddCall("constructStringLiteral"); return original_ICorJitInfo->constructStringLiteral(module, metaTok, ppValue); } -InfoAccessType interceptor_ICJI::emptyStringLiteral( - void **ppValue - ) +InfoAccessType interceptor_ICJI::emptyStringLiteral(void** ppValue) { mcs->AddCall("emptyStringLiteral"); return original_ICorJitInfo->emptyStringLiteral(ppValue); @@ -1599,20 +1366,14 @@ InfoAccessType interceptor_ICJI::emptyStringLiteral( // (static fields only) given that 'field' refers to thread local store, // return the ID (TLS index), which is used to find the begining of the // TLS data area for the particular DLL 'field' is associated with. -DWORD interceptor_ICJI::getFieldThreadLocalStoreID ( - CORINFO_FIELD_HANDLE field, - void **ppIndirection - ) +DWORD interceptor_ICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection) { mcs->AddCall("getFieldThreadLocalStoreID"); return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection); } // Sets another object to intercept calls to "self" and current method being compiled -void interceptor_ICJI::setOverride( - ICorDynamicInfo *pOverride, - CORINFO_METHOD_HANDLE currentMethod - ) +void interceptor_ICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod) { mcs->AddCall("setOverride"); original_ICorJitInfo->setOverride(pOverride, currentMethod); @@ -1620,45 +1381,35 @@ void interceptor_ICJI::setOverride( // Adds an active dependency from the context method's module to the given module // This is internal callback for the EE. JIT should not call it directly. -void interceptor_ICJI::addActiveDependency( - CORINFO_MODULE_HANDLE moduleFrom, - CORINFO_MODULE_HANDLE moduleTo - ) +void interceptor_ICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo) { mcs->AddCall("addActiveDependency"); original_ICorJitInfo->addActiveDependency(moduleFrom, moduleTo); } -CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor( - CORINFO_METHOD_HANDLE methHnd, - CORINFO_CLASS_HANDLE clsHnd, - CORINFO_METHOD_HANDLE targetMethodHnd, - DelegateCtorArgs * pCtorData - ) +CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, + CORINFO_CLASS_HANDLE clsHnd, + CORINFO_METHOD_HANDLE targetMethodHnd, + DelegateCtorArgs* pCtorData) { mcs->AddCall("GetDelegateCtor"); return original_ICorJitInfo->GetDelegateCtor(methHnd, clsHnd, targetMethodHnd, pCtorData); } -void interceptor_ICJI::MethodCompileComplete( - CORINFO_METHOD_HANDLE methHnd - ) +void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd) { mcs->AddCall("MethodCompileComplete"); original_ICorJitInfo->MethodCompileComplete(methHnd); } // return a thunk that will copy the arguments for the given signature. -void* interceptor_ICJI::getTailCallCopyArgsThunk ( - CORINFO_SIG_INFO *pSig, - CorInfoHelperTailCallSpecialHandling flags - ) +void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags) { mcs->AddCall("getTailCallCopyArgsThunk"); return original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags); } -//Stuff directly on ICorJitInfo +// Stuff directly on ICorJitInfo // Returns extended flags for a particular compilation instance. DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes) @@ -1672,7 +1423,7 @@ DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes) // record the results of the call: when this call gets played back, // its result will depend on whether or not `function` calls something // that throws at playback time rather than at capture time. -bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void *param) +bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void* param) { mcs->AddCall("runWithErrorTrap"); return original_ICorJitInfo->runWithErrorTrap(function, param); @@ -1682,26 +1433,26 @@ bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void *param) IEEMemoryManager* interceptor_ICJI::getMemoryManager() { mcs->AddCall("getMemoryManager"); - if(current_IEEMM->original_IEEMM == nullptr) + if (current_IEEMM->original_IEEMM == nullptr) current_IEEMM->original_IEEMM = original_ICorJitInfo->getMemoryManager(); return current_IEEMM; } // get a block of memory for the code, readonly data, and read-write data -void interceptor_ICJI::allocMem ( - ULONG hotCodeSize, /* IN */ - ULONG coldCodeSize, /* IN */ - ULONG roDataSize, /* IN */ - ULONG xcptnsCount, /* IN */ - CorJitAllocMemFlag flag, /* IN */ - void ** hotCodeBlock, /* OUT */ - void ** coldCodeBlock, /* OUT */ - void ** roDataBlock /* OUT */ - ) +void interceptor_ICJI::allocMem(ULONG hotCodeSize, /* IN */ + ULONG coldCodeSize, /* IN */ + ULONG roDataSize, /* IN */ + ULONG xcptnsCount, /* IN */ + CorJitAllocMemFlag flag, /* IN */ + void** hotCodeBlock, /* OUT */ + void** coldCodeBlock, /* OUT */ + void** roDataBlock /* OUT */ + ) { mcs->AddCall("allocMem"); - return original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, coldCodeBlock, roDataBlock); + return original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, + coldCodeBlock, roDataBlock); } // Reserve memory for the method/funclet's unwind information. @@ -1715,11 +1466,10 @@ void interceptor_ICJI::allocMem ( // For prejitted code we split up the unwinding information into // separate sections .rdata and .pdata. // -void interceptor_ICJI::reserveUnwindInfo ( - BOOL isFunclet, /* IN */ - BOOL isColdCode, /* IN */ - ULONG unwindSize /* IN */ - ) +void interceptor_ICJI::reserveUnwindInfo(BOOL isFunclet, /* IN */ + BOOL isColdCode, /* IN */ + ULONG unwindSize /* IN */ + ) { mcs->AddCall("reserveUnwindInfo"); original_ICorJitInfo->reserveUnwindInfo(isFunclet, isColdCode, unwindSize); @@ -1742,33 +1492,32 @@ void interceptor_ICJI::reserveUnwindInfo ( // pUnwindBlock pointer to unwind info // funcKind type of funclet (main method code, handler, filter) // -void interceptor_ICJI::allocUnwindInfo ( - BYTE * pHotCode, /* IN */ - BYTE * pColdCode, /* IN */ - ULONG startOffset, /* IN */ - ULONG endOffset, /* IN */ - ULONG unwindSize, /* IN */ - BYTE * pUnwindBlock, /* IN */ - CorJitFuncKind funcKind /* IN */ - ) +void interceptor_ICJI::allocUnwindInfo(BYTE* pHotCode, /* IN */ + BYTE* pColdCode, /* IN */ + ULONG startOffset, /* IN */ + ULONG endOffset, /* IN */ + ULONG unwindSize, /* IN */ + BYTE* pUnwindBlock, /* IN */ + CorJitFuncKind funcKind /* IN */ + ) { mcs->AddCall("allocUnwindInfo"); - original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, funcKind); + original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, + funcKind); } // Get a block of memory needed for the code manager information, // (the info for enumerating the GC pointers while crawling the // stack frame). // Note that allocMem must be called first -void * interceptor_ICJI::allocGCInfo ( - size_t size /* IN */ - ) +void* interceptor_ICJI::allocGCInfo(size_t size /* IN */ + ) { mcs->AddCall("allocGCInfo"); return original_ICorJitInfo->allocGCInfo(size); } -//only used on x64 +// only used on x64 void interceptor_ICJI::yieldExecution() { mcs->AddCall("yieldExecution"); @@ -1778,9 +1527,8 @@ void interceptor_ICJI::yieldExecution() // Indicate how many exception handler blocks are to be returned. // This is guaranteed to be called before any 'setEHinfo' call. // Note that allocMem must be called before this method can be called. -void interceptor_ICJI::setEHcount ( - unsigned cEH /* IN */ - ) +void interceptor_ICJI::setEHcount(unsigned cEH /* IN */ + ) { mcs->AddCall("setEHcount"); original_ICorJitInfo->setEHcount(cEH); @@ -1791,10 +1539,9 @@ void interceptor_ICJI::setEHcount ( // Handler regions should be lexically contiguous. // This is because FinallyIsUnwinding() uses lexicality to // determine if a "finally" clause is executing. -void interceptor_ICJI::setEHinfo ( - unsigned EHnumber, /* IN */ - const CORINFO_EH_CLAUSE *clause /* IN */ - ) +void interceptor_ICJI::setEHinfo(unsigned EHnumber, /* IN */ + const CORINFO_EH_CLAUSE* clause /* IN */ + ) { mcs->AddCall("setEHinfo"); original_ICorJitInfo->setEHinfo(EHnumber, clause); @@ -1833,10 +1580,8 @@ struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA // allocate a basic block profile buffer where execution counts will be stored // for jitted basic blocks. -HRESULT interceptor_ICJI::allocBBProfileBuffer ( - ULONG count, // The number of basic blocks that we have - ProfileBuffer ** profileBuffer - ) +HRESULT interceptor_ICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have + ProfileBuffer** profileBuffer) { mcs->AddCall("allocBBProfileBuffer"); return original_ICorJitInfo->allocBBProfileBuffer(count, profileBuffer); @@ -1844,12 +1589,10 @@ HRESULT interceptor_ICJI::allocBBProfileBuffer ( // get profile information to be used for optimizing the current method. The format // of the buffer is the same as the format the JIT passes to allocBBProfileBuffer. -HRESULT interceptor_ICJI::getBBProfileData( - CORINFO_METHOD_HANDLE ftnHnd, - ULONG * count, // The number of basic blocks that we have - ProfileBuffer ** profileBuffer, - ULONG * numRuns - ) +HRESULT interceptor_ICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, + ULONG* count, // The number of basic blocks that we have + ProfileBuffer** profileBuffer, + ULONG* numRuns) { mcs->AddCall("getBBProfileData"); return original_ICorJitInfo->getBBProfileData(ftnHnd, count, profileBuffer, numRuns); @@ -1859,11 +1602,10 @@ HRESULT interceptor_ICJI::getBBProfileData( // the signature information and method handle the JIT used to lay out the call site. If // the call site has no signature information (e.g. a helper call) or has no method handle // (e.g. a CALLI P/Invoke), then null should be passed instead. -void interceptor_ICJI::recordCallSite( - ULONG instrOffset, /* IN */ - CORINFO_SIG_INFO * callSig, /* IN */ - CORINFO_METHOD_HANDLE methodHandle /* IN */ - ) +void interceptor_ICJI::recordCallSite(ULONG instrOffset, /* IN */ + CORINFO_SIG_INFO* callSig, /* IN */ + CORINFO_METHOD_HANDLE methodHandle /* IN */ + ) { mcs->AddCall("recordCallSite"); return original_ICorJitInfo->recordCallSite(instrOffset, callSig, methodHandle); @@ -1871,19 +1613,18 @@ void interceptor_ICJI::recordCallSite( // A relocation is recorded if we are pre-jitting. // A jump thunk may be inserted if we are jitting -void interceptor_ICJI::recordRelocation( - void * location, /* IN */ - void * target, /* IN */ - WORD fRelocType, /* IN */ - WORD slotNum, /* IN */ - INT32 addlDelta /* IN */ - ) +void interceptor_ICJI::recordRelocation(void* location, /* IN */ + void* target, /* IN */ + WORD fRelocType, /* IN */ + WORD slotNum, /* IN */ + INT32 addlDelta /* IN */ + ) { mcs->AddCall("recordRelocation"); original_ICorJitInfo->recordRelocation(location, target, fRelocType, slotNum, addlDelta); } -WORD interceptor_ICJI::getRelocTypeHint(void * target) +WORD interceptor_ICJI::getRelocTypeHint(void* target) { mcs->AddCall("getRelocTypeHint"); return original_ICorJitInfo->getRelocTypeHint(target); @@ -1892,10 +1633,9 @@ WORD interceptor_ICJI::getRelocTypeHint(void * target) // A callback to identify the range of address known to point to // compiler-generated native entry points that call back into // MSIL. -void interceptor_ICJI::getModuleNativeEntryPointRange( - void ** pStart, /* OUT */ - void ** pEnd /* OUT */ - ) +void interceptor_ICJI::getModuleNativeEntryPointRange(void** pStart, /* OUT */ + void** pEnd /* OUT */ + ) { mcs->AddCall("getModuleNativeEntryPointRange"); original_ICorJitInfo->getModuleNativeEntryPointRange(pStart, pEnd); diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h index ab90cfc646..ce269cc06c 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h +++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h @@ -16,11 +16,10 @@ class interceptor_ICJI : public ICorJitInfo #include "icorjitinfoimpl.h" public: - - //Added to help us track the original icji and be able to easily indirect - //to it. And a simple way to keep one memory manager instance per instance. - ICorJitInfo *original_ICorJitInfo; - MethodCallSummarizer *mcs; + // Added to help us track the original icji and be able to easily indirect + //to it. And a simple way to keep one memory manager instance per instance. + ICorJitInfo* original_ICorJitInfo; + MethodCallSummarizer* mcs; }; #endif diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp index 863d542202..24efbce4f4 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp @@ -10,7 +10,7 @@ //*************************************************************************** // IUnknown methods //*************************************************************************** -HRESULT STDMETHODCALLTYPE interceptor_IEEMM::QueryInterface(REFIID id, void **pInterface) +HRESULT STDMETHODCALLTYPE interceptor_IEEMM::QueryInterface(REFIID id, void** pInterface) { return original_IEEMM->QueryInterface(id, pInterface); } @@ -26,7 +26,10 @@ ULONG STDMETHODCALLTYPE interceptor_IEEMM::Release() //*************************************************************************** // IEEMemoryManager methods for locking //*************************************************************************** -LPVOID STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect) +LPVOID STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualAlloc(LPVOID lpAddress, + SIZE_T dwSize, + DWORD flAllocationType, + DWORD flProtect) { return original_IEEMM->ClrVirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect); } @@ -34,11 +37,16 @@ BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualFree(LPVOID lpAddress, SIZE_ { return original_IEEMM->ClrVirtualFree(lpAddress, dwSize, dwFreeType); } -SIZE_T STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength) +SIZE_T STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualQuery(LPCVOID lpAddress, + PMEMORY_BASIC_INFORMATION lpBuffer, + SIZE_T dwLength) { return original_IEEMM->ClrVirtualQuery(lpAddress, lpBuffer, dwLength); } -BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect) +BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualProtect(LPVOID lpAddress, + SIZE_T dwSize, + DWORD flNewProtect, + PDWORD lpflOldProtect) { return original_IEEMM->ClrVirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect); } diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h b/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h index 4a72e809ee..28e8539591 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h +++ b/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h @@ -76,12 +76,11 @@ interface IEEMemoryManager : IUnknown class interceptor_IEEMM : public IEEMemoryManager { private: - //*************************************************************************** // IUnknown methods //*************************************************************************** - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface); + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface); ULONG STDMETHODCALLTYPE AddRef(); ULONG STDMETHODCALLTYPE Release(); @@ -91,7 +90,10 @@ private: LPVOID STDMETHODCALLTYPE ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect); BOOL STDMETHODCALLTYPE ClrVirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType); SIZE_T STDMETHODCALLTYPE ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength); - BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect); + BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress, + SIZE_T dwSize, + DWORD flNewProtect, + PDWORD lpflOldProtect); HANDLE STDMETHODCALLTYPE ClrGetProcessHeap(); HANDLE STDMETHODCALLTYPE ClrHeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize); BOOL STDMETHODCALLTYPE ClrHeapDestroy(HANDLE hHeap); @@ -101,7 +103,7 @@ private: HANDLE STDMETHODCALLTYPE ClrGetProcessExecutableHeap(); public: - IEEMemoryManager *original_IEEMM; + IEEMemoryManager* original_IEEMM; }; #endif diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp index 0e2a311ed3..7e882bb396 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp @@ -10,7 +10,7 @@ //*************************************************************************** // IUnknown methods //*************************************************************************** -HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void **pInterface) +HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void** pInterface) { return original_IEE->QueryInterface(id, pInterface); } @@ -27,7 +27,7 @@ ULONG STDMETHODCALLTYPE interceptor_IEE::Release() // IExecutionEngine methods for TLS //*************************************************************************** // Associate a callback for cleanup with a TLS slot -VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback) +VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback) { original_IEE->TLS_AssociateCallback(slot, callback); } @@ -43,7 +43,7 @@ LPVOID STDMETHODCALLTYPE interceptor_IEE::TLS_GetValue(DWORD slot) } // Get the value at a slot, return FALSE if TLS info block doesn't exist -BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID * pValue) +BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID* pValue) { return original_IEE->TLS_CheckValue(slot, pValue); } @@ -114,17 +114,21 @@ void STDMETHODCALLTYPE interceptor_IEE::ClrCloseSemaphore(SEMAPHORE_COOKIE semap { original_IEE->ClrCloseSemaphore(semaphore); } -DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable) +DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, + DWORD dwMilliseconds, + BOOL bAlertable) { return original_IEE->ClrWaitForSemaphore(semaphore, dwMilliseconds, bAlertable); } -BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount) +BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, + LONG lReleaseCount, + LONG* lpPreviousCount) { return original_IEE->ClrReleaseSemaphore(semaphore, lReleaseCount, lpPreviousCount); } MUTEX_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, - BOOL bInitialOwner, - LPCTSTR lpName) + BOOL bInitialOwner, + LPCTSTR lpName) { return original_IEE->ClrCreateMutex(lpMutexAttributes, bInitialOwner, lpName); } @@ -136,9 +140,7 @@ BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseMutex(MUTEX_COOKIE mutex) { return original_IEE->ClrReleaseMutex(mutex); } -DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForMutex(MUTEX_COOKIE mutex, - DWORD dwMilliseconds, - BOOL bAlertable) +DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable) { return original_IEE->ClrWaitForMutex(mutex, dwMilliseconds, bAlertable); } @@ -151,7 +153,7 @@ BOOL STDMETHODCALLTYPE interceptor_IEE::ClrAllocationDisallowed() { return original_IEE->ClrAllocationDisallowed(); } -void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void **ppvException) +void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void** ppvException) { original_IEE->GetLastThrownObjectExceptionFromThread(ppvException); } diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h b/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h index 642c145374..e3706b4196 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h +++ b/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h @@ -88,11 +88,10 @@ interface IExecutionEngine : IUnknown class interceptor_IEE : public IExecutionEngine { private: - //*************************************************************************** // IUnknown methods //*************************************************************************** - HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface); + HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface); ULONG STDMETHODCALLTYPE AddRef(); ULONG STDMETHODCALLTYPE Release(); @@ -100,13 +99,13 @@ private: // IExecutionEngine methods for TLS //*************************************************************************** // Associate a callback for cleanup with a TLS slot - VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback); + VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback); // Get the TLS block for fast Get/Set operations LPVOID* STDMETHODCALLTYPE TLS_GetDataBlock(); // Get the value at a slot LPVOID STDMETHODCALLTYPE TLS_GetValue(DWORD slot); // Get the value at a slot, return FALSE if TLS info block doesn't exist - BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID * pValue); + BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID* pValue); // Set the value at a slot VOID STDMETHODCALLTYPE TLS_SetValue(DWORD slot, LPVOID pData); // Free TLS memory block and make callback @@ -129,21 +128,19 @@ private: SEMAPHORE_COOKIE STDMETHODCALLTYPE ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax); void STDMETHODCALLTYPE ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore); DWORD STDMETHODCALLTYPE ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable); - BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount); + BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG* lpPreviousCount); MUTEX_COOKIE STDMETHODCALLTYPE ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, - BOOL bInitialOwner, - LPCTSTR lpName); + BOOL bInitialOwner, + LPCTSTR lpName); void STDMETHODCALLTYPE ClrCloseMutex(MUTEX_COOKIE mutex); BOOL STDMETHODCALLTYPE ClrReleaseMutex(MUTEX_COOKIE mutex); - DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex, - DWORD dwMilliseconds, - BOOL bAlertable); + DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable); DWORD STDMETHODCALLTYPE ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable); BOOL STDMETHODCALLTYPE ClrAllocationDisallowed(); - void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void **ppvException); + void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void** ppvException); public: - IExecutionEngine *original_IEE; + IExecutionEngine* original_IEE; }; #endif
\ No newline at end of file diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/jithost.h b/src/ToolBox/superpmi/superpmi-shim-counter/jithost.h index 06acf8bf91..fb8ca2649a 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/jithost.h +++ b/src/ToolBox/superpmi/superpmi-shim-counter/jithost.h @@ -16,7 +16,7 @@ public: #include "icorjithostimpl.h" private: - ICorJitHost* wrappedHost; + ICorJitHost* wrappedHost; MethodCallSummarizer* mcs; }; diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp index 61f31e4237..e22c060271 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp @@ -6,36 +6,38 @@ #include "standardpch.h" #include "methodcallsummarizer.h" -MethodCallSummarizer::MethodCallSummarizer(WCHAR *logPath) +MethodCallSummarizer::MethodCallSummarizer(WCHAR* logPath) { numNames = 0; - names = nullptr; - counts = nullptr; + names = nullptr; + counts = nullptr; - WCHAR *ExecutableName = GetCommandLineW(); - WCHAR *quote1 = NULL; + WCHAR* ExecutableName = GetCommandLineW(); + WCHAR* quote1 = NULL; - //if there are any quotes in filename convert them to spaces. + // if there are any quotes in filename convert them to spaces. while ((quote1 = wcsstr(ExecutableName, W("\""))) != NULL) *quote1 = W(' '); - //remove any illegal or annoying characters from file name by converting them to underscores + // remove any illegal or annoying characters from file name by converting them to underscores while ((quote1 = wcspbrk(ExecutableName, W("=<>:\"/\\|?! *.,"))) != NULL) *quote1 = W('_'); - const WCHAR *DataFileExtension = W(".csv"); - size_t ExecutableNameLength = wcslen(ExecutableName); - size_t DataFileExtensionLength = wcslen(DataFileExtension); - size_t logPathLength = wcslen(logPath); + const WCHAR* DataFileExtension = W(".csv"); + size_t ExecutableNameLength = wcslen(ExecutableName); + size_t DataFileExtensionLength = wcslen(DataFileExtension); + size_t logPathLength = wcslen(logPath); unsigned int randNumber = 0; - WCHAR RandNumberString[9]; - RandNumberString[0] = L'\0'; + WCHAR RandNumberString[9]; + RandNumberString[0] = L'\0'; size_t RandNumberLength = 0; - size_t dataFileNameLength = logPathLength + 1 + ExecutableNameLength + 1 + RandNumberLength + 1 + DataFileExtensionLength + 1; + size_t dataFileNameLength = + logPathLength + 1 + ExecutableNameLength + 1 + RandNumberLength + 1 + DataFileExtensionLength + 1; - const size_t MaxAcceptablePathLength = MAX_PATH - 20; // subtract 20 to leave buffer, for possible random number addition + const size_t MaxAcceptablePathLength = + MAX_PATH - 20; // subtract 20 to leave buffer, for possible random number addition if (dataFileNameLength >= MaxAcceptablePathLength) { // The path name is too long; creating the file will fail. This can happen because we use the command line, @@ -48,7 +50,7 @@ MethodCallSummarizer::MethodCallSummarizer(WCHAR *logPath) #ifdef FEATURE_PAL PAL_Random(/* bStrong */ FALSE, &randNumber, sizeof(randNumber)); -#else // !FEATURE_PAL +#else // !FEATURE_PAL rand_s(&randNumber); #endif // !FEATURE_PAL @@ -58,7 +60,7 @@ MethodCallSummarizer::MethodCallSummarizer(WCHAR *logPath) dataFileNameLength += RandNumberLength - 1; } - dataFileName = new WCHAR[dataFileNameLength]; + dataFileName = new WCHAR[dataFileNameLength]; dataFileName[0] = 0; wcsncat_s(dataFileName, dataFileNameLength, logPath, logPathLength); wcsncat_s(dataFileName, dataFileNameLength, W("\\\0"), 1); @@ -72,49 +74,50 @@ MethodCallSummarizer::MethodCallSummarizer(WCHAR *logPath) wcsncat_s(dataFileName, dataFileNameLength, DataFileExtension, DataFileExtensionLength); } -//lots of ways will be faster.. this happens to be decently simple and good enough for the task at hand and nicely sorts the output. -//in this approach the most commonly added items are at the top of the list... 60% landed in the first three slots in short runs -void MethodCallSummarizer::AddCall(const char *name) +// lots of ways will be faster.. this happens to be decently simple and good enough for the task at hand and nicely +// sorts the output. in this approach the most commonly added items are at the top of the list... 60% landed in the first +// three slots in short runs +void MethodCallSummarizer::AddCall(const char* name) { - //if we can find it already in our list, increment the count - for(int i=0;i<numNames;i++) + // if we can find it already in our list, increment the count + for (int i = 0; i < numNames; i++) { - if(strcmp(name, names[i])==0) + if (strcmp(name, names[i]) == 0) { counts[i]++; - for(i=1;i<numNames;i++) - if(counts[i]>counts[i-1]) + for (i = 1; i < numNames; i++) + if (counts[i] > counts[i - 1]) { - unsigned int tempui = counts[i-1]; - counts[i-1] = counts[i]; - counts[i] = tempui; - char *tempc = names[i-1]; - names[i-1] = names[i]; - names[i] = tempc; + unsigned int tempui = counts[i - 1]; + counts[i - 1] = counts[i]; + counts[i] = tempui; + char* tempc = names[i - 1]; + names[i - 1] = names[i]; + names[i] = tempc; } return; } } - //else we didn't find it, so add it - char **tnames = names; - unsigned int *tcounts = counts; + // else we didn't find it, so add it + char** tnames = names; + unsigned int* tcounts = counts; - names = new char*[numNames+1]; - if(tnames!=nullptr) + names = new char*[numNames + 1]; + if (tnames != nullptr) { - memcpy(names, tnames, numNames*sizeof(char*)); + memcpy(names, tnames, numNames * sizeof(char*)); delete tnames; } - size_t tlen = strlen(name); - names[numNames] = new char[tlen+1]; - memcpy(names[numNames], name, tlen+1); + size_t tlen = strlen(name); + names[numNames] = new char[tlen + 1]; + memcpy(names[numNames], name, tlen + 1); - counts = new unsigned int[numNames+1]; - if(tcounts!=nullptr) + counts = new unsigned int[numNames + 1]; + if (tcounts != nullptr) { - memcpy(counts, tcounts, numNames*sizeof(unsigned int)); + memcpy(counts, tcounts, numNames * sizeof(unsigned int)); delete tcounts; } counts[numNames] = 1; @@ -124,16 +127,17 @@ void MethodCallSummarizer::AddCall(const char *name) void MethodCallSummarizer::SaveTextFile() { - char buff[512]; - DWORD bytesWritten = 0; - HANDLE hFile = CreateFileW(dataFileName, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL); + char buff[512]; + DWORD bytesWritten = 0; + HANDLE hFile = CreateFileW(dataFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL); - DWORD len = (DWORD)sprintf_s(buff,512,"FunctionName,Count\n"); + DWORD len = (DWORD)sprintf_s(buff, 512, "FunctionName,Count\n"); WriteFile(hFile, buff, len, &bytesWritten, NULL); - for(int i=0;i<numNames;i++) + for (int i = 0; i < numNames; i++) { - len = sprintf_s(buff,512,"%s,%u\n", names[i], counts[i]); + len = sprintf_s(buff, 512, "%s,%u\n", names[i], counts[i]); WriteFile(hFile, buff, len, &bytesWritten, NULL); } CloseHandle(hFile); diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h b/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h index 09eaaca46f..c45b631e76 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h +++ b/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h @@ -9,15 +9,15 @@ class MethodCallSummarizer { public: - MethodCallSummarizer(WCHAR *name); - void AddCall(const char *name); + MethodCallSummarizer(WCHAR* name); + void AddCall(const char* name); void SaveTextFile(); private: - char **names; - unsigned int *counts; - int numNames; - WCHAR *dataFileName; + char** names; + unsigned int* counts; + int numNames; + WCHAR* dataFileName; }; #endif
\ No newline at end of file diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp index ee47dd8c44..f838ea683f 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp +++ b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp @@ -17,12 +17,12 @@ #include "spmiutil.h" #include "jithost.h" -HMODULE g_hRealJit = 0; //We leak this currently (could do the proper shutdown in process_detach) -WCHAR* g_realJitPath = nullptr; //We leak this (could do the proper shutdown in process_detach) -WCHAR* g_logPath = nullptr; //Again, we leak this one too... -char* g_logFilePath = nullptr; //We *don't* leak this, hooray! -WCHAR* g_HomeDirectory = nullptr; -WCHAR* g_DefaultRealJitPath = nullptr; +HMODULE g_hRealJit = 0; // We leak this currently (could do the proper shutdown in process_detach) +WCHAR* g_realJitPath = nullptr; // We leak this (could do the proper shutdown in process_detach) +WCHAR* g_logPath = nullptr; // Again, we leak this one too... +char* g_logFilePath = nullptr; // We *don't* leak this, hooray! +WCHAR* g_HomeDirectory = nullptr; +WCHAR* g_DefaultRealJitPath = nullptr; void SetDefaultPaths() { @@ -33,7 +33,7 @@ void SetDefaultPaths() if (g_DefaultRealJitPath == nullptr) { - size_t len = wcslen(g_HomeDirectory) + 1 + wcslen(DEFAULT_REAL_JIT_NAME_W) + 1; + size_t len = wcslen(g_HomeDirectory) + 1 + wcslen(DEFAULT_REAL_JIT_NAME_W) + 1; g_DefaultRealJitPath = new WCHAR[len]; wcscpy_s(g_DefaultRealJitPath, len, g_HomeDirectory); wcscat_s(g_DefaultRealJitPath, len, DIRECTORY_SEPARATOR_STR_W); @@ -67,52 +67,50 @@ void SetLogFilePath() } } -extern "C" -BOOL +extern "C" BOOL #ifndef FEATURE_PAL -APIENTRY + APIENTRY #endif // !FEATURE_PAL -DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) + DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { - case DLL_PROCESS_ATTACH: + case DLL_PROCESS_ATTACH: #ifdef FEATURE_PAL - if (0 != PAL_InitializeDLL()) - { - fprintf(stderr, "Error: Fail to PAL_InitializeDLL\n"); - exit(1); - } + if (0 != PAL_InitializeDLL()) + { + fprintf(stderr, "Error: Fail to PAL_InitializeDLL\n"); + exit(1); + } #endif // FEATURE_PAL - Logger::Initialize(); - SetLogFilePath(); - Logger::OpenLogFile(g_logFilePath); - break; + Logger::Initialize(); + SetLogFilePath(); + Logger::OpenLogFile(g_logFilePath); + break; - case DLL_PROCESS_DETACH: - Logger::Shutdown(); + case DLL_PROCESS_DETACH: + Logger::Shutdown(); - delete[] g_logFilePath; - g_logFilePath = nullptr; + delete[] g_logFilePath; + g_logFilePath = nullptr; - break; + break; - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - break; + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + break; } return TRUE; } // Exported via def file -extern "C" -void __stdcall jitStartup(ICorJitHost* host) +extern "C" void __stdcall jitStartup(ICorJitHost* host) { SetDefaultPaths(); SetLibName(); - //Load Library + // Load Library if (g_hRealJit == 0) { g_hRealJit = ::LoadLibraryW(g_realJitPath); @@ -136,48 +134,47 @@ void __stdcall jitStartup(ICorJitHost* host) pnjitStartup(g_ourJitHost); } -//Exported via def file -extern "C" -ICorJitCompiler* __stdcall getJit() +// Exported via def file +extern "C" ICorJitCompiler* __stdcall getJit() { - DWORD dwRetVal = 0; - PgetJit pngetJit; - interceptor_ICJC *pJitInstance = nullptr; - ICorJitCompiler *tICJI = nullptr; + DWORD dwRetVal = 0; + PgetJit pngetJit; + interceptor_ICJC* pJitInstance = nullptr; + ICorJitCompiler* tICJI = nullptr; SetDefaultPaths(); SetLibName(); SetLogPath(); - //Load Library - if(g_hRealJit == 0) + // Load Library + if (g_hRealJit == 0) { g_hRealJit = ::LoadLibraryW(g_realJitPath); - if(g_hRealJit == 0) + if (g_hRealJit == 0) { LogError("getJit() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError()); return nullptr; } } - //get the required entrypoints + // get the required entrypoints pngetJit = (PgetJit)::GetProcAddress(g_hRealJit, "getJit"); - if(pngetJit == 0) + if (pngetJit == 0) { LogError("getJit() - GetProcAddress 'getJit' failed (0x%08x)", ::GetLastError()); return nullptr; } tICJI = pngetJit(); - if(tICJI == nullptr) + if (tICJI == nullptr) { LogError("getJit() - pngetJit gave us null"); return nullptr; } - pJitInstance = new interceptor_ICJC(); + pJitInstance = new interceptor_ICJC(); pJitInstance->original_ICorJitCompiler = tICJI; - pJitInstance->mcs = new MethodCallSummarizer(g_logPath); + pJitInstance->mcs = new MethodCallSummarizer(g_logPath); if (g_ourJitHost != nullptr) { g_ourJitHost->setMethodCallSummarizer(pJitInstance->mcs); @@ -185,42 +182,41 @@ ICorJitCompiler* __stdcall getJit() return pJitInstance; } -//Exported via def file -extern "C" -void __stdcall sxsJitStartup(CoreClrCallbacks const & original_cccallbacks) +// Exported via def file +extern "C" void __stdcall sxsJitStartup(CoreClrCallbacks const& original_cccallbacks) { PsxsJitStartup pnsxsJitStartup; SetDefaultPaths(); SetLibName(); - //Load Library - if(g_hRealJit == 0) + // Load Library + if (g_hRealJit == 0) { g_hRealJit = ::LoadLibraryW(g_realJitPath); - if(g_hRealJit == 0) + if (g_hRealJit == 0) { LogError("sxsJitStartup() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError()); return; } } - //get entry point + // get entry point pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(g_hRealJit, "sxsJitStartup"); - if(pnsxsJitStartup == 0) + if (pnsxsJitStartup == 0) { LogError("sxsJitStartup() - GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError()); return; } - //Setup CoreClrCallbacks and call sxsJitStartup - original_CoreClrCallbacks = new CoreClrCallbacks(); + // Setup CoreClrCallbacks and call sxsJitStartup + original_CoreClrCallbacks = new CoreClrCallbacks(); original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR; original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE; original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory; original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction; - CoreClrCallbacks *temp = new CoreClrCallbacks(); + CoreClrCallbacks* temp = new CoreClrCallbacks(); temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR; temp->m_pfnIEE = IEE_t; diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h index 2068a02775..5edb9263fa 100644 --- a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h +++ b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h @@ -9,5 +9,4 @@ #ifndef _SuperPMIShim #define _SuperPMIShim - #endif |