summaryrefslogtreecommitdiff
path: root/src/inc/corjithost.h
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-11-23 10:09:09 (GMT)
committerJiyoung Yun <jy910.yun@samsung.com>2016-11-23 10:09:09 (GMT)
commit4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch)
tree98110734c91668dfdbb126fcc0e15ddbd93738ca /src/inc/corjithost.h
parentfa45f57ed55137c75ac870356a1b8f76c84b229c (diff)
downloadcoreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'src/inc/corjithost.h')
-rw-r--r--src/inc/corjithost.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/inc/corjithost.h b/src/inc/corjithost.h
new file mode 100644
index 0000000..8242fab
--- /dev/null
+++ b/src/inc/corjithost.h
@@ -0,0 +1,48 @@
+// 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.
+
+#ifndef __CORJITHOST_H__
+#define __CORJITHOST_H__
+
+// ICorJitHost
+//
+// ICorJitHost provides the interface that the JIT uses to access some functionality that
+// would normally be provided by the operating system. This is intended to allow for
+// host-specific policies re: memory allocation, configuration value access, etc. It is
+// expected that the `ICorJitHost` value provided to `jitStartup` lives at least as
+// long as the JIT itself.
+class ICorJitHost
+{
+public:
+ // Allocate memory of the given size in bytes. All bytes of the returned block
+ // must be initialized to zero. If `usePageAllocator` is true, the implementation
+ // should use an allocator that deals in OS pages if one exists.
+ virtual void* allocateMemory(size_t size, bool usePageAllocator = false) = 0;
+
+ // Frees memory previous obtained by a call to `ICorJitHost::allocateMemory`. The
+ // value of the `usePageAllocator` parameter must match the value that was
+ // provided to the call to used to allocate the memory.
+ virtual void freeMemory(void* block, bool usePageAllocator = false) = 0;
+
+ // Return an integer config value for the given key, if any exists.
+ virtual int getIntConfigValue(
+ const wchar_t* name,
+ int defaultValue
+ ) = 0;
+
+ // Return a string config value for the given key, if any exists.
+ virtual const wchar_t* getStringConfigValue(
+ const wchar_t* name
+ ) = 0;
+
+ // Free a string ConfigValue returned by the runtime.
+ // JITs using the getStringConfigValue query are required
+ // to return the string values to the runtime for deletion.
+ // This avoids leaking the memory in the JIT.
+ virtual void freeStringConfigValue(
+ const wchar_t* value
+ ) = 0;
+};
+
+#endif