summaryrefslogtreecommitdiff
path: root/src/zap
diff options
context:
space:
mode:
authordanmosemsft <danmose@microsoft.com>2017-02-10 17:12:53 -0800
committerdanmosemsft <danmose@microsoft.com>2017-02-10 21:36:06 -0800
commit54891e0650e69f08832f75a40dc102efc6115d38 (patch)
tree0e032a0b337767801f696cbaeacded267c694f32 /src/zap
parent396f7d43b3c0f3ca7034a6d1d9cd7d6914778a1e (diff)
downloadcoreclr-54891e0650e69f08832f75a40dc102efc6115d38.tar.gz
coreclr-54891e0650e69f08832f75a40dc102efc6115d38.tar.bz2
coreclr-54891e0650e69f08832f75a40dc102efc6115d38.zip
Remove always defined FEATURE_CORECLR
Diffstat (limited to 'src/zap')
-rw-r--r--src/zap/common.h3
-rw-r--r--src/zap/svcworker.cpp820
-rw-r--r--src/zap/zapimage.cpp99
-rw-r--r--src/zap/zapinfo.cpp29
-rw-r--r--src/zap/zapper.cpp236
5 files changed, 10 insertions, 1177 deletions
diff --git a/src/zap/common.h b/src/zap/common.h
index b3db657f87..777c4e9b94 100644
--- a/src/zap/common.h
+++ b/src/zap/common.h
@@ -50,9 +50,6 @@
#include "guidfromname.h"
#include "../dlls/mscorrc/resource.h"
#include "zaplog.h"
-#ifndef FEATURE_CORECLR
-#include "eventmsg.h"
-#endif // FEATURE_CORECLR
#include "ndpversion.h"
#include "loaderheap.h"
diff --git a/src/zap/svcworker.cpp b/src/zap/svcworker.cpp
index 001345ce1c..e5ddcf9f08 100644
--- a/src/zap/svcworker.cpp
+++ b/src/zap/svcworker.cpp
@@ -201,60 +201,6 @@ ICorSvcLogger* SvcLogger::GetSvcLogger()
return pCorSvcLogger;
}
-#ifndef FEATURE_CORECLR
-
-void InitNGenOptions(NGenOptions *ngo,
- NGenPrivateAttributes ngenPrivateAttributes,
- OptimizationScenario optScenario = ScenarioDefault,
- LPCWSTR lpszRepositoryDir = NULL, RepositoryFlags repositoryFlags = RepositoryDefault)
-{
- ULONG_PTR pScenario = (ULONG_PTR) optScenario;
-
- ngo->dwSize = sizeof(NGenOptions);
-
- // V1
- //
- ngo->fDebug = (pScenario & ScenarioDebug) ? true : false;
- ngo->fDebugOpt = false;
- ngo->fProf = (pScenario & ScenarioProfile) ? true : false;
- ngo->fSilent = false;
- ngo->lpszExecutableFileName = NULL;
-
- // V2 (Whidbey)
- //
- ngo->fInstrument = (pScenario & ScenarioTuningDataCollection) ? true : false;
- ngo->fWholeProgram = false;
- ngo->fProfInfo = (pScenario & ScenarioProfileInfo) ? true : false;
-
- ngo->lpszRepositoryDir = lpszRepositoryDir;
- ngo->repositoryFlags = repositoryFlags;
-
- ngo->dtRequested = DT_NIL;
- ngo->lpszDebugDir = NULL;
-
- ngo->fNoInstall = false;
- ngo->fEmitFixups = false;
- ngo->fFatHeaders = false;
- ngo->fVerbose = false;
-
- // This should be a value from the StatOptions enumeration
- ngo->uStats = ngenPrivateAttributes.ZapStats;
- ngo->dtRequested = (ngenPrivateAttributes.Flags & DbgTypePdb) ? DT_PDB : DT_NIL;
- ngo->lpszDebugDir = ngenPrivateAttributes.DbgDir;
-
-
- // V4
- //
- ngo->fNgenLastRetry = (pScenario & ScenarioNgenLastRetry) ? true : false;
-
- // V4.5
- ngo->fAutoNGen = (pScenario & ScenarioAutoNGen) ? true : false;
-
- // Blue
- ngo->fRepositoryOnly = (pScenario & ScenarioRepositoryOnly) ? true : false;
-}
-
-#endif // !FEATURE_CORECLR
namespace
{
@@ -288,769 +234,3 @@ void SetSvcLogger(ICorSvcLogger *pCorSvcLogger)
}
#endif
-#ifndef FEATURE_CORECLR
-
-//*****************************************************************************
-// ICorSvcDependencies is used to enumerate the dependencies of an
-// IL image. It is used by the native image service.
-//*****************************************************************************[
-class CCorSvcDependencies : public ICorSvcDependencies
-{
-public:
- CCorSvcDependencies()
- {
- _cRef = 0;
- zapper = NULL;
-
- g_pLocalServerLifetime->AddRefServerProcess();
- }
-
- ~CCorSvcDependencies()
- {
- if (zapper != NULL)
- {
- delete zapper;
- }
-
- g_pLocalServerLifetime->ReleaseServerProcess();
- }
-
- void Initialize(BSTR pApplicationName, OptimizationScenario scenario)
- {
- NGenOptions opt = {0};
- NGenPrivateAttributesClass ngenPrivateAttributesClass;
- InitNGenOptions(&opt, ngenPrivateAttributesClass, scenario);
- opt.lpszExecutableFileName = pApplicationName;
- zapper = Zapper::NewZapper(&opt, true);
- zapper->CreateDependenciesLookupDomain();
- }
-
- STDMETHOD (GetAssemblyDependencies)(
- BSTR pAssemblyName,
- SAFEARRAY **pDependencies,
- DWORD *assemblyNGenSetting,
- BSTR *pNativeImageIdentity,
- BSTR *pAssemblyDisplayName,
- SAFEARRAY **pDependencyLoadSetting,
- SAFEARRAY **pDependencyNGenSetting
- )
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- _ASSERTE(zapper != NULL);
- _ASSERTE(pNativeImageIdentity);
-
- HRESULT hr = S_OK;
- EX_TRY
- {
- GUID nativeImageSign = INVALID_NGEN_SIGNATURE;
- zapper->ComputeDependencies(pAssemblyName, &nativeImageSign);
-
- BSTRHolder displayNameHolder(::SysAllocString(zapper->m_assemblyDependencies.GetDisplayName()));
-
- *pDependencies = zapper->m_assemblyDependencies.GetSAFEARRAY();
- *assemblyNGenSetting = zapper->m_assemblyDependencies.GetNGenHint();
- *pDependencyLoadSetting = zapper->m_assemblyDependencies.GetLoadHintSAFEARRAY();
- *pDependencyNGenSetting = zapper->m_assemblyDependencies.GetNGenHintSAFEARRAY();
-
- if (nativeImageSign != INVALID_NGEN_SIGNATURE)
- {
- WCHAR szGuid[64];
- if (GuidToLPWSTR(nativeImageSign, szGuid, sizeof(szGuid) / sizeof(WCHAR)) == 0)
- {
- ThrowHR(E_UNEXPECTED);
- }
- *pNativeImageIdentity = ::SysAllocString(szGuid);
- }
-
- *pAssemblyDisplayName = displayNameHolder.Extract();
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
- STDMETHODIMP_(ULONG) AddRef()
- {
- return InterlockedIncrement (&_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release()
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- ULONG lRet = InterlockedDecrement (&_cRef);
- if (!lRet)
- delete this;
- return lRet;
- }
-
- STDMETHODIMP QueryInterface(REFIID riid,void ** ppv)
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- if (!ppv)
- return E_POINTER;
-
- if (IsEqualIID(riid, IID_IUnknown) ||
- IsEqualIID(riid, IID_ICorSvcDependencies))
- {
- *ppv = static_cast<ICorSvcDependencies*> (this);
- AddRef();
- return S_OK;
- }
- else
- {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- }
-
-private:
- LONG _cRef;
- Zapper *zapper;
-};
-
-//*****************************************************************************
-// CCorSvcCreatePdbWorker is used to load the CLR, initialize an appdomain,
-// load the given assembly and create a PDB for it.
-//*****************************************************************************
-class CCorSvcCreatePdbWorker {
-
-public:
-
- CCorSvcCreatePdbWorker()
- : m_pZapper(NULL)
- {
- }
-
- ~CCorSvcCreatePdbWorker()
- {
- if (m_pZapper)
- delete m_pZapper;
- }
-
- void Initialize(BSTR pAppBaseOrConfig, OptimizationScenario scenario)
- {
- _ASSERTE(m_pZapper == NULL);
-
- NGenOptions options = {0};
- NGenPrivateAttributesClass privateAttributesClass;
-
- InitNGenOptions(&options, privateAttributesClass, scenario);
- options.lpszExecutableFileName = pAppBaseOrConfig;
- m_pZapper = Zapper::NewZapper(&options, true);
- m_pZapper->CreateDependenciesLookupDomain();
- }
-
-
- HRESULT CreatePdb(BSTR pAssemblyName, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath)
- {
- SO_NOT_MAINLINE_FUNCTION;
- _ASSERTE(m_pZapper);
-
- HRESULT hr = S_OK;
- EX_TRY {
-
- m_pZapper->CreatePdb(pAssemblyName, pNativeImagePath, pPdbPath, pdbLines, pManagedPdbSearchPath);
-
- } EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
-private:
-
- Zapper *m_pZapper;
-
-};
-
-#ifdef _DEBUG
- inline void DoFreeEnvironmentStrings(LPTCH lpszEnvironmentBlock)
- {
- WszFreeEnvironmentStrings(lpszEnvironmentBlock);
- }
- typedef Wrapper<LPTCH, DoNothing, DoFreeEnvironmentStrings> EnvHolder;
-#endif //_DEBUG
-
-//*****************************************************************************
-// ICorSvcWorker contains methods for generating native images and enumerating
-// their dependencies.
-//*****************************************************************************[
-class CCorSvcWorker :
- public ICorSvcWorker3,
- public ICorSvcRepository,
- public ICorSvcSetPrivateAttributes,
-#ifdef FEATURE_APPX
- public ICorSvcAppX,
-#endif
- public ICorSvcPooledWorker
-{
-public:
- CCorSvcWorker() :
- _cRef(0),
- repositoryDir(NULL),
- repositoryFlags(RepositoryDefault),
- ngenPrivateAttributesClass()
-
-#ifdef FEATURE_FUSION
- ,
- pAssemblyCache(NULL)
-#endif
- {
- g_pLocalServerLifetime->AddRefServerProcess();
- }
-
- ~CCorSvcWorker()
- {
-#ifdef FEATURE_FUSION
- if (pAssemblyCache != NULL)
- {
- pAssemblyCache->Release();
- pAssemblyCache = NULL;
- }
-#endif
-
- GetSvcLogger()->ReleaseLogger();
-
- g_pLocalServerLifetime->ReleaseServerProcess();
- }
-
- STDMETHOD (SetPriority)(
- /*[in]*/ SvcWorkerPriority priority
- )
- {
- HRESULT hr = E_FAIL;
-
- // Set ourselves to the priority
- if (::SetPriorityClass(GetCurrentProcess(), priority.dwPriorityClass) == FALSE)
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- goto DONE;
- }
-
- hr = S_OK;
- DONE:
- return hr;
- }
-
-#ifdef _DEBUG
- void Debug_CheckPPLProcessStatus(
- LPCWSTR wszAssemblyName)
- {
- size_t cchAssemblyName = wcslen(wszAssemblyName);
-
- // Check if we are in PPL (Protected Process Lightweight) by checking existence of LOCALAPPDATA env. var. (it is not present in PPL)
- BOOL fIsProcessPPL = TRUE;
- EnvHolder pEnvironmentStrings(WszGetEnvironmentStrings());
- for (LPTCH pEnv = pEnvironmentStrings; ((pEnv != NULL) && (*pEnv != W('\0'))); pEnv += wcslen(pEnv) + 1)
- {
- static const WCHAR const_wszLocalAppData[] = W("LOCALAPPDATA=");
- static const size_t const_cchLocalAppData = _countof(const_wszLocalAppData) - 1;
- if (_wcsnicmp(pEnv, const_wszLocalAppData, const_cchLocalAppData) == 0)
- { // LOCALAPPDATA is never set in PPL process
- fIsProcessPPL = FALSE;
- break;
- }
- }
-
- // Semicolon-separated list of names that should assert a failure
- NewArrayHolder<WCHAR> wszAssertList = NULL;
- if (fIsProcessPPL)
- { // If we are in PPL, we should assert for assemblies that are fobidden to be ngen'd in PPL
- CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenProtectedProcess_ForbiddenList, &wszAssertList);
- }
- else
- { // If we are not in PPL, we should assert for assemblies that require to be ngen'd in PPL
- CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenProtectedProcess_RequiredList, &wszAssertList);
- }
-
- if ((wszAssertList != NULL) && (*wszAssertList != W('\0')))
- {
- LPCWSTR pAssertListName = wszAssertList;
- for (;;)
- {
- LPCWSTR pAssertListNameEnd = wcschr(pAssertListName, W(';'));
- size_t cchAssertListName;
- if (pAssertListNameEnd == NULL)
- { // There is not another semicolon
- cchAssertListName = wcslen(pAssertListName);
- }
- else
- {
- cchAssertListName = pAssertListNameEnd - pAssertListName;
- }
-
- if ((cchAssertListName > 0) && (cchAssertListName <= cchAssemblyName))
- {
- // Check prefix or suffix of assembly name (which is either file name or assembly identity name)
- if ((_wcsnicmp(wszAssemblyName, pAssertListName, cchAssertListName) == 0) ||
- (_wcsnicmp(wszAssemblyName + cchAssemblyName - cchAssertListName, pAssertListName, cchAssertListName) == 0))
- {
- if (fIsProcessPPL)
- {
- _ASSERTE_MSG(FALSE, "Assembly that is in NGenProtectedProcess_ForbiddenList is ngen'd in PPL process!");
- }
- else
- {
- _ASSERTE_MSG(FALSE, "Assembly that is in NGenProtectedProcess_RequiredList is ngen'd in normal (non-PPL) process!");
- }
- }
- }
-
- if (pAssertListNameEnd == NULL)
- { // There are no more names in the semicolon-separated list
- break;
- }
-
- // Move to next item in the semicolon-separated list (skip also the semicolon)
- pAssertListName = pAssertListNameEnd + 1;
- }
- }
- } // Debug_CheckPPLProcessStatus
-#endif //_DEBUG
-
- STDMETHOD (OptimizeAssembly)(
- BSTR pAssemblyName,
- BSTR pApplicationName,
- OptimizationScenario scenario,
- SAFEARRAY *loadAlwaysList,
- SAFEARRAY *loadSometimesList,
- SAFEARRAY *loadNeverList,
- BSTR *pNativeImageIdentity
- )
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- INDEBUG(Debug_CheckPPLProcessStatus(pAssemblyName);)
-
- HRESULT hr = S_OK;
- EX_TRY
- {
-#if defined(_DEBUG) || defined(ALLOW_LOCAL_WORKER)
- // Make sure optimize is called only once per process
- static int OptimizeCount = 0;
-#ifdef ALLOW_LOCAL_WORKER
- if (OptimizeCount != 0)
- {
- GetSvcLogger()->Printf(W("You cannot call OptimizeAssembly twice. If you are using COMPlus_NgenLocalWorker, make sure you are only optimizing one assembly.\r\n"));
- ThrowHR(E_FAIL);
- }
-#else // _DEBUG
- _ASSERTE(OptimizeCount == 0);
-#endif
- OptimizeCount++;
-#endif
-
- NGenOptions opt = {0};
- InitNGenOptions(&opt, ngenPrivateAttributesClass, scenario, repositoryDir, repositoryFlags);
- opt.lpszExecutableFileName = pApplicationName;
-
- GUID nativeImageSign;
- bool hasProfileData;
-
- hr = ZapperCompileWrapper(pAssemblyName, &opt, &nativeImageSign,
- loadAlwaysList, loadSometimesList, loadNeverList,
- true, &hasProfileData);
-#if 0
- // Unfotunately we can't perform a retry here as the Zapper currently
- // allocates and initializes some things once CompilationDomain and
- // thus some of this stuff will leak from the failed complation.
- //
- if (FAILED(hr) && hasProfileData && retryNgenFailures)
- {
- hr = ZapperCompileWrapper(pAssemblyName, &opt, &nativeImageSign,
- loadAlwaysList, loadSometimesList, loadNeverList,
- false, NULL);
- if (SUCCEEDED(hr))
- {
- StackSString msg;
- msg.Printf(W("The compile failed when the profile data was used and ")
- W("the compile succeeded when the profile data was ignored."));
- GetSvcLogger()->Log(msg, LogLevel_Info);
- }
- }
-#endif
- IfFailThrow(hr);
-
- _ASSERTE(nativeImageSign != INVALID_NGEN_SIGNATURE || opt.fRepositoryOnly);
-
- _ASSERTE(pNativeImageIdentity);
- if (nativeImageSign != INVALID_NGEN_SIGNATURE)
- {
- WCHAR szGuid[64];
- if (GuidToLPWSTR(nativeImageSign, szGuid, sizeof(szGuid) / sizeof(WCHAR)) == 0)
- ThrowHR(E_UNEXPECTED);
- *pNativeImageIdentity = ::SysAllocString(szGuid);
- }
- else
- {
- *pNativeImageIdentity = NULL;
- }
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
- STDMETHOD (DeleteNativeImage)(
- BSTR pAssemblyName,
- BSTR pNativeImage
- )
- {
- // The caller must either specify both parameters, or specify neither.
- _ASSERTE((pAssemblyName == NULL && pNativeImage == NULL) ||
- (pAssemblyName != NULL && pNativeImage != NULL));
-
- HRESULT hr = S_OK;
- EX_TRY
- {
- NGenOptions opt = {0};
- InitNGenOptions(&opt, ngenPrivateAttributesClass);
- NewHolder<Zapper> zapper = Zapper::NewZapper(&opt, true);
- _ASSERTE(zapper != NULL);
-
- GUID *pNativeImageMVID = NULL;
- GUID nativeImageMVID;
-
- if (pNativeImage)
- {
- StackSString nativeImageString(pNativeImage);
- StackScratchBuffer buffer;
- LPCSTR pstr = nativeImageString.GetANSI(buffer);
- IfFailThrow(LPCSTRToGuid((LPCSTR) pstr, &nativeImageMVID));
- pNativeImageMVID = &nativeImageMVID;
- }
-
-#ifdef FEATURE_FUSION
- if (pAssemblyName != NULL && pNativeImageMVID != NULL)
- {
- // Deleting a specific native image.
- zapper->DeleteFusionCacheEntry(pAssemblyName, pNativeImageMVID);
- }
- else if (pAssemblyName != NULL || pNativeImageMVID != NULL)
- {
- hr = E_UNEXPECTED;
- }
- else
- {
- // Not deleting a specific native image. Need to enumerate NIC.
- IfFailThrow(zapper->EnumerateFusionCache(NULL, false, true, NULL));
- }
-#else //FEATURE_FUSION
- _ASSERTE(!"NYI");
-#endif //FEATURE_FUSION
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
- STDMETHOD (DisplayNativeImages)(BSTR pAssemblyName)
- {
-#ifdef FEATURE_FUSION
- HRESULT hr = S_OK;
- EX_TRY
- {
- NGenOptions opt = {0};
- InitNGenOptions(&opt, ngenPrivateAttributesClass);
- NewHolder<Zapper> zapper = Zapper::NewZapper(&opt, true);
- _ASSERTE(zapper != NULL);
-
- IfFailThrow(zapper->EnumerateFusionCache(pAssemblyName, true, false, NULL));
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
-#else //FEATURE_FUSION
- return E_NOTIMPL;
-#endif //FEATURE_FUSION
- }
-
- STDMETHOD(GetCorSvcDependencies)(
- BSTR pApplicationName,
- OptimizationScenario scenario,
- ICorSvcDependencies **ppCorSvcDependencies
- )
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- HRESULT hr = S_OK;
- EX_TRY
- {
- NewHolder<CCorSvcDependencies> pCorSvcDependencies(new CCorSvcDependencies());
- pCorSvcDependencies->Initialize(pApplicationName, scenario);
- IfFailThrow(pCorSvcDependencies->QueryInterface(IID_ICorSvcDependencies, (void **) ppCorSvcDependencies));
- pCorSvcDependencies.SuppressRelease();
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
- STDMETHOD(Stop)()
- {
- return S_OK;
- }
-
- STDMETHOD(CreatePdb)(__in BSTR pAssemblyName,
- __in BSTR pAppBaseOrConfig,
- __in OptimizationScenario scenario,
- __in BSTR pNativeImagePath,
- __in BSTR pPdbPath)
- {
- return CreatePdb2(
- pAssemblyName,
- pAppBaseOrConfig,
- scenario,
- pNativeImagePath,
- pPdbPath,
- FALSE,
- NULL);
- }
-
- STDMETHOD(CreatePdb2)(__in BSTR pAssemblyName,
- __in BSTR pAppBaseOrConfig,
- __in OptimizationScenario scenario,
- __in BSTR pNativeImagePath,
- __in BSTR pPdbPath,
- __in BOOL pdbLines,
- __in BSTR pManagedPdbSearchPath)
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- HRESULT hr = S_OK;
-
- EX_TRY {
-
- CCorSvcCreatePdbWorker worker;
- worker.Initialize(pAppBaseOrConfig, scenario);
- hr = worker.CreatePdb(pAssemblyName, pNativeImagePath, pPdbPath, pdbLines, pManagedPdbSearchPath);
-
- } EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
-
- return hr;
- }
-
-#ifdef FEATURE_APPX
- STDMETHOD(SetPackage)(__in BSTR pPackageFullName)
- {
- return AppX::SetCurrentPackageForNGen(pPackageFullName);
- }
-
- STDMETHOD(SetLocalAppDataDirectory)(__in BSTR pLocalAppDataDirectory)
- {
- return Clr::Util::SetLocalAppDataDirectory(pLocalAppDataDirectory);
- }
-#endif
-
- STDMETHOD (SetRepository)(
- BSTR pRepositoryDir,
- RepositoryFlags flags
- )
- {
- _ASSERTE(repositoryFlags == RepositoryDefault);
- _ASSERTE(repositoryDir == NULL);
-
- repositoryDir = ::SysAllocString(pRepositoryDir);
- repositoryFlags = flags;
-
- return S_OK;
- }
-
- STDMETHOD (SetNGenPrivateAttributes)(
- NGenPrivateAttributes ngenPrivateAttributes
- )
- {
- _ASSERTE(ngenPrivateAttributesClass.Flags == 0);
- _ASSERTE(ngenPrivateAttributesClass.ZapStats == 0);
-
- ngenPrivateAttributesClass.Flags = ngenPrivateAttributes.Flags;
- ngenPrivateAttributesClass.ZapStats = ngenPrivateAttributes.ZapStats;
-
- if (ngenPrivateAttributes.DbgDir)
- {
- _ASSERTE(ngenPrivateAttributesClass.DbgDir == NULL);
- ngenPrivateAttributesClass.DbgDir = ::SysAllocString(ngenPrivateAttributes.DbgDir);
- }
-
- return S_OK;
- }
-
- STDMETHOD (CanReuseProcess)(
- OptimizationScenario scenario,
- ICorSvcLogger *pCorSvcLogger,
- BOOL *pCanContinue)
- {
- SO_NOT_MAINLINE_FUNCTION;
-
- HRESULT hr = S_OK;
-
- _ASSERTE(pCanContinue != NULL);
- *pCanContinue = FALSE;
-
- return hr;
- }
-
- static HRESULT CreateObject(REFIID riid, void **ppUnk)
- {
- HRESULT hr;
- CCorSvcWorker *pCorSvcWorker = new (nothrow) CCorSvcWorker();
-
- if (pCorSvcWorker == 0)
- return (E_OUTOFMEMORY);
-
- hr = pCorSvcWorker->QueryInterface(riid, ppUnk);
- if (FAILED(hr))
- delete pCorSvcWorker;
- return (hr);
- }
-
- STDMETHODIMP_(ULONG) AddRef()
- {
- return InterlockedIncrement (&_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release()
- {
- ULONG lRet = InterlockedDecrement (&_cRef);
- if (!lRet)
- delete this;
- return lRet;
- }
-
- STDMETHODIMP QueryInterface(REFIID riid,void ** ppv)
- {
- if (!ppv)
- return E_POINTER;
-
- if (IsEqualIID(riid, IID_IUnknown) ||
- IsEqualIID(riid, IID_ICorSvcWorker))
- {
- *ppv = static_cast<ICorSvcWorker*> (this);
- AddRef();
- return S_OK;
- }
- else if (IsEqualIID(riid, IID_ICorSvcWorker2))
- {
- *ppv = static_cast<ICorSvcWorker2 *>(this);
- AddRef();
- return S_OK;
- }
- else if (IsEqualIID(riid, IID_ICorSvcWorker3))
- {
- *ppv = static_cast<ICorSvcWorker3 *>(this);
- AddRef();
- return S_OK;
- }
- else if (IsEqualIID(riid, IID_ICorSvcRepository))
- {
- *ppv = static_cast<ICorSvcRepository*> (this);
- AddRef();
- return S_OK;
- }
- else if (IsEqualIID(riid, IID_ICorSvcSetPrivateAttributes))
- {
- *ppv = static_cast<ICorSvcSetPrivateAttributes *> (this);
- AddRef();
- return S_OK;
- }
-#ifdef FEATURE_APPX
- else if (IsEqualIID(riid, IID_ICorSvcAppX))
- {
- *ppv = static_cast<ICorSvcAppX *> (this);
- AddRef();
- return S_OK;
- }
-#endif
- else if (IsEqualIID(riid, IID_ICorSvcPooledWorker))
- {
- *ppv = static_cast<ICorSvcPooledWorker *> (this);
- AddRef();
- return S_OK;
- }
- else
- {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- }
-
-private:
- HRESULT ZapperCompileWrapper(BSTR pAssemblyName,
- NGenOptions * pOpt,
- GUID * pNativeImageSign,
- SAFEARRAY * loadAlwaysList,
- SAFEARRAY * loadSometimesList,
- SAFEARRAY * loadNeverList,
- bool useProfileData,
- bool * pHasProfileData)
- {
- NewHolder<Zapper> zapper(Zapper::NewZapper(pOpt, true));
-
- *pNativeImageSign = INVALID_NGEN_SIGNATURE;
-
- // Push the load lists to the zapper
- zapper->SetLoadLists(loadAlwaysList, loadSometimesList, loadNeverList);
- if (useProfileData == false)
- {
- zapper->DontUseProfileData();
- }
-
- HRESULT hr = zapper->Compile(pAssemblyName, pNativeImageSign);
-
- if (pHasProfileData != NULL)
- {
- *pHasProfileData = zapper->HasProfileData();
- }
-
- if (!FAILED(hr) && (*pNativeImageSign == INVALID_NGEN_SIGNATURE) && !pOpt->fRepositoryOnly)
- {
- // Unfortunately we can get a passing HR when an EE exception was
- // thrown because the zapper EH logic can't get the correct HR
- // out of the EE exception. This will be fixed, but for now we
- // should also return E_FAIL in that case.
-
- hr = E_FAIL;
- }
-
- return hr;
- }
-
-private:
- LONG _cRef;
-
- BSTRHolder repositoryDir;
- RepositoryFlags repositoryFlags;
-
- NGenPrivateAttributesClass ngenPrivateAttributesClass;
-
-#ifdef FEATURE_FUSION
- IAssemblyCache *pAssemblyCache;
-#endif // FEATURE_FUSION
-};
-
-STDAPI NGenCreateNGenWorker(ICorSvcWorker **pCorSvcWorker, ILocalServerLifetime *pLocalServerLifetime, ICorSvcLogger *pCorSvcLogger)
-{
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- EX_TRY
- {
- _ASSERTE(pLocalServerLifetime);
- //_ASSERTE(g_pLocalServerLifetime == NULL);
-
- g_pLocalServerLifetime = pLocalServerLifetime;
-
- GetSvcLogger()->SetSvcLogger(pCorSvcLogger);
-
- IfFailThrow(CCorSvcWorker::CreateObject(IID_ICorSvcWorker, (void **) pCorSvcWorker));
- }
- EX_CATCH_HRESULT_AND_NGEN_CLEAN(hr);
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-#endif // !FEATURE_CORECLR
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp
index 347718a76c..f285b97e98 100644
--- a/src/zap/zapimage.cpp
+++ b/src/zap/zapimage.cpp
@@ -41,10 +41,6 @@ ZapImage::ZapImage(Zapper *zapper)
: m_zapper(zapper)
/* Everything else is initialized to 0 by default */
{
-#ifndef FEATURE_CORECLR
- if (m_zapper->m_pOpt->m_statOptions)
- m_stats = new ZapperStats();
-#endif
}
ZapImage::~ZapImage()
@@ -57,10 +53,6 @@ ZapImage::~ZapImage()
//
// Clean up.
//
-#ifndef FEATURE_CORECLR
- if (m_stats != NULL)
- delete m_stats;
-#endif
if (m_pModuleFileName != NULL)
delete [] m_pModuleFileName;
@@ -172,9 +164,7 @@ void ZapImage::InitializeSections()
m_pHelperThunks = new (GetHeap()) ZapNode * [CORINFO_HELP_COUNT];
-#ifdef FEATURE_CORECLR
if (!m_zapper->m_pOpt->m_fNoMetaData)
-#endif
{
m_pILMetaData = new (GetHeap()) ZapILMetaData(this);
m_pILMetaDataSection->Place(m_pILMetaData);
@@ -226,11 +216,7 @@ void ZapImage::InitializeSectionsForReadyToRun()
m_pHeaderSection->Place(m_pImportSectionsTable);
{
-#ifdef FEATURE_CORECLR
#define COMPILER_NAME "CoreCLR"
-#else
-#define COMPILER_NAME "CLR"
-#endif
const char * pCompilerIdentifier = COMPILER_NAME " " FX_FILEVERSION_STR " " QUOTE_MACRO(__BUILDMACHINE__);
ZapBlob * pCompilerIdentifierBlob = new (GetHeap()) ZapBlobPtr((PVOID)pCompilerIdentifier, strlen(pCompilerIdentifier) + 1);
@@ -1186,10 +1172,6 @@ HANDLE ZapImage::SaveImage(LPCWSTR wszOutputFileName, CORCOMPILE_NGEN_SIGNATURE
HANDLE hFile = GenerateFile(wszOutputFileName, pNativeImageSig);
-#ifndef FEATURE_CORECLR
- if (m_stats != NULL)
- PrintStats(wszOutputFileName);
-#endif
#ifdef FEATURE_FUSION
CompressFile(wszOutputFileName[0], hFile);
@@ -1354,10 +1336,6 @@ void ZapImage::CalculateZapBaseAddress()
//
// CoreCLR currently always loads both the IL and the native image, so
// move the native image out of the way.
-#ifndef FEATURE_CORECLR
- if (!m_ModuleDecoder.IsDll() || // exes always get loaded to their preferred base address
- !m_ModuleDecoder.IsILOnly()) // since the IL (IJW) image will be loaded first
-#endif // !FEATURE_CORECLR
{
baseAddress += m_ModuleDecoder.GetVirtualSize();
}
@@ -1498,54 +1476,6 @@ void ZapImage::Open(CORINFO_MODULE_HANDLE hModule,
CalculateZapBaseAddress();
}
-#if !defined(FEATURE_CORECLR)
-
-#if (_WIN32_WINNT < _WIN32_WINNT_WIN8)
-
-typedef struct _WIN32_MEMORY_RANGE_ENTRY {
-
- PVOID VirtualAddress;
- SIZE_T NumberOfBytes;
-
-} WIN32_MEMORY_RANGE_ENTRY, *PWIN32_MEMORY_RANGE_ENTRY;
-
-#endif
-
-typedef BOOL
-(WINAPI *PfnPrefetchVirtualMemory)(
- _In_ HANDLE hProcess,
- _In_ ULONG_PTR NumberOfEntries,
- _In_reads_(NumberOfEntries) PWIN32_MEMORY_RANGE_ENTRY VirtualAddresses,
- _In_ ULONG Flags
- );
-
-
-void PrefetchVM(void * pStartAddress, SIZE_T size)
-{
- static PfnPrefetchVirtualMemory s_pfnPrefetchVirtualMemory = NULL;
-
- if (s_pfnPrefetchVirtualMemory == NULL)
- {
- s_pfnPrefetchVirtualMemory = (PfnPrefetchVirtualMemory) GetProcAddress(WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W), "PrefetchVirtualMemory");
-
- if (s_pfnPrefetchVirtualMemory == NULL)
- {
- s_pfnPrefetchVirtualMemory = (PfnPrefetchVirtualMemory) (1);
- }
- }
-
- if (s_pfnPrefetchVirtualMemory > (PfnPrefetchVirtualMemory) (1))
- {
- WIN32_MEMORY_RANGE_ENTRY range;
-
- range.VirtualAddress = pStartAddress;
- range.NumberOfBytes = size;
-
- s_pfnPrefetchVirtualMemory(GetCurrentProcess(), 1, & range, 0);
- }
-}
-
-#endif
@@ -1555,10 +1485,6 @@ void PrefetchVM(void * pStartAddress, SIZE_T size)
void ZapImage::Preload()
{
-#if !defined(FEATURE_CORECLR)
- // Prefetch the whole IL image into memory to avoid small reads (usually 16kb blocks)
- PrefetchVM(m_ModuleDecoder.GetBase(), m_ModuleDecoder.GetSize());
-#endif
CorProfileData * pProfileData = NewProfileData();
m_pPreloader = m_zapper->m_pEECompileInfo->PreloadModule(m_hModule, this, pProfileData);
@@ -1698,14 +1624,6 @@ void ZapImage::OutputTables()
if (IsReadyToRunCompilation())
{
-#ifndef FEATURE_CORECLR
- // Some older versions of Windows (e.g., Win7) can incorrectly fixup
- // relocations if IsDll is not set. In CoreCLR, we handle this by
- // always using the default value of IsDll, which is true. We can't
- // use the same fix in desktop CLR, since in this case the ReadyToRun
- // image can be used to create processes.
- SetIsDll(m_ModuleDecoder.IsDll());
-#endif
SetSizeOfStackReserve(m_ModuleDecoder.GetSizeOfStackReserve());
SetSizeOfStackCommit(m_ModuleDecoder.GetSizeOfStackCommit());
@@ -1714,7 +1632,7 @@ void ZapImage::OutputTables()
#if defined(FEATURE_PAL)
// PAL library requires native image sections to align to page bounaries.
SetFileAlignment(0x1000);
-#elif defined(_TARGET_ARM_) && defined(FEATURE_CORECLR)
+#elif defined(_TARGET_ARM_)
if (!IsReadyToRunCompilation())
{
// On ARM CoreSys builds, crossgen will use 4k file alignment, as requested by Phone perf team
@@ -2627,15 +2545,6 @@ HRESULT ZapImage::parseProfileData()
}
// CoreCLR should never be presented with V1 IBC data.
-#ifndef FEATURE_CORECLR
- if ((fileHeader->Version == CORBBTPROF_V1_VERSION) && CanConvertIbcData())
- {
- // Read and convert V1 data
- m_zapper->Info(W("Converting V1 IBC data to latest format.\n"));
- convertFromV1 = true;
- }
- else
-#endif
if (fileHeader->Version == CORBBTPROF_V3_VERSION)
{
CORBBTPROF_FILE_OPTIONAL_HEADER *optionalHeader =
@@ -3576,23 +3485,17 @@ void ZapImage::FileNotFoundError(LPCWSTR pszMessage)
level = CORZAP_LOGLEVEL_ERROR;
#endif
-#ifndef FEATURE_CORECLR
- m_zapper->Print(level, W("Warning: %s. If this assembly is found during runtime of an application, then the native image currently being generated will not be used.\n"), pszMessage);
-#else
m_zapper->Print(level, W("Warning: %s.\n"), pszMessage);
-#endif
fileNotFoundErrorsTable.Append(message);
}
void ZapImage::Error(mdToken token, HRESULT hr, LPCWSTR message)
{
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
// Missing dependencies are reported as fatal errors in code:CompilationDomain::BindAssemblySpec.
// Avoid printing redundant error message for them.
if (FAILED(g_hrFatalError))
ThrowHR(g_hrFatalError);
-#endif
CorZapLogLevel level = CORZAP_LOGLEVEL_ERROR;
diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp
index d2362d4b90..4b2f39a264 100644
--- a/src/zap/zapinfo.cpp
+++ b/src/zap/zapinfo.cpp
@@ -466,10 +466,6 @@ void ZapInfo::CompileMethod()
return;
}
-#if !defined(FEATURE_CORECLR)
- // Ask the JIT to generate desktop-quirk-compatible code.
- m_jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_DESKTOP_QUIRKS);
-#endif
if (m_pImage->m_stats)
{
@@ -1239,9 +1235,6 @@ int ZapInfo::canHandleException(struct _EXCEPTION_POINTERS *pExceptionPointers)
int ZapInfo::doAssert(const char* szFile, int iLine, const char* szExpr)
{
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- ThrowHR(COR_E_INVALIDPROGRAM);
-#else
#if defined(_DEBUG)
return(_DbgBreakCheck(szFile, iLine, szExpr));
@@ -1249,7 +1242,6 @@ int ZapInfo::doAssert(const char* szFile, int iLine, const char* szExpr)
return(true); // break into debugger
#endif
-#endif
}
void ZapInfo::reportFatalError(CorJitResult result)
{
@@ -2574,9 +2566,6 @@ void ZapInfo::recordRelocation(void *location, void *target,
break;
case IMAGE_REL_BASED_PTR:
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
- _ASSERTE(!"Why we are not using RIP relative address?");
-#endif
*(UNALIGNED TADDR *)location = (TADDR)targetOffset;
break;
@@ -3277,15 +3266,6 @@ size_t ZapInfo::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORINFO_MOD
// if the fixups were exclusively based on the moduleforstatics lookup
cls = NULL;
-#ifndef FEATURE_CORECLR
-
- // Is this mscorlib.dll (which has ModuleDomainId of 0 (tagged == 1), then you don't need a fixup
- if (moduleId == (size_t) 1)
- {
- *ppIndirection = NULL;
- return (size_t) 1;
- }
-#endif
if (module == m_pImage->m_hModule)
{
@@ -3643,15 +3623,6 @@ void ZapInfo::reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd,
const char * reason)
{
-#ifndef FEATURE_CORECLR
- if (!dontInline(inlineResult) && inlineeHnd != NULL)
- {
- // We deliberately report m_currentMethodHandle (not inlinerHnd) as inliner, because
- // if m_currentMethodHandle != inlinerHnd, it simply means that inlinerHnd is intermediate link
- // in inlining into m_currentMethodHandle, and we have no interest to track those intermediate links now.
- m_pImage->m_pPreloader->ReportInlining(m_currentMethodHandle, inlineeHnd);
- }
-#endif //FEATURE_CORECLR
return m_pEEJitInfo->reportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, reason);
}
diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp
index 2c7023a400..b8b674d99b 100644
--- a/src/zap/zapper.cpp
+++ b/src/zap/zapper.cpp
@@ -13,14 +13,8 @@
#include "metahost.h"
#endif
-#if defined(FEATURE_APPX) && !defined(FEATURE_CORECLR)
-#include "AppXUtil.h"
-#include "AssemblyUsageLogManager.h"
-#endif
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
#include "coregen.h"
-#endif
#include "clr/fs/dir.h"
#ifdef FEATURE_FUSION
@@ -55,21 +49,14 @@ extern "C" HRESULT STDMETHODCALLTYPE InitializeFusion();
extern const WCHAR g_pwBaseLibrary[];
extern bool g_fAllowNativeImages;
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
bool g_fNGenMissingDependenciesOk;
-#endif
bool g_fNGenWinMDResilient;
-#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
-extern int g_ningenState;
-#endif
#ifdef FEATURE_READYTORUN_COMPILER
bool g_fReadyToRunCompilation;
#endif
-#ifdef FEATURE_CORECLR
static bool s_fNGenNoMetaData;
-#endif
// Event logging helper
void Zapper::ReportEventNGEN(WORD wType, DWORD dwEventID, LPCWSTR format, ...)
@@ -140,7 +127,6 @@ static HRESULT GetAssemblyName(
// For side by side issues, it's best to use the exported API calls to generate a
// Zapper Object instead of creating one on your own.
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzOutputFilename=NULL, LPCWSTR pwzPlatformWinmdPaths=NULL, ICorSvcLogger *pLogger = NULL, LPCWSTR pwszCLRJITPath = nullptr)
{
@@ -185,9 +171,7 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl
ngo.fNgenLastRetry = false;
-#ifdef FEATURE_CORECLR
s_fNGenNoMetaData = (dwFlags & NGENWORKER_FLAGS_NO_METADATA) != 0;
-#endif
zap = Zapper::NewZapper(&ngo);
@@ -209,7 +193,7 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl
if (pwzPlatformWinmdPaths != nullptr)
zap->SetPlatformWinmdPaths(pwzPlatformWinmdPaths);
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
if (pwszCLRJITPath != nullptr)
zap->SetCLRJITPath(pwszCLRJITPath);
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
@@ -255,7 +239,7 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat
zap = Zapper::NewZapper(&ngo);
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
zap->SetDontLoadJit();
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
@@ -277,7 +261,7 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat
if (pwzPlatformWinmdPaths != nullptr)
zap->SetPlatformWinmdPaths(pwzPlatformWinmdPaths);
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
if (pwzDiasymreaderPath != nullptr)
zap->SetDiasymreaderPath(pwzDiasymreaderPath);
#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
@@ -310,100 +294,6 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat
return hr;
}
-#else // FEATURE_CORECLR || CROSSGEN_COMPILE
-
-STDAPI LegacyNGenCreateZapper(HANDLE* hZapper, NGenOptions* opt)
-{
- if (hZapper == NULL)
- return E_POINTER;
-
- HRESULT hr = S_OK;
- Zapper* zap = NULL;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
-
- EX_TRY
- {
- zap = Zapper::NewZapper(opt);
- }
- EX_CATCH_HRESULT(hr);
-
- END_ENTRYPOINT_NOTHROW;
-
- IfFailRet(hr);
-
- if (zap == NULL)
- return E_OUTOFMEMORY;
-
- zap->SetLegacyMode();
-
- *hZapper = (HANDLE)zap;
-
- return S_OK;
-}// NGenCreateZapper
-
-STDAPI LegacyNGenFreeZapper(HANDLE hZapper)
-{
- if (hZapper == NULL || hZapper == INVALID_HANDLE_VALUE)
- return E_HANDLE;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- Zapper *zapper = (Zapper*)hZapper;
- delete zapper;
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
-}// NGenFreeZapper
-
-#ifdef FEATURE_FUSION
-STDAPI LegacyNGenTryEnumerateFusionCache(HANDLE hZapper, LPCWSTR assemblyName, bool fPrint, bool fDelete)
-{
-
- HRESULT hr = S_OK;
- if (hZapper == NULL || hZapper == INVALID_HANDLE_VALUE)
- return E_HANDLE;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- Zapper *zapper = (Zapper*)hZapper;
- hr = zapper->TryEnumerateFusionCache(assemblyName, fPrint, fDelete);
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-
-}// NGenTryEnumerateFusionCache
-#endif //FEATURE_FUSION
-
-STDAPI_(BOOL) LegacyNGenCompile(HANDLE hZapper, LPCWSTR path)
-{
- CONTRACTL{
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (hZapper == NULL || hZapper == INVALID_HANDLE_VALUE)
- return FALSE;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_VOIDRET;
-
- Zapper *zapper = (Zapper*)hZapper;
-
- EX_TRY
- {
- hr = zapper->Compile(path);
- }
- EX_CATCH_HRESULT(hr);
-
- END_ENTRYPOINT_VOIDRET;
-
- return (hr == S_OK) ? TRUE : FALSE;
-}// NGenCompile
-
-#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
/* --------------------------------------------------------------------------- *
* Options class
@@ -427,9 +317,7 @@ ZapperOptions::ZapperOptions() :
m_fNGenLastRetry(false),
m_compilerFlags(),
m_legacyMode(false)
-#ifdef FEATURE_CORECLR
,m_fNoMetaData(s_fNGenNoMetaData)
-#endif
{
m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_RELOC);
m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_PREJIT);
@@ -691,7 +579,7 @@ void Zapper::Init(ZapperOptions *pOptions, bool fFreeZapperOptions)
_ASSERTE(SUCCEEDED(hr));
#endif
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
m_fDontLoadJit = false;
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
@@ -719,13 +607,12 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi
HRESULT hr = E_FAIL;
-#if defined(FEATURE_CORECLR) || defined(FEATURE_MERGE_JIT_AND_ENGINE)
// Note: FEATURE_MERGE_JIT_AND_ENGINE is defined for the Desktop crossgen compilation as well.
//
PathString CoreClrFolder;
extern HINSTANCE g_hThisInst;
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
if (m_fDontLoadJit)
{
return;
@@ -761,9 +648,6 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi
hr = S_OK;
}
}
-#else
- hr = g_pCLRRuntime->LoadLibrary(pwzJitName, phJit);
-#endif
if (FAILED(hr))
{
@@ -771,7 +655,7 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi
ThrowLastError();
}
-#if (defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST)) && !defined(CROSSGEN_COMPILE)
+#if !defined(CROSSGEN_COMPILE)
typedef void (__stdcall* pSxsJitStartup) (CoreClrCallbacks const & cccallbacks);
pSxsJitStartup sxsJitStartupFn = (pSxsJitStartup) GetProcAddress(*phJit, "sxsJitStartup");
if (sxsJitStartupFn == NULL)
@@ -898,39 +782,11 @@ void Zapper::InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument)
CorCompileRuntimeDlls ngenDllId;
-#if !defined(FEATURE_CORECLR)
- ngenDllId = NGEN_COMPILER_INFO;
-#else // FEATURE_CORECLR
ngenDllId = CROSSGEN_COMPILER_INFO;
-#endif
LPCWSTR pwzJitName = CorCompileGetRuntimeDllName(ngenDllId);
LoadAndInitializeJITForNgen(pwzJitName, &m_hJitLib, &m_pJitCompiler);
-#if defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- // For reasons related to servicing, and RyuJIT rollout on .NET 4.6 and beyond, we only use RyuJIT when the registry
- // value UseRyuJIT (type DWORD), under key HKLM\SOFTWARE\Microsoft\.NETFramework, is set to 1. Otherwise, we fall back
- // to JIT64.
- //
- // See the document "RyuJIT Compatibility Fallback Specification.docx" for details.
- //
- // Also see the code and comments in EEJitManager::LoadJIT().
-
- if (!UseRyuJit()) // Do we need to fall back to JIT64 for NGEN?
- {
- LPCWSTR pwzJitName = MAKEDLLNAME_W(L"compatjit");
-
- // Note: if the compatjit fails to load, we ignore it, and continue to use the main JIT for
- // everything. You can imagine a policy where if the user requests the compatjit, and we fail
- // to load it, that we fail noisily. We don't do that currently.
- ICorJitCompiler* fallbackICorJitCompiler;
- LoadAndInitializeJITForNgen(pwzJitName, &m_hJitLegacy, &fallbackICorJitCompiler);
-
- // Tell the main JIT to fall back to the "fallback" JIT compiler, in case some
- // obfuscator tries to directly call the main JIT's getJit() function.
- m_pJitCompiler->setRealJit(fallbackICorJitCompiler);
- }
-#endif // defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
#endif // FEATURE_MERGE_JIT_AND_ENGINE
#ifdef ALLOW_SXS_JIT_NGEN
@@ -2029,21 +1885,11 @@ void Zapper::CreateDependenciesLookupDomainInCurrentDomain()
SetContextInfo();
}
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
-void ZapperSetPlatformAssembliesPaths(SString &platformAssembliesPaths);
-#endif
-#ifdef FEATURE_CORECLR
void ZapperSetBindingPaths(ICorCompilationDomain *pDomain, SString &trustedPlatformAssemblies, SString &platformResourceRoots, SString &appPaths, SString &appNiPaths);
-#endif
void Zapper::CreateCompilationDomain()
{
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- // Platform assemblies paths have to be set before appdomain is setup so that
- // mscorlib.dll can be loaded from them.
- ZapperSetPlatformAssembliesPaths(m_platformAssembliesPaths);
-#endif
BOOL fForceDebug = FALSE;
if (!m_pOpt->m_autodebug)
@@ -2069,7 +1915,6 @@ void Zapper::CreateCompilationDomain()
IfFailThrow(m_pDomain->SetPlatformWinmdPaths(m_platformWinmdPaths));
#endif
-#ifdef FEATURE_CORECLR
// we support only TPA binding on CoreCLR
if (!m_trustedPlatformAssemblies.IsEmpty())
@@ -2078,7 +1923,6 @@ void Zapper::CreateCompilationDomain()
// Add the trusted paths and apppath to the binding list
ZapperSetBindingPaths(m_pDomain, m_trustedPlatformAssemblies, m_platformResourceRoots, m_appPaths, m_appNiPaths);
}
-#endif
}
void Zapper::CreateDependenciesLookupDomain()
@@ -2249,7 +2093,7 @@ void Zapper::CreatePdbInCurrentDomain(BSTR pAssemblyPathOrName, BSTR pNativeImag
}
LPCWSTR pDiasymreaderPath = nullptr;
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
if (m_DiasymreaderPath.GetCount() > 0)
{
pDiasymreaderPath = m_DiasymreaderPath.GetUnicode();
@@ -2321,29 +2165,6 @@ void Zapper::ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyString, CORCOMP
}
else
{
-#if defined(FEATURE_APPX) && !defined(FEATURE_CORECLR)
- if (m_pOpt->m_fAutoNGen)
- {
- // Make sure we're not been spoofed into loading an assembly that might be unsafe to load.
- // Loading by path so we better be AppX or a WinMD
- StackSString s(pAssemblyString);
- SString literalWinMD(SString::Literal, W(".winmd"));
- BOOL isWinMD = (s.GetCount() > 6) && s.MatchCaseInsensitive(s.End() - 6, literalWinMD);
- if (!AppX::IsAppXProcess() && !isWinMD)
- {
- Error(W("Cannot load assembly %s for automatic NGen.\n"), pAssemblyString);
- ThrowHR(E_FAIL);
- }
-
- // Is AppX NGen disabled?
- if ((AssemblyUsageLogManager::GetUsageLogFlags() & AssemblyUsageLogManager::ASSEMBLY_USAGE_LOG_FLAGS_APPLOCALNGENDISABLED) != 0)
- {
- memset(pNativeImageSig, 0, sizeof(*pNativeImageSig)); // Fake NI signature to disable NGen.
- Warning(W("NGen disabled for this application.\n"));
- return;
- }
- }
-#endif
hr = m_pEECompileInfo->LoadAssemblyByPath(pAssemblyString,
FALSE, // fExplicitBindToNativeImage
@@ -2363,13 +2184,6 @@ void Zapper::ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyString, CORCOMP
IfFailThrow(hr);
}
-#ifndef FEATURE_CORECLR
- if (m_pOpt->m_fAutoNGen && !m_pEECompileInfo->SupportsAutoNGen(hAssembly))
- {
- Error(W("Assembly %s does not support automatic NGen.\n"), pAssemblyString);
- ThrowHR(E_FAIL);
- }
-#endif // FEATURE_CORECLR
//
// Check if we have a native image already, and if so get its GUID
@@ -2603,25 +2417,8 @@ HRESULT Zapper::Compile(LPCWSTR string, CORCOMPILE_NGEN_SIGNATURE * pNativeImage
{
fMscorlib = true;
}
-#ifndef FEATURE_CORECLR
- else
- if (_wcsnicmp(fileName, W("mscorlib"), 8) == 0 && (wcslen(fileName) == 8 || fileName[8] == W(',')))
- {
- fMscorlib = true;
- }
-#endif
-#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- if (fMscorlib)
- {
- //
- // Enable ningen by default for mscorlib to get identical images between ngen and crossgen
- //
- g_ningenState = 1;
- }
-#endif
-#if defined(CROSSGEN_COMPILE) || defined(FEATURE_CORECLR)
if (fMscorlib)
{
//
@@ -2629,7 +2426,6 @@ HRESULT Zapper::Compile(LPCWSTR string, CORCOMPILE_NGEN_SIGNATURE * pNativeImage
//
g_fAllowNativeImages = false;
}
-#endif
// the errors in CreateCompilationDomain are fatal - propogate them up
CreateCompilationDomain();
@@ -2680,11 +2476,6 @@ void Zapper::CompileInCurrentDomain(__in LPCWSTR string, CORCOMPILE_NGEN_SIGNATU
BEGIN_ENTRYPOINT_VOIDRET;
-#ifndef FEATURE_CORECLR
- // Set the hard binding list. This needs to be done early, before we attempt to use any
- // softbound native images, in order to ensure NGen determinism.
- SetAssemblyHardBindList();
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_FUSION
// Set the context info for the current domain
@@ -3382,15 +3173,8 @@ void Zapper::InitializeCompilerFlags(CORCOMPILE_VERSION_INFO * pVersionInfo)
m_pOpt->m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_USE_FCOMI);
}
-#if !defined(FEATURE_CORECLR)
- if (CPU_X86_USE_SSE2(pVersionInfo->cpuInfo.dwFeatures))
- {
- m_pOpt->m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_USE_SSE2);
- }
-#else
// .NET Core requires SSE2.
m_pOpt->m_compilerFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_USE_SSE2);
-#endif // !defined(FEATURE_CORECLR)
#endif // _TARGET_X86_
@@ -4079,7 +3863,7 @@ void Zapper::PrintErrorMessage(CorZapLogLevel level, HRESULT hr)
Print(level, W("%s"), message.GetUnicode());
}
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
void Zapper::SetCLRJITPath(LPCWSTR pwszCLRJITPath)
{
m_CLRJITPath.Set(pwszCLRJITPath);
@@ -4091,14 +3875,13 @@ void Zapper::SetDontLoadJit()
}
#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
-#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+#if !defined(NO_NGENPDB)
void Zapper::SetDiasymreaderPath(LPCWSTR pwzDiasymreaderPath)
{
m_DiasymreaderPath.Set(pwzDiasymreaderPath);
}
#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
void Zapper::SetPlatformAssembliesPaths(LPCWSTR pwzPlatformAssembliesPaths)
{
@@ -4135,7 +3918,6 @@ void Zapper::SetForceFullTrust(bool val)
m_fForceFullTrust = val;
}
-#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
void Zapper::SetOutputFilename(LPCWSTR pwzOutputFilename)