Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ICodeManager.h « Runtime « Native « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: efd5054d284fedbec47427d69461530e63c98e1b (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// 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.
#pragma once

// TODO: Debugger/DAC support (look for TODO: JIT)

struct REGDISPLAY;

#define GC_CALL_INTERIOR            0x1
#define GC_CALL_PINNED              0x2
#define GC_CALL_CHECK_APP_DOMAIN    0x4
#define GC_CALL_STATIC              0x8

typedef void (*GCEnumCallback)(
    void *              hCallback,      // callback data
    PTR_PTR_VOID        pObject,        // address of object-reference we are reporting
    UInt32              flags           // is this a pinned and/or interior pointer
);

struct GCEnumContext
{
    GCEnumCallback pCallback;
};

enum GCRefKind : unsigned char
{ 
    GCRK_Scalar     = 0x00,
    GCRK_Object     = 0x01,
    GCRK_Byref      = 0x02,
    GCRK_Unknown    = 0xFF,
};

//
// MethodInfo is placeholder type used to allocate space for MethodInfo. Maximum size 
// of the actual method should be less or equal to the placeholder size.
// It avoids memory allocation during stackwalk.
//
class MethodInfo
{
    TADDR dummyPtrs[5];
    Int32 dummyInts[8];
};

class EHEnumState
{
    TADDR dummyPtrs[2];
    Int32 dummyInts[2];
};

enum EHClauseKind
{
    EH_CLAUSE_TYPED = 0,
    EH_CLAUSE_FAULT = 1,
    EH_CLAUSE_FILTER = 2,
    EH_CLAUSE_UNUSED = 3,
};

struct EHClause
{
    EHClauseKind m_clauseKind;
    UInt32 m_tryStartOffset;
    UInt32 m_tryEndOffset;
    UInt8* m_filterAddress;
    UInt8* m_handlerAddress;
    void* m_pTargetType;
};

// Constants used with RhpGetClasslibFunction, to indicate which classlib function
// we are interested in. 
// Note: make sure you change the def in System\Runtime\exceptionhandling.cs if you change this!
enum class ClasslibFunctionId
{
    GetRuntimeException = 0,
    FailFast = 1,
    UnhandledExceptionHandler = 2,
    AppendExceptionStackFrame = 3,
    CheckStaticClassConstruction = 4,
    GetSystemArrayEEType = 5,
    OnFirstChanceException = 6,
};

enum class AssociatedDataFlags : unsigned char
{
    None = 0,
    HasUnboxingStubTarget = 1,
};

class ICodeManager
{
public:
    virtual bool FindMethodInfo(PTR_VOID        ControlPC, 
                                MethodInfo *    pMethodInfoOut) = 0;

    virtual bool IsFunclet(MethodInfo * pMethodInfo) = 0;

    virtual PTR_VOID GetFramePointer(MethodInfo *   pMethodInfo,
                                     REGDISPLAY *   pRegisterSet) = 0;

    virtual void EnumGcRefs(MethodInfo *    pMethodInfo, 
                            PTR_VOID        safePointAddress,
                            REGDISPLAY *    pRegisterSet,
                            GCEnumContext * hCallback) = 0;

    virtual bool UnwindStackFrame(MethodInfo *    pMethodInfo,
                                  REGDISPLAY *    pRegisterSet,                     // in/out
                                  PTR_VOID *      ppPreviousTransitionFrame) = 0;   // out

    virtual UIntNative GetConservativeUpperBoundForOutgoingArgs(MethodInfo *   pMethodInfo,
                                                                REGDISPLAY *   pRegisterSet) = 0;

    virtual bool GetReturnAddressHijackInfo(MethodInfo *    pMethodInfo,
                                            REGDISPLAY *    pRegisterSet,           // in
                                            PTR_PTR_VOID *  ppvRetAddrLocation,     // out
                                            GCRefKind *     pRetValueKind) = 0;     // out

    virtual void UnsynchronizedHijackMethodLoops(MethodInfo * pMethodInfo) = 0;

    virtual PTR_VOID RemapHardwareFaultToGCSafePoint(MethodInfo * pMethodInfo, PTR_VOID controlPC) = 0;

    virtual bool EHEnumInit(MethodInfo * pMethodInfo, PTR_VOID * pMethodStartAddress, EHEnumState * pEHEnumState) = 0;

    virtual bool EHEnumNext(EHEnumState * pEHEnumState, EHClause * pEHClause) = 0;

    virtual PTR_VOID GetMethodStartAddress(MethodInfo * pMethodInfo) = 0;

    virtual PTR_VOID GetOsModuleHandle() = 0;

    virtual void * GetClasslibFunction(ClasslibFunctionId functionId) = 0;

    // Returns any custom data attached to the method. Format:
    //      AssociatedDataFlags        // 1 byte. Flags describing the data stored
    //      Data (stream of bytes)     // Variable size (depending on flags). Custom data associated with method
    virtual PTR_VOID GetAssociatedData(PTR_VOID ControlPC) = 0;
};