summaryrefslogtreecommitdiff
path: root/src/vm/rejit.inl
blob: 3c42bcea009516d7e860c7979c9e410dc71be41d (plain)
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ===========================================================================
// 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;

    return CORProfilerEnableRejit();
}

#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_PIN_PROFILER(CORProfilerPresent());
        _ASSERTE(CORProfilerEnableRejit());
        {
            GCX_PREEMP();
            g_profControlBlock.pProfInterface->ReJITError(
                reinterpret_cast< ModuleID > (pModule),
                methodDef,
                reinterpret_cast< FunctionID > (pMD),
                hrStatus);
        }
        END_PIN_PROFILER();
    }
#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()
{
}

#endif // FEATURE_REJIT


#endif // _REJIT_INL_