]
interface ICorProfilerCallback8 : ICorProfilerCallback7
{
- // This event is triggered whenever a metadata less method is jit compiled.
+ // This event is triggered whenever a dynamic method is jit compiled.
// These include various IL Stubs and LCG Methods.
// The goal is to provide profiler writers with enough information to identify
// it to users as beyond unknown code addresses.
// Note: FunctionID's provided here cannot be used to resolve to their metadata
- // tokens since LCG methods have no metadata.
+ // tokens since dynamic methods have no metadata.
//
- // Documentation Note: ilHeader is only valid during the callback
-
- HRESULT DynamicMethodJITCompilationStarted(FunctionID functionId, LPCBYTE ilHeader);
-
- HRESULT DynamicMethodJITCompilationFinished(FunctionID functionId);
+ // Documentation Note: pILHeader is only valid during the callback
+
+ HRESULT DynamicMethodJITCompilationStarted(
+ [in] FunctionID functionId,
+ [in] BOOL fIsSafeToBlock,
+ [in] LPCBYTE pILHeader,
+ [in] ULONG cbILHeader);
+
+ HRESULT DynamicMethodJITCompilationFinished(
+ [in] FunctionID functionId,
+ [in] HRESULT hrStatus,
+ [in] BOOL fIsSafeToBlock);
}
/*
* Maps a managed code instruction pointer to a FunctionID.
*
- * GetFunctionFromIP2 fails for methods without metadata, this method works for
- * both metadata and metadata-less methods and is a superset of GetFunctionFromIP2
+ * GetFunctionFromIP2 fails for dynamic methods, this method works for
+ * both dynamic and non-dynamic methods. It is a superset of GetFunctionFromIP2
*/
HRESULT GetFunctionFromIP3([in] LPCBYTE ip,
[out] FunctionID *functionId,
[out] ReJITID * pReJitId);
/*
- * Retrieves informaiton about metadata-less methods
+ * Retrieves informaiton about dynamic methods
*
- * Certain methods like IL Stubs or DynamicMethod do not have
+ * Certain methods like IL Stubs or LCG do not have
* associated metadata that can be retrieved using the IMetaDataImport APIs.
*
* Such methods can be encountered by profilers through instruction pointers
- * or by listening to ICorProfilerCallback::JITCompilationStartedNoMetadata
+ * or by listening to ICorProfilerCallback::DynamicMethodJITCompilationStarted
*
- * This API can be used to retrieve information about metadata less methods
+ * This API can be used to retrieve information about dynamic methods
* including a friendly name if available.
*/
HRESULT GetDynamicFunctionInfo( [in] FunctionID functionId,
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
- /* File created by MIDL compiler version 8.00.0613 */
+ /* File created by MIDL compiler version 8.01.0620 */
/* @@MIDL_FILE_HEADING( ) */
#pragma warning( disable: 4049 ) /* more than 64k source lines */
{
public:
virtual HRESULT STDMETHODCALLTYPE DynamicMethodJITCompilationStarted(
- FunctionID functionId,
- LPCBYTE ilHeader) = 0;
+ /* [in] */ FunctionID functionId,
+ /* [in] */ BOOL fIsSafeToBlock,
+ /* [in] */ LPCBYTE pILHeader,
+ /* [in] */ ULONG cbILHeader) = 0;
virtual HRESULT STDMETHODCALLTYPE DynamicMethodJITCompilationFinished(
- FunctionID functionId) = 0;
+ /* [in] */ FunctionID functionId,
+ /* [in] */ HRESULT hrStatus,
+ /* [in] */ BOOL fIsSafeToBlock) = 0;
};
HRESULT ( STDMETHODCALLTYPE *DynamicMethodJITCompilationStarted )(
ICorProfilerCallback8 * This,
- FunctionID functionId,
- LPCBYTE ilHeader);
+ /* [in] */ FunctionID functionId,
+ /* [in] */ BOOL fIsSafeToBlock,
+ /* [in] */ LPCBYTE pILHeader,
+ /* [in] */ ULONG cbILHeader);
HRESULT ( STDMETHODCALLTYPE *DynamicMethodJITCompilationFinished )(
ICorProfilerCallback8 * This,
- FunctionID functionId);
+ /* [in] */ FunctionID functionId,
+ /* [in] */ HRESULT hrStatus,
+ /* [in] */ BOOL fIsSafeToBlock);
END_INTERFACE
} ICorProfilerCallback8Vtbl;
( (This)->lpVtbl -> ModuleInMemorySymbolsUpdated(This,moduleId) )
-#define ICorProfilerCallback8_DynamicMethodJITCompilationStarted(This,functionId,ilHeader) \
- ( (This)->lpVtbl -> DynamicMethodJITCompilationStarted(This,functionId,ilHeader) )
+#define ICorProfilerCallback8_DynamicMethodJITCompilationStarted(This,functionId,fIsSafeToBlock,pILHeader,cbILHeader) \
+ ( (This)->lpVtbl -> DynamicMethodJITCompilationStarted(This,functionId,fIsSafeToBlock,pILHeader,cbILHeader) )
-#define ICorProfilerCallback8_DynamicMethodJITCompilationFinished(This,functionId) \
- ( (This)->lpVtbl -> DynamicMethodJITCompilationFinished(This,functionId) )
+#define ICorProfilerCallback8_DynamicMethodJITCompilationFinished(This,functionId,hrStatus,fIsSafeToBlock) \
+ ( (This)->lpVtbl -> DynamicMethodJITCompilationFinished(This,functionId,hrStatus,fIsSafeToBlock) )
#endif /* COBJMACROS */
}
}
-HRESULT EEToProfInterfaceImpl::DynamicMethodJITCompilationFinished(FunctionID functionId)
+HRESULT EEToProfInterfaceImpl::DynamicMethodJITCompilationFinished(FunctionID functionId,
+ HRESULT hrStatus,
+ BOOL fIsSafeToBlock)
{
CONTRACTL
{
_ASSERTE(functionId);
- // Should only be called on profilers that support ICorProfilerCallback8
if (m_pCallback8 == NULL)
{
- return E_FAIL;
+ return S_OK;
}
{
// All callbacks are really NOTHROW, but that's enforced partially by the profiler,
// whose try/catch blocks aren't visible to the contract system
PERMANENT_CONTRACT_VIOLATION(ThrowsViolation, ReasonProfilerCallout);
- return m_pCallback8->DynamicMethodJITCompilationFinished(functionId);
+ return m_pCallback8->DynamicMethodJITCompilationFinished(functionId, hrStatus, fIsSafeToBlock);
}
}
-HRESULT EEToProfInterfaceImpl::DynamicMethodJITCompilationStarted(FunctionID functionId, LPCBYTE ilHeader)
+HRESULT EEToProfInterfaceImpl::DynamicMethodJITCompilationStarted(FunctionID functionId,
+ BOOL fIsSafeToBlock,
+ LPCBYTE pILHeader,
+ ULONG cbILHeader)
{
CONTRACTL
{
_ASSERTE(functionId);
- // Should only be called on profilers that support ICorProfilerCallback8
+ // Currently DynamicMethodJITCompilationStarted is always called with fIsSafeToBlock==TRUE. If this ever changes,
+ // it's safe to remove this assert, but this should serve as a trigger to change our
+ // public documentation to state that this callback is no longer called in preemptive mode all the time.
+ _ASSERTE(fIsSafeToBlock);
+
if (m_pCallback8 == NULL)
{
- return E_FAIL;
+ return S_OK;
}
{
// All callbacks are really NOTHROW, but that's enforced partially by the profiler,
// whose try/catch blocks aren't visible to the contract system
PERMANENT_CONTRACT_VIOLATION(ThrowsViolation, ReasonProfilerCallout);
- return m_pCallback8->DynamicMethodJITCompilationStarted(functionId, ilHeader);
+ return m_pCallback8->DynamicMethodJITCompilationStarted(functionId, fIsSafeToBlock, pILHeader, cbILHeader);
}
}
HRESULT DynamicMethodJITCompilationStarted(
FunctionID functionId,
- LPCBYTE ilHeader);
+ BOOL fIsSafeToBlock,
+ LPCBYTE pILHeader,
+ ULONG cbILHeader);
HRESULT DynamicMethodJITCompilationFinished(
- FunctionID functionId);
+ FunctionID functionId,
+ HRESULT hrStatus,
+ BOOL fIsSafeToBlock);
HRESULT JITCachedFunctionSearchStarted(
/* [in] */ FunctionID functionId,
}
else
{
- g_profControlBlock.pProfInterface->DynamicMethodJITCompilationStarted((FunctionID) this, (LPCBYTE)ILHeader);
+ g_profControlBlock.pProfInterface->DynamicMethodJITCompilationStarted((FunctionID) this, TRUE, (LPCBYTE)ILHeader, ILHeader->GetSize());
}
END_PIN_PROFILER();
}
}
else
{
- g_profControlBlock.pProfInterface->DynamicMethodJITCompilationFinished((FunctionID) this);
+ g_profControlBlock.pProfInterface->DynamicMethodJITCompilationFinished((FunctionID) this, pEntry->m_hrResultCode, TRUE);
}
END_PIN_PROFILER();
}