1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | #ifndef _ICorJitHostImpl |
6 | #define _ICorJitHostImpl |
7 | |
8 | // ICorJitHost |
9 | // |
10 | // ICorJitHost provides the interface that the JIT uses to access some functionality that |
11 | // would normally be provided by the operating system. This is intended to allow for |
12 | // host-specific policies re: memory allocation, configuration value access, etc. It is |
13 | // expected that the `ICorJitHost` value provided to `jitStartup` lives at least as |
14 | // long as the JIT itself. |
15 | |
16 | // ICorJitHostImpl: declare for implementation all the members of the ICorJitHost interface (which are |
17 | // specified as pure virtual methods). This is done once, here, and all implementations share it, |
18 | // to avoid duplicated declarations. This file is #include'd within all the ICorJitHost implementation |
19 | // classes. |
20 | // |
21 | // NOTE: this file is in exactly the same order, with exactly the same whitespace, as the ICorJitHost |
22 | // interface declaration (with the "virtual" and "= 0" syntax removed). This is to make it easy to compare |
23 | // against the interface declaration. |
24 | |
25 | public: |
26 | // Allocate memory of the given size in bytes. |
27 | void* allocateMemory(size_t size); |
28 | |
29 | // Frees memory previous obtained by a call to `ICorJitHost::allocateMemory`. |
30 | void freeMemory(void* block); |
31 | |
32 | // Return an integer config value for the given key, if any exists. |
33 | int getIntConfigValue(const wchar_t* name, int defaultValue); |
34 | |
35 | // Return a string config value for the given key, if any exists. |
36 | const wchar_t* getStringConfigValue(const wchar_t* name); |
37 | |
38 | // Free a string ConfigValue returned by the runtime. |
39 | // JITs using the getStringConfigValue query are required |
40 | // to return the string values to the runtime for deletion. |
41 | // This avoids leaking the memory in the JIT. |
42 | void freeStringConfigValue(const wchar_t* value); |
43 | |
44 | #endif |
45 | |