summaryrefslogtreecommitdiff
path: root/src/vm/corhost.cpp
diff options
context:
space:
mode:
authorKonstantin Baladurin <k.baladurin@samsung.com>2019-07-05 19:36:28 +0300
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>2019-10-15 06:54:39 +0900
commit5647236eac21fb0e01a55a12289a66bc9f874f19 (patch)
treef81eede622d29edc955cf9fe3d5dcb670ec95675 /src/vm/corhost.cpp
parentc4c19b84a37bbc750e2cc13570dd096b13abfff0 (diff)
downloadcoreclr-accepted/tizen/5.5/unified/mobile/hotfix/20201027.061818.tar.gz
coreclr-accepted/tizen/5.5/unified/mobile/hotfix/20201027.061818.tar.bz2
coreclr-accepted/tizen/5.5/unified/mobile/hotfix/20201027.061818.zip
Diffstat (limited to 'src/vm/corhost.cpp')
-rw-r--r--src/vm/corhost.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index be91820e6c..96ade5ca08 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -368,6 +368,47 @@ void SetCommandLineArgs(LPCWSTR pwzAssemblyPath, int argc, LPCWSTR* argv)
GCPROTECT_END();
}
+/*
+ * This method allows to preload assembly to memory and apply relocations before initialization of CoreCLR.
+ * Assemblies are stored in the list, which is scanned during general loading after CoreCLR initialization.
+ * If path is found in the list, preloaded memory is used.
+ * If CoreCLR is already initialized, it returns E_FAIL.
+ */
+HRESULT CorHost2::PreloadAssembly(LPCSTR szPath)
+{
+#ifndef FEATURE_PAL
+ // Preloading is not available without FEATURE_PAL, as it requires some PAL changes
+ return E_FAIL;
+#else
+ if (g_fEEStarted)
+ {
+ return HOST_E_INVALIDOPERATION;
+ }
+
+ void *preloadedImage = PAL_LOADPreloadPEFile(szPath);
+ if (preloadedImage == NULL)
+ {
+ return E_FAIL;
+ }
+
+ return S_OK;
+#endif
+}
+
+HRESULT CorHost2::UnloadPreloadedAssemblies()
+{
+#ifndef FEATURE_PAL
+ // Preloading is not available without FEATURE_PAL, as it requires some PAL changes
+ return E_FAIL;
+#else
+ if (!PAL_LOADUnloadPreloadedPEFiles())
+ {
+ return E_FAIL;
+ }
+ return S_OK;
+#endif
+}
+
HRESULT CorHost2::ExecuteAssembly(DWORD dwAppDomainId,
LPCWSTR pwzAssemblyPath,
int argc,