diff options
author | dotnet-bot <dotnet-bot@microsoft.com> | 2015-01-30 14:14:42 -0800 |
---|---|---|
committer | dotnet-bot <dotnet-bot@microsoft.com> | 2015-01-30 14:14:42 -0800 |
commit | ef1e2ab328087c61a6878c1e84f4fc5d710aebce (patch) | |
tree | dee1bbb89e9d722e16b0d1485e3cdd1b6c8e2cfa /src/vm/eetoprofinterfaceimpl.inl | |
download | coreclr-ef1e2ab328087c61a6878c1e84f4fc5d710aebce.tar.gz coreclr-ef1e2ab328087c61a6878c1e84f4fc5d710aebce.tar.bz2 coreclr-ef1e2ab328087c61a6878c1e84f4fc5d710aebce.zip |
Initial commit to populate CoreCLR repo
[tfs-changeset: 1407945]
Diffstat (limited to 'src/vm/eetoprofinterfaceimpl.inl')
-rw-r--r-- | src/vm/eetoprofinterfaceimpl.inl | 253 |
1 files changed, 253 insertions, 0 deletions
diff --git a/src/vm/eetoprofinterfaceimpl.inl b/src/vm/eetoprofinterfaceimpl.inl new file mode 100644 index 0000000000..c2c98f9a63 --- /dev/null +++ b/src/vm/eetoprofinterfaceimpl.inl @@ -0,0 +1,253 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// +// +// EEToProfInterfaceImpl.inl +// + +// +// Inline implementation of portions of the code that wraps calling into +// the profiler's implementation of ICorProfilerCallback* +// + +// ====================================================================================== + +#ifndef __EETOPROFINTERFACEIMPL_INL__ +#define __EETOPROFINTERFACEIMPL_INL__ + +#include "profilepriv.h" +#include "profilepriv.inl" +#include "simplerwlock.hpp" + +// ---------------------------------------------------------------------------- +// EEToProfInterfaceImpl::IsCallback3Supported +// +// Description: +// Returns BOOL indicating whether the profiler implements +// ICorProfilerCallback3. +// + +inline BOOL EEToProfInterfaceImpl::IsCallback3Supported() +{ + LIMITED_METHOD_CONTRACT; + return (m_pCallback3 != NULL); +} + +// ---------------------------------------------------------------------------- +// EEToProfInterfaceImpl::IsCallback4Supported +// +// Description: +// Returns BOOL indicating whether the profiler implements +// ICorProfilerCallback4. +// + +inline BOOL EEToProfInterfaceImpl::IsCallback4Supported() +{ + LIMITED_METHOD_CONTRACT; + return (m_pCallback4 != NULL); +} + +inline BOOL EEToProfInterfaceImpl::IsCallback5Supported() +{ + LIMITED_METHOD_CONTRACT; + return (m_pCallback5 != NULL); +} + +inline BOOL EEToProfInterfaceImpl::IsCallback6Supported() +{ + LIMITED_METHOD_CONTRACT; + return (m_pCallback6 != NULL); +} + +inline FunctionIDMapper * EEToProfInterfaceImpl::GetFunctionIDMapper() +{ + LIMITED_METHOD_CONTRACT; + return m_pProfilersFuncIDMapper; +} + +inline FunctionIDMapper2 * EEToProfInterfaceImpl::GetFunctionIDMapper2() +{ + LIMITED_METHOD_CONTRACT; + return m_pProfilersFuncIDMapper2; +} + +inline void EEToProfInterfaceImpl::SetFunctionIDMapper(FunctionIDMapper * pFunc) +{ + LIMITED_METHOD_CONTRACT; + m_pProfilersFuncIDMapper = pFunc; +} + +inline void EEToProfInterfaceImpl::SetFunctionIDMapper2(FunctionIDMapper2 * pFunc, void * clientData) +{ + LIMITED_METHOD_CONTRACT; + m_pProfilersFuncIDMapper2 = pFunc; + m_pProfilersFuncIDMapper2ClientData = clientData; +} + +inline BOOL EEToProfInterfaceImpl::IsLoadedViaAttach() +{ + LIMITED_METHOD_CONTRACT; + return m_fLoadedViaAttach; +} + +inline void EEToProfInterfaceImpl::SetUnrevertiblyModifiedILFlag() +{ + LIMITED_METHOD_CONTRACT; + m_fUnrevertiblyModifiedIL = TRUE; +} + +inline FunctionEnter * EEToProfInterfaceImpl::GetEnterHook() +{ + LIMITED_METHOD_CONTRACT; + return m_pEnter; +} + +inline FunctionLeave * EEToProfInterfaceImpl::GetLeaveHook() +{ + LIMITED_METHOD_CONTRACT; + return m_pLeave; +} + +inline FunctionTailcall * EEToProfInterfaceImpl::GetTailcallHook() +{ + LIMITED_METHOD_CONTRACT; + return m_pTailcall; +} + +inline FunctionEnter2 * EEToProfInterfaceImpl::GetEnter2Hook() +{ + LIMITED_METHOD_CONTRACT; + return m_pEnter2; +} + +inline FunctionLeave2 * EEToProfInterfaceImpl::GetLeave2Hook() +{ + LIMITED_METHOD_CONTRACT; + return m_pLeave2; +} + +inline FunctionTailcall2 * EEToProfInterfaceImpl::GetTailcall2Hook() +{ + LIMITED_METHOD_CONTRACT; + return m_pTailcall2; +} + +inline FunctionEnter3 * EEToProfInterfaceImpl::GetEnter3Hook() +{ + LIMITED_METHOD_CONTRACT; + return m_pEnter3; +} + +inline FunctionLeave3 * EEToProfInterfaceImpl::GetLeave3Hook() +{ + LIMITED_METHOD_CONTRACT; + return m_pLeave3; +} + +inline FunctionTailcall3 * EEToProfInterfaceImpl::GetTailcall3Hook() +{ + LIMITED_METHOD_CONTRACT; + return m_pTailcall3; +} + +inline FunctionEnter3WithInfo * EEToProfInterfaceImpl::GetEnter3WithInfoHook() +{ + LIMITED_METHOD_CONTRACT; + return m_pEnter3WithInfo; +} + +inline FunctionLeave3WithInfo * EEToProfInterfaceImpl::GetLeave3WithInfoHook() +{ + LIMITED_METHOD_CONTRACT; + return m_pLeave3WithInfo; +} + +inline FunctionTailcall3WithInfo * EEToProfInterfaceImpl::GetTailcall3WithInfoHook() +{ + LIMITED_METHOD_CONTRACT; + return m_pTailcall3WithInfo; +} + +inline BOOL EEToProfInterfaceImpl::IsClientIDToFunctionIDMappingEnabled() +{ + LIMITED_METHOD_CONTRACT; + return m_fIsClientIDToFunctionIDMappingEnabled; +} + +//--------------------------------------------------------------------------------------- +// +// Lookup the clientID for a given functionID +// +// Arguments: +// functionID +// +// Return Value: +// If found a match, return clientID; Otherwise return NULL. +// +inline UINT_PTR EEToProfInterfaceImpl::LookupClientIDFromCache(FunctionID functionID) +{ + CONTRACTL + { + SO_NOT_MAINLINE; + NOTHROW; + GC_NOTRIGGER; + MODE_COOPERATIVE; + } CONTRACTL_END; + + _ASSERTE(functionID != NULL); + + SimpleReadLockHolder readLockHolder(m_pFunctionIDHashTableRWLock); + const FunctionIDAndClientID * entry = m_pFunctionIDHashTable->LookupPtr(functionID); + + // entry can be NULL when OOM happens. + if (entry != NULL) + { + return entry->clientID; + } + else + { + return NULL; + } +} + +//--------------------------------------------------------------------------------------- +// +// Returns whether the profiler chose options that require the JIT to compile with the +// CORINFO_GENERICS_CTXT_KEEP_ALIVE flag. +// +// Return Value: +// Nonzero iff the JIT should compile with CORINFO_GENERICS_CTXT_KEEP_ALIVE. +// + +inline BOOL EEToProfInterfaceImpl::RequiresGenericsContextForEnterLeave() +{ + CONTRACTL + { + NOTHROW; + GC_NOTRIGGER; + CANNOT_TAKE_LOCK; + } + CONTRACTL_END; + + return + CORProfilerPresent() && + ((g_profControlBlock.dwEventMask & COR_PRF_ENABLE_FRAME_INFO) != 0) && + ( + (m_pEnter2 != NULL) || + (m_pLeave2 != NULL) || + (m_pTailcall2 != NULL) || + (m_pEnter3WithInfo != NULL) || + (m_pLeave3WithInfo != NULL) || + (m_pTailcall3WithInfo != NULL) + ); +} + +inline BOOL EEToProfInterfaceImpl::HasTimedOutWaitingForConcurrentGC() +{ + LIMITED_METHOD_CONTRACT; + return m_bHasTimedOutWaitingForConcurrentGC; +} + +#endif // __EETOPROFINTERFACEIMPL_INL__ + |