forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrejit.inl
111 lines (91 loc) · 2.66 KB
/
rejit.inl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// ===========================================================================
// File: REJIT.INL
//
//
// Inline definitions of various items declared in REJIT.H
// ===========================================================================
#ifndef _REJIT_INL_
#define _REJIT_INL_
#ifdef FEATURE_REJIT
// static
inline void ReJitManager::InitStatic()
{
STANDARD_VM_CONTRACT;
s_csGlobalRequest.Init(CrstReJITGlobalRequest);
}
// static
inline BOOL ReJitManager::IsReJITEnabled()
{
LIMITED_METHOD_CONTRACT;
static bool profilerStartupRejit = CORProfilerEnableRejit() != FALSE;
static ConfigDWORD rejitOnAttachEnabled;
return profilerStartupRejit || (rejitOnAttachEnabled.val(CLRConfig::EXTERNAL_ProfAPI_RejitOnAttach) != 0);
}
inline BOOL ReJitManager::IsReJITInlineTrackingEnabled()
{
LIMITED_METHOD_CONTRACT;
static ConfigDWORD rejitInliningEnabled;
return rejitInliningEnabled.val(CLRConfig::EXTERNAL_ProfAPI_RejitOnAttach) != 0;
}
#ifndef DACCESS_COMPILE
//static
inline void ReJitManager::ReportReJITError(CodeVersionManager::CodePublishError* pErrorRecord)
{
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
CAN_TAKE_LOCK;
MODE_ANY;
}
CONTRACTL_END;
ReportReJITError(pErrorRecord->pModule, pErrorRecord->methodDef, pErrorRecord->pMethodDesc, pErrorRecord->hrStatus);
}
// static
inline void ReJitManager::ReportReJITError(Module* pModule, mdMethodDef methodDef, MethodDesc* pMD, HRESULT hrStatus)
{
#ifdef PROFILING_SUPPORTED
CONTRACTL
{
NOTHROW;
GC_TRIGGERS;
CAN_TAKE_LOCK;
MODE_ANY;
}
CONTRACTL_END;
{
BEGIN_PROFILER_CALLBACK(CORProfilerEnableRejit());
_ASSERTE(CORProfilerEnableRejit());
{
GCX_PREEMP();
(&g_profControlBlock)->mainProfilerInfo.pProfInterface->ReJITError(
reinterpret_cast< ModuleID > (pModule),
methodDef,
reinterpret_cast< FunctionID > (pMD),
hrStatus);
}
END_PROFILER_CALLBACK();
}
#endif // PROFILING_SUPPORTED
}
#endif // DACCESS_COMPILE
#else // FEATURE_REJIT
// On architectures that don't support rejit, just keep around some do-nothing
// stubs so the rest of the VM doesn't have to be littered with #ifdef FEATURE_REJIT
// static
inline BOOL ReJitManager::IsReJITEnabled()
{
return FALSE;
}
// static
inline void ReJitManager::InitStatic()
{
}
inline BOOL ReJitManager::IsReJITInlineTrackingEnabled()
{
return FALSE;
}
#endif // FEATURE_REJIT
#endif // _REJIT_INL_