forked from dotnet/corert
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjitinterface.cpp
More file actions
103 lines (87 loc) · 2.78 KB
/
jitinterface.cpp
File metadata and controls
103 lines (87 loc) · 2.78 KB
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
// 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.
#include <stdarg.h>
#include <stdlib.h>
#include <stdint.h>
#include "dllexport.h"
#include "jitinterface.h"
static void NotImplemented()
{
abort();
}
enum CORINFO_RUNTIME_LOOKUP_KIND { };
struct CORINFO_LOOKUP_KIND
{
bool needsRuntimeLookup;
CORINFO_RUNTIME_LOOKUP_KIND runtimeLookupKind;
unsigned short runtimeLookupFlags;
void* runtimeLookupArgs;
};
int JitInterfaceWrapper::FilterException(void* pExceptionPointers)
{
NotImplemented();
return 1; // EXCEPTION_EXECUTE_HANDLER
}
void JitInterfaceWrapper::HandleException(void* pExceptionPointers)
{
NotImplemented();
}
bool JitInterfaceWrapper::runWithErrorTrap(void* function, void* parameter)
{
typedef void(*pfn)(void*);
try
{
(*(pfn)function)(parameter);
}
catch (CorInfoException *)
{
return false;
}
return true;
}
CORINFO_LOOKUP_KIND JitInterfaceWrapper::getLocationOfThisType(void* context)
{
CorInfoException* pException = nullptr;
CORINFO_LOOKUP_KIND _ret;
_callbacks->getLocationOfThisType(_thisHandle, &pException, &_ret, context);
if (pException != nullptr)
{
throw pException;
}
return _ret;
}
class EEMemoryManager
{
public:
EEMemoryManager()
{
}
virtual void __stdcall QueryInterface() { NotImplemented(); }
virtual void __stdcall AddRef() { NotImplemented(); }
virtual void __stdcall Release() { NotImplemented(); }
// JIT only ever uses IEEMemoryManager::ClrVirtualAlloc/IEEMemoryManager::ClrVirtualFree
virtual void * __stdcall ClrVirtualAlloc(void * lpAddress, size_t dwSize, uint32_t flAllocationType, uint32_t flProtect)
{
return malloc(dwSize);
}
virtual uint32_t __stdcall ClrVirtualFree(void * lpAddress, size_t dwSize, uint32_t dwFreeType)
{
free(lpAddress);
return 1;
}
virtual void __stdcall ClrVirtualQuery() { NotImplemented(); }
virtual void __stdcall ClrVirtualProtect() { NotImplemented(); }
virtual void __stdcall ClrGetProcessHeap() { NotImplemented(); }
virtual void __stdcall ClrHeapCreate() { NotImplemented(); }
virtual void __stdcall ClrHeapDestroy() { NotImplemented(); }
virtual void __stdcall ClrHeapAlloc() { NotImplemented(); }
virtual void __stdcall ClrHeapFree() { NotImplemented(); }
virtual void __stdcall ClrHeapValidate() { NotImplemented(); }
virtual void __stdcall ClrGetProcessExecutableHeap() { NotImplemented(); }
};
static EEMemoryManager eeMemoryManager;
void* JitInterfaceWrapper::getMemoryManager()
{
return &eeMemoryManager;
}