summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/appdomain.cpp908
-rw-r--r--src/vm/appdomain.hpp42
-rw-r--r--src/vm/appdomain.inl9
-rw-r--r--src/vm/appdomainnative.cpp11
-rw-r--r--src/vm/appdomainnative.hpp2
-rw-r--r--src/vm/appxutil.cpp39
-rw-r--r--src/vm/arm/stubs.cpp2
-rw-r--r--src/vm/assembly.cpp1187
-rw-r--r--src/vm/assembly.hpp74
-rw-r--r--src/vm/assemblyname.cpp53
-rw-r--r--src/vm/assemblynative.hpp40
-rw-r--r--src/vm/assemblyspec.cpp109
-rw-r--r--src/vm/assemblyspec.hpp10
-rw-r--r--src/vm/baseassemblyspec.cpp4
-rw-r--r--src/vm/baseassemblyspec.h4
-rw-r--r--src/vm/baseassemblyspec.inl50
-rw-r--r--src/vm/ceeload.cpp16
-rw-r--r--src/vm/ceeload.h6
-rw-r--r--src/vm/ceemain.cpp1045
-rw-r--r--src/vm/ceemain.h39
-rw-r--r--src/vm/class.h15
-rw-r--r--src/vm/classnames.h4
-rw-r--r--src/vm/clrprivbinderwinrt.cpp165
-rw-r--r--src/vm/clrprivbinderwinrt.h6
-rw-r--r--src/vm/clsload.cpp194
-rw-r--r--src/vm/clsload.hpp17
-rw-r--r--src/vm/clsload.inl6
-rw-r--r--src/vm/codeman.cpp39
-rw-r--r--src/vm/comcallablewrapper.cpp12
-rw-r--r--src/vm/comdelegate.cpp30
-rw-r--r--src/vm/comdelegate.h4
-rw-r--r--src/vm/comdynamic.cpp442
-rw-r--r--src/vm/comdynamic.h15
-rw-r--r--src/vm/cominterfacemarshaler.cpp12
-rw-r--r--src/vm/comisolatedstorage.cpp6
-rw-r--r--src/vm/commodule.cpp15
-rw-r--r--src/vm/commodule.h2
-rw-r--r--src/vm/common.h13
-rw-r--r--src/vm/compile.cpp680
-rw-r--r--src/vm/compile.h38
-rw-r--r--src/vm/comsynchronizable.cpp151
-rw-r--r--src/vm/comsynchronizable.h13
-rw-r--r--src/vm/comthreadpool.cpp32
-rw-r--r--src/vm/comutilnative.cpp101
-rw-r--r--src/vm/comutilnative.h34
-rw-r--r--src/vm/comwaithandle.cpp90
-rw-r--r--src/vm/coreassemblyspec.cpp99
-rw-r--r--src/vm/corhost.cpp3457
-rw-r--r--src/vm/crossgencompile.cpp2
-rw-r--r--src/vm/crst.cpp83
-rw-r--r--src/vm/dangerousapis.h14
-rw-r--r--src/vm/dataimage.cpp4
-rw-r--r--src/vm/debugdebugger.cpp61
-rw-r--r--src/vm/disassembler.h5
-rw-r--r--src/vm/dllimport.cpp643
-rw-r--r--src/vm/dllimport.h18
-rw-r--r--src/vm/domainfile.cpp329
-rw-r--r--src/vm/dwbucketmanager.hpp43
-rw-r--r--src/vm/dwreport.cpp26
-rw-r--r--src/vm/ecall.h8
-rw-r--r--src/vm/ecalllist.h238
-rw-r--r--src/vm/eeconfig.cpp376
-rw-r--r--src/vm/eeconfig.h18
-rw-r--r--src/vm/eepolicy.cpp29
-rw-r--r--src/vm/eventreporter.cpp24
-rw-r--r--src/vm/eventreporter.h2
-rw-r--r--src/vm/eventtrace.cpp43
-rw-r--r--src/vm/excep.cpp101
-rw-r--r--src/vm/excep.h2
-rw-r--r--src/vm/exceptionhandling.cpp2
-rw-r--r--src/vm/finalizerthread.cpp2
-rw-r--r--src/vm/frames.h18
-rw-r--r--src/vm/gcenv.os.cpp18
-rw-r--r--src/vm/gchost.cpp248
-rw-r--r--src/vm/hosting.cpp31
-rw-r--r--src/vm/i386/asmconstants.h5
-rw-r--r--src/vm/i386/cgencpu.h3
-rw-r--r--src/vm/i386/excepx86.cpp2
-rw-r--r--src/vm/ilmarshalers.cpp129
-rw-r--r--src/vm/ilmarshalers.h38
-rw-r--r--src/vm/ilstubcache.cpp41
-rw-r--r--src/vm/interoputil.cpp21
-rw-r--r--src/vm/invokeutil.cpp68
-rw-r--r--src/vm/jithelpers.cpp11
-rw-r--r--src/vm/jitinterface.cpp35
-rw-r--r--src/vm/jitinterface.h48
-rw-r--r--src/vm/metasig.h4
-rw-r--r--src/vm/method.cpp97
-rw-r--r--src/vm/method.hpp42
-rw-r--r--src/vm/methodtable.cpp16
-rw-r--r--src/vm/methodtable.inl8
-rw-r--r--src/vm/mlinfo.cpp81
-rw-r--r--src/vm/mlinfo.h41
-rw-r--r--src/vm/mtypes.h5
-rw-r--r--src/vm/multicorejit.cpp37
-rw-r--r--src/vm/multicorejitimpl.h12
-rw-r--r--src/vm/multicorejitplayer.cpp27
-rw-r--r--src/vm/nativeoverlapped.cpp7
-rw-r--r--src/vm/ngenoptout.cpp25
-rw-r--r--src/vm/object.cpp3
-rw-r--r--src/vm/object.h153
-rw-r--r--src/vm/olevariant.cpp6
-rw-r--r--src/vm/pefile.cpp380
-rw-r--r--src/vm/pefile.h31
-rw-r--r--src/vm/pefile.inl81
-rw-r--r--src/vm/peimage.cpp180
-rw-r--r--src/vm/peimage.h10
-rw-r--r--src/vm/peimage.inl114
-rw-r--r--src/vm/peimagelayout.cpp94
-rw-r--r--src/vm/profilinghelper.cpp43
-rw-r--r--src/vm/proftoeeinterfaceimpl.cpp16
-rw-r--r--src/vm/readytoruninfo.cpp5
-rw-r--r--src/vm/reflectclasswriter.h5
-rw-r--r--src/vm/reflectioninvocation.cpp245
-rw-r--r--src/vm/reflectioninvocation.h4
-rw-r--r--src/vm/rejit.cpp6
-rw-r--r--src/vm/rexcep.h13
-rw-r--r--src/vm/runtimecallablewrapper.cpp44
-rw-r--r--src/vm/runtimehandles.cpp44
-rw-r--r--src/vm/runtimehandles.h4
-rw-r--r--src/vm/security.cpp18
-rw-r--r--src/vm/security.h13
-rw-r--r--src/vm/security.inl35
-rw-r--r--src/vm/securitydeclarative.cpp38
-rw-r--r--src/vm/securitydescriptor.cpp152
-rw-r--r--src/vm/securitydescriptor.h26
-rw-r--r--src/vm/securitydescriptor.inl11
-rw-r--r--src/vm/securitydescriptorappdomain.cpp3
-rw-r--r--src/vm/securitydescriptorassembly.cpp9
-rw-r--r--src/vm/securitydescriptorassembly.h3
-rw-r--r--src/vm/securitymeta.cpp245
-rw-r--r--src/vm/securitymeta.h7
-rw-r--r--src/vm/securitymeta.inl41
-rw-r--r--src/vm/securitypolicy.cpp28
-rw-r--r--src/vm/securitypolicy.h3
-rw-r--r--src/vm/securitytransparentassembly.cpp314
-rw-r--r--src/vm/sha1.h4
-rw-r--r--src/vm/stdinterfaces.cpp259
-rw-r--r--src/vm/stubhelpers.cpp176
-rw-r--r--src/vm/stubhelpers.h6
-rw-r--r--src/vm/syncblk.cpp7
-rw-r--r--src/vm/threads.cpp356
-rw-r--r--src/vm/threads.h116
-rw-r--r--src/vm/threadsuspend.cpp471
-rw-r--r--src/vm/util.cpp13
-rw-r--r--src/vm/util.hpp28
-rw-r--r--src/vm/vars.cpp6
-rw-r--r--src/vm/vars.hpp15
148 files changed, 24 insertions, 16393 deletions
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 040837a8a7..bf41be6544 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -103,9 +103,6 @@
#include "clrprivtypecachewinrt.h"
-#ifndef FEATURE_CORECLR
-#include "nlsinfo.h"
-#endif
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
#pragma warning(push)
@@ -739,10 +736,8 @@ OBJECTHANDLE ThreadStaticHandleTable::AllocateHandles(DWORD nRequested)
void BaseDomain::Attach()
{
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
-#ifdef FEATURE_CORECLR
// Randomized string hashing is on by default for String.GetHashCode in coreclr.
COMNlsHashProvider::s_NlsHashProvider.SetUseRandomHashing((CorHost2::GetStartupFlags() & STARTUP_DISABLE_RANDOMIZED_STRING_HASHING) == 0);
-#endif // FEATURE_CORECLR
#endif // FEATURE_RANDOMIZED_STRING_HASHING
m_SpecialStaticsCrst.Init(CrstSpecialStatics);
}
@@ -1229,7 +1224,6 @@ void AppDomain::RegisterLoaderAllocatorForDeletion(LoaderAllocator * pLoaderAllo
m_pDelayedLoaderAllocatorUnloadList = pLoaderAllocator;
}
-#ifdef FEATURE_CORECLR
void AppDomain::ShutdownNativeDllSearchDirectories()
{
LIMITED_METHOD_CONTRACT;
@@ -1243,7 +1237,6 @@ void AppDomain::ShutdownNativeDllSearchDirectories()
m_NativeDllSearchDirectories.Clear();
}
-#endif
void AppDomain::ReleaseDomainBoundInfo()
{
@@ -3497,10 +3490,6 @@ void SystemDomain::InitializeDefaultDomain(
#ifndef CROSSGEN_COMPILE
if (!NingenEnabled())
{
-#ifndef FEATURE_CORECLR
- pDefaultDomain->InitializeHashing(NULL);
- pDefaultDomain->InitializeSorting(NULL);
-#endif // FEATURE_CORECLR
}
#endif // CROSSGEN_COMPILE
@@ -3540,174 +3529,6 @@ void SystemDomain::InitializeDefaultDomain(
Volatile<LONG> g_fInExecuteMainMethod = 0;
#endif
-#ifndef FEATURE_CORECLR
-void SystemDomain::ExecuteMainMethod(HMODULE hMod, __in_opt LPWSTR path /*=NULL*/)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- PRECONDITION(CheckPointer(hMod, NULL_OK));
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
-#ifdef _DEBUG
- CounterHolder counter(&g_fInExecuteMainMethod);
-#endif
-
- Thread *pThread = GetThread();
- _ASSERTE(pThread);
-
- GCX_COOP();
-
- //
- // There is no EH protecting this transition!
- // This is generically ok in this method because if we throw out of here, it becomes unhandled anyway.
- //
- FrameWithCookie<ContextTransitionFrame> frame;
- pThread->EnterContextRestricted(SystemDomain::System()->DefaultDomain()->GetDefaultContext(), &frame);
- _ASSERTE(pThread->GetDomain());
-
- AppDomain *pDomain = GetAppDomain();
- _ASSERTE(pDomain);
-
- // Push this frame around loading the main assembly to ensure the
- // debugger can properly recognize any managed code that gets run
- // as "class initializaion" code.
- FrameWithCookie<DebuggerClassInitMarkFrame> __dcimf;
- {
- GCX_PREEMP();
-
- PEImageHolder pTempImage(PEImage::LoadImage(hMod));
-
- PEFileHolder pTempFile(PEFile::Open(pTempImage.Extract()));
-
- // Check for CustomAttributes - Set up the DefaultDomain and the main thread
- // Note that this has to be done before ExplicitBind() as it
- // affects the bind
- mdToken tkEntryPoint = pTempFile->GetEntryPointToken();
- // <TODO>@TODO: What if the entrypoint is in another file of the assembly?</TODO>
- ReleaseHolder<IMDInternalImport> scope(pTempFile->GetMDImportWithRef());
- // In theory, we should have a valid executable image and scope should never be NULL, but we've been
- // getting Watson failures for AVs here due to ISVs modifying image headers and some new OS loader
- // checks (see Dev10# 718530 and Windows 7# 615596)
- if (scope == NULL)
- {
- ThrowHR(COR_E_BADIMAGEFORMAT);
- }
-
-#ifdef FEATURE_COMINTEROP
- Thread::ApartmentState state = Thread::AS_Unknown;
-
- if((!IsNilToken(tkEntryPoint)) && (TypeFromToken(tkEntryPoint) == mdtMethodDef)) {
- if (scope->IsValidToken(tkEntryPoint))
- state = SystemDomain::GetEntryPointThreadAptState(scope, tkEntryPoint);
- else
- ThrowHR(COR_E_BADIMAGEFORMAT);
- }
-
- // If the entry point has an explicit thread apartment state, set it
- // before running the AppDomainManager initialization code.
- if (state == Thread::AS_InSTA || state == Thread::AS_InMTA)
- SystemDomain::SetThreadAptState(scope, state);
-#endif // FEATURE_COMINTEROP
-
- BOOL fSetGlobalSharePolicyUsingAttribute = FALSE;
-
- if((!IsNilToken(tkEntryPoint)) && (TypeFromToken(tkEntryPoint) == mdtMethodDef))
- {
- // The global share policy needs to be set before initializing default domain
- // so that it is in place for loading of appdomain manager.
- fSetGlobalSharePolicyUsingAttribute = SystemDomain::SetGlobalSharePolicyUsingAttribute(scope, tkEntryPoint);
- }
-
- // This can potentially run managed code.
- InitializeDefaultDomain(FALSE);
-
-#ifdef FEATURE_COMINTEROP
- // If we haven't set an explicit thread apartment state, set it after the
- // AppDomainManager has got a chance to go set it in InitializeNewDomain.
- if (state != Thread::AS_InSTA && state != Thread::AS_InMTA)
- SystemDomain::SetThreadAptState(scope, state);
-#endif // FEATURE_COMINTEROP
-
- if (fSetGlobalSharePolicyUsingAttribute)
- SystemDomain::System()->DefaultDomain()->SetupLoaderOptimization(g_dwGlobalSharePolicy);
-
- NewHolder<IPEFileSecurityDescriptor> pSecDesc(Security::CreatePEFileSecurityDescriptor(pDomain, pTempFile));
-
- {
- GCX_COOP();
- pSecDesc->Resolve();
- if (pSecDesc->AllowBindingRedirects())
- pDomain->TurnOnBindingRedirects();
- }
-
- PEAssemblyHolder pFile(pDomain->BindExplicitAssembly(hMod, TRUE));
-
- pDomain->m_pRootAssembly = GetAppDomain()->LoadAssembly(NULL, pFile, FILE_ACTIVE);
-
- {
- GCX_COOP();
-
- // Reuse the evidence that was generated for the PEFile for the assembly so we don't have to
- // regenerate evidence of the same type again if it is requested later.
- pDomain->m_pRootAssembly->GetSecurityDescriptor()->SetEvidenceFromPEFile(pSecDesc);
- }
-
- // If the AppDomainManager for the default domain was specified in the application config file then
- // we require that the assembly be trusted in order to set the manager
- if (pDomain->HasAppDomainManagerInfo() && pDomain->AppDomainManagerSetFromConfig())
- {
- Assembly *pEntryAssembly = pDomain->GetAppDomainManagerEntryAssembly();
- if (!pEntryAssembly->GetSecurityDescriptor()->AllowApplicationSpecifiedAppDomainManager())
- {
- COMPlusThrow(kTypeLoadException, IDS_E_UNTRUSTED_APPDOMAIN_MANAGER);
- }
- }
-
- if (CorCommandLine::m_pwszAppFullName == NULL) {
- StackSString friendlyName;
- StackSString assemblyPath = pFile->GetPath();
- SString::Iterator i = assemblyPath.End();
-
- if (PEAssembly::FindLastPathSeparator(assemblyPath, i)) {
- i++;
- friendlyName.Set(assemblyPath, i, assemblyPath.End());
- }
- else
- friendlyName.Set(assemblyPath);
-
- pDomain->SetFriendlyName(friendlyName, TRUE);
- }
- }
- __dcimf.Pop();
-
- {
- GCX_PREEMP();
-
- LOG((LF_CLASSLOADER | LF_CORDB,
- LL_INFO10,
- "Created domain for an executable at %p\n",
- (pDomain->m_pRootAssembly ? pDomain->m_pRootAssembly->Parent() : NULL)));
- TESTHOOKCALL(RuntimeStarted(RTS_CALLINGENTRYPOINT));
-
-#ifdef FEATURE_MULTICOREJIT
- pDomain->GetMulticoreJitManager().AutoStartProfile(pDomain);
-#endif
-
- pDomain->m_pRootAssembly->ExecuteMainMethod(NULL, TRUE /* waitForOtherThreads */);
- }
-
- pThread->ReturnToContext(&frame);
-
-#ifdef FEATURE_TESTHOOKS
- TESTHOOKCALL(LeftAppDomain(DefaultADID));
-#endif
-}
-#endif //!FEATURE_CORECLR
#ifdef FEATURE_CLICKONCE
void SystemDomain::ActivateApplication(int *pReturnValue)
@@ -3895,7 +3716,6 @@ Assembly *AppDomain::LoadAssemblyHelper(LPCWSTR wszAssembly,
#if defined(FEATURE_CLASSIC_COMINTEROP) && !defined(CROSSGEN_COMPILE)
-#ifdef FEATURE_CORECLR
MethodTable *AppDomain::LoadCOMClass(GUID clsid,
BOOL bLoadRecord/*=FALSE*/,
BOOL* pfAssemblyInReg/*=NULL*/)
@@ -3903,135 +3723,6 @@ MethodTable *AppDomain::LoadCOMClass(GUID clsid,
// @CORESYSTODO: what to do here?
return NULL;
}
-#else // FEATURE_CORECLR
-
-static BOOL IsSameRuntimeVersion(ICLRRuntimeInfo *pInfo1, ICLRRuntimeInfo *pInfo2)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- WCHAR wszVersion1[_MAX_PATH];
- WCHAR wszVersion2[_MAX_PATH];
- DWORD cchVersion;
-
- cchVersion = COUNTOF(wszVersion1);
- IfFailThrow(pInfo1->GetVersionString(wszVersion1, &cchVersion));
-
- cchVersion = COUNTOF(wszVersion2);
- IfFailThrow(pInfo2->GetVersionString(wszVersion2, &cchVersion));
-
- return SString::_wcsicmp(wszVersion1, wszVersion2) == 0;
-}
-
-MethodTable *AppDomain::LoadCOMClass(GUID clsid,
- BOOL bLoadRecord/*=FALSE*/,
- BOOL* pfAssemblyInReg/*=NULL*/)
-{
- CONTRACT (MethodTable*)
- {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- POSTCONDITION(CheckPointer(RETVAL, NULL_OK));
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACT_END;
-
-
- MethodTable* pMT = NULL;
-
- NewArrayHolder<WCHAR> wszClassName = NULL;
- NewArrayHolder<WCHAR> wszAssemblyString = NULL;
- NewArrayHolder<WCHAR> wszCodeBaseString = NULL;
-
- DWORD cbAssembly = 0;
- DWORD cbCodeBase = 0;
- Assembly *pAssembly = NULL;
- BOOL fFromRegistry = FALSE;
- BOOL fRegFreePIA = FALSE;
-
- HRESULT hr = S_OK;
-
- if (pfAssemblyInReg != NULL)
- *pfAssemblyInReg = FALSE;
-
- // with sxs.dll help
- hr = FindShimInfoFromWin32(clsid, bLoadRecord, NULL, NULL, &wszClassName, &wszAssemblyString, &fRegFreePIA);
-
- if(FAILED(hr))
- {
- hr = FindShimInfoFromRegistry(clsid, bLoadRecord, VER_ASSEMBLYMAJORVERSION, VER_ASSEMBLYMINORVERSION,
- &wszClassName, &wszAssemblyString, &wszCodeBaseString);
- if (FAILED(hr))
- RETURN NULL;
-
- fFromRegistry = TRUE;
- }
-
- // Skip the GetRuntimeForManagedCOMObject check for value types since they cannot be activated and are
- // always used for wrapping existing instances coming from COM.
- if (!bLoadRecord)
- {
- // We will load the assembly only if it is a PIA or if unmanaged activation would load the currently running
- // runtime. Otherwise we return NULL which will result in using the default System.__ComObject type.
-
- // the type is a PIA type if mscoree.dll is not its inproc server dll or it was specified as <clrSurrogate> in the manifest
- BOOL fPIA = (fFromRegistry ? !Clr::Util::Com::CLSIDHasMscoreeAsInprocServer32(clsid) : fRegFreePIA);
- if (!fPIA)
- {
- // this isn't a PIA, so we must determine which runtime it would load
- ReleaseHolder<ICLRRuntimeHostInternal> pRuntimeHostInternal;
- IfFailThrow(g_pCLRRuntime->GetInterface(CLSID_CLRRuntimeHostInternal,
- IID_ICLRRuntimeHostInternal,
- &pRuntimeHostInternal));
-
- // we call the shim to see which runtime would this be activated in
- ReleaseHolder<ICLRRuntimeInfo> pRuntimeInfo;
- if (FAILED(pRuntimeHostInternal->GetRuntimeForManagedCOMObject(clsid, IID_ICLRRuntimeInfo, &pRuntimeInfo)))
- {
- // the requested runtime is not loadable - don't load the assembly
- RETURN NULL;
- }
-
- if (!IsSameRuntimeVersion(g_pCLRRuntime, pRuntimeInfo))
- {
- // the requested runtime is different from this runtime - don't load the assembly
- RETURN NULL;
- }
- }
- }
-
- if (pfAssemblyInReg != NULL)
- *pfAssemblyInReg = TRUE;
-
- if (wszAssemblyString != NULL) {
- pAssembly = LoadAssemblyHelper(wszAssemblyString, wszCodeBaseString);
- pMT = TypeName::GetTypeFromAssembly(wszClassName, pAssembly).GetMethodTable();
- if (!pMT)
- goto ErrExit;
- }
-
- if (pMT == NULL) {
- ErrExit:
- // Convert the GUID to its string representation.
- WCHAR szClsid[64];
- if (GuidToLPWSTR(clsid, szClsid, NumItems(szClsid)) == 0)
- szClsid[0] = 0;
-
- // Throw an exception indicating we failed to load the type with
- // the requested CLSID.
- COMPlusThrow(kTypeLoadException, IDS_CLASSLOAD_NOCLSIDREG, szClsid);
- }
-
- RETURN pMT;
-}
-
-#endif // FEATURE_CORECLR
#endif // FEATURE_CLASSIC_COMINTEROP && !CROSSGEN_COMPILE
@@ -4078,17 +3769,6 @@ bool SystemDomain::IsReflectionInvocationMethod(MethodDesc* pMeth)
CLASS__ASSEMBLY,
CLASS__TYPE_DELEGATOR,
CLASS__RUNTIME_HELPERS,
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
- CLASS__ITYPE,
- CLASS__IASSEMBLY,
- CLASS__IMETHODBASE,
- CLASS__IMETHODINFO,
- CLASS__ICONSTRUCTORINFO,
- CLASS__IFIELDINFO,
- CLASS__IPROPERTYINFO,
- CLASS__IEVENTINFO,
- CLASS__IAPPDOMAIN,
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
CLASS__LAZY_INITIALIZER,
CLASS__DYNAMICMETHOD,
CLASS__DELEGATE,
@@ -4838,15 +4518,6 @@ AppDomain::AppDomain()
m_pUnloadRequestThread = NULL;
m_ADUnloadSink=NULL;
-#ifndef FEATURE_CORECLR
- m_bUseOsSorting = RunningOnWin8();
- m_sortVersion = DEFAULT_SORT_VERSION;
- m_pCustomSortLibrary = NULL;
-#if _DEBUG
- m_bSortingInitialized = FALSE;
-#endif // _DEBUG
- m_pNlsHashProvider = NULL;
-#endif //!FEATURE_CORECLR
// Initialize Shared state. Assemblies are loaded
// into each domain by default.
@@ -4979,13 +4650,6 @@ AppDomain::~AppDomain()
if(!g_fEEInit)
Terminate();
-#ifndef FEATURE_CORECLR
- if (m_pCustomSortLibrary)
- delete m_pCustomSortLibrary;
-
- if (m_pNlsHashProvider)
- delete m_pNlsHashProvider;
-#endif
#ifdef FEATURE_REMOTING
@@ -5450,9 +5114,7 @@ void AppDomain::Terminate()
}
ShutdownAssemblies();
-#ifdef FEATURE_CORECLR
ShutdownNativeDllSearchDirectories();
-#endif
if (m_pRefClassFactHash)
{
@@ -5589,123 +5251,7 @@ OBJECTREF AppDomain::GetExposedObject()
return ref;
}
-#ifndef FEATURE_CORECLR
-void AppDomain::InitializeSorting(OBJECTREF* ppAppdomainSetup)
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- THROWS;
- GC_NOTRIGGER;
- PRECONDITION(ppAppdomainSetup == NULL || IsProtectedByGCFrame(ppAppdomainSetup));
- }
- CONTRACTL_END;
-
- DWORD sortVersionFromConfig = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CompatSortNLSVersion);
-
- if(sortVersionFromConfig != 0)
- {
- m_bUseOsSorting = FALSE;
- m_sortVersion = sortVersionFromConfig;
- }
-
- if(ppAppdomainSetup != NULL)
- {
- APPDOMAINSETUPREF adSetup = (APPDOMAINSETUPREF) *ppAppdomainSetup;
- APPDOMAINSORTINGSETUPINFOREF sortingSetup = adSetup->GetAppDomainSortingSetupInfo();
-
- if(sortingSetup != NULL)
- {
- if(sortingSetup->UseV2LegacySorting() || sortingSetup->UseV4LegacySorting())
- {
-
- m_bUseOsSorting = FALSE;
-
- if(sortingSetup->UseV2LegacySorting())
- {
- m_sortVersion = SORT_VERSION_WHIDBEY;
- }
-
- if(sortingSetup->UseV4LegacySorting())
- {
- m_sortVersion = SORT_VERSION_V4;
- }
- }
- else if(sortingSetup->GetPFNIsNLSDefinedString() != NULL
- && sortingSetup->GetPFNCompareStringEx() != NULL
- && sortingSetup->GetPFNLCMapStringEx() != NULL
- && sortingSetup->GetPFNFindNLSStringEx() != NULL
- && sortingSetup->GetPFNCompareStringOrdinal() != NULL
- && sortingSetup->GetPFNGetNLSVersionEx() != NULL
- && sortingSetup->GetPFNFindStringOrdinal() != NULL)
- {
- m_pCustomSortLibrary = new COMNlsCustomSortLibrary;
- m_pCustomSortLibrary->pIsNLSDefinedString = (PFN_IS_NLS_DEFINED_STRING) sortingSetup->GetPFNIsNLSDefinedString();
- m_pCustomSortLibrary->pCompareStringEx = (PFN_COMPARE_STRING_EX) sortingSetup->GetPFNCompareStringEx();
- m_pCustomSortLibrary->pLCMapStringEx = (PFN_LC_MAP_STRING_EX) sortingSetup->GetPFNLCMapStringEx();
- m_pCustomSortLibrary->pFindNLSStringEx = (PFN_FIND_NLS_STRING_EX) sortingSetup->GetPFNFindNLSStringEx();
- m_pCustomSortLibrary->pCompareStringOrdinal = (PFN_COMPARE_STRING_ORDINAL) sortingSetup->GetPFNCompareStringOrdinal();
- m_pCustomSortLibrary->pGetNLSVersionEx = (PFN_GET_NLS_VERSION_EX) sortingSetup->GetPFNGetNLSVersionEx();
- m_pCustomSortLibrary->pFindStringOrdinal = (PFN_FIND_STRING_ORDINAL) sortingSetup->GetPFNFindStringOrdinal();
- }
- }
- }
-
- if(m_bUseOsSorting == FALSE && m_sortVersion == DEFAULT_SORT_VERSION)
- {
- // If we are using the legacy sorting dlls, the default version for sorting is SORT_VERSION_V4. Note that
- // we don't expect this to change in the future (even when V5 or V6 of the runtime comes out).
- m_sortVersion = SORT_VERSION_V4;
- }
-
- if(RunningOnWin8() && m_bUseOsSorting == FALSE)
- {
- // We need to ensure that the versioned sort DLL could load so we don't crash later. This ensures we have
- // the same behavior as Windows 7, where even if we couldn't load the correct versioned sort dll, we would
- // provide the default sorting behavior.
- INT_PTR sortOrigin;
- if(COMNlsInfo::InternalInitVersionedSortHandle(W(""), &sortOrigin, m_sortVersion) == NULL)
- {
- LOG((LF_APPDOMAIN, LL_WARNING, "AppDomain::InitializeSorting failed to load legacy sort DLL for AppDomain.\n"));
- // We couldn't load a sort DLL. Fall back to default sorting using the OS.
- m_bUseOsSorting = TRUE;
- m_sortVersion = DEFAULT_SORT_VERSION;
- }
- }
-
-#if _DEBUG
- m_bSortingInitialized = TRUE;
-#endif
-}
-#endif
-
-#ifndef FEATURE_CORECLR
-void AppDomain::InitializeHashing(OBJECTREF* ppAppdomainSetup)
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- THROWS;
- GC_NOTRIGGER;
- PRECONDITION(ppAppdomainSetup == NULL || IsProtectedByGCFrame(ppAppdomainSetup));
- }
- CONTRACTL_END;
-
- m_pNlsHashProvider = new COMNlsHashProvider;
-#ifdef FEATURE_RANDOMIZED_STRING_HASHING
- BOOL fUseRandomizedHashing = (BOOL) CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_UseRandomizedStringHashAlgorithm);
-
- if(ppAppdomainSetup != NULL)
- {
- APPDOMAINSETUPREF adSetup = (APPDOMAINSETUPREF) *ppAppdomainSetup;
- fUseRandomizedHashing |= adSetup->UseRandomizedStringHashing();
- }
-
- m_pNlsHashProvider->SetUseRandomHashing(fUseRandomizedHashing);
-#endif // FEATURE_RANDOMIZED_STRING_HASHING
-}
-#endif // FEATURE_CORECLR
OBJECTREF AppDomain::DoSetup(OBJECTREF* setupInfo)
{
@@ -5949,11 +5495,7 @@ bool IsPlatformAssembly(LPCSTR szName, DomainAssembly *pDomainAssembly)
return false;
}
-#ifdef FEATURE_CORECLR
return StrongNameIsSilverlightPlatformKey(pbPublicKey, cbPublicKey);
-#else
- return StrongNameIsEcmaKey(pbPublicKey, cbPublicKey);
-#endif
}
void AppDomain::AddAssembly(DomainAssembly * assem)
@@ -6047,54 +5589,6 @@ BOOL AppDomain::HasSetSecurityPolicy()
RETURN ((APPDOMAINREF)GetExposedObject())->HasSetPolicy();
}
-#if defined (FEATURE_LOADER_OPTIMIZATION) && !defined(FEATURE_CORECLR)
-// Returns true if the user has declared the desire to load an
-// assembly domain-neutral. This is either by specifying System.LoaderOptimizationAttribute
-// on the entry routine or the host has set this loader-optimization flag.
-BOOL AppDomain::ApplySharePolicy(DomainAssembly *pFile)
-{
- CONTRACT(BOOL)
- {
- PRECONDITION(CheckPointer(pFile));
- THROWS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACT_END;
-
- if (!pFile->GetFile()->IsShareable())
- RETURN FALSE;
-
- if (ApplySharePolicyFlag(pFile))
- RETURN TRUE;
-
- RETURN FALSE;
-}
-
-BOOL AppDomain::ApplySharePolicyFlag(DomainAssembly *pFile)
-{
- CONTRACT(BOOL)
- {
- PRECONDITION(CheckPointer(pFile));
- THROWS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACT_END;
-
- switch(GetSharePolicy()) {
- case SHARE_POLICY_ALWAYS:
- RETURN (!pFile->MayHaveUnknownDependencies());
-
- case SHARE_POLICY_GAC:
- RETURN (pFile->IsClosedInGAC());
-
- case SHARE_POLICY_NEVER:
- RETURN pFile->IsSystem();
-
- default:
- UNREACHABLE_MSG("Unknown share policy");
- }
-}
-#endif // FEATURE_LOADER_OPTIMIZATION
EEClassFactoryInfoHashTable* AppDomain::SetupClassFactHash()
{
@@ -6714,7 +6208,6 @@ DomainAssembly* AppDomain::LoadDomainAssembly( AssemblySpec* pSpec,
Exception* pEx=GET_EXCEPTION();
if (!pEx->IsTransient())
{
-#if defined(FEATURE_CORECLR)
// Setup the binder reference in AssemblySpec from the PEAssembly if one is not already set.
ICLRPrivBinder* pCurrentBindingContext = pSpec->GetBindingContext();
ICLRPrivBinder* pBindingContextFromPEAssembly = pFile->GetBindingContext();
@@ -6733,7 +6226,6 @@ DomainAssembly* AppDomain::LoadDomainAssembly( AssemblySpec* pSpec,
_ASSERTE(AreSameBinderInstance(pCurrentBindingContext, pBindingContextFromPEAssembly));
}
#endif // _DEBUG
-#endif // defined(FEATURE_CORECLR)
if (!EEFileLoadException::CheckType(pEx))
{
@@ -7152,16 +6644,6 @@ void AppDomain::TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, F
EX_TRY
{
-#ifndef FEATURE_CORECLR
- // Event Tracing for Windows is used to log data for performance and functional testing purposes.
- // The events below are used to measure the performance of two steps in the assembly loader, namely assembly initialization and delivering events.
- StackSString ETWAssemblySimpleName;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD))
- {
- LPCUTF8 simpleName = pFile->GetSimpleName();
- ETWAssemblySimpleName.AppendUTF8(simpleName ? simpleName : "NULL"); // Gather data used by ETW events later in this function.
- }
-#endif // FEATURE_CORECLR
// Special case: for LoadLibrary, we cannot hold the lock during the
// actual LoadLibrary call, because we might get a callback from _CorDllMain on any
@@ -7172,28 +6654,10 @@ void AppDomain::TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, F
lockHolder.Release();
released = TRUE;
}
-#ifndef FEATURE_CORECLR
- else if (workLevel == FILE_LOAD_DELIVER_EVENTS)
- {
- FireEtwLoaderDeliverEventsPhaseStart(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, NULL, ETWAssemblySimpleName, GetClrInstanceId());
- }
-#endif // FEATURE_CORECLR
// Do the work
TESTHOOKCALL(NextFileLoadLevel(GetId().m_dwId,pFile,workLevel));
-#ifndef FEATURE_CORECLR
- if (workLevel == FILE_LOAD_ALLOCATE)
- {
- FireEtwLoaderAssemblyInitPhaseStart(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, NULL, ETWAssemblySimpleName, GetClrInstanceId());
- }
-#endif // FEATURE_CORECLR
BOOL success = pFile->DoIncrementalLoad(workLevel);
-#ifndef FEATURE_CORECLR
- if (workLevel == FILE_LOAD_ALLOCATE)
- {
- FireEtwLoaderAssemblyInitPhaseEnd(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, NULL, ETWAssemblySimpleName, GetClrInstanceId());
- }
-#endif // FEATURE_CORECLR
TESTHOOKCALL(CompletingFileLoadLevel(GetId().m_dwId,pFile,workLevel));
if (released)
{
@@ -7216,9 +6680,6 @@ void AppDomain::TryIncrementalLoad(DomainFile *pFile, FileLoadLevel workLevel, F
lockHolder.Release();
released = TRUE;
pFile->DeliverAsyncEvents();
-#ifndef FEATURE_CORECLR
- FireEtwLoaderDeliverEventsPhaseEnd(GetId().m_dwId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, NULL, ETWAssemblySimpleName, GetClrInstanceId());
-#endif // FEATURE_CORECLR
};
}
}
@@ -7489,7 +6950,6 @@ AppDomain::SharePolicy AppDomain::GetSharePolicy()
#endif // FEATURE_LOADER_OPTIMIZATION
-#ifdef FEATURE_CORECLR
void AppDomain::CheckForMismatchedNativeImages(AssemblySpec * pSpec, const GUID * pGuid)
{
STANDARD_VM_CONTRACT;
@@ -7555,7 +7015,6 @@ void AppDomain::CheckForMismatchedNativeImages(AssemblySpec * pSpec, const GUID
amTracker.SuppressRelease();
}
}
-#endif // FEATURE_CORECLR
void AppDomain::SetupSharedStatics()
@@ -8097,13 +7556,11 @@ BOOL AppDomain::IsCached(AssemblySpec *pSpec)
return m_AssemblyCache.Contains(pSpec);
}
-#ifdef FEATURE_CORECLR
void AppDomain::GetCacheAssemblyList(SetSHash<PTR_DomainAssembly>& assemblyList)
{
CrstHolder holder(&m_DomainCacheCrst);
m_AssemblyCache.GetAllAssemblies(assemblyList);
}
-#endif
PEAssembly* AppDomain::FindCachedFile(AssemblySpec* pSpec, BOOL fThrow /*=TRUE*/)
{
@@ -8886,12 +8343,10 @@ EndTry2:;
}
fAddFileToCache = true;
-#if defined(FEATURE_CORECLR)
// Setup the reference to the binder, which performed the bind, into the AssemblySpec
ICLRPrivBinder* pBinder = result->GetBindingContext();
_ASSERTE(pBinder != NULL);
pSpec->SetBindingContext(pBinder);
-#endif // defined(FEATURE_CORECLR)
}
#endif //!FEATURE_FUSION
@@ -9568,13 +9023,6 @@ BOOL AppDomain::OnUnhandledException(OBJECTREF *pThrowable, BOOL isTerminating/*
orSender = pAppDomain->GetRawExposedObject();
retVal = pAppDomain->RaiseUnhandledExceptionEventNoThrow(&orSender, pThrowable, isTerminating);
-#ifndef FEATURE_CORECLR
-// CoreCLR#520:
-// To make this work correctly we need the changes for coreclr 473
- if (pAppDomain != SystemDomain::System()->DefaultDomain())
- retVal |= SystemDomain::System()->DefaultDomain()->RaiseUnhandledExceptionEventNoThrow
- (&orSender, pThrowable, isTerminating);
-#endif
GCPROTECT_END();
@@ -9670,54 +9118,6 @@ void AppDomain::RaiseExitProcessEvent()
}
}
-#ifndef FEATURE_CORECLR
-void AppDomain::RaiseUnhandledExceptionEvent_Wrapper(LPVOID ptr)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- INJECT_FAULT(COMPlusThrowOM(););
- SO_INTOLERANT;
- }
- CONTRACTL_END;
- AppDomain::RaiseUnhandled_Args *args = (AppDomain::RaiseUnhandled_Args *) ptr;
-
- struct _gc {
- OBJECTREF orThrowable;
- OBJECTREF orSender;
- } gc;
-
- ZeroMemory(&gc, sizeof(gc));
-
- _ASSERTE(args->pTargetDomain == GetAppDomain());
- GCPROTECT_BEGIN(gc);
- EX_TRY
- {
- SetObjectReference(&gc.orThrowable,
- AppDomainHelper::CrossContextCopyFrom(args->pExceptionDomain,
- args->pThrowable),
- args->pTargetDomain);
-
- SetObjectReference(&gc.orSender,
- AppDomainHelper::CrossContextCopyFrom(args->pExceptionDomain,
- args->pSender),
- args->pTargetDomain);
- }
- EX_CATCH
- {
- SetObjectReference(&gc.orThrowable, GET_THROWABLE(), args->pTargetDomain);
- SetObjectReference(&gc.orSender, GetAppDomain()->GetRawExposedObject(), args->pTargetDomain);
- }
- EX_END_CATCH(SwallowAllExceptions)
- *(args->pResult) = args->pTargetDomain->RaiseUnhandledExceptionEvent(&gc.orSender,
- &gc.orThrowable,
- args->isTerminating);
- GCPROTECT_END();
-
-}
-#endif //!FEATURE_CORECLR
BOOL
AppDomain::RaiseUnhandledExceptionEventNoThrow(OBJECTREF *pSender, OBJECTREF *pThrowable, BOOL isTerminating)
@@ -9780,18 +9180,7 @@ AppDomain::RaiseUnhandledExceptionEvent(OBJECTREF *pSender, OBJECTREF *pThrowabl
_ASSERTE(pThrowable != NULL && IsProtectedByGCFrame(pThrowable));
_ASSERTE(pSender != NULL && IsProtectedByGCFrame(pSender));
-#ifndef FEATURE_CORECLR
- Thread *pThread = GetThread();
- if (this != pThread->GetDomain())
- {
- RaiseUnhandled_Args args = {pThread->GetDomain(), this, pSender, pThrowable, isTerminating, &result};
- // call through DoCallBack with a domain transition
- pThread->DoADCallBack(this, AppDomain::RaiseUnhandledExceptionEvent_Wrapper, &args, ADV_DEFAULTAD);
- return result;
- }
-#else
_ASSERTE(this == GetThread()->GetDomain());
-#endif
OBJECTREF orDelegate = NULL;
@@ -9814,48 +9203,6 @@ AppDomain::RaiseUnhandledExceptionEvent(OBJECTREF *pSender, OBJECTREF *pThrowabl
}
-#ifndef FEATURE_CORECLR
-// Create a domain based on a string name
-AppDomain* AppDomain::CreateDomainContext(LPCWSTR fileName)
-{
- CONTRACTL
- {
- THROWS;
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- if(fileName == NULL) return NULL;
-
- AppDomain* pDomain = NULL;
-
- MethodDescCallSite valCreateDomain(METHOD__APP_DOMAIN__VAL_CREATE_DOMAIN);
-
- STRINGREF pFilePath = NULL;
- GCPROTECT_BEGIN(pFilePath);
- pFilePath = StringObject::NewString(fileName);
-
- ARG_SLOT args[1] =
- {
- ObjToArgSlot(pFilePath),
- };
-
- APPDOMAINREF pDom = (APPDOMAINREF) valCreateDomain.Call_RetOBJECTREF(args);
- if(pDom != NULL)
- {
- Context* pContext = Context::GetExecutionContext(pDom);
- if(pContext)
- {
- pDomain = pContext->GetDomain();
- }
- }
- GCPROTECT_END();
-
- return pDomain;
-}
-#endif // !FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
@@ -9909,28 +9256,6 @@ void AppDomain::InitializeDomainContext(BOOL allowRedirects,
gc.pConfig = StringObject::NewString(pwszConfig);
}
-#ifndef FEATURE_CORECLR
- StringArrayList *pPropertyNames;
- StringArrayList *pPropertyValues;
- CorHost2::GetDefaultAppDomainProperties(&pPropertyNames, &pPropertyValues);
-
- _ASSERTE(pPropertyNames->GetCount() == pPropertyValues->GetCount());
-
- if (pPropertyNames->GetCount() > 0)
- {
- gc.propertyNames = (PTRARRAYREF)AllocateObjectArray(pPropertyNames->GetCount(), g_pStringClass);
- gc.propertyValues = (PTRARRAYREF)AllocateObjectArray(pPropertyValues->GetCount(), g_pStringClass);
-
- for (DWORD i = 0; i < pPropertyNames->GetCount(); ++i)
- {
- STRINGREF propertyName = StringObject::NewString(pPropertyNames->Get(i));
- gc.propertyNames->SetAt(i, propertyName);
-
- STRINGREF propertyValue = StringObject::NewString(pPropertyValues->Get(i));
- gc.propertyValues->SetAt(i, propertyValue);
- }
- }
-#endif // !FEATURE_CORECLR
if ((gc.ref = GetExposedObject()) != NULL)
{
@@ -9998,23 +9323,6 @@ IApplicationContext *AppDomain::CreateFusionContext()
IfFailThrow(FusionBind::CreateFusionContext(NULL, &pFusionContext));
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
- CLRPrivBinderWinRT * pWinRtBinder;
- if (AppX::IsAppXProcess())
- { // Note: Fusion binder is used in AppX to bind .NET Fx assemblies - some of them depend on .winmd files (e.g. System.Runtime.WindowsRuntime.dll)
- CLRPrivBinderAppX * pAppXBinder = CLRPrivBinderAppX::GetOrCreateBinder();
- pWinRtBinder = pAppXBinder->GetWinRtBinder();
- }
- else
- {
- pWinRtBinder = m_pWinRtBinder;
- }
- _ASSERTE(pWinRtBinder != nullptr);
-
- IfFailThrow(SetApplicationContext_WinRTBinder(
- pFusionContext,
- static_cast<IBindContext *>(pWinRtBinder)));
-#endif
#ifdef FEATURE_PREJIT
if (NGENImagesAllowed())
@@ -12587,13 +11895,6 @@ AppDomain::RaiseAssemblyResolveEvent(
{
if (pSpec->GetParentAssembly() != NULL)
{
-#ifndef FEATURE_CORECLR
- if ( pSpec->IsIntrospectionOnly()
-#ifdef FEATURE_FUSION
- || pSpec->GetParentLoadContext() == LOADCTX_TYPE_UNKNOWN
-#endif
- )
-#endif // FEATURE_CORECLR
{
gc.AssemblyRef=pSpec->GetParentAssembly()->GetExposedAssemblyObject();
}
@@ -12636,68 +11937,6 @@ AppDomain::RaiseAssemblyResolveEvent(
RETURN pAssembly;
} // AppDomain::RaiseAssemblyResolveEvent
-#ifndef FEATURE_CORECLR
-
-//---------------------------------------------------------------------------------------
-//
-// Ask the AppDomainManager for the entry assembly of the application
-//
-// Note:
-// Most AppDomainManagers will fall back on the root assembly for the domain, so we need
-// to make sure this is set before we call through to the AppDomainManager itself.
-//
-
-Assembly *AppDomain::GetAppDomainManagerEntryAssembly()
-{
- CONTRACT(Assembly *)
- {
- STANDARD_VM_CHECK;
- PRECONDITION(HasAppDomainManagerInfo());
- PRECONDITION(CheckPointer(m_pRootAssembly));
- POSTCONDITION(CheckPointer(RETVAL));
- }
- CONTRACT_END;
-
- GCX_COOP();
-
- Assembly *pEntryAssembly = NULL;
-
- struct
- {
- APPDOMAINREF orDomain;
- OBJECTREF orAppDomainManager;
- ASSEMBLYREF orEntryAssembly;
- }
- gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
-
- gc.orDomain = static_cast<APPDOMAINREF>(GetExposedObject());
- gc.orAppDomainManager = gc.orDomain->GetAppDomainManager();
- _ASSERTE(gc.orAppDomainManager != NULL);
-
- MethodDescCallSite getEntryAssembly(METHOD__APPDOMAIN_MANAGER__GET_ENTRY_ASSEMBLY, &gc.orAppDomainManager);
- ARG_SLOT argThis = ObjToArgSlot(gc.orAppDomainManager);
- gc.orEntryAssembly = static_cast<ASSEMBLYREF>(getEntryAssembly.Call_RetOBJECTREF(&argThis));
-
- if (gc.orEntryAssembly != NULL)
- {
- pEntryAssembly = gc.orEntryAssembly->GetAssembly();
- }
-
- GCPROTECT_END();
-
- // If the AppDomainManager did not return an entry assembly, we'll assume the default assembly
- if (pEntryAssembly == NULL)
- {
- pEntryAssembly = m_pRootAssembly;
- }
-
- RETURN(pEntryAssembly);
-}
-
-#endif // !FEATURE_CORECLR
//---------------------------------------------------------------------------------------
//
@@ -12740,45 +11979,6 @@ void AppDomain::InitializeDefaultDomainManager()
LOG((LF_APPDOMAIN, LL_INFO10, "Setting default AppDomainManager '%S', '%S' from hosting API.\n", GetAppDomainManagerAsm(), GetAppDomainManagerType()));
}
-#ifndef FEATURE_CORECLR
- else
- {
- CLRConfigStringHolder wszConfigAppDomainManagerAssembly(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_AppDomainManagerAsm));
- CLRConfigStringHolder wszConfigAppDomainManagerType(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_AppDomainManagerType));
-
- if (wszConfigAppDomainManagerAssembly != NULL &&
- wszConfigAppDomainManagerType != NULL)
- {
- SetAppDomainManagerInfo(wszConfigAppDomainManagerAssembly,
- wszConfigAppDomainManagerType,
- eInitializeNewDomainFlags_None);
- m_fAppDomainManagerSetInConfig = TRUE;
-
- LOG((LF_APPDOMAIN, LL_INFO10, "Setting default AppDomainManager '%S', '%S' from application config file.\n", GetAppDomainManagerAsm(), GetAppDomainManagerType()));
- }
- else
- {
- CLRConfigStringHolder wszEnvironmentAppDomainManagerAssembly(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_LEGACY_APPDOMAIN_MANAGER_ASM));
- CLRConfigStringHolder wszEnvironmentAppDomainManagerType(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_LEGACY_APPDOMAIN_MANAGER_TYPE));
-
- if (wszEnvironmentAppDomainManagerAssembly != NULL &&
- wszEnvironmentAppDomainManagerType != NULL)
- {
- SetAppDomainManagerInfo(wszEnvironmentAppDomainManagerAssembly,
- wszEnvironmentAppDomainManagerType,
- eInitializeNewDomainFlags_None);
- m_fAppDomainManagerSetInConfig = FALSE;
-
- LOG((LF_APPDOMAIN, LL_INFO10, "Setting default AppDomainManager '%S', '%S' from environment variables.\n", GetAppDomainManagerAsm(), GetAppDomainManagerType()));
-
- // Reset the environmetn variables so that child processes do not inherit our domain manager
- // by default.
- WszSetEnvironmentVariable(CLRConfig::EXTERNAL_LEGACY_APPDOMAIN_MANAGER_ASM.name, NULL);
- WszSetEnvironmentVariable(CLRConfig::EXTERNAL_LEGACY_APPDOMAIN_MANAGER_TYPE.name, NULL);
- }
- }
- }
-#endif // !FEATURE_CORECLR
// If we found an AppDomain manager to use, create and initialize it
// Otherwise, initialize the config flags.
@@ -12962,11 +12162,9 @@ void AppDomain::CreateADUnloadWorker()
{
STANDARD_VM_CONTRACT;
-#ifdef FEATURE_CORECLR
// Do not create adUnload thread if there is only default domain
if(IsSingleAppDomain())
return;
-#endif
Retry:
BOOL fCreator = FALSE;
@@ -13820,95 +13018,6 @@ PTR_MethodTable BaseDomain::LookupType(UINT32 id) {
#ifndef DACCESS_COMPILE
-#ifndef FEATURE_CORECLR
-//------------------------------------------------------------------------
-DWORD* SetupCompatibilityFlags()
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- } CONTRACTL_END;
-
- LPCWSTR buf;
- bool return_null = true;
-
- FAULT_NOT_FATAL(); // we can simply give up
-
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return NULL;)
- InlineSString<4> bufString;
-
- if (WszGetEnvironmentVariable(W("UnsupportedCompatSwitchesEnabled"), bufString) != 0)
- {
- buf = bufString.GetUnicode();
- if (buf[0] != '1' || buf[1] != '\0')
- {
- return_null = true;
- }
- else
- {
- return_null = false;
- }
-
- }
- END_SO_INTOLERANT_CODE
-
- if (return_null)
- return NULL;
-
- static const LPCWSTR rgFlagNames[] = {
-#define COMPATFLAGDEF(name) TEXT(#name),
-#include "compatibilityflagsdef.h"
- };
-
- int size = (compatCount+31) / 32;
- DWORD* pFlags = new (nothrow) DWORD[size];
- if (pFlags == NULL)
- return NULL;
- ZeroMemory(pFlags, size * sizeof(DWORD));
-
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(SetLastError(COR_E_STACKOVERFLOW); return NULL;)
- InlineSString<4> bufEnvString;
- for (int i = 0; i < COUNTOF(rgFlagNames); i++)
- {
- if (WszGetEnvironmentVariable(rgFlagNames[i], bufEnvString) == 0)
- continue;
-
- buf = bufEnvString.GetUnicode();
- if (buf[0] != '1' || buf[1] != '\0')
- continue;
-
- pFlags[i / 32] |= 1 << (i % 32);
- }
- END_SO_INTOLERANT_CODE
-
- return pFlags;
-}
-
-//------------------------------------------------------------------------
-static VolatilePtr<DWORD> g_pCompatibilityFlags = (DWORD*)(-1);
-
-DWORD* GetGlobalCompatibilityFlags()
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- } CONTRACTL_END;
-
- if (g_pCompatibilityFlags == (DWORD*)(-1))
- {
- DWORD *pCompatibilityFlags = SetupCompatibilityFlags();
-
- if (FastInterlockCompareExchangePointer(g_pCompatibilityFlags.GetPointer(), pCompatibilityFlags, reinterpret_cast<DWORD *>(-1)) != (VOID*)(-1))
- {
- delete [] pCompatibilityFlags;
- }
- }
-
- return g_pCompatibilityFlags;
-}
-#endif // !FEATURE_CORECLR
//------------------------------------------------------------------------
BOOL GetCompatibilityFlag(CompatibilityFlag flag)
@@ -13919,16 +13028,7 @@ BOOL GetCompatibilityFlag(CompatibilityFlag flag)
SO_TOLERANT;
} CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- DWORD *pFlags = GetGlobalCompatibilityFlags();
-
- if (pFlags != NULL)
- return (pFlags[flag / 32] & (1 << (flag % 32))) ? TRUE : FALSE;
- else
- return FALSE;
-#else // !FEATURE_CORECLR
return FALSE;
-#endif // !FEATURE_CORECLR
}
#endif // !DACCESS_COMPILE
@@ -14127,7 +13227,6 @@ AppDomain::AssemblyIterator::Next_UnsafeNoAddRef(
return FALSE;
} // AppDomain::AssemblyIterator::Next_UnsafeNoAddRef
-#ifdef FEATURE_CORECLR
//---------------------------------------------------------------------------------------
//
@@ -14165,7 +13264,6 @@ BOOL AppDomain::IsImageFullyTrusted(PEImage* pPEImage)
return IsImageFromTrustedPath(pPEImage);
}
-#endif //FEATURE_CORECLR
#endif //!DACCESS_COMPILE
@@ -14850,7 +13948,7 @@ void AppDomain::UnPublishHostedAssembly(
}
}
-#if defined(FEATURE_CORECLR) && defined(FEATURE_COMINTEROP)
+#if defined(FEATURE_COMINTEROP)
HRESULT AppDomain::SetWinrtApplicationContext(SString &appLocalWinMD)
{
STANDARD_VM_CONTRACT;
@@ -14904,7 +14002,7 @@ PTR_DomainAssembly AppDomain::FindAssembly(PTR_ICLRPrivAssembly pHostAssembly)
}
}
-#if !defined(DACCESS_COMPILE) && defined(FEATURE_CORECLR) && defined(FEATURE_NATIVE_IMAGE_GENERATION)
+#if !defined(DACCESS_COMPILE) && defined(FEATURE_NATIVE_IMAGE_GENERATION)
void ZapperSetBindingPaths(ICorCompilationDomain *pDomain, SString &trustedPlatformAssemblies, SString &platformResourceRoots, SString &appPaths, SString &appNiPaths)
{
@@ -14919,7 +14017,7 @@ void ZapperSetBindingPaths(ICorCompilationDomain *pDomain, SString &trustedPlatf
#endif
-#if defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
+#if !defined(CROSSGEN_COMPILE)
bool IsSingleAppDomain()
{
STARTUP_FLAGS flags = CorHost2::GetStartupFlags();
diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp
index 670f685fdc..0e7ab65e63 100644
--- a/src/vm/appdomain.hpp
+++ b/src/vm/appdomain.hpp
@@ -42,10 +42,6 @@
#ifdef FEATURE_COMINTEROP
#include "clrprivbinderwinrt.h"
-#ifndef FEATURE_CORECLR
-#include "clrprivbinderreflectiononlywinrt.h"
-#include "clrprivtypecachereflectiononlywinrt.h"
-#endif
#include "..\md\winmd\inc\adapter.h"
#include "winrttypenameconverter.h"
#endif // FEATURE_COMINTEROP
@@ -1988,13 +1984,8 @@ public:
inline LPCWSTR GetAppDomainManagerType();
inline EInitializeNewDomainFlags GetAppDomainManagerInitializeNewDomainFlags();
-#ifndef FEATURE_CORECLR
- inline BOOL AppDomainManagerSetFromConfig();
- Assembly *GetAppDomainManagerEntryAssembly();
- void ComputeTargetFrameworkName();
-#endif // FEATURE_CORECLR
-#if defined(FEATURE_CORECLR) && defined(FEATURE_COMINTEROP)
+#if defined(FEATURE_COMINTEROP)
HRESULT SetWinrtApplicationContext(SString &appLocalWinMD);
#endif // FEATURE_CORECLR && FEATURE_COMINTEROP
@@ -2032,10 +2023,6 @@ public:
virtual BOOL IsAppDomain() { LIMITED_METHOD_DAC_CONTRACT; return TRUE; }
virtual PTR_AppDomain AsAppDomain() { LIMITED_METHOD_CONTRACT; return dac_cast<PTR_AppDomain>(this); }
-#ifndef FEATURE_CORECLR
- void InitializeSorting(OBJECTREF* ppAppdomainSetup);
- void InitializeHashing(OBJECTREF* ppAppdomainSetup);
-#endif
OBJECTREF DoSetup(OBJECTREF* setupInfo);
@@ -2290,7 +2277,6 @@ public:
return AssemblyIterator::Create(this, assemblyIterationFlags);
}
-#ifdef FEATURE_CORECLR
private:
struct NativeImageDependenciesEntry
{
@@ -2346,7 +2332,6 @@ public:
void SetNativeDllSearchDirectories(LPCWSTR paths);
BOOL HasNativeDllSearchDirectories();
void ShutdownNativeDllSearchDirectories();
-#endif // FEATURE_CORECLR
public:
SIZE_T GetAssemblyCount()
@@ -2485,10 +2470,6 @@ public:
//****************************************************************************************
// Determines if the image is to be loaded into the shared assembly or an individual
// appdomains.
-#ifndef FEATURE_CORECLR
- BOOL ApplySharePolicy(DomainAssembly *pFile);
- BOOL ApplySharePolicyFlag(DomainAssembly *pFile);
-#endif
#endif // FEATURE_LOADER_OPTIMIZATION
BOOL HasSetSecurityPolicy();
@@ -3480,9 +3461,6 @@ private:
BOOL isTerminating;
BOOL *pResult;
};
- #ifndef FEATURE_CORECLR
- static void RaiseUnhandledExceptionEvent_Wrapper(LPVOID /* RaiseUnhandled_Args * */);
- #endif
static void AllowThreadEntrance(AppDomain *pApp);
@@ -3843,11 +3821,9 @@ public:
ILLEGAL_VERIFICATION_DOMAIN = 0x8000, // This can't be a verification domain
IGNORE_UNHANDLED_EXCEPTIONS = 0x10000, // AppDomain was created using the APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS flag
ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x20000, // AppDomain was created using the APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP flag
-#ifdef FEATURE_CORECLR
ENABLE_SKIP_PLAT_CHECKS = 0x200000, // Skip various assembly checks (like platform check)
ENABLE_ASSEMBLY_LOADFILE = 0x400000, // Allow Assembly.LoadFile in CoreCLR
DISABLE_TRANSPARENCY_ENFORCEMENT= 0x800000, // Disable enforcement of security transparency rules
-#endif
};
SecurityContext *m_pSecContext;
@@ -3861,9 +3837,7 @@ public:
BOOL m_fAppDomainManagerSetInConfig;
EInitializeNewDomainFlags m_dwAppDomainManagerInitializeDomainFlags;
-#ifdef FEATURE_CORECLR
ArrayList m_NativeDllSearchDirectories;
-#endif
BOOL m_ReversePInvokeCanEnter;
bool m_ForceTrivialWaitOperations;
// Section to support AD unload due to escalation
@@ -3891,10 +3865,8 @@ public:
return (m_Stage == STAGE_UNLOAD_REQUESTED);
}
-#ifdef FEATURE_CORECLR
BOOL IsImageFromTrustedPath(PEImage* pImage);
BOOL IsImageFullyTrusted(PEImage* pImage);
-#endif
#ifdef FEATURE_TYPEEQUIVALENCE
private:
@@ -3941,15 +3913,6 @@ private:
#endif //FEATURE_COMINTEROP
public:
-#ifndef FEATURE_CORECLR
- BOOL m_bUseOsSorting;
- DWORD m_sortVersion;
- COMNlsCustomSortLibrary *m_pCustomSortLibrary;
-#if _DEBUG
- BOOL m_bSortingInitialized;
-#endif // _DEBUG
- COMNlsHashProvider *m_pNlsHashProvider;
-#endif // !FEATURE_CORECLR
private:
// This is the root-level default load context root binder. If null, then
@@ -4367,9 +4330,6 @@ public:
}
#endif // DACCESS_COMPILE
-#ifndef FEATURE_CORECLR
- static void ExecuteMainMethod(HMODULE hMod, __in_opt LPWSTR path = NULL);
-#endif
static void ActivateApplication(int *pReturnValue);
static void InitializeDefaultDomain(BOOL allowRedirects, ICLRPrivBinder * pBinder = NULL);
diff --git a/src/vm/appdomain.inl b/src/vm/appdomain.inl
index 210334c78e..2986588ddc 100644
--- a/src/vm/appdomain.inl
+++ b/src/vm/appdomain.inl
@@ -231,13 +231,6 @@ inline LPCWSTR AppDomain::GetAppDomainManagerType()
return m_AppDomainManagerType;
}
-#ifndef FEATURE_CORECLR
-inline BOOL AppDomain::AppDomainManagerSetFromConfig()
-{
- WRAPPER_NO_CONTRACT;
- return m_fAppDomainManagerSetInConfig;
-}
-#endif // !FEATURE_CORECLR
inline EInitializeNewDomainFlags AppDomain::GetAppDomainManagerInitializeNewDomainFlags()
{
@@ -245,7 +238,6 @@ inline EInitializeNewDomainFlags AppDomain::GetAppDomainManagerInitializeNewDoma
return m_dwAppDomainManagerInitializeDomainFlags;
}
-#ifdef FEATURE_CORECLR
inline AppDomain::PathIterator AppDomain::IterateNativeDllSearchDirectories()
{
WRAPPER_NO_CONTRACT;
@@ -260,7 +252,6 @@ inline BOOL AppDomain::HasNativeDllSearchDirectories()
return m_NativeDllSearchDirectories.GetCount() !=0;
}
-#endif // FEATURE_CORECLR
inline BOOL AppDomain::CanReversePInvokeEnter()
{
diff --git a/src/vm/appdomainnative.cpp b/src/vm/appdomainnative.cpp
index 9266849be4..02e96e2286 100644
--- a/src/vm/appdomainnative.cpp
+++ b/src/vm/appdomainnative.cpp
@@ -16,9 +16,6 @@
#include "eeconfig.h"
#include "appdomain.inl"
#include "eventtrace.h"
-#ifndef FEATURE_CORECLR
-#include "comutilnative.h"
-#endif // !FEATURE_CORECLR
#if defined(FEATURE_APPX)
#include "appxutil.h"
#endif // FEATURE_APPX
@@ -177,12 +174,6 @@ void AppDomainNative::CreateDomainHelper (STRINGREF* ppFriendlyName, OBJECTREF*
setupInfo = prepareDataForSetup.Call_RetOBJECTREF(args);
-#ifndef FEATURE_CORECLR
- // We need to setup domain sorting before any other managed code runs in the domain, since that code
- // could end up caching data based on the sorting mode of the domain.
- pDomain->InitializeSorting(ppAppdomainSetup);
- pDomain->InitializeHashing(ppAppdomainSetup);
-#endif
// We need to ensure that the AppDomainProxy is generated before we call into DoSetup, since
// GetAppDomainProxy will ensure that remoting is correctly configured in the domain. DoSetup can
@@ -1341,7 +1332,6 @@ FCIMPL1(void , AppDomainNative::PublishAnonymouslyHostedDynamicMethodsAssembly,
}
FCIMPLEND
-#ifdef FEATURE_CORECLR
void QCALLTYPE AppDomainNative::SetNativeDllSearchDirectories(__in_z LPCWSTR wszNativeDllSearchDirectories)
{
@@ -1398,7 +1388,6 @@ void QCALLTYPE AppDomainNative::SetNativeDllSearchDirectories(__in_z LPCWSTR wsz
END_QCALL;
}
-#endif // FEATURE_CORECLR
#ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
FCIMPL0(void, AppDomainNative::EnableMonitoring)
diff --git a/src/vm/appdomainnative.hpp b/src/vm/appdomainnative.hpp
index dff84345ea..6825fcfac6 100644
--- a/src/vm/appdomainnative.hpp
+++ b/src/vm/appdomainnative.hpp
@@ -66,9 +66,7 @@ public:
static FCDECL2(FC_BOOL_RET, IsFrameworkAssembly, AppDomainBaseObject* refThisUNSAFE, AssemblyNameBaseObject* refAssemblyNameUNSAFE);
static FCDECL1(UINT32, GetAppDomainId, AppDomainBaseObject* refThisUNSAFE);
static FCDECL1(void , PublishAnonymouslyHostedDynamicMethodsAssembly, AssemblyBaseObject * pAssemblyUNSAFE);
-#ifdef FEATURE_CORECLR
static void QCALLTYPE SetNativeDllSearchDirectories(__in_z LPCWSTR wszAssembly);
-#endif // FEATURE_CORECLR
#ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
static FCDECL0(void, EnableMonitoring);
diff --git a/src/vm/appxutil.cpp b/src/vm/appxutil.cpp
index 6bc04d74cd..6ec0386d0a 100644
--- a/src/vm/appxutil.cpp
+++ b/src/vm/appxutil.cpp
@@ -148,48 +148,9 @@ namespace AppX
}
CONTRACTL_END
-#ifdef FEATURE_CORECLR
// CoreCLR does not have proper support for AppX design mode. Once/if it has one, it should not need
// any special casing like desktop. Avoid the expensive check completely.
return false;
-#else
- // DevMode does not change over the lifetime of a process and is expensive to compute
- // Cache the first answer and return it once computed; idempotent so races are fine
- static enum
- {
- CachedAppxMode_Unknown,
- CachedAppxMode_Normal,
- CachedAppxMode_Design
- }
- s_cachedAppxMode = CachedAppxMode_Unknown;
-
- bool result = false;
-
- switch (s_cachedAppxMode)
- {
- case CachedAppxMode_Unknown:
- if (SUCCEEDED(IsAppXDesignModeWorker(&result)))
- { // Cache the result on success; otherwise use the default value of false.
- s_cachedAppxMode = result ? CachedAppxMode_Design : CachedAppxMode_Normal;
- }
- break;
-
- case CachedAppxMode_Normal:
- result = false;
- break;
-
- case CachedAppxMode_Design:
- result = true;
- break;
- }
-
-#ifdef _DEBUG
- bool dbg_result = false;
- _ASSERTE(FAILED(IsAppXDesignModeWorker(&dbg_result)) || dbg_result == result);
-#endif
-
- return result;
-#endif // FEATURE_CORECLR
}
HRESULT GetApplicationId(LPCWSTR& rString)
diff --git a/src/vm/arm/stubs.cpp b/src/vm/arm/stubs.cpp
index 1309695f73..5c9e31eab5 100644
--- a/src/vm/arm/stubs.cpp
+++ b/src/vm/arm/stubs.cpp
@@ -2675,7 +2675,6 @@ void InitJITHelpers1()
}
-#ifdef FEATURE_CORECLR
if(IsSingleAppDomain())
{
SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase_SingleAppDomain);
@@ -2684,7 +2683,6 @@ void InitJITHelpers1()
SetJitHelperFunction(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain);
}
else
-#endif
if (gAppDomainTLSIndex >= TLS_MINIMUM_AVAILABLE)
{
SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase_Portable);
diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp
index eb4c2e5083..59f9947ef0 100644
--- a/src/vm/assembly.cpp
+++ b/src/vm/assembly.cpp
@@ -28,10 +28,6 @@
#include "ngenoptout.h"
#endif
-#if !defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
-#include "assemblyusagelogmanager.h"
-#include "policy.h"
-#endif
#include "eeprofinterfaces.h"
#include "reflectclasswriter.h"
@@ -67,10 +63,6 @@
#include "peimagelayout.inl"
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-#include <shlobj.h>
-#include "eventmsg.h"
-#endif
#ifdef FEATURE_TRACELOGGING
#include "clrtracelogging.h"
@@ -171,9 +163,6 @@ Assembly::Assembly(BaseDomain *pDomain, PEAssembly* pFile, DebuggerAssemblyContr
#ifdef FEATURE_COMINTEROP
, m_InteropAttributeStatus(INTEROP_ATTRIBUTE_UNSET)
#endif
-#ifndef FEATURE_CORECLR
- , m_fSupportsAutoNGen(FALSE)
-#endif
{
STANDARD_VM_CONTRACT;
}
@@ -285,13 +274,6 @@ void Assembly::Init(AllocMemTracker *pamTracker, LoaderAllocator *pLoaderAllocat
if (!m_pManifest->IsReadyToRun())
CacheManifestExportedTypes(pamTracker);
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- GenerateBreadcrumbForServicing();
-
- m_fSupportsAutoNGen = SupportsAutoNGenWorker();
-
- ReportAssemblyUse();
-#endif
#ifdef FEATURE_TRACELOGGING
@@ -808,69 +790,12 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, CreateDynamicAssemblyArgs
}
AssemblyLoadSecurity loadSecurity;
-#ifndef FEATURE_CORECLR
- DWORD dwSpecialFlags = 0xFFFFFFFF;
-
- // Don't bother with setting up permissions if this isn't allowed to run
- // This doesn't apply in CoreCLR because you cannot specify evidence when creating a dynamic assembly
- if ((args->identity != NULL) &&
- (args->access & ASSEMBLY_ACCESS_RUN))
- {
- loadSecurity.m_pAdditionalEvidence = &args->identity;
- }
- else
- {
- if (pCallerAssembly != NULL) // can be null if caller is interop
- {
- if (args->securityContextSource == kCurrentAssembly)
- {
- IAssemblySecurityDescriptor *pCallerSecDesc = pCallerAssembly->GetSecurityDescriptor(pCallersDomain);
- gc.granted = pCallerSecDesc->GetGrantedPermissionSet(&(gc.denied));
- dwSpecialFlags = pCallerSecDesc->GetSpecialFlags();
- }
- else
- {
- IApplicationSecurityDescriptor *pCallersDomainSecDesc = pCallersDomain->GetSecurityDescriptor();
-
-#ifdef FEATURE_CAS_POLICY
- // We only want to propigate the identity of homogenous domains, since heterogenous domains tend
- // to be fully trusted even if they are housing partially trusted code - which could lead to an
- // elevation of privilege if we allow the grant set to be pushed to assemblies partially trusted
- // code is loading.
- if (!pCallersDomainSecDesc->IsHomogeneous())
- {
- COMPlusThrow(kNotSupportedException, W("NotSupported_SecurityContextSourceAppDomainInHeterogenous"));
- }
-#endif // FEATURE_CAS_POLICY
-
- gc.granted = pCallersDomainSecDesc->GetGrantedPermissionSet();
- dwSpecialFlags = pCallersDomainSecDesc->GetSpecialFlags();
- }
-
- // Caller may be in another appdomain context, in which case we'll
- // need to marshal/unmarshal the grant and deny sets across.
-#ifdef FEATURE_REMOTING // should not happen without remoting
- if (pCallersDomain != ::GetAppDomain())
- {
- gc.granted = AppDomainHelper::CrossContextCopyFrom(pCallersDomain->GetId(), &(gc.granted));
- if (gc.denied != NULL)
- {
- gc.denied = AppDomainHelper::CrossContextCopyFrom(pCallersDomain->GetId(), &(gc.denied));
- }
- }
-#else // !FEATURE_REMOTING
- _ASSERTE(pCallersDomain == ::GetAppDomain());
-#endif // FEATURE_REMOTING
- }
- }
-#else // FEATURE_CORECLR
// In SilverLight all dynamic assemblies should be transparent and partially trusted, even if they are
// created by platform assemblies. Thus they should inherit the grant sets from the appdomain not the
// parent assembly.
IApplicationSecurityDescriptor *pCurrentDomainSecDesc = ::GetAppDomain()->GetSecurityDescriptor();
gc.granted = pCurrentDomainSecDesc->GetGrantedPermissionSet();
DWORD dwSpecialFlags = pCurrentDomainSecDesc->GetSpecialFlags();
-#endif // !FEATURE_CORECLR
// If the dynamic assembly creator did not specify evidence for the newly created assembly, then it
// should inherit the grant set of the creation assembly.
@@ -992,33 +917,6 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, CreateDynamicAssemblyArgs
tokenFlags |= TokenSecurityDescriptorFlags_TreatAsSafe;
-#ifndef FEATURE_CORECLR
- // Use the security rules given to us if the emitting code has selected a specific one. Otherwise,
- // inherit the security rules of the emitting assembly.
- if (args->securityRulesBlob != NULL)
- {
- tokenFlags |= ParseSecurityRulesAttribute(args->securityRulesBlob->GetDirectPointerToNonObjectElements(),
- args->securityRulesBlob->GetNumComponents());
- }
- else
- {
- // Ensure that dynamic assemblies created by mscorlib always specify a rule set, since we want to
- // make sure that creating a level 2 assembly was an explicit decision by the emitting code,
- // rather than an implicit decision because mscorlib is level 2 itself.
- //
- // If you're seeing this assert, it means that you've created a dynamic assembly from mscorlib,
- // but did not pass a CustomAttributeBuilder for the SecurityRulesAttribute to the
- // DefineDynamicAssembly call.
- _ASSERTE(!pCallerAssembly->IsSystem());
-
- // Use the creating assembly's security rule set for the emitted assembly
- SecurityRuleSet callerRuleSet =
- ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pCallerAssembly)->GetSecurityRuleSet();
- tokenFlags |= EncodeSecurityRuleSet(callerRuleSet);
-
- tokenFlags |= TokenSecurityDescriptorFlags_SecurityRules;
- }
-#endif // !FEATURE_CORECLR
_ASSERTE(pAssem->GetManifestModule()->m_pModuleSecurityDescriptor != NULL);
pAssem->GetManifestModule()->m_pModuleSecurityDescriptor->OverrideTokenFlags(tokenFlags);
@@ -1030,47 +928,6 @@ Assembly *Assembly::CreateDynamic(AppDomain *pDomain, CreateDynamicAssemblyArgs
if (publicKey.GetSize() > 0)
{
pAssem->SetStrongNameLevel(Assembly::SN_PUBLIC_KEY);
-#ifndef FEATURE_CORECLR
- gc.strongNameKeyPair = args->assemblyName->GetStrongNameKeyPair();
- // If there's a public key, there might be a strong name key pair.
- if (gc.strongNameKeyPair != NULL)
- {
- MethodDescCallSite getKeyPair(METHOD__STRONG_NAME_KEY_PAIR__GET_KEY_PAIR, &gc.strongNameKeyPair);
-
- ARG_SLOT arglist[] =
- {
- ObjToArgSlot(gc.strongNameKeyPair),
- PtrToArgSlot(&gc.orArrayOrContainer)
- };
-
- BOOL bKeyInArray;
- bKeyInArray = (BOOL)getKeyPair.Call_RetBool(arglist);
-
- if (bKeyInArray)
- {
- U1ARRAYREF orArray = (U1ARRAYREF)gc.orArrayOrContainer;
- pAssem->m_cbStrongNameKeyPair = orArray->GetNumComponents();
- pAssem->m_pbStrongNameKeyPair = new BYTE[pAssem->m_cbStrongNameKeyPair];
-
- pAssem->m_FreeFlag |= pAssem->FREE_KEY_PAIR;
- memcpy(pAssem->m_pbStrongNameKeyPair, orArray->GetDataPtr(), pAssem->m_cbStrongNameKeyPair);
- pAssem->SetStrongNameLevel(Assembly::SN_FULL_KEYPAIR_IN_ARRAY);
- }
- else
- {
- STRINGREF orContainer = (STRINGREF)gc.orArrayOrContainer;
- DWORD cchContainer = orContainer->GetStringLength();
- pAssem->m_pwStrongNameKeyContainer = new WCHAR[cchContainer + 1];
-
- pAssem->m_FreeFlag |= pAssem->FREE_KEY_CONTAINER;
- memcpy(pAssem->m_pwStrongNameKeyContainer, orContainer->GetBuffer(), cchContainer * sizeof(WCHAR));
- pAssem->m_pwStrongNameKeyContainer[cchContainer] = W('\0');
-
- pAssem->SetStrongNameLevel(Assembly::SN_FULL_KEYPAIR_IN_CONTAINER);
- }
- }
- else
-#endif // FEATURE_CORECLR
{
// Since we have no way to validate the public key of a dynamic assembly we don't allow
// partial trust code to emit a dynamic assembly with an arbitrary public key.
@@ -1764,11 +1621,6 @@ Module * Assembly::FindModuleByTypeRef(
RETURN NULL;
}
-#ifndef FEATURE_CORECLR
- // Event Tracing for Windows is used to log data for performance and functional testing purposes.
- // The events below are used to help measure the performance of assembly loading of a static reference.
- FireEtwLoaderPhaseStart((::GetAppDomain() ? ::GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable), ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderStaticLoad, NULL, NULL, GetClrInstanceId());
-#endif //!FEATURE_CORECLR
DomainAssembly * pDomainAssembly = pModule->LoadAssembly(
::GetAppDomain(),
@@ -1776,27 +1628,6 @@ Module * Assembly::FindModuleByTypeRef(
szNamespace,
szClassName);
-#ifndef FEATURE_CORECLR
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD))
- {
- StackSString assemblySimpleName;
- EX_TRY
- {
- if ((pDomainAssembly != NULL) && (pDomainAssembly->GetCurrentAssembly() != NULL))
- {
- assemblySimpleName.AppendUTF8(pDomainAssembly->GetCurrentAssembly()->GetSimpleName());
- assemblySimpleName.Normalize(); // Ensures that the later cast to LPCWSTR does not throw.
- }
- }
- EX_CATCH
- {
- assemblySimpleName.Clear();
- }
- EX_END_CATCH(RethrowTransientExceptions)
-
- FireEtwLoaderPhaseEnd(::GetAppDomain() ? ::GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderStaticLoad, NULL, assemblySimpleName.IsEmpty() ? NULL : (LPCWSTR)assemblySimpleName, GetClrInstanceId());
- }
-#endif //!FEATURE_CORECLR
if (pDomainAssembly == NULL)
RETURN NULL;
@@ -2539,20 +2370,7 @@ HRESULT RunMain(MethodDesc *pFD ,
if ((EntryType == EntryManagedMain) &&
(stringArgs == NULL)) {
- #ifndef FEATURE_CORECLR
- // If you look at the DIFF on this code then you will see a major change which is that we
- // no longer accept all the different types of data arguments to main. We now only accept
- // an array of strings.
-
- wzArgs = CorCommandLine::GetArgvW(&cCommandArgs);
- // In the WindowsCE case where the app has additional args the count will come back zero.
- if (cCommandArgs > 0) {
- if (!wzArgs)
- return E_INVALIDARG;
- }
-#else // !FEATURE_CORECLR
return E_INVALIDARG;
-#endif // !FEATURE_CORECLR
}
ETWFireEvent(Main_V1);
@@ -2727,13 +2545,11 @@ INT32 Assembly::ExecuteMainMethod(PTRARRAYREF *stringArgs, BOOL waitForOtherThre
}
#endif // FEATURE_APPX_BINDER && FEATURE_MULTICOREJIT
-#ifdef FEATURE_CORECLR
// Set the root assembly as the assembly that is containing the main method
// The root assembly is used in the GetEntryAssembly method that on CoreCLR is used
// to get the TargetFrameworkMoniker for the app
AppDomain * pDomain = pThread->GetDomain();
pDomain->SetRootAssembly(pMeth->GetAssembly());
-#endif
hr = RunMain(pMeth, 1, &iRetVal, stringArgs);
}
}
@@ -3165,24 +2981,13 @@ mdAssemblyRef Assembly::AddAssemblyRef(Assembly *refedAssembly, IMetaDataAssembl
GC_TRIGGERS;
INJECT_FAULT(COMPlusThrowOM(););
PRECONDITION(CheckPointer(refedAssembly));
-#ifdef FEATURE_CORECLR
PRECONDITION(CheckPointer(pAssemEmitter, NULL_NOT_OK));
-#else
- PRECONDITION(CheckPointer(pAssemEmitter, NULL_OK));
-#endif //FEATURE_CORECLR
POSTCONDITION(!IsNilToken(RETVAL));
POSTCONDITION(TypeFromToken(RETVAL) == mdtAssemblyRef);
}
CONTRACT_END;
SafeComHolder<IMetaDataAssemblyEmit> emitHolder;
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- if (pAssemEmitter == NULL)
- {
- pAssemEmitter = GetOnDiskMDAssemblyEmitter();
- emitHolder.Assign(pAssemEmitter);
- }
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
AssemblySpec spec;
spec.InitializeSpec(refedAssembly->GetManifestFile());
@@ -3250,476 +3055,6 @@ void Assembly::AddExportedType(mdExportedType cl)
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-
-//***********************************************************
-//
-// get the IMetaDataAssemblyEmit for the on disk manifest.
-// Note that the pointer returned is AddRefed. It is the caller's
-// responsibility to release the reference.
-//
-//***********************************************************
-IMetaDataAssemblyEmit *Assembly::GetOnDiskMDAssemblyEmitter()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END
-
- IMetaDataAssemblyEmit *pAssemEmitter = NULL;
- IMetaDataEmit *pEmitter;
- RefClassWriter *pRCW;
-
- _ASSERTE(m_pOnDiskManifest);
-
- pRCW = m_pOnDiskManifest->GetClassWriter();
- _ASSERTE(pRCW);
-
- // If the RefClassWriter has a on disk emitter, then use it rather than the in-memory emitter.
- pEmitter = pRCW->GetOnDiskEmitter();
-
- if (pEmitter == NULL)
- pEmitter = m_pOnDiskManifest->GetEmitter();
-
- _ASSERTE(pEmitter != NULL);
-
- IfFailThrow(pEmitter->QueryInterface(IID_IMetaDataAssemblyEmit, (void**) &pAssemEmitter));
-
- if (pAssemEmitter == NULL)
- {
- // the manifest is not writable
- _ASSERTE(!"Bad usage!");
- }
- return pAssemEmitter;
-}
-
-//***********************************************************
-//
-// prepare saving manifest to disk.
-//
-//***********************************************************
-void Assembly::PrepareSavingManifest(ReflectionModule *pAssemblyModule)
-{
- STANDARD_VM_CONTRACT;
-
- if (pAssemblyModule)
- {
- // embedded assembly
- m_pOnDiskManifest = pAssemblyModule;
- m_fEmbeddedManifest = true;
- }
- else
- {
- m_fEmbeddedManifest = false;
-
- StackSString name(SString::Utf8, GetSimpleName());
-
- // Create the module
- m_pOnDiskManifest = CreateDynamicModule(name, name, FALSE /*fIsTransient*/);
- // store the fact this on disk manifest is temporary and can be hidden from the user
- m_needsToHideManifestForEmit = TRUE;
- }
-
- NonVMComHolder<IMetaDataAssemblyEmit> pAssemblyEmit(GetOnDiskMDAssemblyEmitter());
-
- // Copy assembly metadata to emit scope
- //<TODO>@todo: add Title, Description, Alias as CA</TODO>
- // <TODO>@todo: propagate all of the information</TODO>
- // <TODO>@todo: introduce a helper in metadata to take the ansi version of string.</TODO>
-
- IMetaDataAssemblyImport *pAssemblyImport = GetManifestFile()->GetAssemblyImporter();
-
- const void *pbPublicKey;
- ULONG cbPublicKey;
- ULONG ulHashAlgId;
- LPWSTR szName;
- ULONG chName;
- ASSEMBLYMETADATA MetaData;
- DWORD dwAssemblyFlags;
-
- MetaData.cbLocale = 0;
- MetaData.ulProcessor = 0;
- MetaData.ulOS = 0;
- IfFailThrow(pAssemblyImport->GetAssemblyProps(TokenFromRid(1, mdtAssembly),
- NULL, NULL, NULL,
- NULL, 0, &chName,
- &MetaData, NULL));
- StackSString name;
- szName = name.OpenUnicodeBuffer(chName);
-
- SString locale;
- MetaData.szLocale = locale.OpenUnicodeBuffer(MetaData.cbLocale);
-
- SBuffer proc;
- MetaData.rProcessor = (DWORD *) proc.OpenRawBuffer(MetaData.ulProcessor*sizeof(*MetaData.rProcessor));
-
- SBuffer os;
- MetaData.rOS = (OSINFO *) os.OpenRawBuffer(MetaData.ulOS*sizeof(*MetaData.rOS));
-
- IfFailThrow(pAssemblyImport->GetAssemblyProps(TokenFromRid(1, mdtAssembly),
- &pbPublicKey, &cbPublicKey, &ulHashAlgId,
- szName, chName, &chName,
- &MetaData, &dwAssemblyFlags));
-
- mdAssembly ad;
- IfFailThrow(pAssemblyEmit->DefineAssembly(pbPublicKey, cbPublicKey, ulHashAlgId,
- szName, &MetaData, dwAssemblyFlags, &ad));
-
- SafeComHolder<IMetaDataImport> pImport;
- IfFailThrow(pAssemblyEmit->QueryInterface(IID_IMetaDataImport, (void**)&pImport));
- ULONG cExistingName = 0;
- if (FAILED(pImport->GetScopeProps(NULL, 0, &cExistingName, NULL)) || cExistingName == 0)
- {
- SafeComHolder<IMetaDataEmit> pEmit;
- IfFailThrow(pAssemblyEmit->QueryInterface(IID_IMetaDataEmit, (void**)&pEmit));
- IfFailThrow(pEmit->SetModuleProps(szName));
- }
-
- name.CloseBuffer();
- locale.CloseBuffer();
- proc.CloseRawBuffer();
- os.CloseRawBuffer();
-} // Assembly::PrepareSavingManifest
-
-
-//***********************************************************
-//
-// add a file name to the file list of this assembly. On disk only.
-//
-//***********************************************************
-mdFile Assembly::AddFile(LPCWSTR wszFileName)
-{
- STANDARD_VM_CONTRACT;
-
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
- mdFile fl;
-
- // Define File.
- IfFailThrow( pAssemEmitter->DefineFile(
- wszFileName, // [IN] Name of the file.
- 0, // [IN] Hash Blob.
- 0, // [IN] Count of bytes in the Hash Blob.
- 0, // [IN] Flags.
- &fl) ); // [OUT] Returned File token.
-
- return fl;
-} // Assembly::AddFile
-
-
-//***********************************************************
-//
-// Set the hash value on a file table entry.
-//
-//***********************************************************
-void Assembly::SetFileHashValue(mdFile tkFile, LPCWSTR wszFullFileName)
-{
- STANDARD_VM_CONTRACT;
-
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
-
- // Get the hash value.
- SBuffer buffer;
- PEImageHolder map(PEImage::OpenImage(StackSString(wszFullFileName)));
- map->ComputeHash(GetHashAlgId(), buffer);
-
- // Set the hash blob.
- IfFailThrow( pAssemEmitter->SetFileProps(
- tkFile, // [IN] File Token.
- buffer, // [IN] Hash Blob.
- buffer.GetSize(), // [IN] Count of bytes in the Hash Blob.
- (DWORD) -1)); // [IN] Flags.
-
-} // Assembly::SetHashValue
-
-//*****************************************************************************
-// Add a Type name to the ExportedType table in the on-disk assembly manifest.
-//*****************************************************************************
-mdExportedType Assembly::AddExportedTypeOnDisk(LPCWSTR wszExportedType, mdToken tkImpl, mdToken tkTypeDef, CorTypeAttr flags)
-{
- STANDARD_VM_CONTRACT;
-
- _ASSERTE(TypeFromToken(tkTypeDef) == mdtTypeDef);
-
- // The on-disk assembly manifest
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
-
- mdExportedType ct;
-
- IfFailThrow( pAssemEmitter->DefineExportedType(
- wszExportedType, // [IN] Name of the COMType.
- tkImpl, // [IN] mdFile or mdAssemblyRef that provides the ExportedType.
- tkTypeDef, // [IN] TypeDef token within the file.
- flags, // [IN] Flags.
- &ct) ); // [OUT] Returned ExportedType token.
-
- return ct;
-} // Assembly::AddExportedTypeOnDisk
-
-//*******************************************************************************
-// Add a Type name to the ExportedType table in the in-memory assembly manifest.
-//*******************************************************************************
-mdExportedType Assembly::AddExportedTypeInMemory(LPCWSTR wszExportedType, mdToken tkImpl, mdToken tkTypeDef, CorTypeAttr flags)
-{
- STANDARD_VM_CONTRACT;
-
- _ASSERTE(TypeFromToken(tkTypeDef) == mdtTypeDef);
-
- // The in-memory assembly manifest
- IMetaDataAssemblyEmit* pAssemEmitter = GetManifestFile()->GetAssemblyEmitter();
-
- mdExportedType ct;
-
- IfFailThrow( pAssemEmitter->DefineExportedType(
- wszExportedType, // [IN] Name of the COMType.
- tkImpl, // [IN] mdFile or mdAssemblyRef that provides the ExportedType.
- tkTypeDef, // [IN] TypeDef token within the file.
- flags, // [IN] Flags.
- &ct) ); // [OUT] Returned ExportedType token.
-
- return ct;
-} // Assembly::AddExportedTypeInMemory
-
-
-//***********************************************************
-// add an entry to ManifestResource table for a stand alone managed resource. On disk only.
-//***********************************************************
-void Assembly::AddStandAloneResource(LPCWSTR wszName, LPCWSTR wszDescription, LPCWSTR wszMimeType, LPCWSTR wszFileName, LPCWSTR wszFullFileName, int iAttribute)
-{
- STANDARD_VM_CONTRACT;
-
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
- mdFile tkFile;
- mdManifestResource mr;
- SBuffer hash;
-
- // Get the hash value;
- if (GetHashAlgId())
- {
- PEImageHolder pImage(PEImage::OpenImage(StackSString(wszFullFileName)));
- pImage->ComputeHash(GetHashAlgId(), hash);
- }
-
- IfFailThrow( pAssemEmitter->DefineFile(
- wszFileName, // [IN] Name of the file.
- hash, // [IN] Hash Blob.
- hash.GetSize(), // [IN] Count of bytes in the Hash Blob.
- ffContainsNoMetaData, // [IN] Flags.
- &tkFile) ); // [OUT] Returned File token.
-
-
- IfFailThrow( pAssemEmitter->DefineManifestResource(
- wszName, // [IN] Name of the resource.
- tkFile, // [IN] mdFile or mdAssemblyRef that provides the resource.
- 0, // [IN] Offset to the beginning of the resource within the file.
- iAttribute, // [IN] Flags.
- &mr) ); // [OUT] Returned ManifestResource token.
-
-} // Assembly::AddStandAloneResource
-
-
-//***********************************************************
-// Save security permission requests.
-//***********************************************************
-void Assembly::AddDeclarativeSecurity(DWORD dwAction, void const *pValue, DWORD cbValue)
-{
- STANDARD_VM_CONTRACT;
-
- mdAssembly tkAssembly = 0x20000001;
-
- SafeComHolder<IMetaDataAssemblyEmit> pAssemEmitter(GetOnDiskMDAssemblyEmitter());
- _ASSERTE( pAssemEmitter );
-
- SafeComHolder<IMetaDataEmitHelper> pEmitHelper;
- IfFailThrow( pAssemEmitter->QueryInterface(IID_IMetaDataEmitHelper, (void**)&pEmitHelper) );
-
- IfFailThrow(pEmitHelper->AddDeclarativeSecurityHelper(tkAssembly,
- dwAction,
- pValue,
- cbValue,
- NULL));
-}
-
-
-//***********************************************************
-// Allocate space for a strong name signature in the manifest
-//***********************************************************
-HRESULT Assembly::AllocateStrongNameSignature(ICeeFileGen *pCeeFileGen,
- HCEEFILE ceeFile)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END
-
- HRESULT hr;
- HCEESECTION TData;
- DWORD dwDataOffset;
- DWORD dwDataLength;
- DWORD dwDataRVA;
- VOID *pvBuffer;
- const void *pbPublicKey;
- ULONG cbPublicKey;
-
- // Determine size of signature blob.
-
- IfFailRet(GetManifestImport()->GetAssemblyProps(TokenFromRid(1, mdtAssembly),
- &pbPublicKey, &cbPublicKey, NULL,
- NULL, NULL, NULL));
-
- if (!StrongNameSignatureSize((BYTE *) pbPublicKey, cbPublicKey, &dwDataLength)) {
- hr = StrongNameErrorInfo();
- return hr;
- }
-
- // Allocate space for the signature in the text section and update the COM+
- // header to point to the space.
- IfFailRet(pCeeFileGen->GetIlSection(ceeFile, &TData));
- IfFailRet(pCeeFileGen->GetSectionDataLen(TData, &dwDataOffset));
- IfFailRet(pCeeFileGen->GetSectionBlock(TData, dwDataLength, 4, &pvBuffer));
- IfFailRet(pCeeFileGen->GetMethodRVA(ceeFile, dwDataOffset, &dwDataRVA));
- IfFailRet(pCeeFileGen->SetStrongNameEntry(ceeFile, dwDataLength, dwDataRVA));
-
- return S_OK;
-}
-
-
-//***********************************************************
-// Strong name sign a manifest already persisted to disk
-//***********************************************************
-HRESULT Assembly::SignWithStrongName(LPCWSTR wszFileName)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- INJECT_FAULT(return E_OUTOFMEMORY;);
- }
- CONTRACTL_END
-
- HRESULT hr = S_OK;
-
- // If we're going to do a full signing we have a key pair either
- // in a key container or provided directly in a byte array.
-
- switch (m_eStrongNameLevel) {
- case SN_FULL_KEYPAIR_IN_ARRAY:
- if (!StrongNameSignatureGeneration(wszFileName, NULL, m_pbStrongNameKeyPair, m_cbStrongNameKeyPair, NULL, NULL))
- hr = StrongNameErrorInfo();
- break;
-
- case SN_FULL_KEYPAIR_IN_CONTAINER:
- if (!StrongNameSignatureGeneration(wszFileName, m_pwStrongNameKeyContainer, NULL, 0, NULL, NULL))
- hr = StrongNameErrorInfo();
- break;
-
- default:
- break;
- }
-
- return hr;
-}
-
-
-//***********************************************************
-// save the manifest to disk!
-//***********************************************************
-void Assembly::SaveManifestToDisk(LPCWSTR wszFileName, int entrypoint, int fileKind, DWORD corhFlags, DWORD peFlags)
-{
- STANDARD_VM_CONTRACT;
-
- HRESULT hr = NOERROR;
- HCEEFILE ceeFile = NULL;
- ICeeFileGen *pCeeFileGen = NULL;
- RefClassWriter *pRCW;
- IMetaDataEmit *pEmitter;
-
- _ASSERTE( m_fEmbeddedManifest == false );
-
- pRCW = m_pOnDiskManifest->GetClassWriter();
- _ASSERTE(pRCW);
-
- IfFailGo( pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags) );
-
- pCeeFileGen = pRCW->GetCeeFileGen();
- ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- //Emit the MetaData
- pEmitter = m_pOnDiskManifest->GetClassWriter()->GetEmitter();
- IfFailGo( pCeeFileGen->EmitMetaDataEx(ceeFile, pEmitter) );
-
- // Allocate space for a strong name signature if a public key was supplied
- // (this doesn't strong name the assembly, but it makes it possible to do so
- // as a post processing step).
- if (IsStrongNamed())
- IfFailGo(AllocateStrongNameSignature(pCeeFileGen, ceeFile));
-
- IfFailGo( pCeeFileGen->SetOutputFileName(ceeFile, (LPWSTR)wszFileName) );
-
- // the entryPoint for an assembly is a tkFile token if exist.
- if (RidFromToken(entrypoint) != mdTokenNil)
- IfFailGo( pCeeFileGen->SetEntryPoint(ceeFile, entrypoint) );
- if (fileKind == Dll)
- {
- pCeeFileGen->SetDllSwitch(ceeFile, true);
- }
- else
- {
- // should have a valid entry point for applications
- if (fileKind == WindowApplication)
- {
- IfFailGo( pCeeFileGen->SetSubsystem(ceeFile, IMAGE_SUBSYSTEM_WINDOWS_GUI, CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION, CEE_IMAGE_SUBSYSTEM_MINOR_VERSION) );
- }
- else
- {
- _ASSERTE(fileKind == ConsoleApplication);
- IfFailGo( pCeeFileGen->SetSubsystem(ceeFile, IMAGE_SUBSYSTEM_WINDOWS_CUI, CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION, CEE_IMAGE_SUBSYSTEM_MINOR_VERSION) );
- }
-
- }
-
- //Generate the CeeFile
- IfFailGo(pCeeFileGen->GenerateCeeFile(ceeFile) );
-
- // Strong name sign the resulting assembly if required.
- if (IsStrongNamed())
- IfFailGo(SignWithStrongName(wszFileName));
-
- // now release the m_pOnDiskManifest
-ErrExit:
- pRCW->DestroyCeeFileGen();
-
- // we keep the on disk manifest so that the GetModules code can skip over this ad-hoc module when modules are enumerated.
- // Need to see if we can remove the creation of this module alltogether
- //m_pOnDiskManifest = NULL;
-
- if (FAILED(hr))
- {
- if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
- {
- if (IsWin32IOError(HRESULT_CODE(hr)))
- {
- COMPlusThrowHR(COR_E_IO);
- }
- else
- {
- COMPlusThrowHR(hr);
- }
- }
- if (hr == CEE_E_CVTRES_NOT_FOUND)
- COMPlusThrow(kIOException, W("Argument_cvtres_NotFound"));
- COMPlusThrowHR(hr);
- }
-} // Assembly::SaveManifestToDisk
-
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
HRESULT STDMETHODCALLTYPE
@@ -3749,78 +3084,7 @@ GetAssembliesByName(LPCWSTR szAppBase,
if (!(szAssemblyName && ppIUnk && pcAssemblies))
return E_POINTER;
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
hr = COR_E_NOTSUPPORTED;
-#else
- AppDomain *pDomain = NULL;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr)
- if(szAppBase || szPrivateBin)
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
- MethodDescCallSite createDomainEx(METHOD__APP_DOMAIN__CREATE_DOMAINEX);
- struct _gc {
- STRINGREF pFriendlyName;
- STRINGREF pAppBase;
- STRINGREF pPrivateBin;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
- gc.pFriendlyName = StringObject::NewString(W("GetAssembliesByName"));
-
- if(szAppBase)
- {
- gc.pAppBase = StringObject::NewString(szAppBase);
- }
-
- if(szPrivateBin)
- {
- gc.pPrivateBin = StringObject::NewString(szPrivateBin);
- }
-
- ARG_SLOT args[5] =
- {
- ObjToArgSlot(gc.pFriendlyName),
- NULL,
- ObjToArgSlot(gc.pAppBase),
- ObjToArgSlot(gc.pPrivateBin),
- BoolToArgSlot(false)
- };
- APPDOMAINREF pDom = (APPDOMAINREF) createDomainEx.Call_RetOBJECTREF(args);
- if (pDom == NULL)
- {
- hr = E_FAIL;
- }
- else
- {
- Context *pContext = CRemotingServices::GetServerContextForProxy((OBJECTREF) pDom);
- _ASSERTE(pContext);
- pDomain = pContext->GetDomain();
- }
-
- GCPROTECT_END();
- }
- else
- pDomain = SystemDomain::System()->DefaultDomain();
-
- Assembly *pFoundAssembly;
- if (SUCCEEDED(hr)) {
- pFoundAssembly = pDomain->LoadAssemblyHelper(szAssemblyName,
- NULL);
- if (SUCCEEDED(hr)) {
- if (cMax < 1)
- hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
- else {
- ppIUnk[0] = (IUnknown *)pFoundAssembly->GetManifestAssemblyImporter();
- ppIUnk[0]->AddRef();
- }
- *pcAssemblies = 1;
- }
- }
-
- END_EXTERNAL_ENTRYPOINT;
-#endif // FEATURE_CORECLR
return hr;
}// Used by the IMetadata API's to access an assemblies metadata.
@@ -4296,365 +3560,6 @@ IWinMDImport *Assembly::GetManifestWinMDImport()
#endif // FEATURE_COMINTEROP
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-void Assembly::GenerateBreadcrumbForServicing()
-{
- STANDARD_VM_CONTRACT;
-
- if (AppX::IsAppXProcess() || IsIntrospectionOnly() || GetManifestFile()->IsDynamic())
- {
- return;
- }
-
- if (HasServiceableAttribute() || IsExistingOobAssembly())
- {
- StackSString ssDisplayName;
- GetDisplayName(ssDisplayName);
-
- WriteBreadcrumb(ssDisplayName);
- CheckDenyList(ssDisplayName);
- }
-}
-
-void Assembly::WriteBreadcrumb(const SString &ssDisplayName)
-{
- STANDARD_VM_CONTRACT;
-
- WCHAR path[MAX_LONGPATH];
- HRESULT hr = WszSHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, ARRAYSIZE(path), path);
- if (hr != S_OK)
- {
- return;
- }
-
- if (wcscat_s(path, W("\\Microsoft\\NetFramework\\BreadcrumbStore\\")) != 0)
- {
- return;
- }
-
- size_t dirPathLen = wcslen(path);
-
- // Validate the display name. E.g., we don't want the display name to start with "..\\".
- bool inSimpleName = true;
- for (SString::CIterator it = ssDisplayName.Begin(); it != ssDisplayName.End(); ++it)
- {
- WCHAR c = *it;
-
- // The following characters are always allowed: a-zA-Z0-9_
- if (c >= W('a') && c <= W('z') || c >= W('A') && c <= W('Z') || c >= W('0') && c <= W('9') || c == W('_')) continue;
-
- // The period is allowed except as the first char.
- if (c == W('.') && it != ssDisplayName.Begin()) continue;
-
- // A comma terminates the assembly simple name, and we are in key=value portion of the display name.
- if (c == W(','))
- {
- inSimpleName = false;
- continue;
- }
-
- // In key=value portion, space and equal sign are also allowed.
- if (!inSimpleName && (c == W(' ') || c == W('='))) continue;
-
- // If we reach here, we have an invalid assembly display name. Return without writing breadcrumb.
- return;
- }
-
- // Log a breadcrumb using full display name.
- if (wcscat_s(path, ssDisplayName.GetUnicode()) == 0)
- {
- HandleHolder hFile = WszCreateFile(path, 0, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- }
-
- // Log another breadcrumb using display name without version.
- // First make a copy of the display name, and look for its version part.
- StackSString ssNoVersion(ssDisplayName);
- SString::Iterator itVersion = ssNoVersion.Begin();
- if (!ssNoVersion.Find(itVersion, W(", Version=")))
- {
- return;
- }
-
- // Start from the comma before Version=, advance past the comma, then look for the next comma.
- SString::Iterator itVersionEnd = itVersion;
- ++itVersionEnd;
- if (!ssNoVersion.Find(itVersionEnd, W(',')))
- {
- // Version is the last key=value pair.
- itVersionEnd = ssNoVersion.End();
- }
-
- // Erase the version.
- ssNoVersion.Delete(itVersion, itVersionEnd - itVersion);
-
- // Generate the full path string and create the file.
- path[dirPathLen] = W('\0');
- if (wcscat_s(path, ssNoVersion.GetUnicode()) == 0)
- {
- HandleHolder hFile = WszCreateFile(path, 0, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
- }
-
-}
-
-bool Assembly::HasServiceableAttribute()
-{
- STANDARD_VM_CONTRACT;
-
- IMDInternalImport *pImport = GetManifestImport();
- MDEnumHolder hEnum(pImport);
- HRESULT hr = pImport->EnumCustomAttributeByNameInit(GetManifestToken(), ASSEMBLY_METADATA_TYPE, &hEnum);
- if (hr != S_OK)
- {
- return false;
- }
-
- mdCustomAttribute tkAttribute;
- while (pImport->EnumNext(&hEnum, &tkAttribute))
- {
- // Get raw custom attribute.
- const BYTE *pbAttr = NULL; // Custom attribute data as a BYTE*.
- ULONG cbAttr = 0; // Size of custom attribute data.
- if (FAILED(pImport->GetCustomAttributeAsBlob(tkAttribute, reinterpret_cast<const void **>(&pbAttr), &cbAttr)))
- {
- THROW_BAD_FORMAT(BFA_INVALID_TOKEN, GetManifestModule());
- }
-
- CustomAttributeParser cap(pbAttr, cbAttr);
- if (FAILED(cap.ValidateProlog()))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
-
- // Get the metadata key. It is not null terminated.
- LPCUTF8 key;
- ULONG cbKey;
- if (FAILED(cap.GetString(&key, &cbKey)))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
-
- const LPCUTF8 szServiceable = "Serviceable";
- const ULONG cbServiceable = 11;
- if (cbKey != cbServiceable || strncmp(key, szServiceable, cbKey) != 0)
- {
- continue;
- }
-
- // Get the metadata value. It is not null terminated.
- if (FAILED(cap.GetString(&key, &cbKey)))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
-
- const LPCUTF8 szTrue = "True";
- const ULONG cbTrue = 4;
- if (cbKey == cbTrue && strncmp(key, szTrue, cbKey) == 0)
- {
- return true;
- }
- }
-
- return false;
-}
-
-bool Assembly::IsExistingOobAssembly()
-{
- WRAPPER_NO_CONTRACT;
-
- return ExistingOobAssemblyList::Instance()->IsOnlist(this);
-}
-
-void Assembly::CheckDenyList(const SString &ssDisplayName)
-{
- STANDARD_VM_CONTRACT;
-
- StackSString ssKeyName(W("SOFTWARE\\Microsoft\\.NETFramework\\Policy\\DenyList\\"));
-
- ssKeyName.Append(ssDisplayName);
-
- RegKeyHolder hKey;
- LONG status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ssKeyName.GetUnicode(), 0, KEY_WOW64_64KEY | GENERIC_READ, &hKey);
-
- if (status != ERROR_SUCCESS)
- {
- return;
- }
-
- StackSString ssFwlink;
- HRESULT hr = Clr::Util::Reg::ReadStringValue(hKey, NULL, NULL, ssFwlink);
- if (FAILED(hr) || ssFwlink.GetCount() == 0)
- {
- ssFwlink.Set(W("http://go.microsoft.com/fwlink/?LinkID=286319"));
- }
-
- StackSString ssMessageTemplate;
- if(!ssMessageTemplate.LoadResource(CCompRC::Optional, IDS_EE_ASSEMBLY_ON_DENY_LIST))
- {
- ssMessageTemplate.Set(W("The assembly %1 that the application tried to load has a known vulnerability. Please go to %2 to find a fix for this issue."));
- }
-
- StackSString ssMessage;
- ssMessage.FormatMessage(FORMAT_MESSAGE_FROM_STRING, ssMessageTemplate.GetUnicode(), 0, 0, ssDisplayName, ssFwlink);
-
- ClrReportEvent(
- W(".NET Runtime"), // Event source
- EVENTLOG_ERROR_TYPE, // Type
- 0, // Category
- SecurityConfig, // Event ID
- NULL, // User SID
- ssMessage.GetUnicode()); // Message
-
- NewHolder<EEMessageException> pEx(new EEMessageException(kSecurityException, IDS_EE_ASSEMBLY_ON_DENY_LIST, ssDisplayName.GetUnicode(), ssFwlink.GetUnicode()));
- EEFileLoadException::Throw(m_pManifestFile, pEx->GetHR(), pEx);
-}
-
-BOOL IsReportableAssembly(PEAssembly *pPEAssembly)
-{
- STANDARD_VM_CONTRACT;
-
- // If the assembly could have used a native image, but did not, report the IL image
- BOOL fCanUseNativeImage = (pPEAssembly->HasHostAssembly() || pPEAssembly->IsContextLoad()) &&
- pPEAssembly->CanUseNativeImage() &&
- !IsNativeImageOptedOut(pPEAssembly->GetFusionAssemblyName());
-
- return fCanUseNativeImage;
-}
-
-BOOL Assembly::SupportsAutoNGenWorker()
-{
- STANDARD_VM_CONTRACT;
-
- PEAssembly *pPEAssembly = GetManifestFile();
-
- if (pPEAssembly->IsSourceGAC() && Fusion::Util::IsUnifiedAssembly(pPEAssembly->GetFusionAssemblyName()) == S_OK)
- {
- // Assemblies in the .NET Framework supports Auto NGen.
- return TRUE;
- }
-
- if (IsAfContentType_WindowsRuntime(GetFlags()))
- {
- // WinMD files support Auto NGen.
- return TRUE;
- }
-
- if (pPEAssembly->HasHostAssembly())
- {
- // Auto NGen is enabled on all Metro app assemblies.
- return TRUE;
- }
-
- if (pPEAssembly->IsSourceGAC())
- {
- // For non-framework assemblies in GAC, look for TargetFrameworkAttriute.
- const BYTE *pbAttr; // Custom attribute data as a BYTE*.
- ULONG cbAttr; // Size of custom attribute data.
- HRESULT hr = GetManifestImport()->GetCustomAttributeByName(GetManifestToken(), TARGET_FRAMEWORK_TYPE, (const void**)&pbAttr, &cbAttr);
- if (hr != S_OK)
- {
- return FALSE;
- }
-
- CustomAttributeParser cap(pbAttr, cbAttr);
- if (FAILED(cap.ValidateProlog()))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
- LPCUTF8 lpTargetFramework;
- ULONG cbTargetFramework;
- if (FAILED(cap.GetString(&lpTargetFramework, &cbTargetFramework)))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, GetManifestModule());
- }
-
- if (lpTargetFramework == NULL || cbTargetFramework == 0)
- {
- return FALSE;
- }
-
- SString ssTargetFramework(SString::Utf8, lpTargetFramework, cbTargetFramework);
-
- // Look for two special TargetFramework values that disables AutoNGen. To guard against future
- // variations of the string values, we do prefix matches.
- SString ssFramework40(SString::Literal, W(".NETFramework,Version=v4.0"));
- SString ssPortableLib(SString::Literal, W(".NETPortable,"));
- if (ssTargetFramework.BeginsWithCaseInsensitive(ssFramework40) || ssTargetFramework.BeginsWithCaseInsensitive(ssPortableLib))
- {
- return FALSE;
- }
-
- // If TargetFramework doesn't match one of the two special values, we enable Auto NGen.
- return TRUE;
- }
-
- return FALSE;
-}
-
-void Assembly::ReportAssemblyUse()
-{
- STANDARD_VM_CONTRACT;
-
- // Do not log if we don't have a global gac logger object
- if (g_pIAssemblyUsageLogGac != NULL)
- {
- // Only consider reporting for loads that could possibly use native images.
- PEAssembly *pPEAssembly = this->GetManifestFile();
- if (IsReportableAssembly(pPEAssembly) && !pPEAssembly->IsReportedToUsageLog())
- {
- // Do not log repeatedly
- pPEAssembly->SetReportedToUsageLog();
-
- ReleaseHolder<IAssemblyUsageLog> pRefCountedUsageLog;
- IAssemblyUsageLog *pUsageLog = NULL;
- if (SupportsAutoNGen())
- {
- if (pPEAssembly->IsSourceGAC())
- {
- pUsageLog = g_pIAssemblyUsageLogGac;
- }
- else if (pPEAssembly->HasHostAssembly())
- {
- UINT_PTR binderId;
- IfFailThrow(pPEAssembly->GetHostAssembly()->GetBinderID(&binderId));
- pRefCountedUsageLog = AssemblyUsageLogManager::GetUsageLogForBinder(binderId);
- pUsageLog = pRefCountedUsageLog;
- }
- }
-
- if (pUsageLog)
- {
- PEAssembly *pPEAssembly = GetManifestFile();
- StackSString name;
- // GAC Assemblies are reported by assembly name
- if (pUsageLog == g_pIAssemblyUsageLogGac)
- {
- this->GetDisplayName(name);
- }
- // Other assemblies (AppX...) are reported by file path
- else
- {
- name.Set(pPEAssembly->GetILimage()->GetPath().GetUnicode());
- }
-
- if (pPEAssembly->HasNativeImage())
- {
- if(!IsSystem())
- {
- // If the assembly used a native image, report it
- ReleaseHolder<PEImage> pNativeImage = pPEAssembly->GetNativeImageWithRef();
- pUsageLog->LogFile(name.GetUnicode(), pNativeImage->GetPath().GetUnicode(), ASSEMBLY_USAGE_LOG_FLAGS_NI);
- }
- }
- else
- {
- // If the assembly could have used a native image, but did not, report the IL image
- pUsageLog->LogFile(name.GetUnicode(), NULL, ASSEMBLY_USAGE_LOG_FLAGS_IL);
- }
- }
- }
- }
-}
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
#endif // #ifndef DACCESS_COMPILE
@@ -4857,31 +3762,6 @@ FriendAssemblyDescriptor *FriendAssemblyDescriptor::CreateFriendAssemblyDescript
// CoreCLR does not have a valid scenario for strong-named assemblies requiring their dependencies
// to be strong-named as well.
-#if !defined(FEATURE_CORECLR)
- // If this assembly has a strong name, then its friends declarations need to have strong names too
- if (pAssembly->IsStrongNamed())
- {
-#ifdef FEATURE_FUSION
- DWORD dwSize = 0;
- if (SUCCEEDED(hr = pFriendAssemblyName->GetProperty(ASM_NAME_PUBLIC_KEY, NULL, &dwSize)))
- {
- // If this call succeeds with an empty buffer, then the supplied name doesn't have a public key.
- THROW_HR_ERROR_WITH_INFO(META_E_CA_FRIENDS_SN_REQUIRED, pAssembly);
- }
- else if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
- {
- IfFailThrow(hr);
- }
-#else // FEATURE_FUSION
- // Desktop crossgen comes here
- if (!pFriendAssemblyName->IsStrongNamed())
- {
- // If this call succeeds with an empty buffer, then the supplied name doesn't have a public key.
- THROW_HR_ERROR_WITH_INFO(META_E_CA_FRIENDS_SN_REQUIRED, pAssembly);
- }
-#endif // FEATURE_FUSION
- }
-#endif // !defined(FEATURE_CORECLR)
pFriendAssemblies->AddFriendAssembly(pFriendAssemblyName);
@@ -4974,70 +3854,3 @@ bool FriendAssemblyDescriptor::IsAssemblyOnList(PEAssembly *pAssembly, const Arr
#endif // !DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) && !defined(DACCESS_COMPILE)
-
-ExistingOobAssemblyList::ExistingOobAssemblyList()
-{
- STANDARD_VM_CONTRACT;
-
- RegKeyHolder hKey;
- LONG status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, W("SOFTWARE\\Microsoft\\.NETFramework\\Policy\\Servicing"), 0, KEY_WOW64_64KEY | GENERIC_READ, &hKey);
- if (status != ERROR_SUCCESS)
- {
- return;
- }
-
- for (DWORD i = 0; ; i++)
- {
- WCHAR name[MAX_PATH_FNAME + 1];
- DWORD cchName = ARRAYSIZE(name);
- status = RegEnumKeyExW(hKey, i, name, &cchName, NULL, NULL, NULL, NULL);
-
- if (status == ERROR_NO_MORE_ITEMS)
- {
- break;
- }
-
- if (status == ERROR_SUCCESS)
- {
- NonVMComHolder<IAssemblyName> pAssemblyName;
- HRESULT hr = CreateAssemblyNameObject(&pAssemblyName, name, CANOF_PARSE_DISPLAY_NAME, NULL);
- if (SUCCEEDED(hr))
- {
- hr = m_alExistingOobAssemblies.Append(pAssemblyName.GetValue());
- if (SUCCEEDED(hr))
- {
- pAssemblyName.SuppressRelease();
- }
- }
- }
- }
-}
-
-bool ExistingOobAssemblyList::IsOnlist(Assembly *pAssembly)
-{
- STANDARD_VM_CONTRACT;
-
- ArrayList::Iterator itAssemblyNames = m_alExistingOobAssemblies.Iterate();
- while (itAssemblyNames.Next())
- {
- IAssemblyName *pAssemblyName = static_cast<IAssemblyName *>(itAssemblyNames.GetElement());
- HRESULT hr = pAssemblyName->IsEqual(pAssembly->GetFusionAssemblyName(), ASM_CMPF_DEFAULT);
- if (hr == S_OK)
- {
- return true;
- }
- }
-
- return false;
-}
-
-void ExistingOobAssemblyList::Init()
-{
- STANDARD_VM_CONTRACT;
-
- s_pInstance = new ExistingOobAssemblyList();
-}
-
-ExistingOobAssemblyList *ExistingOobAssemblyList::s_pInstance;
-#endif // !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) && !defined(DACCESS_COMPILE)
diff --git a/src/vm/assembly.hpp b/src/vm/assembly.hpp
index 7466903663..6974fdd62f 100644
--- a/src/vm/assembly.hpp
+++ b/src/vm/assembly.hpp
@@ -531,23 +531,7 @@ public:
void AddType(Module* pModule,
mdTypeDef cl);
void AddExportedType(mdExportedType cl);
-#ifndef FEATURE_CORECLR
- void PrepareSavingManifest(ReflectionModule *pAssemblyModule);
- mdFile AddFile(LPCWSTR wszFileName);
- void SetFileHashValue(mdFile tkFile, LPCWSTR wszFullFileName);
-#endif
mdAssemblyRef AddAssemblyRef(Assembly *refedAssembly, IMetaDataAssemblyEmit *pAssemEmitter = NULL, BOOL fUsePublicKeyToken = TRUE);
-#ifndef FEATURE_CORECLR
- mdExportedType AddExportedTypeOnDisk(LPCWSTR wszExportedType, mdToken tkImpl, mdToken tkTypeDef, CorTypeAttr flags);
- mdExportedType AddExportedTypeInMemory(LPCWSTR wszExportedType, mdToken tkImpl, mdToken tkTypeDef, CorTypeAttr flags);
- void AddStandAloneResource(LPCWSTR wszName, LPCWSTR wszDescription, LPCWSTR wszMimeType, LPCWSTR wszFileName, LPCWSTR wszFullFileName, int iAttribute);
- void SaveManifestToDisk(LPCWSTR wszFileName, int entrypoint, int fileKind, DWORD corhFlags, DWORD peFlags);
-#endif // FEATURE_CORECLR
-#ifndef FEATURE_CORECLR
- void AddDeclarativeSecurity(DWORD dwAction, void const *pValue, DWORD cbValue);
-
- IMetaDataAssemblyEmit *GetOnDiskMDAssemblyEmitter();
-#endif // FEATURE_CORECLR
//****************************************************************************************
@@ -714,13 +698,6 @@ public:
IWinMDImport *GetManifestWinMDImport();
#endif
-#ifndef FEATURE_CORECLR
- BOOL SupportsAutoNGen()
- {
- WRAPPER_NO_CONTRACT;
- return m_fSupportsAutoNGen;
- }
-#endif
protected:
@@ -797,15 +774,6 @@ private:
void CacheFriendAssemblyInfo();
-#ifndef FEATURE_CORECLR
- void GenerateBreadcrumbForServicing();
- void WriteBreadcrumb(const SString &ssDisplayName);
- bool HasServiceableAttribute();
- bool IsExistingOobAssembly();
- void CheckDenyList(const SString &ssDisplayName);
-
- BOOL SupportsAutoNGenWorker();
-#endif
PTR_BaseDomain m_pDomain; // Parent Domain
PTR_ClassLoader m_pClassLoader; // Single Loader
@@ -870,9 +838,6 @@ private:
DWORD m_dwReliabilityContract;
-#ifndef FEATURE_CORECLR
- BOOL m_fSupportsAutoNGen;
-#endif
};
typedef Assembly::ModuleIterator ModuleIterator;
@@ -923,25 +888,6 @@ public:
return IsAssemblyOnList(pAccessingAssembly, m_alFullAccessFriendAssemblies);
}
-#ifndef FEATURE_CORECLR
- //------------------------------------------------------------------------------
- // It is undesirable to reintroduce the concept of inquiring about friendship without specifying a member or type
- // but necessary for TP. In case of doubt, it's safer to return "true" as this won't affect
- // correctness (but might cause unnecessary ngen's when updating assemblies.)
- //------------------------------------------------------------------------------
- bool MightGrantFriendAccessTo(PEAssembly *pAccessingAssembly)
- {
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- PRECONDITION(CheckPointer(pAccessingAssembly));
- }
- CONTRACTL_END;
-
- return IsAssemblyOnList(pAccessingAssembly, m_alFullAccessFriendAssemblies);
- }
-#endif // !FEATURE_CORECLR
bool IgnoresAccessChecksTo(Assembly *pAccessedAssembly)
{
@@ -977,25 +923,5 @@ private:
#endif // !DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-class ExistingOobAssemblyList
-{
-public:
-#ifndef DACCESS_COMPILE
- ExistingOobAssemblyList();
-
- bool IsOnlist(Assembly *pAssembly);
-
- static void Init();
- static ExistingOobAssemblyList *Instance() { return s_pInstance; }
-#endif
-
-private:
- ArrayList m_alExistingOobAssemblies;
-
- // The single instance of this class:
- static ExistingOobAssemblyList *s_pInstance;
-};
-#endif // !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
#endif
diff --git a/src/vm/assemblyname.cpp b/src/vm/assemblyname.cpp
index d7689e8b88..686527f8c2 100644
--- a/src/vm/assemblyname.cpp
+++ b/src/vm/assemblyname.cpp
@@ -62,15 +62,11 @@ FCIMPL1(Object*, AssemblyNameNative::GetFileInformation, StringObject* filenameU
EX_TRY
{
-#ifdef FEATURE_CORECLR
// Allow AssemblyLoadContext.GetAssemblyName for native images on CoreCLR
if (pImage->HasNTHeaders() && pImage->HasCorHeader() && pImage->HasNativeHeader())
pImage->VerifyIsNIAssembly();
else
pImage->VerifyIsAssembly();
-#else
- pImage->VerifyIsAssembly();
-#endif
}
EX_CATCH
{
@@ -84,9 +80,6 @@ FCIMPL1(Object*, AssemblyNameNative::GetFileInformation, StringObject* filenameU
AssemblySpec spec;
spec.InitializeSpec(TokenFromRid(mdtAssembly,1),pImage->GetMDImport(),NULL,TRUE);
-#ifndef FEATURE_CORECLR
- spec.SetCodeBase(sUrl);
-#endif
spec.AssemblyNameInit(&gc.result, pImage);
HELPER_METHOD_FRAME_END();
@@ -168,52 +161,6 @@ FCIMPL1(Object*, AssemblyNameNative::GetPublicKeyToken, Object* refThisUNSAFE)
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-FCIMPL1(Object*, AssemblyNameNative::EscapeCodeBase, StringObject* filenameUNSAFE)
-{
- FCALL_CONTRACT;
-
- STRINGREF rv = NULL;
- STRINGREF filename = (STRINGREF) filenameUNSAFE;
- HELPER_METHOD_FRAME_BEGIN_RET_1(filename);
-
- LPWSTR pCodeBase = NULL;
- DWORD dwCodeBase = 0;
- CQuickBytes qb;
-
- if (filename != NULL) {
- WCHAR* pString;
- int iString;
- filename->RefInterpretGetStringValuesDangerousForGC(&pString, &iString);
- dwCodeBase = (DWORD) iString;
- pCodeBase = (LPWSTR) qb.AllocThrows((++dwCodeBase) * sizeof(WCHAR));
- memcpy(pCodeBase, pString, dwCodeBase*sizeof(WCHAR));
- }
-
- if(pCodeBase) {
- CQuickBytes qb2;
- DWORD dwEscaped = 1;
-
- DWORD flags = 0;
- if (RunningOnWin7())
- flags |= URL_ESCAPE_AS_UTF8;
-
- UrlEscape(pCodeBase, (LPWSTR) qb2.Ptr(), &dwEscaped, flags);
-
- LPWSTR result = (LPWSTR)qb2.AllocThrows((++dwEscaped) * sizeof(WCHAR));
- HRESULT hr = UrlEscape(pCodeBase, result, &dwEscaped, flags);
-
- if (SUCCEEDED(hr))
- rv = StringObject::NewString(result);
- else
- COMPlusThrowHR(hr);
- }
-
- HELPER_METHOD_FRAME_END();
- return OBJECTREFToObject(rv);
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL4(void, AssemblyNameNative::Init, Object * refThisUNSAFE, OBJECTREF * pAssemblyRef, CLR_BOOL fForIntrospection, CLR_BOOL fRaiseResolveEvent)
{
diff --git a/src/vm/assemblynative.hpp b/src/vm/assemblynative.hpp
index 99f51e9837..a92198cb32 100644
--- a/src/vm/assemblynative.hpp
+++ b/src/vm/assemblynative.hpp
@@ -74,10 +74,6 @@ public:
static
INT32 QCALLTYPE GetHashAlgorithm(QCall::AssemblyHandle pAssembly);
-#ifndef FEATURE_CORECLR
- static
- BYTE QCALLTYPE GetSecurityRuleSet(QCall::AssemblyHandle pAssembly);
-#endif // !FEATURE_CORECLR
static
void QCALLTYPE GetSimpleName(QCall::AssemblyHandle pAssembly, QCall::StringHandleOnStack retSimpleName);
@@ -149,10 +145,6 @@ public:
static FCDECL1(ReflectModuleBaseObject *, GetOnDiskAssemblyModule, AssemblyBaseObject * pAssemblyUNSAFE);
static FCDECL1(ReflectModuleBaseObject *, GetInMemoryAssemblyModule, AssemblyBaseObject * pAssemblyUNSAFE);
-#ifndef FEATURE_CORECLR
- static
- FCDECL1(FC_BOOL_RET, IsGlobalAssemblyCache, AssemblyBaseObject* pAssemblyUNSAFE);
-#endif // !FEATURE_CORECLR
static
void QCALLTYPE GetGrantSet(QCall::AssemblyHandle pAssembly, QCall::ObjectHandleOnStack retGranted, QCall::ObjectHandleOnStack retDenied);
@@ -187,22 +179,6 @@ public:
static
void QCALLTYPE PrepareForSavingManifestToDisk(QCall::AssemblyHandle pAssembly, QCall::ModuleHandle pAssemblyModule);
-#ifndef FEATURE_CORECLR
- static
- void QCALLTYPE SaveManifestToDisk(QCall::AssemblyHandle pAssembly,
- LPCWSTR wszManifestFileName,
- INT32 entrypoint,
- INT32 fileKind,
- INT32 portableExecutableKind,
- INT32 imageFileMachine);
-
- static
- mdExportedType QCALLTYPE AddExportedTypeOnDisk(QCall::AssemblyHandle pAssembly, LPCWSTR wzzCOMTypeName, INT32 tkImpl, INT32 tkTypeDef, INT32 flags);
-
- static
- mdExportedType QCALLTYPE AddExportedTypeInMemory(QCall::AssemblyHandle pAssembly, LPCWSTR wzzCOMTypeName, INT32 tkImpl, INT32 tkTypeDef, INT32 flags);
-
-#endif // FEATURE_CORECLR
static
mdFile QCALLTYPE AddFile(QCall::AssemblyHandle pAssembly, LPCWSTR wszFileName);
@@ -216,22 +192,6 @@ public:
static
void QCALLTYPE AddDeclarativeSecurity(QCall::AssemblyHandle pAssembly, INT32 action, PVOID blob, INT32 length);
-#ifndef FEATURE_CORECLR
- static
- void QCALLTYPE CreateVersionInfoResource(LPCWSTR pwzFilename,
- LPCWSTR pwzTitle,
- LPCWSTR pwzIconFilename,
- LPCWSTR pwzDescription,
- LPCWSTR pwzCopyright,
- LPCWSTR pwzTrademark,
- LPCWSTR pwzCompany,
- LPCWSTR pwzProduct,
- LPCWSTR pwzProductVersion,
- LPCWSTR pwzFileVersion,
- INT32 lcid,
- BOOL fIsDll,
- QCall::StringHandleOnStack retFileName);
-#endif // !FEATURE_CORECLR
static
void QCALLTYPE GetRawBytes(QCall::AssemblyHandle pAssembly, QCall::ObjectHandleOnStack retRawBytes);
diff --git a/src/vm/assemblyspec.cpp b/src/vm/assemblyspec.cpp
index b9e94e8a81..004b1cb12c 100644
--- a/src/vm/assemblyspec.cpp
+++ b/src/vm/assemblyspec.cpp
@@ -252,13 +252,6 @@ HRESULT AssemblySpec::InitializeSpecInternal(mdToken kAssemblyToken,
if (pStaticParent != NULL)
{
// We dont validate this for CoreCLR as there is no good use-case for this scenario.
-#if !defined(FEATURE_CORECLR)
- // It is OK for signed assemblies to reference WinRT assemblies (.winmd files) that are not signed
- if (!IsContentType_WindowsRuntime() && pStaticParent->GetFile()->IsStrongNamed() && !IsStrongNamed())
- {
- ThrowHR(FUSION_E_PRIVATE_ASM_DISALLOWED);
- }
-#endif // !defined(FEATURE_CORECLR)
SetParentAssembly(pStaticParent);
}
@@ -378,7 +371,6 @@ void AssemblySpec::InitializeSpec(PEAssembly * pFile)
}
#endif //FEATURE_COMINTEROP
-#if defined(FEATURE_CORECLR)
// Set the binding context for the AssemblySpec
ICLRPrivBinder* pCurrentBinder = GetBindingContext();
ICLRPrivBinder* pExpectedBinder = pFile->GetBindingContext();
@@ -391,7 +383,6 @@ void AssemblySpec::InitializeSpec(PEAssembly * pFile)
_ASSERTE((pExpectedBinder != NULL) || pFile->IsSystem() || pFile->IsDynamic());
SetBindingContext(pExpectedBinder);
}
-#endif // defined(FEATURE_CORECLR)
}
#ifndef CROSSGEN_COMPILE
@@ -1206,7 +1197,6 @@ Assembly *AssemblySpec::LoadAssembly(FileLoadLevel targetLevel, AssemblyLoadSecu
return pDomainAssembly->GetAssembly();
}
-#if defined(FEATURE_CORECLR)
// Returns a BOOL indicating if the two Binder references point to the same
// binder instance.
BOOL AreSameBinderInstance(ICLRPrivBinder *pBinderA, ICLRPrivBinder *pBinderB)
@@ -1233,7 +1223,6 @@ BOOL AreSameBinderInstance(ICLRPrivBinder *pBinderA, ICLRPrivBinder *pBinderB)
return fIsSameInstance;
}
-#endif // defined(FEATURE_CORECLR)
ICLRPrivBinder* AssemblySpec::GetBindingContextFromParentAssembly(AppDomain *pDomain)
{
@@ -1360,78 +1349,6 @@ DomainAssembly *AssemblySpec::LoadDomainAssembly(FileLoadLevel targetLevel,
ETWOnStartup (LoaderCatchCall_V1, LoaderCatchCallEnd_V1);
AppDomain* pDomain = GetAppDomain();
-#ifndef FEATURE_CORECLR
- // Event Tracing for Windows is used to log data for performance and functional testing purposes.
- // The events in this function are used to help measure the performance of assembly loading as a whole for dynamic loads.
-
- // Special-purpose holder structure to ensure the LoaderPhaseEnd ETW event is fired when returning from function.
- struct ETWLoaderPhaseHolder
- {
- StackSString ETWCodeBase, ETWAssemblyName;
-
- DWORD _dwAppDomainId;
- BOOL initialized;
-
- ETWLoaderPhaseHolder()
- : _dwAppDomainId(ETWAppDomainIdNotAvailable)
- , initialized(FALSE)
- { }
-
- void Init(DWORD dwAppDomainId, LPCWSTR wszCodeBase, LPCSTR szAssemblyName)
- {
- _dwAppDomainId = dwAppDomainId;
-
- EX_TRY
- {
- if (wszCodeBase != NULL)
- {
- ETWCodeBase.Append(wszCodeBase);
- ETWCodeBase.Normalize(); // Ensures that the later cast to LPCWSTR does not throw.
- }
- }
- EX_CATCH
- {
- ETWCodeBase.Clear();
- }
- EX_END_CATCH(RethrowTransientExceptions)
-
- EX_TRY
- {
- if (szAssemblyName != NULL)
- {
- ETWAssemblyName.AppendUTF8(szAssemblyName);
- ETWAssemblyName.Normalize(); // Ensures that the later cast to LPCWSTR does not throw.
- }
- }
- EX_CATCH
- {
- ETWAssemblyName.Clear();
- }
- EX_END_CATCH(RethrowTransientExceptions)
-
- FireEtwLoaderPhaseStart(_dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderDynamicLoad, ETWCodeBase.IsEmpty() ? NULL : (LPCWSTR)ETWCodeBase, ETWAssemblyName.IsEmpty() ? NULL : (LPCWSTR)ETWAssemblyName, GetClrInstanceId());
-
- initialized = TRUE;
- }
-
- ~ETWLoaderPhaseHolder()
- {
- if (initialized)
- {
- FireEtwLoaderPhaseEnd(_dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderDynamicLoad, ETWCodeBase.IsEmpty() ? NULL : (LPCWSTR)ETWCodeBase, ETWAssemblyName.IsEmpty() ? NULL : (LPCWSTR)ETWAssemblyName, GetClrInstanceId());
- }
- }
- };
-
- ETWLoaderPhaseHolder loaderPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
-#ifdef FEATURE_FUSION
- loaderPhaseHolder.Init(pDomain->GetId().m_dwId, m_wszCodeBase, m_pAssemblyName);
-#else
- loaderPhaseHolder.Init(pDomain->GetId().m_dwId, NULL, NULL);
-#endif
- }
-#endif // FEATURE_CORECLR
DomainAssembly *pAssembly = nullptr;
@@ -1821,7 +1738,6 @@ void AssemblySpecBindingCache::Init(CrstBase *pCrst, LoaderHeap *pHeap)
m_pHeap = pHeap;
}
-#if defined(FEATURE_CORECLR)
AssemblySpecBindingCache::AssemblyBinding* AssemblySpecBindingCache::GetAssemblyBindingEntryForAssemblySpec(AssemblySpec* pSpec, BOOL fThrow)
{
CONTRACTL
@@ -1895,19 +1811,12 @@ AssemblySpecBindingCache::AssemblyBinding* AssemblySpecBindingCache::GetAssembly
return pEntry;
}
-#endif // defined(FEATURE_CORECLR)
BOOL AssemblySpecBindingCache::Contains(AssemblySpec *pSpec)
{
WRAPPER_NO_CONTRACT;
-#if !defined(FEATURE_CORECLR)
- DWORD key = pSpec->Hash();
- AssemblyBinding *entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
- return (entry != (AssemblyBinding *) INVALIDENTRY);
-#else // defined(FEATURE_CORECLR)
return (GetAssemblyBindingEntryForAssemblySpec(pSpec, TRUE) != (AssemblyBinding *) INVALIDENTRY);
-#endif // !defined(FEATURE_CORECLR)
}
DomainAssembly *AssemblySpecBindingCache::LookupAssembly(AssemblySpec *pSpec,
@@ -1933,12 +1842,7 @@ DomainAssembly *AssemblySpecBindingCache::LookupAssembly(AssemblySpec *pSpec,
AssemblyBinding *entry = (AssemblyBinding *) INVALIDENTRY;
-#if !defined(FEATURE_CORECLR)
- DWORD key = pSpec->Hash();
- entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
-#else // defined(FEATURE_CORECLR)
entry = GetAssemblyBindingEntryForAssemblySpec(pSpec, fThrow);
-#endif // !defined(FEATURE_CORECLR)
if (entry == (AssemblyBinding *) INVALIDENTRY)
RETURN NULL;
@@ -1976,12 +1880,7 @@ PEAssembly *AssemblySpecBindingCache::LookupFile(AssemblySpec *pSpec, BOOL fThro
AssemblyBinding *entry = (AssemblyBinding *) INVALIDENTRY;
-#if !defined(FEATURE_CORECLR)
- DWORD key = pSpec->Hash();
- entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
-#else // defined(FEATURE_CORECLR)
entry = GetAssemblyBindingEntryForAssemblySpec(pSpec, fThrow);
-#endif // !defined(FEATURE_CORECLR)
if (entry == (AssemblyBinding *) INVALIDENTRY)
RETURN NULL;
@@ -2108,7 +2007,6 @@ BOOL AssemblySpecBindingCache::StoreAssembly(AssemblySpec *pSpec, DomainAssembly
UPTR key = (UPTR)pSpec->Hash();
-#if defined(FEATURE_CORECLR)
// On CoreCLR, we will use the BinderID as the key
ICLRPrivBinder* pBinderContextForLookup = pAssembly->GetFile()->GetBindingContext();
_ASSERTE(pBinderContextForLookup || pAssembly->GetFile()->IsSystem());
@@ -2124,7 +2022,6 @@ BOOL AssemblySpecBindingCache::StoreAssembly(AssemblySpec *pSpec, DomainAssembly
pSpec->SetBindingContext(pBinderContextForLookup);
}
}
-#endif // defined(FEATURE_CORECLR)
AssemblyBinding *entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
@@ -2190,7 +2087,6 @@ BOOL AssemblySpecBindingCache::StoreFile(AssemblySpec *pSpec, PEAssembly *pFile)
UPTR key = (UPTR)pSpec->Hash();
-#if defined(FEATURE_CORECLR)
// On CoreCLR, we will use the BinderID as the key
ICLRPrivBinder* pBinderContextForLookup = pFile->GetBindingContext();
_ASSERTE(pBinderContextForLookup || pFile->IsSystem());
@@ -2206,7 +2102,6 @@ BOOL AssemblySpecBindingCache::StoreFile(AssemblySpec *pSpec, PEAssembly *pFile)
pSpec->SetBindingContext(pBinderContextForLookup);
}
}
-#endif // defined(FEATURE_CORECLR)
AssemblyBinding *entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
@@ -2263,9 +2158,6 @@ BOOL AssemblySpecBindingCache::StoreException(AssemblySpec *pSpec, Exception* pE
UPTR key = (UPTR)pSpec->Hash();
-#if !defined(FEATURE_CORECLR)
- AssemblyBinding *entry = (AssemblyBinding *) m_map.LookupValue(key, pSpec);
-#else // defined(FEATURE_CORECLR)
AssemblyBinding *entry = GetAssemblyBindingEntryForAssemblySpec(pSpec, TRUE);
if (entry == (AssemblyBinding *) INVALIDENTRY)
{
@@ -2287,7 +2179,6 @@ BOOL AssemblySpecBindingCache::StoreException(AssemblySpec *pSpec, Exception* pE
}
}
}
-#endif // defined(FEATURE_CORECLR)
if (entry == (AssemblyBinding *) INVALIDENTRY) {
AssemblyBindingHolder abHolder;
diff --git a/src/vm/assemblyspec.hpp b/src/vm/assemblyspec.hpp
index d94a847124..2669f5234c 100644
--- a/src/vm/assemblyspec.hpp
+++ b/src/vm/assemblyspec.hpp
@@ -125,9 +125,6 @@ class AssemblySpec : public BaseAssemblySpec
HRESULT hr=InitializeSpecInternal(kAssemblyRefOrDef, pImport,pStaticParent,fIntrospectionOnly,TRUE);
if(FAILED(hr))
EEFileLoadException::Throw(this,hr);
-#ifndef FEATURE_CORECLR
- CloneFields();
-#endif
};
#ifdef FEATURE_FUSION
@@ -269,9 +266,6 @@ class AssemblySpec : public BaseAssemblySpec
BOOL fNgenExplicitBind = FALSE,
BOOL fExplicitBindToNativeImage = FALSE,
StackCrawlMark *pCallerStackMark = NULL );
-#ifndef FEATURE_CORECLR
- static VOID BindToSystem(BINDER_SPACE::Assembly** ppAssembly);
-#endif
#endif
Assembly *LoadAssembly(FileLoadLevel targetLevel,
@@ -653,9 +647,7 @@ class AssemblySpecBindingCache
PtrHashMap m_map;
LoaderHeap *m_pHeap;
-#if defined(FEATURE_CORECLR)
AssemblySpecBindingCache::AssemblyBinding* GetAssemblyBindingEntryForAssemblySpec(AssemblySpec* pSpec, BOOL fThrow);
-#endif // defined(FEATURE_CORECLR)
public:
@@ -683,7 +675,7 @@ class AssemblySpecBindingCache
return pSpec->Hash();
}
-#if defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE)
+#if !defined(DACCESS_COMPILE)
void GetAllAssemblies(SetSHash<PTR_DomainAssembly>& assemblyList)
{
PtrHashMap::PtrIterator i = m_map.begin();
diff --git a/src/vm/baseassemblyspec.cpp b/src/vm/baseassemblyspec.cpp
index 806416e923..09297f6db7 100644
--- a/src/vm/baseassemblyspec.cpp
+++ b/src/vm/baseassemblyspec.cpp
@@ -122,7 +122,6 @@ BOOL BaseAssemblySpec::IsMscorlib()
( (iNameLen == CoreLibNameLen) || (m_pAssemblyName[CoreLibNameLen] == ',') ) ) ) );
}
-#ifdef FEATURE_CORECLR
BOOL BaseAssemblySpec::IsAssemblySpecForMscorlib()
{
CONTRACTL
@@ -150,9 +149,6 @@ BOOL BaseAssemblySpec::IsAssemblySpecForMscorlib()
}
#define MSCORLIB_PUBLICKEY g_rbTheSilverlightPlatformKey
-#else
-#define MSCORLIB_PUBLICKEY g_rbNeutralPublicKey
-#endif
// A satellite assembly for mscorlib is named "mscorlib.resources" or
diff --git a/src/vm/baseassemblyspec.h b/src/vm/baseassemblyspec.h
index 0a21d95ee8..d27c90fb98 100644
--- a/src/vm/baseassemblyspec.h
+++ b/src/vm/baseassemblyspec.h
@@ -36,9 +36,7 @@ protected:
ICLRPrivBinder *m_pHostBinder;
int m_ownedFlags;
BOOL m_fIntrospectionOnly;
-#if defined(FEATURE_CORECLR)
ICLRPrivBinder *m_pBindingContext;
-#endif // defined(FEATURE_CORECLR)
public:
enum
@@ -76,7 +74,6 @@ public:
VOID CloneFieldsToLoaderHeap(int flags, LoaderHeap *pHeap, AllocMemTracker *pamTracker);
VOID CloneFieldsToStackingAllocator(StackingAllocator* alloc);
-#if defined(FEATURE_CORECLR)
inline void SetBindingContext(ICLRPrivBinder *pBindingContext)
{
LIMITED_METHOD_CONTRACT;
@@ -92,7 +89,6 @@ public:
}
BOOL IsAssemblySpecForMscorlib();
-#endif // defined(FEATURE_CORECLR)
HRESULT ParseName();
DWORD Hash();
diff --git a/src/vm/baseassemblyspec.inl b/src/vm/baseassemblyspec.inl
index 53c312f069..63107c6208 100644
--- a/src/vm/baseassemblyspec.inl
+++ b/src/vm/baseassemblyspec.inl
@@ -17,9 +17,7 @@
extern LocaleID g_lcid;
-#if defined(FEATURE_CORECLR)
BOOL AreSameBinderInstance(ICLRPrivBinder *pBinderA, ICLRPrivBinder *pBinderB);
-#endif // defined(FEATURE_CORECLR)
inline int BaseAssemblySpec::CompareStrings(LPCUTF8 string1, LPCUTF8 string2)
{
@@ -262,12 +260,10 @@ inline void BaseAssemblySpec::CopyFrom(const BaseAssemblySpec *pSpec)
m_pHostBinder = pSpec->m_pHostBinder;
-#ifdef FEATURE_CORECLR
if ((pSpec->m_ownedFlags & BAD_NAME_OWNED) != 0)
{
m_ownedFlags |= BAD_NAME_OWNED;
}
-#endif
#ifdef FEATURE_FUSION
IAssemblyName* pNameAfterPolicy=pSpec->GetNameAfterPolicy();
@@ -278,9 +274,7 @@ inline void BaseAssemblySpec::CopyFrom(const BaseAssemblySpec *pSpec)
}
#endif
-#if defined(FEATURE_CORECLR)
m_pBindingContext = pSpec->m_pBindingContext;
-#endif // defined(FEATURE_CORECLR)
}
@@ -294,10 +288,8 @@ inline DWORD BaseAssemblySpec::Hash()
MODE_ANY;
} CONTRACTL_END;
-#ifdef FEATURE_CORECLR
if(m_wszCodeBase)
return HashString(m_wszCodeBase);
-#endif
// Hash fields.
DWORD hash = 0;
@@ -312,11 +304,6 @@ inline DWORD BaseAssemblySpec::Hash()
hash ^= m_dwFlags;
hash = _rotl(hash, 4);
-#ifndef FEATURE_CORECLR
- if (m_wszCodeBase)
- hash ^= HashString(m_wszCodeBase);
- hash = _rotl(hash, 4);
-#endif
hash ^= m_context.usMajorVersion;
hash = _rotl(hash, 8);
@@ -364,42 +351,13 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare
{
WRAPPER_NO_CONTRACT;
-#ifndef FEATURE_CORECLR
- _ASSERTE(pSpec != NULL);
-
- if ((m_dwFlags & afContentType_Mask) == (pSpec->m_dwFlags & afContentType_Mask))
- {
- if (IsContentType_WindowsRuntime() && pSpec->IsContentType_WindowsRuntime())
- {
- // If comparing assembly definitions, can not use bindability attributes as
- // a shortcut for equivalence, as this type of shortcut is only applicable
- // when comparing assembly references (not definitions).
- //
- // Example of why this is needed: native images still need to compare
- // assembly identities even if they are not bindable, because it needs to
- // ensure that the exact same assembly file (definition) is used at runtime
- // as was used during compilation.
- if ((dwCompareFlags & ASC_DefinitionEquality) != ASC_DefinitionEquality)
- {
- // WinRT assembly references are meaningless, they are all equal to each other
- return TRUE;
- }
- }
- }
- else
- {
- return FALSE;
- }
-#endif
-#ifdef FEATURE_CORECLR
if(m_wszCodeBase || pSpec->m_wszCodeBase)
{
if(!m_wszCodeBase || !pSpec->m_wszCodeBase)
return FALSE;
return wcscmp(m_wszCodeBase,(pSpec->m_wszCodeBase))==0;
}
-#endif
// Compare fields
#ifdef FEATURE_FUSION
@@ -418,12 +376,6 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare
|| memcmp(m_pbPublicKeyOrToken, pSpec->m_pbPublicKeyOrToken, m_cbPublicKeyOrToken))
return FALSE;
-#ifndef FEATURE_CORECLR
- if (m_wszCodeBase != pSpec->m_wszCodeBase
- && (m_wszCodeBase == NULL || pSpec->m_wszCodeBase == NULL
- || wcscmp(m_wszCodeBase, pSpec->m_wszCodeBase)))
- return FALSE;
-#endif
if (m_dwFlags != pSpec->m_dwFlags)
return FALSE;
@@ -465,7 +417,6 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare
}
#endif
-#if defined(FEATURE_CORECLR)
// If the assemblySpec contains the binding context, then check if they match.
if (!(pSpec->IsAssemblySpecForMscorlib() && IsAssemblySpecForMscorlib()))
{
@@ -474,7 +425,6 @@ inline BOOL BaseAssemblySpec::CompareEx(BaseAssemblySpec *pSpec, DWORD dwCompare
return FALSE;
}
}
-#endif // defined(FEATURE_CORECLR)
return TRUE;
diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp
index c95fbac16e..c89e7a641e 100644
--- a/src/vm/ceeload.cpp
+++ b/src/vm/ceeload.cpp
@@ -4260,14 +4260,12 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void)
SafeComHolder<ISymUnmanagedBinder> pBinder;
-#if defined(FEATURE_CORECLR)
if (g_pDebugInterface == NULL)
{
// @TODO: this is reachable when debugging!
UNREACHABLE_MSG("About to CoCreateInstance! This code should not be "
"reachable or needs to be reimplemented for CoreCLR!");
}
-#endif // FEATURE_CORECLR
if (this->GetInMemorySymbolStreamFormat() == eSymbolFormatILDB)
{
@@ -4286,21 +4284,13 @@ ISymUnmanagedReader *Module::GetISymUnmanagedReader(void)
// On desktop, the framework installer is supposed to install diasymreader.dll as well
// and so this shouldn't happen.
hr = FakeCoCreateInstanceEx(CLSID_CorSymBinder_SxS,
-#ifdef FEATURE_CORECLR
NATIVE_SYMBOL_READER_DLL,
-#else
- GetInternalSystemDirectory(),
-#endif
IID_ISymUnmanagedBinder,
(void**)&pBinder,
NULL);
if (FAILED(hr))
{
-#ifdef FEATURE_CORECLR
RETURN (NULL);
-#else
- ThrowHR(hr);
-#endif
}
}
@@ -5840,7 +5830,6 @@ Module::GetAssemblyIfLoaded(
continue;
}
-#if defined(FEATURE_CORECLR)
// If we have been passed the binding context for the loaded assembly that is being looked up in the
// cache, then set it up in the AssemblySpec for the cache lookup to use it below.
if (pBindingContextForLoadedAssembly != NULL)
@@ -5848,7 +5837,6 @@ Module::GetAssemblyIfLoaded(
_ASSERTE(spec.GetBindingContext() == NULL);
spec.SetBindingContext(pBindingContextForLoadedAssembly);
}
-#endif // defined(FEATURE_CORECLR)
DomainAssembly * pDomainAssembly = nullptr;
#ifdef FEATURE_APPX_BINDER
@@ -6154,7 +6142,6 @@ DomainAssembly * Module::LoadAssembly(
szWinRtTypeClassName);
AssemblySpec spec;
spec.InitializeSpec(kAssemblyRef, GetMDImport(), GetDomainFile(GetAppDomain())->GetDomainAssembly(), IsIntrospectionOnly());
-#if defined(FEATURE_CORECLR)
// Set the binding context in the AssemblySpec if one is available. This can happen if the LoadAssembly ended up
// invoking the custom AssemblyLoadContext implementation that returned a reference to an assembly bound to a different
// AssemblyLoadContext implementation.
@@ -6163,7 +6150,6 @@ DomainAssembly * Module::LoadAssembly(
{
spec.SetBindingContext(pBindingContext);
}
-#endif // defined(FEATURE_CORECLR)
if (szWinRtTypeClassName != NULL)
{
spec.SetWindowsRuntimeType(szWinRtTypeNamespace, szWinRtTypeClassName);
@@ -15794,7 +15780,6 @@ LPCWSTR Module::GetPathForErrorMessages()
}
}
-#ifdef FEATURE_CORECLR
#ifndef DACCESS_COMPILE
BOOL IsVerifiableWrapper(MethodDesc* pMD)
{
@@ -15887,7 +15872,6 @@ void Module::VerifyAllMethods()
EEFileLoadException::Throw(GetFile(), COR_E_VERIFICATION);
#endif //DACCESS_COMPILE
}
-#endif //FEATURE_CORECLR
#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && !defined(CROSS_COMPILE)
diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h
index d15bd6b3d1..fad76a6594 100644
--- a/src/vm/ceeload.h
+++ b/src/vm/ceeload.h
@@ -95,7 +95,6 @@ class PersistentInlineTrackingMap;
#define GUID_TO_TYPE_HASH_BUCKETS 16
// The native symbol reader dll name
-#ifdef FEATURE_CORECLR
#if defined(_AMD64_)
#define NATIVE_SYMBOL_READER_DLL W("Microsoft.DiaSymReader.Native.amd64.dll")
#elif defined(_X86_)
@@ -107,9 +106,6 @@ class PersistentInlineTrackingMap;
//#define NATIVE_SYMBOL_READER_DLL W("Microsoft.DiaSymReader.Native.arm64.dll")
#define NATIVE_SYMBOL_READER_DLL W("diasymreader.dll")
#endif
-#else
-#define NATIVE_SYMBOL_READER_DLL W("diasymreader.dll")
-#endif
typedef DPTR(PersistentInlineTrackingMap) PTR_PersistentInlineTrackingMap;
@@ -3449,9 +3445,7 @@ public:
}
#endif // !DACCESS_COMPILE && FEATURE_CER
-#ifdef FEATURE_CORECLR
void VerifyAllMethods();
-#endif //FEATURE_CORECLR
CrstBase *GetLookupTableCrst()
{
diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp
index ca819ecbfd..1fc086d3a4 100644
--- a/src/vm/ceemain.cpp
+++ b/src/vm/ceemain.cpp
@@ -213,10 +213,6 @@
#include "bbsweep.h"
-#ifndef FEATURE_CORECLR
-#include <metahost.h>
-#include "assemblyusagelogmanager.h"
-#endif
#ifdef FEATURE_COMINTEROP
#include "runtimecallablewrapper.h"
@@ -284,12 +280,6 @@ HRESULT PrepareExecuteDLLForThunk(HINSTANCE hInst,
DWORD dwReason,
LPVOID lpReserved);
#endif // FEATURE_MIXEDMODE
-#ifndef FEATURE_CORECLR
-BOOL STDMETHODCALLTYPE ExecuteDLL(HINSTANCE hInst,
- DWORD dwReason,
- LPVOID lpReserved,
- BOOL fFromThunk);
-#endif // !FEATURE_CORECLR
BOOL STDMETHODCALLTYPE ExecuteEXE(HMODULE hMod);
BOOL STDMETHODCALLTYPE ExecuteEXE(__in LPWSTR pImageNameIn);
@@ -305,12 +295,6 @@ extern "C" HRESULT __cdecl CorDBGetInterface(DebugInterface** rcInterface);
#endif // !CROSSGEN_COMPILE
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-
-// Pointer to the activated CLR interface provided by the shim.
-ICLRRuntimeInfo *g_pCLRRuntime = NULL;
-
-#endif // !FEATURE_CORECLR && !CROSSGEN_COMPILE
extern "C" IExecutionEngine* __stdcall IEE();
@@ -391,7 +375,7 @@ HRESULT EnsureEEStarted(COINITIEE flags)
{
BEGIN_ENTRYPOINT_NOTHROW;
-#if defined(FEATURE_CORECLR) && defined(FEATURE_APPX) && !defined(CROSSGEN_COMPILE)
+#if defined(FEATURE_APPX) && !defined(CROSSGEN_COMPILE)
STARTUP_FLAGS startupFlags = CorHost2::GetStartupFlags();
// On CoreCLR, the host is in charge of determining whether the process is AppX or not.
AppX::SetIsAppXProcess(!!(startupFlags & STARTUP_APPX_APP_MODEL));
@@ -528,58 +512,7 @@ static BOOL WINAPI DbgCtrlCHandler(DWORD dwCtrlType)
// A host can specify that it only wants one version of hosting interface to be used.
BOOL g_singleVersionHosting;
-#ifndef FEATURE_CORECLR
-HRESULT STDMETHODCALLTYPE
-SetRuntimeInfo(
- IUnknown * pUnk,
- STARTUP_FLAGS dwStartupFlags,
- LPCWSTR pwzHostConfig,
- const CoreClrCallbacks ** ppClrCallbacks)
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- ENTRY_POINT;
- PRECONDITION(CheckPointer(pUnk));
- PRECONDITION(CheckPointer(pwzHostConfig, NULL_OK));
- } CONTRACTL_END;
-
- ICLRRuntimeInfo *pRuntime;
- HRESULT hr;
-
- IfFailGo(pUnk->QueryInterface(IID_ICLRRuntimeInfo, (LPVOID *)&pRuntime));
-
- IfFailGo(CorHost2::SetFlagsAndHostConfig(dwStartupFlags, pwzHostConfig, FALSE));
-
- if (InterlockedCompareExchangeT(&g_pCLRRuntime, pRuntime, NULL) != NULL)
- {
- // already set, release this one
- pRuntime->Release();
- }
- *ppClrCallbacks = &GetClrCallbacks();
-
-ErrExit:
- return hr;
-}
-#endif // !FEATURE_CORECLR
-
-#ifndef FEATURE_CORECLR
-HRESULT InitializeHostConfigFile()
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- MODE_ANY;
- INJECT_FAULT(return E_OUTOFMEMORY);
- } CONTRACTL_END;
-
- g_pszHostConfigFile = CorHost2::GetHostConfigFile();
- g_dwHostConfigFile = (g_pszHostConfigFile == NULL ? 0 : wcslen(g_pszHostConfigFile));
- return S_OK;
-}
-#endif // !FEATURE_CORECLR
void InitializeStartupFlags()
{
@@ -591,54 +524,12 @@ void InitializeStartupFlags()
STARTUP_FLAGS flags = CorHost2::GetStartupFlags();
-#ifndef FEATURE_CORECLR
- // If we are running under a requested performance default mode, honor any changes to startup flags
- // In the future, we could make this conditional on the host telling us which subset of flags is
- // valid to override. See file:PerfDefaults.h
- flags = PerformanceDefaults::GetModifiedStartupFlags(flags);
-#endif // !FEATURE_CORECLR
if (flags & STARTUP_CONCURRENT_GC)
g_IGCconcurrent = 1;
else
g_IGCconcurrent = 0;
-#ifndef FEATURE_CORECLR // TODO: We can remove this. Retaining it now just to be safe
- if (flags & STARTUP_SINGLE_VERSION_HOSTING_INTERFACE)
- {
- g_singleVersionHosting = TRUE;
- }
-
-#ifndef FEATURE_CORECLR
- g_pConfig->SetDisableCommitThreadStack(!CLRHosted() || (flags & STARTUP_DISABLE_COMMITTHREADSTACK));
-#else
- g_pConfig->SetDisableCommitThreadStack(true);
-#endif
-
- if(flags & STARTUP_LEGACY_IMPERSONATION)
- g_pConfig->SetLegacyImpersonationPolicy();
-
- if(flags & STARTUP_ALWAYSFLOW_IMPERSONATION)
- g_pConfig->SetAlwaysFlowImpersonationPolicy();
-
- if(flags & STARTUP_HOARD_GC_VM)
- g_IGCHoardVM = 1;
- else
- g_IGCHoardVM = 0;
-
-#ifdef GCTRIMCOMMIT
- if (flags & STARTUP_TRIM_GC_COMMIT)
- g_IGCTrimCommit = 1;
- else
- g_IGCTrimCommit = 0;
-#endif
-
- if(flags & STARTUP_ETW)
- g_fEnableETW = TRUE;
-
- if(flags & STARTUP_ARM)
- g_fEnableARM = TRUE;
-#endif // !FEATURE_CORECLR
InitializeHeapType((flags & STARTUP_SERVER_GC) != 0);
@@ -740,37 +631,6 @@ void InitGSCookie()
}
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-void InitAssemblyUsageLogManager()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- } CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- g_pIAssemblyUsageLogGac = NULL;
-
- AssemblyUsageLogManager::Config config;
-
- config.wszLogDir = NULL;
- config.cLogBufferSize = 32768;
-#ifdef FEATURE_APPX
- config.uiLogRefreshInterval = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenAssemblyUsageLogRefreshInterval);
-#endif
-
- NewArrayHolder<WCHAR> szCustomLogDir(CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NGenAssemblyUsageLog));
- config.wszLogDir = szCustomLogDir;
-
- AssemblyUsageLogManager::Init(&config);
-
- // Once the logger is initialized, create a log object for logging GAC loads.
- AssemblyUsageLogManager::GetUsageLogForContext(W("fusion"), W("GAC"), &g_pIAssemblyUsageLogGac);
-}
-#endif
// ---------------------------------------------------------------------------
// %%Function: EEStartupHelper
@@ -845,10 +705,6 @@ void EEStartupHelper(COINITIEE fFlags)
if (!g_pConfig)
{
IfFailGo(EEConfig::Setup());
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- IfFailGo(InitializeHostConfigFile());
- IfFailGo(g_pConfig->SetupConfiguration());
-#endif // !FEATURE_CORECLR && !CROSSGEN_COMPILE
}
#ifndef CROSSGEN_COMPILE
@@ -858,11 +714,6 @@ void EEStartupHelper(COINITIEE fFlags)
NumaNodeInfo::InitNumaNodeInfo();
CPUGroupInfo::EnsureInitialized();
-#ifndef FEATURE_CORECLR
- // Check in EEConfig whether a workload-specific set of performance defaults have been requested
- // This needs to be done before InitializeStartupFlags in case one is to be overridden
- PerformanceDefaults::InitializeForScenario(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PerformanceScenario));
-#endif
// Initialize global configuration settings based on startup flags
// This needs to be done before the EE has started
@@ -897,10 +748,6 @@ void EEStartupHelper(COINITIEE fFlags)
#endif // CROSSGEN_COMPILE
-#ifndef FEATURE_CORECLR
- // Ensure initialization of Apphacks environment variables
- GetGlobalCompatibilityFlags();
-#endif // !FEATURE_CORECLR
#ifdef STRESS_LOG
if (REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_StressLog, g_pConfig->StressLog ()) != 0) {
@@ -988,16 +835,6 @@ void EEStartupHelper(COINITIEE fFlags)
#ifndef CROSSGEN_COMPILE
-#if defined(STRESS_HEAP) && defined(_DEBUG) && !defined(FEATURE_CORECLR)
- // TODO: is this still an issue?
- // There is a race that causes random AVs on dual proc boxes
- // that we suspect is due to memory coherancy problems (see Whidbey bug 2360)
- // Avoid the issue by making the box effectively single proc.
- if (GCStress<cfg_instr>::IsEnabled() &&
- g_SystemInfo.dwNumberOfProcessors > 1)
- SetProcessAffinityMask(GetCurrentProcess(),
- 1 << (DbgGetEXETimeStamp() % g_SystemInfo.dwNumberOfProcessors));
-#endif // STRESS_HEAP && _DEBUG && !FEATURE_CORECLR
#ifdef FEATURE_PREJIT
// Initialize the sweeper thread. THis is violating our rules with hosting
@@ -1099,10 +936,6 @@ void EEStartupHelper(COINITIEE fFlags)
GCInterface::m_MemoryPressureLock.Init(CrstGCMemoryPressure);
-#ifndef FEATURE_CORECLR
- // Initialize Assembly Usage Logger
- InitAssemblyUsageLogManager();
-#endif
#endif // CROSSGEN_COMPILE
@@ -1239,9 +1072,6 @@ void EEStartupHelper(COINITIEE fFlags)
SystemDomain::System()->PublishAppDomainAndInformDebugger(SystemDomain::System()->DefaultDomain());
#endif
-#ifndef FEATURE_CORECLR
- ExistingOobAssemblyList::Init();
-#endif
#endif // CROSSGEN_COMPILE
@@ -1329,12 +1159,10 @@ void EEStartupHelper(COINITIEE fFlags)
}
//For a similar reason, let's not run VerifyAllOnLoad either.
-#ifdef FEATURE_CORECLR
if (g_pConfig->VerifyModulesOnLoad())
{
SystemDomain::SystemModule()->VerifyAllMethods();
}
-#endif //FEATURE_CORECLR
// Perform mscorlib consistency check if requested
g_Mscorlib.CheckExtended();
@@ -1595,11 +1423,6 @@ static void ExternalShutdownHelper(int exitCode, ShutdownCompleteAction sca)
// process exit code. This can be modified by the app via System.SetExitCode().
SetLatchedExitCode(exitCode);
-#ifndef FEATURE_CORECLR // no shim
- // Bump up the ref-count on the module
- for (int i =0; i<6; i++)
- CLRLoadLibrary(MSCOREE_SHIM_W);
-#endif // FEATURE_CORECLR
ForceEEShutdown(sca);
@@ -1671,12 +1494,6 @@ BOOL IsRuntimeStarted(DWORD *pdwStartupFlags)
if (pdwStartupFlags != NULL) // this parameter is optional
{
*pdwStartupFlags = 0;
-#ifndef FEATURE_CORECLR
- if (g_fEEStarted)
- {
- *pdwStartupFlags = CorHost2::GetStartupFlags();
- }
-#endif
}
return g_fEEStarted;
}
@@ -1869,14 +1686,6 @@ void STDMETHODCALLTYPE EEShutDownHelper(BOOL fIsDllUnloading)
fFinalizeOK = FinalizerThread::FinalizerThreadWatchDog();
}
-#ifndef FEATURE_CORECLR
- if (!g_fFastExitProcess)
- {
- // Log usage data to disk. (Only do this in normal shutdown scenarios, and not involving ngen)
- if (!IsCompilationProcess())
- AssemblyUsageLogManager::GenerateLog(AssemblyUsageLogManager::GENERATE_LOG_FLAGS_NONE);
- }
-#endif
// Ok. Let's stop the EE.
if (!g_fProcessDetach)
@@ -1990,22 +1799,6 @@ void STDMETHODCALLTYPE EEShutDownHelper(BOOL fIsDllUnloading)
}
#endif // PROFILING_SUPPORTED
-#ifndef FEATURE_CORECLR
- // CoEEShutDownCOM moved to
- // the Finalizer thread. See bug 87809
- if (!g_fProcessDetach && !g_fFastExitProcess)
- {
- g_fEEShutDown |= ShutDown_COM;
- if (fFinalizeOK)
- {
- FinalizerThread::FinalizerThreadWatchDog();
- }
- }
-#ifdef _DEBUG
- else
- g_fEEShutDown |= ShutDown_COM;
-#endif
-#endif //FEATURE_CORECLR
#ifdef _DEBUG
g_fEEShutDown |= ShutDown_SyncBlock;
@@ -2662,75 +2455,6 @@ void STDMETHODCALLTYPE CoUninitializeEE(BOOL fIsDllUnloading)
}
-#ifndef FEATURE_CORECLR
-//*****************************************************************************
-// This entry point is called from the native DllMain of the loaded image.
-// This gives the COM+ loader the chance to dispatch the loader event. The
-// first call will cause the loader to look for the entry point in the user
-// image. Subsequent calls will dispatch to either the user's DllMain or
-// their Module derived class.
-//*****************************************************************************
-BOOL STDMETHODCALLTYPE _CorDllMain( // TRUE on success, FALSE on error.
- HINSTANCE hInst, // Instance handle of the loaded module.
- DWORD dwReason, // Reason for loading.
- LPVOID lpReserved // Unused.
- )
-{
- STATIC_CONTRACT_NOTHROW;
- //STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_ENTRY_POINT;
-
- //BEGIN_ENTRYPOINT_NOTHROW;
-
- struct Param
- {
- HINSTANCE hInst;
- DWORD dwReason;
- LPVOID lpReserved;
- BOOL retval;
- } param;
- param.hInst = hInst;
- param.dwReason = dwReason;
- param.lpReserved = lpReserved;
- param.retval = FALSE;
-
- // Can't use PAL_TRY/EX_TRY here as they access the ClrDebugState which gets blown away as part of the
- // PROCESS_DETACH path. Must use special PAL_TRY_FOR_DLLMAIN, passing the reason were in the DllMain.
- PAL_TRY_FOR_DLLMAIN(Param *, pParam, &param, pParam->dwReason)
- {
-#ifdef _DEBUG
- if (CLRTaskHosted() &&
- ((pParam->dwReason == DLL_PROCESS_ATTACH && pParam->lpReserved == NULL) || // LoadLibrary of a managed dll
- (pParam->dwReason == DLL_PROCESS_DETACH && pParam->lpReserved == NULL) // FreeLibrary of a managed dll
- )) {
- // OS loader lock is being held by the current thread. We can not allow the fiber
- // to be rescheduled here while processing DllMain for managed dll.
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- IHostTask *pTask = GetCurrentHostTask();
- if (pTask) {
- Thread *pThread = GetThread();
- _ASSERTE (pThread);
- _ASSERTE (pThread->HasThreadAffinity());
- }
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
- }
-#endif
- // Since we're in _CorDllMain, we know that we were not called because of a
- // bootstrap thunk, since they will call CorDllMainForThunk. Because of this,
- // we can pass FALSE for the fFromThunk parameter.
- pParam->retval = ExecuteDLL(pParam->hInst,pParam->dwReason,pParam->lpReserved, FALSE);
- }
- PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- }
- PAL_ENDTRY;
-
- //END_ENTRYPOINT_NOTHROW;
-
- return param.retval;
-}
-
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_MIXEDMODE
//*****************************************************************************
@@ -2779,334 +2503,6 @@ void STDMETHODCALLTYPE CorDllMainForThunk(HINSTANCE hInst, HINSTANCE hInstShim)
#endif // FEATURE_MIXEDMODE
-#ifndef FEATURE_CORECLR
-
-// This function will do some additional PE Checks to make sure everything looks good.
-// We must do these before we run any managed code (that's why we can't do them in PEVerifier, as
-// managed code is used to determine the policy settings)
-HRESULT DoAdditionalPEChecks(HINSTANCE hInst)
-{
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_TRIGGERS;
-
- struct Param
- {
- HINSTANCE hInst;
- HRESULT hr;
- } param;
- param.hInst = hInst;
- param.hr = S_OK;
-
- PAL_TRY(Param *, pParam, &param)
- {
- PEDecoder pe(pParam->hInst);
-
- if (!pe.CheckWillCreateGuardPage())
- pParam->hr = COR_E_BADIMAGEFORMAT;
- }
- PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
- {
- }
- PAL_ENDTRY
-
- return param.hr;
-}
-
-//*****************************************************************************
-// This entry point is called from the native entry point of the loaded
-// executable image. This simply calls into _CorExeMainInternal, the real
-// entry point inside a filter to trigger unhandled exception processing in the
-// event an exception goes unhandled, independent of the OS UEF mechanism.
-//*****************************************************************************
-__int32 STDMETHODCALLTYPE _CorExeMain( // Executable exit code.
- )
-{
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
-
- // We really have nothing to share with our filter at this point.
- struct Param
- {
- PVOID pData;
- } param;
- param.pData = NULL;
-
- PAL_TRY(Param*, _pParam, &param)
- {
- // Call the real function that will invoke the managed entry point
- _CorExeMainInternal();
- }
- PAL_EXCEPT_FILTER(EntryPointFilter)
- {
- LOG((LF_STARTUP, LL_INFO10, "EntryPointFilter returned EXCEPTION_EXECUTE_HANDLER!"));
- }
- PAL_ENDTRY;
-
- return 0;
-}
-
-//*****************************************************************************
-// This entry point is called from _CorExeMain. If an exception goes unhandled
-// from here, we will trigger unhandled exception processing in _CorExeMain.
-//
-// The command line arguments and other entry point data
-// will be gathered here. The entry point for the user image will be found
-// and handled accordingly.
-//*****************************************************************************
-__int32 STDMETHODCALLTYPE _CorExeMainInternal( // Executable exit code.
- )
-{
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_ENTRY_POINT;
-
- // Yes, CorExeMain needs throws. If an exception passes through here, it will cause the
- // "The application has generated an unhandled exception" dialog and offer to debug.
-
- BEGIN_ENTRYPOINT_THROWS;
-
- // Make sure PE file looks ok
- HRESULT hr;
- {
- // We are early in the process, if we get an SO here we will just rip
- CONTRACT_VIOLATION(SOToleranceViolation);
- if (FAILED(hr = DoAdditionalPEChecks(WszGetModuleHandle(NULL))))
- {
- GCX_PREEMP();
- VMDumpCOMErrors(hr);
- SetLatchedExitCode (-1);
- goto exit;
- }
- }
-
- g_fEEManagedEXEStartup = TRUE;
- // Before we initialize the EE, make sure we've snooped for all EE-specific
- // command line arguments that might guide our startup.
- WCHAR *pCmdLine = WszGetCommandLine();
- HRESULT result = CorCommandLine::SetArgvW(pCmdLine);
-
- if (SUCCEEDED(result))
- {
- g_fWeOwnProcess = TRUE;
- result = EnsureEEStarted(COINITEE_MAIN);
- }
-
- if (FAILED(result))
- {
- g_fWeOwnProcess = FALSE;
- GCX_PREEMP();
- VMDumpCOMErrors(result);
- SetLatchedExitCode (-1);
- goto exit;
- }
-
- INSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
- // This will be called from a EXE so this is a self referential file so I am going to call
- // ExecuteEXE which will do the work to make a EXE load.
-
- BOOL bretval = 0;
-
- bretval = ExecuteEXE(WszGetModuleHandle(NULL));
- if (!bretval) {
- // The only reason I've seen this type of error in the wild is bad
- // metadata file format versions and inadequate error handling for
- // partially signed assemblies. While this may happen during
- // development, our customers should not get here. This is a back-stop
- // to catch CLR bugs. If you see this, please try to find a better way
- // to handle your error, like throwing an unhandled exception.
- EEMessageBoxCatastrophic(IDS_EE_COREXEMAIN_FAILED_TEXT, IDS_EE_COREXEMAIN_FAILED_TITLE);
- SetLatchedExitCode (-1);
- }
-
- UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
-exit:
- STRESS_LOG1(LF_STARTUP, LL_ALWAYS, "Program exiting: return code = %d", GetLatchedExitCode());
-
- STRESS_LOG0(LF_STARTUP, LL_INFO10, "EEShutDown invoked from _CorExeMainInternal");
-
- EEPolicy::HandleExitProcess();
-
- END_ENTRYPOINT_THROWS;
-
- return 0;
-}
-
-
-static BOOL CacheCommandLine(__in LPWSTR pCmdLine, __in_opt LPWSTR* ArgvW)
-{
- CONTRACTL {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- PRECONDITION(CheckPointer(pCmdLine));
- PRECONDITION(CheckPointer(ArgvW));
- } CONTRACTL_END;
-
- if (pCmdLine) {
- size_t len = wcslen(pCmdLine);
-
- _ASSERT(g_pCachedCommandLine== NULL);
- g_pCachedCommandLine = new WCHAR[len+1];
- wcscpy_s(g_pCachedCommandLine, len+1, pCmdLine);
- }
-
- if (ArgvW != NULL && ArgvW[0] != NULL) {
- PathString wszModuleName;
- PathString wszCurDir;
- if (!WszGetCurrentDirectory(wszCurDir))
- return FALSE;
-
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable:25025)
-#endif
-
- // usage of PathCombine is safe if we ensure that buffer specified by
- // parameter1 can accomodate buffers specified by paramater2, parameter3
- // and one path separator
- COUNT_T wszModuleName_len = wszCurDir.GetCount() + lstrlenW(ArgvW[0]);
- WCHAR* wszModuleName_buf = wszModuleName.OpenUnicodeBuffer(wszModuleName_len);
-
- if (PathCombine(wszModuleName_buf, wszCurDir, ArgvW[0]) == NULL)
- return FALSE;
- wszModuleName.CloseBuffer();
-#ifdef _PREFAST_
-#pragma warning(pop)
-#endif
-
- size_t len = wszModuleName.GetCount();
- _ASSERT(g_pCachedModuleFileName== NULL);
- g_pCachedModuleFileName = new WCHAR[len+1];
- wcscpy_s(g_pCachedModuleFileName, len+1, wszModuleName);
- }
-
- return TRUE;
-}
-
-//*****************************************************************************
-// This entry point is called from the native entry point of the loaded
-// executable image. The command line arguments and other entry point data
-// will be gathered here. The entry point for the user image will be found
-// and handled accordingly.
-//*****************************************************************************
-__int32 STDMETHODCALLTYPE _CorExeMain2( // Executable exit code.
- PBYTE pUnmappedPE, // -> memory mapped code
- DWORD cUnmappedPE, // Size of memory mapped code
- __in LPWSTR pImageNameIn, // -> Executable Name
- __in LPWSTR pLoadersFileName, // -> Loaders Name
- __in LPWSTR pCmdLine) // -> Command Line
-{
-
- // This entry point is used by clix
- BOOL bRetVal = 0;
-
- BEGIN_ENTRYPOINT_VOIDRET;
- {
- // Before we initialize the EE, make sure we've snooped for all EE-specific
- // command line arguments that might guide our startup.
- HRESULT result = CorCommandLine::SetArgvW(pCmdLine);
-
- if (!CacheCommandLine(pCmdLine, CorCommandLine::GetArgvW(NULL))) {
- LOG((LF_STARTUP, LL_INFO10, "Program exiting - CacheCommandLine failed\n"));
- bRetVal = -1;
- goto exit;
- }
-
- if (SUCCEEDED(result))
- result = InitializeEE(COINITEE_MAIN);
-
- if (FAILED(result)) {
- VMDumpCOMErrors(result);
- SetLatchedExitCode (-1);
- goto exit;
- }
-
- // Load the executable
- bRetVal = ExecuteEXE(pImageNameIn);
-
- if (!bRetVal) {
- // The only reason I've seen this type of error in the wild is bad
- // metadata file format versions and inadequate error handling for
- // partially signed assemblies. While this may happen during
- // development, our customers should not get here. This is a back-stop
- // to catch CLR bugs. If you see this, please try to find a better way
- // to handle your error, like throwing an unhandled exception.
- EEMessageBoxCatastrophic(IDS_EE_COREXEMAIN2_FAILED_TEXT, IDS_EE_COREXEMAIN2_FAILED_TITLE);
- SetLatchedExitCode (-1);
- }
-
-exit:
- STRESS_LOG1(LF_STARTUP, LL_ALWAYS, "Program exiting: return code = %d", GetLatchedExitCode());
-
- STRESS_LOG0(LF_STARTUP, LL_INFO10, "EEShutDown invoked from _CorExeMain2");
-
- EEPolicy::HandleExitProcess();
- }
- END_ENTRYPOINT_VOIDRET;
-
- return bRetVal;
-}
-
-//*****************************************************************************
-// This is the call point to wire up an EXE. In this case we have the HMODULE
-// and just need to make sure we do to correct self referantial things.
-//*****************************************************************************
-
-
-BOOL STDMETHODCALLTYPE ExecuteEXE(HMODULE hMod)
-{
- STATIC_CONTRACT_GC_TRIGGERS;
-
- _ASSERTE(hMod);
- if (!hMod)
- return FALSE;
-
- ETWFireEvent(ExecExe_V1);
-
- struct Param
- {
- HMODULE hMod;
- } param;
- param.hMod = hMod;
-
- EX_TRY_NOCATCH(Param *, pParam, &param)
- {
- // Executables are part of the system domain
- SystemDomain::ExecuteMainMethod(pParam->hMod);
- }
- EX_END_NOCATCH;
-
- ETWFireEvent(ExecExeEnd_V1);
-
- return TRUE;
-}
-
-BOOL STDMETHODCALLTYPE ExecuteEXE(__in LPWSTR pImageNameIn)
-{
- STATIC_CONTRACT_GC_TRIGGERS;
-
- EX_TRY_NOCATCH(LPWSTR, pImageNameInner, pImageNameIn)
- {
- WCHAR wzPath[MAX_LONGPATH];
- DWORD dwPathLength = 0;
-
- // get the path of executable
- dwPathLength = WszGetFullPathName(pImageNameInner, MAX_LONGPATH, wzPath, NULL);
-
- if (!dwPathLength || dwPathLength > MAX_LONGPATH)
- {
- ThrowWin32( !dwPathLength ? GetLastError() : ERROR_FILENAME_EXCED_RANGE);
- }
-
- SystemDomain::ExecuteMainMethod( NULL, (WCHAR *)wzPath );
- }
- EX_END_NOCATCH;
-
- return TRUE;
-}
-#endif // FEATURE_CORECLR
#ifdef FEATURE_MIXEDMODE
@@ -3449,31 +2845,6 @@ BOOL ExecuteDLL_ReturnOrThrow(HRESULT hr, BOOL fFromThunk)
return SUCCEEDED(hr);
}
-#if !defined(FEATURE_CORECLR) && defined(_DEBUG)
-//*****************************************************************************
-// Factor some common debug code.
-//*****************************************************************************
-static void EnsureManagedThreadExistsForHostedThread()
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- } CONTRACTL_END;
-
- if (CLRTaskHosted()) {
- // If CLR is hosted, and this is on a thread that a host controls,
- // we must have created Thread object.
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- IHostTask *pHostTask = GetCurrentHostTask();
- if (pHostTask)
- {
- CONSISTENCY_CHECK(CheckPointer(GetThread()));
- }
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
- }
-}
-#endif // !FEATURE_CORECLR && _DEBUG
#ifdef FEATURE_MIXEDMODE
//*****************************************************************************
@@ -3520,161 +2891,6 @@ HRESULT PrepareExecuteDLLForThunk(HINSTANCE hInst,
#endif // FEATURE_MIXEDMODE
-#ifndef FEATURE_CORECLR
-//*****************************************************************************
-// This is the call point to make a DLL that is already loaded into our address
-// space run. There will be other code to actually have us load a DLL due to a
-// class reference.
-//*****************************************************************************
-BOOL STDMETHODCALLTYPE ExecuteDLL(HINSTANCE hInst,
- DWORD dwReason,
- LPVOID lpReserved,
- BOOL fFromThunk)
-{
-
- CONTRACTL{
- THROWS;
- WRAPPER(GC_TRIGGERS);
- MODE_ANY;
- ENTRY_POINT;
- PRECONDITION(CheckPointer(lpReserved, NULL_OK));
- PRECONDITION(CheckPointer(hInst));
- PRECONDITION(GetThread() != NULL || !fFromThunk);
- } CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BOOL fRetValue = FALSE;
-
- // This needs to be before the BEGIN_ENTRYPOINT_THROWS since
- // we can't call ReportStackOverflow if we're almost done with
- // shutdown and can't run managed code.
- if (!CanRunManagedCode(LoaderLockCheck::None))
- {
- return fRetValue;
- }
-
- BEGIN_ENTRYPOINT_THROWS;
-
- Thread *pThread = GetThread();
-
- if (!hInst)
- {
- fRetValue = ExecuteDLL_ReturnOrThrow(E_FAIL, fFromThunk);
- goto Exit;
- }
-
- // Note that we always check fFromThunk before checking the dwReason value.
- // This is because the dwReason value is undefined in the case that we're
- // being invoked due to a bootstrap (because that is by definition outside
- // of the loader lock and there is no appropriate dwReason value).
- if (fFromThunk ||
- dwReason == DLL_PROCESS_ATTACH ||
- dwReason == DLL_THREAD_ATTACH)
- {
- INDEBUG(EnsureManagedThreadExistsForHostedThread();)
-
-
- // If necessary, start the runtime and create a managed thread object.
- if (fFromThunk || dwReason == DLL_PROCESS_ATTACH)
- {
- hr = EnsureEEStarted(COINITEE_DLL);
-
- if (SUCCEEDED(hr) && pThread == NULL)
- {
- pThread = SetupThreadNoThrow(&hr);
- }
-
- if(FAILED(hr))
- {
- fRetValue = ExecuteDLL_ReturnOrThrow(hr, fFromThunk);
- goto Exit;
- }
- }
-
- // IJW assemblies cause the thread doing the process attach to
- // re-enter ExecuteDLL and do a thread attach. This happens when
- // CoInitializeEE() above executed
- else if (!(pThread &&
- pThread->GetDomain() &&
- CanRunManagedCode(LoaderLockCheck::None)))
- {
- fRetValue = ExecuteDLL_ReturnOrThrow(S_OK, fFromThunk);
- goto Exit;
- }
-
- // we now have a thread setup - either the 1st if set it up, or
- // the else if ran if we didn't have a thread setup.
-
-#ifdef FEATURE_MIXEDMODE
-
- EX_TRY
- {
- hr = ExecuteDLLForAttach(hInst, dwReason, lpReserved, fFromThunk);
- }
- EX_CATCH
- {
- // We rethrow directly here instead of using ExecuteDLL_ReturnOrThrow() to
- // preserve the full exception information, rather than just the HRESULT
- if (fFromThunk)
- {
- EX_RETHROW;
- }
- else
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- if (FAILED(hr))
- {
- fRetValue = ExecuteDLL_ReturnOrThrow(hr, fFromThunk);
- goto Exit;
- }
-#endif // FEATURE_MIXEDMODE
- }
- else
- {
- PEDecoder pe(hInst);
- if (pe.HasManagedEntryPoint())
- {
- // If the EE is still intact, then run user entry points. Otherwise
- // detach was handled when the app domain was stopped.
- //
- // Checks for the loader lock will occur within RunDllMain, if that's
- FAULT_NOT_FATAL();
- if (CanRunManagedCode(LoaderLockCheck::None))
- {
- hr = SystemDomain::RunDllMain(hInst, dwReason, lpReserved);
- }
- }
- // This does need to match the attach. We will only unload dll's
- // at the end and CoUninitialize will just bounce at 0. WHEN and IF we
- // get around to unloading IL DLL's during execution prior to
- // shutdown we will need to bump the reference one to compensate
- // for this call.
- if (dwReason == DLL_PROCESS_DETACH && !g_fForbidEnterEE)
- {
-#ifdef FEATURE_MIXEDMODE
- // If we're in a decent state, we need to free the memory associated
- // with the IJW thunk fixups.
- // we are not in a decent state if the process is terminating (lpReserved!=NULL)
- if (g_fEEStarted && !g_fEEShutDown && !lpReserved)
- {
- PEImage::UnloadIJWModule(hInst);
- }
-#endif // FEATURE_MIXEDMODE
- }
- }
-
- fRetValue = ExecuteDLL_ReturnOrThrow(hr, fFromThunk);
-
-Exit:
-
- END_ENTRYPOINT_THROWS;
- return fRetValue;
-}
-#endif // !FEATURE_CORECLR
Volatile<BOOL> g_bIsGarbageCollectorFullyInitialized = FALSE;
@@ -3803,15 +3019,6 @@ BOOL STDMETHODCALLTYPE EEDllMain( // TRUE on success, FALSE on error.
// Remember module instance
g_pMSCorEE = pParam->hInst;
-#ifndef FEATURE_CORECLR
- CoreClrCallbacks cccallbacks;
- cccallbacks.m_hmodCoreCLR = (HINSTANCE)g_pMSCorEE;
- cccallbacks.m_pfnIEE = IEE;
- cccallbacks.m_pfnGetCORSystemDirectory = GetCORSystemDirectoryInternaL;
- cccallbacks.m_pfnGetCLRFunction = GetCLRFunction;
-
- InitUtilcode(cccallbacks);
-#endif // !FEATURE_CORECLR
// Set callbacks so that LoadStringRC knows which language our
// threads are in so that it can return the proper localized string.
@@ -4124,7 +3331,6 @@ static void InitializeDebugger(void)
hr = g_pDebugInterface->Startup(); // throw on error
_ASSERTE(SUCCEEDED(hr));
-#ifdef FEATURE_CORECLR
//
// If the debug pack is not installed, Startup will return S_FALSE
// and we should cleanup and proceed without debugging support.
@@ -4133,31 +3339,8 @@ static void InitializeDebugger(void)
{
return;
}
-#endif // FEATURE_CORECLR
- }
-
-#if !defined(FEATURE_CORECLR) // simple hosting
- // If there's a DebuggerThreadControl interface, then we
- // need to update the DebuggerSpecialThread list.
- if (CorHost::GetDebuggerThreadControl())
- {
- hr = CorHost::RefreshDebuggerSpecialThreadList();
- _ASSERTE((SUCCEEDED(hr)) && (hr != S_FALSE));
-
- // So we don't think this will ever fail, but just in case...
- IfFailThrow(hr);
}
- // If there is a DebuggerThreadControl interface, then it was set before the debugger
- // was initialized and we need to provide this interface now. If debugging is already
- // initialized then the IDTC pointer is passed in when it is set through CorHost
- IDebuggerThreadControl *pDTC = CorHost::GetDebuggerThreadControl();
-
- if (pDTC != NULL)
- {
- g_pDebugInterface->SetIDbgThreadControl(pDTC);
- }
-#endif // !defined(FEATURE_CORECLR)
LOG((LF_CORDB, LL_INFO10, "Left-side debugging services setup.\n"));
@@ -4198,9 +3381,6 @@ static void TerminateDebugger(void)
g_CORDebuggerControlFlags = DBCF_NORMAL_OPERATION;
-#if !defined(FEATURE_CORECLR) // simple hosting
- CorHost::CleanupDebuggerThreadControl();
-#endif // !defined(FEATURE_CORECLR)
}
@@ -4825,172 +4005,6 @@ void ContractRegressionCheck()
#endif // ENABLE_CONTRACTS_IMPL
-#ifndef FEATURE_CORECLR
-//-------------------------------------------------------------------------
-// CorCommandLine state and methods
-//-------------------------------------------------------------------------
-// Class to encapsulate Cor Command line processing
-
-// Statics for the CorCommandLine class
-DWORD CorCommandLine::m_NumArgs = 0;
-LPWSTR *CorCommandLine::m_ArgvW = 0;
-
-LPWSTR CorCommandLine::m_pwszAppFullName = NULL;
-DWORD CorCommandLine::m_dwManifestPaths = 0;
-LPWSTR *CorCommandLine::m_ppwszManifestPaths = NULL;
-DWORD CorCommandLine::m_dwActivationData = 0;
-LPWSTR *CorCommandLine::m_ppwszActivationData = NULL;
-
-#ifdef _DEBUG
-LPCWSTR g_CommandLine;
-#endif
-
-// Set argvw from command line
-/* static */
-HRESULT CorCommandLine::SetArgvW(LPCWSTR lpCommandLine)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- INJECT_FAULT(return E_OUTOFMEMORY;);
-
- PRECONDITION(CheckPointer(lpCommandLine));
- }
- CONTRACTL_END
-
- HRESULT hr = S_OK;
- if(!m_ArgvW) {
- INDEBUG(g_CommandLine = lpCommandLine);
-
- InitializeLogging(); // This is so early, we may not be initialized
- LOG((LF_ALWAYS, LL_INFO10, "Executing program with command line '%S'\n", lpCommandLine));
-
- m_ArgvW = SegmentCommandLine(lpCommandLine, &m_NumArgs);
-
- if (!m_ArgvW)
- return E_OUTOFMEMORY;
-
- // Click once specific parsing
- hr = ReadClickOnceEnvVariables();
- }
-
- return hr;
-}
-
-// Retrieve the command line
-/* static */
-LPWSTR* CorCommandLine::GetArgvW(DWORD *pNumArgs)
-{
- LIMITED_METHOD_CONTRACT;
-
- if (pNumArgs != 0)
- *pNumArgs = m_NumArgs;
-
- return m_ArgvW;
-}
-
-HRESULT CorCommandLine::ReadClickOnceEnvVariables()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- } CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW);
-
- EX_TRY
- {
- // Find out if this is a ClickOnce application being activated.
- PathString m_pwszAppFullNameHolder;
- DWORD cAppFullName = WszGetEnvironmentVariable(g_pwzClickOnceEnv_FullName, m_pwszAppFullNameHolder);
- if (cAppFullName > 0) {
- // get the application full name.
- m_pwszAppFullName = m_pwszAppFullNameHolder.GetCopyOfUnicodeString();
-
- // reset the variable now that we read it so child processes
- // do not think they are a clickonce app.
- WszSetEnvironmentVariable(g_pwzClickOnceEnv_FullName, NULL);
-
- // see if we have application manifest files.
- DWORD dwManifestPaths = 0;
- while (1) {
- StackSString manifestFile(g_pwzClickOnceEnv_Manifest);
- StackSString buf;
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(dwManifestPaths, buf.OpenUnicodeBuffer(size), size, 10);
- buf.CloseBuffer();
- manifestFile.Append(buf);
- SString temp;
- if (WszGetEnvironmentVariable(manifestFile.GetUnicode(), temp) > 0)
- dwManifestPaths++;
- else
- break;
- }
- m_ppwszManifestPaths = new LPWSTR[dwManifestPaths];
- for (DWORD i=0; i<dwManifestPaths; i++) {
- StackSString manifestFile(g_pwzClickOnceEnv_Manifest);
- StackSString buf;
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(i, buf.OpenUnicodeBuffer(size), size, 10);
- buf.CloseBuffer();
- manifestFile.Append(buf);
- PathString m_ppwszManifestPathsHolder;
- DWORD cManifestPath = WszGetEnvironmentVariable(manifestFile.GetUnicode(), m_ppwszManifestPathsHolder);
- if (cManifestPath > 0) {
-
- m_ppwszManifestPaths[i] = m_ppwszManifestPathsHolder.GetCopyOfUnicodeString();
- WszSetEnvironmentVariable(manifestFile.GetUnicode(), NULL); // reset the env. variable.
- }
- }
- m_dwManifestPaths = dwManifestPaths;
-
- // see if we have activation data arguments.
- DWORD dwActivationData = 0;
- while (1) {
- StackSString activationData(g_pwzClickOnceEnv_Parameter);
- StackSString buf;
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(dwActivationData, buf.OpenUnicodeBuffer(size), size, 10);
- buf.CloseBuffer();
- activationData.Append(buf);
- SString temp;
- if (WszGetEnvironmentVariable(activationData.GetUnicode(), temp) > 0)
- dwActivationData++;
- else
- break;
- }
- m_ppwszActivationData = new LPWSTR[dwActivationData];
- for (DWORD i=0; i<dwActivationData; i++) {
- StackSString activationData(g_pwzClickOnceEnv_Parameter);
- StackSString buf;
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(i, buf.OpenUnicodeBuffer(size), size, 10);
- buf.CloseBuffer();
- activationData.Append(buf);
- PathString m_ppwszActivationDataHolder;
- DWORD cActivationData = WszGetEnvironmentVariable(activationData.GetUnicode(), m_ppwszActivationDataHolder);
- if (cActivationData > 0) {
- m_ppwszActivationData[i] = m_ppwszActivationDataHolder.GetCopyOfUnicodeString();
- WszSetEnvironmentVariable(activationData.GetUnicode(), NULL); // reset the env. variable.
- }
- }
- m_dwActivationData = dwActivationData;
- }
- }
- EX_CATCH_HRESULT(hr);
-
- END_SO_INTOLERANT_CODE;
-
- return hr;
-}
-
-#endif // !FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
@@ -5004,62 +4018,6 @@ HRESULT CorCommandLine::ReadClickOnceEnvVariables()
//
BOOL GetOSVersion(LPOSVERSIONINFO lposVer)
{
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
-
- //declared static to cache the version info
- static OSVERSIONINFOEX osvi = {0};
- BOOL ret = TRUE;
-
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(GetThread(), return FALSE);
-
- //If not yet cached get the OS version info
- if(osvi.dwMajorVersion == 0)
- {
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
-
- ReleaseHolder<ICLRRuntimeHostInternal> pRuntimeHostInternal;
- //Get the interface
- HRESULT hr = g_pCLRRuntime->GetInterface(CLSID_CLRRuntimeHostInternal,
- IID_ICLRRuntimeHostInternal,
- &pRuntimeHostInternal);
-
- _ASSERT(SUCCEEDED(hr));
-
- //Call mscoree!GetVersionExWrapper() through mscoreei interface method
- hr = pRuntimeHostInternal->GetTrueOSVersion((LPOSVERSIONINFO)&osvi);
- if(!SUCCEEDED(hr))
- {
- osvi.dwMajorVersion = 0;
- ret = FALSE;
- goto FUNCEND;
- }
- }
-
- if(lposVer->dwOSVersionInfoSize==sizeof(OSVERSIONINFOEX)||lposVer->dwOSVersionInfoSize==sizeof(OSVERSIONINFO))
- {
- //Copy the cached version info to the return memory location
- memcpy(lposVer,&osvi, lposVer->dwOSVersionInfoSize);
- }
- else
- {
- //return failure if dwOSVersionInfoSize not set properly
- ret = FALSE;
- }
-
-FUNCEND:
- END_SO_INTOLERANT_CODE;
-
- return ret;
-#else
// Fix for warnings when building against WinBlue build 9444.0.130614-1739
// warning C4996: 'GetVersionExW': was declared deprecated
// externalapis\windows\winblue\sdk\inc\sysinfoapi.h(442)
@@ -5067,5 +4025,4 @@ FUNCEND:
#pragma warning( disable : 4996 )
return WszGetVersionEx(lposVer);
#pragma warning( default : 4996 )
-#endif
}
diff --git a/src/vm/ceemain.h b/src/vm/ceemain.h
index 37fc3dcddf..f3d4db5b00 100644
--- a/src/vm/ceemain.h
+++ b/src/vm/ceemain.h
@@ -210,44 +210,5 @@ INT32 GetLatchedExitCode (void);
// Stronger than IsGCHeapInitialized
BOOL IsGarbageCollectorFullyInitialized();
-#ifndef FEATURE_CORECLR
-//---------------------------------------------------------------------------------------
-//
-// Class to encapsulate Cor Command line processing
-//
-class CorCommandLine
-{
-public:
-
-//********** TYPES
-
- // Note: We don't bother with interlocked operations as we manipulate these bits,
- // because we don't anticipate free-threaded access. (Most of this is used only
- // during startup / shutdown).
-
-//********** DATA
-
- // Hold the current (possibly parsed) command line here
- static DWORD m_NumArgs;
- static LPWSTR *m_ArgvW;
-
- static LPWSTR m_pwszAppFullName;
- static DWORD m_dwManifestPaths;
- static LPWSTR *m_ppwszManifestPaths;
- static DWORD m_dwActivationData;
- static LPWSTR *m_ppwszActivationData;
-
-//********** METHODS
-
- // parse the command line
- static HRESULT SetArgvW(LPCWSTR lpCommandLine);
-
- // Retrieve the parsed command line
- static LPWSTR *GetArgvW(DWORD *pNumArgs);
-
-private:
- static HRESULT ReadClickOnceEnvVariables();
-};
-#endif // !FEATURE_CORECLR
#endif
diff --git a/src/vm/class.h b/src/vm/class.h
index 7517863278..3b7ff4490e 100644
--- a/src/vm/class.h
+++ b/src/vm/class.h
@@ -1360,9 +1360,6 @@ public:
_ASSERTE(HasCriticalTransparentInfo());
return (m_VMFlags & VMFLAG_TRANSPARENCY_MASK) == VMFLAG_TRANSPARENCY_ALLCRITICAL_TAS ||
(m_VMFlags & VMFLAG_TRANSPARENCY_MASK) == VMFLAG_TRANSPARENCY_TAS_NOTCRITICAL
-#ifndef FEATURE_CORECLR
- || (m_VMFlags & VMFLAG_TRANSPARENCY_MASK) == VMFLAG_TRANSPARENCY_CRITICAL_TAS
-#endif // !FEATURE_CORECLR;
;
}
@@ -1388,9 +1385,6 @@ public:
}
void SetCriticalTransparentInfo(
-#ifndef FEATURE_CORECLR
- BOOL fIsCritical,
-#endif // !FEATURE_CORECLR
BOOL fIsTreatAsSafe,
BOOL fIsAllTransparent,
BOOL fIsAllCritical)
@@ -1399,9 +1393,7 @@ public:
// TAS wihtout critical doesn't make sense - although it was allowed in the v2 desktop model,
// so we need to allow it for compatibility reasons on the desktop.
-#ifdef FEATURE_CORECLR
_ASSERTE(!fIsTreatAsSafe || fIsAllCritical);
-#endif // FEATURE_CORECLR
//if nothing is set, then we're transparent.
unsigned flags = VMFLAG_TRANSPARENCY_TRANSPARENT;
@@ -1415,13 +1407,6 @@ public:
flags = fIsTreatAsSafe ? VMFLAG_TRANSPARENCY_ALLCRITICAL_TAS :
VMFLAG_TRANSPARENCY_ALLCRITICAL;
}
-#ifndef FEATURE_CORECLR
- else if (fIsCritical)
- {
- flags = fIsTreatAsSafe ? VMFLAG_TRANSPARENCY_CRITICAL_TAS :
- VMFLAG_TRANSPARENCY_CRITICAL;
- }
-#endif // !FEATURE_CORECLR
else
{
flags = fIsTreatAsSafe ? VMFLAG_TRANSPARENCY_TAS_NOTCRITICAL :
diff --git a/src/vm/classnames.h b/src/vm/classnames.h
index 6b10da1e27..7664158afa 100644
--- a/src/vm/classnames.h
+++ b/src/vm/classnames.h
@@ -158,10 +158,6 @@
#define g_SecurityCriticalAttribute "System.Security.SecurityCriticalAttribute"
#define g_SecurityTransparentAttribute "System.Security.SecurityTransparentAttribute"
-#ifndef FEATURE_CORECLR
-#define g_SecurityTreatAsSafeAttribute "System.Security.SecurityTreatAsSafeAttribute"
-#define g_SecurityRulesAttribute "System.Security.SecurityRulesAttribute"
-#endif //FEATURE_CORECLR
#define g_SecuritySafeCriticalAttribute "System.Security.SecuritySafeCriticalAttribute"
diff --git a/src/vm/clrprivbinderwinrt.cpp b/src/vm/clrprivbinderwinrt.cpp
index b4fb45c083..5da5ed2967 100644
--- a/src/vm/clrprivbinderwinrt.cpp
+++ b/src/vm/clrprivbinderwinrt.cpp
@@ -11,9 +11,6 @@
#include "common.h" // precompiled header
-#ifndef FEATURE_CORECLR
-#include "assemblyusagelogmanager.h"
-#endif
#include "clr/fs/file.h"
#include "clrprivbinderwinrt.h"
#include "clrprivbinderutil.h"
@@ -33,14 +30,12 @@
#endif
#include <TypeResolution.h>
#include "delayloadhelpers.h"
-#ifdef FEATURE_CORECLR
#include "../binder/inc/applicationcontext.hpp"
#include "../binder/inc/assemblybinder.hpp"
#include "../binder/inc/assembly.hpp"
#include "../binder/inc/debuglog.hpp"
#include "../binder/inc/utils.hpp"
#include "../binder/inc/fusionassemblyname.hpp"
-#endif
#ifdef CROSSGEN_COMPILE
#include "crossgenroresolvenamespace.h"
@@ -138,10 +133,8 @@ CLRPrivBinderWinRT::CLRPrivBinderWinRT(
, m_fCanUseNativeImages(fCanUseNativeImages)
#endif
, m_fNamespaceResolutionKind(fNamespaceResolutionKind)
-#ifdef FEATURE_CORECLR
, m_pApplicationContext(nullptr)
, m_appLocalWinMDPath(nullptr)
-#endif
#ifdef FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
, m_fCanSetLocalWinMDPath(TRUE)
#endif // FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
@@ -177,34 +170,6 @@ CLRPrivBinderWinRT::CLRPrivBinderWinRT(
m_rgAltPaths.GetRawArray() + iAltPath));
}
}
-#if defined(FEATURE_APPX) && !defined(FEATURE_CORECLR)
- else if (AppX::IsAppXNGen())
- {
- // If this is an NGen worker process for AppX, then the process doesn't actually run in the package,
- // and RoResolveNamespace won't work without some help. AppX::GetCurrentPackageInfo can give us the
- // package graph, which we can pass to RoResolveNamespace to make it work properly.
- UINT32 cbBuffer = 0;
- UINT32 nCount = 0;
- HRESULT hr = AppX::GetCurrentPackageInfo(PACKAGE_FILTER_CLR_DEFAULT, &cbBuffer, nullptr, nullptr);
- if (hr != HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
- ThrowHR(hr);
-
- NewArrayHolder<BYTE> pbBuffer(new (nothrow) BYTE[cbBuffer]);
- IfNullThrow(pbBuffer);
- IfFailThrow(AppX::GetCurrentPackageInfo(PACKAGE_FILTER_CLR_DEFAULT, &cbBuffer, pbBuffer, &nCount));
-
- m_rgAltPaths.Allocate(nCount);
-
- PCPACKAGE_INFO pPackageInfo = reinterpret_cast<PCPACKAGE_INFO>(static_cast<PBYTE>(pbBuffer));
- for (UINT32 iAltPath = 0; iAltPath < nCount; iAltPath++)
- {
- IfFailThrow(WindowsCreateString(
- pPackageInfo[iAltPath].path,
- (UINT32)wcslen(pPackageInfo[iAltPath].path),
- m_rgAltPaths.GetRawArray() + iAltPath));
- }
- }
-#endif //FEATURE_APPX && !FEATURE_CORECLR
#endif //CROSSGEN_COMPILE
#ifdef FEATURE_FUSION
@@ -217,9 +182,6 @@ CLRPrivBinderWinRT::~CLRPrivBinderWinRT()
{
WRAPPER_NO_CONTRACT;
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- AssemblyUsageLogManager::UnRegisterBinderFromUsageLog((UINT_PTR)this);
-#endif
if (m_pTypeCache != nullptr)
{
m_pTypeCache->Release();
@@ -256,15 +218,6 @@ CLRPrivBinderWinRT::GetOrCreateBinder(
{
pBinder.SuppressRelease();
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- // Create and register WinRT usage log
- ReleaseHolder<IAssemblyUsageLog> pNewWinRTUsageLog;
- IfFailThrow(AssemblyUsageLogManager::GetUsageLogForContext(W("WinRT"), W("NotApp"), &pNewWinRTUsageLog));
-
- UINT_PTR winRTBinderId;
- IfFailThrow(pBinder->GetBinderID(&winRTBinderId));
- IfFailThrow(AssemblyUsageLogManager::RegisterBinderWithUsageLog(winRTBinderId, pNewWinRTUsageLog));
-#endif
}
_ASSERTE(s_pSingleton->m_fNamespaceResolutionKind == fNamespaceResolutionKind);
@@ -289,17 +242,10 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
HRESULT hr = S_OK;
ReleaseHolder<CLRPrivAssemblyWinRT> pAssembly;
LPWSTR wszFullTypeName = nullptr;
-#ifndef FEATURE_CORECLR
- NewArrayHolder<WCHAR> wszAssemblySimpleName;
-#endif
#ifndef CROSSGEN_COMPILE
-#ifndef FEATURE_CORECLR
- fusion::logging::StatusScope logStatus(0, ID_FUSLOG_BINDING_STATUS_WINRT, &hr);
-#else
BINDER_SPACE::BINDER_LOG_ENTER(W("CLRPrivBinderWinRT_CoreCLR::BindWinRTAssemblyByName"));
#endif
-#endif
VALIDATE_ARG_RET(pAssemblyName != nullptr);
VALIDATE_ARG_RET(ppAssembly != nullptr);
@@ -316,15 +262,11 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
IfFailGo(COR_E_PLATFORMNOTSUPPORTED);
}
-#ifndef FEATURE_CORECLR
- IfFailGo(fusion::util::GetProperty(pAssemblyName, ASM_NAME_NAME, &wszAssemblySimpleName));
-#else
WCHAR wszAssemblySimpleName[_MAX_PATH];
{
DWORD cchAssemblySimpleName = _MAX_PATH;
IfFailGo(pAssemblyName->GetName(&cchAssemblySimpleName, wszAssemblySimpleName));
}
-#endif
wszFullTypeName = wcschr(wszAssemblySimpleName, W('!'));
@@ -445,49 +387,7 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
pNewAssembly.SuppressRelease();
}
-#ifndef FEATURE_CORECLR
- if (fPreBind)
- {
- // We are pre-binding to this WinMD and do not want to open it
- // Compare the filename to the assembly simple name. This is legal to do with WinRT because at NGen time
- // we embed a WinRT dependency as assembly def name component plus a namespace and type from it.
- // At bind time, this type should still exist in the same assembly. If it doesn't, and has been moved,
- // the native image validation will fail anyway and we'll fall back to IL. This is because if the type has
- // been moved to another WinMD, it must have been removed from the first one because WinRT allows no duplicates.
- // See comment on CLRPrivBinderWinRT::PreBind for further details.
- if (!_wcsicmp(wszAssemblySimpleName, wszFileNameStripped))
- {
- *ppAssembly = pAssembly.Extract();
- return (hr = S_OK);
- }
- else
- {
- continue;
- }
- }
-#endif
- }
-#ifndef FEATURE_CORECLR
- else if (fPreBind)
- {
- // We are pre-binding to this WinMD and do not want to force it to be loaded into the runtime yet.
- // Compare the filename to the assembly simple name. This is legal to do with WinRT because at NGen time
- // we embed a WinRT dependency as assembly def name component plus a namespace and type from it.
- // At bind time, this type should still exist in the same assembly. If it doesn't, and has been moved,
- // the native image validation will fail anyway and we'll fall back to IL. This is because if the type has
- // been moved to another WinMD, it must have been removed from the first one because WinRT allows no duplicates.
- // See comment on CLRPrivBinderWinRT::PreBind for further details.
- if (!_wcsicmp(wszAssemblySimpleName, wszFileNameStripped))
- {
- *ppAssembly = pAssembly.Extract();
- return (hr = S_OK);
- }
- else
- {
- continue;
- }
}
-#endif
//
// Look to see if there's a native image available.
@@ -499,12 +399,8 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
if (hr == S_OK)
{ // The type we are looking for has been found in this assembly
#ifndef CROSSGEN_COMPILE
-#ifndef FEATURE_CORECLR
- fusion::logging::LogMessage(0, ID_FUSLOG_BINDING_STATUS_FOUND, wszFileName);
-#else
BINDER_SPACE::BINDER_LOG_LEAVE_HR(W("CLRPrivBinderWinRT_CoreCLR::BindWinRTAssemblyByName"), hr);
#endif
-#endif
*ppAssembly = pAssembly.Extract();
return (hr = S_OK);
}
@@ -516,9 +412,7 @@ HRESULT CLRPrivBinderWinRT::BindWinRTAssemblyByName(
hr = CLR_E_BIND_TYPE_NOT_FOUND;
ErrExit:
-#ifdef FEATURE_CORECLR
BINDER_SPACE::BINDER_LOG_LEAVE_HR(W("CLRPrivBinderWinRT_CoreCLR::BindWinRTAssemblyByName"), hr);
-#endif
return hr;
} // CLRPrivBinderWinRT::BindWinRTAssemblyByName
@@ -659,7 +553,6 @@ HRESULT CLRPrivBinderWinRT::GetAssemblyAndTryFindNativeImage(SString &sWinmdFile
{
HRESULT hr = S_OK;
-#ifdef FEATURE_CORECLR
if (!m_pApplicationContext->IsTpaListProvided())
return COR_E_FILENOTFOUND;
@@ -732,24 +625,11 @@ HRESULT CLRPrivBinderWinRT::GetAssemblyAndTryFindNativeImage(SString &sWinmdFile
FALSE, /* fIsInGAC */
FALSE /* fExplicitBindToNativeImage */,
ppAssembly);
-#else
- ReleaseHolder<BINDER_SPACE::Assembly> pAssembly;
-
- // This codepath is used for desktop crossgen
- pAssembly = new BINDER_SPACE::Assembly();
-
- pAssembly->SetPEImage(PEImage::OpenImage(sWinmdFilename, MDInternalImport_Default));
-
- pAssembly->m_assemblyPath.Set(sWinmdFilename);
-
- *ppAssembly = pAssembly.Extract();
-#endif
return hr;
}
#endif // !FEATURE_FUSION
-#ifdef FEATURE_CORECLR
//=====================================================================================================================
HRESULT CLRPrivBinderWinRT::SetApplicationContext(BINDER_SPACE::ApplicationContext *pApplicationContext, SString &appLocalWinMD)
{
@@ -784,7 +664,6 @@ HRESULT CLRPrivBinderWinRT::SetApplicationContext(BINDER_SPACE::ApplicationConte
return hr;
}
-#endif //FEATURE_CORECLR
//=====================================================================================================================
// Implements interface method code:ICLRPrivBinder::BindAssemblyByName.
@@ -950,20 +829,7 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace(
LPWSTR wszWinMDPath = nullptr;
UINT32 cchWinMDPath = 0;
-#ifdef FEATURE_CORECLR
wszWinMDPath = m_appLocalWinMDPath;
-#else
- if (AppX::IsAdaptiveApp())
- {
- IfFailRet(AppX::GetWinMetadataDirForAdaptiveApps(&wszWinMDPath));
- }
-
- else if (AppX::IsAppXDesignMode() || IsNgenOffline())
- {
- wszWinMDPathConfig = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_WinMDPath);
- wszWinMDPath = wszWinMDPathConfig;
- }
-#endif // FEATURE_CORECLR
if (wszWinMDPath != nullptr)
{
@@ -981,7 +847,6 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace(
&rgFileNames,
nullptr, // pcDirectNamespaceChildren
nullptr); // rgDirectNamespaceChildren
-#ifdef FEATURE_CORECLR
// For CoreCLR, if the process is not AppX, deliver more appropriate error message
// when trying to bind to 3rd party WinMDs that is not confusing.
if (HRESULT_FROM_WIN32(APPMODEL_ERROR_NO_PACKAGE) == hr)
@@ -991,7 +856,6 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace(
IfFailRet(HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED));
}
}
-#endif
#ifdef FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
// If we failed to find the requested name, but we have an application local probing path setup, then
@@ -1059,33 +923,6 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace(
&cchFileName);
BOOL fSkipFilename = FALSE;
-#ifndef FEATURE_CORECLR
- // If we have a specified path list. Be certain to only find filenames in that list.
- // NGen for AppX is an exception, where the path list contains the package graph, and we can
- // accept files found elsewhere (e.g., in the Windows WinMD directory).
- // On CoreCLR, we have no concept of an AppX package, so we want the passed in app
- // paths to additively contribute to the set of WinMDs the API can find.
- if (m_rgAltPaths.GetCount() > 0 && !AppX::IsAppXNGen())
- {
- fSkipFilename = TRUE;
- for (DWORD iAltPath = 0; iAltPath < m_rgAltPaths.GetCount(); iAltPath++)
- {
- UINT32 cchAltPath = 0;
- LPCWSTR wszAltPath = WindowsGetStringRawBuffer(
- m_rgAltPaths.GetAt(iAltPath),
- &cchAltPath);
-
- if (cchAltPath >= cchFileName)
- continue;
-
- if (wcsncmp(wszAltPath, wszFileName, cchAltPath) == 0)
- {
- fSkipFilename = FALSE;
- break;
- }
- }
- }
-#endif
if (!fSkipFilename)
hFileNameList.InsertTail(wszFileName);
}
@@ -1573,7 +1410,6 @@ HRESULT CLRPrivBinderWinRT::GetBinderID(
return S_OK;
}
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
//=====================================================================================================================
HRESULT CLRPrivBinderWinRT::FindWinRTAssemblyBySpec(
LPVOID pvAppDomain,
@@ -1584,7 +1420,6 @@ HRESULT CLRPrivBinderWinRT::FindWinRTAssemblyBySpec(
STATIC_CONTRACT_WRAPPER;
return E_FAIL;
}
-#endif
#ifdef FEATURE_FUSION
//=====================================================================================================================
diff --git a/src/vm/clrprivbinderwinrt.h b/src/vm/clrprivbinderwinrt.h
index caaefff6d2..34f8ef7a09 100644
--- a/src/vm/clrprivbinderwinrt.h
+++ b/src/vm/clrprivbinderwinrt.h
@@ -32,10 +32,8 @@ typedef CoreBindResult IBindResult;
// Forward declarations
class CLRPrivBinderWinRT;
class CLRPrivAssemblyWinRT;
-#ifdef FEATURE_CORECLR
class BINDER_SPACE::ApplicationContext;
class BINDER_SPACE::Assembly;
-#endif
typedef DPTR(CLRPrivBinderWinRT) PTR_CLRPrivBinderWinRT;
typedef DPTR(CLRPrivAssemblyWinRT) PTR_CLRPrivAssemblyWinRT;
@@ -242,12 +240,10 @@ public:
#ifndef FEATURE_FUSION
HRESULT GetAssemblyAndTryFindNativeImage(SString &sWinmdFilename, LPCWSTR pwzSimpleName, BINDER_SPACE::Assembly ** ppAssembly);
#endif
-#ifdef FEATURE_CORECLR
// On Phone the application's APP_PATH CoreCLR hosting config property is used as the app
// package graph for RoResolveNamespace to find 3rd party WinMDs. This method wires up
// the app paths so the WinRT binder will find 3rd party WinMDs.
HRESULT SetApplicationContext(BINDER_SPACE::ApplicationContext *pApplicationContext, SString &appLocalWinMD);
-#endif
// Finds assembly with WinRT type if it is already loaded
// Note: This method could implement interface code:ICLRPrivWinRtTypeBinder if it is ever needed
PTR_Assembly FindAssemblyForTypeIfLoaded(
@@ -331,10 +327,8 @@ private:
HRESULT GetParentIBindContext(IBindContext **ppIBindContext);
#endif //FEATURE_FUSION
-#ifdef FEATURE_CORECLR
BINDER_SPACE::ApplicationContext * m_pApplicationContext;
NewArrayHolder<WCHAR> m_appLocalWinMDPath;
-#endif
#ifdef FEATURE_COMINTEROP_WINRT_DESKTOP_HOST
// App-local location that can be probed for WinMD files
diff --git a/src/vm/clsload.cpp b/src/vm/clsload.cpp
index fd7644ce98..5e136fb6a9 100644
--- a/src/vm/clsload.cpp
+++ b/src/vm/clsload.cpp
@@ -4620,24 +4620,7 @@ VOID ClassLoader::AddAvailableClassHaveLock(
// However, this used to be allowed in 1.0/1.1, and some third-party DLLs have
// been obfuscated so that they have duplicate private typedefs.
// We must allow this for old assemblies for app compat reasons
-#ifdef FEATURE_CORECLR
pModule->GetAssembly()->ThrowBadImageException(pszNameSpace, pszName, BFA_MULT_TYPE_SAME_NAME);
-#else
- LPCSTR pszVersion = NULL;
- if (FAILED(pModule->GetMDImport()->GetVersionString(&pszVersion)))
- {
- pModule->GetAssembly()->ThrowBadImageException(pszNameSpace, pszName, BFA_MULT_TYPE_SAME_NAME);
- }
-
- SString ssVersion(SString::Utf8, pszVersion);
- SString ssV1(SString::Literal, "v1.");
-
- AdjustImageRuntimeVersion(&ssVersion);
-
- // If not "v1.*", throw an exception
- if (!ssVersion.BeginsWith(ssV1))
- pModule->GetAssembly()->ThrowBadImageException(pszNameSpace, pszName, BFA_MULT_TYPE_SAME_NAME);
-#endif
}
}
else {
@@ -4914,41 +4897,6 @@ bool StaticAccessCheckContext::IsCallerCritical()
}
-#ifndef FEATURE_CORECLR
-
-//******************************************************************************
-// This function determines whether a Type is accessible from
-// outside of the assembly it lives in.
-
-static BOOL IsTypeVisibleOutsideAssembly(MethodTable* pMT)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
- DWORD dwProtection;
- // check all types in nesting chain, while inner types are public
- while (IsTdPublic(dwProtection = pMT->GetClass()->GetProtection()) ||
- IsTdNestedPublic(dwProtection))
- {
- // if type is nested, check outer type, too
- if (IsTdNested(dwProtection))
- {
- pMT = GetEnclosingMethodTable(pMT);
- }
- // otherwise, type is visible outside of the assembly
- else
- {
- return TRUE;
- }
- }
- return FALSE;
-} // static BOOL IsTypeVisibleOutsideAssembly(MethodTable* pMT)
-
-#endif //!FEATURE_CORECLR
//******************************************************************************
@@ -5031,7 +4979,6 @@ BOOL AccessCheckOptions::DemandMemberAccess(AccessCheckContext *pContext, Method
BOOL canAccessTarget = FALSE;
#ifndef CROSSGEN_COMPILE
-#ifdef FEATURE_CORECLR
BOOL fAccessingFrameworkCode = FALSE;
@@ -5079,102 +5026,6 @@ BOOL AccessCheckOptions::DemandMemberAccess(AccessCheckContext *pContext, Method
ThrowAccessException(pContext, pTargetMT, NULL, fAccessingFrameworkCode);
}
-#else // FEATURE_CORECLR
-
- GCX_COOP();
-
- // Overriding the rules of visibility checks in Win8 immersive: no access is allowed to internal
- // code in the framework even in full trust, unless the caller is also framework code.
- if ( (m_accessCheckType == kUserCodeOnlyRestrictedMemberAccess ||
- m_accessCheckType == kUserCodeOnlyRestrictedMemberAccessNoTransparency) &&
- visibilityCheck )
- {
- IAssemblyName *pIAssemblyName = pTargetMT->GetAssembly()->GetFusionAssemblyName();
-
- HRESULT hr = Fusion::Util::IsAnyFrameworkAssembly(pIAssemblyName);
-
- // S_OK: pIAssemblyName is a framework assembly.
- // S_FALSE: pIAssemblyName is not a framework assembly.
- // Other values: pIAssemblyName is an invalid name.
- if (hr == S_OK)
- {
- if (pContext->IsCalledFromInterop())
- return TRUE;
-
- // If the caller method is NULL and we are not called from interop
- // this is not a normal method access check (e.g. a CA accessibility check)
- // The access check should fail in this case.
- hr = S_FALSE;
-
- MethodDesc* pCallerMD = pContext->GetCallerMethod();
- if (pCallerMD != NULL)
- {
- pIAssemblyName = pCallerMD->GetAssembly()->GetFusionAssemblyName();
- hr = Fusion::Util::IsAnyFrameworkAssembly(pIAssemblyName);
- }
-
- // The caller is not framework code.
- if (hr != S_OK)
- {
- if (m_fThrowIfTargetIsInaccessible)
- ThrowAccessException(pContext, pTargetMT, NULL, TRUE);
- else
- return FALSE;
- }
- }
- }
-
- EX_TRY
- {
- if (m_accessCheckType == kMemberAccess)
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, REFLECTION_MEMBER_ACCESS);
- }
- else
- {
- _ASSERTE(m_accessCheckType == kRestrictedMemberAccess ||
- m_accessCheckType == kUserCodeOnlyRestrictedMemberAccess ||
- (m_accessCheckType == kUserCodeOnlyRestrictedMemberAccessNoTransparency && visibilityCheck));
-
- // JIT guarantees that pTargetMT has been fully loaded and ready to execute by this point, but reflection doesn't.
- // So GetSecurityDescriptor could AV because the DomainAssembly cannot be found.
- // For now we avoid this by calling EnsureActive aggressively. We might want to move this to the reflection code in the future:
- // ReflectionInvocation::PerformVisibilityCheck, PerformSecurityCheckHelper, COMDelegate::BindToMethodName/Info, etc.
- // We don't need to call EnsureInstanceActive because we will be doing access check on all the generic arguments any way so
- // EnsureActive will be called on everyone of them if needed.
- pTargetMT->EnsureActive();
-
- IAssemblySecurityDescriptor * pTargetSecurityDescriptor = pTargetMT->GetModule()->GetSecurityDescriptor();
- _ASSERTE(pTargetSecurityDescriptor != NULL);
-
- if (m_pAccessContext != NULL)
- {
- // If we have a context, use it to do the demand
- Security::ReflectionTargetDemand(REFLECTION_MEMBER_ACCESS,
- pTargetSecurityDescriptor,
- m_pAccessContext);
- }
- else
- {
- // Just do a normal Demand
- Security::ReflectionTargetDemand(REFLECTION_MEMBER_ACCESS, pTargetSecurityDescriptor);
- }
- }
-
- canAccessTarget = TRUE;
- }
- EX_CATCH
- {
- canAccessTarget = FALSE;
-
- if (m_fThrowIfTargetIsInaccessible)
- {
- ThrowAccessException(pContext, pTargetMT, GET_EXCEPTION());
- }
- }
- EX_END_CATCH(RethrowTerminalExceptions);
-
-#endif // FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
return canAccessTarget;
@@ -5335,39 +5186,6 @@ void GetAccessExceptionAdditionalContextForSecurity(Assembly *pAccessingAssembly
pContextInformation->Append(accessingFrameworkCodeError);
}
-#ifndef FEATURE_CORECLR
- if (isTransparencyError)
- {
- ModuleSecurityDescriptor *pMSD = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pAccessingAssembly);
-
- // If the accessing assembly is APTCA and using level 2 transparency, then transparency errors may be
- // because APTCA newly opts assemblies into being all transparent.
- if (pMSD->IsMixedTransparency() && !pAccessingAssembly->GetSecurityTransparencyBehavior()->DoesUnsignedImplyAPTCA())
- {
- SString callerDisplayName;
- pAccessingAssembly->GetDisplayName(callerDisplayName);
-
- SString level2AptcaTransparencyError;
- EEException::GetResourceMessage(IDS_ACCESS_EXCEPTION_CONTEXT_LEVEL2_APTCA, level2AptcaTransparencyError, callerDisplayName);
-
- pContextInformation->Append(level2AptcaTransparencyError);
- }
-
- // If the assessing assembly is fully transparent and it is partially trusted, then transparency
- // errors may be because the CLR forced the assembly to be transparent due to its trust level.
- if (pMSD->IsAllTransparentDueToPartialTrust())
- {
- _ASSERTE(pMSD->IsAllTransparent());
- SString callerDisplayName;
- pAccessingAssembly->GetDisplayName(callerDisplayName);
-
- SString partialTrustTransparencyError;
- EEException::GetResourceMessage(IDS_ACCESS_EXCEPTION_CONTEXT_PT_TRANSPARENT, partialTrustTransparencyError, callerDisplayName);
-
- pContextInformation->Append(partialTrustTransparencyError);
- }
- }
-#endif // FEATURE_CORECLR
}
@@ -5675,18 +5493,6 @@ static BOOL CheckTransparentAccessToCriticalCode(
(pOptionalTargetField ? 1 : 0) +
(pOptionalTargetType ? 1 : 0)));
-#ifndef FEATURE_CORECLR
- if (pTargetMT->GetAssembly()->GetSecurityTransparencyBehavior()->DoesPublicImplyTreatAsSafe())
- {
- // @ telesto: public => TAS in non-coreclr only. The intent is to remove this ifdef and remove
- // public => TAS in all flavors/branches.
- // check if the Target member accessible outside the assembly
- if (IsMdPublic(dwMemberAccess) && IsTypeVisibleOutsideAssembly(pTargetMT))
- {
- return TRUE;
- }
- }
-#endif // !FEATURE_CORECLR
// if the caller [Method] is transparent, do special security checks
// check if security disallows access to target member
diff --git a/src/vm/clsload.hpp b/src/vm/clsload.hpp
index a3a0de3cf4..2ee6524a7b 100644
--- a/src/vm/clsload.hpp
+++ b/src/vm/clsload.hpp
@@ -408,19 +408,6 @@ public:
// CoreCLR: Do RestrictedMemberAcess visibility checks but bypass transparency checks.
kRestrictedMemberAccessNoTransparency,
-#ifndef FEATURE_CORECLR
- // Used by DynamicMethod with kRestrictedMemberAccess in Win8 immersive mode.
- // Desktop: Equals kNormalAccessibilityChecks for non-framework code calling framework code,
- // kRestrictedMemberAccess otherwise.
- kUserCodeOnlyRestrictedMemberAccess,
-
- // A variation of kUserCodeOnlyRestrictedMemberAccess, but without transparency checks.
- // This is used for reflection invocation in Win8 immersive when all domains on the call stack is full trust.
- // This is an optimization to avoid stackwalks for transparency checks in full trust.
- // Note that both kUserCodeOnlyRestrictedMemberAccess and kUserCodeOnlyRestrictedMemberAccessNoTransparency
- // are needed because we restrict user code from accessing framework internals in Win8 immersive even in full trust.
- kUserCodeOnlyRestrictedMemberAccessNoTransparency
-#endif
};
AccessCheckOptions(
@@ -472,11 +459,7 @@ public:
BOOL TransparencyCheckNeeded() const
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return (m_accessCheckType != kNormalAccessNoTransparency && m_accessCheckType != kRestrictedMemberAccessNoTransparency);
-#else //FEATURE_CORECLR
- return (m_accessCheckType != kUserCodeOnlyRestrictedMemberAccessNoTransparency);
-#endif //FEATURE_CORECLR
}
static AccessCheckOptions* s_pNormalAccessChecks;
diff --git a/src/vm/clsload.inl b/src/vm/clsload.inl
index a362d5a3db..991498ec9c 100644
--- a/src/vm/clsload.inl
+++ b/src/vm/clsload.inl
@@ -80,14 +80,8 @@ inline void AccessCheckOptions::Initialize(
!throwIfTargetIsInaccessible ||
((pTargetMT ? 1 : 0) + (pTargetMethod ? 1 : 0) + (pTargetField ? 1 : 0)) == 1);
// m_pAccessContext can only be set for kRestrictedMemberAccess
-#ifdef FEATURE_CORECLR
PRECONDITION(m_pAccessContext == NULL ||
accessCheckType == AccessCheckOptions::kRestrictedMemberAccess);
-#else
- PRECONDITION(m_pAccessContext == NULL ||
- accessCheckType == AccessCheckOptions::kUserCodeOnlyRestrictedMemberAccess ||
- accessCheckType == AccessCheckOptions::kRestrictedMemberAccess);
-#endif
}
CONTRACTL_END;
diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp
index 8fc851d86b..0ae75ecaa6 100644
--- a/src/vm/codeman.cpp
+++ b/src/vm/codeman.cpp
@@ -31,9 +31,7 @@
#include "debuginfostore.h"
#include "strsafe.h"
-#ifdef FEATURE_CORECLR
#include "configuration.h"
-#endif
#ifdef _WIN64
#define CHECK_DUPLICATED_STRUCT_LAYOUTS
@@ -1397,7 +1395,7 @@ struct JIT_LOAD_DATA
// Here's the global data for JIT load and initialization state.
JIT_LOAD_DATA g_JitLoadData;
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
// Global that holds the path to custom JIT location
extern "C" LPCWSTR g_CLRJITPath = nullptr;
@@ -1439,7 +1437,6 @@ static void LoadAndInitializeJIT(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT I
HRESULT hr = E_FAIL;
-#ifdef FEATURE_CORECLR
PathString CoreClrFolderHolder;
extern HINSTANCE g_hThisInst;
bool havePath = false;
@@ -1482,9 +1479,6 @@ static void LoadAndInitializeJIT(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT I
}
}
-#else
- hr = g_pCLRRuntime->LoadLibrary(pwzJitName, phJit);
-#endif
if (SUCCEEDED(hr))
{
@@ -1493,25 +1487,9 @@ static void LoadAndInitializeJIT(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT I
EX_TRY
{
bool fContinueToLoadJIT = false;
-#if !defined(FEATURE_CORECLR)
- typedef void (__stdcall* psxsJitStartup) (CoreClrCallbacks const &);
- psxsJitStartup sxsJitStartupFn = (psxsJitStartup) GetProcAddress(*phJit, "sxsJitStartup");
-
- if (sxsJitStartupFn)
- {
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_GET_SXSJITSTARTUP;
-
- CoreClrCallbacks cccallbacks = GetClrCallbacks();
- (*sxsJitStartupFn) (cccallbacks);
-
- pJitLoadData->jld_status = JIT_LOAD_STATUS_DONE_CALL_SXSJITSTARTUP;
- fContinueToLoadJIT = true;
- }
-#else // FEATURE_CORECLR
// For CoreCLR, we never use "sxsJitStartup" as that is Desktop utilcode initialization
// specific. Thus, assume we always got
fContinueToLoadJIT = true;
-#endif // !defined(FEATURE_CORECLR)
if (fContinueToLoadJIT)
{
@@ -1644,7 +1622,7 @@ BOOL EEJitManager::LoadJIT()
// Set as a courtesy to code:CorCompileGetRuntimeDll
s_ngenCompilerDll = m_JITCompiler;
-#if (defined(_TARGET_AMD64_) && !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)) || (defined(_TARGET_X86_) && defined(FEATURE_CORECLR))
+#if defined(_TARGET_X86_)
// If COMPlus_UseLegacyJit=1, then we fall back to compatjit.dll.
//
// This fallback mechanism was introduced for Visual Studio "14" Preview, when JIT64 (the legacy JIT) was replaced with
@@ -1670,11 +1648,7 @@ BOOL EEJitManager::LoadJIT()
// Thus, the COMPlus_useLegacyJit=1 mechanism has been enabled for x86 CoreCLR. This scenario does not have the UseRyuJIT
// registry key, nor the AppX binder mode.
-#if defined(FEATURE_CORECLR)
bool fUseRyuJit = true;
-#else
- bool fUseRyuJit = UseRyuJit();
-#endif
if ((!IsCompilationProcess() || !fUseRyuJit) && // Use RyuJIT for all NGEN, unless we're falling back to JIT64 for everything.
(newJitCompiler != nullptr)) // the main JIT must successfully load before we try loading the fallback JIT
@@ -1688,11 +1662,7 @@ BOOL EEJitManager::LoadJIT()
if (!fUsingCompatJit)
{
-#if defined(FEATURE_CORECLR)
DWORD useLegacyJit = Configuration::GetKnobBooleanValue(W("System.JIT.UseWindowsX86CoreLegacyJit"), CLRConfig::EXTERNAL_UseWindowsX86CoreLegacyJit);
-#else
- DWORD useLegacyJit = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_UseLegacyJit); // uncached access, since this code is run no more than one time
-#endif
if (useLegacyJit == 1)
{
fUsingCompatJit = TRUE;
@@ -4404,7 +4374,6 @@ LPCWSTR ExecutionManager::GetJitName()
LPCWSTR pwzJitName = NULL;
-#if defined(FEATURE_CORECLR)
#if !defined(CROSSGEN_COMPILE)
if (g_CLRJITPath != nullptr)
{
@@ -4419,10 +4388,6 @@ LPCWSTR ExecutionManager::GetJitName()
}
}
#endif // !defined(CROSSGEN_COMPILE)
-#else // !FEATURE_CORECLR
- // Try to obtain a name for the jit library from the env. variable
- IfFailThrow(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_JitName, const_cast<LPWSTR *>(&pwzJitName)));
-#endif // !FEATURE_CORECLR
if (NULL == pwzJitName)
{
diff --git a/src/vm/comcallablewrapper.cpp b/src/vm/comcallablewrapper.cpp
index 17f0fb60aa..91e9afcda3 100644
--- a/src/vm/comcallablewrapper.cpp
+++ b/src/vm/comcallablewrapper.cpp
@@ -1774,12 +1774,10 @@ IUnknown* SimpleComCallWrapper::QIStandardInterface(Enum_StdInterfaces index)
else if (index == enum_IDispatchEx)
{
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
RETURN NULL;
}
-#endif // FEATURE_CORECLR
if (SupportsIReflect(m_pMT))
{
@@ -1988,9 +1986,6 @@ IUnknown* SimpleComCallWrapper::QIStandardInterface(REFIID riid)
// Keeping the Apollo behaviour also ensures that we allow SL 8.1 scenarios (which do not pass the AppX flag like the modern host)
// to use CorDispatcher for async, in the expected manner, as the OS implementation for CoreDispatcher expects objects to be Agile.
if (!IsAggregated()
-#if !defined(FEATURE_CORECLR)
- && AppX::IsAppXProcess()
-#endif // !defined(FEATURE_CORECLR)
)
{
ComCallWrapperTemplate *pTemplate = GetComCallWrapperTemplate();
@@ -3614,12 +3609,10 @@ IUnknown* ComCallWrapper::GetComIPFromCCW(ComCallWrapper *pWrap, REFIID riid, Me
}
if (IsIDispatch(riid))
{
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
RETURN NULL;
}
-#endif // FEATURE_CORECLR
// We don't do visibility checks on IUnknown.
RETURN pWrap->GetIDispatchIP();
@@ -4735,11 +4728,6 @@ BOOL ComMethodTable::LayOutInterfaceMethodTable(MethodTable* pClsMT)
SLOT *pComVtable;
unsigned i;
-#ifndef FEATURE_CORECLR
- // Skip this unnecessary expensive check for CoreCLR
- if (!CheckSigTypesCanBeLoaded(pItfClass))
- return FALSE;
-#endif
LOG((LF_INTEROP, LL_INFO1000, "LayOutInterfaceMethodTable: %s, this: %p\n", pItfClass->GetDebugClassName(), this));
diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp
index 4c85a0216e..ae65afcde0 100644
--- a/src/vm/comdelegate.cpp
+++ b/src/vm/comdelegate.cpp
@@ -1098,7 +1098,6 @@ void COMDelegate::BindToMethod(DELEGATEREF *pRefThis,
GCPROTECT_END();
}
-#ifdef FEATURE_CORECLR
// On the CoreCLR, we don't allow non-fulltrust delegates to be marshaled out (or created: CorHost::CreateDelegate ensures that)
// This helper function checks if we have a full-trust delegate with AllowReversePInvokeCallsAttribute targets.
BOOL COMDelegate::IsFullTrustDelegate(DELEGATEREF pDelegate)
@@ -1218,7 +1217,6 @@ BOOL COMDelegate::IsMethodAllowedToSinkReversePInvoke(MethodDesc *pMD)
NULL));
#endif // FEATURE_WINDOWSPHONE
}
-#endif // FEATURE_CORECLR
// Marshals a managed method to an unmanaged callback provided the
// managed method is static and it's parameters require no marshalling.
@@ -1312,7 +1310,6 @@ LPVOID COMDelegate::ConvertToCallback(OBJECTREF pDelegateObj)
MethodTable* pMT = pDelegate->GetMethodTable();
DelegateEEClass* pClass = (DelegateEEClass*)(pMT->GetClass());
-#ifdef FEATURE_CORECLR
// On the CoreCLR, we only allow marshaling out delegates that we can guarantee are full-trust delegates
if (!IsFullTrustDelegate(pDelegate))
{
@@ -1320,7 +1317,6 @@ LPVOID COMDelegate::ConvertToCallback(OBJECTREF pDelegateObj)
TypeString::AppendType(strDelegateType, pMT, TypeString::FormatNamespace | TypeString::FormatAngleBrackets| TypeString::FormatSignature);
COMPlusThrow(kSecurityException, IDS_E_DELEGATE_FULLTRUST_ARPIC_1, strDelegateType.GetUnicode());
}
-#endif
if (pMT->HasInstantiation())
COMPlusThrowArgumentException(W("delegate"), W("Argument_NeedNonGenericType"));
@@ -1502,13 +1498,11 @@ OBJECTREF COMDelegate::ConvertToDelegate(LPVOID pCallback, MethodTable* pMT)
if (pUMEntryThunk->GetDomainId() != GetAppDomain()->GetId())
COMPlusThrow(kNotSupportedException, W("NotSupported_DelegateMarshalToWrongDomain"));
-#ifdef FEATURE_CORECLR
// On the CoreCLR, we only allow marshaling out delegates that we can guarantee are full-trust delegates
if (!IsFullTrustDelegate((DELEGATEREF)pDelegate))
{
COMPlusThrow(kSecurityException, IDS_E_DELEGATE_FULLTRUST_ARPIC_2);
}
-#endif
GCPROTECT_END();
return pDelegate;
@@ -1590,13 +1584,6 @@ OBJECTREF COMDelegate::ConvertToDelegate(LPVOID pCallback, MethodTable* pMT)
MethodDesc *pStubMD = pClass->m_pForwardStubMD;
_ASSERTE(pStubMD != NULL && pStubMD->IsILStub());
-#ifndef FEATURE_CORECLR
- if (pStubMD->AsDynamicMethodDesc()->HasCopyCtorArgs())
- {
- // static stub that gets its arguments in a thread-static field
- pInterceptStub = NDirect::GetStubForCopyCtor();
- }
-#endif // !FEATURE_CORECLR
#ifdef MDA_SUPPORTED
if (MDA_GET_ASSISTANT(PInvokeStackImbalance))
@@ -1630,13 +1617,11 @@ OBJECTREF COMDelegate::ConvertToDelegate(LPVOID pCallback, MethodTable* pMT)
GCPROTECT_END();
#endif // defined(_TARGET_X86_)
-#ifdef FEATURE_CORECLR
// On the CoreCLR, we only allow marshaling out delegates that we can guarantee are full-trust delegates
if (!IsFullTrustDelegate(delObj))
{
COMPlusThrow(kSecurityException, IDS_E_DELEGATE_FULLTRUST_ARPIC_2);
}
-#endif
return delObj;
}
@@ -2182,17 +2167,6 @@ void COMDelegate::DoUnmanagedCodeAccessCheck(MethodDesc* pMeth)
{
// Check whether this is actually a SuppressUnmanagedCodePermission attribute and
// if so, don't do a demand
-#ifndef FEATURE_CORECLR
- MethodTable* pMTMeth = pMeth->GetMethodTable();
- if (pMTMeth->GetMDImport()->GetCustomAttributeByName(pMeth->GetMethodTable()->GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK ||
- pMTMeth->GetMDImport()->GetCustomAttributeByName(pMeth->GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK)
-#endif
{
return;
}
@@ -3800,7 +3774,6 @@ BOOL COMDelegate::ValidateSecurityTransparency(MethodDesc *pFtn, MethodTable *pd
{
WRAPPER_NO_CONTRACT;
-#ifdef FEATURE_CORECLR
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
return TRUE;
@@ -3811,9 +3784,6 @@ BOOL COMDelegate::ValidateSecurityTransparency(MethodDesc *pFtn, MethodTable *pd
// 1. the delegate is critical and the target method is critical, or
// 2. the delegate is transparent/safecritical and the target method is transparent/safecritical
return (fCriticalDelegate == fCriticalTarget);
-#else
- return TRUE;
-#endif // !FEATURE_CORECLR
}
diff --git a/src/vm/comdelegate.h b/src/vm/comdelegate.h
index a562f88392..c8ebf377ba 100644
--- a/src/vm/comdelegate.h
+++ b/src/vm/comdelegate.h
@@ -131,14 +131,10 @@ public:
static BOOL IsTrueMulticastDelegate(OBJECTREF delegate);
-#ifdef FEATURE_CORECLR
static BOOL IsMethodAllowedToSinkReversePInvoke(MethodDesc *pMD);
-#endif
private:
-#ifdef FEATURE_CORECLR
static BOOL IsFullTrustDelegate(DELEGATEREF pDelegate);
-#endif
static Stub* SetupShuffleThunk(MethodTable * pDelMT, MethodDesc *pTargetMeth);
public:
diff --git a/src/vm/comdynamic.cpp b/src/vm/comdynamic.cpp
index 835b5cab3b..97e408ac32 100644
--- a/src/vm/comdynamic.cpp
+++ b/src/vm/comdynamic.cpp
@@ -714,33 +714,6 @@ INT32 QCALLTYPE COMDynamicWrite::SetParamInfo(QCall::ModuleHandle pModule, UINT3
return (INT32)retVal;
}
-#ifndef FEATURE_CORECLR
-/*============================CWSetMarshal============================
-**Action: Helper to set marshal information
-**Returns:
-**Arguments:
-**Exceptions:
-==============================================================================*/
-void QCALLTYPE COMDynamicWrite::SetFieldMarshal(QCall::ModuleHandle pModule, UINT32 tk, LPCBYTE pMarshal, INT32 cbMarshal)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- _ASSERTE(pMarshal);
-
- // Define the signature
- IfFailThrow(pRCW->GetEmitter()->SetFieldMarshal(
- tk,
- (PCCOR_SIGNATURE)pMarshal, // marshal blob
- cbMarshal)); // blob length
-
- END_QCALL;
-}
-#endif
/*============================SetConstantValue============================
**Action: Helper to set constant value to field or parameter
@@ -1103,275 +1076,6 @@ void ManagedBitnessFlagsToUnmanagedBitnessFlags(
*pPeFlags |= ICEE_CREATE_MACHINE_ARM|ICEE_CREATE_FILE_PE32;
}
-#ifndef FEATURE_CORECLR
-//=============================PreSavePEFile=====================================*/
-// PreSave the PEFile
-//==============================================================================*/
-void QCALLTYPE COMDynamicWrite::PreSavePEFile(QCall::ModuleHandle pModule, INT32 portableExecutableKind, INT32 imageFileMachine)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter *pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- DWORD peFlags = 0, corhFlags = 0;
- ManagedBitnessFlagsToUnmanagedBitnessFlags(portableExecutableKind, imageFileMachine, &peFlags, &corhFlags);
- IfFailThrow(pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags));
-
- ICeeFileGen *pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- // We should not have the on disk emitter yet
- if (pRCW->GetOnDiskEmitter() != NULL)
- pRCW->SetOnDiskEmitter(NULL);
-
- // Get the dispenser.
- SafeComHolderPreemp<IMetaDataDispenserEx> pDisp;
- IfFailThrow(MetaDataGetDispenser(CLSID_CorMetaDataDispenser, IID_IMetaDataDispenserEx, (void**)&pDisp));
-
- //Get the emitter and the importer
- IMetaDataImport *pImport = pRCW->GetRWImporter();
- IMetaDataEmit *pEmit = pRCW->GetEmitter();
- _ASSERTE((pEmit != NULL ) && (pImport != NULL));
-
- // Set the option on the dispenser turn on duplicate check for TypeDef and moduleRef
- VARIANT varOption;
- V_VT(&varOption) = VT_UI4;
- V_I4(&varOption) = MDDupDefault | MDDupTypeDef | MDDupModuleRef | MDDupExportedType | MDDupAssemblyRef | MDDupFile | MDDupAssembly;
- IfFailThrow(pDisp->SetOption(MetaDataCheckDuplicatesFor, &varOption));
-
- V_VT(&varOption) = VT_UI4;
- V_I4(&varOption) = MDRefToDefNone;
- IfFailThrow(pDisp->SetOption(MetaDataRefToDefCheck, &varOption));
-
- V_VT(&varOption) = VT_UI4;
- V_I4(&varOption) = MergeManifest;
- IfFailThrow(pDisp->SetOption(MetaDataMergerOptions, &varOption));
-
- //Define an empty scope
- SafeComHolderPreemp<IMetaDataEmit> pEmitNew;
- IfFailThrow(pDisp->DefineScope(CLSID_CorMetaDataRuntime, 0, IID_IMetaDataEmit, (IUnknown**)&pEmitNew));
-
- // Token can move upon merge. Get the IMapToken from the CeeFileGen that is created for save
- // and pass it to merge to receive token movement notification.
- // Note that this is not a long term fix. We are relying on the fact that those tokens embedded
- // in PE cannot move after the merge. These tokens are TypeDef, TypeRef, MethodDef, FieldDef, MemberRef,
- // TypeSpec, UserString. If this is no longer true, we can break!
- //
- // Note that we don't need to release pIMapToken because it is not AddRef'ed in the GetIMapTokenIfaceEx.
- //
- IUnknown *pUnknown = NULL;
- IfFailThrow(pCeeFileGen->GetIMapTokenIfaceEx(ceeFile, pEmit, &pUnknown));
-
- SafeComHolderPreemp<IMapToken> pIMapToken;
- IfFailThrow(SafeQueryInterfacePreemp(pUnknown, IID_IMapToken, (IUnknown**) &pIMapToken));
-
- // get the unmanaged writer.
- ISymUnmanagedWriter *pWriter = pModule->GetReflectionModule()->GetISymUnmanagedWriter();
- SafeComHolderPreemp<CSymMapToken> pSymMapToken(new CSymMapToken(pWriter, pIMapToken));
-
- //Merge the old tokens into the new (empty) scope
- //This is a copy.
- IfFailThrow(pEmitNew->Merge(pImport, pSymMapToken, NULL));
- IfFailThrow(pEmitNew->MergeEnd());
-
- // Update the Module name in the new scope.
- CQuickArray<WCHAR> cqModuleName;
- ULONG cchName;
-
- IfFailThrow(pImport->GetScopeProps(0, 0, &cchName, 0));
-
- cqModuleName.ReSizeThrows(cchName);
-
- IfFailThrow(pImport->GetScopeProps(cqModuleName.Ptr(), cchName, &cchName, 0));
- IfFailThrow(pEmitNew->SetModuleProps(cqModuleName.Ptr()));
-
- // cache the pEmitNew to RCW!!
- pRCW->SetOnDiskEmitter(pEmitNew);
-
- END_QCALL;
-} // COMDynamicWrite::PreSavePEFile
-
-//=============================SavePEFile=====================================*/
-// Save the PEFile to disk
-//==============================================================================*/
-void QCALLTYPE COMDynamicWrite::SavePEFile(QCall::ModuleHandle pModule, LPCWSTR wszPeName, UINT32 entryPoint, UINT32 fileKind, BOOL isManifestFile)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- HRESULT hr=S_OK;
- HCORENUM hTypeDefs=0;
- mdTypeDef td;
- ULONG count;
- IMetaDataImport *pImportNew = 0;
- ULONG newMethRVA;
- DWORD metaDataSize;
- BYTE *metaData;
- ULONG metaDataOffset;
- HCEESECTION pILSection;
- ISymUnmanagedWriter *pWriter = NULL;
-
- if (wszPeName==NULL)
- COMPlusThrow(kArgumentNullException, W("ArgumentNull_String"));
- if (wszPeName[0] == '\0')
- COMPlusThrow(kFormatException, W("Format_StringZeroLength"));
-
- Assembly * pAssembly = pModule->GetAssembly();
- _ASSERTE( pAssembly );
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- ICeeFileGen * pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- IMetaDataEmit * pEmitNew = pRCW->GetOnDiskEmitter();
- _ASSERTE(pEmitNew);
-
- //Get the emitter and the importer
-
- if (pAssembly->IsDynamic() && isManifestFile)
- {
- // manifest is stored in this file
-
- // Allocate space for a strong name signature if an originator was supplied
- // (this doesn't strong name the assembly, but it makes it possible to do so
- // as a post processing step).
- if (pAssembly->IsStrongNamed())
- IfFailGo(pAssembly->AllocateStrongNameSignature(pCeeFileGen, ceeFile));
- }
-
- //Set the Output FileName
- IfFailGo( pCeeFileGen->SetOutputFileName(ceeFile, (LPWSTR)wszPeName) );
-
- //Set the Entry Point or throw the dll switch if we're creating a dll.
- if (entryPoint!=0)
- {
- IfFailGo( pCeeFileGen->SetEntryPoint(ceeFile, entryPoint) );
- }
-
- switch (fileKind)
- {
- case Dll:
- {
- IfFailGo( pCeeFileGen->SetDllSwitch(ceeFile, true) );
- break;
- }
- case WindowApplication:
- {
- // window application. Set the SubSystem
- IfFailGo( pCeeFileGen->SetSubsystem(ceeFile, IMAGE_SUBSYSTEM_WINDOWS_GUI, CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION, CEE_IMAGE_SUBSYSTEM_MINOR_VERSION) );
- break;
- }
- case ConsoleApplication:
- {
- // Console application. Set the SubSystem
- IfFailGo( pCeeFileGen->SetSubsystem(ceeFile, IMAGE_SUBSYSTEM_WINDOWS_CUI, CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION, CEE_IMAGE_SUBSYSTEM_MINOR_VERSION) );
- break;
- }
- default:
- {
- _ASSERTE(!"Unknown file kind!");
- break;
- }
- }
-
- IfFailGo( pCeeFileGen->GetIlSection(ceeFile, &pILSection) );
- IfFailGo( pEmitNew->GetSaveSize(cssAccurate, &metaDataSize) );
- IfFailGo( pCeeFileGen->GetSectionBlock(pILSection, metaDataSize, sizeof(DWORD), (void**) &metaData) );
- IfFailGo( pCeeFileGen->GetSectionDataLen(pILSection, &metaDataOffset) );
- metaDataOffset -= metaDataSize;
-
- // get the unmanaged writer.
- pWriter = pModule->GetReflectionModule()->GetISymUnmanagedWriter();
- IfFailGo( EmitDebugInfoBegin(pModule, pCeeFileGen, ceeFile, pILSection, wszPeName, pWriter) );
-
- if (pAssembly->IsDynamic() && pRCW->m_ulResourceSize)
- {
- // There are manifest in this file
-
- IfFailGo( pCeeFileGen->GetMethodRVA(ceeFile, 0, &newMethRVA) );
-
- // Point to manifest resource
- IfFailGo( pCeeFileGen->SetManifestEntry( ceeFile, pRCW->m_ulResourceSize, newMethRVA ) );
- }
-
- IfFailGo( pCeeFileGen->LinkCeeFile(ceeFile) );
-
- // Get the import interface from the new Emit interface.
- IfFailGo( pEmitNew->QueryInterface(IID_IMetaDataImport, (void **)&pImportNew));
-
-
- //Enumerate the TypeDefs and update method RVAs.
- while ((hr = pImportNew->EnumTypeDefs( &hTypeDefs, &td, 1, &count)) == S_OK)
- {
- UpdateMethodRVAs(pEmitNew, pImportNew, pCeeFileGen, ceeFile, td, pModule->GetReflectionModule()->m_sdataSection);
- }
-
- if (hTypeDefs)
- {
- pImportNew->CloseEnum(hTypeDefs);
- }
- hTypeDefs=0;
-
- //Update Global Methods.
- UpdateMethodRVAs(pEmitNew, pImportNew, pCeeFileGen, ceeFile, 0, pModule->GetReflectionModule()->m_sdataSection);
-
-
- //Emit the MetaData
- // IfFailGo( pCeeFileGen->EmitMetaDataEx(ceeFile, pEmitNew));
- IfFailGo( pCeeFileGen->EmitMetaDataAt(ceeFile, pEmitNew, pILSection, metaDataOffset, metaData, metaDataSize) );
-
- // finish the debugging info emitting after the metadata save so that token remap will be caught correctly
- IfFailGo( EmitDebugInfoEnd(pModule, pCeeFileGen, ceeFile, pILSection, wszPeName, pWriter) );
-
- //Generate the CeeFile
- IfFailGo(pCeeFileGen->GenerateCeeFile(ceeFile) );
-
- // Strong name sign the resulting assembly if required.
- if (pAssembly->IsDynamic() && isManifestFile && pAssembly->IsStrongNamed())
- IfFailGo(pAssembly->SignWithStrongName((LPWSTR)wszPeName));
-
-ErrExit:
-
- pRCW->SetOnDiskEmitter(NULL);
-
- //Release the interfaces. This should free some of the associated resources.
- if (pImportNew)
- pImportNew->Release();
-
- //Release our interfaces if we allocated them to begin with
- pRCW->DestroyCeeFileGen();
-
- //Check all file IO errors. If so, throw IOException. Otherwise, just throw the hr.
- if (FAILED(hr))
- {
- if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
- {
- if (IsWin32IOError(HRESULT_CODE(hr)))
- {
- SString hrMessage;
- GenerateTopLevelHRExceptionMessage(hr, hrMessage);
- COMPlusThrowHR(COR_E_IO, IDS_EE_GENERIC, hrMessage.GetUnicode());
- }
- else
- {
- COMPlusThrowHR(hr);
- }
- }
- COMPlusThrowHR(hr);
- }
-
- END_QCALL;
-}
-
-#endif // FEATURE_CORECLR
//=============================EmitDebugInfoBegin============================*/
// Phase 1 of emit debugging directory and symbol file.
@@ -1592,152 +1296,6 @@ ErrExit:
}
-#ifndef FEATURE_CORECLR
-//==============================================================================
-// Define external file for native resource.
-//==============================================================================
-void QCALLTYPE COMDynamicWrite::DefineNativeResourceFile(QCall::ModuleHandle pModule, LPCWSTR pwzFileName, INT32 portableExecutableKind, INT32 imageFileMachine)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- DWORD peFlags = 0, corhFlags = 0;
- ManagedBitnessFlagsToUnmanagedBitnessFlags(portableExecutableKind, imageFileMachine, &peFlags, &corhFlags);
- IfFailThrow( pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags) );
-
- ICeeFileGen * pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- // Set the resource file name.
- IfFailThrow( pCeeFileGen->SetResourceFileName(ceeFile, (LPWSTR)pwzFileName) );
-
- END_QCALL;
-} // void __stdcall COMDynamicWrite::DefineNativeResourceFile()
-
-//==============================================================================
-// Define array of bytes for native resource.
-//==============================================================================
-void QCALLTYPE COMDynamicWrite::DefineNativeResourceBytes(QCall::ModuleHandle pModule, LPCBYTE pbResource, INT32 cbResource, INT32 portableExecutableKind, INT32 imageFileMachine)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- DWORD peFlags = 0, corhFlags = 0;
- ManagedBitnessFlagsToUnmanagedBitnessFlags(portableExecutableKind, imageFileMachine, &peFlags, &corhFlags);
- IfFailThrow( pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags) );
-
- ICeeFileGen * pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- // Set the resource stream.
- HCEESECTION ceeSection = NULL;
- IfFailThrow( pCeeFileGen->GetSectionCreate(ceeFile, ".rsrc", sdReadOnly, &ceeSection) );
-
- void * pvResource;
- IfFailThrow( pCeeFileGen->GetSectionBlock(ceeSection, cbResource, 1, &pvResource) );
- memcpy(pvResource, pbResource, cbResource);
-
- END_QCALL;
-} // void __stdcall COMDynamicWrite::DefineNativeResourceBytes()
-
-//=============================AddResource=====================================*/
-// ecall for adding embedded resource to this module
-//==============================================================================*/
-void QCALLTYPE COMDynamicWrite::AddResource(QCall::ModuleHandle pModule, LPCWSTR pName, LPCBYTE pResBytes, INT32 resByteCount, UINT32 uFileTk, UINT32 iAttribute, INT32 portableExecutableKind, INT32 imageFileMachine)
-{
- QCALL_CONTRACT;
-
- BEGIN_QCALL;
-
- RefClassWriter * pRCW = pModule->GetReflectionModule()->GetClassWriter();
- _ASSERTE(pRCW);
-
- DWORD peFlags = 0, corhFlags = 0;
- ManagedBitnessFlagsToUnmanagedBitnessFlags(portableExecutableKind, imageFileMachine, &peFlags, &corhFlags);
- IfFailThrow( pRCW->EnsureCeeFileGenCreated(corhFlags, peFlags) );
-
- Assembly * pAssembly = pModule->GetAssembly();
- _ASSERTE( pAssembly && pAssembly->IsDynamic() );
-
- ICeeFileGen * pCeeFileGen = pRCW->GetCeeFileGen();
- HCEEFILE ceeFile = pRCW->GetHCEEFILE();
- _ASSERTE(ceeFile && pCeeFileGen);
-
- IMetaDataEmit * pOnDiskEmit = pRCW->GetOnDiskEmitter();
-
- // First, put it into .rdata section. The only reason that we choose .rdata section at
- // this moment is because this is the first section on the PE file. We don't need to deal with
- // reloc. Actually, I don't know how to deal with the reloc with CeeFileGen given that the reloc
- // position is not in the same file!
-
- // Get the .rdata section
- HCEESECTION hSection;
- IfFailThrow( pCeeFileGen->GetRdataSection(ceeFile, &hSection) );
-
- // the current section data length is the RVA
- ULONG ulOffset;
- IfFailThrow( pCeeFileGen->GetSectionDataLen(hSection, &ulOffset) );
-
- // Allocate a block of space fromt he .rdata section
- BYTE * pbBuffer;
- IfFailThrow( pCeeFileGen->GetSectionBlock(
- hSection, // from .rdata section
- resByteCount + sizeof(DWORD), // number of bytes that we need
- 1, // alignment
- (void**) &pbBuffer) );
-
- // now copy over the resource
- memcpy( pbBuffer, &resByteCount, sizeof(DWORD) );
- memcpy( pbBuffer + sizeof(DWORD), pResBytes, resByteCount );
-
- // track the total resource size so far. The size is actually the offset into the section
- // after writing the resource out
- IfFailThrow( pCeeFileGen->GetSectionDataLen(hSection, &pRCW->m_ulResourceSize) );
-
- mdFile tkFile = RidFromToken(uFileTk) ? uFileTk : mdFileNil;
- mdManifestResource mr;
-
- if (tkFile != mdFileNil)
- {
- SafeComHolderPreemp<IMetaDataAssemblyEmit> pOnDiskAssemblyEmit;
-
- IfFailThrow( pOnDiskEmit->QueryInterface(IID_IMetaDataAssemblyEmit, (void **) &pOnDiskAssemblyEmit) );
-
- // The resource is stored in a file other than the manifest file
- IfFailThrow(pOnDiskAssemblyEmit->DefineManifestResource(
- pName,
- mdFileNil, // implementation -- should be file token of this module in the manifest
- ulOffset, // offset to this file -- need to be adjusted upon save
- iAttribute, // resource flag
- &mr)); // manifest resource token
- }
-
- // Add an entry into the ManifestResource table for this resource
- // The RVA is ulOffset
- SafeComHolderPreemp<IMetaDataAssemblyEmit> pAssemEmitter(pAssembly->GetOnDiskMDAssemblyEmitter());
- IfFailThrow(pAssemEmitter->DefineManifestResource(
- pName,
- tkFile, // implementation -- should be file token of this module in the manifest
- ulOffset, // offset to this file -- need to be adjusted upon save
- iAttribute, // resource flag
- &mr)); // manifest resource token
-
- pRCW->m_tkFile = tkFile;
-
- END_QCALL;
-}
-
-#endif // FEATURE_CORECLR
//============================AddDeclarativeSecurity============================*/
// Add a declarative security serialized blob and a security action code to a
diff --git a/src/vm/comdynamic.h b/src/vm/comdynamic.h
index 224e017330..a605fa19ba 100644
--- a/src/vm/comdynamic.h
+++ b/src/vm/comdynamic.h
@@ -90,16 +90,6 @@ public:
static
void QCALLTYPE SavePEFile(QCall::ModuleHandle pModule, LPCWSTR wszPeName, UINT32 entryPoint, UINT32 fileKind, BOOL isManifestFile);
-#ifndef FEATURE_CORECLR
- static
- void QCALLTYPE DefineNativeResourceFile(QCall::ModuleHandle pModule, LPCWSTR pwzFileName, INT32 portableExecutableKind, INT32 imageFileMachine);
-
- static
- void QCALLTYPE DefineNativeResourceBytes(QCall::ModuleHandle pModule, LPCBYTE pbResource, INT32 cbResource, INT32 portableExecutableKind, INT32 imageFileMachine);
-
- static
- void QCALLTYPE AddResource(QCall::ModuleHandle pModule, LPCWSTR pName, LPCBYTE pResBytes, INT32 resByteCount, UINT32 uFileTk, UINT32 iAttribute, INT32 portableExecutableKind, INT32 imageFileMachine);
-#endif // !FEATURE_CORECLR
// not an ecall!
static HRESULT EmitDebugInfoBegin(
@@ -160,11 +150,6 @@ public:
static
INT32 QCALLTYPE SetParamInfo(QCall::ModuleHandle pModule, UINT32 tkMethod, UINT32 iSequence, UINT32 iAttributes, LPCWSTR wszParamName);
-#ifndef FEATURE_CORECLR
- // functions to set FieldMarshal
- static
- void QCALLTYPE SetFieldMarshal(QCall::ModuleHandle pModule, UINT32 tk, LPCBYTE pMarshal, INT32 cbMarshal);
-#endif
// functions to set default value
static
void QCALLTYPE SetConstantValue(QCall::ModuleHandle pModule, UINT32 tk, DWORD valueType, LPVOID pValue);
diff --git a/src/vm/cominterfacemarshaler.cpp b/src/vm/cominterfacemarshaler.cpp
index 251beff352..0bd22a028b 100644
--- a/src/vm/cominterfacemarshaler.cpp
+++ b/src/vm/cominterfacemarshaler.cpp
@@ -389,20 +389,8 @@ OBJECTREF COMInterfaceMarshaler::HandleInProcManagedComponent()
}
else
{
-#ifdef FEATURE_CORECLR
_ASSERTE(!"NYI");
COMPlusThrowHR(COR_E_NOTSUPPORTED);
-#else // FEATURE_CORECLR
- // TODO: probably we can cache the object on a per App domain bases
- // using CCW as the key
- OBJECTREF pwrap = NULL;
- GCPROTECT_BEGIN(pwrap);
- {
- pwrap = GetCCWObject();
- oref = AppDomainHelper::CrossContextCopyFrom(m_dwServerDomainId, &pwrap);
- }
- GCPROTECT_END();
-#endif // FEATURE_CORECLR
}
return oref;
diff --git a/src/vm/comisolatedstorage.cpp b/src/vm/comisolatedstorage.cpp
index 2f4f4f69b3..36dd787e11 100644
--- a/src/vm/comisolatedstorage.cpp
+++ b/src/vm/comisolatedstorage.cpp
@@ -992,9 +992,6 @@ HRESULT AccountingInfo::Lock()
DWORD dwRet;
{
// m_hLock is a mutex
-#ifndef FEATURE_CORECLR
- Thread::BeginThreadAffinityAndCriticalRegion();
-#endif
dwRet = WaitForSingleObject(m_hLock, INFINITE);
}
@@ -1065,9 +1062,6 @@ void AccountingInfo::Unlock()
InterlockedDecrement((LPLONG)&m_dwNumLocks);
#endif
-#ifndef FEATURE_CORECLR
- Thread::EndThreadAffinityAndCriticalRegion();
-#endif
}
#endif
diff --git a/src/vm/commodule.cpp b/src/vm/commodule.cpp
index af6dc48d15..bb6da1d5e7 100644
--- a/src/vm/commodule.cpp
+++ b/src/vm/commodule.cpp
@@ -45,12 +45,6 @@ static ISymUnmanagedWriter **CreateISymWriterForDynamicModule(ReflectionModule *
//
ESymbolFormat symFormatToUse = eSymbolFormatILDB;
-#ifndef FEATURE_CORECLR // On desktop only we still use PDB format if the symbols are savable to disk
- if(mod->GetAssembly()->HasSaveAccess())
- {
- symFormatToUse = eSymbolFormatPDB;
- }
-#endif
static ConfigDWORD dbgForcePDBSymbols;
if(dbgForcePDBSymbols.val_DontUse_(W("DbgForcePDBSymbols"), 0) == 1)
@@ -951,13 +945,6 @@ void QCALLTYPE COMModule::GetFullyQualifiedName(QCall::ModuleHandle pModule, QCa
{
LPCWSTR fileName = pModule->GetPath();
if (*fileName != 0) {
-#ifndef FEATURE_CORECLR
- // workaround - lie about where mscorlib is. Mscorlib is now loaded out of the GAC,
- // but some apps query its location to find the system directory. (Notably CodeDOM)
- if (pModule->IsSystem())
- retString.Set(SystemDomain::System()->BaseLibrary());
- else
-#endif // !FEATURE_CORECLR
{
#ifdef FEATURE_WINDOWSPHONE
//
@@ -1248,7 +1235,6 @@ FCIMPL1(FC_BOOL_RET, COMModule::IsResource, ReflectModuleBaseObject* pModuleUNSA
}
FCIMPLEND
-#ifdef FEATURE_CORECLR
//---------------------------------------------------------------------
// Helper code for PunkSafeHandle class. This does the Release in the
@@ -1283,6 +1269,5 @@ FCIMPL0(void*, COMPunkSafeHandle::nGetDReleaseTarget)
return (void*)DReleaseTarget;
}
FCIMPLEND
-#endif //FEATURE_CORECLR
diff --git a/src/vm/commodule.h b/src/vm/commodule.h
index 255b22dfbf..b3598abf5a 100644
--- a/src/vm/commodule.h
+++ b/src/vm/commodule.h
@@ -135,9 +135,7 @@ public:
class COMPunkSafeHandle
{
public:
-#ifdef FEATURE_CORECLR
static FCDECL0(void*, nGetDReleaseTarget);
-#endif
};
#endif
diff --git a/src/vm/common.h b/src/vm/common.h
index 9de9f35141..45f2d62d61 100644
--- a/src/vm/common.h
+++ b/src/vm/common.h
@@ -99,9 +99,6 @@
#include "compatibilityflags.h"
extern BOOL GetCompatibilityFlag(CompatibilityFlag flag);
-#ifndef FEATURE_CORECLR
-extern DWORD* GetGlobalCompatibilityFlags();
-#endif // !FEATURE_CORECLR
#include "strongname.h"
#include "stdmacros.h"
@@ -399,11 +396,6 @@ inline VOID UnsafeEEEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_CAN_TAKE_LOCK;
-#ifndef FEATURE_CORECLR
- if (CLRTaskHosted()) {
- Thread::BeginThreadAffinity();
- }
-#endif // !FEATURE_CORECLR
UnsafeEnterCriticalSection(lpCriticalSection);
INCTHREADLOCKCOUNT();
}
@@ -415,11 +407,6 @@ inline VOID UnsafeEELeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
UnsafeLeaveCriticalSection(lpCriticalSection);
DECTHREADLOCKCOUNT();
-#ifndef FEATURE_CORECLR
- if (CLRTaskHosted()) {
- Thread::EndThreadAffinity();
- }
-#endif // !FEATURE_CORECLR
}
inline BOOL UnsafeEETryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp
index 724dd315be..8eaab5e222 100644
--- a/src/vm/compile.cpp
+++ b/src/vm/compile.cpp
@@ -27,9 +27,6 @@
#include "zapsig.h"
#include "gcrefmap.h"
-#ifndef FEATURE_CORECLR
-#include "corsym.h"
-#endif // FEATURE_CORECLR
#include "virtualcallstub.h"
#include "typeparse.h"
@@ -192,20 +189,14 @@ HRESULT CEECompileInfo::CreateDomain(ICorCompilationDomain **ppDomain,
ENTER_DOMAIN_PTR(pCompilationDomain,ADV_COMPILATION)
{
-#ifdef FEATURE_CORECLR
if (fForceFulltrustDomain)
((ApplicationSecurityDescriptor *)pCompilationDomain->GetSecurityDescriptor())->SetGrantedPermissionSet(NULL, NULL, 0xFFFFFFFF);
-#endif
#ifndef CROSSGEN_COMPILE
-#ifndef FEATURE_CORECLR
- pCompilationDomain->InitializeHashing(NULL);
-#endif // FEATURE_CORECLR
#endif
pCompilationDomain->InitializeDomainContext(TRUE, NULL, NULL);
#ifndef CROSSGEN_COMPILE
-#ifdef FEATURE_CORECLR
if (!NingenEnabled())
{
@@ -223,7 +214,6 @@ HRESULT CEECompileInfo::CreateDomain(ICorCompilationDomain **ppDomain,
initializeSecurity.Call(args);
GCPROTECT_END();
}
-#endif //FEATURE_CORECLR
#endif
{
@@ -393,14 +383,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath(
PEImageHolder pImage;
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- // If the path is not absolute, look for the assembly on platform path list first
- if (wcschr(wzPath, '\\') == NULL || wcschr(wzPath, ':') == NULL || wcschr(wzPath, '/') == NULL)
- {
- CompilationDomain::FindImage(wzPath,
- fExplicitBindToNativeImage ? MDInternalImport_NoCache : MDInternalImport_Default, &pImage);
- }
-#endif
if (pImage == NULL)
{
@@ -521,10 +503,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath(
pDomain->AddAssemblyToCache(&spec, pDomainAssembly);
#endif
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- if (!IsReadyToRunCompilation())
- pDomain->ToCompilationDomain()->ComputeAssemblyHardBindList(pAssemblyHolder->GetPersistentMDImport());
-#endif
{
// Mark the assembly before it gets fully loaded and NGen image dependencies are verified. This is necessary
@@ -802,66 +780,6 @@ HRESULT CEECompileInfo::LoadAssemblyModule(
return S_OK;
}
-#ifndef FEATURE_CORECLR
-BOOL CEECompileInfo::SupportsAutoNGen(CORINFO_ASSEMBLY_HANDLE assembly)
-{
- STANDARD_VM_CONTRACT;
-
- Assembly *pAssembly = (Assembly*) assembly;
- return pAssembly->SupportsAutoNGen();
-}
-
-HRESULT CEECompileInfo::SetCachedSigningLevel(HANDLE hNI, HANDLE *pModules, COUNT_T nModules)
-{
- STANDARD_VM_CONTRACT;
-
- HRESULT hr = S_OK;
-
- HMODULE hKernel32 = WszLoadLibrary(W("kernel32.dll"));
- typedef BOOL (WINAPI *SetCachedSigningLevel_t)
- (__in_ecount(Count) PHANDLE SourceFiles, __in ULONG Count, __in ULONG Flags, __in HANDLE TargetFile);
- SetCachedSigningLevel_t SetCachedSigningLevel
- = (SetCachedSigningLevel_t)GetProcAddress(hKernel32, "SetCachedSigningLevel");
- if (SetCachedSigningLevel == NULL)
- {
- return S_OK;
- }
-
- StackSArray<PEImage*> images;
- PEImage::GetAll(images);
-
- StackSArray<HANDLE> handles;
- for (StackSArray<PEImage*>::Iterator i = images.Begin(), end = images.End(); i != end; i++)
- {
- if (!(*i)->IsFile())
- {
- continue;
- }
- HANDLE hFile = (*i)->GetFileHandleLocking();
- handles.Append(hFile);
- }
-
- if (!SetCachedSigningLevel(handles.GetElements(), handles.GetCount(), 0, hNI))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- _ASSERTE(FAILED(hr));
- goto ErrExit;
- }
-
- for (COUNT_T i = 0; i < nModules; i++)
- {
- if (!SetCachedSigningLevel(handles.GetElements(), handles.GetCount(), 0, pModules[i]))
- {
- hr = HRESULT_FROM_WIN32(GetLastError());
- _ASSERTE(FAILED(hr));
- goto ErrExit;
- }
- }
-
-ErrExit:
- return hr;
-}
-#endif
BOOL CEECompileInfo::CheckAssemblyZap(
CORINFO_ASSEMBLY_HANDLE assembly,
@@ -2910,11 +2828,7 @@ public:
LIMITED_METHOD_CONTRACT;
}
-#ifdef FEATURE_CORECLR
#define WRITER_LOAD_ERROR_MESSAGE W("Unable to load ") NATIVE_SYMBOL_READER_DLL W(". Please ensure that ") NATIVE_SYMBOL_READER_DLL W(" is on the path. Error='%d'\n")
-#else
-#define WRITER_LOAD_ERROR_MESSAGE W("Unable to load diasymreader.dll. Please ensure that version 11 or greater of diasymreader.dll is on the path. You can typically find this DLL in the desktop .NET install directory for 4.5 or greater. Error='%d'\n")
-#endif
HRESULT Load(LPCWSTR wszDiasymreaderPath = nullptr)
{
@@ -2942,11 +2856,7 @@ public:
{
hr = FakeCoCreateInstanceEx(
CLSID_CorSymBinder_SxS,
-#ifdef FEATURE_CORECLR
wszDiasymreaderPath != nullptr ? wszDiasymreaderPath : (LPCWSTR)NATIVE_SYMBOL_READER_DLL,
-#else
- wszDiasymreaderPath,
-#endif
IID_ISymUnmanagedBinder,
(void**)&m_pBinder,
NULL);
@@ -4952,9 +4862,6 @@ void CEECompileInfo::SetAssemblyHardBindList(
{
STANDARD_VM_CONTRACT;
-#ifndef FEATURE_CORECLR // hardbinding
- GetAppDomain()->ToCompilationDomain()->SetAssemblyHardBindList(pHardBindList, cHardBindList);
-#endif
}
HRESULT CEECompileInfo::SetVerboseLevel(
@@ -7254,11 +7161,6 @@ CompilationDomain::CompilationDomain(BOOL fForceDebug,
{
STANDARD_VM_CONTRACT;
-#ifndef FEATURE_CORECLR // hardbinding
- m_hardBoundModules.Init(FALSE, NULL);
- m_cantHardBindModules.Init(FALSE, NULL);
- m_useHardBindList = FALSE;
-#endif
}
void CompilationDomain::ReleaseDependencyEmitter()
@@ -7307,11 +7209,6 @@ void CompilationDomain::Init()
Security::SetDefaultAppDomainProperty(GetSecurityDescriptor());
SetCompilationDomain();
-#ifndef FEATURE_CORECLR
- // We need the Compilation Domain to be homogeneous. We've already forced everything to be full trust.
- // However, CheckZapSecurity needs this to be set, so set it here.
- GetSecurityDescriptor()->SetHomogeneousFlag(TRUE);
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
g_pConfig->DisableGenerateStubForHost();
@@ -7381,12 +7278,8 @@ HRESULT CompilationDomain::AddDependencyEntry(PEAssembly *pFile,
// Note that this can trigger an assembly load (of mscorlib)
pAssembly->GetOptimizedIdentitySignature(&pDependency->signAssemblyDef);
-#if !defined(FEATURE_CORECLR)
- ReleaseHolder<IMDInternalImport> pAssemblyMD(pFile->GetMDImportWithRef());
-#endif
-#ifdef FEATURE_CORECLR // hardbinding
//
// This is done in CompilationDomain::CanEagerBindToZapFile with full support for hardbinding
//
@@ -7395,59 +7288,7 @@ HRESULT CompilationDomain::AddDependencyEntry(PEAssembly *pFile,
CORCOMPILE_VERSION_INFO * pNativeVersion = pFile->GetLoadedNative()->GetNativeVersionInfo();
pDependency->signNativeImage = pNativeVersion->signature;
}
-#endif
-
-#ifndef FEATURE_CORECLR
- // Find the architecture of the dependency, using algorithm from Fusion GetRuntimeVersionForAssembly.
- // Normally, when an assembly is loaded at runtime, Fusion determines its architecture based on the
- // metadata. However, if assembly load is skipped due to presence of native image, then Fusion needs
- // to get assembly architecture from another source. For assemblies in GAC, the GAC structure provides
- // architecture data. For assemblies outside of GAC, however, no other source of info is available.
- // So we calculate the architecture now and store it in the native image, to make it available to Fusion.
- // The algorithm here must exactly match the algorithm in GetRuntimeVersionForAssembly.
- LPCSTR pszPERuntime;
- IfFailThrow(pAssemblyMD->GetVersionString(&pszPERuntime));
-
- if (SString::_strnicmp(pszPERuntime, "v1.0", 4) != 0 &&
- SString::_strnicmp(pszPERuntime, "v1.1", 4) != 0 &&
- SString::_stricmp(pszPERuntime, "Standard CLI 2002") != 0)
- {
- // Get the PE architecture of this dependency, similar to PEAssembly::GetFusionProcessorArchitecture.
- // The difference is when NI is loaded, PEAssembly::GetFusionProcessorArchitecture returns the
- // architecture of the NI (which is never processor neutral), but we want the architecture
- // associated with the IL image.
- DWORD dwPEKind, dwMachine;
- if (pFile->HasNativeImage())
- {
- // CrossGen can load an NI without loading the corresponding IL image, in which case
- // PEAssembly::GetILImage() actually returns an NI. Thus we need specific code to handle NI.
- PEImageHolder pImage(pFile->GetNativeImageWithRef());
- pImage->GetNativeILPEKindAndMachine(&dwPEKind, &dwMachine);
- }
- else
- {
- pFile->GetILimage()->GetPEKindAndMachine(&dwPEKind, &dwMachine);
- }
- DWORD dwAssemblyFlags = 0;
- IfFailThrow(pAssemblyMD->GetAssemblyProps(TokenFromRid(1, mdtAssembly),
- NULL, NULL, NULL,
- NULL, NULL, &dwAssemblyFlags));
-
- PEKIND peKind;
- if (SUCCEEDED(TranslatePEToArchitectureType(
- (CorPEKind)dwPEKind,
- dwMachine,
- dwAssemblyFlags,
- &peKind)))
- {
- CorCompileDependencyInfo peKindShifted = CorCompileDependencyInfo(peKind << CORCOMPILE_DEPENDENCY_PEKIND_SHIFT);
- _ASSERTE(peKindShifted == (peKindShifted & CORCOMPILE_DEPENDENCY_PEKIND_MASK));
- pDependency->dependencyInfo = CorCompileDependencyInfo(pDependency->dependencyInfo
- | (peKindShifted & CORCOMPILE_DEPENDENCY_PEKIND_MASK));
- }
- }
-#endif //FEATURE_FUSION
}
return S_OK;
@@ -7619,68 +7460,6 @@ AssemblySpec* CompilationDomain::FindAssemblyRefSpecForDefSpec(
return (pEntry != NULL) ? pEntry->m_pRef : NULL;
}
-#ifndef FEATURE_CORECLR // hardbinding
-//----------------------------------------------------------------------------
-// Was the assembly asked to be hard-bound to?
-
-BOOL CompilationDomain::IsInHardBindRequestList(Assembly * pAssembly)
-{
- return IsInHardBindRequestList(pAssembly->GetManifestFile());
-}
-
-BOOL CompilationDomain::IsInHardBindRequestList(PEAssembly * pAssembly)
-{
- if (!m_useHardBindList)
- return FALSE;
-
- StackSString displayName;
- pAssembly->GetDisplayName(displayName);
-
- for (COUNT_T i = 0; i < m_assemblyHardBindList.GetCount(); i++)
- {
- if (displayName.Equals(m_assemblyHardBindList[i]))
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOL CompilationDomain::IsSafeToHardBindTo(PEAssembly * pAssembly)
-{
- WRAPPER_NO_CONTRACT;
- // The dependency worker does not have m_useHardBindList set.
- // We do want to allow all possible native images to be loaded in this case.
- if (!m_useHardBindList)
- return TRUE;
-
- if (CompilationDomain::IsInHardBindRequestList(pAssembly))
- return TRUE;
-
- return FALSE;
-}
-
-PtrHashMap::PtrIterator CompilationDomain::IterateHardBoundModules()
-{
- WRAPPER_NO_CONTRACT;
- return m_hardBoundModules.begin();
-}
-
-void CompilationDomain::SetAssemblyHardBindList(
- __in_ecount( cHardBindList )
- LPWSTR *pHardBindList,
- DWORD cHardBindList)
-{
- m_assemblyHardBindList.SetCount(0);
-
- for (DWORD i = 0; i < cHardBindList; i++)
- {
- SString s(pHardBindList[i]);
- m_assemblyHardBindList.Append(s);
- }
-
- m_useHardBindList = TRUE;
-}
-#endif // FEATURE_CORECLR
//----------------------------------------------------------------------------
// Is it OK to embed direct pointers to an ngen dependency?
@@ -7703,261 +7482,13 @@ BOOL CompilationDomain::CanEagerBindToZapFile(Module *targetModule, BOOL limitTo
return TRUE;
}
-#ifdef FEATURE_CORECLR // hardbinding
//
// CoreCLR does not have attributes for fine grained eager binding control.
// We hard bind to mscorlib.dll only.
//
return targetModule->IsSystem();
-#else
- // Now, look up the hashtables to avoid doing the heavy-duty work everytime
-
- if (m_cantHardBindModules.LookupValue((UPTR)targetModule, targetModule) !=
- LPVOID(INVALIDENTRY))
- {
- return FALSE;
- }
-
- if (m_hardBoundModules.LookupValue((UPTR)targetModule, targetModule) !=
- LPVOID(INVALIDENTRY))
- {
- return TRUE;
- }
-
- const char * logMsg = NULL;
-
- EEConfig::NgenHardBindType ngenHardBindConfig = g_pConfig->NgenHardBind();
-
- if (ngenHardBindConfig == EEConfig::NGEN_HARD_BIND_NONE)
- {
- logMsg = "COMPlus_HardPrejitEnabled=0 is specified";
- goto CANNOT_HARD_BIND;
- }
-
- if (ngenHardBindConfig == EEConfig::NGEN_HARD_BIND_ALL)
- {
- // COMPlus_HardPrejitEnabled=2 is specified
- limitToHardBindList = FALSE;
- }
-
- if (!targetModule->HasNativeImage())
- {
- logMsg = "dependency does not have a native image (check FusLogVw for reason)";
- goto CANNOT_HARD_BIND;
- }
-
- // The loader/Fusion cannot currently guarantee that a non-manifest module of a
- // hardbound dependency gets eagerly loaded.
- if (!targetModule->GetFile()->IsAssembly())
- {
- logMsg = "dependency is a non-manifest module";
- goto CANNOT_HARD_BIND;
- }
-
- // Don't hard bind to modules not on the list
- if (limitToHardBindList && m_useHardBindList)
- {
- if (!IsInHardBindRequestList(targetModule->GetAssembly()))
- {
- logMsg = "dependency was not found in m_assemblyHardBindList";
- goto CANNOT_HARD_BIND;
- }
- }
-
- // Mark targetModule as a hard dependency
- //
- m_hardBoundModules.InsertValue((UPTR)targetModule, targetModule);
-
- // Update m_pDependencies for the corresponding assembly, to reflect the fact
- // that we are hard-binding to its native image
- //
- PEAssembly * pTargetAssembly;
- pTargetAssembly = targetModule->GetFile()->GetAssembly();
- UpdateDependencyEntryForHardBind(pTargetAssembly);
-
- logMsg = "new dependency";
-
- // Try to hardbind to the hardbound dependency closure as there is
- // no extra cost in doing so
- IncludeHardBindClosure(pTargetAssembly);
-
- LOG((LF_ZAP, LL_INFO100, "Success CanEagerBindToZapFile: %S (%s)\n",
- targetModule->GetDebugName(), logMsg));
-
- return TRUE;
-
-CANNOT_HARD_BIND:
-
- m_cantHardBindModules.InsertValue((UPTR)targetModule, targetModule);
-
- // If we have a hard binding list, check if this module is on the list.
- if (targetModule->GetFile()->IsAssembly() &&
- IsInHardBindRequestList(targetModule->GetAssembly()))
- {
- StackSString displayName;
- targetModule->GetAssembly()->GetDisplayName(displayName);
-
- GetSvcLogger()->Printf(LogLevel_Warning, W("WARNING: Cannot hardbind to %s because %S\n"),
- displayName.GetUnicode(), logMsg);
- }
-
- if (logMsg)
- {
- LOG((LF_ZAP, LL_INFO100, "Failure CanEagerBindToZapFile: %S (%s)\n",
- targetModule->GetDebugName(), logMsg));
- }
-
- return FALSE;
-#endif // FEATURE_CORECLR
-}
-
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
-
-SArray<LPCWSTR> * s_pPlatformAssembliesPaths;
-
-void ZapperSetPlatformAssembliesPaths(SString &platformAssembliesPaths)
-{
- STANDARD_VM_CONTRACT;
-
- _ASSERTE(s_pPlatformAssembliesPaths == NULL);
- s_pPlatformAssembliesPaths = new SArray<LPCWSTR>();
-
- SString strPaths(platformAssembliesPaths);
- if (strPaths.IsEmpty())
- return;
-
- for (SString::Iterator i = strPaths.Begin(); i != strPaths.End(); )
- {
- // Skip any leading spaces or semicolons
- if (strPaths.Skip(i, W(';')))
- {
- continue;
- }
-
- SString::Iterator iEnd = i; // Where current assembly name ends
- SString::Iterator iNext; // Where next assembly name starts
- if (strPaths.Find(iEnd, W(';')))
- {
- iNext = iEnd + 1;
- }
- else
- {
- iNext = iEnd = strPaths.End();
- }
-
- _ASSERTE(i < iEnd);
- if(i != iEnd)
- {
- SString strPath(strPaths, i, iEnd);
-
- SString strFullPath;
- Clr::Util::Win32::GetFullPathName(strPath, strFullPath, NULL);
-
- NewArrayHolder<WCHAR> wszFullPath = DuplicateStringThrowing(strFullPath.GetUnicode());
- s_pPlatformAssembliesPaths->Append(wszFullPath);
- wszFullPath.SuppressRelease();
- }
- i = iNext;
- }
}
-BOOL CompilationDomain::FindImage(const SString& fileName, MDInternalImportFlags flags, PEImage ** ppImage)
-{
- if (s_pPlatformAssembliesPaths == NULL)
- return FALSE;
-
- for (COUNT_T i = 0; i < s_pPlatformAssembliesPaths->GetCount(); i++)
- {
- SString sPath((*s_pPlatformAssembliesPaths)[i]);
- if (sPath[sPath.GetCount() - 1] != '\\')
- sPath.Append(W("\\"));
- sPath.Append(fileName);
-
- if (!FileExists(sPath))
- continue;
-
- // Normalize the path to maintain identity
- SString sFullPath;
- Clr::Util::Win32::GetFullPathName(sPath, sFullPath, NULL);
-
- PEImageHolder image(PEImage::OpenImage(sFullPath, flags));
-
- PEImageLayoutHolder pLayout(image->GetLayout(
- (flags == MDInternalImport_NoCache) ? PEImageLayout::LAYOUT_FLAT : PEImageLayout::LAYOUT_MAPPED,
- PEImage::LAYOUT_CREATEIFNEEDED));
-
- if (!pLayout->HasNTHeaders())
- continue;
-
- if (!pLayout->IsNativeMachineFormat())
- {
- // Check for platform agnostic IL
- if (!pLayout->IsPlatformNeutral())
- continue;
- }
-
- *ppImage = image.Extract();
- return TRUE;
- }
-
- return FALSE;
-}
-
-BOOL CompilationDomain::IsInHardBindList(SString& simpleName)
-{
- for (COUNT_T i = 0; i < m_assemblyHardBindList.GetCount(); i++)
- {
- if (simpleName.Equals(m_assemblyHardBindList[i]))
- return TRUE;
- }
-
- return FALSE;
-}
-
-void CompilationDomain::ComputeAssemblyHardBindList(IMDInternalImport * pImport)
-{
- AssemblyForLoadHint assembly(pImport);
-
- HENUMInternalHolder hEnum(pImport);
- hEnum.EnumAllInit(mdtAssemblyRef);
-
- mdAssembly token;
- while (pImport->EnumNext(&hEnum, &token))
- {
- LPCSTR pszName;
- IfFailThrow(pImport->GetAssemblyRefProps(token, NULL, NULL,
- &pszName, NULL,
- NULL, NULL, NULL));
-
- SString sSimpleName(SString::Utf8, pszName);
-
- SString sFileName(sSimpleName, W(".dll"));
-
- PEImageHolder pDependencyImage;
-
- if (!FindImage(sFileName, MDInternalImport_Default, &pDependencyImage))
- continue;
-
- AssemblyForLoadHint assemblyDependency(pDependencyImage->GetMDImport());
-
- LoadHintEnum loadHint;
- ::GetLoadHint(&assembly, &assemblyDependency, &loadHint);
-
- if (loadHint == LoadAlways)
- {
- GetSvcLogger()->Printf(W("Hardbinding to %s\n"), sSimpleName.GetUnicode());
-
- if (!IsInHardBindList(sSimpleName))
- {
- m_assemblyHardBindList.Append(sSimpleName);
- }
- }
- }
-
- // Note that we are not setting m_useHardBindList to TRUE here. When we load the NGen image, we are good to hardbind.
- // m_useHardBindList = TRUE;
-}
-#endif
void CompilationDomain::SetTarget(Assembly *pAssembly, Module *pModule)
{
@@ -7977,7 +7508,6 @@ void CompilationDomain::SetTargetImage(DataImage *pImage, CEEPreloader * pPreloa
_ASSERTE(pImage->GetModule() == GetTargetModule());
}
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
void ReportMissingDependency(Exception * e)
{
// Avoid duplicate error messages
@@ -7991,7 +7521,6 @@ void ReportMissingDependency(Exception * e)
g_hrFatalError = COR_E_FILELOAD;
}
-#endif
PEAssembly *CompilationDomain::BindAssemblySpec(
AssemblySpec *pSpec,
@@ -8022,13 +7551,11 @@ PEAssembly *CompilationDomain::BindAssemblySpec(
}
EX_HOOK
{
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
if (!g_fNGenMissingDependenciesOk)
{
ReportMissingDependency(GET_EXCEPTION());
EX_RETHROW;
}
-#endif
//
// Record missing dependencies
@@ -8127,199 +7654,6 @@ void CompilationDomain::SetDependencyEmitter(IMetaDataAssemblyEmit *pEmit)
m_pDependencyRefSpecs = new AssemblySpecHash();
}
-#ifndef FEATURE_CORECLR // hardbinding
-/* Update m_pDependencies for the corresponding assembly, to reflect the fact
- that we are hard-binding to its native image
- */
-
-void CompilationDomain::UpdateDependencyEntryForHardBind(PEAssembly * pDependencyAssembly)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- PRECONDITION(pDependencyAssembly->HasBindableIdentity()); // Currently no hard deps on WinMD files.
- }
- CONTRACTL_END;
- AssemblySpec assemblySpec;
- assemblySpec.InitializeSpec(pDependencyAssembly);
-
- mdAssemblyRef defToken;
- IfFailThrow(assemblySpec.EmitToken(m_pEmit, &defToken));
-
- CORCOMPILE_DEPENDENCY * pDep = m_pDependencies;
-
- for (unsigned i = 0; i < m_cDependenciesCount; i++, pDep++)
- {
- if (pDep->dwAssemblyDef == defToken)
- {
- PEImage * pNativeImage = pDependencyAssembly->GetPersistentNativeImage();
- CORCOMPILE_VERSION_INFO * pNativeVersion = pNativeImage->GetLoadedLayout()->GetNativeVersionInfo();
- _ASSERTE(pDep->signNativeImage == INVALID_NGEN_SIGNATURE ||
- pDep->signNativeImage == pNativeVersion->signature);
- pDep->signNativeImage = pNativeVersion->signature;
- return;
- }
- }
-
- // We should have found and updated the corresponding dependency
- _ASSERTE(!"This should be unreachable");
-}
-
-// pAssembly is a hardbound ngen dependency of m_pTargetModule.
-// Try to hardbind to the hardbound dependency closure as there is
-// no extra cost in doing so, and it will help generate better code
-//
-
-void CompilationDomain::IncludeHardBindClosure(PEAssembly * pAssembly)
-{
- CONTRACTL {
- PRECONDITION(pAssembly->GetPersistentNativeImage() != NULL);
- } CONTRACTL_END;
-
- PEImageLayout *pNativeImage = pAssembly->GetLoadedNative();
- COUNT_T cDependencies;
- CORCOMPILE_DEPENDENCY *pDependencies = pNativeImage->GetNativeDependencies(&cDependencies);
- CORCOMPILE_DEPENDENCY *pDependenciesEnd = pDependencies + cDependencies;
-
- for (/**/; pDependencies < pDependenciesEnd; pDependencies++)
- {
- // Ignore "soft" dependencies
-
- if (pDependencies->signNativeImage == INVALID_NGEN_SIGNATURE)
- continue;
-
- // Load the manifest file for the given hardbound name-assembly-spec.
-
- AssemblySpec name;
- name.InitializeSpec(pDependencies->dwAssemblyRef,
- pAssembly->GetPersistentNativeImage()->GetNativeMDImport(),
- FindAssembly(pAssembly),
- FALSE);
-
- DomainAssembly * pDependency = name.LoadDomainAssembly(FILE_LOADED);
-
- // Since pAssembly hardbinds to pDependency, pDependency better
- // have a native image
- _ASSERTE(pDependency->GetFile()->HasNativeImage());
-
- //
- // Now add pDependency as a hard dependency of m_pTargetModule.
- // We pass in limitToHardBindList=FALSE as it is OK to hardbind even if
- // pDependency is not in the hardbound list.
- //
-
- CanEagerBindToZapFile(pDependency->GetLoadedModule(), FALSE);
- }
-}
-
-//-----------------------------------------------------------------------------
-// Check if we were successfully able to hardbind to the requested dependency
-
-void CompilationDomain::CheckHardBindToZapFile(SString dependencyNameFromCA)
-{
- // First check if we were successfully able to hard-bind
-
- for (PtrHashMap::PtrIterator hbItr = m_hardBoundModules.begin(); !hbItr.end(); ++hbItr)
- {
- Module * pModule = (Module*) hbItr.GetValue();
-
- if (IsAssemblySpecifiedInCA(pModule->GetAssembly(), dependencyNameFromCA))
- {
- // We did successfully use "dependencyNameFromCA"
- return;
- }
- }
-
- // Next, check if we failed to hard-bind. CompilationDomain::CanEagerBindToZapFile()
- // would have logged a warning message with the cause of the soft-bind
-
- for (PtrHashMap::PtrIterator sbItr = m_cantHardBindModules.begin(); !sbItr.end(); ++sbItr)
- {
- Module * pModule = (Module*) sbItr.GetValue();
-
- if (IsAssemblySpecifiedInCA(pModule->GetAssembly(), dependencyNameFromCA))
- {
- if (!IsInHardBindRequestList(pModule->GetAssembly()))
- {
- // CompilationDomain::CanEagerBindToZapFile() does not give a warning
- // message for the cyclic dependency case, since the NGEN service
- // breaks the cycle by overriding the CA. So give a message here instead.
- GetSvcLogger()->Printf(LogLevel_Warning, W("WARNING: Dependency attribute for %s is being ignored, possibly because of cyclic dependencies.\n"),
- dependencyNameFromCA.GetUnicode());
- }
- return;
- }
- }
-
- // Finally, it looks like the assembly was either not loaded, or that
- // there was no reason to even try to hard-bind.
-
- GetSvcLogger()->Printf(LogLevel_Warning, W("WARNING: Cannot hardbind to %s because it is not loaded\n"),
- dependencyNameFromCA.GetUnicode());
-}
-
-//-----------------------------------------------------------------------------
-// Check if we were successfully able to hardbind to all the requested
-// dependencies.
-
-void CompilationDomain::CheckLoadHints()
-{
- if (!m_useHardBindList)
- return;
-
- if (g_pConfig->NgenHardBind() == EEConfig::NGEN_HARD_BIND_NONE)
- return;
-
- // Look for the binding custom attribute
-
- IMDInternalImport * pImport = m_pTargetAssembly->GetManifestImport();
- _ASSERTE(pImport);
-
- MDEnumHolder hEnum(pImport); // Enumerator for custom attributes
- if (FAILED(pImport->EnumCustomAttributeByNameInit(m_pTargetAssembly->GetManifestToken(),
- DEPENDENCY_TYPE,
- &hEnum)))
- {
- return;
- }
-
- mdCustomAttribute tkAttribute; // A custom attribute on this assembly.
- const BYTE *pbAttr; // Custom attribute data as a BYTE*.
- ULONG cbAttr; // Size of custom attribute data.
-
- while (pImport->EnumNext(&hEnum, &tkAttribute))
- { // Get raw custom attribute.
- IfFailThrow(pImport->GetCustomAttributeAsBlob(tkAttribute, (const void**)&pbAttr, &cbAttr));
-
- CustomAttributeParser cap(pbAttr, cbAttr);
- if (FAILED(cap.ValidateProlog()))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_HEADER, m_pTargetAssembly->GetManifestModule());
- }
-
- LPCUTF8 szString;
- ULONG cbString;
- if (FAILED(cap.GetNonNullString(&szString, &cbString)))
- {
- THROW_BAD_FORMAT(BFA_BAD_CA_STRING, m_pTargetAssembly->GetManifestModule());
- }
-
- UINT32 u4;
- IfFailThrow(cap.GetU4(&u4));
- LoadHintEnum loadHint = (LoadHintEnum)u4;
-
- if (loadHint != LoadAlways)
- continue;
-
- // Convert the string to Unicode.
- StackSString dependencyNameFromCA(SString::Utf8, szString, cbString);
-
- CheckHardBindToZapFile(dependencyNameFromCA);
- }
-}
-#endif // FEATURE_CORECLR
HRESULT
CompilationDomain::GetDependencies(CORCOMPILE_DEPENDENCY **ppDependencies,
@@ -8327,9 +7661,6 @@ HRESULT
{
STANDARD_VM_CONTRACT;
-#ifndef FEATURE_CORECLR // hardbinding
- CheckLoadHints();
-#endif
//
// Return the bindings.
@@ -8412,16 +7743,5 @@ HRESULT CompilationDomain::SetPlatformWinmdPaths(LPCWSTR pwzPlatformWinmdPaths)
}
#endif // CROSSGEN_COMPILE
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
-bool UseRyuJit()
-{
-#ifdef CROSSGEN_COMPILE
- return true;
-#else
- static ConfigDWORD useRyuJitValue;
- return useRyuJitValue.val(CLRConfig::INTERNAL_UseRyuJit) == 1 || IsNgenOffline();
-#endif
-}
-#endif
#endif // FEATURE_PREJIT
diff --git a/src/vm/compile.h b/src/vm/compile.h
index 8ee66dbec8..140a62fcb0 100644
--- a/src/vm/compile.h
+++ b/src/vm/compile.h
@@ -235,12 +235,6 @@ class CEECompileInfo : public ICorCompileInfo
mdFile file,
CORINFO_MODULE_HANDLE *pHandle);
-#ifndef FEATURE_CORECLR
- // Check if the assembly supports automatic NGen
- BOOL SupportsAutoNGen(CORINFO_ASSEMBLY_HANDLE assembly);
-
- HRESULT SetCachedSigningLevel(HANDLE hNI, HANDLE *pModules, COUNT_T nModules);
-#endif
BOOL CheckAssemblyZap(
CORINFO_ASSEMBLY_HANDLE assembly,
@@ -757,9 +751,6 @@ typedef SHash<AssemblySpecDefRefMapTraits> AssemblySpecMapDefRefMapTable;
class CompilationDomain : public AppDomain,
public ICorCompilationDomain
{
-#ifndef FEATURE_CORECLR
- VPTR_MULTI_VTABLE_CLASS(CompilationDomain, AppDomain);
-#endif
public:
BOOL m_fForceDebug;
@@ -796,14 +787,6 @@ class CompilationDomain : public AppDomain,
HRESULT AddDependencyEntry(PEAssembly *pFile, mdAssemblyRef ref,mdAssemblyRef def);
void ReleaseDependencyEmitter();
-#ifndef FEATURE_CORECLR // hardbinding
- PtrHashMap m_hardBoundModules; // Hard dependency on native image of these dependency modules
- PtrHashMap m_cantHardBindModules;
- void UpdateDependencyEntryForHardBind(PEAssembly * pDependencyAssembly);
- void IncludeHardBindClosure(PEAssembly * pDependencyAssembly);
- void CheckHardBindToZapFile(SString dependencyNameFromCustomAttribute);
- void CheckLoadHints();
-#endif
public:
@@ -831,28 +814,7 @@ class CompilationDomain : public AppDomain,
BOOL CanEagerBindToZapFile(Module *targetModule, BOOL limitToHardBindList = TRUE);
-#ifndef FEATURE_CORECLR // hardbinding
- PtrHashMap::PtrIterator IterateHardBoundModules();
-
- // List of full display names of assemblies to hard-bind to
- SArray<SString,FALSE> m_assemblyHardBindList;
- BOOL m_useHardBindList;
- BOOL IsInHardBindRequestList(Assembly * pAssembly);
- BOOL IsInHardBindRequestList(PEAssembly * pAssembly);
- BOOL IsSafeToHardBindTo(PEAssembly * pAssembly);
- void SetAssemblyHardBindList(
- __in_ecount( cHardBindList )
- LPWSTR *pHardBindList,
- DWORD cHardBindList);
-#endif
-
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- void ComputeAssemblyHardBindList(IMDInternalImport * pImport);
- BOOL IsInHardBindList(SString& simpleName);
-
- static BOOL FindImage(const SString& fileName, MDInternalImportFlags flags, PEImage ** ppImage);
-#endif
// Returns NULL on out-of-memory
RefCache *GetRefCache(Module *pModule)
diff --git a/src/vm/comsynchronizable.cpp b/src/vm/comsynchronizable.cpp
index b486687752..9a45c9cb7a 100644
--- a/src/vm/comsynchronizable.cpp
+++ b/src/vm/comsynchronizable.cpp
@@ -607,59 +607,6 @@ FCIMPL1(void, ThreadNative::ResetAbort, ThreadBaseObject* pThis)
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-// You can only suspend a running thread.
-FCIMPL1(void, ThreadNative::Suspend, ThreadBaseObject* pThisUNSAFE)
-{
- FCALL_CONTRACT;
-
- if (pThisUNSAFE == NULL)
- FCThrowResVoid(kNullReferenceException, W("NullReference_This"));
-
- Thread *thread = pThisUNSAFE->GetInternal();
-
- HELPER_METHOD_FRAME_BEGIN_0();
-
-#ifdef MDA_SUPPORTED
- MDA_TRIGGER_ASSISTANT(DangerousThreadingAPI, ReportViolation(W("System.Threading.Thread.Suspend")));
-#endif
-
- if (!ThreadIsRunning(thread))
- COMPlusThrow(kThreadStateException, IDS_EE_THREAD_SUSPEND_NON_RUNNING);
-
- thread->UserSuspendThread();
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-// You can only resume a thread that is in the user-suspended state. (This puts a large
-// burden on the app developer, but we want him to be thinking carefully about race
-// conditions. Precise errors give him a hope of sorting out his logic).
-FCIMPL1(void, ThreadNative::Resume, ThreadBaseObject* pThisUNSAFE)
-{
- FCALL_CONTRACT;
-
- if (pThisUNSAFE == NULL)
- FCThrowResVoid(kNullReferenceException, W("NullReference_This"));
-
- Thread *thread = pThisUNSAFE->GetInternal();
-
- HELPER_METHOD_FRAME_BEGIN_0();
-
- // UserResumeThread() will return 0 if there isn't a user suspension for us to
- // clear.
- if (!ThreadIsRunning(thread))
- COMPlusThrow(kThreadStateException, IDS_EE_THREAD_RESUME_NON_RUNNING);
-
- if (thread->UserResumeThread() == 0)
- COMPlusThrow(kThreadStateException, IDS_EE_THREAD_RESUME_NON_USER_SUSPEND);
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-#endif // FEATURE_CORECLR
// Note that you can manipulate the priority of a thread that hasn't started yet,
// or one that is running. But you get an exception if you manipulate the priority
@@ -1913,41 +1860,6 @@ UINT64 QCALLTYPE ThreadNative::GetProcessDefaultStackSize()
return (UINT64)reserve;
}
-#ifndef FEATURE_CORECLR
-FCIMPL0(void, ThreadNative::BeginCriticalRegion)
-{
- FCALL_CONTRACT;
- if (CLRHosted())
- {
- GetThread()->BeginCriticalRegion_NoCheck();
- }
-}
-FCIMPLEND
-
-FCIMPL0(void, ThreadNative::EndCriticalRegion)
-{
- FCALL_CONTRACT;
- if (CLRHosted())
- {
- GetThread()->EndCriticalRegion_NoCheck();
- }
-}
-FCIMPLEND
-
-FCIMPL0(void, ThreadNative::BeginThreadAffinity)
-{
- FCALL_CONTRACT;
- Thread::BeginThreadAffinity();
-}
-FCIMPLEND
-
-FCIMPL0(void, ThreadNative::EndThreadAffinity)
-{
- FCALL_CONTRACT;
- Thread::EndThreadAffinity();
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL1(FC_BOOL_RET, ThreadNative::IsThreadpoolThread, ThreadBaseObject* thread)
@@ -2128,69 +2040,6 @@ FCIMPL2(void, ThreadNative::SetAbortReason, ThreadBaseObject* pThisUNSAFE, Objec
}
FCIMPLEND
-#ifndef FEATURE_CORECLR // core clr does not support abort reason
-FCIMPL1(Object*, ThreadNative::GetAbortReason, ThreadBaseObject *pThisUNSAFE)
-{
- FCALL_CONTRACT;
-
- if (pThisUNSAFE==NULL)
- FCThrowRes(kNullReferenceException, W("NullReference_This"));
-
- OBJECTREF refRetVal = NULL;
- Thread *pThread = pThisUNSAFE->GetInternal();
-
- // Set up a frame in case of GC or EH
- HELPER_METHOD_FRAME_BEGIN_RET_1(refRetVal)
-
- if (pThread == NULL)
- COMPlusThrow(kThreadStateException, IDS_EE_THREAD_CANNOT_GET);
-
- // While the ExceptionInfo probably will be *set* from a different
- // thread, it should only be *read* from the current thread.
- _ASSERTE(GetThread() == pThread);
-
- // Set cooperative mode, to avoid AD unload while we're working.
- GCX_COOP();
-
- OBJECTHANDLE oh=NULL;
- ADID adid;
- // Scope the lock to reading the two fields on the Thread object.
- { // Atomically get the OBJECTHANDLE and ADID of the object
- // NOTE: get the lock on this thread object, not on the executing thread.
- Thread::AbortRequestLockHolder lock(pThread);
- oh = pThread->m_AbortReason;
- adid = pThread->m_AbortReasonDomainID;
- }
-
- // If the OBJECTHANDLE is not 0...
- if (oh != 0)
- {
-
- AppDomain *pCurrentDomain = pThread->GetDomain();
- // See if the appdomain is equal to the appdomain of the currently running
- // thread.
-
- if (pCurrentDomain->GetId() == adid)
- { // Same appdomain; just return object from the OBJECTHANDLE
- refRetVal = ObjectFromHandle(oh);
- }
- else
- { // Otherwise, try to marshal the object from the other AppDomain
- ENTER_DOMAIN_ID(adid);
- CrossAppDomainClonerCallback cadcc;
- ObjectClone Cloner(&cadcc, CrossAppDomain, FALSE);
- refRetVal = Cloner.Clone(ObjectFromHandle(oh), GetAppDomain(), pCurrentDomain, NULL);
- Cloner.RemoveGCFrames();
- END_DOMAIN_TRANSITION;
- }
- }
-
- HELPER_METHOD_FRAME_END()
-
- return OBJECTREFToObject(refRetVal);
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL1(void, ThreadNative::ClearAbortReason, ThreadBaseObject* pThisUNSAFE)
{
diff --git a/src/vm/comsynchronizable.h b/src/vm/comsynchronizable.h
index d9c2defd70..9a87d8eb67 100644
--- a/src/vm/comsynchronizable.h
+++ b/src/vm/comsynchronizable.h
@@ -69,10 +69,6 @@ public:
static FCDECL1(void, Abort, ThreadBaseObject* pThis);
static FCDECL1(void, ResetAbort, ThreadBaseObject* pThis);
static FCDECL2(void, Start, ThreadBaseObject* pThisUNSAFE, StackCrawlMark* pStackMark);
-#ifndef FEATURE_CORECLR
- static FCDECL1(void, Suspend, ThreadBaseObject* pThisUNSAFE);
- static FCDECL1(void, Resume, ThreadBaseObject* pThisUNSAFE);
-#endif // FEATURE_CORECLR
static FCDECL1(INT32, GetPriority, ThreadBaseObject* pThisUNSAFE);
static FCDECL2(void, SetPriority, ThreadBaseObject* pThisUNSAFE, INT32 iPriority);
static FCDECL1(void, Interrupt, ThreadBaseObject* pThisUNSAFE);
@@ -109,12 +105,6 @@ public:
UINT64 QCALLTYPE GetProcessDefaultStackSize();
static FCDECL1(INT32, GetManagedThreadId, ThreadBaseObject* th);
-#ifndef FEATURE_CORECLR
- static FCDECL0(void, BeginCriticalRegion);
- static FCDECL0(void, EndCriticalRegion);
- static FCDECL0(void, BeginThreadAffinity);
- static FCDECL0(void, EndThreadAffinity);
-#endif // !FEATURE_CORECLR
static FCDECL1(void, SpinWait, int iterations);
static BOOL QCALLTYPE YieldThread();
static FCDECL0(Object*, GetCurrentThread);
@@ -135,9 +125,6 @@ public:
static FCDECL1(void, SetIsThreadStaticsArray, Object* pObject);
static FCDECL2(void, SetAbortReason, ThreadBaseObject* pThisUNSAFE, Object* pObject);
-#ifndef FEATURE_CORECLR
- static FCDECL1(Object*, GetAbortReason, ThreadBaseObject* pThisUNSAFE);
-#endif
static FCDECL1(void, ClearAbortReason, ThreadBaseObject* pThisUNSAFE);
private:
diff --git a/src/vm/comthreadpool.cpp b/src/vm/comthreadpool.cpp
index a4c7e75064..c26242e85d 100644
--- a/src/vm/comthreadpool.cpp
+++ b/src/vm/comthreadpool.cpp
@@ -632,31 +632,6 @@ void SetAsyncResultProperties(
STATIC_CONTRACT_MODE_ANY;
STATIC_CONTRACT_SO_TOLERANT;
-#ifndef FEATURE_CORECLR
- ASYNCRESULTREF asyncResult = overlapped->m_asyncResult;
- // only filestream is expected to have a null delegate in which
- // case we do the necessary book-keeping here. However, for robustness
- // we should make sure that the asyncResult is indeed an instance of
- // FileStreamAsyncResult
- if (asyncResult->GetMethodTable() == g_pAsyncFileStream_AsyncResultClass)
- {
- // Handle reading from & writing to closed pipes. It's possible for
- // an async read on a pipe to be issued and then the pipe is closed,
- // returning this error. This may very well be necessary. -BG
- if (dwErrorCode == ERROR_BROKEN_PIPE || dwErrorCode == ERROR_NO_DATA)
- dwErrorCode = 0;
- asyncResult->SetErrorCode(dwErrorCode);
- asyncResult->SetNumBytes(dwNumBytes);
- asyncResult->SetCompletedAsynchronously();
- asyncResult->SetIsComplete();
-
- // Signal the event - the OS does not do this for us.
- WAITHANDLEREF waitHandle = asyncResult->GetWaitHandle();
- HANDLE h = waitHandle->GetWaitHandle();
- if ((h != NULL) && (h != (HANDLE) -1))
- UnsafeSetEvent(h);
- }
-#endif // !FEATURE_CORECLR
}
VOID BindIoCompletionCallBack_Worker(LPVOID args)
@@ -698,13 +673,6 @@ VOID BindIoCompletionCallBack_Worker(LPVOID args)
// no user delegate to callback
_ASSERTE((overlapped->m_iocbHelper == NULL) || !"This is benign, but should be optimized");
-#ifndef FEATURE_CORECLR
- // we cannot do this at threadpool initialization time since mscorlib may not have been loaded
- if (!g_pAsyncFileStream_AsyncResultClass)
- {
- g_pAsyncFileStream_AsyncResultClass = MscorlibBinder::GetClass(CLASS__FILESTREAM_ASYNCRESULT);
- }
-#endif // !FEATURE_CORECLR
SetAsyncResultProperties(overlapped, ErrorCode, numBytesTransferred);
}
diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp
index 0ef7460d37..04ad7a8c1a 100644
--- a/src/vm/comutilnative.cpp
+++ b/src/vm/comutilnative.cpp
@@ -777,48 +777,6 @@ FCIMPL1(FC_BOOL_RET, ExceptionNative::IsTransient, INT32 hresult)
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-
-FCIMPL3(StringObject *, ExceptionNative::StripFileInfo, Object *orefExcepUNSAFE, StringObject *orefStrUNSAFE, CLR_BOOL isRemoteStackTrace)
-{
- FCALL_CONTRACT;
-
- OBJECTREF orefExcep = ObjectToOBJECTREF(orefExcepUNSAFE);
- STRINGREF orefStr = (STRINGREF)ObjectToOBJECTREF(orefStrUNSAFE);
-
- if (orefStr == NULL)
- {
- return NULL;
- }
-
- HELPER_METHOD_FRAME_BEGIN_RET_2(orefExcep, orefStr);
-
- if (isRemoteStackTrace)
- {
- if (!AppX::IsAppXProcess() && ExceptionTypeOverridesStackTraceGetter(orefExcep->GetMethodTable()))
- {
- // In classic processes, the remote stack trace could have been generated using a custom get_StackTrace
- // override which means that we would not be able to parse is - strip the whole string by returning NULL.
- orefStr = NULL;
- }
- }
-
- if (orefStr != NULL)
- {
- SString stackTrace;
- orefStr->GetSString(stackTrace);
-
- StripFileInfoFromStackTrace(stackTrace);
-
- orefStr = AllocateString(stackTrace);
- }
-
- HELPER_METHOD_FRAME_END();
- return (StringObject *)OBJECTREFToObject(orefStr);
-}
-FCIMPLEND
-
-#endif // !FEATURE_CORECLR
#if defined(FEATURE_EXCEPTIONDISPATCHINFO)
// This FCall sets a flag against the thread exception state to indicate to
@@ -2847,67 +2805,8 @@ FCIMPL1(INT32, ValueTypeHelper::GetHashCodeOfPtr, LPVOID ptr)
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-FCIMPL1(OBJECTHANDLE, SizedRefHandle::Initialize, Object* _obj)
-{
- FCALL_CONTRACT;
-
- OBJECTHANDLE result = 0;
- OBJECTREF obj(_obj);
-
- HELPER_METHOD_FRAME_BEGIN_RET_0();
-
- result = GetAppDomain()->CreateSizedRefHandle(obj);
-
- HELPER_METHOD_FRAME_END();
-
- return result;
-}
-FCIMPLEND
-
-FCIMPL1(VOID, SizedRefHandle::Free, OBJECTHANDLE handle)
-{
- FCALL_CONTRACT;
-
- _ASSERTE(handle != NULL);
-
- HELPER_METHOD_FRAME_BEGIN_0();
-
- DestroySizedRefHandle(handle);
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-FCIMPL1(LPVOID, SizedRefHandle::GetTarget, OBJECTHANDLE handle)
-{
- FCALL_CONTRACT;
-
- _ASSERTE(handle != NULL);
-
- OBJECTREF objRef = NULL;
-
- objRef = ObjectFromHandle(handle);
-
- FCUnique(0x33);
- return *((LPVOID*)&objRef);
-}
-FCIMPLEND
-
-FCIMPL1(INT64, SizedRefHandle::GetApproximateSize, OBJECTHANDLE handle)
-{
- FCALL_CONTRACT;
-
- _ASSERTE(handle != NULL);
-
- return (INT64)HndGetHandleExtraInfo(handle);
-}
-FCIMPLEND
-#endif //!FEATURE_CORECLR
-#ifdef FEATURE_CORECLR
COMNlsHashProvider COMNlsHashProvider::s_NlsHashProvider;
-#endif // FEATURE_CORECLR
COMNlsHashProvider::COMNlsHashProvider()
diff --git a/src/vm/comutilnative.h b/src/vm/comutilnative.h
index dce7ec600b..32c1c2eef3 100644
--- a/src/vm/comutilnative.h
+++ b/src/vm/comutilnative.h
@@ -26,9 +26,6 @@
#include "windows.h"
#undef GetCurrentTime
-#ifndef FEATURE_CORECLR
-#include <winnls.h>
-#endif
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
#pragma warning(push)
@@ -249,35 +246,6 @@ public:
static FCDECL1(INT32, GetHashCodeOfPtr, LPVOID ptr);
};
-#ifndef FEATURE_CORECLR
-class SizedRefHandle
-{
-public:
- static FCDECL1(OBJECTHANDLE, Initialize, Object* _obj);
- static FCDECL1(VOID, Free, OBJECTHANDLE handle);
- static FCDECL1(LPVOID, GetTarget, OBJECTHANDLE handle);
- static FCDECL1(INT64, GetApproximateSize, OBJECTHANDLE handle);
-};
-
-typedef BOOL (*PFN_IS_NLS_DEFINED_STRING)(NLS_FUNCTION, DWORD, LPNLSVERSIONINFO, LPCWSTR, INT);
-typedef INT (*PFN_COMPARE_STRING_EX)(LPCWSTR, DWORD, LPCWSTR, INT, LPCWSTR, INT, LPNLSVERSIONINFO, LPVOID, LPARAM);
-typedef INT (*PFN_LC_MAP_STRING_EX)(LPCWSTR, DWORD, LPCWSTR, INT, LPWSTR, INT, LPNLSVERSIONINFO, LPVOID, LPARAM);
-typedef INT (*PFN_FIND_NLS_STRING_EX)(LPCWSTR, DWORD, LPCWSTR, INT, LPCWSTR, INT, LPINT, LPNLSVERSIONINFO, LPVOID, LPARAM);
-typedef INT (*PFN_COMPARE_STRING_ORDINAL)(LPCWSTR, INT, LPCWSTR, INT, BOOL);
-typedef BOOL (*PFN_GET_NLS_VERSION_EX)(NLS_FUNCTION, LPCWSTR, LPNLSVERSIONINFOEX);
-typedef INT (*PFN_FIND_STRING_ORDINAL)(DWORD, LPCWSTR, INT, LPCWSTR, INT, BOOL);
-
-class COMNlsCustomSortLibrary {
-public:
- PFN_IS_NLS_DEFINED_STRING pIsNLSDefinedString;
- PFN_COMPARE_STRING_EX pCompareStringEx;
- PFN_LC_MAP_STRING_EX pLCMapStringEx;
- PFN_FIND_NLS_STRING_EX pFindNLSStringEx;
- PFN_COMPARE_STRING_ORDINAL pCompareStringOrdinal;
- PFN_GET_NLS_VERSION_EX pGetNLSVersionEx;
- PFN_FIND_STRING_ORDINAL pFindStringOrdinal;
-};
-#endif //!FEATURE_CORECLR
typedef const BYTE * PCBYTE;
@@ -289,9 +257,7 @@ public:
INT32 HashSortKey(PCBYTE pSrc, SIZE_T cbSrc, BOOL forceRandomHashing, INT64 additionalEntropy);
INT32 HashiStringKnownLower80(LPCWSTR lpszStr, INT32 strLen, BOOL forceRandomHashing, INT64 additionalEntropy);
-#ifdef FEATURE_CORECLR
static COMNlsHashProvider s_NlsHashProvider;
-#endif // FEATURE_CORECLR
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
void SetUseRandomHashing(BOOL useRandomHashing) { LIMITED_METHOD_CONTRACT; bUseRandomHashing = useRandomHashing; }
diff --git a/src/vm/comwaithandle.cpp b/src/vm/comwaithandle.cpp
index 13886c3de8..7b15ae5acd 100644
--- a/src/vm/comwaithandle.cpp
+++ b/src/vm/comwaithandle.cpp
@@ -181,11 +181,6 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitOneNative, SafeHandle* safeWaitHandleUNS
Context* defaultContext;
defaultContext = pThread->GetDomain()->GetDefaultContext();
_ASSERTE(defaultContext);
-#ifndef FEATURE_CORECLR
- // DoAppropriateWait calls LeaveRuntime/EnterRuntime which may cause the current
- // fiber to be re-scheduled.
- ThreadAffinityAndCriticalRegionHolder affinityAndCriticalRegionHolder(hasThreadAffinity);
-#endif
SafeHandleHolder shh(&sh);
// Note that SafeHandle is a GC object, and RequestCallback and
// DoAppropriateWait work on an array of handles. Don't pass the address
@@ -222,18 +217,6 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitOneNative, SafeHandle* safeWaitHandleUNS
retVal = res;
-#ifndef FEATURE_CORECLR
- if (res == WAIT_OBJECT_0 && hasThreadAffinity) {
- affinityAndCriticalRegionHolder.SuppressRelease();
- }
- else if(res == WAIT_ABANDONED_0) {
- // WAIT_ABANDONED means the specified object is a mutex object that was not released by the thread
- // that owned the mutex object before the owning thread terminated.
- // Ownership of the mutex object is granted to the calling thread, and the mutex is set to nonsignaled.
- _ASSERTE(hasThreadAffinity);
- affinityAndCriticalRegionHolder.SuppressRelease();
- }
-#endif
HELPER_METHOD_FRAME_END();
return retVal;
@@ -263,22 +246,12 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitMultipleNative, Object* waitObjectsUNSAF
// on CoreCLR we won't break anyone.
// Perhaps in a future release we can fix this, if we aren't quite so concerned about
// compatibility....
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
- if (waitForAll && numWaiters > 1 && pThread->GetApartment() == Thread::AS_InSTA) {
- COMPlusThrow(kNotSupportedException, W("NotSupported_WaitAllSTAThread"));
- }
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
WaitHandleArrayHolder arrayHolder;
arrayHolder.Initialize(numWaiters, (PTRARRAYREF*) &waitObjects);
pWaitObjects = (PTRARRAYREF)waitObjects; // array of objects on which to wait
HANDLE* internalHandles = (HANDLE*) _alloca(numWaiters*sizeof(HANDLE));
-#ifndef FEATURE_CORECLR
- BOOL *hasThreadAffinity = (BOOL*) _alloca(numWaiters*sizeof(BOOL));
-
- BOOL mayRequireThreadAffinity = FALSE;
-#endif // !FEATURE_CORECLR
for (int i=0;i<numWaiters;i++)
{
WAITHANDLEREF waitObject = (WAITHANDLEREF) pWaitObjects->m_Array[i];
@@ -289,19 +262,9 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitMultipleNative, Object* waitObjectsUNSAF
// this behavior seems wrong but someone explicitly coded that condition so it must have been for a reason.
internalHandles[i] = waitObject->m_handle;
-#ifndef FEATURE_CORECLR
- // m_hasThreadAffinity is set for Mutex only
- hasThreadAffinity[i] = waitObject->m_hasThreadAffinity;
- if (hasThreadAffinity[i]) {
- mayRequireThreadAffinity = TRUE;
- }
-#endif // !FEATURE_CORECLR
}
DWORD res = (DWORD) -1;
-#ifndef FEATURE_CORECLR
- ThreadAffinityHolder affinityHolder(mayRequireThreadAffinity);
-#endif // !FEATURE_CORECLR
Context* targetContext;
targetContext = pThread->GetContext();
_ASSERTE(targetContext);
@@ -335,45 +298,6 @@ FCIMPL4(INT32, WaitHandleNative::CorWaitMultipleNative, Object* waitObjectsUNSAF
}
}
-#ifndef FEATURE_CORECLR
- if (mayRequireThreadAffinity) {
- if (waitForAll) {
- if (res >= (DWORD) WAIT_OBJECT_0 && res < (DWORD) WAIT_OBJECT_0 + numWaiters) {
- for (int i = 0; i < numWaiters; i ++) {
- if (hasThreadAffinity[i]) {
- Thread::BeginThreadAffinityAndCriticalRegion();
- }
- }
- }
- // If some mutex is abandoned
- else if (res >= (DWORD) WAIT_ABANDONED_0 && res < (DWORD) WAIT_ABANDONED_0+numWaiters) {
- for (int i = 0; i < numWaiters; i ++) {
- if (hasThreadAffinity[i])
- {
- if (WaitForSingleObject(internalHandles[i],0) == WAIT_OBJECT_0)
- {
- BOOL result;
- result = ReleaseMutex(internalHandles[i]);
- _ASSERTE (result);
- Thread::BeginThreadAffinityAndCriticalRegion();
- }
- }
- }
- }
- }
- else {
- if ( res >= (DWORD)WAIT_OBJECT_0 && res < (DWORD)WAIT_OBJECT_0 + numWaiters) {
- if (hasThreadAffinity[res - WAIT_OBJECT_0]) {
- Thread::BeginThreadAffinityAndCriticalRegion();
- }
- }
- else if (res >= (DWORD)WAIT_ABANDONED_0 && res < (DWORD)WAIT_ABANDONED_0 + numWaiters) {
- _ASSERTE (hasThreadAffinity[res - WAIT_ABANDONED_0]);
- Thread::BeginThreadAffinityAndCriticalRegion();
- }
- }
- }
-#endif // !FEATURE_CORECLR
retVal = res;
@@ -415,11 +339,6 @@ FCIMPL5(INT32, WaitHandleNative::CorSignalAndWaitOneNative, SafeHandle* safeWait
Context* defaultContext = pThread->GetDomain()->GetDefaultContext();
_ASSERTE(defaultContext);
-#ifndef FEATURE_CORECLR
- // DoSignalAndWait calls LeaveRuntime/EnterRuntime which may cause the current
- // fiber to be re-scheduled.
- ThreadAffinityAndCriticalRegionHolder affinityAndCriticalRegionHolder(hasThreadAffinity);
-#endif // !FEATURE_CORECLR
SafeHandleHolder shhSignal(&shSignal);
SafeHandleHolder shhWait(&shWait);
@@ -444,15 +363,6 @@ FCIMPL5(INT32, WaitHandleNative::CorSignalAndWaitOneNative, SafeHandle* safeWait
res = pThread->DoSignalAndWait(handles,timeout,TRUE /*alertable*/);
}
-#ifndef FEATURE_CORECLR
- if (res == WAIT_OBJECT_0 && hasThreadAffinity) {
- affinityAndCriticalRegionHolder.SuppressRelease();
- }
- else if(res == WAIT_ABANDONED_0) {
- _ASSERTE(hasThreadAffinity);
- affinityAndCriticalRegionHolder.SuppressRelease();
- }
-#endif // !FEATURE_CORECLR
retVal = res;
diff --git a/src/vm/coreassemblyspec.cpp b/src/vm/coreassemblyspec.cpp
index 310c663392..a850bab487 100644
--- a/src/vm/coreassemblyspec.cpp
+++ b/src/vm/coreassemblyspec.cpp
@@ -595,104 +595,5 @@ VOID BaseAssemblySpec::GetFileOrDisplayName(DWORD flags, SString &result) const
result));
}
-#ifndef FEATURE_CORECLR
-
-//
-// Trivial assembly binder for desktop crossgen
-//
-
-VOID AssemblySpec::Bind(AppDomain *pAppDomain,
- BOOL fThrowOnFileNotFound,
- CoreBindResult *pResult,
- BOOL fNgenExplicitBind /* = FALSE */,
- BOOL fExplicitBindToNativeImage /* = FALSE */,
- StackCrawlMark *pCallerStackMark /* = NULL */)
-{
- PEImageHolder pImage;
- BOOL fNativeImage = FALSE;
-
- if (GetCodeBase() != NULL)
- {
- // Normalize the path to maintain identity
- SString sFullAssemblyPath;
- Clr::Util::Win32::GetFullPathName(GetCodeBase(), sFullAssemblyPath, NULL);
-
- pImage = PEImage::OpenImage(sFullAssemblyPath, MDInternalImport_Default);
- }
- else
- {
- SString sSimpleName(SString::Utf8, m_pAssemblyName);
-
- fNativeImage = !IsReadyToRunCompilation() && pAppDomain->ToCompilationDomain()->IsInHardBindList(sSimpleName);
-
- SString sFileName(sSimpleName, fNativeImage ? W(".ni.dll") : W(".dll"));
-
- if (!CompilationDomain::FindImage(sFileName,
- fNativeImage ? MDInternalImport_TrustedNativeImage : MDInternalImport_Default,
- &pImage))
- {
- sFileName.Set(sSimpleName, fNativeImage ? W(".ni.exe") : W(".exe"));
-
- if (!CompilationDomain::FindImage(sFileName,
- fNativeImage ? MDInternalImport_TrustedNativeImage : MDInternalImport_Default,
- &pImage))
- {
- EEFileLoadException::Throw(sSimpleName, COR_E_FILENOTFOUND);
- }
- }
- }
-
- GetSvcLogger()->Printf(W("Loading %s\n"), pImage->GetPath().GetUnicode());
-
- NewHolder<BINDER_SPACE::Assembly> pAssembly;
- pAssembly = new BINDER_SPACE::Assembly();
-
- pAssembly->m_assemblyPath.Set(pImage->GetPath());
-
- if (fNativeImage)
- pAssembly->SetNativePEImage(pImage.Extract());
- else
- pAssembly->SetPEImage(pImage.Extract());
-
- pResult->Init(pAssembly.Extract(), TRUE, TRUE);
-}
-
-VOID AssemblySpec::BindToSystem(BINDER_SPACE::Assembly** ppAssembly)
-{
- PEImageHolder pImage;
- BOOL fNativeImage = FALSE;
-
- _ASSERTE(ppAssembly != nullptr);
-
- if (g_fAllowNativeImages)
- {
- if (CompilationDomain::FindImage(W("mscorlib.ni.dll"), MDInternalImport_TrustedNativeImage, &pImage))
- fNativeImage = TRUE;
- }
-
- if (!fNativeImage)
- {
- if (!CompilationDomain::FindImage(W("mscorlib.dll"), MDInternalImport_Default, &pImage))
- {
- EEFileLoadException::Throw(W("mscorlib.dll"), COR_E_FILENOTFOUND);
- }
- }
-
- GetSvcLogger()->Printf(W("Loading %s\n"), pImage->GetPath().GetUnicode());
-
- NewHolder<BINDER_SPACE::Assembly> pAssembly;
- pAssembly = new BINDER_SPACE::Assembly();
-
- pAssembly->m_assemblyPath.Set(pImage->GetPath());
-
- if (fNativeImage)
- pAssembly->SetNativePEImage(pImage.Extract());
- else
- pAssembly->SetPEImage(pImage.Extract());
-
- *ppAssembly = pAssembly.Extract();
-}
-
-#endif // !FEATURE_CORECLR
#endif // FEATURE_FUSION
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index e00482168d..c71c2f9879 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -89,395 +89,9 @@ extern BOOL g_fEEHostedStartup;
INT64 g_PauseTime; // Total time in millisecond the CLR has been paused
Volatile<BOOL> g_IsPaused; // True if the runtime is paused (FAS)
CLREventStatic g_ClrResumeEvent; // Event that is fired at FAS Resuming
-#ifndef FEATURE_CORECLR
-CLREventStatic g_PauseCompletedEvent; // Set when Pause has completed its work on another thread.
-#endif
-#if defined(FEATURE_CORECLR)
extern BYTE g_rbTestKeyBuffer[];
-#endif
-
-#if !defined(FEATURE_CORECLR)
-//******************************************************************************
-// <TODO>TODO: ICorThreadpool: Move this into a separate file CorThreadpool.cpp
-// after the move to VBL </TODO>
-//******************************************************************************
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorRegisterWaitForSingleObject(PHANDLE phNewWaitObject,
- HANDLE hWaitObject,
- WAITORTIMERCALLBACK Callback,
- PVOID Context,
- ULONG timeout,
- BOOL executeOnlyOnce,
- BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- ULONG flag = executeOnlyOnce ? WAIT_SINGLE_EXECUTION : 0;
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::RegisterWaitForSingleObject(phNewWaitObject,
- hWaitObject,
- Callback,
- Context,
- timeout,
- flag);
-
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorBindIoCompletionCallback(HANDLE fileHandle,
- LPOVERLAPPED_COMPLETION_ROUTINE callback)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BOOL ret = FALSE;
- DWORD errCode = 0;
-
- EX_TRY
- {
- ret = ThreadpoolMgr::BindIoCompletionCallback(fileHandle,callback,0, errCode);
- hr = (ret ? S_OK : HRESULT_FROM_WIN32(errCode));
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorUnregisterWait(HANDLE hWaitObject,
- HANDLE CompletionEvent,
- BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
-
- *pResult = ThreadpoolMgr::UnregisterWaitEx(hWaitObject,CompletionEvent);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,
- PVOID Context,BOOL executeOnlyOnce,
- BOOL* pResult )
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::QueueUserWorkItem(Function,Context,QUEUE_ONLY);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorCallOrQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,
- PVOID Context,
- BOOL* pResult )
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::QueueUserWorkItem(Function,Context,CALL_OR_QUEUE);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorCreateTimer(PHANDLE phNewTimer,
- WAITORTIMERCALLBACK Callback,
- PVOID Parameter,
- DWORD DueTime,
- DWORD Period,
- BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::CreateTimerQueueTimer(phNewTimer,Callback,Parameter,DueTime,Period,0);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorDeleteTimer(HANDLE Timer, HANDLE CompletionEvent, BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
- *pResult = ThreadpoolMgr::DeleteTimerQueueTimer(Timer,CompletionEvent);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorChangeTimer(HANDLE Timer,
- ULONG DueTime,
- ULONG Period,
- BOOL* pResult)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- *pResult = FALSE;
- EX_TRY
- {
- //CONTRACT_VIOLATION(ThrowsViolation);
- *pResult = ThreadpoolMgr::ChangeTimerQueueTimer(Timer,DueTime,Period);
- hr = (*pResult ? S_OK : HRESULT_FROM_GetLastError());
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorSetMaxThreads(DWORD MaxWorkerThreads,
- DWORD MaxIOCompletionThreads)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BOOL result = FALSE;
- EX_TRY
- {
- result = ThreadpoolMgr::SetMaxThreads(MaxWorkerThreads, MaxIOCompletionThreads);
- hr = (result ? S_OK : E_FAIL);
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorGetMaxThreads(DWORD *MaxWorkerThreads,
- DWORD *MaxIOCompletionThreads)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BOOL result = FALSE;
- EX_TRY
- {
- result = ThreadpoolMgr::GetMaxThreads(MaxWorkerThreads, MaxIOCompletionThreads);
- hr = (result ? S_OK : E_FAIL);
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE CorThreadpool::CorGetAvailableThreads(DWORD *AvailableWorkerThreads,
- DWORD *AvailableIOCompletionThreads)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BOOL result = FALSE;
- EX_TRY
- {
- result = ThreadpoolMgr::GetAvailableThreads(AvailableWorkerThreads, AvailableIOCompletionThreads);
- hr = (result ? S_OK : E_FAIL);
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-#endif // !defined(FEATURE_CORECLR)
//***************************************************************************
ULONG CorRuntimeHostBase::m_Version = 0;
@@ -666,102 +280,9 @@ CrstStatic CCLRDebugManager::m_lockConnectionNameTable;
#ifndef DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR) // simple hosting
-//*****************************************************************************
-// ICorRuntimeHost
-//*****************************************************************************
-extern BOOL g_singleVersionHosting;
-
-// *** ICorRuntimeHost methods ***
-// Returns an object for configuring the runtime prior to
-// it starting. If the runtime has been initialized this
-// routine returns an error. See ICorConfiguration.
-HRESULT CorHost::GetConfiguration(ICorConfiguration** pConfiguration)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
- HRESULT hr=E_FAIL;
- BEGIN_ENTRYPOINT_NOTHROW;
- if (CorHost::GetHostVersion() != 1)
- {
- hr=HOST_E_INVALIDOPERATION;
- }
- else
- if (!pConfiguration)
- hr= E_POINTER;
- else
- if (!m_Started)
- {
- *pConfiguration = (ICorConfiguration *) this;
- AddRef();
- hr=S_OK;
- }
- END_ENTRYPOINT_NOTHROW;
- // Cannot obtain configuration after the runtime is started
- return hr;
-}
-
-STDMETHODIMP CorHost::Start(void)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = CorRuntimeHostBase::Start();
-
- END_ENTRYPOINT_NOTHROW;
-
- if (hr == S_FALSE)
- {
- // This is to keep v1 behavior.
- hr = S_OK;
- }
- return(hr);
-}
-#endif // !defined(FEATURE_CORECLR)
// *** ICorRuntimeHost methods ***
-#ifndef FEATURE_CORECLR
-// Returns an object for configuring the runtime prior to
-// it starting. If the runtime has been initialized this
-// routine returns an error. See ICorConfiguration.
-HRESULT CorHost2::GetConfiguration(ICorConfiguration** pConfiguration)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (!pConfiguration)
- return E_POINTER;
- HRESULT hr=E_FAIL;
- BEGIN_ENTRYPOINT_NOTHROW;
- if (!m_Started)
- {
- *pConfiguration = (ICorConfiguration *) this;
- AddRef();
- hr=S_OK;
- }
- END_ENTRYPOINT_NOTHROW;
- // Cannot obtain configuration after the runtime is started
- return hr;
-}
-#endif // FEATURE_CORECLR
extern BOOL g_fWeOwnProcess;
@@ -769,11 +290,9 @@ CorHost2::CorHost2()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
m_fStarted = FALSE;
m_fFirstToLoadCLR = FALSE;
m_fAppDomainCreated = FALSE;
-#endif // FEATURE_CORECLR
}
static DangerousNonHostedSpinLock lockOnlyOneToInvokeStart;
@@ -791,7 +310,6 @@ STDMETHODIMP CorHost2::Start()
BEGIN_ENTRYPOINT_NOTHROW;
-#ifdef FEATURE_CORECLR
// Ensure that only one thread at a time gets in here
DangerousNonHostedSpinLockHolder lockHolder(&lockOnlyOneToInvokeStart);
@@ -821,7 +339,6 @@ STDMETHODIMP CorHost2::Start()
}
}
else
-#endif // FEATURE_CORECLR
{
// Using managed C++ libraries, its possible that when the runtime is already running,
// MC++ will use CorBindToRuntimeEx to make callbacks into specific appdomain of its
@@ -842,7 +359,6 @@ STDMETHODIMP CorHost2::Start()
hr = CorRuntimeHostBase::Start();
if (SUCCEEDED(hr))
{
-#ifdef FEATURE_CORECLR
// Set our flag that this host invoked the Start method.
m_fStarted = TRUE;
@@ -855,7 +371,6 @@ STDMETHODIMP CorHost2::Start()
// So, if you want to do that, just make sure you are the first host to load the
// specific version of CLR in memory AND start it.
m_fFirstToLoadCLR = TRUE;
-#endif // FEATURE_CORECLR
if (FastInterlockIncrement(&m_RefCount) != 1)
{
}
@@ -901,21 +416,6 @@ HRESULT CorRuntimeHostBase::Start()
return hr;
}
-#if !defined(FEATURE_CORECLR) // simple hosting
-HRESULT CorHost::Stop()
-{
- CONTRACTL
- {
- NOTHROW;
- ENTRY_POINT;
- if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
- }
- CONTRACTL_END;
-
- // This must remain this way (that is doing nothing) for backwards compat reasons.
- return S_OK;
-}
-#endif // !defined(FEATURE_CORECLR)
HRESULT CorHost2::Stop()
{
@@ -933,7 +433,6 @@ HRESULT CorHost2::Stop()
HRESULT hr=S_OK;
BEGIN_ENTRYPOINT_NOTHROW;
-#ifdef FEATURE_CORECLR
// Is this host eligible to invoke the Stop method?
if ((!m_fStarted) && (!m_fFirstToLoadCLR))
{
@@ -944,28 +443,21 @@ HRESULT CorHost2::Stop()
hr = HOST_E_CLRNOTAVAILABLE;
}
else
-#endif // FEATURE_CORECLR
{
while (TRUE)
{
LONG refCount = m_RefCount;
if (refCount == 0)
{
- #ifdef FEATURE_CORECLR
hr = HOST_E_CLRNOTAVAILABLE;
- #else // !FEATURE_CORECLR
- hr= E_UNEXPECTED;
- #endif // FEATURE_CORECLR
break;
}
else
if (FastInterlockCompareExchange(&m_RefCount, refCount - 1, refCount) == refCount)
{
- #ifdef FEATURE_CORECLR
// Indicate that we have got a Stop for a corresponding Start call from the
// Host. Semantically, CoreCLR has stopped for them.
m_fStarted = FALSE;
- #endif // FEATURE_CORECLR
if (refCount > 1)
{
@@ -979,125 +471,12 @@ HRESULT CorHost2::Stop()
}
}
}
-#ifndef FEATURE_CORECLR
- if (hr==S_OK)
- {
- EPolicyAction action = GetEEPolicy()->GetDefaultAction(OPR_ProcessExit, NULL);
- if (action > eExitProcess)
- {
- g_fFastExitProcess = 1;
- }
- EEShutDown(FALSE);
- }
-#endif // FEATURE_CORECLR
END_ENTRYPOINT_NOTHROW;
-#ifndef FEATURE_CORECLR
- if (hr == S_OK)
- {
- if (m_HostControl)
- {
- m_HostControl->Release();
- m_HostControl = NULL;
- }
- }
-#endif // FEATURE_CORECLR
return hr;
}
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
-
-// Creates a domain in the runtime. The identity array is
-// a pointer to an array TYPE containing IIdentity objects defining
-// the security identity.
-HRESULT CorRuntimeHostBase::CreateDomain(LPCWSTR pwzFriendlyName,
- IUnknown* pIdentityArray, // Optional
- IUnknown ** pAppDomain)
-{
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_ENTRY_POINT;
-
- return CreateDomainEx(pwzFriendlyName,
- NULL,
- NULL,
- pAppDomain);
-}
-
-
-// Returns the default domain.
-HRESULT CorRuntimeHostBase::GetDefaultDomain(IUnknown ** pAppDomain)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- } CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- if (!g_fEEStarted)
- return hr;
-
- if( pAppDomain == NULL)
- return E_POINTER;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- if (SystemDomain::System()) {
- AppDomain* pCom = SystemDomain::System()->DefaultDomain();
- if(pCom)
- hr = pCom->GetComIPForExposedObject(pAppDomain);
- }
-
- }
- END_EXTERNAL_ENTRYPOINT;
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-// Returns the default domain.
-HRESULT CorRuntimeHostBase::CurrentDomain(IUnknown ** pAppDomain)
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
- }
- CONTRACTL_END;
-
- HRESULT hr = E_UNEXPECTED;
- if (!g_fEEStarted)
- return hr;
-
- if( pAppDomain == NULL) return E_POINTER;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- AppDomain* pCom = ::GetAppDomain();
- if(pCom)
- hr = pCom->GetComIPForExposedObject(pAppDomain);
-
- }
- END_EXTERNAL_ENTRYPOINT;
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-};
-
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
HRESULT CorHost2::GetCurrentAppDomainId(DWORD *pdwAppDomainId)
{
@@ -1113,9 +492,7 @@ HRESULT CorHost2::GetCurrentAppDomainId(DWORD *pdwAppDomainId)
// We use CanRunManagedCode() instead of IsRuntimeActive() because this allows us
// to specify test using the form that does not trigger a GC.
if (!(g_fEEStarted && CanRunManagedCode(LoaderLockCheck::None))
-#ifdef FEATURE_CORECLR
|| !m_fStarted
-#endif
)
{
return HOST_E_CLRNOTAVAILABLE;
@@ -1154,64 +531,9 @@ HRESULT CorHost2::ExecuteApplication(LPCWSTR pwzAppFullName,
LPCWSTR *ppwzActivationData,
int *pReturnValue)
{
-#ifndef FEATURE_CORECLR
- // This API should not be called when the EE has already been started.
- HRESULT hr = E_UNEXPECTED;
- if (g_fEEStarted)
- return hr;
-
- //
- // We will let unhandled exceptions in the activated application
- // propagate all the way up, so that ClickOnce semi-trusted apps
- // can participate in the Dr Watson program, etc...
- //
-
- CONTRACTL {
- THROWS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (!pwzAppFullName)
- IfFailGo(E_POINTER);
-
- // Set the information about the application to execute.
- CorCommandLine::m_pwszAppFullName = (LPWSTR) pwzAppFullName;
- CorCommandLine::m_dwManifestPaths = dwManifestPaths;
- CorCommandLine::m_ppwszManifestPaths = (LPWSTR*) ppwzManifestPaths;
- CorCommandLine::m_dwActivationData = dwActivationData;
- CorCommandLine::m_ppwszActivationData = (LPWSTR*) ppwzActivationData;
-
- // Start up the EE.
- IfFailGo(Start());
-
- Thread *pThread;
- pThread = GetThread();
- if (pThread == NULL)
- pThread = SetupThreadNoThrow(&hr);
- if (pThread == NULL)
- goto ErrExit;
-
- _ASSERTE (!pThread->PreemptiveGCDisabled());
-
- hr = S_OK;
-
- BEGIN_ENTRYPOINT_THROWS_WITH_THREAD(pThread);
- ENTER_DOMAIN_PTR(SystemDomain::System()->DefaultDomain(),ADV_DEFAULTAD)
-
- SystemDomain::ActivateApplication(pReturnValue);
-
- END_DOMAIN_TRANSITION;
- END_ENTRYPOINT_THROWS_WITH_THREAD;
-
-ErrExit:
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif
}
-#ifdef FEATURE_CORECLR
/*
* This method processes the arguments sent to the host which are then used
* to invoke the main method.
@@ -1363,7 +685,6 @@ ErrExit:
return hr;
}
-#endif
HRESULT CorHost2::ExecuteInDefaultAppDomain(LPCWSTR pwzAssemblyPath,
LPCWSTR pwzTypeName,
@@ -1380,98 +701,15 @@ HRESULT CorHost2::ExecuteInDefaultAppDomain(LPCWSTR pwzAssemblyPath,
// No point going further if the runtime is not running...
if (!IsRuntimeActive()
-#ifdef FEATURE_CORECLR
|| !m_fStarted
-#endif
)
{
return HOST_E_CLRNOTAVAILABLE;
}
-#ifndef FEATURE_CORECLR
- if(! (pwzAssemblyPath && pwzTypeName && pwzMethodName) )
- return E_POINTER;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- Thread *pThread = GetThread();
- if (pThread == NULL)
- {
- pThread = SetupThreadNoThrow(&hr);
- if (pThread == NULL)
- {
- goto ErrExit;
- }
- }
-
- _ASSERTE (!pThread->PreemptiveGCDisabled());
-
- EX_TRY
- {
- ENTER_DOMAIN_PTR(SystemDomain::System()->DefaultDomain(),ADV_DEFAULTAD)
-
- INSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
- Assembly *pAssembly = AssemblySpec::LoadAssembly(pwzAssemblyPath);
-
- SString szTypeName(pwzTypeName);
- StackScratchBuffer buff1;
- const char* szTypeNameUTF8 = szTypeName.GetUTF8(buff1);
- MethodTable *pMT = ClassLoader::LoadTypeByNameThrowing(pAssembly,
- NULL,
- szTypeNameUTF8).AsMethodTable();
-
- SString szMethodName(pwzMethodName);
- StackScratchBuffer buff;
- const char* szMethodNameUTF8 = szMethodName.GetUTF8(buff);
- MethodDesc *pMethodMD = MemberLoader::FindMethod(pMT, szMethodNameUTF8, &gsig_SM_Str_RetInt);
-
- if (!pMethodMD)
- {
- hr = COR_E_MISSINGMETHOD;
- }
- else
- {
- GCX_COOP();
-
- MethodDescCallSite method(pMethodMD);
-
- STRINGREF sref = NULL;
- GCPROTECT_BEGIN(sref);
-
- if (pwzArgument)
- sref = StringObject::NewString(pwzArgument);
-
- ARG_SLOT MethodArgs[] =
- {
- ObjToArgSlot(sref)
- };
- DWORD retval = method.Call_RetI4(MethodArgs);
- if (pReturnValue)
- {
- *pReturnValue = retval;
- }
-
- GCPROTECT_END();
- }
-
- UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
- END_DOMAIN_TRANSITION;
- }
- EX_CATCH_HRESULT(hr);
-
-ErrExit:
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-#else // FEATURE_CORECLR
// Ensure that code is not loaded in the Default AppDomain
return HOST_E_INVALIDOPERATION;
-#endif
}
HRESULT ExecuteInAppDomainHelper(FExecuteInAppDomainCallback pCallback,
@@ -1496,22 +734,18 @@ HRESULT CorHost2::ExecuteInAppDomain(DWORD dwAppDomainId,
// No point going further if the runtime is not running...
if (!IsRuntimeActive()
-#ifdef FEATURE_CORECLR
|| !m_fStarted
-#endif // FEATURE_CORECLR
)
{
return HOST_E_CLRNOTAVAILABLE;
}
-#ifdef FEATURE_CORECLR
if(!(m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN))
{
// Ensure that code is not loaded in the Default AppDomain
if (dwAppDomainId == DefaultADID)
return HOST_E_INVALIDOPERATION;
}
-#endif // FEATURE_CORECLR
// Moved this here since no point validating the pointer
// if the basic checks [above] fail
@@ -1555,9 +789,6 @@ HRESULT CorHost2::_CreateAppDomain(
int nProperties,
LPCWSTR* pPropertyNames,
LPCWSTR* pPropertyValues,
-#if !defined(FEATURE_CORECLR)
- ICLRPrivBinder* pBinder,
-#endif
DWORD* pAppDomainID)
{
CONTRACTL
@@ -1570,13 +801,11 @@ HRESULT CorHost2::_CreateAppDomain(
HRESULT hr=S_OK;
-#ifdef FEATURE_CORECLR
//cannot call the function more than once when single appDomain is allowed
if (m_fAppDomainCreated && (m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN))
{
return HOST_E_INVALIDOPERATION;
}
-#endif
//normalize empty strings
EMPTY_STRING_TO_NULL(wszFriendlyName);
@@ -1586,10 +815,8 @@ HRESULT CorHost2::_CreateAppDomain(
if(pAppDomainID==NULL)
return E_POINTER;
-#ifdef FEATURE_CORECLR
if (!m_fStarted)
return HOST_E_INVALIDOPERATION;
-#endif // FEATURE_CORECLR
if(wszFriendlyName == NULL)
return E_INVALIDARG;
@@ -1604,26 +831,22 @@ HRESULT CorHost2::_CreateAppDomain(
AppDomainCreationHolder<AppDomain> pDomain;
-#ifdef FEATURE_CORECLR
// If StartupFlag specifies single appDomain then return the default domain instead of creating new one
if(m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN)
{
pDomain.Assign(SystemDomain::System()->DefaultDomain());
}
else
-#endif
{
AppDomain::CreateUnmanagedObject(pDomain);
}
ETW::LoaderLog::DomainLoad(pDomain, (LPWSTR)wszFriendlyName);
-#ifdef FEATURE_CORECLR
if (dwFlags & APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS)
{
pDomain->SetIgnoreUnhandledExceptions();
}
-#endif // FEATURE_CORECLR
if (dwFlags & APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE)
pDomain->SetReversePInvokeCannotEnter();
@@ -1631,10 +854,6 @@ HRESULT CorHost2::_CreateAppDomain(
if (dwFlags & APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS)
pDomain->SetForceTrivialWaitOperations();
-#if !defined(FEATURE_CORECLR)
- if (pBinder != NULL)
- pDomain->SetLoadContextHostBinder(pBinder);
-#endif
#ifdef PROFILING_SUPPORTED
EX_TRY
@@ -1689,12 +908,8 @@ HRESULT CorHost2::_CreateAppDomain(
args[1]=ObjToArgSlot(NULL);
args[2]=ObjToArgSlot(NULL);
args[3]=ObjToArgSlot(NULL);
-#ifdef FEATURE_CORECLR
//CoreCLR shouldn't have dependencies on parent app domain.
args[4]=ObjToArgSlot(NULL);
-#else
- args[4]=PtrToArgSlot(GetAppDomain()->GetSecurityDescriptor());
-#endif //FEATURE_CORECLR
args[5]=ObjToArgSlot(_gc.sandboxName);
args[6]=ObjToArgSlot(_gc.propertyNames);
args[7]=ObjToArgSlot(_gc.propertyValues);
@@ -1707,12 +922,6 @@ HRESULT CorHost2::_CreateAppDomain(
PTRARRAYREF handleArrayObj = (PTRARRAYREF) ObjectToOBJECTREF(_gc.setupInfo);
_gc.adSetup = ObjectToOBJECTREF(handleArrayObj->GetAt(1));
-#ifndef FEATURE_CORECLR
- // We need to setup domain sorting before any other managed code runs in the domain, since that code
- // could end up caching data based on the sorting mode of the domain.
- pDomain->InitializeSorting(&_gc.adSetup);
- pDomain->InitializeHashing(&_gc.adSetup);
-#endif
pDomain->DoSetup(&_gc.setupInfo);
@@ -1722,13 +931,11 @@ HRESULT CorHost2::_CreateAppDomain(
*pAppDomainID=pDomain->GetId().m_dwId;
-#ifdef FEATURE_CORECLR
// If StartupFlag specifies single appDomain then set the flag that appdomain has already been created
if(m_dwStartupFlags & STARTUP_SINGLE_APPDOMAIN)
{
m_fAppDomainCreated = TRUE;
}
-#endif
}
#ifdef PROFILING_SUPPORTED
EX_HOOK
@@ -1798,7 +1005,6 @@ HRESULT CorHost2::_CreateDelegate(
if(wszMethodName == NULL)
return E_INVALIDARG;
-#ifdef FEATURE_CORECLR
if (!m_fStarted)
return HOST_E_INVALIDOPERATION;
@@ -1808,7 +1014,6 @@ HRESULT CorHost2::_CreateDelegate(
if (appDomainID == DefaultADID)
return HOST_E_INVALIDOPERATION;
}
-#endif
BEGIN_ENTRYPOINT_NOTHROW;
@@ -1856,11 +1061,9 @@ HRESULT CorHost2::_CreateDelegate(
if (pMD==NULL || !pMD->IsStatic() || pMD->ContainsGenericVariables())
ThrowHR(COR_E_MISSINGMETHOD);
-#ifdef FEATURE_CORECLR
// the target method must be decorated with AllowReversePInvokeCallsAttribute
if (!COMDelegate::IsMethodAllowedToSinkReversePInvoke(pMD))
ThrowHR(COR_E_SECURITY);
-#endif
UMEntryThunk *pUMEntryThunk = GetAppDomain()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
*fnPtr = (INT_PTR)pUMEntryThunk->GetCode();
@@ -1874,7 +1077,6 @@ HRESULT CorHost2::_CreateDelegate(
return hr;
}
-#ifdef FEATURE_CORECLR
HRESULT CorHost2::CreateAppDomainWithManager(
LPCWSTR wszFriendlyName,
DWORD dwFlags,
@@ -1957,70 +1159,7 @@ HRESULT CorHost2::SetStartupFlags(STARTUP_FLAGS flag)
return S_OK;
}
-#endif //FEATURE_CORECLR
-
-#ifndef FEATURE_CORECLR
-void PauseOneAppDomain(AppDomainIterator* pi)
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- EX_TRY {
- ENTER_DOMAIN_PTR(pi->GetDomain(),ADV_ITERATOR);
-
- MethodDescCallSite(METHOD__APP_DOMAIN__PAUSE).Call(NULL);
-
- END_DOMAIN_TRANSITION;
- } EX_CATCH {
- } EX_END_CATCH(SwallowAllExceptions);
-}
-
-void ResumeOneAppDomain(AppDomainIterator* pi)
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- EX_TRY {
- ENTER_DOMAIN_PTR(pi->GetDomain(),ADV_ITERATOR);
-
- MethodDescCallSite(METHOD__APP_DOMAIN__RESUME).Call(NULL);
-
- END_DOMAIN_TRANSITION;
- } EX_CATCH {
- } EX_END_CATCH(SwallowAllExceptions);
-}
-
-// see comments in SuspendEEFromPause
-DWORD WINAPI SuspendAndResumeForPause(LPVOID arg)
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_ANY;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- ThreadSuspend::SuspendEE(ThreadSuspend::SUSPEND_OTHER);
-
- g_PauseCompletedEvent.Set();
- g_ClrResumeEvent.Wait(INFINITE, FALSE);
-
- ThreadSuspend::RestartEE(FALSE, TRUE);
- return 0;
-}
-#endif // !FEATURE_CORECLR
HRESULT SuspendEEForPause()
{
@@ -2034,33 +1173,9 @@ HRESULT SuspendEEForPause()
HRESULT hr = S_OK;
-#ifdef FEATURE_CORECLR
// In CoreCLR, we always resume from the same thread that paused. So we can simply suspend the EE from this thread,
// knowing we'll restart from the same thread.
ThreadSuspend::SuspendEE(ThreadSuspend::SUSPEND_OTHER);
-#else
- // In the CLR, we can resume from a different thread than the one that paused. We can't call SuspendEE directly,
- // because we can't call RestartEE from another thread. So we queue a workitem to the ThreadPool to call SuspendEE
- // and ResumeEE on our behalf.
-
- EX_TRY
- {
- if (!ThreadpoolMgr::QueueUserWorkItem(SuspendAndResumeForPause, NULL, QUEUE_ONLY))
- {
- hr = HRESULT_FROM_GetLastError();
- }
- else
- {
- // wait for SuspendEE to complete before returning.
- g_PauseCompletedEvent.Wait(INFINITE,FALSE);
- }
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-#endif
return hr;
}
@@ -2076,12 +1191,7 @@ HRESULT RestartEEFromPauseAndSetResumeEvent()
CONTRACTL_END;
// see comments in SuspendEEFromPause
-#ifdef FEATURE_CORECLR
ThreadSuspend::RestartEE(FALSE, TRUE);
-#else
- // setting the resume event below will restart the EE as well. We don't wait for the restart
- // to complete, because we'll sync with it next time we go to cooperative mode.
-#endif
_ASSERTE(g_ClrResumeEvent.IsValid());
g_ClrResumeEvent.Set();
@@ -2111,10 +1221,6 @@ HRESULT CorExecutionManager::Pause(DWORD dwAppDomainId, DWORD dwFlags)
HRESULT hr = S_OK;
-#ifndef FEATURE_CORECLR
- if (!IsRuntimeActive())
- return HOST_E_CLRNOTAVAILABLE;
-#endif
if(g_IsPaused)
return E_FAIL;
@@ -2126,12 +1232,6 @@ HRESULT CorExecutionManager::Pause(DWORD dwAppDomainId, DWORD dwFlags)
else
g_ClrResumeEvent.Reset();
-#ifndef FEATURE_CORECLR
- if (!g_PauseCompletedEvent.IsValid())
- g_PauseCompletedEvent.CreateManualEvent(FALSE);
- else
- g_PauseCompletedEvent.Reset();
-#endif
}
EX_CATCH_HRESULT(hr);
@@ -2142,20 +1242,6 @@ HRESULT CorExecutionManager::Pause(DWORD dwAppDomainId, DWORD dwFlags)
m_dwFlags = dwFlags;
-#ifndef FEATURE_CORECLR
- if ((m_dwFlags & PAUSE_APP_DOMAINS) != 0)
- {
- Thread* pThread = SetupThreadNoThrow(&hr);
- if (pThread != NULL)
- {
- GCX_COOP_THREAD_EXISTS(pThread);
-
- AppDomainIterator ai(/*bOnlyActive:*/ TRUE);
- while (ai.Next())
- PauseOneAppDomain(&ai);
- }
- }
-#endif
if (SUCCEEDED(hr))
{
@@ -2185,15 +1271,10 @@ HRESULT CorExecutionManager::Resume(DWORD dwAppDomainId)
HRESULT hr = S_OK;
-#ifndef FEATURE_CORECLR
- if (!IsRuntimeActive())
- return HOST_E_CLRNOTAVAILABLE;
-#endif
if(!g_IsPaused)
return E_FAIL;
-#ifdef FEATURE_CORECLR
// GCThread is the thread that did the Pause. Resume should also happen on that same thread
Thread *pThread = GetThread();
if(pThread != ThreadSuspend::GetSuspensionThread())
@@ -2201,7 +1282,6 @@ HRESULT CorExecutionManager::Resume(DWORD dwAppDomainId)
_ASSERTE(!"HOST BUG: The same thread that did Pause should do the Resume");
return E_FAIL;
}
-#endif
BEGIN_ENTRYPOINT_NOTHROW;
@@ -2215,23 +1295,6 @@ HRESULT CorExecutionManager::Resume(DWORD dwAppDomainId)
hr = RestartEEFromPauseAndSetResumeEvent();
-#ifndef FEATURE_CORECLR
- if (SUCCEEDED(hr))
- {
- if ((m_dwFlags & PAUSE_APP_DOMAINS) != 0)
- {
- Thread* pThread = SetupThreadNoThrow(&hr);
- if (pThread != NULL)
- {
- GCX_COOP_THREAD_EXISTS(pThread);
-
- AppDomainIterator ai(/*bOnlyActive:*/ TRUE);
- while (ai.Next())
- ResumeOneAppDomain(&ai);
- }
- }
- }
-#endif
END_ENTRYPOINT_NOTHROW;
@@ -2241,7 +1304,6 @@ HRESULT CorExecutionManager::Resume(DWORD dwAppDomainId)
#endif //!DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
#ifndef DACCESS_COMPILE
SVAL_IMPL(STARTUP_FLAGS, CorHost2, m_dwStartupFlags = STARTUP_CONCURRENT_GC);
#else
@@ -2252,347 +1314,9 @@ STARTUP_FLAGS CorHost2::GetStartupFlags()
{
return m_dwStartupFlags;
}
-#endif //FEATURE_CORECLR
#ifndef DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR)
-/*************************************************************************************
- ** ICLRPrivRuntime Methods
- *************************************************************************************/
-
-HRESULT CorHost2::GetInterface(
- REFCLSID rclsid,
- REFIID riid,
- LPVOID * ppUnk)
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- } CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- EX_TRY
- {
- if (rclsid == __uuidof(CLRPrivAppXBinder))
- {
- CLRPrivBinderAppX * pBinder = CLRPrivBinderAppX::GetOrCreateBinder();
- hr = pBinder->QueryInterface(riid, ppUnk);
- }
- else
- {
- hr = E_NOINTERFACE;
- }
- }
- EX_CATCH_HRESULT(hr);
-
- return hr;
-}
-
-HRESULT CorHost2::CreateAppDomain(
- LPCWSTR pwzFriendlyName,
- ICLRPrivBinder * pBinder,
- LPDWORD pdwAppDomainId)
-{
- return _CreateAppDomain(
- pwzFriendlyName,
- 0 /* default security */,
- nullptr, /* domain manager */
- nullptr, /* domain manager */
- 0, /* property count */
- nullptr, /* property names */
- nullptr, /* property values */
- pBinder,
- pdwAppDomainId);
-}
-
-HRESULT CorHost2::CreateDelegate(
- DWORD appDomainID,
- LPCWSTR wszAssemblyName,
- LPCWSTR wszClassName,
- LPCWSTR wszMethodName,
- LPVOID * ppvDelegate)
-{
- return _CreateDelegate(appDomainID, wszAssemblyName, wszClassName,
- wszMethodName, reinterpret_cast<INT_PTR*>(ppvDelegate));
-}
-
-// Flag indicating if the EE was started up by an managed exe. Defined in ceemain.cpp.
-extern BOOL g_fEEManagedEXEStartup;
-
-HRESULT CorHost2::ExecuteMain(
- ICLRPrivBinder * pBinder,
- int * pRetVal)
-{
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_ENTRY_POINT;
-
- HRESULT hr = S_OK;
-
- // If an exception passes through here, it will cause the
- // "The application has generated an unhandled exception" dialog and offer to debug.
- BEGIN_ENTRYPOINT_THROWS;
-
- // Indicates that the EE was started up by a managed exe.
- g_fEEManagedEXEStartup = TRUE;
-
- IfFailGo(CorCommandLine::SetArgvW(WszGetCommandLine()));
-
- IfFailGo(EnsureEEStarted(COINITEE_MAIN));
-
- INSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
- //
- // Look for the [STAThread] or [MTAThread] attribute
- // TODO delete this code when we move to the default AppDomain
- //
- HMODULE hMod = WszGetModuleHandle(NULL);
-
- PEImageHolder pTempImage(PEImage::LoadImage(hMod));
- PEFileHolder pTempFile(PEFile::Open(pTempImage.Extract()));
-
- // Check for CustomAttributes - Set up the DefaultDomain and the main thread
- // Note that this has to be done before ExplicitBind() as it
- // affects the bind
- mdToken tkEntryPoint = pTempFile->GetEntryPointToken();
- // <TODO>@TODO: What if the entrypoint is in another file of the assembly?</TODO>
- ReleaseHolder<IMDInternalImport> scope(pTempFile->GetMDImportWithRef());
- // In theory, we should have a valid executable image and scope should never be NULL, but we've been
- // getting Watson failures for AVs here due to ISVs modifying image headers and some new OS loader
- // checks (see Dev10# 718530 and Windows 7# 615596)
- if (scope == NULL)
- {
- ThrowHR(COR_E_BADIMAGEFORMAT);
- }
-
- Thread::ApartmentState state = Thread::AS_Unknown;
-
- if((!IsNilToken(tkEntryPoint)) && (TypeFromToken(tkEntryPoint) == mdtMethodDef)) {
- if (scope->IsValidToken(tkEntryPoint))
- state = SystemDomain::GetEntryPointThreadAptState(scope, tkEntryPoint);
- else
- ThrowHR(COR_E_BADIMAGEFORMAT);
- }
-
- BOOL fSetGlobalSharePolicyUsingAttribute = FALSE;
-
- if((!IsNilToken(tkEntryPoint)) && (TypeFromToken(tkEntryPoint) == mdtMethodDef))
- {
- // The global share policy needs to be set before initializing default domain
- // so that it is in place for loading of appdomain manager.
- fSetGlobalSharePolicyUsingAttribute = SystemDomain::SetGlobalSharePolicyUsingAttribute(scope, tkEntryPoint);
- }
-
- // If the entry point has an explicit thread apartment state, set it
- // before running the AppDomainManager initialization code.
- if (state == Thread::AS_InSTA || state == Thread::AS_InMTA)
- SystemDomain::SetThreadAptState(scope, state);
-
- // This can potentially run managed code.
- SystemDomain::InitializeDefaultDomain(FALSE, pBinder);
-
- // If we haven't set an explicit thread apartment state, set it after the
- // AppDomainManager has got a chance to go set it in InitializeNewDomain.
- if (state != Thread::AS_InSTA && state != Thread::AS_InMTA)
- SystemDomain::SetThreadAptState(scope, state);
-
- if (fSetGlobalSharePolicyUsingAttribute)
- SystemDomain::System()->DefaultDomain()->SetupLoaderOptimization(g_dwGlobalSharePolicy);
-
- ADID adId(DefaultADID);
-
- GCX_COOP();
-
- ENTER_DOMAIN_ID(adId)
- TESTHOOKCALL(EnteredAppDomain(adId.m_dwId));
- {
- GCX_PREEMP();
-
- AppDomain *pDomain = GetAppDomain();
- _ASSERTE(pDomain);
-
- PathString wzExeFileName;
-
- if (WszGetModuleFileName(nullptr, wzExeFileName) == 0)
- IfFailThrow(E_UNEXPECTED);
-
- LPWSTR wzExeSimpleFileName = nullptr;
- size_t cchExeSimpleFileName = 0;
- SplitPathInterior(
- wzExeFileName,
- nullptr, nullptr, // drive
- nullptr, nullptr, // dir
- (LPCWSTR*)&wzExeSimpleFileName, &cchExeSimpleFileName, // filename
- nullptr, nullptr); // ext
-
- // Remove the extension
- wzExeSimpleFileName[cchExeSimpleFileName] = W('\0');
-
- ReleaseHolder<IAssemblyName> pAssemblyName;
- IfFailThrow(CreateAssemblyNameObject(
- &pAssemblyName, // Returned IAssemblyName
- wzExeSimpleFileName, // Name of assembly
- CANOF_PARSE_DISPLAY_NAME, // Parse as display name
- nullptr)); // Reserved
-
- AssemblySpec specExe;
- specExe.InitializeSpec(pAssemblyName, nullptr, false);
-
- PEAssemblyHolder pPEAssembly = pDomain->BindAssemblySpec(&specExe, TRUE, FALSE);
-
- pDomain->SetRootAssembly(pDomain->LoadAssembly(NULL, pPEAssembly, FILE_ACTIVE));
-
- LOG((LF_CLASSLOADER | LF_CORDB,
- LL_INFO10,
- "Created domain for an executable at %p\n",
- (pDomain->GetRootAssembly()? pDomain->GetRootAssembly()->Parent() : NULL)));
- TESTHOOKCALL(RuntimeStarted(RTS_CALLINGENTRYPOINT));
-
- // Set the friendly name to indicate that this is an immersive domain.
- pDomain->SetFriendlyName(W("Immersive Application Domain"), TRUE);
-
- // Execute the main method
- // NOTE: we call the entry point with our entry point exception filter active
- // after the AppDomain transition which is a bit different from classic apps.
- // this is so that we have the correct context when notifying the debugger
- // or invoking WER on the main thread and mimics the behavior of classic apps.
- // the assumption is that AppX entry points are always invoked post-AD transition.
- ExecuteMainInner(pDomain->GetRootAssembly());
-
- // Get the global latched exit code instead of the return value from ExecuteMainMethod
- // because in the case of a "void Main" method the return code is always 0,
- // while the latched exit code is set in either case.
- *pRetVal = GetLatchedExitCode();
- }
- END_DOMAIN_TRANSITION;
- TESTHOOKCALL(LeftAppDomain(adId.m_dwId));
-
- UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
-
-ErrExit:
- END_ENTRYPOINT_THROWS;
-
- return hr;
-}
-
-VOID CorHost2::ExecuteMainInner(Assembly* pRootAssembly)
-{
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_ENTRY_POINT;
-
- struct Param
- {
- Assembly* pRootAssembly;
- } param;
-
- param.pRootAssembly = pRootAssembly;
-
- PAL_TRY(Param*, pParam, &param)
- {
- // since this is the thread 0 entry point for AppX apps we use
- // the EntryPointFilter so that an unhandled exception here will
- // trigger the same behavior as in classic apps.
- pParam->pRootAssembly->ExecuteMainMethod(NULL, TRUE /* waitForOtherThreads */);
- }
- PAL_EXCEPT_FILTER(EntryPointFilter)
- {
- LOG((LF_STARTUP, LL_INFO10, "EntryPointFilter returned EXCEPTION_EXECUTE_HANDLER!"));
- }
- PAL_ENDTRY
-}
-
-// static
-HRESULT CorHost2::SetFlagsAndHostConfig(STARTUP_FLAGS dwStartupFlags, LPCWSTR pwzHostConfigFile, BOOL fFinalize)
-{
- WRAPPER_NO_CONTRACT;
-
- HRESULT hr = E_INVALIDARG;
-
- if (pwzHostConfigFile == NULL)
- pwzHostConfigFile = W("");
-
- DangerousNonHostedSpinLockHolder lockHolder(&m_FlagsLock);
-
- if (m_dwFlagsFinalized)
- {
- // verify that flags and config file are the same
- if (dwStartupFlags == m_dwStartupFlags &&
- _wcsicmp(pwzHostConfigFile, m_wzHostConfigFile) == 0)
- {
- hr = S_OK;
- }
- }
- else
- {
- // overwrite the flags and config with the incoming values
- if (wcslen(pwzHostConfigFile) < COUNTOF(m_wzHostConfigFile))
- {
- VERIFY(wcscpy_s(m_wzHostConfigFile, COUNTOF(m_wzHostConfigFile), pwzHostConfigFile) == 0);
-
- // If they asked for the server gc but only have one processor, deny that option.
- // Keep this in sync with shim logic in ComputeStartupFlagsAndFlavor that also switches to
- // the workstation GC on uniprocessor boxes.
- if (g_SystemInfo.dwNumberOfProcessors == 1 && (dwStartupFlags & STARTUP_SERVER_GC))
- dwStartupFlags = (STARTUP_FLAGS)(dwStartupFlags & ~(STARTUP_SERVER_GC | STARTUP_CONCURRENT_GC));
-
- m_dwStartupFlags = dwStartupFlags;
-
- if (fFinalize)
- m_dwFlagsFinalized = TRUE;
-
- hr = S_OK;
- }
- }
-
- return hr;
-}
-
-// static
-STARTUP_FLAGS CorHost2::GetStartupFlags()
-{
- WRAPPER_NO_CONTRACT;
-
- if (!m_dwFlagsFinalized) // make sure we return consistent results
- {
- DangerousNonHostedSpinLockHolder lockHolder(&m_FlagsLock);
- m_dwFlagsFinalized = TRUE;
- }
-
- return m_dwStartupFlags;
-}
-
-// static
-LPCWSTR CorHost2::GetHostConfigFile()
-{
- WRAPPER_NO_CONTRACT;
-
- if (!m_dwFlagsFinalized) // make sure we return consistent results
- {
- DangerousNonHostedSpinLockHolder lockHolder(&m_FlagsLock);
- m_dwFlagsFinalized = TRUE;
- }
-
- return m_wzHostConfigFile;
-}
-
-// static
-void CorHost2::GetDefaultAppDomainProperties(StringArrayList **pPropertyNames, StringArrayList **pPropertyValues)
-{
- LIMITED_METHOD_CONTRACT;
-
- // We should only read these after the runtime has started to ensure that the host isn't modifying them
- // still
- _ASSERTE(g_fEEStarted || HasStarted());
-
- *pPropertyNames = &s_defaultDomainPropertyNames;
- *pPropertyValues = &s_defaultDomainPropertyValues;
-}
-
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
@@ -2644,370 +1368,12 @@ HRESULT GetCLRRuntimeHost(REFIID riid, IUnknown **ppUnk)
return CorHost2::CreateObject(riid, (void**)ppUnk);
}
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
-
-HRESULT NextDomainWorker(AppDomainIterator *pEnum,
- IUnknown** pAppDomain)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW); // nothrow contract's fs:0 handler gets called before the C++ EH fs:0 handler which is pushed in the prolog
- GC_TRIGGERS;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- Thread *pThread = GetThread();
- BEGIN_SO_INTOLERANT_CODE_NOTHROW(pThread, return COR_E_STACKOVERFLOW);
-
- EX_TRY
- {
- GCX_COOP_THREAD_EXISTS(pThread);
-
- if (pEnum->Next())
- {
- AppDomain* pDomain = pEnum->GetDomain();
- // Need to enter the AppDomain to synchronize access to the exposed
- // object properly (can't just take the system domain mutex since we
- // might need to run code that uses higher ranking crsts).
- ENTER_DOMAIN_PTR(pDomain,ADV_ITERATOR)
- {
-
- hr = pDomain->GetComIPForExposedObject(pAppDomain);
- }
- END_DOMAIN_TRANSITION;
- }
- else
- {
- hr = S_FALSE;
- }
- }
- EX_CATCH_HRESULT(hr);
-
- END_SO_INTOLERANT_CODE;
-
- return hr;
-}
-
-// Returns S_FALSE when there are no more domains. A domain
-// is passed out only when S_OK is returned.
-HRESULT CorRuntimeHostBase::NextDomain(HDOMAINENUM hEnum,
- IUnknown** pAppDomain)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if(hEnum == NULL || pAppDomain == NULL)
- return E_POINTER;
-
- // If the runtime has not started, we have nothing to do.
- if (!g_fEEStarted)
- {
- return HOST_E_CLRNOTAVAILABLE;
- }
-
- HRESULT hr;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- AppDomainIterator *pEnum = (AppDomainIterator *) hEnum;
-
- do
- {
- hr = NextDomainWorker(pEnum, pAppDomain);
- // Might need to look at the next appdomain if we were attempting to get at
- // the exposed appdomain object and were chucked out as the result of an
- // appdomain unload.
- } while (hr == COR_E_APPDOMAINUNLOADED);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-// Creates a domain in the runtime. The identity array is
-// a pointer to an array TYPE containing IIdentity objects defining
-// the security identity.
-HRESULT CorRuntimeHostBase::CreateDomainEx(LPCWSTR pwzFriendlyName,
- IUnknown* pSetup, // Optional
- IUnknown* pEvidence, // Optional
- IUnknown ** pAppDomain)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- if(!pwzFriendlyName) return E_POINTER;
- if(pAppDomain == NULL) return E_POINTER;
- if(!g_fEEStarted) return E_FAIL;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- struct _gc {
- STRINGREF pName;
- OBJECTREF pSetup;
- OBJECTREF pEvidence;
- APPDOMAINREF pDomain;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- if (FAILED(hr = EnsureComStartedNoThrow()))
- goto lDone;
-
- GCPROTECT_BEGIN(gc);
-
- gc.pName = StringObject::NewString(pwzFriendlyName);
-
- if(pSetup)
- GetObjectRefFromComIP(&gc.pSetup, pSetup);
- if(pEvidence)
- GetObjectRefFromComIP(&gc.pEvidence, pEvidence);
-
- MethodDescCallSite createDomain(METHOD__APP_DOMAIN__CREATE_DOMAIN);
-
- ARG_SLOT args[3] = {
- ObjToArgSlot(gc.pName),
- ObjToArgSlot(gc.pEvidence),
- ObjToArgSlot(gc.pSetup),
- };
-
- gc.pDomain = (APPDOMAINREF) createDomain.Call_RetOBJECTREF(args);
-
- *pAppDomain = GetComIPFromObjectRef((OBJECTREF*) &gc.pDomain);
-
- GCPROTECT_END();
-
-lDone: ;
- }
- END_EXTERNAL_ENTRYPOINT;
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-// Close the enumeration releasing resources
-HRESULT CorRuntimeHostBase::CloseEnum(HDOMAINENUM hEnum)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- if(hEnum) {
- AppDomainIterator* pEnum = (AppDomainIterator*) hEnum;
- delete pEnum;
- }
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT CorRuntimeHostBase::CreateDomainSetup(IUnknown **pAppDomainSetup)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- MODE_PREEMPTIVE;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- if (!pAppDomainSetup)
- return E_POINTER;
-
- // If the runtime has not started, we have nothing to do.
- if (!g_fEEStarted)
- {
- return HOST_E_CLRNOTAVAILABLE;
- }
-
- // Create the domain.
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- struct _gc {
- OBJECTREF pSetup;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
- MethodTable* pMT = NULL;
-
- hr = EnsureComStartedNoThrow();
- if (FAILED(hr))
- goto lDone;
-
- pMT = MscorlibBinder::GetClass(CLASS__APPDOMAIN_SETUP);
-
- GCPROTECT_BEGIN(gc);
- gc.pSetup = AllocateObject(pMT);
- *pAppDomainSetup = GetComIPFromObjectRef((OBJECTREF*) &gc.pSetup);
- GCPROTECT_END();
-
-lDone: ;
- }
- END_EXTERNAL_ENTRYPOINT;
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-HRESULT CorRuntimeHostBase::CreateEvidence(IUnknown **pEvidence)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- if (!pEvidence)
- return E_POINTER;
-
-#ifdef FEATURE_CAS_POLICY
-
- // If the runtime has not started, we have nothing to do.
- if (!g_fEEStarted)
- {
- return HOST_E_CLRNOTAVAILABLE;
- }
-
- // Create the domain.
- BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr);
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- struct _gc {
- OBJECTREF pEvidence;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- MethodTable* pMT = NULL;
-
- hr = EnsureComStartedNoThrow();
- if (FAILED(hr))
- goto lDone;
-
- pMT = MscorlibBinder::GetClass(CLASS__EVIDENCE);
-
- GCPROTECT_BEGIN(gc);
- gc.pEvidence = AllocateObject(pMT);
- MethodDescCallSite ctor(METHOD__EVIDENCE__CTOR, &(gc.pEvidence));
-
- // Call the Evidence class constructor.
- ARG_SLOT CtorArgs[] =
- {
- ObjToArgSlot(gc.pEvidence)
- };
- ctor.Call(CtorArgs);
-
- *pEvidence = GetComIPFromObjectRef((OBJECTREF*) &gc.pEvidence);
- GCPROTECT_END();
-
-lDone: ;
- }
- END_EXTERNAL_ENTRYPOINT;
- END_ENTRYPOINT_NOTHROW;
-#else // !FEATURE_CAS_POLICY
- // There is no Evidence class support without CAS policy.
- return E_NOTIMPL;
-#endif // FEATURE_CAS_POLICY
-
- return hr;
-}
-
-HRESULT CorRuntimeHostBase::UnloadDomain(IUnknown *pUnkDomain)
-{
- CONTRACTL
- {
- DISABLED(NOTHROW);
- GC_TRIGGERS;
- MODE_ANY;
- FORBID_FAULT;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (!pUnkDomain)
- return E_POINTER;
-
- // If the runtime has not started, we have nothing to do.
- if (!g_fEEStarted)
- {
- return HOST_E_CLRNOTAVAILABLE;
- }
-
- CONTRACT_VIOLATION(FaultViolation); // This entire function is full of OOM potential: must fix.
-
- HRESULT hr = S_OK;
- DWORD dwDomainId = 0;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- _ASSERTE (g_fComStarted);
-
- {
- SystemDomain::LockHolder lh;
-
- ComCallWrapper* pWrap = GetCCWFromIUnknown(pUnkDomain, FALSE);
- if (!pWrap)
- {
- hr = COR_E_APPDOMAINUNLOADED;
- }
- if (SUCCEEDED(hr))
- {
- dwDomainId = pWrap->GetDomainID().m_dwId;
- }
- }
- if (SUCCEEDED(hr))
- {
- hr = UnloadAppDomain(dwDomainId, TRUE);
- }
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
STDMETHODIMP CorHost2::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone)
{
WRAPPER_NO_CONTRACT;
STATIC_CONTRACT_SO_TOLERANT;
-#ifdef FEATURE_CORECLR
if (!m_fStarted)
return HOST_E_INVALIDOPERATION;
@@ -3056,7 +1422,6 @@ STDMETHODIMP CorHost2::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone)
return hr;
}
else
-#endif // FEATURE_CORECLR
return CorRuntimeHostBase::UnloadAppDomain(dwDomainId, fWaitUntilDone);
}
@@ -3093,9 +1458,7 @@ HRESULT CorRuntimeHostBase::UnloadAppDomain(DWORD dwDomainId, BOOL fSync)
// for this scope only.
CONTRACT_VIOLATION(FaultViolation);
if (!IsRuntimeActive()
- #ifdef FEATURE_CORECLR
|| !m_fStarted
- #endif // FEATURE_CORECLR
)
{
return HOST_E_CLRNOTAVAILABLE;
@@ -3117,126 +1480,6 @@ HRESULT CorRuntimeHostBase::UnloadAppDomain(DWORD dwDomainId, BOOL fSync)
//*****************************************************************************
// Fiber Methods
//*****************************************************************************
-#if !defined(FEATURE_CORECLR) // simple hosting
-HRESULT CorHost::CreateLogicalThreadState()
-{
- CONTRACTL
- {
- NOTHROW;
- DISABLED(GC_TRIGGERS);
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
- if (CorHost::GetHostVersion() != 1)
- {
- hr=HOST_E_INVALIDOPERATION;
- }
- else
- {
- _ASSERTE (GetThread() == 0 || GetThread()->HasRightCacheStackBase());
- /* Thread *thread = */ SetupThreadNoThrow(&hr);
-
- }
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT CorHost::DeleteLogicalThreadState()
-{
- if (CorHost::GetHostVersion() != 1)
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- Thread *pThread = GetThread();
- if (!pThread)
- return E_UNEXPECTED;
-
- CONTRACTL
- {
- NOTHROW;
- GC_TRIGGERS;
- ENTRY_POINT;
- }
- CONTRACTL_END;
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
- // We need to reset the TrapReturningThread count that was
- // set when a thread is requested to be aborted. Otherwise
- // every stub call is going to go through a slow path.
- if (pThread->IsAbortRequested())
- pThread->UnmarkThreadForAbort(Thread::TAR_ALL);
-
- // see code:Thread::OnThreadTerminate#ReportDeadOnThreadTerminate
- pThread->SetThreadState(Thread::TS_ReportDead);
-
- pThread->OnThreadTerminate(FALSE);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-}
-
-
-HRESULT CorHost::SwitchInLogicalThreadState(DWORD *pFiberCookie)
-{
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_MODE_ANY;
- STATIC_CONTRACT_ENTRY_POINT;
-
- if (CorHost::GetHostVersion() != 1)
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- if (!pFiberCookie)
- {
- return E_POINTER;
- }
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- hr = ((Thread*)pFiberCookie)->SwitchIn(::GetCurrentThread());
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
-
-}
-
-HRESULT CorHost::SwitchOutLogicalThreadState(DWORD **pFiberCookie)
-{
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_MODE_ANY;
- STATIC_CONTRACT_ENTRY_POINT;
-
- if (CorHost::GetHostVersion() != 1)
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- if (!pFiberCookie)
- {
- return E_POINTER;
- }
-
- Thread *pThread = GetThread();
- if (!pThread)
- {
- return E_UNEXPECTED;
- }
-
- pThread->InternalSwitchOut();
- *pFiberCookie = (DWORD*)pThread;
-
- return S_OK;
-}
-#endif // !defined(FEATURE_CORECLR)
HRESULT CorRuntimeHostBase::LocksHeldByLogicalThread(DWORD *pCount)
{
@@ -3267,242 +1510,6 @@ HRESULT CorRuntimeHostBase::LocksHeldByLogicalThread(DWORD *pCount)
//*****************************************************************************
// ICorConfiguration
//*****************************************************************************
-#if !defined(FEATURE_CORECLR)
-IGCThreadControl *CorConfiguration::m_CachedGCThreadControl = 0;
-IGCHostControl *CorConfiguration::m_CachedGCHostControl = 0;
-IDebuggerThreadControl *CorConfiguration::m_CachedDebuggerThreadControl = 0;
-DWORD *CorConfiguration::m_DSTArray = 0;
-DWORD CorConfiguration::m_DSTCount = 0;
-DWORD CorConfiguration::m_DSTArraySize = 0;
-
-// *** ICorConfiguration methods ***
-
-
-HRESULT CorConfiguration::SetGCThreadControl(IGCThreadControl *pGCThreadControl)
-{
- if (!pGCThreadControl)
- return E_POINTER;
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- if (m_CachedGCThreadControl)
- m_CachedGCThreadControl->Release();
-
- m_CachedGCThreadControl = pGCThreadControl;
-
- if (m_CachedGCThreadControl)
- m_CachedGCThreadControl->AddRef();
-
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
-}
-
-HRESULT CorConfiguration::SetGCHostControl(IGCHostControl *pGCHostControl)
-{
- if (!pGCHostControl)
- return E_POINTER;
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- if (m_CachedGCHostControl)
- m_CachedGCHostControl->Release();
-
- m_CachedGCHostControl = pGCHostControl;
-
- if (m_CachedGCHostControl)
- m_CachedGCHostControl->AddRef();
-
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
-}
-
-HRESULT CorConfiguration::SetDebuggerThreadControl(IDebuggerThreadControl *pDebuggerThreadControl)
-{
- if (!pDebuggerThreadControl)
- return E_POINTER;
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
-#ifdef DEBUGGING_SUPPORTED
- // Can't change the debugger thread control object once its been set.
- if (m_CachedDebuggerThreadControl != NULL)
- IfFailGo(E_INVALIDARG);
-
- m_CachedDebuggerThreadControl = pDebuggerThreadControl;
-
- // If debugging is already initialized then provide this interface pointer to it.
- // It will also addref the new one and release the old one.
- if (g_pDebugInterface)
- g_pDebugInterface->SetIDbgThreadControl(pDebuggerThreadControl);
-
- if (m_CachedDebuggerThreadControl)
- m_CachedDebuggerThreadControl->AddRef();
-
- hr = S_OK;
-#else // !DEBUGGING_SUPPORTED
- hr = E_NOTIMPL;
-#endif // !DEBUGGING_SUPPORTED
-
-ErrExit:
- END_ENTRYPOINT_NOTHROW;
- return hr;
-
-}
-
-
-HRESULT CorConfiguration::AddDebuggerSpecialThread(DWORD dwSpecialThreadId)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT; // debugging not hardened for SO
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
-
-#ifdef DEBUGGING_SUPPORTED
- // If it's already in the list, don't add it again.
- if (IsDebuggerSpecialThread(dwSpecialThreadId))
- {
- hr = S_OK;
- goto ErrExit;
- }
- // Grow the array if necessary.
- if (m_DSTCount >= m_DSTArraySize)
- {
- // There's probably only ever gonna be one or two of these
- // things, so we'll start small.
- DWORD newSize = (m_DSTArraySize == 0) ? 2 : m_DSTArraySize * 2;
-
- DWORD *newArray = new (nothrow) DWORD[newSize];
- IfNullGo(newArray);
-
- // If we're growing instead of starting, then copy the old array.
- if (m_DSTArray)
- {
- memcpy(newArray, m_DSTArray, m_DSTArraySize * sizeof(DWORD));
- delete [] m_DSTArray;
- }
-
- // Update to the new array and size.
- m_DSTArray = newArray;
- m_DSTArraySize = newSize;
- }
-
- // Save the new thread ID.
- m_DSTArray[m_DSTCount++] = dwSpecialThreadId;
-
- hr = (RefreshDebuggerSpecialThreadList());
-#else // !DEBUGGING_SUPPORTED
- hr = E_NOTIMPL;
-#endif // !DEBUGGING_SUPPORTED
-ErrExit:
- END_ENTRYPOINT_NOTHROW;
- return hr;
-
-}
-// Helper function to update the thread list in the debugger control block
-HRESULT CorConfiguration::RefreshDebuggerSpecialThreadList()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
-#ifdef DEBUGGING_SUPPORTED
- HRESULT hr = S_OK;
-
- if (g_pDebugInterface)
- {
- // Inform the debugger services that this list has changed
- hr = g_pDebugInterface->UpdateSpecialThreadList(
- m_DSTCount, m_DSTArray);
-
- _ASSERTE(SUCCEEDED(hr));
- }
-
- return (hr);
-#else // !DEBUGGING_SUPPORTED
- return E_NOTIMPL;
-#endif // !DEBUGGING_SUPPORTED
-}
-
-
-// Helper func that returns true if the thread is in the debugger special thread list
-BOOL CorConfiguration::IsDebuggerSpecialThread(DWORD dwThreadId)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- for (DWORD i = 0; i < m_DSTCount; i++)
- {
- if (m_DSTArray[i] == dwThreadId)
- return (TRUE);
- }
-
- return (FALSE);
-}
-
-
-// Clean up any debugger thread control object we may be holding, called at shutdown.
-void CorConfiguration::CleanupDebuggerThreadControl()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- if (m_CachedDebuggerThreadControl != NULL)
- {
- // Note: we don't release the IDebuggerThreadControl object if we're cleaning up from
- // our DllMain. The DLL that implements the object may already have been unloaded.
- // Leaking the object is okay... the PDM doesn't care.
- if (!IsAtProcessExit())
- m_CachedDebuggerThreadControl->Release();
-
- m_CachedDebuggerThreadControl = NULL;
- }
-}
-#endif // !defined(FEATURE_CORECLR)
//*****************************************************************************
// IUnknown
@@ -3520,20 +1527,6 @@ ULONG CorRuntimeHostBase::AddRef()
return InterlockedIncrement(&m_cRef);
}
-#if !defined(FEATURE_CORECLR) // simple hosting
-ULONG CorHost::Release()
-{
- LIMITED_METHOD_CONTRACT;
- STATIC_CONTRACT_SO_TOLERANT;
-
- ULONG cRef = InterlockedDecrement(&m_cRef);
- if (!cRef) {
- delete this;
- }
-
- return (cRef);
-}
-#endif // !defined(FEATURE_CORECLR)
ULONG CorHost2::Release()
{
@@ -3551,62 +1544,6 @@ ULONG CorHost2::Release()
return (cRef);
}
-#if !defined(FEATURE_CORECLR) // simple hosting
-HRESULT CorHost::QueryInterface(REFIID riid, void **ppUnk)
-{
- if (!ppUnk)
- return E_POINTER;
-
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT; // no global state updates that need guarding.
- }
- CONTRACTL_END;
-
- if (ppUnk == NULL)
- {
- return E_POINTER;
- }
-
- *ppUnk = 0;
-
- // Deliberately do NOT hand out ICorConfiguration. They must explicitly call
- // GetConfiguration to obtain that interface.
- if (riid == IID_IUnknown)
- *ppUnk = (IUnknown *) (ICorRuntimeHost *) this;
- else if (riid == IID_ICorRuntimeHost)
- {
- ULONG version = 1;
- if (m_Version == 0)
- FastInterlockCompareExchange((LONG*)&m_Version, version, 0);
-
- if (m_Version != version && (g_singleVersionHosting || !g_fEEStarted))
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- *ppUnk = (ICorRuntimeHost *) this;
- }
- else if (riid == IID_ICorThreadpool)
- *ppUnk = (ICorThreadpool *) this;
- else if (riid == IID_IGCHost)
- *ppUnk = (IGCHost *) this;
- else if (riid == IID_IGCHost2)
- *ppUnk = (IGCHost2 *) this;
- else if (riid == IID_IValidator)
- *ppUnk = (IValidator *) this;
- else if (riid == IID_IDebuggerInfo)
- *ppUnk = (IDebuggerInfo *) this;
- else if (riid == IID_ICLRExecutionManager)
- *ppUnk = (ICLRExecutionManager *) this;
- else
- return (E_NOINTERFACE);
- AddRef();
- return (S_OK);
-}
-#endif // !defined(FEATURE_CORECLR)
HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
@@ -3633,7 +1570,6 @@ HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
// GetConfiguration to obtain that interface.
if (riid == IID_IUnknown)
*ppUnk = static_cast<IUnknown *>(static_cast<ICLRRuntimeHost *>(this));
-#ifdef FEATURE_CORECLR // CoreCLR only supports IID_ICLRRuntimeHost2
else if (riid == IID_ICLRRuntimeHost2)
{
ULONG version = 2;
@@ -3642,16 +1578,6 @@ HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
*ppUnk = static_cast<ICLRRuntimeHost2 *>(this);
}
-#else // DesktopCLR only supports IID_ICLRRuntimeHost
- else if (riid == IID_ICLRRuntimeHost)
- {
- ULONG version = 2;
- if (m_Version == 0)
- FastInterlockCompareExchange((LONG*)&m_Version, version, 0);
-
- *ppUnk = static_cast<ICLRRuntimeHost *>(this);
- }
-#endif // FEATURE_CORECLR
else if (riid == IID_ICLRExecutionManager)
{
ULONG version = 2;
@@ -3660,79 +1586,18 @@ HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
*ppUnk = static_cast<ICLRExecutionManager *>(this);
}
-#if !defined(FEATURE_CORECLR)
- else if (riid == __uuidof(ICLRPrivRuntime))
- {
- ULONG version = 2;
- if (m_Version == 0)
- FastInterlockCompareExchange((LONG*)&m_Version, version, 0);
-
- *ppUnk = static_cast<ICLRPrivRuntime *>(this);
- }
-#endif
#ifndef FEATURE_PAL
else if (riid == IID_IPrivateManagedExceptionReporting)
{
*ppUnk = static_cast<IPrivateManagedExceptionReporting *>(this);
}
#endif // !FEATURE_PAL
-#ifndef FEATURE_CORECLR
- else if (riid == IID_ICorThreadpool)
- *ppUnk = static_cast<ICorThreadpool *>(this);
- // TODO: wwl Remove this after SQL uses new interface.
- else if (riid == IID_IGCHost &&
- GetHostVersion() == 3)
- *ppUnk = static_cast<IGCHost *>(this);
- else if (riid == IID_ICLRValidator)
- *ppUnk = static_cast<ICLRValidator *>(this);
- else if (riid == IID_IDebuggerInfo)
- *ppUnk = static_cast<IDebuggerInfo *>(this);
-#ifdef FEATURE_TESTHOOKS
- else if (riid == IID_ICLRTestHookManager)
- {
- *ppUnk=CLRTestHookManager::Start();
- if(*ppUnk==NULL)
- return E_OUTOFMEMORY;
- }
-#endif // FEATURE_TESTHOOKS
-#endif // FEATURE_CORECLR
else
return (E_NOINTERFACE);
AddRef();
return (S_OK);
}
-#ifndef FEATURE_CORECLR // CorHost isn't exposed externally
-//*****************************************************************************
-// Called by the class factory template to create a new instance of this object.
-//*****************************************************************************
-HRESULT CorHost::CreateObject(REFIID riid, void **ppUnk)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- CorHost *pCorHost = new (nothrow) CorHost();
- if (!pCorHost)
- {
- hr = E_OUTOFMEMORY;
- }
- else
- {
- hr = pCorHost->QueryInterface(riid, ppUnk);
-
- if (FAILED(hr))
- delete pCorHost;
- }
- return (hr);
-}
-#endif // FEATURE_CORECLR
#ifndef FEATURE_PAL
HRESULT CorHost2::GetBucketParametersForCurrentException(BucketParameters *pParams)
@@ -3849,34 +1714,6 @@ HRESULT CorRuntimeHostBase::MapFile(HANDLE hFile, HMODULE* phHandle)
///////////////////////////////////////////////////////////////////////////////
// IDebuggerInfo::IsDebuggerAttached
-#if !defined(FEATURE_CORECLR)
-HRESULT CorDebuggerInfo::IsDebuggerAttached(BOOL *pbAttached)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- if (pbAttached == NULL)
- hr = E_INVALIDARG;
- else
-#ifdef DEBUGGING_SUPPORTED
- *pbAttached = (CORDebuggerAttached() != 0);
-#else
- *pbAttached = FALSE;
-#endif
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
-}
-#endif // !defined(FEATURE_CORECLR)
LONG CorHost2::m_RefCount = 0;
@@ -3886,440 +1723,6 @@ LPCWSTR CorHost2::s_wszAppDomainManagerAsm = NULL;
LPCWSTR CorHost2::s_wszAppDomainManagerType = NULL;
EInitializeNewDomainFlags CorHost2::s_dwDomainManagerInitFlags = eInitializeNewDomainFlags_None;
-#ifndef FEATURE_CORECLR // not supported
-
-StringArrayList CorHost2::s_defaultDomainPropertyNames;
-StringArrayList CorHost2::s_defaultDomainPropertyValues;
-
-IHostMemoryManager *CorHost2::m_HostMemoryManager = NULL;
-IHostMalloc *CorHost2::m_HostMalloc = NULL;
-IHostTaskManager *CorHost2::m_HostTaskManager = NULL;
-IHostThreadpoolManager *CorHost2::m_HostThreadpoolManager = NULL;
-IHostIoCompletionManager *CorHost2::m_HostIoCompletionManager = NULL;
-IHostSyncManager *CorHost2::m_HostSyncManager = NULL;
-IHostAssemblyManager *CorHost2::m_HostAssemblyManager = NULL;
-IHostGCManager *CorHost2::m_HostGCManager = NULL;
-IHostSecurityManager *CorHost2::m_HostSecurityManager = NULL;
-IHostPolicyManager *CorHost2::m_HostPolicyManager = NULL;
-int CorHost2::m_HostOverlappedExtensionSize = -1;
-
-STARTUP_FLAGS CorHost2::m_dwStartupFlags = STARTUP_CONCURRENT_GC;
-WCHAR CorHost2::m_wzHostConfigFile[_MAX_PATH] = { 0 };
-
-BOOL CorHost2::m_dwFlagsFinalized = FALSE;
-DangerousNonHostedSpinLock CorHost2::m_FlagsLock;
-
-class CCLRMemoryNotificationCallback: public ICLRMemoryNotificationCallback
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE OnMemoryNotification(EMemoryAvailable eMemoryAvailable) {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- // We have not started runtime yet.
- if (!g_fEEStarted)
- return S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- switch (eMemoryAvailable)
- {
- case eMemoryAvailableLow:
- STRESS_LOG0(LF_GC, LL_INFO100, "Host delivers memory notification: Low\n");
- break;
- case eMemoryAvailableNeutral:
- STRESS_LOG0(LF_GC, LL_INFO100, "Host delivers memory notification: Neutral\n");
- break;
- case eMemoryAvailableHigh:
- STRESS_LOG0(LF_GC, LL_INFO100, "Host delivers memory notification: High\n");
- break;
- }
- static DWORD lastTime = (DWORD)-1;
- if (eMemoryAvailable == eMemoryAvailableLow)
- {
- FastInterlockIncrement ((LONG *)&g_bLowMemoryFromHost);
- DWORD curTime = GetTickCount();
- if (curTime < lastTime || curTime - lastTime >= 0x2000)
- {
- lastTime = curTime;
- FinalizerThread::EnableFinalization();
- }
- }
- else
- {
- FastInterlockExchange ((LONG *)&g_bLowMemoryFromHost, FALSE);
- }
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
- {
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLRMemoryNotificationCallback && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppvObject = this;
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-};
-
-static CCLRMemoryNotificationCallback s_MemoryNotification;
-
-class CLRTaskManager : public ICLRTaskManager
-{
-public:
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) {
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLRTaskManager && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppvObject = this;
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- virtual HRESULT STDMETHODCALLTYPE CreateTask(ICLRTask **pTask)
- {
- CONTRACTL
- {
- NOTHROW;
- DISABLED(GC_NOTRIGGER);
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
-#ifdef _DEBUG
- _ASSERTE (!CLRTaskHosted() || GetCurrentHostTask());
-#endif
- _ASSERTE (GetThread() == NULL);
- Thread *pThread = NULL;
- pThread = SetupThreadNoThrow(&hr);
- *pTask = pThread;
-
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE GetCurrentTask(ICLRTask **pTask)
- {
- // This function may be called due SQL SwitchIn/Out. Contract may
- // force memory allocation which is not allowed during Switch.
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_SO_TOLERANT;
- STATIC_CONTRACT_ENTRY_POINT;
-
- *pTask = GetThread();
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE SetUILocale(LCID lcid)
- {
- Thread *pThread = GetThread();
- if (pThread == NULL)
- return HOST_E_INVALIDOPERATION;
-
- CONTRACTL
- {
- GC_TRIGGERS;
- NOTHROW;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- //BEGIN_ENTRYPOINT_NOTHROW;
- BEGIN_EXTERNAL_ENTRYPOINT(&hr)
- {
- pThread->SetCultureId(lcid,TRUE);
- }
- END_EXTERNAL_ENTRYPOINT;
- //END_ENTRYPOINT_NOTHROW;
-
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE SetLocale(LCID lcid)
- {
- Thread *pThread = GetThread();
- if (pThread == NULL)
- return HOST_E_INVALIDOPERATION;
-
- CONTRACTL
- {
- GC_TRIGGERS;
- NOTHROW;
- MODE_PREEMPTIVE;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
- //BEGIN_ENTRYPOINT_NOTHROW;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr)
- {
- pThread->SetCultureId(lcid,FALSE);
- }
- END_EXTERNAL_ENTRYPOINT;
- //END_ENTRYPOINT_NOTHROW;
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE GetCurrentTaskType(ETaskType *pTaskType)
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- BEGIN_ENTRYPOINT_NOTHROW;
- *pTaskType = ::GetCurrentTaskType();
- END_ENTRYPOINT_NOTHROW;
-
- return S_OK;
- }
-};
-
-static CLRTaskManager s_CLRTaskManager;
-
-class CLRSyncManager : public ICLRSyncManager
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE GetMonitorOwner(SIZE_T Cookie,
- IHostTask **ppOwnerHostTask)
- {
- CONTRACTL
- {
- NOTHROW;
- MODE_PREEMPTIVE;
- GC_NOTRIGGER;
- ENTRY_POINT;;
- }
- CONTRACTL_END;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- // Cookie is the SyncBlock
- // <TODO>TODO: Lifetime of Cookie?</TODO>
- AwareLock* pAwareLock = (AwareLock*)Cookie;
- IHostTask *pTask = NULL;
- Thread *pThread = pAwareLock->GetOwningThread();
- if (pThread)
- {
- ThreadStoreLockHolder tsLock;
- pThread = pAwareLock->GetOwningThread();
- if (pThread)
- {
- // See if the lock is orphaned, and the Thread object has been deleted
- Thread *pWalk = NULL;
- while ((pWalk = ThreadStore::GetAllThreadList(pWalk, 0, 0)) != NULL)
- {
- if (pWalk == pThread)
- {
- pTask = pThread->GetHostTaskWithAddRef();
- break;
- }
- }
- }
- }
-
- *ppOwnerHostTask = pTask;
-
- END_ENTRYPOINT_NOTHROW;
-
-
- return S_OK;
- }
- virtual HRESULT STDMETHODCALLTYPE CreateRWLockOwnerIterator(SIZE_T Cookie,
- SIZE_T *pIterator) {
- Thread *pThread = GetThread();
-
- // We may open a window for GC here.
- // A host should not hijack a coop thread to do deadlock detection.
- if (pThread && pThread->PreemptiveGCDisabled())
- return HOST_E_INVALIDOPERATION;
-
- CONTRACTL
- {
- NOTHROW;
- MODE_PREEMPTIVE;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- HRESULT hr = E_FAIL;
-
-#ifdef FEATURE_RWLOCK
- BEGIN_ENTRYPOINT_NOTHROW;
- ThreadStoreLockHolder tsLock;
- // Cookie is a weak handle. We need to make sure that the object is not moving.
- CRWLock *pRWLock = *(CRWLock **) Cookie;
- *pIterator = NULL;
- if (pRWLock == NULL)
- {
- hr = S_OK;
- }
- else
- {
- hr = pRWLock->CreateOwnerIterator(pIterator);
- }
- END_ENTRYPOINT_NOTHROW;
-#endif // FEATURE_RWLOCK
-
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE GetRWLockOwnerNext(SIZE_T Iterator,
- IHostTask **ppOwnerHostTask)
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
-#ifdef FEATURE_RWLOCK
- BEGIN_ENTRYPOINT_NOTHROW;
- CRWLock::GetNextOwner(Iterator,ppOwnerHostTask);
- END_ENTRYPOINT_NOTHROW;
-#endif // FEATURE_RWLOCK
-
- return S_OK;
- }
-
- virtual HRESULT STDMETHODCALLTYPE DeleteRWLockOwnerIterator(SIZE_T Iterator)
- {
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
-#ifdef FEATURE_RWLOCK
- BEGIN_ENTRYPOINT_NOTHROW;
- CRWLock::DeleteOwnerIterator(Iterator);
- END_ENTRYPOINT_NOTHROW;
-#endif // FEATURE_RWLOCK
-
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
- {
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLRSyncManager && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppvObject = this;
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-};
-
-static CLRSyncManager s_CLRSyncManager;
-
-extern void HostIOCompletionCallback(DWORD ErrorCode,
- DWORD numBytesTransferred,
- LPOVERLAPPED lpOverlapped);
-class CCLRIoCompletionManager :public ICLRIoCompletionManager
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE OnComplete(DWORD dwErrorCode,
- DWORD NumberOfBytesTransferred,
- void* pvOverlapped)
- {
- WRAPPER_NO_CONTRACT;
- STATIC_CONTRACT_ENTRY_POINT;
-
- if (pvOverlapped)
- {
- BEGIN_ENTRYPOINT_NOTHROW;
- HostIOCompletionCallback (dwErrorCode, NumberOfBytesTransferred, (LPOVERLAPPED)pvOverlapped);
- END_ENTRYPOINT_NOTHROW;
- }
-
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
- BEGIN_INTERFACE HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLRIoCompletionManager && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppvObject = this;
- return S_OK;
- }
-};
-
-static CCLRIoCompletionManager s_CLRIoCompletionManager;
-#endif // FEATURE_CORECLR
#ifdef _DEBUG
extern void ValidateHostInterface();
@@ -4375,181 +1778,9 @@ HRESULT CorHost2::SetHostControl(IHostControl* pHostControl)
while (FastInterlockExchange((LONG*)&fOneOnly, 1) == 1)
{
- #ifndef FEATURE_CORECLR
- if (m_HostTaskManager != NULL)
- {
- m_HostTaskManager->SwitchToTask(0);
- }
- else
- {
- IHostTaskManager *pHostTaskManager = NULL;
- if (pHostControl->GetHostManager(IID_IHostTaskManager, (void**)&pHostTaskManager) == S_OK &&
- pHostTaskManager != NULL)
- {
- pHostTaskManager->SwitchToTask(0);
- pHostTaskManager->Release();
- }
- else
- {
- __SwitchToThread(0, ++dwSwitchCount);
- }
- }
- #else
__SwitchToThread(0, ++dwSwitchCount);
- #endif // FEATURE_CORECLR
}
-#ifndef FEATURE_CORECLR
-
-#ifdef _DEBUG
- ValidateHostInterface();
-#endif
-
-#ifdef _DEBUG
- DWORD dbg_HostManagerConfig = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_HostManagerConfig);
-#endif
-
- IHostMemoryManager *memoryManager = NULL;
- IHostTaskManager *taskManager = NULL;
- IHostThreadpoolManager *threadpoolManager = NULL;
- IHostIoCompletionManager *ioCompletionManager = NULL;
- IHostSyncManager *syncManager = NULL;
- IHostAssemblyManager *assemblyManager = NULL;
- IHostGCManager *gcManager = NULL;
- IHostSecurityManager *securityManager = NULL;
- IHostPolicyManager *policyManager = NULL;
-
- if (m_HostMemoryManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRMEMORYHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostMemoryManager,(void**)&memoryManager) == S_OK &&
- memoryManager != NULL) {
- if (m_HostMalloc == NULL)
- {
- hr = memoryManager->CreateMalloc (MALLOC_THREADSAFE, &m_HostMalloc);
- if (hr == S_OK)
- {
- memoryManager->RegisterMemoryNotificationCallback(&s_MemoryNotification);
- }
- else
- {
- memoryManager->Release();
- IfFailGo(E_UNEXPECTED);
- }
- }
- m_HostMemoryManager = memoryManager;
- g_fHostConfig |= CLRMEMORYHOSTED;
- }
-
- if (m_HostTaskManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRTASKHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostTaskManager,(void**)&taskManager) == S_OK &&
- taskManager != NULL) {
-#ifdef _TARGET_ARM_ // @ARMTODO: re-enable once we support hosted p/invokes.
- IfFailGo(E_NOTIMPL);
-#endif
- m_HostTaskManager = taskManager;
- m_HostTaskManager->SetCLRTaskManager(&s_CLRTaskManager);
- g_fHostConfig |= CLRTASKHOSTED;
- }
-
- if (m_HostThreadpoolManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRTHREADPOOLHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostThreadpoolManager,(void**)&threadpoolManager) == S_OK &&
- threadpoolManager != NULL) {
- m_HostThreadpoolManager = threadpoolManager;
- g_fHostConfig |= CLRTHREADPOOLHOSTED;
- }
-
- if (m_HostIoCompletionManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRIOCOMPLETIONHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostIoCompletionManager,(void**)&ioCompletionManager) == S_OK &&
- ioCompletionManager != NULL) {
- DWORD hostSize;
- hr = ioCompletionManager->GetHostOverlappedSize(&hostSize);
- if (FAILED(hr))
- {
- ioCompletionManager->Release();
- IfFailGo(E_UNEXPECTED);
- }
- m_HostOverlappedExtensionSize = (int)hostSize;
- m_HostIoCompletionManager = ioCompletionManager;
- m_HostIoCompletionManager->SetCLRIoCompletionManager(&s_CLRIoCompletionManager);
- g_fHostConfig |= CLRIOCOMPLETIONHOSTED;
- }
-
- if (m_HostSyncManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRSYNCHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostSyncManager,(void**)&syncManager) == S_OK &&
- syncManager != NULL) {
- m_HostSyncManager = syncManager;
- m_HostSyncManager->SetCLRSyncManager(&s_CLRSyncManager);
- g_fHostConfig |= CLRSYNCHOSTED;
- }
-
- if (m_HostAssemblyManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRASSEMBLYHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostAssemblyManager,(void**)&assemblyManager) == S_OK &&
- assemblyManager != NULL) {
-
- assemblyManager->GetAssemblyStore(&g_pHostAssemblyStore);
-
- hr = assemblyManager->GetNonHostStoreAssemblies(&g_pHostAsmList);
- if (FAILED(hr))
- {
- assemblyManager->Release();
- IfFailGo(hr);
- }
-
- if (g_pHostAssemblyStore || g_pHostAsmList)
- g_bFusionHosted = TRUE;
- m_HostAssemblyManager = assemblyManager;
- g_fHostConfig |= CLRASSEMBLYHOSTED;
- }
-
- if (m_HostGCManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRGCHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostGCManager,
- (void**)&gcManager) == S_OK &&
- gcManager != NULL) {
- m_HostGCManager = gcManager;
- g_fHostConfig |= CLRGCHOSTED;
- }
-
- if (m_HostSecurityManager == NULL &&
-#ifdef _DEBUG
- (dbg_HostManagerConfig & CLRSECURITYHOSTED) &&
-#endif
- pHostControl->GetHostManager(IID_IHostSecurityManager,
- (void**)&securityManager) == S_OK &&
- securityManager != NULL) {
- g_fHostConfig |= CLRSECURITYHOSTED;
- m_HostSecurityManager = securityManager;
-#ifdef FEATURE_CAS_POLICY
- HostExecutionContextManager::InitializeRestrictedContext();
-#endif // #ifdef FEATURE_CAS_POLICY
- }
-
- if (m_HostPolicyManager == NULL &&
- pHostControl->GetHostManager(IID_IHostPolicyManager,
- (void**)&policyManager) == S_OK &&
- policyManager != NULL) {
- m_HostPolicyManager = policyManager;
- }
-#endif //!FEATURE_CORECLR
if (m_HostControl == NULL)
{
@@ -4574,64 +1805,28 @@ public:
EPolicyAction action)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_ENTRY_POINT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetDefaultAction(operation, action);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual HRESULT STDMETHODCALLTYPE SetTimeout(EClrOperation operation,
DWORD dwMilliseconds)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_ENTRY_POINT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetTimeout(operation,dwMilliseconds);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual HRESULT STDMETHODCALLTYPE SetActionOnTimeout(EClrOperation operation,
EPolicyAction action)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_ENTRY_POINT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetActionOnTimeout(operation,action);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual HRESULT STDMETHODCALLTYPE SetTimeoutAndAction(EClrOperation operation, DWORD dwMilliseconds,
EPolicyAction action)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_SO_TOLERANT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetTimeoutAndAction(operation,dwMilliseconds,action);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual HRESULT STDMETHODCALLTYPE SetActionOnFailure(EClrFailure failure,
@@ -4642,7 +1837,6 @@ public:
STATIC_CONTRACT_ENTRY_POINT;
LIMITED_METHOD_CONTRACT;
HRESULT hr;
-#ifdef FEATURE_CORECLR
// For CoreCLR, this method just supports FAIL_AccessViolation as a valid
// failure input arg. The validation of the specified action for the failure
// will be done in EEPolicy::IsValidActionForFailure.
@@ -4650,7 +1844,6 @@ public:
{
return E_INVALIDARG;
}
-#endif // FEATURE_CORECLR
BEGIN_ENTRYPOINT_NOTHROW;
hr = GetEEPolicy()->SetActionOnFailure(failure,action);
END_ENTRYPOINT_NOTHROW;
@@ -4660,16 +1853,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE SetUnhandledExceptionPolicy(EClrUnhandledException policy)
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- STATIC_CONTRACT_ENTRY_POINT;
- HRESULT hr;
- BEGIN_ENTRYPOINT_NOTHROW;
- hr = GetEEPolicy()->SetUnhandledExceptionPolicy(policy);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual ULONG STDMETHODCALLTYPE AddRef(void)
@@ -4705,427 +1889,22 @@ public:
static CCLRPolicyManager s_PolicyManager;
-#ifndef FEATURE_CORECLR // not supported
-class CCLROnEventManager: public ICLROnEventManager
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE RegisterActionOnEvent(EClrEvent event,
- IActionOnCLREvent *pAction)
- {
- CONTRACTL
- {
- GC_TRIGGERS;
- NOTHROW;
- ENTRY_POINT;
-
- // This function is always called from outside the Runtime. So, we assert that we either don't have a
- // managed thread, or if we do, that we're in preemptive GC mode.
- PRECONDITION((GetThread() == NULL) || !GetThread()->PreemptiveGCDisabled());
- }
- CONTRACTL_END;
-
- if (event >= MaxClrEvent || pAction == NULL || event < (EClrEvent)0)
- return E_INVALIDARG;
-
- HRESULT hr = S_OK;
- BEGIN_ENTRYPOINT_NOTHROW;
-
- // Note: its only safe to use a straight ReleaseHolder from within the VM directory when we know we're
- // called from outside the Runtime. We assert that above, just to be sure.
- ReleaseHolder<IActionOnCLREvent> actionHolder(pAction);
- pAction->AddRef();
-
- CrstHolderWithState ch(m_pLock);
-
- DWORD dwSwitchCount = 0;
- while (m_ProcessEvent != 0)
- {
- ch.Release();
- __SwitchToThread(0, ++dwSwitchCount);
- ch.Acquire();
- }
-
- if (m_pAction[event] == NULL)
- {
- m_pAction[event] = new (nothrow)ActionNode;
- if (m_pAction[event] == NULL)
- hr = E_OUTOFMEMORY;
- }
-
- if (SUCCEEDED(hr))
- {
- ActionNode *walk = m_pAction[event];
- while (TRUE)
- {
- int n = 0;
- for ( ; n < ActionNode::ActionArraySize; n ++)
- {
- if (walk->pAction[n] == NULL)
- {
- walk->pAction[n] = pAction;
- actionHolder.SuppressRelease();
- hr = S_OK;
- break;
- }
- }
- if (n < ActionNode::ActionArraySize)
- {
- break;
- }
- if (walk->pNext == NULL)
- {
- walk->pNext = new (nothrow) ActionNode;
- if (walk->pNext == NULL)
- {
- hr = E_OUTOFMEMORY;
- break;
- }
- }
- walk = walk->pNext;
- }
- }
-
- END_ENTRYPOINT_NOTHROW;
- return hr;
- }
-
- virtual HRESULT STDMETHODCALLTYPE UnregisterActionOnEvent(EClrEvent event,
- IActionOnCLREvent *pAction)
- {
- CONTRACTL
- {
- GC_NOTRIGGER;
- NOTHROW;
- ENTRY_POINT;
- }
- CONTRACTL_END;
-
- if (event == Event_StackOverflow)
- {
- // We don't want to take a lock when we process StackOverflow event, because we may
- // not have enough stack to do it.
- // So we do not release our cache of the callback in order to avoid race.
- return HOST_E_INVALIDOPERATION;
- }
-
- HRESULT hr = S_OK;
-
- ActionNode *walk = NULL;
- ActionNode *prev = NULL;
-
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- CrstHolderWithState ch(m_pLock);
-
- DWORD dwSwitchCount = 0;
- while (m_ProcessEvent != 0)
- {
- ch.Release();
- __SwitchToThread(0, ++dwSwitchCount);
- ch.Acquire();
- }
-
- if (m_pAction[event] == NULL)
- IfFailGo(HOST_E_INVALIDOPERATION);
-
- walk = m_pAction[event];
- while (walk)
- {
- BOOL fInUse = FALSE;
- for (int n = 0; n < ActionNode::ActionArraySize; n ++)
- {
- if (prev && !fInUse && walk->pAction[n])
- fInUse = TRUE;
- if (walk->pAction[n] == pAction)
- {
- walk->pAction[n] = NULL;
- ch.Release();
- pAction->Release();
- hr = S_OK;
- goto ErrExit;
- }
- }
- if (prev && !fInUse)
- {
- prev->pNext = walk->pNext;
- delete walk;
- walk = prev;
- }
- prev = walk;
- walk = walk->pNext;
- }
- hr = HOST_E_INVALIDOPERATION;
-ErrExit:
- END_ENTRYPOINT_NOTHROW;
-
- return hr;
- }
-
- virtual ULONG STDMETHODCALLTYPE AddRef(void)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppUnk)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- if (riid != IID_ICLROnEventManager && riid != IID_IUnknown)
- return (E_NOINTERFACE);
- *ppUnk = this;
- return S_OK;
- }
-
- virtual ULONG STDMETHODCALLTYPE Release(void)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- LIMITED_METHOD_CONTRACT;
- return 1;
- }
-
- // This function is to work around an issue in scan.exe.
- // scan.exe is not smart to handle that if (){} else {}.
- void ProcessSOEvent(void *data)
- {
- STATIC_CONTRACT_SO_TOLERANT;
- WRAPPER_NO_CONTRACT;
-
- if (m_pLock == NULL)
- return;
-
- ActionNode *walk = m_pAction[Event_StackOverflow];
-
- while (walk)
- {
- for (int n = 0; n < ActionNode::ActionArraySize; n ++)
- {
- if (walk->pAction[n])
- {
- walk->pAction[n]->OnEvent(Event_StackOverflow,data);
- }
- }
- walk = walk->pNext;
- }
- }
-
- void ProcessEvent(EClrEvent event, void *data)
- {
- WRAPPER_NO_CONTRACT;
-
- if (m_pLock == NULL)
- {
- return;
- }
-
- _ASSERTE (event != Event_StackOverflow);
-
- {
- CrstHolder ch(m_pLock);
-
- if (event == Event_ClrDisabled)
- {
- if (m_CLRDisabled)
- {
- return;
- }
- m_CLRDisabled = TRUE;
- }
- m_ProcessEvent ++;
-
- // Release the lock around the call into the host. Is this correct?
- // It seems that we need to hold the lock except for the actual callback itself.
- }
-
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- {
- ActionNode *walk = m_pAction[event];
- while (walk)
- {
- for (int n = 0; n < ActionNode::ActionArraySize; n ++)
- {
- if (walk->pAction[n])
- {
- walk->pAction[n]->OnEvent(event,data);
- }
- }
- walk = walk->pNext;
- }
- }
- END_SO_TOLERANT_CODE_CALLING_HOST;
-
- {
- CrstHolder ch(m_pLock);
- m_ProcessEvent --;
- }
- }
-
- BOOL IsActionRegisteredForEvent(EClrEvent event)
- {
- WRAPPER_NO_CONTRACT;
-
- // Check to see if the event manager has been set up.
- if (m_pLock == NULL)
- return FALSE;
-
- CrstHolder ch(m_pLock);
-
- ActionNode *walk = m_pAction[event];
- while (walk)
- {
- for (int n = 0; n < ActionNode::ActionArraySize; n ++)
- {
- if (walk->pAction[n] != NULL)
- {
- // We found an action registered for this event.
- return TRUE;
- }
- }
- walk = walk->pNext;
- }
-
- // There weren't any actions registered.
- return FALSE;
- }
-
- HRESULT Init()
- {
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_MODE_ANY;
- STATIC_CONTRACT_SO_TOLERANT;
-
- HRESULT hr = S_OK;
- if (m_pLock == NULL)
- {
- EX_TRY
- {
- BEGIN_SO_INTOLERANT_CODE(GetThread());
- {
- InitHelper();
- }
- END_SO_INTOLERANT_CODE;
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
- }
-
- return hr;
- }
-
-#if 0
- // We do not need this one. We have one instance of this class
- // and it is static.
- CCLROnEventManager()
- {
- LIMITED_METHOD_CONTRACT;
- for (int n = 0; n < MaxClrEvent; n ++)
- m_pAction[n] = NULL;
- }
-#endif
-
-private:
- struct ActionNode
- {
- static const int ActionArraySize = 8;
-
- IActionOnCLREvent *pAction[ActionArraySize];
- ActionNode *pNext;
-
- ActionNode ()
- : pNext(NULL)
- {
- LIMITED_METHOD_CONTRACT;
-
- for (int n = 0; n < ActionArraySize; n ++)
- pAction[n] = 0;
- }
- };
- ActionNode *m_pAction[MaxClrEvent];
-
- Crst* m_pLock;
-
- BOOL m_CLRDisabled;
-
- // We can not call out into host while holding the lock. At the same time
- // we need to make our data consistent. Therefore, m_ProcessEvent is a marker
- // to forbid touching the data structure from Register and UnRegister.
- DWORD m_ProcessEvent;
-
- void InitHelper()
- {
- CONTRACTL
- {
- GC_NOTRIGGER;
- THROWS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- m_ProcessEvent = 0;
-
- Crst* tmp = new Crst(CrstOnEventManager, CrstFlags(CRST_DEFAULT | CRST_DEBUGGER_THREAD));
- if (FastInterlockCompareExchangePointer(&m_pLock, tmp, NULL) != NULL)
- delete tmp;
- }
-};
-
-static CCLROnEventManager s_OnEventManager;
-#endif // FEATURE_CORECLR
void ProcessEventForHost(EClrEvent event, void *data)
{
-#ifndef FEATURE_CORECLR
- WRAPPER_NO_CONTRACT;
-
- _ASSERTE (event != Event_StackOverflow);
-
- GCX_PREEMP();
-
- s_OnEventManager.ProcessEvent(event,data);
-#endif // FEATURE_CORECLR
}
// We do not call ProcessEventForHost for stack overflow, since we have limit stack
// and we should avoid calling GCX_PREEMPT
void ProcessSOEventForHost(EXCEPTION_POINTERS *pExceptionInfo, BOOL fInSoTolerant)
{
-#ifndef FEATURE_CORECLR
- WRAPPER_NO_CONTRACT;
-
- StackOverflowInfo soInfo;
- if (fInSoTolerant)
- {
- soInfo.soType = SO_Managed;
- }
- else if (pExceptionInfo == NULL || IsIPInModule(g_pMSCorEE, GetIP(pExceptionInfo->ContextRecord)))
- {
- soInfo.soType = SO_ClrEngine;
- }
- else
- {
- soInfo.soType = SO_Other;
- }
-
- soInfo.pExceptionInfo = pExceptionInfo;
- s_OnEventManager.ProcessSOEvent(&soInfo);
-#endif // FEATURE_CORECLR
}
BOOL IsHostRegisteredForEvent(EClrEvent event)
{
WRAPPER_NO_CONTRACT;
-#ifdef FEATURE_CORECLR
return FALSE;
-#else // FEATURE_CORECLR
- return s_OnEventManager.IsActionRegisteredForEvent(event);
-#endif // FEATURE_CORECLR
}
inline size_t SizeInKBytes(size_t cbSize)
@@ -5154,7 +1933,7 @@ void UpdateGCSettingFromHost ()
}
}
-#if !defined(FEATURE_CORECLR) || defined(FEATURE_WINDOWSPHONE)
+#if defined(FEATURE_WINDOWSPHONE)
class CCLRGCManager: public ICLRGCManager2
{
public:
@@ -5562,17 +2341,7 @@ public:
if (ppObject == NULL)
return E_INVALIDARG;
-#ifndef FEATURE_CORECLR
- // ErrorReportingManager is allowed, even if runtime is started, so
- // make this check first.
- // Host must call release on CLRErrorReportingManager after this call
- if (riid == IID_ICLRErrorReportingManager)
- {
- *ppObject = &g_CLRErrorReportingManager;
- return S_OK;
- }
- else
-#elif defined(FEATURE_WINDOWSPHONE)
+#if defined(FEATURE_WINDOWSPHONE)
if (riid == IID_ICLRErrorReportingManager2)
{
*ppObject = &g_CLRErrorReportingManager;
@@ -5585,12 +2354,6 @@ public:
// If runtime has been started, do not allow user to obtain CLR managers.
return HOST_E_INVALIDOPERATION;
}
-#ifndef FEATURE_CORECLR
- else if (riid == IID_ICLRTaskManager) {
- *ppObject = &s_CLRTaskManager;
- return S_OK;
- }
-#endif // !FEATURE_CORECLR
// CoreCLR supports ICLRPolicyManager since it allows the host
// to specify the policy for AccessViolation.
@@ -5599,30 +2362,8 @@ public:
FastInterlockExchange((LONG*)&g_CLRPolicyRequested, TRUE);
return S_OK;
}
-#ifndef FEATURE_CORECLR
- else if (riid == IID_ICLRHostProtectionManager) {
- *ppObject = GetHostProtectionManager();
- return S_OK;
- }
-
- // Host must call release on CLRDebugManager after this call
- else if (riid == IID_ICLRDebugManager)
- {
- *ppObject = &s_CLRDebugManager;
- return S_OK;
- }
-
- else if (riid == IID_ICLROnEventManager)
- {
- HRESULT hr = s_OnEventManager.Init();
- if (FAILED(hr))
- return hr;
- *ppObject = &s_OnEventManager;
- return S_OK;
- }
-#endif // !FEATURE_CORECLR
-#if !defined(FEATURE_CORECLR) || defined(FEATURE_WINDOWSPHONE)
+#if defined(FEATURE_WINDOWSPHONE)
else if ((riid == IID_ICLRGCManager) || (riid == IID_ICLRGCManager2))
{
*ppObject = &s_GCManager;
@@ -5646,29 +2387,9 @@ public:
LPCWSTR pwzAppDomainManagerAssembly,
LPCWSTR pwzAppDomainManagerType)
{
-#ifndef FEATURE_CORECLR
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- ENTRY_POINT; // no global state updates
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- hr = CorHost2::SetAppDomainManagerType(pwzAppDomainManagerAssembly,
- pwzAppDomainManagerType,
- eInitializeNewDomainFlags_None);
- END_ENTRYPOINT_NOTHROW;
- return hr;
-#else // FEATURE_CORECLR
// CoreCLR does not support this method
return E_NOTIMPL;
-#endif // !FEATURE_CORECLR
}
virtual ULONG STDMETHODCALLTYPE AddRef(void)
@@ -5713,9 +2434,6 @@ private:
// After CLR starts, we give out s_CorCLRControlLimited which allows limited access to managers.
static CCorCLRControl s_CorCLRControl;
-#ifndef FEATURE_CORECLR
-static CCorCLRControl s_CorCLRControlLimited;
-#endif // FEATURE_CORECLR
///////////////////////////////////////////////////////////////////////////////
// ICLRRuntimeHost::GetCLRControl
@@ -5740,11 +2458,6 @@ HRESULT CorHost2::GetCLRControl(ICLRControl** pCLRControl)
}
else
{
-#ifndef FEATURE_CORECLR
- // Even CLR is hosted by v1 hosting interface, we still allow part of CLRControl, like IID_ICLRErrorReportingManager.
- s_CorCLRControlLimited.SetAccess(FALSE);
- *pCLRControl = &s_CorCLRControlLimited;
-#else // FEATURE_CORECLR
// If :
// 1) request comes for interface other than ICLRControl*, OR
// 2) runtime has already started, OR
@@ -5761,175 +2474,30 @@ HRESULT CorHost2::GetCLRControl(ICLRControl** pCLRControl)
{
hr = E_NOTIMPL;
}
-#endif // !FEATURE_CORECLR
}
END_ENTRYPOINT_NOTHROW;
return hr;
}
-#ifndef FEATURE_CORECLR
-
-// static
-HRESULT CorHost2::SetPropertiesForDefaultAppDomain(DWORD nProperties,
- __in_ecount(nProperties) LPCWSTR *pwszPropertyNames,
- __in_ecount(nProperties) LPCWSTR *pwszPropertyValues)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- // Default domain properties can only be set before the CLR has started
- if (g_fEEStarted || HasStarted())
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- // If the host is specifying properties, they should be there
- if (nProperties > 0 && (pwszPropertyNames == NULL || pwszPropertyValues == NULL))
- {
- return E_POINTER;
- }
-
- // v4 - since this property is being added late in the cycle to address a specific scenario, we
- // reject any attempt to set anything but a single well known property name. This restriction
- // can be removed in the future.
- for (DWORD iProperty = 0; iProperty < nProperties; ++iProperty)
- {
- if (pwszPropertyNames[iProperty] == NULL)
- {
- return E_POINTER;
- }
- if (pwszPropertyValues[iProperty] == NULL)
- {
- return E_POINTER;
- }
- if (wcscmp(PARTIAL_TRUST_VISIBLE_ASSEMBLIES_PROPERTY, pwszPropertyNames[iProperty]) != 0)
- {
- return HRESULT_FROM_WIN32(ERROR_UNKNOWN_PROPERTY);
- }
- }
-
- HRESULT hr = S_OK;
-
- EX_TRY
- {
- for (DWORD iProperty = 0; iProperty < nProperties; ++iProperty)
- {
- SString propertyName(pwszPropertyNames[iProperty]);
- s_defaultDomainPropertyNames.Append(propertyName);
-
- SString propertyValue(pwszPropertyValues[iProperty]);
- s_defaultDomainPropertyValues.Append(propertyValue);
- }
- }
- EX_CATCH_HRESULT(hr);
-
- return hr;
-}
-
-// static
-HRESULT CorHost2::SetAppDomainManagerType(LPCWSTR wszAppDomainManagerAssembly,
- LPCWSTR wszAppDomainManagerType,
- EInitializeNewDomainFlags dwInitializeDomainFlags)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- // The AppDomainManger can only be set by the host before the CLR has started
- if (g_fEEStarted || HasStarted())
- {
- return HOST_E_INVALIDOPERATION;
- }
-
- // Both the type and assembly must be specified
- if (wszAppDomainManagerAssembly == NULL || wszAppDomainManagerType == NULL)
- {
- return E_INVALIDARG;
- }
-
- // Make sure we understand the incoming flags
- const EInitializeNewDomainFlags knownFlags = eInitializeNewDomainFlags_NoSecurityChanges;
- if ((dwInitializeDomainFlags & (~knownFlags)) != eInitializeNewDomainFlags_None)
- {
- return E_INVALIDARG;
- }
-
- // Get a copy of the AppDomainManager assembly
- size_t cchAsm = wcslen(wszAppDomainManagerAssembly) + 1;
- NewArrayHolder<WCHAR> wszAppDomainManagerAssemblyCopy(new (nothrow) WCHAR[cchAsm]);
- if (wszAppDomainManagerAssemblyCopy == NULL)
- {
- return E_OUTOFMEMORY;
- }
- wcsncpy_s(wszAppDomainManagerAssemblyCopy, cchAsm, wszAppDomainManagerAssembly, cchAsm - 1);
-
- // And of the AppDomainManagerType
- size_t cchType = wcslen(wszAppDomainManagerType) + 1;
- NewArrayHolder<WCHAR> wszAppDomainManagerTypeCopy(new (nothrow) WCHAR[cchType]);
- if (wszAppDomainManagerTypeCopy == NULL)
- {
- return E_OUTOFMEMORY;
- }
- wcsncpy_s(wszAppDomainManagerTypeCopy, cchType, wszAppDomainManagerType, cchType - 1);
-
- LPCWSTR wszOldAsmValue = FastInterlockCompareExchangePointer(&s_wszAppDomainManagerAsm,
- static_cast<LPCWSTR>(wszAppDomainManagerAssemblyCopy.GetValue()),
- NULL);
- if (wszOldAsmValue != NULL)
- {
- // We've tried to setup an AppDomainManager twice ... that's not allowed
- return HOST_E_INVALIDOPERATION;
- }
-
- s_wszAppDomainManagerType = wszAppDomainManagerTypeCopy;
- s_dwDomainManagerInitFlags = dwInitializeDomainFlags;
-
- wszAppDomainManagerAssemblyCopy.SuppressRelease();
- wszAppDomainManagerTypeCopy.SuppressRelease();
- return S_OK;
-}
-#endif // !FEATURE_CORECLR
LPCWSTR CorHost2::GetAppDomainManagerAsm()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- _ASSERTE (g_fEEStarted);
- return s_wszAppDomainManagerAsm;
-#endif // FEATURE_CORECLR
}
LPCWSTR CorHost2::GetAppDomainManagerType()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return NULL;
-#else // FEATURE_CORECLR
- _ASSERTE (g_fEEStarted);
- return s_wszAppDomainManagerType;
-#endif // FEATURE_CORECLR
}
// static
EInitializeNewDomainFlags CorHost2::GetAppDomainManagerInitializeNewDomainFlags()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return eInitializeNewDomainFlags_None;
-#else // FEAUTRE_CORECLR
- _ASSERTE (g_fEEStarted);
- return s_dwDomainManagerInitFlags;
-#endif // FEATURE_CORECLR
}
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
@@ -7229,9 +3797,6 @@ struct ClrTlsInfo
#define DataToClrTlsInfo(a) (a)?(ClrTlsInfo*)((BYTE*)a - offsetof(ClrTlsInfo, data)):NULL
-#if !defined(FEATURE_CORECLR)
-#define HAS_FLS_SUPPORT 1
-#endif
#ifdef HAS_FLS_SUPPORT
@@ -8338,7 +4903,7 @@ SIZE_T STDMETHODCALLTYPE CExecutionEngine::ClrVirtualQuery(LPCVOID lpAddress,
}
#define ClrVirtualQuery EEVirtualQuery
-#if defined(_DEBUG) && defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if defined(_DEBUG) && !defined(FEATURE_PAL)
static VolatilePtr<BYTE> s_pStartOfUEFSection = NULL;
static VolatilePtr<BYTE> s_pEndOfUEFSectionBoundary = NULL;
static Volatile<DWORD> s_dwProtection = 0;
@@ -8388,7 +4953,7 @@ BOOL STDMETHODCALLTYPE CExecutionEngine::ClrVirtualProtect(LPVOID lpAddress,
//
// We assert if either of the two conditions above are true.
-#if defined(_DEBUG) && defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if defined(_DEBUG) && !defined(FEATURE_PAL)
// We do this check in debug/checked builds only
// Do we have the UEF details?
@@ -8569,7 +5134,6 @@ LocaleID RuntimeGetFileSystemLocale()
};
#endif
-#ifdef FEATURE_CORECLR
HRESULT CorHost2::DllGetActivationFactory(DWORD appDomainID, LPCWSTR wszTypeName, IActivationFactory ** factory)
{
#ifdef FEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION
@@ -8599,7 +5163,6 @@ HRESULT CorHost2::DllGetActivationFactory(DWORD appDomainID, LPCWSTR wszTypeName
return E_NOTIMPL;
#endif
}
-#endif
#ifdef FEATURE_COMINTEROP_WINRT_MANAGED_ACTIVATION
@@ -8624,16 +5187,6 @@ HRESULT STDMETHODCALLTYPE DllGetActivationFactoryImpl(LPCWSTR wszAssemblyName,
AppDomain* pDomain = SystemDomain::System()->DefaultDomain();
_ASSERTE(pDomain);
-#ifndef FEATURE_CORECLR // coreclr uses winrt binder which does not allow redirects
- {
- BaseDomain::LockHolder lh(pDomain);
- if (!pDomain->HasLoadContextHostBinder())
- {
- // don't allow redirects
- SystemDomain::InitializeDefaultDomain(FALSE);
- }
- }
-#endif
BEGIN_EXTERNAL_ENTRYPOINT(&hr);
{
diff --git a/src/vm/crossgencompile.cpp b/src/vm/crossgencompile.cpp
index ffb025adb0..d214aa6152 100644
--- a/src/vm/crossgencompile.cpp
+++ b/src/vm/crossgencompile.cpp
@@ -461,12 +461,10 @@ void AppDomain::RaiseLoadingAssemblyEvent(DomainAssembly *pAssembly)
{
}
-#ifdef FEATURE_CORECLR
BOOL AppDomain::BindingByManifestFile()
{
return FALSE;
}
-#endif
ReJitManager::ReJitManager()
{
diff --git a/src/vm/crst.cpp b/src/vm/crst.cpp
index 7bf9bd65da..a1a9a9f71f 100644
--- a/src/vm/crst.cpp
+++ b/src/vm/crst.cpp
@@ -202,62 +202,6 @@ void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CH
#else // !DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR)
-// Slower spin enter path after first attemp failed
-void CrstBase::SpinEnter()
-{
- STATIC_CONTRACT_NOTHROW;
- STATIC_CONTRACT_GC_NOTRIGGER;
- STATIC_CONTRACT_CAN_TAKE_LOCK;
-
- // We only reach this routine when first attemp failed, so time to fire ETW event (fyuan)
-
- // Fire an ETW event to mark the beginning of native contention
- FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::NativeContention, GetClrInstanceId());
-
- // Try spinning and yielding before eventually blocking.
- // The limit of dwRepetitions = 10 is largely arbitrary - feel free to tune if you have evidence
- // you're making things better.
-
- for (DWORD iter = 0; iter < g_SpinConstants.dwRepetitions; iter++)
- {
- DWORD i = g_SpinConstants.dwInitialDuration;
-
- do
- {
- if ( (m_criticalsection.LockCount == -1 ||
- (size_t)m_criticalsection.OwningThread == (size_t) GetCurrentThreadId())
- && UnsafeTryEnterCriticalSection(&m_criticalsection))
- {
- return;
- }
-
- if (g_SystemInfo.dwNumberOfProcessors <= 1)
- {
- break;
- }
-
- // Delay by approximately 2*i clock cycles (Pentium III).
- // This is brittle code - future processors may of course execute this
- // faster or slower, and future code generators may eliminate the loop altogether.
- // The precise value of the delay is not critical, however, and can't think
- // of a better way that isn't machine-dependent.
-
- for (int delayCount = i; --delayCount; )
- {
- YieldProcessor(); // indicate to the processor that we are spining
- }
-
- // exponential backoff: wait a factor longer in the next iteration
- i *= g_SpinConstants.dwBackoffFactor;
- } while (i < g_SpinConstants.dwMaximumDuration);
-
- __SwitchToThread(0, CALLER_LIMITS_SPINNING);
- }
-
- UnsafeEnterCriticalSection(& m_criticalsection);
-}
-#endif // FEATURE_CORECLR
void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CHECK*/))
@@ -438,10 +382,6 @@ void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CH
if (! fIsCriticalSectionEnteredAfterFailingOnce)
{
-#ifndef FEATURE_CORECLR
- // Fire an ETW event to mark the beginning of native contention
- FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::NativeContention, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
fIsCriticalSectionEnteredAfterFailingOnce = TRUE;
hr = m_pHostCrst->Enter(option);
@@ -465,36 +405,13 @@ void CrstBase::Enter(INDEBUG(NoLevelCheckFlag noLevelCheckFlag/* = CRST_LEVEL_CH
Thread::BeginThreadAffinity();
}
-#ifdef FEATURE_CORECLR
UnsafeEnterCriticalSection(&m_criticalsection);
-#else
- // Try entering the critical section once, if we fail we contend
- // and fire the contention start ETW event
- if ((m_criticalsection.LockCount == -1 || (size_t)m_criticalsection.OwningThread == (size_t) GetCurrentThreadId())
- && UnsafeTryEnterCriticalSection(& m_criticalsection))
- {
- }
- else
- {
- SpinEnter();
-
- fIsCriticalSectionEnteredAfterFailingOnce = TRUE;
- }
-#endif
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
INCTHREADLOCKCOUNTTHREAD(pThread);
#endif
}
-#ifndef FEATURE_CORECLR
- // Fire an ETW event to mark the end of native contention
- // This we do only when we have fired a contention start event before
- if (fIsCriticalSectionEnteredAfterFailingOnce)
- {
- FireEtwContentionStop(ETW::ContentionLog::ContentionStructs::NativeContention, GetClrInstanceId());
- }
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
PostEnter();
diff --git a/src/vm/dangerousapis.h b/src/vm/dangerousapis.h
index 13122b7e8d..51686135e8 100644
--- a/src/vm/dangerousapis.h
+++ b/src/vm/dangerousapis.h
@@ -48,20 +48,6 @@ DEFINE_DANGEROUS_API(EVENT_INFO, API_NAMES("AddEventHandler", "Re
DEFINE_DANGEROUS_API(EVENT, API_NAMES("AddEventHandler", "RemoveEventHandler", "ToString"))
DEFINE_DANGEROUS_API(RESOURCE_MANAGER, API_NAMES("GetResourceSet", "InternalGetResourceSet", ".ctor"))
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
-// The COM interfaces implemented by the reflection types.
-// The IDispatch Invoke methods are not included here because they are not implemented in mscorlib.
-DEFINE_DANGEROUS_API(ITYPE, API_NAMES("InvokeMember"))
-DEFINE_DANGEROUS_API(IASSEMBLY, API_NAMES("CreateInstance"))
-DEFINE_DANGEROUS_API(IMETHODBASE, API_NAMES("Invoke"))
-DEFINE_DANGEROUS_API(IMETHODINFO, API_NAMES("Invoke"))
-DEFINE_DANGEROUS_API(ICONSTRUCTORINFO, API_NAMES("Invoke", "Invoke_2", "Invoke_3", "Invoke_4", "Invoke_5"))
-DEFINE_DANGEROUS_API(IFIELDINFO, API_NAMES("GetValue", "SetValue"))
-DEFINE_DANGEROUS_API(IPROPERTYINFO, API_NAMES("GetValue", "SetValue"))
-DEFINE_DANGEROUS_API(IEVENTINFO, API_NAMES("AddEventHandler", "RemoveEventHandler"))
-DEFINE_DANGEROUS_API(IAPPDOMAIN, API_NAMES("CreateInstance", "CreateInstanceFrom", "DefineDynamicAssembly", "Load"))
-DEFINE_DANGEROUS_API(IREFLECT, API_NAMES("InvokeMember"))
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
diff --git a/src/vm/dataimage.cpp b/src/vm/dataimage.cpp
index e90c7e6a0e..df1ef30291 100644
--- a/src/vm/dataimage.cpp
+++ b/src/vm/dataimage.cpp
@@ -128,11 +128,7 @@ DataImage::DataImage(Module *module, CEEPreloader *preloader)
m_pInternedStructures = new InternedStructureHashTable();
-#ifdef FEATURE_CORECLR
m_inlineTrackingMap = NULL;
-#else
- m_inlineTrackingMap = new InlineTrackingMap();
-#endif
}
DataImage::~DataImage()
diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp
index c8b76bf6dc..098bdfdd4e 100644
--- a/src/vm/debugdebugger.cpp
+++ b/src/vm/debugdebugger.cpp
@@ -102,61 +102,6 @@ UINT_PTR FindMostRecentUserCodeOnStack(void)
return address;
}
-#ifndef FEATURE_CORECLR
-// Call into the unhandled-exception processing code to launch Watson.
-//
-// Arguments:
-// address - address to distinguish callsite of break.
-//
-// Notes:
-// Invokes a watson dialog in response to a user break (Debug.Break).
-// Assumes that caller has already enforced any policy it cares about related to whether a debugger is attached.
-void DoWatsonForUserBreak(UINT_PTR address)
-{
- CONTRACTL
- {
- MODE_ANY;
- GC_TRIGGERS;
- THROWS;
- PRECONDITION(address != NULL);
- }
- CONTRACTL_END;
-
- CONTEXT context;
- EXCEPTION_RECORD exceptionRecord;
- EXCEPTION_POINTERS exceptionPointers;
-
- ZeroMemory(&context, sizeof(context));
- ZeroMemory(&exceptionRecord, sizeof(exceptionRecord));
- ZeroMemory(&exceptionPointers, sizeof(exceptionPointers));
-
- // Try to locate the user managed code invoking System.Diagnostics.Debugger.Break
- UINT_PTR userCodeAddress = FindMostRecentUserCodeOnStack();
- if (userCodeAddress != NULL)
- {
- address = userCodeAddress;
- }
-
- LOG((LF_EH, LL_INFO10, "DoDebugBreak: break at %0p\n", address));
-
- exceptionRecord.ExceptionAddress = reinterpret_cast< PVOID >(address);
- exceptionPointers.ExceptionRecord = &exceptionRecord;
- exceptionPointers.ContextRecord = &context;
-
- Thread *pThread = GetThread();
- PTR_EHWatsonBucketTracker pUEWatsonBucketTracker = pThread->GetExceptionState()->GetUEWatsonBucketTracker();
- _ASSERTE(pUEWatsonBucketTracker != NULL);
- pUEWatsonBucketTracker->SaveIpForWatsonBucket(address);
- pUEWatsonBucketTracker->CaptureUnhandledInfoForWatson(TypeOfReportedError::UserBreakpoint, pThread, NULL);
- if (pUEWatsonBucketTracker->RetrieveWatsonBuckets() == NULL)
- {
- pUEWatsonBucketTracker->ClearWatsonBucketDetails();
- }
-
- WatsonLastChance(GetThread(), &exceptionPointers, TypeOfReportedError::UserBreakpoint);
-
-} // void DoDebugBreak()
-#endif // !FEATURE_CORECLR
// This does a user break, triggered by System.Diagnostics.Debugger.Break, or the IL opcode for break.
//
@@ -210,12 +155,6 @@ FCIMPL0(void, DebugDebugger::Break)
}
else
{
-#ifndef FEATURE_CORECLR
- // No debugger attached -- Watson up.
-
- // The HelperMethodFrame knows how to get the return address.
- DoWatsonForUserBreak(HELPER_METHOD_FRAME_GET_RETURN_ADDRESS());
-#endif //FEATURE_CORECLR
}
HELPER_METHOD_FRAME_END();
diff --git a/src/vm/disassembler.h b/src/vm/disassembler.h
index 1b3bf46e0e..5a7976a44f 100644
--- a/src/vm/disassembler.h
+++ b/src/vm/disassembler.h
@@ -10,7 +10,6 @@
#define USE_COREDISTOOLS_DISASSEMBLER 0
#define USE_MSVC_DISASSEMBLER 0
#ifdef HAVE_GCCOVER
- #if defined(FEATURE_CORECLR)
// COREDISTOOLS disassembler only supports amd64 and x86, so if this is
// CoreCLR but not amd64 and not x86, we will fall out of this check and not
// set USE_DISASSEMBLER.
@@ -18,10 +17,6 @@
#undef USE_COREDISTOOLS_DISASSEMBLER
#define USE_COREDISTOOLS_DISASSEMBLER 1
#endif
- #elif defined(_TARGET_AMD64_) || defined(_TARGET_X86_)
- #undef USE_MSVC_DISASSEMBLER
- #define USE_MSVC_DISASSEMBLER 1
- #endif // defined(FEATURE_CORECLR) || defined(_TARGET_AMD64_) || defined(_TARGET_X86_)
#endif // HAVE_GCCOVER
#if USE_COREDISTOOLS_DISASSEMBLER
diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp
index d2d8c96694..98e58c60c7 100644
--- a/src/vm/dllimport.cpp
+++ b/src/vm/dllimport.cpp
@@ -50,10 +50,6 @@
#include "eventtrace.h"
-#ifndef FEATURE_CORECLR
-#define NEEDDATA
-#include "fxretarget.h"
-#endif
#include "clr/fs/path.h"
using namespace clr::fs;
@@ -913,7 +909,6 @@ public:
}
#endif // MDA_SUPPORTED
-#ifdef FEATURE_CORECLR
// For CoreClr, clear the last error before calling the target that returns last error.
// There isn't always a way to know the function have failed without checking last error,
// in particular on Unix.
@@ -921,7 +916,6 @@ public:
{
pcsDispatch->EmitCALL(METHOD__STUBHELPERS__CLEAR_LAST_ERROR, 0, 0);
}
-#endif // FEATURE_CORECLR
// Invoke the target (calli, call method, call delegate, get/set field, etc.)
EmitInvokeTarget(pStubMD);
@@ -1158,178 +1152,8 @@ public:
LOG((LF_STUBS, LL_INFO1000, "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"));
#endif // LOGGING
-#ifndef FEATURE_CORECLR
- //
- // Publish ETW events for IL stubs
- //
-
- // If the category and the event is enabled...
- if (ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, ILStubGenerated))
- {
- EtwOnILStubGenerated(
- pStubMD,
- pbLocalSig,
- cbSig,
- jitFlags,
- &convertToHRTryCatch,
- &cleanupTryFinally,
- maxStack,
- (DWORD)cbCode
- );
- }
-#endif // !FEATURE_CORECLR
}
-#ifndef FEATURE_CORECLR
- //---------------------------------------------------------------------------------------
- //
- void
- EtwOnILStubGenerated(
- MethodDesc * pStubMD,
- PCCOR_SIGNATURE pbLocalSig,
- DWORD cbSig,
- CORJIT_FLAGS jitFlags,
- ILStubEHClause * pConvertToHRTryCatchBounds,
- ILStubEHClause * pCleanupTryFinallyBounds,
- DWORD maxStack,
- DWORD cbCode)
- {
- STANDARD_VM_CONTRACT;
-
- //
- // Interop Method Information
- //
- MethodDesc *pTargetMD = m_slIL.GetTargetMD();
- SString strNamespaceOrClassName, strMethodName, strMethodSignature;
- UINT64 uModuleId = 0;
-
- if (pTargetMD)
- {
- pTargetMD->GetMethodInfoWithNewSig(strNamespaceOrClassName, strMethodName, strMethodSignature);
- uModuleId = (UINT64)pTargetMD->GetModule()->GetAddrModuleID();
- }
-
- //
- // Stub Method Signature
- //
- SString stubNamespaceOrClassName, stubMethodName, stubMethodSignature;
- pStubMD->GetMethodInfoWithNewSig(stubNamespaceOrClassName, stubMethodName, stubMethodSignature);
-
- IMDInternalImport *pStubImport = pStubMD->GetModule()->GetMDImport();
-
- CQuickBytes qbLocal;
- PrettyPrintSig(pbLocalSig, (DWORD)cbSig, NULL, &qbLocal, pStubImport, NULL);
-
- SString strLocalSig(SString::Utf8, (LPCUTF8)qbLocal.Ptr());
-
- //
- // Native Signature
- //
- SString strNativeSignature(SString::Utf8);
- if (m_dwStubFlags & NDIRECTSTUB_FL_REVERSE_INTEROP)
- {
- // Reverse interop. Use StubSignature
- strNativeSignature = stubMethodSignature;
- }
- else
- {
- // Forward interop. Use StubTarget siganture
- PCCOR_SIGNATURE pCallTargetSig = GetStubTargetMethodSig();
- DWORD cCallTargetSig = GetStubTargetMethodSigLength();
-
- CQuickBytes qbCallTargetSig;
-
- PrettyPrintSig(pCallTargetSig, cCallTargetSig, "", &qbCallTargetSig, pStubImport, NULL);
-
- strNativeSignature.SetUTF8((LPCUTF8)qbCallTargetSig.Ptr());
- }
-
- //
- // Dump IL stub code
- //
- SString strILStubCode;
- strILStubCode.Preallocate(4096); // Preallocate 4K bytes to avoid unnecessary growth
-
- SString codeSizeFormat;
- codeSizeFormat.LoadResource(CCompRC::Optional, IDS_EE_INTEROP_CODE_SIZE_COMMENT);
- strILStubCode.AppendPrintf(W("// %s\t%d (0x%04x)\n"), codeSizeFormat.GetUnicode(), cbCode, cbCode);
- strILStubCode.AppendPrintf(W(".maxstack %d \n"), maxStack);
- strILStubCode.AppendPrintf(W(".locals %s\n"), strLocalSig.GetUnicode());
-
- m_slIL.LogILStub(jitFlags, &strILStubCode);
-
- if (pConvertToHRTryCatchBounds->cbTryLength != 0 && pConvertToHRTryCatchBounds->cbHandlerLength != 0)
- {
- strILStubCode.AppendPrintf(
- W(".try IL_%04x to IL_%04x catch handler IL_%04x to IL_%04x\n"),
- pConvertToHRTryCatchBounds->dwTryBeginOffset,
- pConvertToHRTryCatchBounds->dwTryBeginOffset + pConvertToHRTryCatchBounds->cbTryLength,
- pConvertToHRTryCatchBounds->dwHandlerBeginOffset,
- pConvertToHRTryCatchBounds->dwHandlerBeginOffset + pConvertToHRTryCatchBounds->cbHandlerLength);
- }
-
- if (pCleanupTryFinallyBounds->cbTryLength != 0 && pCleanupTryFinallyBounds->cbHandlerLength != 0)
- {
- strILStubCode.AppendPrintf(
- W(".try IL_%04x to IL_%04x finally handler IL_%04x to IL_%04x\n"),
- pCleanupTryFinallyBounds->dwTryBeginOffset,
- pCleanupTryFinallyBounds->dwTryBeginOffset + pCleanupTryFinallyBounds->cbTryLength,
- pCleanupTryFinallyBounds->dwHandlerBeginOffset,
- pCleanupTryFinallyBounds->dwHandlerBeginOffset + pCleanupTryFinallyBounds->cbHandlerLength);
- }
-
- //
- // Fire the event
- //
- DWORD dwFlags = 0;
- if (m_dwStubFlags & NDIRECTSTUB_FL_REVERSE_INTEROP)
- dwFlags |= ETW_IL_STUB_FLAGS_REVERSE_INTEROP;
-#ifdef FEATURE_COMINTEROP
- if (m_dwStubFlags & NDIRECTSTUB_FL_COM)
- dwFlags |= ETW_IL_STUB_FLAGS_COM_INTEROP;
-#endif // FEATURE_COMINTEROP
- if (m_dwStubFlags & NDIRECTSTUB_FL_NGENEDSTUB)
- dwFlags |= ETW_IL_STUB_FLAGS_NGENED_STUB;
- if (m_dwStubFlags & NDIRECTSTUB_FL_DELEGATE)
- dwFlags |= ETW_IL_STUB_FLAGS_DELEGATE;
- if (m_dwStubFlags & NDIRECTSTUB_FL_CONVSIGASVARARG)
- dwFlags |= ETW_IL_STUB_FLAGS_VARARG;
- if (m_dwStubFlags & NDIRECTSTUB_FL_UNMANAGED_CALLI)
- dwFlags |= ETW_IL_STUB_FLAGS_UNMANAGED_CALLI;
-
- DWORD dwToken = 0;
- if (pTargetMD)
- dwToken = pTargetMD->GetMemberDef();
-
-
- //
- // Truncate string fields. Make sure the whole event is less than 64KB
- //
- TruncateUnicodeString(strNamespaceOrClassName, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strMethodName, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strMethodSignature, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strNativeSignature, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(stubMethodSignature, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strILStubCode, ETW_IL_STUB_EVENT_CODE_STRING_FIELD_MAXSIZE);
-
- //
- // Fire ETW event
- //
- FireEtwILStubGenerated(
- GetClrInstanceId(), // ClrInstanceId
- uModuleId, // ModuleIdentifier
- (UINT64)pStubMD, // StubMethodIdentifier
- dwFlags, // StubFlags
- dwToken, // ManagedInteropMethodToken
- strNamespaceOrClassName.GetUnicode(), // ManagedInteropMethodNamespace
- strMethodName.GetUnicode(), // ManagedInteropMethodName
- strMethodSignature.GetUnicode(), // ManagedInteropMethodSignature
- strNativeSignature.GetUnicode(), // NativeSignature
- stubMethodSignature.GetUnicode(), // StubMethodSigature
- strILStubCode.GetUnicode() // StubMethodILCode
- );
- } // EtwOnILStubGenerated
-#endif // !FEATURE_CORECLR
#ifdef LOGGING
//---------------------------------------------------------------------------------------
@@ -1790,10 +1614,6 @@ NDirectStubLinker::NDirectStubLinker(
m_dwThreadLocalNum(-1),
m_dwCleanupWorkListLocalNum(-1),
m_dwRetValLocalNum(-1),
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- m_dwFirstCopyCtorCookieLocalNum(-1),
- m_dwLastCopyCtorCookieLocalNum(-1),
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
m_ErrorResID(-1),
m_ErrorParamIdx(-1),
m_iLCIDParamIdx(iLCIDParamIdx),
@@ -2218,46 +2038,6 @@ void NDirectStubLinker::LoadCleanupWorkList(ILCodeStream* pcsEmit)
pcsEmit->EmitLDLOCA(GetCleanupWorkListLocalNum());
}
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
-
-BOOL NDirectStubLinker::IsCopyCtorStubNeeded()
-{
- LIMITED_METHOD_CONTRACT;
- return (m_dwFirstCopyCtorCookieLocalNum != (DWORD)-1);
-}
-
-DWORD NDirectStubLinker::CreateCopyCtorCookie(ILCodeStream* pcsEmit)
-{
- STANDARD_VM_CONTRACT;
-
- MethodTable *pCookieMT = MscorlibBinder::GetClass(CLASS__COPYCTORSTUBCOOKIE);
-
- LocalDesc desc(pCookieMT);
- DWORD dwCookieLocalNum = pcsEmit->NewLocal(desc);
-
- // <dwCookieLocalNum> = new CopyCtorStubCookie()
- pcsEmit->EmitLDLOCA(dwCookieLocalNum);
- pcsEmit->EmitINITOBJ(pcsEmit->GetToken(pCookieMT));
-
- if (m_dwLastCopyCtorCookieLocalNum == (DWORD)-1)
- {
- // this is the first cookie in this stub
- m_dwFirstCopyCtorCookieLocalNum = dwCookieLocalNum;
- }
- else
- {
- // this is not the first cookie - build a linked list
- // <m_dwLastCopyCtorCookieLocalNum>.SetNext(&<dwCookieLocalNum>)
- pcsEmit->EmitLDLOCA(m_dwLastCopyCtorCookieLocalNum);
- pcsEmit->EmitLDLOCA(dwCookieLocalNum);
- pcsEmit->EmitCALL(METHOD__COPYCTORSTUBCOOKIE__SET_NEXT, 2, 0);
- }
-
- m_dwLastCopyCtorCookieLocalNum = dwCookieLocalNum;
- return dwCookieLocalNum;
-}
-
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
void NDirectStubLinker::Begin(DWORD dwStubFlags)
{
@@ -2292,23 +2072,6 @@ void NDirectStubLinker::Begin(DWORD dwStubFlags)
if (SF_IsForwardStub(dwStubFlags))
{
-#ifndef FEATURE_CORECLR // CAS
- // we may need to demand security permission
- if (SF_IsStubWithDemand(dwStubFlags))
- {
- if (SF_IsCOMStub(dwStubFlags) || SF_IsDelegateStub(dwStubFlags))
- {
- // pass NULL NDirectMethodDesc for COM and delegate P/Invoke
- m_pcsSetup->EmitLoadNullPtr();
- }
- else
- {
- // pass the real MD for direct P/Invoke
- EmitLoadStubContext(m_pcsSetup, dwStubFlags);
- }
- m_pcsSetup->EmitCALL(METHOD__STUBHELPERS__DEMAND_PERMISSION, 1, 0);
- }
-#endif // !FEATURE_CORECLR
if (SF_IsStubWithCctorTrigger(dwStubFlags))
{
@@ -2327,7 +2090,7 @@ void NDirectStubLinker::Begin(DWORD dwStubFlags)
if (SF_IsDelegateStub(dwStubFlags))
{
-#if defined(MDA_SUPPORTED) || (defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR))
+#if defined(MDA_SUPPORTED)
// GC was induced (gcUnmanagedToManagedMDA), arguments have been marshaled, and we are about
// to touch the UMEntryThunk and extract the delegate target from it so this is the right time
// to do the collected delegate MDA check.
@@ -2469,38 +2232,6 @@ void NDirectStubLinker::DoNDirect(ILCodeStream *pcsEmit, DWORD dwStubFlags, Meth
STANDARD_VM_CONTRACT;
if (SF_IsForwardStub(dwStubFlags)) // managed-to-native
{
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- // set the copy ctor cookie chain if needed
- if (IsCopyCtorStubNeeded())
- {
- // StubHelpers.SetCopyCtorCookieChain(pStubArg, pUnmngThis, dwStubFlags, &<m_dwFirstCopyCtorCookieLocalNum>)
- if (SF_IsDelegateStub(dwStubFlags))
- {
- // for forward delegate P/Invoke load the target from 'this'
- pcsEmit->EmitLoadThis();
- pcsEmit->EmitLDFLD(pcsEmit->GetToken(MscorlibBinder::GetField(FIELD__DELEGATE__METHOD_PTR_AUX)));
- }
- else
- {
- // otherwise load the secret argument
- EmitLoadStubContext(pcsEmit, dwStubFlags);
- }
-
- if (SF_IsCOMStub(dwStubFlags))
- {
- // for forward COM load the unmanaged interface pointer
- pcsEmit->EmitLDLOC(m_dwTargetInterfacePointerLocalNum);
- }
- else
- {
- // otherwise load 0
- pcsEmit->EmitLoadNullPtr();
- }
- pcsEmit->EmitLDC(dwStubFlags);
- pcsEmit->EmitLDLOCA(m_dwFirstCopyCtorCookieLocalNum);
- pcsEmit->EmitCALL(METHOD__STUBHELPERS__SET_COPY_CTOR_COOKIE_CHAIN, 4, 0);
- }
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
if (SF_IsDelegateStub(dwStubFlags)) // delegate invocation
{
@@ -2529,15 +2260,6 @@ void NDirectStubLinker::DoNDirect(ILCodeStream *pcsEmit, DWORD dwStubFlags, Meth
#ifdef _TARGET_X86_
-#ifndef FEATURE_CORECLR
- if (IsCopyCtorStubNeeded())
- {
- // if we need to call copy ctor(s), we go to the copy ctor stub
- Stub *pCopyCtorStub = NDirect::GetStubForCopyCtor();
- pcsEmit->EmitLDC((DWORD_PTR)pCopyCtorStub->GetEntryPoint());
- }
- else
-#endif // !FEATURE_CORECLR
{
// for managed-to-unmanaged CALLI that requires marshaling, the target is passed
// as the secret argument to the stub by GenericPInvokeCalliHelper (asmhelpers.asm)
@@ -4217,16 +3939,6 @@ static void CreateNDirectStubWorker(StubState* pss,
fMarshalReturnValueFirst = HasRetBuffArg(&msig);
#endif
-#if defined(_TARGET_AMD64_) && defined(_WIN64) && !defined(FEATURE_CORECLR)
- // JIT64 (which is only used on the Windows Desktop CLR) has a problem generating code
- // for the pinvoke ILStubs which do a return using a struct type. Therefore, we
- // change the signature of calli to return void and make the return buffer as first argument.
- // This matches the ABI i.e. return buffer is passed as first arg. So native target will get
- // the return buffer in correct register.
- // Ideally we only want to set it for JIT64 and not ryujit but currently there isn't a fast way
- // to determine that at runtime.
- fMarshalReturnValueFirst = HasRetBuffArg(&msig);
-#endif
}
if (fMarshalReturnValueFirst)
@@ -4388,12 +4100,6 @@ static void CreateNDirectStubWorker(StubState* pss,
COMPlusThrow(kMarshalDirectiveException, IDS_EE_NDIRECT_BADNATL_THISCALL);
}
-#ifndef FEATURE_CORECLR
- if (info.GetMarshalType() == MarshalInfo::MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR)
- {
- fHasCopyCtorArgs = true;
- }
-#endif // !FEATURE_CORECLR
argidx++;
}
@@ -6206,15 +5912,6 @@ VOID NDirectMethodDesc::SetNDirectTarget(LPVOID pTarget)
#ifdef _TARGET_X86_
-#ifndef FEATURE_CORECLR
- if (HasCopyCtorArgs())
- {
- _ASSERTE(pInterceptStub == NULL);
-
- // static stub that gets its arguments in a thread-static field
- pInterceptStub = NDirect::GetStubForCopyCtor();
- }
-#endif // !FEATURE_CORECLR
#ifdef MDA_SUPPORTED
if (!IsQCall() && MDA_GET_ASSISTANT(PInvokeStackImbalance))
@@ -6263,39 +5960,6 @@ VOID NDirectMethodDesc::SetNDirectTarget(LPVOID pTarget)
}
}
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
-
-// Returns a small stub whose purpose is to record current ESP and call code:CopyCtorCallStubWorker
-// to invoke copy constructors and destructors as appropriate. This stub operates on arguments
-// already pushed to the stack by JITted IL stub and must not create a new frame, i.e. it must
-// tail call to the target for it to see the arguments that copy ctors have been called on.
-//
-// As a consequence, the stub doesn't take any extra secret arguments and the description of the
-// ctors/dtors to call is passed "out-of-band" in a thread static field. The worker returns
-// address of the real target (also passed out of band) which enables us to have only one static
-// stub in i386\asmhelpers.asm.
-
-// static
-Stub *NDirect::GetStubForCopyCtor()
-{
- STANDARD_VM_CONTRACT;
-
- static Stub *s_pStub = NULL;
-
- if (s_pStub == NULL)
- {
- Stub *pStub = Stub::NewStub(GetEEFuncEntryPoint(CopyCtorCallStub));
- if (InterlockedCompareExchangeT(&s_pStub, pStub, NULL) != NULL)
- {
- pStub->DecRef();
- }
- }
-
- s_pStub->IncRef();
- return s_pStub;
-}
-
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
BOOL NDirect::IsHostHookEnabled()
@@ -6354,147 +6018,6 @@ EXTERN_C VOID __stdcall PInvokeStackImbalanceWorker(StackImbalanceCookie *pSICoo
}
#endif // _TARGET_X86_ && MDA_SUPPORTED
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
-struct CopyCtorStubCookie // same layout as StubHelpers.CopyCtorStubCookie
-{
- LPVOID m_srcInstancePtr;
- DWORD m_dstStackOffset;
- LPVOID m_ctorPtr; // managed method ptr
- LPVOID m_dtorPtr; // managed method ptr
-
- CopyCtorStubCookie *m_pNext;
-};
-
-struct CopyCtorStubDesc // same layout as StubHelpers.CopyCtorStubDesc
-{
- CopyCtorStubCookie *m_pCookie;
- LPVOID m_pTarget;
-};
-
-// Called by CopyCtorCallStub after we have already transitioned to unmanaged. Invokes copy ctor(s)
-// and dtor(s) using reverse P/Invoke which has some perf impact but provides all the debugging and
-// profiling support. An alternative solution would be CallDescr or some optimized variant of it
-// which would probably result in confusing call stacks.
-EXTERN_C LPVOID __stdcall CopyCtorCallStubWorker(BYTE *pESP)
-{
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_MODE_PREEMPTIVE; // we've already switched to preemptive
-
- CopyCtorStubCookie *pCookie;
- LPVOID pTarget;
- {
- GCX_COOP();
- // get address of the thread-static field
- FieldDesc *pFD = MscorlibBinder::GetField(FIELD__STUBHELPERS__COPY_CTOR_STUB_DESC);
-
- CopyCtorStubDesc *pStubDesc = (CopyCtorStubDesc *)Thread::GetStaticFieldAddress(pFD);
-
- // read the fields in cooperative mode
- pCookie = pStubDesc->m_pCookie;
- pTarget = pStubDesc->m_pTarget;
-
- _ASSERTE(pCookie != NULL && pTarget != NULL);
-
- // make sure we ASSERT/AV reliably if we are called by mistake
- pStubDesc->m_pCookie = NULL;
- pStubDesc->m_pTarget = NULL;
- }
-
- while (pCookie != NULL)
- {
- if (pCookie->m_ctorPtr != NULL)
- {
- // get reverse P/Invoke to the copy ctor (cache on AD)
- MethodDesc *pMD = Entry2MethodDesc((PCODE)pCookie->m_ctorPtr, NULL);
- UMEntryThunk *pUMEntryThunk = GetAppDomain()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
-
- // GetUMEntryThunk always returns stdcall-able function pointers for ordinary managed methods
- // but the ctor can be a P/Invoke (pre-Whidbey MC++ only)
- typedef void (__stdcall *CtorFnPtr_StdCall) (LPVOID dst, LPVOID src);
- typedef void (__thiscall *CtorFnPtr_ThisCall)(LPVOID dst, LPVOID src);
- typedef void (__cdecl *CtorFnPtr_Cdecl) (LPVOID dst, LPVOID src);
-
- // call the copy ctor using the right calling convention
- UMThunkMarshInfo *pMarshInfo = pUMEntryThunk->GetUMThunkMarshInfo();
- pMarshInfo->RunTimeInit();
-
- switch (pMarshInfo->GetCallingConvention() & pmCallConvMask)
- {
- case pmCallConvStdcall:
- case pmCallConvWinapi:
- {
- CtorFnPtr_StdCall fnPtr = (CtorFnPtr_StdCall)pUMEntryThunk->GetCode();
- fnPtr(pESP + pCookie->m_dstStackOffset, pCookie->m_srcInstancePtr);
- break;
- }
-
- case pmCallConvThiscall:
- {
- CtorFnPtr_ThisCall fnPtr = (CtorFnPtr_ThisCall)pUMEntryThunk->GetCode();
- fnPtr(pESP + pCookie->m_dstStackOffset, pCookie->m_srcInstancePtr);
- break;
- }
-
- default:
- {
- _ASSERTE((pMarshInfo->GetCallingConvention() & pmCallConvMask) == pmCallConvCdecl);
-
- CtorFnPtr_Cdecl fnPtr = (CtorFnPtr_Cdecl)pUMEntryThunk->GetCode();
- fnPtr(pESP + pCookie->m_dstStackOffset, pCookie->m_srcInstancePtr);
- break;
- }
- }
- }
- if (pCookie->m_dtorPtr != NULL)
- {
- // get reverse P/Invoke to the dtor (cache on AD)
- MethodDesc *pMD = Entry2MethodDesc((PCODE)pCookie->m_dtorPtr, NULL);
- UMEntryThunk *pUMEntryThunk = GetAppDomain()->GetUMEntryThunkCache()->GetUMEntryThunk(pMD);
-
- // GetUMEntryThunk always returns stdcall-able function pointers for ordinary managed methods
- // but the dtor can be a P/Invoke (pre-Whidbey MC++ only)
- typedef void (__stdcall *DtorFnPtr_StdCall) (LPVOID src);
- typedef void (__thiscall *DtorFnPtr_ThisCall)(LPVOID src);
- typedef void (__cdecl *DtorFnPtr_Cdecl) (LPVOID src);
-
- // call the dtor using the right calling convention
- UMThunkMarshInfo *pMarshInfo = pUMEntryThunk->GetUMThunkMarshInfo();
- pMarshInfo->RunTimeInit();
-
- switch (pMarshInfo->GetCallingConvention() & pmCallConvMask)
- {
- case pmCallConvStdcall:
- case pmCallConvWinapi:
- {
- DtorFnPtr_StdCall fnPtr = (DtorFnPtr_StdCall)pUMEntryThunk->GetCode();
- fnPtr(pCookie->m_srcInstancePtr);
- break;
- }
-
- case pmCallConvThiscall:
- {
- DtorFnPtr_ThisCall fnPtr = (DtorFnPtr_ThisCall)pUMEntryThunk->GetCode();
- fnPtr(pCookie->m_srcInstancePtr);
- break;
- }
-
- default:
- {
- _ASSERTE((pMarshInfo->GetCallingConvention() & pmCallConvMask) == pmCallConvCdecl);
-
- DtorFnPtr_Cdecl fnPtr = (DtorFnPtr_Cdecl)pUMEntryThunk->GetCode();
- fnPtr(pCookie->m_srcInstancePtr);
- break;
- }
- }
- }
- pCookie = pCookie->m_pNext;
- }
-
- return pTarget;
-}
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
// Preserving good error info from DllImport-driven LoadLibrary is tricky because we keep loading from different places
// if earlier loads fail and those later loads obliterate error codes.
@@ -6662,79 +6185,6 @@ static HMODULE LocalLoadLibraryDirectHelper(LPCWSTR name, DWORD flags, LoadLibEr
#define TOLOWER(a) (((a) >= W('A') && (a) <= W('Z')) ? (W('a') + (a - W('A'))) : (a))
#define TOHEX(a) ((a)>=10 ? W('a')+(a)-10 : W('0')+(a))
-#ifndef FEATURE_CORECLR
-/*static*/
-VOID NDirect::CheckUnificationList(NDirectMethodDesc * pMD, DWORD * pDllImportSearchPathFlag, BOOL * pSearchAssemblyDirectory)
-{
- CONTRACTL
- {
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- // If neither assembly and method have the attribute, check the unification list.
- Assembly *pAssembly = pMD->GetAssembly();
-
- if (!pAssembly->IsStrongNamed())
- return;
-
- const char * simpleName = pAssembly->GetSimpleName();
-
- StringHashIterator(it, g_arFxPolicy, simpleName);
-
- int pos;
-
- while ((pos = it.GetNext()) >= 0)
- {
- const FrameworkConfig & config = g_arFxPolicy[pos];
-
- FixedSizeString<char> asmName;
-
- config.GetFxAssemblyName(asmName);
-
- if (_stricmp(asmName, simpleName) == 0)
- {
- DWORD cbPublicKey = 0;
- const void *pbPublicKey = NULL;
- pbPublicKey = pAssembly->GetPublicKey(&cbPublicKey);
-
- //
- // StrongNameTokenFromPublicKey is potentially expensive operation. Do it only once we got a match on the simple name.
- //
- StrongNameBufferHolder<BYTE> pbStrongNameToken;
- DWORD cbStrongNameToken;
-
- if (StrongNameTokenFromPublicKey((BYTE*) pbPublicKey,cbPublicKey,&pbStrongNameToken,&cbStrongNameToken))
- {
- BOOL pktIsEqual = TRUE;
-
- LPCWSTR pwzPKT = config.GetPKT();
-
- for (UINT j = 0; j < cbStrongNameToken; j++)
- {
- WCHAR firstChar = TOHEX(pbStrongNameToken[j] / 16);
- WCHAR secondChar = TOHEX(pbStrongNameToken[j] % 16);
-
- if (firstChar != TOLOWER(pwzPKT[j*2]) || secondChar != TOLOWER(pwzPKT[j*2+1]))
- {
- pktIsEqual = FALSE;
- break;
- }
- }
-
- if (pktIsEqual)
- {
- *pDllImportSearchPathFlag = LOAD_LIBRARY_SEARCH_DEFAULT_DIRS;
- *pSearchAssemblyDirectory = TRUE;
- break;
- }
- }
- }
- }
-}
-#endif // !FEATURE_CORECLR
// static
HMODULE NDirect::LoadLibraryFromPath(LPCWSTR libraryPath)
@@ -6878,7 +6328,6 @@ HMODULE NDirect::LoadFromPInvokeAssemblyDirectory(Assembly *pAssembly, LPCWSTR l
return hmod;
}
-#ifdef FEATURE_CORECLR
// Try to load the module from the native DLL search directories
HMODULE NDirect::LoadFromNativeDllSearchDirectories(AppDomain* pDomain, LPCWSTR libName, DWORD flags, LoadLibErrorTracker *pErrorTracker)
{
@@ -6902,7 +6351,6 @@ HMODULE NDirect::LoadFromNativeDllSearchDirectories(AppDomain* pDomain, LPCWSTR
return hmod;
}
-#endif // FEATURE_CORECLR
HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracker * pErrorTracker)
{
@@ -6970,13 +6418,11 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke
}
#endif // FEATURE_CORESYSTEM && !FEATURE_PAL
-#ifdef FEATURE_CORECLR
if (hmod == NULL)
{
// NATIVE_DLL_SEARCH_DIRECTORIES set by host is considered well known path
hmod = LoadFromNativeDllSearchDirectories(pDomain, wszLibName, loadWithAlteredPathFlags, pErrorTracker);
}
-#endif // FEATURE_CORECLR
DWORD dllImportSearchPathFlag = 0;
BOOL searchAssemblyDirectory = TRUE;
@@ -7007,12 +6453,6 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke
}
}
-#ifndef FEATURE_CORECLR
- if (!attributeIsFound)
- {
- CheckUnificationList(pMD, &dllImportSearchPathFlag, &searchAssemblyDirectory);
- }
-#endif
if (!libNameIsRelativePath)
{
@@ -7031,68 +6471,6 @@ HINSTANCE NDirect::LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracke
Assembly* pAssembly = pMD->GetMethodTable()->GetAssembly();
hmod = LoadFromPInvokeAssemblyDirectory(pAssembly, wszLibName, loadWithAlteredPathFlags | dllImportSearchPathFlag, pErrorTracker);
-#ifndef FEATURE_CORECLR
- if (hmod == NULL)
- {
- // Try to load the DLL alongside the assembly where the PInvoke was
- // declared using the codebase of the assembly. This is required for download
- // and shadow copy scenarios.
- const WCHAR* ptr;
- SString codebase;
- pAssembly->GetCodeBase(codebase);
- DWORD dwCodebaseLength = codebase.GetCount();
-
- // Strip off the protocol
- for (ptr = codebase.GetUnicode(); *ptr && *ptr != W(':'); ptr++);
-
- // If we have a code base then prepend it to the library name
- if (*ptr)
- {
- SString pathFromCodebase;
-
- // After finding the colon move forward until no more forward slashes
- for (ptr++; *ptr && *ptr == W('/'); ptr++);
- if (*ptr)
- {
- // Calculate the number of characters we are interested in
- if (dwCodebaseLength > (DWORD)(ptr - codebase.GetUnicode()) )
- {
- // Back up to the last slash (forward or backwards)
- const WCHAR* tail;
-
- for (tail = codebase.GetUnicode() + (dwCodebaseLength - 1); tail > ptr && *tail != W('/') && *tail != W('\\'); tail--);
-
- if (tail > ptr)
- {
- for (;ptr <= tail; ptr++)
- {
- if (*ptr == W('/'))
- pathFromCodebase.Append(W('\\'));
- else
- pathFromCodebase.Append(*ptr);
- }
- }
- }
- }
-
- pathFromCodebase.Append(wszLibName);
-
- SString path = pAssembly->GetManifestFile()->GetPath();
- SString::Iterator i = path.End();
- if (PEAssembly::FindLastPathSeparator(path, i))
- {
- i++;
- path.Truncate(i);
- path.Append(wszLibName);
- }
-
- if (!pathFromCodebase.EqualsCaseInsensitive(path, PEImage::GetFileSystemLocale()))
- {
- hmod = LocalLoadLibraryHelper(pathFromCodebase, loadWithAlteredPathFlags | dllImportSearchPathFlag, pErrorTracker);
- }
- }
- }
-#endif // !FEATURE_CORECLR
}
}
@@ -7291,25 +6669,6 @@ VOID NDirect::NDirectLink(NDirectMethodDesc *pMD)
}
CONTRACTL_END;
-#if !defined(FEATURE_CORECLR)
- // Generate a table of some well known native dlls
- s_pWellKnownNativeModules = ::new PtrHashMap();
- s_pWellKnownNativeModules->Init(sizeof(wellKnownModules)/sizeof(LPCWSTR), CompareLibNames, TRUE, NULL);
- for (int index = 0; index < sizeof(wellKnownModules)/sizeof(LPCWSTR); index++)
- {
- s_pWellKnownNativeModules->InsertValue((UPTR) HashiString(wellKnownModules[index]), (LPVOID)wellKnownModules[index]);
- }
-
- // Check if the OS supports the new secure LoadLibraryEx flags introduced in KB2533623
- HMODULE hMod = CLRGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- _ASSERTE(hMod != NULL);
-
- if (GetProcAddress(hMod, "AddDllDirectory") != NULL)
- {
- // The AddDllDirectory export was added in KB2533623 together with the new flag support
- s_fSecureLoadLibrarySupported = true;
- }
-#endif // !FEATURE_CORECLR
}
diff --git a/src/vm/dllimport.h b/src/vm/dllimport.h
index a989af35ff..ca046614f0 100644
--- a/src/vm/dllimport.h
+++ b/src/vm/dllimport.h
@@ -80,9 +80,6 @@ public:
static HMODULE LoadLibraryFromPath(LPCWSTR libraryPath);
static HINSTANCE LoadLibraryModule(NDirectMethodDesc * pMD, LoadLibErrorTracker *pErrorTracker);
-#ifndef FEATURE_CORECLR
- static VOID CheckUnificationList(NDirectMethodDesc * pMD, DWORD * pDllImportSearchPathFlag, BOOL * pSearchAssemblyDirectory);
-#endif // !FEATURE_CORECLR
static VOID NDirectLink(NDirectMethodDesc *pMD);
@@ -121,9 +118,6 @@ public:
inline static ILStubCache* GetILStubCache(NDirectStubParameters* pParams);
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- static Stub* GetStubForCopyCtor();
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
static BOOL IsHostHookEnabled();
@@ -132,9 +126,7 @@ public:
private:
NDirect() {LIMITED_METHOD_CONTRACT;}; // prevent "new"'s on this class
-#ifdef FEATURE_CORECLR
static HMODULE LoadFromNativeDllSearchDirectories(AppDomain* pDomain, LPCWSTR libName, DWORD flags, LoadLibErrorTracker *pErrorTracker);
-#endif
static HMODULE LoadFromPInvokeAssemblyDirectory(Assembly *pAssembly, LPCWSTR libName, DWORD flags, LoadLibErrorTracker *pErrorTracker);
#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER)
@@ -493,9 +485,6 @@ public:
void GetCleanupFinallyOffsets(ILStubEHClause * pClause);
void AdjustTargetStackDeltaForReverseInteropHRESULTSwapping();
void AdjustTargetStackDeltaForExtraParam();
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- DWORD CreateCopyCtorCookie(ILCodeStream* pcsEmit);
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
void SetInteropParamExceptionInfo(UINT resID, UINT paramIdx);
bool HasInteropParamExceptionInfo();
@@ -535,9 +524,6 @@ protected:
void InitCleanupCode();
void InitExceptionCleanupCode();
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- BOOL IsCopyCtorStubNeeded();
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
ILCodeStream* m_pcsSetup;
@@ -569,10 +555,6 @@ protected:
DWORD m_dwCleanupWorkListLocalNum;
DWORD m_dwRetValLocalNum;
-#if defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- DWORD m_dwFirstCopyCtorCookieLocalNum; // list head passed to SetCopyCtorCookieChain
- DWORD m_dwLastCopyCtorCookieLocalNum; // used for chaining the cookies into a linked list
-#endif // _TARGET_X86_ && !FEATURE_CORECLR
UINT m_ErrorResID;
UINT m_ErrorParamIdx;
diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp
index 6842accba1..b482dafcbf 100644
--- a/src/vm/domainfile.cpp
+++ b/src/vm/domainfile.cpp
@@ -33,9 +33,6 @@
#include "umthunkhash.h"
#include "peimagelayout.inl"
-#if !defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
-#include "policy.h" // for fusion::util::isanyframeworkassembly
-#endif
#include "winrthelpers.h"
#ifdef FEATURE_PERFMAP
@@ -743,7 +740,6 @@ void DomainFile::VerifyNativeImageDependencies(bool verifyOnly)
if (pDependency->signNativeImage == INVALID_NGEN_SIGNATURE)
continue;
-#ifdef FEATURE_CORECLR // hardbinding
//
// CoreCLR hard binds to mscorlib.dll only. Avoid going through the full load.
@@ -759,51 +755,6 @@ void DomainFile::VerifyNativeImageDependencies(bool verifyOnly)
PEAssembly * pDependencyFile = SystemDomain::SystemFile();
-#else // FEATURE_CORECLR
-
- //
- // Load the manifest file for the given name assembly spec.
- //
-
- AssemblySpec name;
- name.InitializeSpec(pDependency->dwAssemblyRef,
- ((pManifestNativeImage != NULL) ? pManifestNativeImage : pNativeImage)->GetNativeMDImport(),
- GetDomainAssembly());
-
- if (this->GetAppDomain()->IsCompilationDomain())
- {
- //
- // Allow transitive closure of hardbound dependecies to be loaded during ngen.
- //
-
- DomainAssembly * pDependencyAssembly = name.LoadDomainAssembly(FILE_LOAD_FIND_NATIVE_IMAGE);
- pDependencyAssembly->GetFile()->SetSafeToHardBindTo();
- }
-
- DomainAssembly * pDependencyAssembly = NULL;
- {
- // We are about to validate the hard-bound dependencies of the assembly being loaded. The invariant of being hard-bound states
- // that each hard-bound dependency must have its NI image to be valid and available for loading and this is done recursively for each
- // hard-bound dependency.
- //
- // The validity (and presence) of the NI image happens in FILE_LOAD_ALLOCATE stage of assembly load, which is the next stage in assembly loading,
- // and not the current stage (FILE_LOAD_VERIFY_NATIVE_DEPENDENCIES). In FILE_LOAD_ALLOCATE, we do sharing checks, closure validation, redirection policy application, etc
- // before computing if a NI is available and if it is, whether it is valid or not.
- //
- // However, we need to know about validity of NI in the current(and earlier) stage. As a result, we will temporarily set the assembly load limit (defined as the maximum
- // load level till which recursive assembly load can execute) to be FILE_LOAD_ALLOCATE if we have been invoked to validate the NI dependencies for the first time.
- //
- // A valid concern at this point is that we would allow to load a dependency at a load stage higher than its dependent assembly as it could crete cycles. This concern is
- // alleviated since we are doing this override (of the load stage) only for hard-bound dependencies and NGEN is responsible for ensuring that there are no cycles.
- //
- // As a result, once the dependency load returns, we will know for sure if the dependency has a valid NI or not.
- OVERRIDE_LOAD_LEVEL_LIMIT(verifyOnly ? FILE_LOADED : FILE_LOAD_ALLOCATE);
- pDependencyAssembly = name.LoadDomainAssembly(FILE_LOADED);
- }
-
- PEAssembly * pDependencyFile = pDependencyAssembly->GetFile();
-
-#endif // FEATURE_CORECLR
ReleaseHolder<PEImage> pDependencyNativeImage = pDependencyFile->GetNativeImageWithRef();
if (pDependencyNativeImage == NULL)
@@ -1175,52 +1126,9 @@ void DomainFile::AddDependencies()
#ifdef FEATURE_PREJIT
-#ifdef FEATURE_CORECLR // hardbinding
//
// CoreCLR hard binds to mscorlib.dll only. No need to track hardbound dependencies.
//
-#else
- // Add hard bindings as unconditional dependencies
- if (GetFile()->HasNativeImage() && GetCurrentModule()->HasNativeImage() && IsAssembly())
- {
- PEImage *pNativeImage = GetFile()->GetPersistentNativeImage();
- PEImageLayout *pNativeLayout = pNativeImage->GetLoadedLayout();
-
- COUNT_T cDependencies;
- CORCOMPILE_DEPENDENCY *pDependencies = pNativeLayout->GetNativeDependencies(&cDependencies);
- CORCOMPILE_DEPENDENCY *pDependenciesEnd = pDependencies + cDependencies;
-
- while (pDependencies < pDependenciesEnd)
- {
- if (pDependencies->signNativeImage != INVALID_NGEN_SIGNATURE)
- {
-
- //
- // Load the manifest file for the given name assembly spec.
- //
-
- AssemblySpec name;
- name.InitializeSpec(pDependencies->dwAssemblyRef,
- pNativeImage->GetNativeMDImport(),
- GetDomainAssembly());
-
- DomainAssembly *pDependency = name.LoadDomainAssembly(FILE_LOADED);
-
- // Right now we only support hard binding to other manifest modules so we don't
- // need to consider the other module cases
- Module *pModule = pDependency->GetModule();
-
- // Add hard binding as an unconditional active dependency
- STRESS_LOG4(LF_CODESHARING,LL_INFO100,"unconditional dependency %p %p %i %i\n",
- GetFile(),GetCurrentModule(),GetFile()->HasNativeImage(),GetCurrentModule()->HasNativeImage());
- if(!pModule->IsSystem())
- GetCurrentModule()->AddActiveDependency(pModule, TRUE);
- }
-
- pDependencies++;
- }
- }
-#endif // FEATURE_CORECLR
#endif // FEATURE_PREJIT
}
@@ -1315,7 +1223,7 @@ void DomainFile::FinishLoad()
// Are we absolutely required to use a native image?
CheckZapRequired();
-#if defined(FEATURE_CORECLR) && defined(FEATURE_COMINTEROP)
+#if defined(FEATURE_COMINTEROP)
// If this is a winmd file, ensure that the ngen reference namespace is loadable.
// This is necessary as on the phone we don't check ngen image dependencies, and thus we can get in a situation
// where a winmd is loaded as a dependency of an ngen image, but the type used to build cross module references
@@ -1499,12 +1407,10 @@ void DomainFile::Activate()
m_bDisableActivationCheck=TRUE;
pMT->CheckRunClassInitThrowing();
}
-#ifdef FEATURE_CORECLR
if (g_pConfig->VerifyModulesOnLoad())
{
m_pModule->VerifyAllMethods();
}
-#endif //FEATURE_CORECLR
#ifdef _DEBUG
if (g_pConfig->ExpandModulesOnLoad())
{
@@ -2201,13 +2107,11 @@ BOOL DomainAssembly::MissingDependenciesCheckDone()
return m_MissingDependenciesCheckStatus != CMD_Unknown;
}
-#ifdef FEATURE_CORECLR
CMD_State DomainAssembly::CheckMissingDependencies()
{
//CoreCLR simply doesn't share if dependencies are missing
return CMD_NotNeeded;
}
-#endif // FEATURE_CORECLR
#endif // FEATURE_LOADER_OPTIMIZATION
@@ -2305,24 +2209,6 @@ void DomainAssembly::FindNativeImage()
}
#endif // FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS
-#ifndef FEATURE_CORECLR // hardbinding
- // The IsSafeToHardBindTo() check is only for use during the ngen compilation phase. It discards ngen images for
- // assemblies that aren't hard-bound to (as this would cause all such assemblies be loaded eagerly.)
- if (!IsSystem() && this->GetAppDomain()->IsCompilationDomain() && !GetFile()->IsSafeToHardBindTo())
- {
- if (!this->GetAppDomain()->ToCompilationDomain()->IsSafeToHardBindTo(GetFile()))
- {
- GetFile()->SetCannotUseNativeImage();
-
- if (GetFile()->HasNativeImage())
- GetFile()->ClearNativeImage();
-
- return;
- }
-
- GetFile()->SetSafeToHardBindTo();
- }
-#endif
#ifdef FEATURE_FUSION
DomainAssembly * pDomainAssembly = GetDomainAssembly();
@@ -2340,7 +2226,7 @@ void DomainAssembly::FindNativeImage()
if (GetFile()->HasNativeImage())
{
-#if defined(_DEBUG) && defined(FEATURE_CORECLR)
+#if defined(_DEBUG)
if (g_pConfig->ForbidZap(GetSimpleName()))
{
SString sbuf;
@@ -2489,7 +2375,6 @@ void DomainAssembly::FindNativeImage()
}
}
-#if defined(FEATURE_CORECLR)
if (!GetFile()->HasNativeImage())
{
//
@@ -2504,7 +2389,6 @@ void DomainAssembly::FindNativeImage()
GetAppDomain()->CheckForMismatchedNativeImages(&spec, &mvid);
}
-#endif
CheckZapRequired();
}
@@ -2529,65 +2413,6 @@ BOOL DomainAssembly::ShouldLoadDomainNeutralHelper()
#ifdef FEATURE_LOADER_OPTIMIZATION
-#ifndef FEATURE_CORECLR
-
- BOOL fIsShareableHostAssembly = FALSE;
- if (GetFile()->HasHostAssembly())
- {
- IfFailThrow(GetFile()->GetHostAssembly()->IsShareable(&fIsShareableHostAssembly));
- }
-
-#ifdef FEATURE_FUSION
- // Only use domain neutral code for normal assembly loads
- if ((GetFile()->GetFusionAssembly() == NULL) && !fIsShareableHostAssembly)
- {
- return FALSE;
- }
-#endif
-
-#ifdef FEATURE_REFLECTION_ONLY_LOAD
- // Introspection only does not use domain neutral code
- if (IsIntrospectionOnly())
- return FALSE;
-#endif
-
-#ifdef FEATURE_FUSION
- // use domain neutral code only for Load context, as the
- // required eager binding interferes with LoadFrom binding semantics
- if (!GetFile()->IsContextLoad() && !fIsShareableHostAssembly)
- return FALSE;
-#endif
-
- // Check app domain policy...
- if (this->GetAppDomain()->ApplySharePolicy(this))
- {
- if (IsSystem())
- return TRUE;
-
- // if not the default AD, ensure that the closure is filled in
- if (this->GetAppDomain() != SystemDomain::System()->DefaultDomain())
- GetAssemblyBindingClosure(LEVEL_COMPLETE);
-
-
- // Can be domain neutral only if we aren't binding any missing dependencies with
- // the assembly resolve event
- if ((this->GetAppDomain() != SystemDomain::System()->DefaultDomain()) &&
- (CheckMissingDependencies() == CMD_Resolved))
- {
- return FALSE;
- }
-
- // Ensure that all security conditions are met for code sharing
- if (!Security::CanShareAssembly(this))
- {
- return FALSE;
- }
-
- return TRUE;
- }
- return FALSE;
-
-#else // FEATURE_CORECLR
if (IsSystem())
return TRUE;
@@ -2620,7 +2445,6 @@ BOOL DomainAssembly::ShouldLoadDomainNeutralHelper()
return FALSE; // No meaning in doing costly closure walk for CoreCLR.
-#endif // FEATURE_CORECLR
#else // FEATURE_LOADER_OPTIMIZATION
return IsSystem();
@@ -3155,52 +2979,7 @@ void GetTimeStampsForNativeImage(CORCOMPILE_VERSION_INFO * pNativeVersionInfo)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// Do not store runtime timestamps into NGen image for cross-platform NGen determinism
-#else
- // fill in pRuntimeDllInfo
- CORCOMPILE_RUNTIME_DLL_INFO *pRuntimeDllInfo = pNativeVersionInfo->runtimeDllInfo;
-
- for (DWORD index = 0; index < NUM_RUNTIME_DLLS; index++)
- {
-#ifdef CROSSGEN_COMPILE
- SString sFileName(SString::Utf8, CorCompileGetRuntimeDllName((CorCompileRuntimeDlls)index));
-
- PEImageHolder pImage;
- if (!GetAppDomain()->ToCompilationDomain()->FindImage(sFileName, MDInternalImport_NoCache, &pImage))
- {
- EEFileLoadException::Throw(sFileName, COR_E_FILENOTFOUND);
- }
-
- PEImageLayoutHolder pLayout(pImage->GetLayout(PEImageLayout::LAYOUT_FLAT,PEImage::LAYOUT_CREATEIFNEEDED));
- pRuntimeDllInfo[index].timeStamp = pLayout->GetTimeDateStamp();
- pRuntimeDllInfo[index].virtualSize = pLayout->GetVirtualSize();
-
-#else // CROSSGEN_COMPILE
-
- HMODULE hMod = CorCompileGetRuntimeDll((CorCompileRuntimeDlls)index);
-
- if (hMod == NULL)
- {
- _ASSERTE((CorCompileRuntimeDlls)index == NGEN_COMPILER_INFO);
-
- LPCWSTR wszDllName = CorCompileGetRuntimeDllName((CorCompileRuntimeDlls)index);
- if (FAILED(g_pCLRRuntime->LoadLibrary(wszDllName, &hMod)))
- {
- EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("Unable to load CLR DLL during ngen"));
- }
- }
-
- _ASSERTE(hMod != NULL);
-
- PEDecoder pe(hMod);
-
- pRuntimeDllInfo[index].timeStamp = pe.GetTimeDateStamp();
- pRuntimeDllInfo[index].virtualSize = pe.GetVirtualSize();
-#endif // CROSSGEN_COMPILE
-
- }
-#endif // FEATURE_CORECLR
}
//
@@ -3215,7 +2994,6 @@ void GetNGenCpuInfo(CORINFO_CPU * cpuInfo)
#ifdef _TARGET_X86_
-#ifdef FEATURE_CORECLR
static CORINFO_CPU ngenCpuInfo =
{
(CPU_X86_PENTIUM_PRO << 8), // dwCPUType
@@ -3225,26 +3003,6 @@ void GetNGenCpuInfo(CORINFO_CPU * cpuInfo)
// We always generate P3-compatible code on CoreCLR
*cpuInfo = ngenCpuInfo;
-#else // FEATURE_CORECLR
- static CORINFO_CPU ngenCpuInfo =
- {
- (CPU_X86_PENTIUM_4 << 8), // dwCPUType
- 0x00008001, // dwFeatures
- 0 // dwExtendedFeatures
- };
-
-#ifndef CROSSGEN_COMPILE
- GetSpecificCpuInfo(cpuInfo);
- if (!IsCompatibleCpuInfo(cpuInfo, &ngenCpuInfo))
- {
- // Use the actual cpuInfo if the platform is not compatible
- // with the "recommended" processor. We expect most platforms to be compatible
- return;
- }
-#endif
-
- *cpuInfo = ngenCpuInfo;
-#endif // FEATURE_CORECLR
#else // _TARGET_X86_
cpuInfo->dwCPUType = 0;
@@ -3373,12 +3131,6 @@ void DomainAssembly::GetCurrentVersionInfo(CORCOMPILE_VERSION_INFO *pNativeVersi
pNativeVersionInfo->wConfigFlags |= CORCOMPILE_CONFIG_INSTRUMENTATION_NONE;
}
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
- if (UseRyuJit())
- {
- pNativeVersionInfo->wCodegenFlags |= CORCOMPILE_CODEGEN_USE_RYUJIT;
- }
-#endif
GetTimeStampsForNativeImage(pNativeVersionInfo);
@@ -3449,7 +3201,6 @@ BOOL DomainAssembly::CheckZapDependencyIdentities(PEImage *pNativeImage)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
AssemblySpec spec;
spec.InitializeSpec(this->GetFile());
@@ -3496,7 +3247,6 @@ BOOL DomainAssembly::CheckZapDependencyIdentities(PEImage *pNativeImage)
pDependencies++;
}
-#endif
return TRUE;
}
@@ -3510,82 +3260,7 @@ BOOL DomainAssembly::CheckZapSecurity(PEImage *pNativeImage)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
return TRUE;
-#else
-
- //
- // System libraries are a special case, the security info's always OK.
- //
-
- if (IsSystem())
- return TRUE;
-
-#ifdef FEATURE_NATIVE_IMAGE_GENERATION
- //
- // If we're just loading files as part of PDB generation, we're not executing code,
- // so no need to do security checks
- //
-
- if (IsNgenPDBCompilationProcess())
- return TRUE;
-#endif
-
- ETWOnStartup (SecurityCatchCall_V1, SecurityCatchCallEnd_V1);
-
-#ifdef CROSSGEN_COMPILE
- return TRUE;
-#else
-
-
- GCX_COOP();
-
- BOOL fHostProtectionOK = FALSE;
- BOOL fImageAndDependenciesAreFullTrust = FALSE;
-
- EX_TRY
- {
- // Check the HostProtection settings.
- EApiCategories eRequestedProtectedCategories = GetHostProtectionManager()->GetProtectedCategories();
- if (eRequestedProtectedCategories == eNoChecks)
- fHostProtectionOK = TRUE;
-
- // Due to native code generated for one IL image being more agressively put into another
- // assembly's native image, we're disabling partial trust NGEN images. If the current
- // domain can only have fully trusted assemblies, then we can load this image, or if the current
- // assembly and its closure are all in the GAC we can also use it. Otherwise, we'll conservatively
- // disable the use of this image.
- IApplicationSecurityDescriptor *pAppDomainSecurity = this->GetAppDomain()->GetSecurityDescriptor();
- if (pAppDomainSecurity->IsFullyTrusted() && pAppDomainSecurity->IsHomogeneous())
- {
- // A fully trusted homogenous domain can only have full trust assemblies, therefore this assembly
- // and all its dependencies must be full trust
- fImageAndDependenciesAreFullTrust = TRUE;
- }
- else if (IsClosedInGAC())
- {
- // The domain allows partial trust assemblies to be loaded into it. However, this assembly and
- // all of its dependencies came from the GAC, so we know that they must all be trusted even if
- // other code in this domain is not.
- fImageAndDependenciesAreFullTrust = TRUE;
- }
- else
- {
- // The domain allows partial trust assemblies and we cannot prove that the closure of
- // dependencies of this assembly will all be fully trusted. Conservatively throw away this NGEN
- // image.
- fImageAndDependenciesAreFullTrust = FALSE;
- }
- }
- EX_CATCH
- {
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- return fHostProtectionOK && fImageAndDependenciesAreFullTrust;
-#endif // CROSSGEN_COMPILE
-
-#endif // FEATURE_CORECLR
}
#endif // FEATURE_PREJIT
diff --git a/src/vm/dwbucketmanager.hpp b/src/vm/dwbucketmanager.hpp
index a3aef9b2a8..2e37e1be5e 100644
--- a/src/vm/dwbucketmanager.hpp
+++ b/src/vm/dwbucketmanager.hpp
@@ -887,27 +887,7 @@ void BaseBucketParamsManager::GetPackageMoniker(__out_ecount(maxLength) WCHAR* t
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- bool success = false;
- EX_TRY
- {
- wcsncpy_s(targetParam, maxLength, AppX::GetHeadPackageMoniker(), _TRUNCATE);
- success = true;
- }
- EX_CATCH
- {
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- if (!success)
- {
- // should this ever legitimately fail??
- _ASSERTE(!"failed to get package moniker for watson");
- wcsncpy_s(targetParam, maxLength, W("missing"), _TRUNCATE);
- }
-#else
_ASSERTE(!"AppX support NYI for CoreCLR");
-#endif // FEATURE_CORECLR
}
void BaseBucketParamsManager::GetPRAID(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
@@ -920,25 +900,7 @@ void BaseBucketParamsManager::GetPRAID(__out_ecount(maxLength) WCHAR* targetPara
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- LPCWSTR pPraid = NULL;
- if (SUCCEEDED(AppX::GetApplicationId(pPraid)))
- {
- _snwprintf_s(targetParam,
- maxLength,
- _TRUNCATE,
- W("praid:%s"),
- pPraid);
- }
- else
- {
- // should this ever legitimately fail??
- _ASSERTE(!"failed to get PRAID for watson");
- wcsncpy_s(targetParam, maxLength, W("missing"), _TRUNCATE);
- }
-#else
_ASSERTE(!"PRAID support NYI for CoreCLR");
-#endif
}
void BaseBucketParamsManager::GetIlRva(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
@@ -1475,11 +1437,6 @@ WatsonBucketType GetWatsonBucketType()
}
CONTRACTL_END;
-#if defined(FEATURE_APPX) && !defined(FEATURE_CORECLR)
- if (AppX::IsAppXProcess() && !AppX::IsAppXNGen())
- return MoCrash;
- else
-#endif // FEATURE_APPX
#ifdef FEATURE_WINDOWSPHONE
return WinPhoneCrash;
diff --git a/src/vm/dwreport.cpp b/src/vm/dwreport.cpp
index 67a9fb66b2..e119fa7301 100644
--- a/src/vm/dwreport.cpp
+++ b/src/vm/dwreport.cpp
@@ -1484,19 +1484,6 @@ BOOL RunWatson(
{
- #if !defined(FEATURE_CORECLR)
- // Use the version of DW20.exe that lives in the system directory.
- DWORD ret;
-
- if (FAILED(GetCORSystemDirectoryInternaL(watsonAppName)))
- {
- hr = E_FAIL;
- break;
- }
- watsonCommandLine.Set(watsonAppName);
- watsonCommandLine.Append(kWatsonImageNameOnVista);
-
- #else // FEATURE_CORECLR
HKEYHolder hKey;
// Look for key \\HKLM\Software\Microsoft\PCHealth\ErrorReporting\DW\Installed"
DWORD ret = WszRegOpenKeyEx(HKEY_LOCAL_MACHINE,
@@ -1517,7 +1504,6 @@ BOOL RunWatson(
ClrRegReadString(hKey, kWatsonValue, watsonAppName);
- #endif // ! FEATURE_CORECLR
COUNT_T len = watsonCommandLine.GetCount();
WCHAR* buffer = watsonCommandLine.OpenUnicodeBuffer(len);
@@ -1895,14 +1881,6 @@ HRESULT GetManagedBucketParametersForIp(
}
WatsonBucketType bucketType = GetWatsonBucketType();
-#ifndef FEATURE_CORECLR
- if (bucketType == MoCrash)
- {
- MoCrashBucketParamsManager moCrashManager(pGenericModeBlock, tore, currentPC, pThread, pThrowable);
- moCrashManager.PopulateBucketParameters();
- }
- else
-#endif // !FEATURE_CORECLR
{
#ifdef FEATURE_WINDOWSPHONE
_ASSERTE(bucketType == WinPhoneCrash);
@@ -2041,11 +2019,9 @@ HRESULT RetrieveManagedBucketParameters(
#if defined(PRESERVE_WATSON_ACROSS_CONTEXTS)
GenericModeBlock *pBuckets = NULL;
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
if (pThread != NULL)
{
@@ -3082,7 +3058,6 @@ FaultReportResult DoFaultReport( // Was Watson attempted, successful?
Thread *pThread = GetThread();
-#ifdef FEATURE_CORECLR
// If watson isn't available (eg. in Silverlight), then use a simple dialog box instead
if (!IsWatsonEnabled())
{
@@ -3121,7 +3096,6 @@ FaultReportResult DoFaultReport( // Was Watson attempted, successful?
return fri.m_faultReportResult;
}
-#endif // FEATURE_CORECLR
#ifdef FEATURE_UEF_CHAINMANAGER
if (g_pUEFManager && !tore.IsUserBreakpoint())
diff --git a/src/vm/ecall.h b/src/vm/ecall.h
index 768b8a9698..c4fed1ff42 100644
--- a/src/vm/ecall.h
+++ b/src/vm/ecall.h
@@ -16,16 +16,8 @@
class MethodDesc;
-#ifndef FEATURE_CORECLR
-// Every program tends to use only a subset of ~1000 FCalls. Even big apps like
-// VS do not usually hit more than 300. Pick a size of the hashtable that's sufficient
-// for the typical case. It is ok to have some colisions in the rare case. Note that
-// the size of the table should be prime.
-#define FCALL_HASH_SIZE 257
-#else
// CoreCLR defines fewer FCalls so make the hashtable even smaller.
#define FCALL_HASH_SIZE 127
-#endif
typedef DPTR(struct ECHash) PTR_ECHash;
diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h
index 587f6f9132..b427d6311d 100644
--- a/src/vm/ecalllist.h
+++ b/src/vm/ecalllist.h
@@ -112,14 +112,6 @@ FCFuncStart(gDependentHandleFuncs)
FCFuncElement("nSetSecondary", DependentHandle::nSetSecondary)
FCFuncEnd()
-#ifndef FEATURE_CORECLR
-FCFuncStart(gSizedRefHandleFuncs)
- FCFuncElement("CreateSizedRef", SizedRefHandle::Initialize)
- FCFuncElement("FreeSizedRef", SizedRefHandle::Free)
- FCFuncElement("GetTargetOfSizedRef", SizedRefHandle::GetTarget)
- FCFuncElement("GetApproximateSizeOfSizedRef", SizedRefHandle::GetApproximateSize)
-FCFuncEnd()
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_RWLOCK
FCFuncStart(gRWLockFuncs)
@@ -178,11 +170,9 @@ FCFuncStart(gStackBuilderSinkFuncs)
FCFuncEnd()
#endif
-#ifdef FEATURE_CORECLR
FCFuncStart(gSymWrapperCodePunkSafeHandleFuncs)
FCFuncElement("nGetDReleaseTarget", COMPunkSafeHandle::nGetDReleaseTarget)
FCFuncEnd()
-#endif //FEATURE_CORECLR
FCFuncStart(gParseNumbersFuncs)
FCFuncElement("IntToString", ParseNumbers::IntToString)
@@ -191,11 +181,6 @@ FCFuncStart(gParseNumbersFuncs)
FCFuncElement("StringToLong", ParseNumbers::StringToLong)
FCFuncEnd()
-#ifndef FEATURE_CORECLR // FCalls used by System.TimeSpan
-FCFuncStart(gTimeSpanFuncs)
- FCFuncElement("LegacyFormatMode", SystemNative::LegacyFormatMode)
-FCFuncEnd()
-#endif // !FEATURE_CORECLR
FCFuncStart(gObjectFuncs)
FCIntrinsic("GetType", ObjectNative::GetClass, CORINFO_INTRINSIC_Object_GetType)
@@ -267,10 +252,6 @@ FCFuncEnd()
FCFuncStart(gDateTimeFuncs)
FCFuncElement("GetSystemTimeAsFileTime", SystemNative::__GetSystemTimeAsFileTime)
-#ifndef FEATURE_CORECLR
- QCFuncElement("LegacyParseMode", SystemNative::LegacyDateTimeParseMode)
- QCFuncElement("EnableAmPmParseAdjustment", SystemNative::EnableAmPmParseAdjustment)
-#endif
FCFuncEnd()
FCFuncStart(gEnvironmentFuncs)
@@ -282,35 +263,18 @@ FCFuncStart(gEnvironmentFuncs)
FCFuncElement("get_ExitCode", SystemNative::GetExitCode)
FCFuncElement("get_HasShutdownStarted", SystemNative::HasShutdownStarted)
QCFuncElement("GetProcessorCount", SystemNative::GetProcessorCount)
-#ifndef FEATURE_CORECLR
- FCFuncElement("nativeGetEnvironmentVariable", SystemNative::_GetEnvironmentVariable)
- FCFuncElement("GetCompatibilityFlag", SystemNative::_GetCompatibilityFlag)
- QCFuncElement("GetCommandLine", SystemNative::_GetCommandLine)
- FCFuncElement("GetResourceFromDefault", GetResourceFromDefault)
-#endif // !FEATURE_CORECLR
FCFuncElement("GetCommandLineArgsNative", SystemNative::GetCommandLineArgs)
FCFuncElement("get_CurrentProcessorNumber", SystemNative::GetCurrentProcessorNumber)
FCFuncElementSig("FailFast", &gsig_SM_Str_RetVoid, SystemNative::FailFast)
FCFuncElementSig("FailFast", &gsig_SM_Str_Exception_RetVoid, SystemNative::FailFastWithException)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetIsCLRHosted", SystemNative::IsCLRHosted)
- QCFuncElement("TriggerCodeContractFailure", SystemNative::TriggerCodeContractFailure)
-#endif // !FEATURE_CORECLR
FCFuncEnd()
FCFuncStart(gRuntimeEnvironmentFuncs)
FCFuncElement("GetModuleFileName", SystemNative::_GetModuleFileName)
-#ifndef FEATURE_CORECLR
- QCFuncElement("_GetSystemVersion", SystemNative::_GetSystemVersion)
-#endif
FCFuncEnd()
FCFuncStart(gSerializationFuncs)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetEnableUnsafeTypeForwarders", ReflectionSerialization::GetEnableUnsafeTypeForwarders)
- FCFuncElement("nativeGetSafeUninitializedObject", ReflectionSerialization::GetSafeUninitializedObject)
-#endif
FCFuncElement("nativeGetUninitializedObject", ReflectionSerialization::GetUninitializedObject)
FCFuncEnd()
@@ -318,9 +282,6 @@ FCFuncStart(gExceptionFuncs)
FCFuncElement("IsImmutableAgileException", ExceptionNative::IsImmutableAgileException)
FCFuncElement("nIsTransient", ExceptionNative::IsTransient)
FCFuncElement("GetMethodFromStackTrace", SystemNative::GetMethodFromStackTrace)
-#ifndef FEATURE_CORECLR
- FCFuncElement("StripFileInfo", ExceptionNative::StripFileInfo)
-#endif
QCFuncElement("GetMessageFromNativeResources", ExceptionNative::GetMessageFromNativeResources)
#if defined(FEATURE_EXCEPTIONDISPATCHINFO)
FCFuncElement("PrepareForForeignExceptionRaise", ExceptionNative::PrepareForForeignExceptionRaise)
@@ -453,10 +414,6 @@ FCFuncStart(gCOMTypeHandleFuncs)
FCFuncElement("Allocate", RuntimeTypeHandle::Allocate) //for A.CI
FCFuncElement("CompareCanonicalHandles", RuntimeTypeHandle::CompareCanonicalHandles)
FCIntrinsic("GetValueInternal", RuntimeTypeHandle::GetValueInternal, CORINFO_INTRINSIC_RTH_GetValueInternal)
-#ifndef FEATURE_CORECLR
- FCFuncElement("IsEquivalentTo", RuntimeTypeHandle::IsEquivalentTo)
- FCFuncElement("IsEquivalentType", RuntimeTypeHandle::IsEquivalentType)
-#endif // FEATURE_CORECLR
FCFuncEnd()
FCFuncStart(gMetaDataImport)
@@ -520,11 +477,6 @@ FCFuncStart(gRuntimeMethodHandle)
FCFuncElement("GetMethodFromCanonical", RuntimeMethodHandle::GetMethodFromCanonical)
FCFuncElement("IsDynamicMethod", RuntimeMethodHandle::IsDynamicMethod)
FCFuncElement("GetMethodBody", RuntimeMethodHandle::GetMethodBody)
-#ifndef FEATURE_CORECLR
- FCFuncElement("_IsTokenSecurityTransparent", RuntimeMethodHandle::IsTokenSecurityTransparent)
- QCFuncElement("_IsSecurityCritical", RuntimeMethodHandle::IsSecurityCritical)
- QCFuncElement("_IsSecuritySafeCritical", RuntimeMethodHandle::IsSecuritySafeCritical)
-#endif // FEATURE_CORECLR
QCFuncElement("_IsSecurityTransparent", RuntimeMethodHandle::IsSecurityTransparent)
FCFuncElement("CheckLinktimeDemands", RuntimeMethodHandle::CheckLinktimeDemands)
QCFuncElement("IsCAVisibleFromDecoratedType", RuntimeMethodHandle::IsCAVisibleFromDecoratedType)
@@ -533,10 +485,6 @@ FCFuncStart(gRuntimeMethodHandle)
FCFuncElement("GetResolver", RuntimeMethodHandle::GetResolver)
FCFuncElement("GetLoaderAllocator", RuntimeMethodHandle::GetLoaderAllocator)
FCFuncElement("GetSpecialSecurityFlags", ReflectionInvocation::GetSpecialSecurityFlags)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetCallerType", RuntimeMethodHandle::GetCallerType)
- FCFuncElement("PerformSecurityCheck", ReflectionInvocation::PerformSecurityCheck)
-#endif // FEATURE_CORECLR
FCFuncEnd()
FCFuncStart(gCOMDefaultBinderFuncs)
@@ -596,9 +544,6 @@ FCFuncStart(gCOMModuleHandleFuncs)
QCFuncElement("ResolveMethod", ModuleHandle::ResolveMethod)
QCFuncElement("_ContainsPropertyMatchingHash", ModuleHandle::ContainsPropertyMatchingHash)
QCFuncElement("ResolveField", ModuleHandle::ResolveField)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetAssembly", ModuleHandle::GetAssembly)
-#endif // FEATURE_CORECLR
QCFuncElement("GetPEKind", ModuleHandle::GetPEKind)
FCFuncElement("GetMDStreamVersion", ModuleHandle::GetMDStreamVersion)
FCFuncEnd()
@@ -634,9 +579,6 @@ FCFuncStart(gCOMClassWriter)
QCFuncElement("SetParamInfo", COMDynamicWrite::SetParamInfo)
QCFuncElement("SetConstantValue", COMDynamicWrite::SetConstantValue)
QCFuncElement("DefineCustomAttribute", COMDynamicWrite::DefineCustomAttribute)
-#ifndef FEATURE_CORECLR
- QCFuncElement("AddDeclarativeSecurity", COMDynamicWrite::AddDeclarativeSecurity)
-#endif // FEATURE_CORECLR
FCFuncEnd()
#ifdef FEATURE_METHOD_RENTAL
@@ -668,12 +610,6 @@ FCFuncStart(gAppDomainSetupFuncs)
FCFuncEnd()
#endif // FEATURE_FUSION
-#ifndef FEATURE_CORECLR
-FCFuncStart(gWindowsRuntimeContextFuncs)
- QCFuncElement("CreateDesignerContext", AppDomainNative::CreateDesignerContext)
- QCFuncElement("SetCurrentContext", AppDomainNative::SetCurrentDesignerContext)
-FCFuncEnd()
-#endif // FEATURE_CORECLR
FCFuncStart(gAppDomainFuncs)
#ifdef FEATURE_REMOTING
@@ -699,11 +635,6 @@ FCFuncStart(gAppDomainFuncs)
QCFuncElement("GetAppDomainManagerType", AppDomainNative::GetAppDomainManagerType)
QCFuncElement("SetAppDomainManagerType", AppDomainNative::SetAppDomainManagerType)
FCFuncElement("nGetFriendlyName", AppDomainNative::GetFriendlyName)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetSecurityDescriptor", AppDomainNative::GetSecurityDescriptor)
- FCFuncElement("nIsDefaultAppDomainForEvidence", AppDomainNative::IsDefaultAppDomainForEvidence)
- FCFuncElement("nGetAssemblies", AppDomainNative::GetAssemblies)
-#endif
QCFuncElement("SetSecurityHomogeneousFlag", AppDomainNative::SetSecurityHomogeneousFlag)
QCFuncElement("SetupDomainSecurity", AppDomainNative::SetupDomainSecurity)
FCFuncElement("nSetupFriendlyName", AppDomainNative::SetupFriendlyName)
@@ -725,10 +656,8 @@ FCFuncStart(gAppDomainFuncs)
FCFuncElement("IsDomainIdValid", AppDomainNative::IsDomainIdValid)
FCFuncElement("nApplyPolicy", AppDomainNative::nApplyPolicy)
#endif // FEATURE_REMOTING
-#ifdef FEATURE_CORECLR
QCFuncElement("nSetupBindingPaths", AppDomainNative::SetupBindingPaths)
QCFuncElement("nSetNativeDllSearchDirectories", AppDomainNative::SetNativeDllSearchDirectories)
-#endif
FCFuncElement("IsFinalizingForUnload", AppDomainNative::IsFinalizingForUnload)
FCFuncElement("PublishAnonymouslyHostedDynamicMethodsAssembly", AppDomainNative::PublishAnonymouslyHostedDynamicMethodsAssembly)
#ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
@@ -742,12 +671,6 @@ FCFuncStart(gAppDomainFuncs)
#endif //FEATURE_APPDOMAIN_RESOURCE_MONITORING
FCFuncEnd()
-#if defined(FEATURE_MULTICOREJIT) && !defined(FEATURE_CORECLR)
-FCFuncStart(gProfileOptimizationFuncs)
- QCFuncElement("InternalSetProfileRoot", MultiCoreJITNative::InternalSetProfileRoot)
- QCFuncElement("InternalStartProfile", MultiCoreJITNative::InternalStartProfile)
-FCFuncEnd()
-#endif // defined(FEATURE_MULTICOREJIT) && !defined(FEATURE_CORECLR)
FCFuncStart(gUtf8String)
FCFuncElement("EqualsCaseSensitive", Utf8String::EqualsCaseSensitive)
@@ -799,26 +722,13 @@ FCFuncStart(gAssemblyFuncs)
QCFuncElement("GetHashAlgorithm", AssemblyNative::GetHashAlgorithm)
QCFuncElement("GetLocale", AssemblyNative::GetLocale)
QCFuncElement("GetPublicKey", AssemblyNative::GetPublicKey)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetSecurityRuleSet", AssemblyNative::GetSecurityRuleSet)
-#endif // !FEATURE_CORECLR
QCFuncElement("GetSimpleName", AssemblyNative::GetSimpleName)
QCFuncElement("GetVersion", AssemblyNative::GetVersion)
FCFuncElement("FCallIsDynamic", AssemblyNative::IsDynamic)
FCFuncElement("_nLoad", AssemblyNative::Load)
-#ifndef FEATURE_CORECLR
- FCFuncElement("IsFrameworkAssembly", AssemblyNative::IsFrameworkAssembly)
- FCFuncElement("IsNewPortableAssembly", AssemblyNative::IsNewPortableAssembly)
-#endif
FCFuncElement("nLoadImage", AssemblyNative::LoadImage)
-#ifndef FEATURE_CORECLR
- QCFuncElement("LoadModule", AssemblyNative::LoadModule)
-#endif // FEATURE_CORECLR
QCFuncElement("GetType", AssemblyNative::GetType)
QCFuncElement("GetManifestResourceInfo", AssemblyNative::GetManifestResourceInfo)
-#ifndef FEATURE_CORECLR
- QCFuncElement("UseRelativeBindForSatellites", AssemblyNative::UseRelativeBindForSatellites)
-#endif
QCFuncElement("GetModules", AssemblyNative::GetModules)
QCFuncElement("GetModule", AssemblyNative::GetModule)
FCFuncElement("GetReferencedAssemblies", AssemblyNative::GetReferencedAssemblies)
@@ -827,22 +737,15 @@ FCFuncStart(gAssemblyFuncs)
QCFuncElement("GetEntryPoint", AssemblyNative::GetEntryPoint)
QCFuncElement("IsAllSecurityTransparent", AssemblyNative::IsAllSecurityTransparent)
QCFuncElement("IsAllSecurityCritical", AssemblyNative::IsAllSecurityCritical)
-#ifndef FEATURE_CORECLR
- QCFuncElement("IsAllSecuritySafeCritical", AssemblyNative::IsAllSecuritySafeCritical)
- QCFuncElement("IsAllPublicAreaSecuritySafeCritical", AssemblyNative::IsAllPublicAreaSecuritySafeCritical)
- QCFuncElement("GetGrantSet", AssemblyNative::GetGrantSet)
-#endif // !FEATURE_CORECLR
QCFuncElement("GetImageRuntimeVersion", AssemblyNative::GetImageRuntimeVersion)
FCFuncElement("IsReflectionOnly", AssemblyNative::IsReflectionOnly)
FCFuncElement("GetManifestModule", AssemblyHandle::GetManifestModule)
FCFuncElement("GetToken", AssemblyHandle::GetToken)
FCFuncEnd()
-#ifdef FEATURE_CORECLR
FCFuncStart(gAssemblyExtensionsFuncs)
QCFuncElement("InternalTryGetRawMetadata", AssemblyNative::InternalTryGetRawMetadata)
FCFuncEnd()
-#endif
#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER)
FCFuncStart(gAssemblyLoadContextFuncs)
@@ -865,9 +768,6 @@ FCFuncStart(gAssemblyNameFuncs)
FCFuncElement("nInit", AssemblyNameNative::Init)
FCFuncElement("nToString", AssemblyNameNative::ToString)
FCFuncElement("nGetPublicKeyToken", AssemblyNameNative::GetPublicKeyToken)
-#ifndef FEATURE_CORECLR
- FCFuncElement("EscapeCodeBase", AssemblyNameNative::EscapeCodeBase)
-#endif // !FEATURE_CORECLR
FCFuncElement("ReferenceMatchesDefinitionInternal", AssemblyNameNative::ReferenceMatchesDefinition)
FCFuncElement("nGetFileInformation", AssemblyNameNative::GetFileInformation)
FCFuncEnd()
@@ -879,21 +779,6 @@ FCFuncEnd()
FCFuncStart(gAssemblyBuilderFuncs)
FCFuncElement("nCreateDynamicAssembly", AppDomainNative::CreateDynamicAssembly)
FCFuncElement("GetInMemoryAssemblyModule", AssemblyNative::GetInMemoryAssemblyModule)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetOnDiskAssemblyModule", AssemblyNative::GetOnDiskAssemblyModule)
-#ifdef FEATURE_MULTIMODULE_ASSEMBLIES
- QCFuncElement("DefineDynamicModule", COMModule::DefineDynamicModule)
-#endif // FEATURE_MULTIMODULE_ASSEMBLIES
- QCFuncElement("PrepareForSavingManifestToDisk", AssemblyNative::PrepareForSavingManifestToDisk)
- QCFuncElement("SaveManifestToDisk", AssemblyNative::SaveManifestToDisk)
- QCFuncElement("AddFile", AssemblyNative::AddFile)
- QCFuncElement("SetFileHashValue", AssemblyNative::SetFileHashValue)
- QCFuncElement("AddStandAloneResource", AssemblyNative::AddStandAloneResource)
- QCFuncElement("AddExportedTypeOnDisk", AssemblyNative::AddExportedTypeOnDisk)
- QCFuncElement("AddExportedTypeInMemory", AssemblyNative::AddExportedTypeInMemory)
- QCFuncElement("AddDeclarativeSecurity", AssemblyNative::AddDeclarativeSecurity)
- QCFuncElement("CreateVersionInfoResource", AssemblyNative::CreateVersionInfoResource)
-#endif // !FEATURE_CORECLR
FCFuncEnd()
#ifdef MDA_SUPPORTED
@@ -997,10 +882,6 @@ FCFuncEnd()
FCFuncStart(gThreadFuncs)
FCDynamic("InternalGetCurrentThread", CORINFO_INTRINSIC_Illegal, ECall::InternalGetCurrentThread)
FCFuncElement("StartInternal", ThreadNative::Start)
-#ifndef FEATURE_CORECLR
- FCFuncElement("SuspendInternal", ThreadNative::Suspend)
- FCFuncElement("ResumeInternal", ThreadNative::Resume)
-#endif
#ifdef FEATURE_LEAK_CULTURE_INFO
FCFuncElement("nativeGetSafeCulture", ThreadNative::nativeGetSafeCulture)
#else
@@ -1019,16 +900,6 @@ FCFuncStart(gThreadFuncs)
FCFuncElement("InternalCrossContextCallback", ThreadNative::InternalCrossContextCallback)
#endif
QCFuncElement("InformThreadNameChange", ThreadNative::InformThreadNameChange)
-#ifndef FEATURE_CORECLR
- QCFuncElement("GetProcessDefaultStackSize", ThreadNative::GetProcessDefaultStackSize)
- FCFuncElement("BeginCriticalRegion", ThreadNative::BeginCriticalRegion)
- FCFuncElement("EndCriticalRegion", ThreadNative::EndCriticalRegion)
- FCFuncElement("BeginThreadAffinity", ThreadNative::BeginThreadAffinity)
- FCFuncElement("EndThreadAffinity", ThreadNative::EndThreadAffinity)
-#endif // FEATURE_CORECLR
-#ifndef FEATURE_CORECLR
- FCFuncElement("ResetAbortNative", ThreadNative::ResetAbort)
-#endif // FEATURE_CORECLR
FCFuncElement("SpinWaitInternal", ThreadNative::SpinWait)
QCFuncElement("YieldInternal", ThreadNative::YieldThread)
FCIntrinsic("GetCurrentThreadNative", ThreadNative::GetCurrentThread, CORINFO_INTRINSIC_GetCurrentManagedThread)
@@ -1041,11 +912,6 @@ FCFuncStart(gThreadFuncs)
FCFuncElement("StartupSetApartmentStateInternal", ThreadNative::StartupSetApartmentState)
#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
FCIntrinsic("MemoryBarrier", ThreadNative::FCMemoryBarrier, CORINFO_INTRINSIC_MemoryBarrier)
-#ifndef FEATURE_CORECLR // coreclr does not support abort reason
- FCFuncElement("SetAbortReason", ThreadNative::SetAbortReason)
- FCFuncElement("GetAbortReason", ThreadNative::GetAbortReason)
- FCFuncElement("ClearAbortReason", ThreadNative::ClearAbortReason)
-#endif
FCFuncEnd()
FCFuncStart(gThreadPoolFuncs)
@@ -1093,9 +959,6 @@ FCFuncStart(gNumberFuncs)
FCFuncElement("FormatInt64", COMNumber::FormatInt64)
FCFuncElement("FormatUInt64", COMNumber::FormatUInt64)
FCFuncElement("FormatSingle", COMNumber::FormatSingle)
-#if !defined(FEATURE_CORECLR)
- FCFuncElement("FormatNumberBuffer", COMNumber::FormatNumberBuffer)
-#endif // !FEATURE_CORECLR
FCFuncElement("NumberBufferToDecimal", COMNumber::NumberBufferToDecimal)
FCFuncElement("NumberBufferToDouble", COMNumber::NumberBufferToDouble)
FCFuncEnd()
@@ -1138,12 +1001,6 @@ FCFuncStart(gCurrencyFuncs)
FCFuncElement("FCallToDecimal", COMCurrency::DoToDecimal)
FCFuncEnd()
-#ifndef FEATURE_CORECLR
-FCFuncStart(gCLRConfigFuncs)
- FCFuncElement("CheckLegacyManagedDeflateStream", SystemNative::CheckLegacyManagedDeflateStream)
- FCFuncElement("CheckThrowUnobservedTaskExceptions", SystemNative::CheckThrowUnobservedTaskExceptions)
-FCFuncEnd()
-#endif // ifndef FEATURE_CORECLR
#if !defined(FEATURE_COREFX_GLOBALIZATION)
FCFuncStart(gCompareInfoFuncs)
@@ -1153,9 +1010,6 @@ FCFuncStart(gCompareInfoFuncs)
QCFuncElement("NativeInternalInitSortHandle", COMNlsInfo::InternalInitSortHandle)
QCFuncElement("InternalIsSortable", COMNlsInfo::InternalIsSortable)
QCFuncElement("InternalGetSortKey", COMNlsInfo::InternalGetSortKey)
-#ifndef FEATURE_CORECLR
- QCFuncElement("InternalGetSortVersion", COMNlsInfo::InternalGetSortVersion)
-#endif
QCFuncElement("InternalGetNlsVersionEx", COMNlsInfo::InternalGetNlsVersionEx)
FCFuncEnd()
@@ -1190,9 +1044,7 @@ FCFuncStart(gCultureInfoFuncs)
QCFuncElement("InternalGetUserDefaultUILanguage", COMNlsInfo::InternalGetUserDefaultUILanguage)
QCFuncElement("InternalGetSystemDefaultUILanguage", COMNlsInfo::InternalGetSystemDefaultUILanguage)
// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5
-#ifdef FEATURE_CORECLR
FCFuncElement("nativeGetResourceFallbackArray", COMNlsInfo::nativeGetResourceFallbackArray)
-#endif
FCFuncEnd()
FCFuncStart(gTextInfoFuncs)
@@ -1286,13 +1138,6 @@ FCFuncStart(gInteropMarshalFuncs)
FCFuncElement("UnsafeAddrOfPinnedArrayElement", MarshalNative::FCUnsafeAddrOfPinnedArrayElement)
FCFuncElement("GetExceptionCode", ExceptionNative::GetExceptionCode)
QCFuncElement("GetHINSTANCE", COMModule::GetHINSTANCE)
-#ifndef FEATURE_CORECLR
- QCFuncElement("InternalNumParamBytes", MarshalNative::NumParamBytes)
- FCFuncElement("GetExceptionPointers", ExceptionNative::GetExceptionPointers)
- FCFuncElement("GetUnmanagedThunkForManagedMethodPtr", MarshalNative::GetUnmanagedThunkForManagedMethodPtr)
- FCFuncElement("GetManagedThunkForUnmanagedMethodPtr", MarshalNative::GetManagedThunkForUnmanagedMethodPtr)
- FCFuncElement("InternalGetThreadFromFiberCookie", MarshalNative::GetThreadFromFiberCookie)
-#endif
FCFuncElement("OffsetOfHelper", MarshalNative::OffsetOfHelper)
FCFuncElement("SizeOfType", SafeBuffer::SizeOfType)
@@ -1328,9 +1173,6 @@ FCFuncStart(gInteropMarshalFuncs)
FCFuncElement("GetNativeActivationFactory", MarshalNative::GetNativeActivationFactory)
FCFuncElement("GetIUnknownForObjectNative", MarshalNative::GetIUnknownForObjectNative)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetIDispatchForObjectNative", MarshalNative::GetIDispatchForObjectNative)
-#endif // FEATURE_CORECLR
FCFuncElement("GetComInterfaceForObjectNative", MarshalNative::GetComInterfaceForObjectNative)
FCFuncElement("InternalReleaseComObject", MarshalNative::ReleaseComObject)
FCFuncElement("Release", MarshalNative::Release)
@@ -1338,26 +1180,6 @@ FCFuncStart(gInteropMarshalFuncs)
FCFuncElement("GetTypedObjectForIUnknown", MarshalNative::GetTypedObjectForIUnknown)
FCFuncElement("ChangeWrapperHandleStrength", MarshalNative::ChangeWrapperHandleStrength)
FCFuncElement("CleanupUnusedObjectsInCurrentContext", MarshalNative::CleanupUnusedObjectsInCurrentContext)
-#ifndef FEATURE_CORECLR
- FCFuncElement("GetLoadedTypeForGUID", MarshalNative::GetLoadedTypeForGUID)
- FCFuncElement("GetITypeInfoForType", MarshalNative::GetITypeInfoForType)
- FCFuncElement("IsTypeVisibleFromCom", MarshalNative::IsTypeVisibleFromCom)
- FCFuncElement("FCallGenerateGuidForType", MarshalNative::DoGenerateGuidForType)
- FCFuncElement("FCallGetTypeLibGuid", MarshalNative::DoGetTypeLibGuid)
- FCFuncElement("GetTypeLibLcid", MarshalNative::GetTypeLibLcid)
- FCFuncElement("GetTypeLibVersion", MarshalNative::GetTypeLibVersion)
- FCFuncElement("FCallGetTypeInfoGuid", MarshalNative::DoGetTypeInfoGuid)
- FCFuncElement("FCallGetTypeLibGuidForAssembly", MarshalNative::DoGetTypeLibGuidForAssembly)
- FCFuncElement("_GetTypeLibVersionForAssembly", MarshalNative::GetTypeLibVersionForAssembly)
- FCFuncElement("GetEndComSlot", MarshalNative::GetEndComSlot)
- FCFuncElement("GetMethodInfoForComSlot", MarshalNative::GetMethodInfoForComSlot)
- FCFuncElement("InternalGetComSlotForMethodInfo", MarshalNative::GetComSlotForMethodInfo)
- FCFuncElement("InternalSwitchCCW", MarshalNative::SwitchCCW)
- FCFuncElement("InternalWrapIUnknownWithComObject", MarshalNative::WrapIUnknownWithComObject)
- QCFuncElement("_GetInspectableIids", MarshalNative::GetInspectableIIDs)
- QCFuncElement("_GetCachedWinRTTypes", MarshalNative::GetCachedWinRTTypes)
- QCFuncElement("_GetCachedWinRTTypeByIid", MarshalNative::GetCachedWinRTTypeByIID)
-#endif // FEATURE_CORECLR
#endif // FEATURE_COMINTEROP
FCFuncEnd()
@@ -1367,11 +1189,6 @@ FCFuncEnd()
#ifdef FEATURE_COMINTEROP
-#ifndef FEATURE_CORECLR
-FCFuncStart(gExtensibleClassFactoryFuncs)
- FCFuncElement("RegisterObjectCreationCallback", RegisterObjectCreationCallback)
-FCFuncEnd()
-#endif
#ifdef FEATURE_COMINTEROP_TLB_SUPPORT
@@ -1458,13 +1275,7 @@ FCFuncStart(gCompilerFuncs)
FCIntrinsic("InitializeArray", ArrayNative::InitializeArray, CORINFO_INTRINSIC_InitializeArray)
FCFuncElement("_RunClassConstructor", ReflectionInvocation::RunClassConstructor)
FCFuncElement("_RunModuleConstructor", ReflectionInvocation::RunModuleConstructor)
-#ifndef FEATURE_CORECLR
- FCFuncElement("_PrepareMethod", ReflectionInvocation::PrepareMethod)
-#endif // !FEATURE_CORECLR
QCFuncElement("_CompileMethod", ReflectionInvocation::CompileMethod)
-#ifndef FEATURE_CORECLR
- FCFuncElement("PrepareDelegate", ReflectionInvocation::PrepareDelegate)
-#endif // !FEATURE_CORECLR
FCFuncElement("PrepareContractedDelegate", ReflectionInvocation::PrepareContractedDelegate)
FCFuncElement("ProbeForSufficientStack", ReflectionInvocation::ProbeForSufficientStack)
FCFuncElement("ExecuteCodeWithGuaranteedCleanup", ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup)
@@ -1562,20 +1373,12 @@ FCFuncStart(gMngdRefCustomMarshalerFuncs)
FCFuncEnd()
FCFuncStart(gStubHelperFuncs)
-#ifndef FEATURE_CORECLR
-#ifndef _WIN64
- FCFuncElement("GetFinalStubTarget", StubHelpers::GetFinalStubTarget)
-#endif // !_WIN64
- FCFuncElement("DemandPermission", StubHelpers::DemandPermission)
-#endif // !FEATURE_CORECLR
FCFuncElement("IsQCall", StubHelpers::IsQCall)
FCFuncElement("InitDeclaringType", StubHelpers::InitDeclaringType)
FCIntrinsic("GetNDirectTarget", StubHelpers::GetNDirectTarget, CORINFO_INTRINSIC_StubHelpers_GetNDirectTarget)
FCFuncElement("GetDelegateTarget", StubHelpers::GetDelegateTarget)
FCFuncElement("SetLastError", StubHelpers::SetLastError)
-#ifdef FEATURE_CORECLR
FCFuncElement("ClearLastError", StubHelpers::ClearLastError)
-#endif
FCFuncElement("ThrowInteropParamException", StubHelpers::ThrowInteropParamException)
FCFuncElement("InternalGetHRExceptionObject", StubHelpers::GetHRExceptionObject)
#ifdef FEATURE_COMINTEROP
@@ -1645,11 +1448,6 @@ FCFuncStart(gGCHandleFuncs)
FCFuncElement("InternalCheckDomain", MarshalNative::GCHandleInternalCheckDomain)
FCFuncEnd()
-#ifndef FEATURE_CORECLR
-FCFuncStart(gConsoleFuncs)
- QCFuncElement("GetTitleNative", ConsoleNative::GetTitle)
-FCFuncEnd()
-#endif // ifndef FEATURE_CORECLR
FCFuncStart(gVersioningHelperFuncs)
FCFuncElement("GetRuntimeId", GetRuntimeId_Wrapper)
@@ -1750,9 +1548,7 @@ FCClassElement("Array", "System", gArrayFuncs)
FCClassElement("ArrayWithOffset", "System.Runtime.InteropServices", gArrayWithOffsetFuncs)
FCClassElement("AssemblyBuilder", "System.Reflection.Emit", gAssemblyBuilderFuncs)
-#ifdef FEATURE_CORECLR
FCClassElement("AssemblyExtensions", "System.Reflection.Metadata", gAssemblyExtensionsFuncs)
-#endif
#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER)
FCClassElement("AssemblyLoadContext", "System.Runtime.Loader", gAssemblyLoadContextFuncs)
@@ -1762,22 +1558,11 @@ FCClassElement("AssemblyName", "System.Reflection", gAssemblyNameFuncs)
FCClassElement("Assert", "System.Diagnostics", gDiagnosticsAssert)
FCClassElement("BCLDebug", "System", gBCLDebugFuncs)
FCClassElement("Buffer", "System", gBufferFuncs)
-#ifndef FEATURE_CORECLR
-// Since the 2nd letter of the classname is capital, we need to sort this before all class names
-// that start with Cx where x is any small letter (strcmp is used for verification).
-FCClassElement("CLRConfig", "System", gCLRConfigFuncs)
-#endif // FEATURE_CORECLR
#if !defined(FEATURE_COREFX_GLOBALIZATION)
FCClassElement("CalendarData", "System.Globalization", gCalendarDataFuncs)
#endif // !defined(FEATURE_COREFX_GLOBALIZATION)
-#ifndef FEATURE_CORECLR
-FCClassElement("ChannelServices", "System.Runtime.Remoting.Channels", gChannelServicesFuncs)
-#endif // FEATURE_CORECLR
FCClassElement("CompareInfo", "System.Globalization", gCompareInfoFuncs)
FCClassElement("CompatibilitySwitch", "System.Runtime.Versioning", gCompatibilitySwitchFuncs)
-#ifndef FEATURE_CORECLR
-FCClassElement("Console", "System", gConsoleFuncs)
-#endif // ifndef FEATURE_CORECLR
#ifdef FEATURE_REMOTING
FCClassElement("Context", "System.Runtime.Remoting.Contexts", gContextFuncs)
#endif
@@ -1805,9 +1590,6 @@ FCClassElement("Environment", "System", gEnvironmentFuncs)
FCClassElement("EventArgsMarshaler", "System.StubHelpers", gEventArgsMarshalerFuncs)
#endif // FEATURE_COMINTEROP
FCClassElement("Exception", "System", gExceptionFuncs)
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
-FCClassElement("ExtensibleClassFactory", "System.Runtime.InteropServices", gExtensibleClassFactoryFuncs)
-#endif
FCClassElement("FileLoadException", "System.IO", gFileLoadExceptionFuncs)
FCClassElement("FormatterServices", "System.Runtime.Serialization", gSerializationFuncs)
FCClassElement("GC", "System", gGCInterfaceFuncs)
@@ -1871,20 +1653,9 @@ FCClassElement("ObjectMarshaler", "System.StubHelpers", gObjectMarshalerFuncs)
#endif
FCClassElement("OverlappedData", "System.Threading", gOverlappedFuncs)
FCClassElement("ParseNumbers", "System", gParseNumbersFuncs)
-#ifndef FEATURE_CORECLR
-FCClassElement("PasswordDeriveBytes", "System.Security.Cryptography", gPasswordDeriveBytesFuncs)
-#endif
-#if defined(FEATURE_MULTICOREJIT) && !defined(FEATURE_CORECLR)
-FCClassElement("ProfileOptimization", "System.Runtime", gProfileOptimizationFuncs)
-#endif // defined(FEATURE_MULTICOREJIT) && !defined(FEATURE_CORECLR)
-#ifdef FEATURE_CORECLR
FCClassElement("PunkSafeHandle", "System.Reflection.Emit", gSymWrapperCodePunkSafeHandleFuncs)
-#endif
-#ifndef FEATURE_CORECLR
-FCClassElement("RNGCryptoServiceProvider", "System.Security.Cryptography", gRNGCryptoServiceProviderFuncs)
-#endif
#ifdef FEATURE_RWLOCK
FCClassElement("ReaderWriterLock", "System.Threading", gRWLockFuncs)
#endif // FEATURE_RWLOCK
@@ -1919,9 +1690,6 @@ FCClassElement("SafeHandle", "System.Runtime.InteropServices", gSafeHandleFuncs)
FCClassElement("SafeTypeNameParserHandle", "System", gSafeTypeNameParserHandle)
FCClassElement("Signature", "System", gSignatureNative)
-#ifndef FEATURE_CORECLR
-FCClassElement("SizedReference", "System", gSizedRefHandleFuncs)
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_REMOTING
FCClassElement("StackBuilderSink", "System.Runtime.Remoting.Messaging", gStackBuilderSinkFuncs)
#endif
@@ -1938,9 +1706,6 @@ FCClassElement("TextInfo", "System.Globalization", gTextInfoFuncs)
#endif // !defined(FEATURE_COREFX_GLOBALIZATION)
FCClassElement("Thread", "System.Threading", gThreadFuncs)
FCClassElement("ThreadPool", "System.Threading", gThreadPoolFuncs)
-#ifndef FEATURE_CORECLR
-FCClassElement("TimeSpan", "System", gTimeSpanFuncs)
-#endif // !FEATURE_CORECLR
FCClassElement("TimerQueue", "System.Threading", gTimerFuncs)
FCClassElement("Type", "System", gSystem_Type)
FCClassElement("TypeBuilder", "System.Reflection.Emit", gCOMClassWriter)
@@ -1973,9 +1738,6 @@ FCClassElement("WinRTTypeNameConverter", "System.StubHelpers", gWinRTTypeNameCon
FCClassElement("WindowsRuntimeBufferHelper", "System.Runtime.InteropServices.WindowsRuntime", gWindowsRuntimeBufferHelperFuncs)
#endif
-#ifndef FEATURE_CORECLR
-FCClassElement("WindowsRuntimeDesignerContext", "System.Runtime.DesignerServices", gWindowsRuntimeContextFuncs)
-#endif
#if defined(FEATURE_COMINTEROP) && defined(FEATURE_REFLECTION_ONLY_LOAD)
FCClassElement("WindowsRuntimeMetadata", "System.Runtime.InteropServices.WindowsRuntime", gWindowsRuntimeMetadata)
diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp
index 91b9e64a78..4abfcc7dc7 100644
--- a/src/vm/eeconfig.cpp
+++ b/src/vm/eeconfig.cpp
@@ -16,11 +16,6 @@
#endif
#include "eeconfig.h"
#include "method.hpp"
-#ifndef FEATURE_CORECLR
-#include <xmlparser.h>
-#include <mscorcfg.h>
-#include "eeconfigfactory.h"
-#endif
#ifdef FEATURE_FUSION
#include "fusionsetup.h"
#endif
@@ -33,9 +28,7 @@
#ifdef FEATURE_WIN_DB_APPCOMPAT
#include "QuirksApi.h"
#endif
-#ifdef FEATURE_CORECLR
#include "configuration.h"
-#endif
using namespace clr;
@@ -294,9 +287,7 @@ HRESULT EEConfig::Init()
INDEBUG(fStressLog = true;)
-#ifdef FEATURE_CORECLR
fVerifyAllOnLoad = false;
-#endif
#ifdef _DEBUG
fExpandAllOnLoad = false;
fDebuggable = false;
@@ -798,14 +789,12 @@ HRESULT EEConfig::sync()
}
bool gcConcurrentWasForced = false;
-#ifdef FEATURE_CORECLR
// The CLRConfig value for UNSUPPORTED_gcConcurrent defaults to -1, and treats any
// positive value as 'forcing' concurrent GC to be on. Because the standard logic
// for mapping a DWORD CLRConfig to a boolean configuration treats -1 as true (just
// like any other nonzero value), we will explicitly check the DWORD later if this
// check returns false.
gcConcurrentWasForced = Configuration::GetKnobBooleanValue(W("System.GC.Concurrent"), false);
-#endif
int gcConcurrentConfigVal = 0;
if (!gcConcurrentWasForced)
@@ -975,14 +964,9 @@ HRESULT EEConfig::sync()
#endif
iGCForceCompact = GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_gcForceCompact, iGCForceCompact);
-#ifdef FEATURE_CORECLR
iGCNoAffinitize = Configuration::GetKnobBooleanValue(W("System.GC.NoAffinitize"),
CLRConfig::UNSUPPORTED_GCNoAffinitize);
iGCHeapCount = Configuration::GetKnobDWORDValue(W("System.GC.HeapCount"), CLRConfig::UNSUPPORTED_GCHeapCount);
-#else
- iGCNoAffinitize = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_GCNoAffinitize);
- iGCHeapCount = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_GCHeapCount);
-#endif
fStressLog = GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_StressLog, fStressLog) != 0;
fForceEnc = GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_ForceEnc, fForceEnc) != 0;
@@ -1137,59 +1121,6 @@ HRESULT EEConfig::sync()
fPInvokeRestoreEsp = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Jit_NetFx40PInvokeStackResilience);
#endif
-#ifndef FEATURE_CORECLR
- // These two values respect the Shim's policy of favoring config files over registry settings.
- fLegacyNullReferenceExceptionPolicy = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::UNSUPPORTED_legacyNullReferenceExceptionPolicy,
- fLegacyNullReferenceExceptionPolicy) != 0);
- fLegacyUnhandledExceptionPolicy = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::UNSUPPORTED_legacyUnhandledExceptionPolicy,
- fLegacyUnhandledExceptionPolicy) != 0);
-
-#ifdef FEATURE_CORRUPTING_EXCEPTIONS
- // Check if the user has overriden how Corrupted State Exceptions (CSE) will be handled. If the
- // <runtime> section of app.exe.config has "legacyCorruptedStateExceptionsPolicy" set to 1, then
- // V4 runtime will treat CSE in the same fashion as V2.
- fLegacyCorruptedStateExceptionsPolicy = (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_legacyCorruptedStateExceptionsPolicy) != 0);
-#endif // FEATURE_CORRUPTING_EXCEPTIONS
-
- fLegacyVirtualMethodCallVerification = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyVirtualMethodCallVerification,
- fLegacyVirtualMethodCallVerification,
- REGUTIL::COR_CONFIG_ALL, TRUE,
- CONFIG_SYSTEMONLY) != 0);
-
- fLegacyApartmentInitPolicy = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyApartmentInitPolicy,
- fLegacyApartmentInitPolicy) != 0);
-
- fLegacyComHierarchyVisibility = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyComHierarchyVisibility,
- fLegacyComHierarchyVisibility) != 0);
-
- fLegacyComVTableLayout = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyComVTableLayout,
- fLegacyComVTableLayout) != 0);
- fNewComVTableLayout = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_newComVTableLayout,
- fNewComVTableLayout) != 0);
-
- if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_legacyImpersonationPolicy) != 0)
- iImpersonationPolicy = IMP_NOFLOW;
- else if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_alwaysFlowImpersonationPolicy) != 0)
- iImpersonationPolicy = IMP_ALWAYSFLOW;
-
- fLegacyLoadMscorsnOnStartup = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::UNSUPPORTED_legacyLoadMscorsnOnStartup,
- fLegacyLoadMscorsnOnStartup) != 0);
- fBypassStrongNameVerification = (GetConfigDWORDFavoringConfigFile_DontUse_(W("bypassTrustedAppStrongNames"), fBypassStrongNameVerification) != 0) && // App opted in
- (GetConfigDWORD_DontUse_(SN_CONFIG_BYPASS_POLICY_W, TRUE, REGUTIL::COR_CONFIG_MACHINE) != 0); // And the machine policy allows for bypass
- fGeneratePublisherEvidence = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_generatePublisherEvidence, fGeneratePublisherEvidence) != 0);
- fEnforceFIPSPolicy = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_enforceFIPSPolicy, fEnforceFIPSPolicy) != 0);
- fLegacyHMACMode = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_legacyHMACMode, fLegacyHMACMode) != 0);
-
- fCacheBindingFailures = !(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_disableCachingBindingFailures));
- fUseLegacyIdentityFormat =
-#ifdef FEATURE_APPX
- AppX::IsAppXProcess() ||
-#endif
- (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_useLegacyIdentityFormat) != 0);
- fDisableFusionUpdatesFromADManager = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_disableFusionUpdatesFromADManager) != 0);
- fDisableCommitThreadStack = (GetConfigDWORDFavoringConfigFile_DontUse_(CLRConfig::EXTERNAL_disableCommitThreadStack, fDisableCommitThreadStack) != 0);
- fProbeForStackOverflow = !(CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_disableStackOverflowProbing));
-#endif // FEATURE_CORECLR
#ifdef _DEBUG
fDebuggable = (GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_JitDebuggable, fDebuggable) != 0);
@@ -1264,10 +1195,8 @@ HRESULT EEConfig::sync()
fEnableRCWCleanupOnSTAShutdown = (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_EnableRCWCleanupOnSTAShutdown) != 0);
#endif // FEATURE_COMINTEROP
-#ifdef FEATURE_CORECLR
//Eager verification of all assemblies.
fVerifyAllOnLoad = (GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_VerifyAllOnLoad, fVerifyAllOnLoad) != 0);
-#endif //FEATURE_CORECLR
#ifdef _DEBUG
fExpandAllOnLoad = (GetConfigDWORD_DontUse_(CLRConfig::INTERNAL_ExpandAllOnLoad, fExpandAllOnLoad) != 0);
@@ -1367,12 +1296,6 @@ HRESULT EEConfig::sync()
m_fInteropLogArguments = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_InteropLogArguments) != 0);
#ifdef FEATURE_PREJIT
-#ifndef FEATURE_CORECLR
- DWORD iNgenHardBindOverride = GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_HardPrejitEnabled, iNgenHardBind);
- _ASSERTE(iNgenHardBindOverride < NGEN_HARD_BIND_COUNT);
- if (iNgenHardBindOverride < NGEN_HARD_BIND_COUNT)
- iNgenHardBind = NgenHardBindType(iNgenHardBindOverride);
-#endif
#ifdef _DEBUG
dwNgenForceFailureMask = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NgenForceFailureMask);
dwNgenForceFailureCount = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_NgenForceFailureCount);
@@ -1565,305 +1488,6 @@ SIZE_T EEConfig::GetSizeOfProcessBindingFile()
return g_dwHostConfigFile;
}
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) // unimpactful install --> no config files
-
-/**************************************************************/
-static void MessageBoxParseError(HRESULT hr, __in_z LPCWSTR wszFile);
-
-#define IfFailParseError(FILE, ISAPPCONFIG, ...) \
- do \
- { \
- /* On error, always show an error dialog and return an error result when process is immersive; */ \
- /* otherwise show dialog (conditionally for App config) and swallow error. */ \
- if (FAILED(hr = (__VA_ARGS__)) && (!(ISAPPCONFIG) || AppX::IsAppXProcess() || GetConfigDWORDInternal_DontUse_(CLRConfig::EXTERNAL_NotifyBadAppCfg,false))) \
- { \
- MessageBoxParseError(hr, FILE); \
- if (AppX::IsAppXProcess()) \
- { /* Fail on bad config in AppX process. */ \
- return hr; \
- } \
- else \
- { \
- hr = S_FALSE; \
- } \
- } \
- } while (false)
-
-/**************************************************************/
-HRESULT EEConfig::SetupConfiguration()
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- MODE_ANY;
- } CONTRACTL_END;
-
- WCHAR version[_MAX_PATH];
- DWORD dwVersion = _MAX_PATH;
-
- HRESULT hr = S_OK;
- // Get the version location
- IfFailRet(GetCORVersionInternal(version, _MAX_PATH, & dwVersion));
-
- // See if the environment has specified an XML file
- NewArrayHolder<WCHAR> file(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CONFIG));
- if(file != NULL)
- {
- IfFailParseError(file, false, AppendConfigurationFile(file, version));
- }
-
- // We need to read configuration information from 3 sources... the app config file, the
- // host supplied config file, and the machine.config file. The order in which we
- // read them are very import. If the different config sources specify the same config
- // setting, we will use the setting of the first one read.
- //
- // In the pecking order, machine.config should always have the final say. The host supplied config
- // file should follow, and lastly, the app config file.
- //
- // Note: the order we read them is not the order they are published. Need to read the AppConfig
- // first so that we can decide if we should import machine.config (yes in Classic, typically no
- // in AppX). We still publish in the order required as described above.
-
- enum
- {
- MachineConfig = 0,
- HostConfig = 1,
- AppConfig = 2,
- NumConfig = 3,
- };
-
- ConfigSource * rgpSources[NumConfig] = { nullptr };
-
- // Create ConfigSource objects for all config files.
- for (size_t i = 0; i < NumConfig; ++i)
- {
- rgpSources[i] = new (nothrow) ConfigSource();
- if (rgpSources[i] == NULL)
- {
- while (i != 0)
- {
- --i;
- delete rgpSources[i];
- rgpSources[i] = nullptr;
- }
- return E_OUTOFMEMORY;
- }
- }
-
- // Publish ConfigSource objects in required order. It's ok that the file contents are imported below,
- // since we're in EEStartup and this data cannot be accessed by any other threads yet.
- for (size_t i = 0; i < NumConfig; ++i)
- {
- m_Configuration.Append(rgpSources[i]);
- }
-
- // ----------------------------------------------------
- // Import the app.config file, or in the case of an
- // AppX process check to make sure no app.config file
- // exists unless launched with AO_DESIGNMODE.
- // ----------------------------------------------------
-
- do
- {
- size_t cchProcExe=0;
- PathString wzProcExe;
- EX_TRY
- {
-
-
-
- // Get name of file used to create process
- if (g_pCachedModuleFileName)
- {
- wzProcExe.Set(g_pCachedModuleFileName);
- cchProcExe = wzProcExe.GetCount();
- }
- else
- {
- cchProcExe = WszGetModuleFileName(NULL, wzProcExe);
-
- if (cchProcExe == 0)
- {
- hr = HRESULT_FROM_GetLastError();
- break;
- }
- }
-
- if (cchProcExe != 0)
- {
- wzProcExe.Append(CONFIGURATION_EXTENSION);
-
- if (AppX::IsAppXProcess() && !AppX::IsAppXDesignMode())
- {
- if (clr::fs::Path::Exists(wzProcExe))
- {
- hr = CLR_E_APP_CONFIG_NOT_ALLOWED_IN_APPX_PROCESS;
- break;
- }
- }
- }
- }
- EX_CATCH_HRESULT(hr);
- if (cchProcExe != 0)
- {
- IfFailParseError(wzProcExe, true, AppendConfigurationFile(wzProcExe, version));
-
- // We really should return a failure hresult if the app config file is bad, but that
- // would be a breaking change. Not sure if it's worth it yet.
- hr = S_OK;
- break;
- }
- } while (false);
-
-
- if (hr != S_OK)
- return hr;
- // ----------------------------------------------------
- // Import machine.config, if needed.
- // ----------------------------------------------------
- if (!AppX::IsAppXProcess() || AppX::IsAppXDesignMode())
- {
- WCHAR wzSystemDir[_MAX_PATH];
- DWORD cchSystemDir = COUNTOF(wzSystemDir);
- IfFailRet(GetInternalSystemDirectory(wzSystemDir, &cchSystemDir));
-
- // cchSystemDir already includes the NULL
- if(cchSystemDir + StrLen(MACHINE_CONFIGURATION_FILE) <= _MAX_PATH)
- {
- IfFailRet(StringCchCat(wzSystemDir, COUNTOF(wzSystemDir), MACHINE_CONFIGURATION_FILE));
-
- // CLR_STARTUP_OPT:
- // The machine.config file can be very large. We cannot afford
- // to parse all of it at CLR startup time.
- //
- // Accordingly, we instruct the XML parser to stop parsing the
- // machine.config file when it sees the end of the
- // <runtime>...</runtime> section that holds our data (if any).
- //
- // By construction, this section is now placed near the top
- // of machine.config.
- //
- IfFailParseError(wzSystemDir, false, ImportConfigurationFile(
- rgpSources[MachineConfig]->Table(), wzSystemDir, version, stopAfterRuntimeSection));
-
- if (hr == S_FALSE) // means that we couldn't find machine.config
- hr = S_OK;
- }
- }
-
- // ----------------------------------------------------
- // Import the host supplied config file, if needed.
- // ----------------------------------------------------
- // Cannot host an AppX managed process, so no need to check devModeEnabled.
- if (!AppX::IsAppXProcess())
- {
- if (GetProcessBindingFile() != NULL && GetSizeOfProcessBindingFile() > 0)
- {
- IfFailRet(ImportConfigurationFile(
- rgpSources[HostConfig]->Table(), GetProcessBindingFile(), version));
- }
- }
-
- return hr;
-}
-
-//
-// There was an error 'hr' parsing the file 'wszFile'.
-// Pop up a MessageBox reporting the error, unless the config setting
-// 'NoGuiFromShim' is in effect.
-//
-static void MessageBoxParseError(HRESULT hr, __in_z LPCWSTR wszFile)
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- MODE_ANY;
- PRECONDITION(FAILED(hr));
- } CONTRACTL_END;
-
- if (!REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::UNSUPPORTED_NoGuiFromShim, FALSE))
- {
- EEMessageBoxCatastrophic(IDS_EE_CONFIGPARSER_ERROR, IDS_EE_CONFIGPARSER_ERROR_CAPTION, wszFile, hr);
- }
-}
-
-/**************************************************************/
-
-STDAPI GetXMLObjectEx(IXMLParser **ppv);
-
-HRESULT EEConfig::ImportConfigurationFile(
- ConfigStringHashtable* pTable,
- LPCWSTR pszFileName,
- LPCWSTR version,
- ParseCtl parseCtl)
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- PRECONDITION(CheckPointer(pTable));
- PRECONDITION(CheckPointer(pszFileName));
- PRECONDITION(CheckPointer(version));
- INJECT_FAULT(return E_OUTOFMEMORY);
- } CONTRACTL_END;
-
- NonVMComHolder<IXMLParser> pIXMLParser(NULL);
- NonVMComHolder<IStream> pFile(NULL);
- NonVMComHolder<EEConfigFactory> factory(NULL);
-
- HRESULT hr = CreateConfigStreamHelper(pszFileName, &pFile);
- if(FAILED(hr)) goto Exit;
-
- hr = GetXMLObjectEx(&pIXMLParser);
- if(FAILED(hr)) goto Exit;
-
- factory = new (nothrow) EEConfigFactory(pTable, version, parseCtl);
-
- if ( ! factory) {
- hr = E_OUTOFMEMORY;
- goto Exit;
- }
- factory->AddRef(); // RefCount = 1
-
-
- hr = pIXMLParser->SetInput(pFile); // filestream's RefCount=2
- if ( ! SUCCEEDED(hr))
- goto Exit;
-
- hr = pIXMLParser->SetFactory(factory); // factory's RefCount=2
- if ( ! SUCCEEDED(hr))
- goto Exit;
-
- {
- CONTRACT_VIOLATION(ThrowsViolation); // @todo: Run() throws!
- hr = pIXMLParser->Run(-1);
- }
-
-Exit:
- if (hr == (HRESULT) XML_E_MISSINGROOT)
- hr = S_OK;
- else if (Assembly::FileNotFound(hr))
- hr = S_FALSE;
-
- return hr;
-}
-
-HRESULT EEConfig::AppendConfigurationFile(
- LPCWSTR pszFileName,
- LPCWSTR version,
- ParseCtl parseCtl)
-{
- LIMITED_METHOD_CONTRACT;
- HRESULT hr = S_OK;
-
- ConfigStringHashtable* pTable = m_Configuration.Append();
- IfNullRet(pTable);
-
- return ImportConfigurationFile(pTable, pszFileName, version, parseCtl);
-}
-
-
-#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE
bool EEConfig::RequireZap(LPCUTF8 assemblyName) const
{
diff --git a/src/vm/eeconfig.h b/src/vm/eeconfig.h
index 338a97268b..8e21c445da 100644
--- a/src/vm/eeconfig.h
+++ b/src/vm/eeconfig.h
@@ -510,9 +510,7 @@ public:
}
#endif // FEATURE_COMINTEROP
-#ifdef FEATURE_CORECLR
bool VerifyModulesOnLoad(void) const { LIMITED_METHOD_CONTRACT; return fVerifyAllOnLoad; }
-#endif
#ifdef _DEBUG
bool ExpandModulesOnLoad(void) const { LIMITED_METHOD_CONTRACT; return fExpandAllOnLoad; }
#endif //_DEBUG
@@ -1008,9 +1006,7 @@ private: //----------------------------------------------------------------
bool m_fDeveloperInstallation; // We are on a developers machine
bool fAppDomainUnload; // Enable appdomain unloading
-#ifdef FEATURE_CORECLR
bool fVerifyAllOnLoad; // True if we want to verify all methods in an assembly at load time.
-#endif //FEATURE_CORECLR
DWORD dwADURetryCount;
@@ -1197,20 +1193,6 @@ private: //----------------------------------------------------------------
#endif
public:
-#ifndef FEATURE_CORECLR // unimpactful install --> no config files
- HRESULT ImportConfigurationFile(
- ConfigStringHashtable* pTable,
- LPCWSTR pszFileName,
- LPCWSTR version,
- ParseCtl parseCtl = parseAll);
-
- HRESULT AppendConfigurationFile(
- LPCWSTR pszFileName,
- LPCWSTR version,
- ParseCtl parseCtl = parseAll);
-
- HRESULT SetupConfiguration();
-#endif // FEATURE_CORECLR
HRESULT GetConfiguration_DontUse_(__in_z LPCWSTR pKey, ConfigSearch direction, __deref_out_opt LPCWSTR* value);
LPCWSTR GetProcessBindingFile(); // All flavors must support this method
diff --git a/src/vm/eepolicy.cpp b/src/vm/eepolicy.cpp
index 236f5afd6e..b35e9e9864 100644
--- a/src/vm/eepolicy.cpp
+++ b/src/vm/eepolicy.cpp
@@ -70,12 +70,10 @@ EEPolicy::EEPolicy ()
m_ActionOnFailure[FAIL_NonCriticalResource] = eThrowException;
m_ActionOnFailure[FAIL_OrphanedLock] = eNoAction;
m_ActionOnFailure[FAIL_FatalRuntime] = eRudeExitProcess;
-#ifdef FEATURE_CORECLR
// For CoreCLR, initialize the default action for AV processing to all
// all kind of code to catch AV exception. If the host wants, they can
// specify a different action for this.
m_ActionOnFailure[FAIL_AccessViolation] = eNoAction;
-#endif // FEATURE_CORECLR
m_ActionOnFailure[FAIL_StackOverflow] = eRudeExitProcess;
m_ActionOnFailure[FAIL_CodeContract] = eThrowException;
m_unhandledExceptionPolicy = eRuntimeDeterminedPolicy;
@@ -178,22 +176,10 @@ BOOL EEPolicy::IsValidActionForFailure(EClrFailure failure, EPolicyAction action
return action >= eUnloadAppDomain &&
action < MaxPolicyAction;
case FAIL_AccessViolation:
-#ifdef FEATURE_CORECLR
// Allowed actions on failure are:
//
// eNoAction or eRudeExitProcess.
return ((action == eNoAction) || (action == eRudeExitProcess));
-#else // !FEATURE_CORECLR
- // FAIL_AccessViolation is defined for the desktop so that
- // if any more definitions are added after it, their value
- // should remain constant irrespective of whether its the
- // desktop CLR or CoreCLR.
- //
- // That said, currently, Desktop CLR does not support
- // FAIL_AccessViolation. Thus, any calls which use
- // this failure are not allowed.
- return FALSE;
-#endif // FEATURE_CORECLR
case FAIL_StackOverflow:
return action >= eRudeUnloadAppDomain &&
action < MaxPolicyAction;
@@ -602,21 +588,6 @@ void EEPolicy::ExitProcessViaShim(UINT exitCode)
// runtime in a process with many. We need to give the other runtimes a chance to exit
// cleanly. If we can't make the call, or if the call fails for some reason, then we
// simply exit the process here, which is rude to the others, but the best we can do.
-#if !defined(FEATURE_CORECLR)
- {
- ReleaseHolder<ICLRRuntimeHostInternal> pRuntimeHostInternal;
-
- HRESULT hr = g_pCLRRuntime->GetInterface(CLSID_CLRRuntimeHostInternal,
- IID_ICLRRuntimeHostInternal,
- &pRuntimeHostInternal);
-
- if (SUCCEEDED(hr))
- {
- pRuntimeHostInternal->ShutdownAllRuntimesThenExit(exitCode);
- LOG((LF_EH, LL_INFO10, "ExitProcessViaShim: shim returned... exiting now.\n"));
- }
- }
-#endif // !FEATURE_CORECLR
ExitProcess(exitCode);
}
diff --git a/src/vm/eventreporter.cpp b/src/vm/eventreporter.cpp
index 6ef767c424..e10aed9441 100644
--- a/src/vm/eventreporter.cpp
+++ b/src/vm/eventreporter.cpp
@@ -20,9 +20,7 @@
#include "../dlls/mscorrc/resource.h"
-#if defined(FEATURE_CORECLR)
#include "getproductversionnumber.h"
-#endif // FEATURE_CORECLR
//---------------------------------------------------------------------------------------
//
@@ -84,30 +82,13 @@ EventReporter::EventReporter(EventReporterType type)
ssMessage.Clear();
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_FRAMEWORK_VERSION))
-#ifndef FEATURE_CORECLR
- m_Description.Append(W("Framework Version: "));
-#else // FEATURE_CORECLR
m_Description.Append(W("CoreCLR Version: "));
-#endif // !FEATURE_CORECLR
else
{
m_Description.Append(ssMessage);
}
BOOL fHasVersion = FALSE;
-#ifndef FEATURE_CORECLR
- if (GetCLRModule() != NULL)
- {
- WCHAR buffer[80];
- DWORD length;
- if (SUCCEEDED(GetCORVersionInternal(buffer, 80, &length)))
- {
- m_Description.Append(buffer);
- m_Description.Append(W("\n"));
- fHasVersion = TRUE;
- }
- }
-#else // FEATURE_CORECLR
DWORD dwMajorVersion = 0;
DWORD dwMinorVersion = 0;
DWORD dwBuild = 0;
@@ -115,7 +96,6 @@ EventReporter::EventReporter(EventReporterType type)
EventReporter::GetCoreCLRInstanceProductVersion(&dwMajorVersion, &dwMinorVersion, &dwBuild, &dwRevision);
m_Description.AppendPrintf(W("%lu.%lu.%lu.%lu\n"),dwMajorVersion, dwMinorVersion, dwBuild, dwRevision);
fHasVersion = TRUE;
-#endif // !FEATURE_CORECLR
if (!fHasVersion)
{
@@ -674,7 +654,6 @@ void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
gc.throwable = pThread->GetThrowable();
_ASSERTE(gc.throwable != NULL);
-#ifdef FEATURE_CORECLR
// On CoreCLR, managed code execution happens in non-default AppDomains and all threads have an AD transition
// at their base from DefaultDomain to the target Domain before they start executing managed code. Thus, when
// an exception goes unhandled in a non-default AppDomain on a reverse pinvoke thread, the original exception details are copied
@@ -716,7 +695,6 @@ void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
}
}
else
-#endif // FEATURE_CORECLR
{
if (IsException(gc.throwable->GetMethodTable()))
{
@@ -771,7 +749,6 @@ void DoReportForUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
}
}
-#if defined(FEATURE_CORECLR)
// This function will return the product version of CoreCLR
// instance we are executing in.
void EventReporter::GetCoreCLRInstanceProductVersion(DWORD * pdwMajor, DWORD * pdwMinor, DWORD * pdwBuild, DWORD * pdwRevision)
@@ -809,4 +786,3 @@ void EventReporter::GetCoreCLRInstanceProductVersion(DWORD * pdwMajor, DWORD * p
LOG((LF_CORDB, LL_INFO100, "GetCoreCLRInstanceVersion: Unable to get CoreCLR version.\n"));
}
}
-#endif // FEATURE_CORECLR
diff --git a/src/vm/eventreporter.h b/src/vm/eventreporter.h
index ecbc9d1382..54317133dd 100644
--- a/src/vm/eventreporter.h
+++ b/src/vm/eventreporter.h
@@ -49,9 +49,7 @@ private:
// Flag to indicate if the buffer is full
BOOL fBufferFull;
-#ifdef FEATURE_CORECLR
static void GetCoreCLRInstanceProductVersion(DWORD * pdwMajor, DWORD * pdwMinor, DWORD * pdwBuild, DWORD * pdwRevision);
-#endif // FEATURE_CORECLR
public:
// Construct
diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp
index fb5d9b0090..4285f6e5b4 100644
--- a/src/vm/eventtrace.cpp
+++ b/src/vm/eventtrace.cpp
@@ -4316,16 +4316,10 @@ HRESULT ETW::CEtwTracer::Register()
EventRegisterMicrosoft_Windows_DotNETRuntimeRundown();
// Stress Log ETW events are available only on the desktop version of the runtime
-#ifndef FEATURE_CORECLR
- EventRegisterMicrosoft_Windows_DotNETRuntimeStress();
-#endif // !FEATURE_CORECLR
MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context.RegistrationHandle = Microsoft_Windows_DotNETRuntimeHandle;
MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context.RegistrationHandle = Microsoft_Windows_DotNETRuntimePrivateHandle;
MICROSOFT_WINDOWS_DOTNETRUNTIME_RUNDOWN_PROVIDER_Context.RegistrationHandle = Microsoft_Windows_DotNETRuntimeRundownHandle;
-#ifndef FEATURE_CORECLR
- MICROSOFT_WINDOWS_DOTNETRUNTIME_STRESS_PROVIDER_Context.RegistrationHandle = Microsoft_Windows_DotNETRuntimeStressHandle;
-#endif // !FEATURE_CORECLR
return S_OK;
}
@@ -4351,9 +4345,6 @@ HRESULT ETW::CEtwTracer::UnRegister()
EventUnregisterMicrosoft_Windows_DotNETRuntime();
EventUnregisterMicrosoft_Windows_DotNETRuntimePrivate();
EventUnregisterMicrosoft_Windows_DotNETRuntimeRundown();
-#ifndef FEATURE_CORECLR
- EventUnregisterMicrosoft_Windows_DotNETRuntimeStress();
-#endif // !FEATURE_CORECLR
return S_OK;
}
@@ -4903,11 +4894,7 @@ VOID ETW::InfoLog::RuntimeInformation(INT32 type)
g_fEEComActivatedStartup || //CLR started as a COM object
g_fEEOtherStartup ); //In case none of the 4 above mentioned cases are true for example ngen, ildasm then we asssume its a "other" startup
-#ifdef FEATURE_CORECLR
Sku = ETW::InfoLog::InfoStructs::CoreCLR;
-#else
- Sku = ETW::InfoLog::InfoStructs::DesktopCLR;
-#endif //FEATURE_CORECLR
//version info for clr.dll
USHORT vmMajorVersion = VER_MAJORVERSION;
@@ -4926,30 +4913,6 @@ VOID ETW::InfoLog::RuntimeInformation(INT32 type)
PCWSTR lpwszCommandLine = W("");
-#ifndef FEATURE_CORECLR
- startupFlags = CorHost2::GetStartupFlags();
-
- // Some of the options specified by the startup flags can be overwritten by config files.
- // Strictly speaking since the field in this event is called StartupFlags there's nothing
- // wrong with just showing the actual startup flags but it makes it less useful (a more
- // appropriate name for the field is StartupOptions).
- startupFlags &= ~STARTUP_CONCURRENT_GC;
- if (g_pConfig->GetGCconcurrent())
- startupFlags |= STARTUP_CONCURRENT_GC;
-
- if (g_pConfig->DefaultSharePolicy() != AppDomain::SHARE_POLICY_UNSPECIFIED)
- {
- startupFlags &= ~STARTUP_LOADER_OPTIMIZATION_MASK;
- startupFlags |= g_pConfig->DefaultSharePolicy() << 1;
- }
-
- startupFlags &= ~STARTUP_LEGACY_IMPERSONATION;
- startupFlags &= ~STARTUP_ALWAYSFLOW_IMPERSONATION;
- if (g_pConfig->ImpersonationMode() == IMP_NOFLOW)
- startupFlags |= STARTUP_LEGACY_IMPERSONATION;
- else if (g_pConfig->ImpersonationMode() == IMP_ALWAYSFLOW)
- startupFlags |= STARTUP_ALWAYSFLOW_IMPERSONATION;
-#endif //!FEATURE_CORECLR
// Determine the startupmode
if(g_fEEIJWStartup)
@@ -5457,9 +5420,6 @@ VOID ETW::MethodLog::MethodTableRestored(MethodTable *pMethodTable)
VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
-#ifndef FEATURE_CORECLR
- FireEtwStrongNameVerificationStart_V1(dwInFlags, 0, strFullyQualifiedAssemblyName, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
}
@@ -5469,9 +5429,6 @@ VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR
VOID ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
-#ifndef FEATURE_CORECLR
- FireEtwStrongNameVerificationStop_V1(dwInFlags, result, strFullyQualifiedAssemblyName, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
}
/****************************************************************************/
diff --git a/src/vm/excep.cpp b/src/vm/excep.cpp
index 262414cd6c..3a4685eb11 100644
--- a/src/vm/excep.cpp
+++ b/src/vm/excep.cpp
@@ -4125,32 +4125,6 @@ void DisableOSWatson(void)
SetErrorMode(lastErrorMode | SEM_NOGPFAULTERRORBOX);
LOG((LF_EH, LL_INFO100, "DisableOSWatson: SetErrorMode = 0x%x\n", lastErrorMode | SEM_NOGPFAULTERRORBOX));
-#ifndef FEATURE_CORECLR
- // CoreCLR is always hosted and so this condition is always false
- if (RunningOnWin7() && !CLRHosted())
- {
- typedef DWORD (WINAPI * GetThreadErrorModeFnPtr)(void);
- typedef BOOL (WINAPI * SetThreadErrorModeFnPtr)(DWORD, LPDWORD);
- GetThreadErrorModeFnPtr pFnGetThreadErrorMode;
- SetThreadErrorModeFnPtr pFnSetThreadErrorMode;
-
- HINSTANCE hKernel32 = WszGetModuleHandle(WINDOWS_KERNEL32_DLLNAME_W);
- if (hKernel32 != NULL)
- {
- pFnGetThreadErrorMode = (GetThreadErrorModeFnPtr)GetProcAddress(hKernel32, "GetThreadErrorMode");
- pFnSetThreadErrorMode = (SetThreadErrorModeFnPtr)GetProcAddress(hKernel32, "SetThreadErrorMode");
-
- // GetThreadErrorMode and SetThreadErrorMode should be available on Win7.
- _ASSERTE((pFnGetThreadErrorMode != NULL) && (pFnSetThreadErrorMode != NULL));
- if ((pFnGetThreadErrorMode != NULL) && (pFnSetThreadErrorMode != NULL))
- {
- DWORD dwOldMode = (*pFnGetThreadErrorMode)();
- (*pFnSetThreadErrorMode)(dwOldMode | SEM_NOGPFAULTERRORBOX, &dwOldMode);
- LOG((LF_EH, LL_INFO100, "DisableOSWatson: SetThreadErrorMode = 0x%x\n", dwOldMode | SEM_NOGPFAULTERRORBOX));
- }
- }
- }
-#endif // FEATURE_CORECLR
}
@@ -4858,7 +4832,6 @@ LONG DefaultCatchNoSwallowFilter(EXCEPTION_POINTERS *ep, PVOID pv)
return EXCEPTION_CONTINUE_SEARCH;
} // LONG DefaultCatchNoSwallowFilter()
-#if defined(FEATURE_CORECLR)
// Note: This is used only for CoreCLR on WLC.
//
// We keep a pointer to the previous unhandled exception filter. After we install, we use
@@ -4871,7 +4844,6 @@ LONG DefaultCatchNoSwallowFilter(EXCEPTION_POINTERS *ep, PVOID pv)
// yet and having installed it but the original handler was NULL.
static LPTOP_LEVEL_EXCEPTION_FILTER g_pOriginalUnhandledExceptionFilter = (LPTOP_LEVEL_EXCEPTION_FILTER)-1;
#define FILTER_NOT_INSTALLED (LPTOP_LEVEL_EXCEPTION_FILTER) -1
-#endif // defined(FEATURE_CORECLR)
BOOL InstallUnhandledExceptionFilter() {
@@ -5222,7 +5194,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
//
if (pThread && (pThread->HasThreadStateNC(Thread::TSNC_ProcessedUnhandledException) || pThread->HasThreadStateNC(Thread::TSNC_AppDomainContainUnhandled)))
{
-#ifdef FEATURE_CORECLR
// This assert shouldnt be hit in CoreCLR since:
//
// 1) It has no concept of managed entry point that is invoked by the shim. You can
@@ -5236,7 +5207,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
{
_ASSERTE(!"How come a thread with TSNC_ProcessedUnhandledException state entered the UEF on CoreCLR?");
}
-#endif // FEATURE_CORECLR
LOG((LF_EH, LL_INFO100, "InternalUnhandledExceptionFilter_Worker: have already processed unhandled exception for this thread.\n"));
return EXCEPTION_CONTINUE_SEARCH;
@@ -5318,7 +5288,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
{
BOOL fIsProcessTerminating = TRUE;
-#ifdef FEATURE_CORECLR
// In CoreCLR, we can be asked to not let an exception go unhandled on managed threads in a given AppDomain.
// If the exception reaches the top of the thread's stack, we simply deliver AppDomain's UnhandledException event and
// return back to the filter, instead of letting the process terminate because of unhandled exception.
@@ -5342,7 +5311,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
fIsProcessTerminating = !(pParam->pThread->GetDomain()->IgnoreUnhandledExceptions());
else
fIsProcessTerminating = !(pParam->pThread->HasThreadStateNC(Thread::TSNC_IgnoreUnhandledExceptions));
-#endif // FEATURE_CORECLR
#ifndef FEATURE_PAL
// Setup the watson bucketing details for UE processing.
@@ -5354,14 +5322,12 @@ LONG InternalUnhandledExceptionFilter_Worker(
// Send notifications to the AppDomains.
NotifyAppDomainsOfUnhandledException(pParam->pExceptionInfo, NULL, useLastThrownObject, fIsProcessTerminating /*isTerminating*/);
-#ifdef FEATURE_CORECLR
// If the process is not terminating, then return back to the filter and ask it to execute
if (!fIsProcessTerminating)
{
pParam->retval = EXCEPTION_EXECUTE_HANDLER;
goto lDone;
}
-#endif // FEATURE_CORECLR
}
else
{
@@ -5547,7 +5513,6 @@ LONG InternalUnhandledExceptionFilter(
//
// Note: Also see the conditional UEF registration with the OS in EEStartupHelper.
-#ifdef FEATURE_CORECLR
// We would be here only on CoreCLR for WLC since we dont register
// the UEF with the OS for SL.
if (g_pOriginalUnhandledExceptionFilter != FILTER_NOT_INSTALLED
@@ -5555,7 +5520,6 @@ LONG InternalUnhandledExceptionFilter(
{
STRESS_LOG1(LF_EH, LL_INFO100, "InternalUnhandledExceptionFilter: Not chaining back to previous UEF at address %p on CoreCLR!\n", g_pOriginalUnhandledExceptionFilter);
}
-#endif // FEATURE_CORECLR
return retval;
@@ -5623,7 +5587,7 @@ LONG EntryPointFilter(PEXCEPTION_POINTERS pExceptionInfo, PVOID _pData)
// Returns
// the result of calling InternalUnhandledExceptionFilter
//------------------------------------------------------------------------------
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
#pragma code_seg(push, uef, CLR_UEF_SECTION_NAME)
#endif // FEATURE_CORECLR && !FEATURE_PAL
LONG __stdcall COMUnhandledExceptionFilter( // EXCEPTION_CONTINUE_SEARCH or EXCEPTION_CONTINUE_EXECUTION
@@ -5653,47 +5617,6 @@ LONG __stdcall COMUnhandledExceptionFilter( // EXCEPTION_CONTINUE_SEARCH or
return retVal;
}
-#ifndef FEATURE_CORECLR
-#ifdef _DEBUG
- // V4 onwards, we will reach here in the UEF only on the following conditions:
- //
- // 1) Faulting address is in native code on a reverse pinvoke thread. An example is an exception that escaped
- // out of the reverse pinvoke thread but was caught in the native part of the thread. The native part then
- // had another exception that went unhandled. The difference between this and (3) below is that
- // we have a thread object here but not in (3).
- //
- // An exception from PInvoke, that is never caught/rethrown in managed code and goes unhandled, also falls
- // in this category.
- //
- // 2) The exception escaped out of a reverse pinvoke thread and went unhandled.
- //
- // 3) Faulting thread was never seen by the runtime. An example is a another native thread
- // which the user code created that had unhandled exception.
- //
- // 4) A corrupting exception may become unhandled.
- //
- // This is not applicable to CoreCLR, as this unhandled exception filter is always set up, and all hardware exceptions in
- // managed code, including those that are not process-corrupting, such as integer division by zero, will end up here.
-
- // Assert these conditions here - we shouldnt be here for any other unhandled exception processing.
- Thread *pThread = GetThread();
- if ((pThread != NULL) && // condition 3
- !(pThread->GetExceptionState()->IsExceptionInProgress() &&
- pThread->GetExceptionState()->GetFlags()->ReversePInvokeEscapingException()) && // condition 2
- (ExecutionManager::IsManagedCode((PCODE)pExceptionInfo->ExceptionRecord->ExceptionAddress))) // condition 1
- {
-#ifdef FEATURE_CORRUPTING_EXCEPTIONS
- if (!CEHelper::IsProcessCorruptedStateException(pExceptionInfo->ExceptionRecord->ExceptionCode)) // condition 4
- {
- GCX_COOP();
- _ASSERTE(CEHelper::IsProcessCorruptedStateException(pThread->GetThrowable())); // condition 4
- }
-#else // !FEATURE_CORRUPTING_EXCEPTIONS
- _ASSERTE(false);
-#endif // FEATURE_CORRUPTING_EXCEPTIONS
- }
-#endif // _DEBUG
-#endif // !FEATURE_CORECLR
retVal = InternalUnhandledExceptionFilter(pExceptionInfo);
@@ -5706,7 +5629,7 @@ LONG __stdcall COMUnhandledExceptionFilter( // EXCEPTION_CONTINUE_SEARCH or
return retVal;
} // LONG __stdcall COMUnhandledExceptionFilter()
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
#pragma code_seg(pop, uef)
#endif // FEATURE_CORECLR && !FEATURE_PAL
@@ -6802,10 +6725,8 @@ exit:
#ifndef FEATURE_PAL
-#ifdef FEATURE_CORECLR
// Only proceed if Watson is enabled - CoreCLR may have it disabled.
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
BOOL fClearUEWatsonBucketTracker = TRUE;
PTR_EHWatsonBucketTracker pUEWatsonBucketTracker = pThread->GetExceptionState()->GetUEWatsonBucketTracker();
@@ -7108,7 +7029,7 @@ bool IsInterceptableException(Thread *pThread)
// appropriate exception code, or zero if the code is not a GC marker.
DWORD GetGcMarkerExceptionCode(LPVOID ip)
{
-#if defined(HAVE_GCCOVER) && defined(FEATURE_CORECLR)
+#if defined(HAVE_GCCOVER)
WRAPPER_NO_CONTRACT;
if (GCStress<cfg_any>::IsEnabled() && IsGcCoverageInterrupt(ip))
@@ -9322,13 +9243,11 @@ BOOL SetupWatsonBucketsForNonPreallocatedExceptions(OBJECTREF oThrowable /* = NU
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// CoreCLR may have watson bucketing conditionally enabled.
if (!IsWatsonEnabled())
{
return FALSE;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -9441,13 +9360,11 @@ BOOL SetupWatsonBucketsForEscapingPreallocatedExceptions()
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// CoreCLR may have watson bucketing conditionally enabled.
if (!IsWatsonEnabled())
{
return FALSE;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -9572,13 +9489,11 @@ void SetupWatsonBucketsForUEF(BOOL fUseLastThrownObject)
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// CoreCLR may have watson bucketing conditionally enabled.
if (!IsWatsonEnabled())
{
return;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -10028,14 +9943,12 @@ BOOL SetupWatsonBucketsForFailFast(EXCEPTIONREF refException)
BOOL fResult = TRUE;
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (!IsWatsonEnabled())
{
return fResult;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -10290,14 +10203,12 @@ void SetupInitialThrowBucketDetails(UINT_PTR adjustedIp)
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (!IsWatsonEnabled())
{
return;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -10901,14 +10812,12 @@ void SetStateForWatsonBucketing(BOOL fIsRethrownException, OBJECTHANDLE ohOrigin
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (!IsWatsonEnabled())
{
return;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
@@ -11364,7 +11273,7 @@ UINT_PTR EHWatsonBucketTracker::RetrieveWatsonBucketIp()
// This is *also* invoked from the DAC when buckets are requested.
PTR_VOID EHWatsonBucketTracker::RetrieveWatsonBuckets()
{
-#if defined(FEATURE_CORECLR) && !defined(DACCESS_COMPILE)
+#if !defined(DACCESS_COMPILE)
if (!IsWatsonEnabled())
{
return NULL;
@@ -11390,12 +11299,10 @@ void EHWatsonBucketTracker::ClearWatsonBucketDetails()
{
#ifndef DACCESS_COMPILE
-#ifdef FEATURE_CORECLR
if (!IsWatsonEnabled())
{
return;
}
-#endif // FEATURE_CORECLR
CONTRACTL
{
diff --git a/src/vm/excep.h b/src/vm/excep.h
index 53fa20160a..6057c551a5 100644
--- a/src/vm/excep.h
+++ b/src/vm/excep.h
@@ -174,7 +174,7 @@ BOOL IsCOMPlusExceptionHandlerInstalled();
BOOL InstallUnhandledExceptionFilter();
void UninstallUnhandledExceptionFilter();
-#if defined(FEATURE_CORECLR) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_PAL)
// Section naming is a strategy by itself. Ideally, we could have named the UEF section
// ".text$zzz" (lowercase after $ is important). What the linker does is look for the sections
// that has the same name before '$' sign. It combines them together but sorted in an alphabetical
diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp
index 262d3526eb..63192a2146 100644
--- a/src/vm/exceptionhandling.cpp
+++ b/src/vm/exceptionhandling.cpp
@@ -966,7 +966,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
}
#endif // FEATURE_CORRUPTING_EXCEPTIONS
-#ifdef FEATURE_CORECLR
{
// Switch to COOP mode since we are going to work
// with throwable
@@ -1009,7 +1008,6 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
}
}
}
-#endif // FEATURE_CORECLR
#ifndef FEATURE_PAL // Watson is on Windows only
// Setup bucketing details for nested exceptions (rethrow and non-rethrow) only if we are in the first pass
diff --git a/src/vm/finalizerthread.cpp b/src/vm/finalizerthread.cpp
index 4c0f5acbf9..d52d599db2 100644
--- a/src/vm/finalizerthread.cpp
+++ b/src/vm/finalizerthread.cpp
@@ -1408,12 +1408,10 @@ BOOL FinalizerThread::FinalizerThreadWatchDogHelper()
}
#endif // PROFILING_SUPPORTED
-#ifdef FEATURE_CORECLR
// This change was added late in Windows Phone 8, so we want to keep it minimal.
// We should consider refactoring this later, as we've got a lot of dead code here now on CoreCLR.
dwTimeout = INFINITE;
maxTotalWait = INFINITE;
-#endif // FEATURE_CORECLR
while (1) {
struct Param
diff --git a/src/vm/frames.h b/src/vm/frames.h
index e37f980b9f..2c9ddb4ab0 100644
--- a/src/vm/frames.h
+++ b/src/vm/frames.h
@@ -3203,9 +3203,6 @@ private:
PTR_Object m_LastThrownObjectInParentContext;
ULONG_PTR m_LockCount; // Number of locks the thread takes
// before the transition.
-#ifndef FEATURE_CORECLR
- ULONG_PTR m_CriticalRegionCount;
-#endif // !FEATURE_CORECLR
VPTR_VTABLE_CLASS(ContextTransitionFrame, Frame)
public:
@@ -3244,18 +3241,6 @@ public:
return (DWORD) m_LockCount;
}
-#ifndef FEATURE_CORECLR
- void SetCriticalRegionCount(DWORD criticalRegionCount)
- {
- LIMITED_METHOD_CONTRACT;
- m_CriticalRegionCount = criticalRegionCount;
- }
- DWORD GetCriticalRegionCount()
- {
- LIMITED_METHOD_CONTRACT;
- return (DWORD) m_CriticalRegionCount;
- }
-#endif // !FEATURE_CORECLR
// Let debugger know that we're transitioning between AppDomains.
ETransitionType GetTransitionType()
@@ -3270,9 +3255,6 @@ public:
, m_ReturnExecutionContext(NULL)
, m_LastThrownObjectInParentContext(NULL)
, m_LockCount(0)
-#ifndef FEATURE_CORECLR
- , m_CriticalRegionCount(0)
-#endif // !FEATURE_CORECLR
{
LIMITED_METHOD_CONTRACT;
}
diff --git a/src/vm/gcenv.os.cpp b/src/vm/gcenv.os.cpp
index f61d042092..29f912ce41 100644
--- a/src/vm/gcenv.os.cpp
+++ b/src/vm/gcenv.os.cpp
@@ -378,11 +378,7 @@ static size_t GetRestrictedPhysicalMemoryLimit()
size_t job_physical_memory_limit = (size_t)MAX_PTR;
BOOL in_job_p = FALSE;
-#ifdef FEATURE_CORECLR
HINSTANCE hinstKernel32 = 0;
-#else
- HINSTANCE hinstPsapi = 0;
-#endif
PIS_PROCESS_IN_JOB GCIsProcessInJob = 0;
PQUERY_INFORMATION_JOB_OBJECT GCQueryInformationJobObject = 0;
@@ -394,21 +390,11 @@ static size_t GetRestrictedPhysicalMemoryLimit()
if (in_job_p)
{
-#ifdef FEATURE_CORECLR
hinstKernel32 = WszLoadLibrary(L"kernel32.dll");
if (!hinstKernel32)
goto exit;
GCGetProcessMemoryInfo = (PGET_PROCESS_MEMORY_INFO)GetProcAddress(hinstKernel32, "K32GetProcessMemoryInfo");
-#else
- // We need a way to get the working set in a job object and GetProcessMemoryInfo
- // is the way to get that. According to MSDN, we should use GetProcessMemoryInfo In order to
- // compensate for the incompatibility that psapi.dll introduced we are getting this dynamically.
- hinstPsapi = WszLoadLibrary(L"psapi.dll");
- if (!hinstPsapi)
- return 0;
- GCGetProcessMemoryInfo = (PGET_PROCESS_MEMORY_INFO)GetProcAddress(hinstPsapi, "GetProcessMemoryInfo");
-#endif
if (!GCGetProcessMemoryInfo)
goto exit;
@@ -460,11 +446,7 @@ exit:
{
job_physical_memory_limit = 0;
-#ifdef FEATURE_CORECLR
FreeLibrary(hinstKernel32);
-#else
- FreeLibrary(hinstPsapi);
-#endif
}
VolatileStore(&g_RestrictedPhysicalMemoryLimit, job_physical_memory_limit);
diff --git a/src/vm/gchost.cpp b/src/vm/gchost.cpp
index b51f2459fd..af213c27be 100644
--- a/src/vm/gchost.cpp
+++ b/src/vm/gchost.cpp
@@ -24,253 +24,5 @@
#include "field.h"
#include "gcheaputilities.h"
-#if !defined(FEATURE_CORECLR)
-inline size_t SizeInKBytes(size_t cbSize)
-{
- LIMITED_METHOD_CONTRACT;
-
- size_t cb = (cbSize % 1024) ? 1 : 0;
- return ((cbSize / 1024) + cb);
-}
-
-// IGCController
-
-HRESULT CorGCHost::_SetGCSegmentSize(SIZE_T SegmentSize)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // Sanity check the value, it must be a power of two and big enough.
- if (!GCHeapUtilities::GetGCHeap()->IsValidSegmentSize(SegmentSize))
- {
- hr = E_INVALIDARG;
- }
- else
- {
- Host_SegmentSize = SegmentSize;
- Host_fSegmentSizeSet = TRUE;
- }
-
- return (hr);
-}
-
-HRESULT CorGCHost::_SetGCMaxGen0Size(SIZE_T MaxGen0Size)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // Sanity check the value is at least large enough.
- if (!GCHeapUtilities::GetGCHeap()->IsValidGen0MaxSize(MaxGen0Size))
- {
- hr = E_INVALIDARG;
- }
- else
- {
- Host_MaxGen0Size = MaxGen0Size;
- Host_fMaxGen0SizeSet = TRUE;
- }
-
- return (hr);
-}
-
-HRESULT CorGCHost::SetGCStartupLimits(
- DWORD SegmentSize,
- DWORD MaxGen0Size)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // Set default overrides if specified by caller.
- if (SegmentSize != (DWORD) ~0 && SegmentSize > 0)
- {
- hr = _SetGCSegmentSize(SegmentSize);
- }
-
- if (SUCCEEDED(hr) && MaxGen0Size != (DWORD) ~0 && MaxGen0Size > 0)
- {
- hr = _SetGCMaxGen0Size(MaxGen0Size);
- }
-
- return (hr);
-}
-
-HRESULT CorGCHost::SetGCStartupLimitsEx(
- SIZE_T SegmentSize,
- SIZE_T MaxGen0Size)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- // Set default overrides if specified by caller.
- if (SegmentSize != (SIZE_T) ~0 && SegmentSize > 0)
- {
- hr = _SetGCSegmentSize(SegmentSize);
- }
-
- if (SUCCEEDED(hr) && MaxGen0Size != (SIZE_T) ~0 && MaxGen0Size > 0)
- {
- hr = _SetGCMaxGen0Size(MaxGen0Size);
- }
-
- return (hr);
-}
-
-// Collect the requested generation.
-HRESULT CorGCHost::Collect(
- LONG Generation)
-{
- STATIC_CONTRACT_SO_TOLERANT;
-
- HRESULT hr = E_FAIL;
-
- if (Generation > (int) GCHeapUtilities::GetGCHeap()->GetMaxGeneration())
- hr = E_INVALIDARG;
- else
- {
- // Set up a Thread object if this is called on a native thread.
- Thread *pThread;
- pThread = GetThread();
- if (pThread == NULL)
- pThread = SetupThreadNoThrow(&hr);
-
- if (pThread != NULL)
- {
- // Put thread into co-operative mode, which is how GC must run.
- GCX_COOP();
-
- BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW);
-
- EX_TRY
- {
- hr = GCHeapUtilities::GetGCHeap()->GarbageCollect(Generation);
- }
- EX_CATCH
- {
- hr = GET_EXCEPTION()->GetHR();
- }
- EX_END_CATCH(SwallowAllExceptions);
-
- END_SO_INTOLERANT_CODE;
- }
- }
- return (hr);
-}
-
-
-// Return GC counters in the gchost format.
-HRESULT CorGCHost::GetStats(
- COR_GC_STATS *pStats)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
-#if defined(ENABLE_PERF_COUNTERS)
-
- Perf_GC *pgc = &GetPerfCounters().m_GC;
-
- if (!pStats)
- return (E_INVALIDARG);
-
- if (pStats->Flags & COR_GC_COUNTS)
- {
- pStats->ExplicitGCCount = pgc->cInducedGCs;
- for (int idx=0; idx<3; idx++)
- {
- pStats->GenCollectionsTaken[idx] = pgc->cGenCollections[idx];
- }
- }
-
- if (pStats->Flags & COR_GC_MEMORYUSAGE)
- {
- pStats->CommittedKBytes = SizeInKBytes(pgc->cTotalCommittedBytes);
- pStats->ReservedKBytes = SizeInKBytes(pgc->cTotalReservedBytes);
- pStats->Gen0HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[0]);
- pStats->Gen1HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[1]);
- pStats->Gen2HeapSizeKBytes = SizeInKBytes(pgc->cGenHeapSize[2]);
- pStats->LargeObjectHeapSizeKBytes = SizeInKBytes(pgc->cLrgObjSize);
- pStats->KBytesPromotedFromGen0 = SizeInKBytes(pgc->cbPromotedMem[0]);
- pStats->KBytesPromotedFromGen1 = SizeInKBytes(pgc->cbPromotedMem[1]);
- }
- return (S_OK);
-#else
- return (E_NOTIMPL);
-#endif // ENABLE_PERF_COUNTERS
-}
-
-// Return per-thread allocation information.
-HRESULT CorGCHost::GetThreadStats(
- DWORD *pFiberCookie,
- COR_GC_THREAD_STATS *pStats)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- Thread *pThread;
-
- // Get the thread from the caller or the current thread.
- if (!pFiberCookie)
- pThread = GetThread();
- else
- pThread = (Thread *) pFiberCookie;
- if (!pThread)
- return (E_INVALIDARG);
-
- return pThread->GetMemStats (pStats);
-}
-
-// Return per-thread allocation information.
-HRESULT CorGCHost::SetVirtualMemLimit(
- SIZE_T sztMaxVirtualMemMB)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- GCHeapUtilities::GetGCHeap()->SetReservedVMLimit (sztMaxVirtualMemMB);
- return (S_OK);
-}
-#endif // !defined(FEATURE_CORECLR)
diff --git a/src/vm/hosting.cpp b/src/vm/hosting.cpp
index 4dd6a59729..a76d6af867 100644
--- a/src/vm/hosting.cpp
+++ b/src/vm/hosting.cpp
@@ -197,15 +197,6 @@ BOOL GlobalAllocStore::m_Disabled = FALSE;
#endif
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
-// The helper thread can't call regular new / delete b/c of interop-debugging deadlocks.
-// It must use the (InteropSafe) heap from debugger.h, you also can't allocate normally
-// when we have any other thread hard-suspended.
-
-// Telesto doesn't support interop-debugging, so this won't be an issue.
-
-void AssertAllocationAllowed();
-#endif
HANDLE g_ExecutableHeapHandle = NULL;
@@ -225,9 +216,6 @@ LPVOID EEVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, D
return NULL;
#endif
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- AssertAllocationAllowed();
-#endif
#ifdef _DEBUG
if (g_fEEStarted) {
@@ -570,9 +558,6 @@ LPVOID EEHeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes)
return NULL;
#endif
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- AssertAllocationAllowed();
-#endif
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
IHostMalloc *pHM = CorHost2::GetHostMalloc();
@@ -644,9 +629,6 @@ BOOL EEHeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem)
// @todo - Need a backout validation here.
CONTRACT_VIOLATION(SOToleranceViolation);
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- AssertAllocationAllowed();
-#endif
BOOL retVal = FALSE;
@@ -745,7 +727,6 @@ HANDLE EEGetProcessExecutableHeap() {
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
-#ifdef FEATURE_CORECLR
#ifndef FEATURE_PAL
@@ -780,18 +761,6 @@ HANDLE EEGetProcessExecutableHeap() {
UNREACHABLE();
#endif // !FEATURE_PAL
-#else // FEATURE_CORECLR
-
- //
- // Use process executable heap created by the shim
- //
- if (g_ExecutableHeapHandle == NULL)
- {
- extern HANDLE GetProcessExecutableHeap();
- g_ExecutableHeapHandle = GetProcessExecutableHeap();
- }
-
-#endif // FEATURE_CORECLR
// TODO: implement hosted executable heap
return g_ExecutableHeapHandle;
diff --git a/src/vm/i386/asmconstants.h b/src/vm/i386/asmconstants.h
index ce648518f9..0d5237bd5a 100644
--- a/src/vm/i386/asmconstants.h
+++ b/src/vm/i386/asmconstants.h
@@ -34,12 +34,7 @@
#endif
//***************************************************************************
-#if defined(_DEBUG) && defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- #define HAS_TRACK_CXX_EXCEPTION_CODE_HACK 1
- #define TRACK_CXX_EXCEPTION_CODE_HACK
-#else
#define HAS_TRACK_CXX_EXCEPTION_CODE_HACK 0
-#endif
#define INITIAL_SUCCESS_COUNT 0x100
diff --git a/src/vm/i386/cgencpu.h b/src/vm/i386/cgencpu.h
index 2e47a6af90..6dc53beb92 100644
--- a/src/vm/i386/cgencpu.h
+++ b/src/vm/i386/cgencpu.h
@@ -39,9 +39,6 @@ Stub * GenerateInitPInvokeFrameHelper();
EXTERN_C void STDCALL PInvokeStackImbalanceHelper(void);
#endif // MDA_SUPPORTED
-#ifndef FEATURE_CORECLR
-EXTERN_C void STDCALL CopyCtorCallStub(void);
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_STUBS_AS_IL
EXTERN_C void SinglecastDelegateInvokeStub();
diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp
index b860800943..7c93963aad 100644
--- a/src/vm/i386/excepx86.cpp
+++ b/src/vm/i386/excepx86.cpp
@@ -1095,7 +1095,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc.
}
#endif // FEATURE_CORRUPTING_EXCEPTIONS
-#ifdef FEATURE_CORECLR
// Check if we are dealing with AV or not and if we are,
// ensure that this is a real AV and not managed AV exception
BOOL fIsThrownExceptionAV = FALSE;
@@ -1124,7 +1123,6 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc.
EEPOLICY_HANDLE_FATAL_ERROR(COR_E_SECURITY);
}
}
-#endif // FEATURE_CORECLR
// If we're out of memory, then we figure there's probably not memory to maintain a stack trace, so we skip it.
// If we've got a stack overflow, then we figure the stack will be so huge as to make tracking the stack trace
diff --git a/src/vm/ilmarshalers.cpp b/src/vm/ilmarshalers.cpp
index c44e561df3..a72276ef4a 100644
--- a/src/vm/ilmarshalers.cpp
+++ b/src/vm/ilmarshalers.cpp
@@ -3305,135 +3305,6 @@ ILCriticalHandleMarshaler::ReturnOverride(
return OVERRIDDEN;
} // ILCriticalHandleMarshaler::ReturnOverride
-#ifndef FEATURE_CORECLR
-//---------------------------------------------------------------------------------------
-//
-MarshalerOverrideStatus ILBlittableValueClassWithCopyCtorMarshaler::ArgumentOverride(NDirectStubLinker* psl,
- BOOL byref,
- BOOL fin,
- BOOL fout,
- BOOL fManagedToNative,
- OverrideProcArgs* pargs,
- UINT* pResID,
- UINT argidx,
- UINT nativeStackOffset)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- ILCodeStream* pslIL = psl->GetMarshalCodeStream();
- ILCodeStream* pslILDispatch = psl->GetDispatchCodeStream();
-
- if (byref)
- {
- *pResID = IDS_EE_BADMARSHAL_COPYCTORRESTRICTION;
- return DISALLOWED;
- }
-
- if (fManagedToNative)
- {
-#ifdef _TARGET_X86_
- _ASSERTE(nativeStackOffset != (UINT)-1);
-
- // get a new copy ctor cookie
- DWORD dwCookieLocalNum = psl->CreateCopyCtorCookie(pslIL);
-
- // and initialize it with our values
- pslIL->EmitLDLOCA(dwCookieLocalNum);
- pslIL->EmitLDARG(argidx);
- pslIL->EmitLDC(nativeStackOffset);
-
- // SetData takes pointers to managed methods although code:CopyCtorCallStubWorker
- // currently calls them via reverse P/Invokes
- if (pargs->mm.m_pCopyCtor)
- {
- pslIL->EmitLDFTN(pslIL->GetToken(pargs->mm.m_pCopyCtor));
- }
- else
- {
- pslIL->EmitLoadNullPtr();
- }
-
- if (pargs->mm.m_pDtor)
- {
- pslIL->EmitLDFTN(pslIL->GetToken(pargs->mm.m_pDtor));
- }
- else
- {
- pslIL->EmitLoadNullPtr();
- }
-
- // <dwCookieLocalNum>.SetData(<argidx>, <nativeStackOffset>, ctorPtr, dtorPtr)
- pslIL->EmitCALL(METHOD__COPYCTORSTUBCOOKIE__SET_DATA, 5, 0);
-
- LocalDesc locDesc(pargs->mm.m_pMT);
- pslIL->SetStubTargetArgType(&locDesc); // native type is the value type
-
- pslILDispatch->EmitLDARG(argidx); // we load the argument directly
- pslILDispatch->EmitLDOBJ(pslILDispatch->GetToken(pargs->mm.m_pMT));
-#else // _TARGET_X86_
- // On WIN64 platforms, copy-constructed arguments are actually passed by reference.
- // This is the same calling convention as used by managed code, but to maintain parity,
- // we mimic the x86 behaviour:
- //
- // 1) create new native value type local
- // 2) run new->CopyCtor(old)
- // 3) run old->Dtor()
-
- LocalDesc locDesc(pargs->mm.m_pMT);
-
- DWORD dwNewValueTypeLocal;
-
- // Step 1
- dwNewValueTypeLocal = pslIL->NewLocal(locDesc);
-
- // Step 2
- if (pargs->mm.m_pCopyCtor)
- {
- pslIL->EmitLDLOCA(dwNewValueTypeLocal);
- pslIL->EmitLDARG(argidx);
- pslIL->EmitCALL(pslIL->GetToken(pargs->mm.m_pCopyCtor), 2, 0);
- }
- else
- {
- pslIL->EmitLDARG(argidx);
- pslIL->EmitLDOBJ(pslIL->GetToken(pargs->mm.m_pMT));
- pslIL->EmitSTLOC(dwNewValueTypeLocal);
- }
-
- // Step 3
- if (pargs->mm.m_pDtor)
- {
- pslIL->EmitLDARG(argidx);
- pslIL->EmitCALL(pslIL->GetToken(pargs->mm.m_pDtor), 1, 0);
- }
-
- pslIL->SetStubTargetArgType(ELEMENT_TYPE_I); // native type is a pointer
- pslILDispatch->EmitLDLOCA(dwNewValueTypeLocal);
-#endif // _TARGET_X86_
-
- return OVERRIDDEN;
- }
- else
- {
- // nothing to do but pass the value along
- // note that on x86 the argument comes by-value but is converted to pointer by the UM thunk
- // so that we don't make copies that would not be accounted for by copy ctors
- LocalDesc locDesc(pargs->mm.m_pMT);
- locDesc.MakeCopyConstructedPointer();
-
- pslIL->SetStubTargetArgType(&locDesc); // native type is a pointer
- pslILDispatch->EmitLDARG(argidx);
-
- return OVERRIDDEN;
- }
-}
-#endif // FEATURE_CORECLR
LocalDesc ILArgIteratorMarshaler::GetNativeType()
{
diff --git a/src/vm/ilmarshalers.h b/src/vm/ilmarshalers.h
index 5337b081c6..7c7f9a6553 100644
--- a/src/vm/ilmarshalers.h
+++ b/src/vm/ilmarshalers.h
@@ -600,7 +600,7 @@ public:
nativeSize = wNativeSize;
}
-#if defined(_TARGET_X86_) || (defined(_TARGET_AMD64_) && defined(_WIN64) && !defined(FEATURE_CORECLR))
+#if defined(_TARGET_X86_)
// JIT32 and JIT64 (which is only used on the Windows Desktop CLR) has a problem generating
// code for the pinvoke ILStubs which do a return using a struct type. Therefore, we
// change the signature of calli to return void and make the return buffer as first argument.
@@ -2716,42 +2716,6 @@ protected:
};
-#ifndef FEATURE_CORECLR
-class ILBlittableValueClassWithCopyCtorMarshaler : public ILMarshaler
-{
-public:
- enum
- {
- c_fInOnly = TRUE,
- c_nativeSize = VARIABLESIZE,
- c_CLRSize = sizeof(OBJECTREF),
- };
-
- LocalDesc GetManagedType()
- {
- LIMITED_METHOD_CONTRACT;
- return LocalDesc();
- }
-
- LocalDesc GetNativeType()
- {
- LIMITED_METHOD_CONTRACT;
- return LocalDesc();
- }
-
- static MarshalerOverrideStatus ArgumentOverride(NDirectStubLinker* psl,
- BOOL byref,
- BOOL fin,
- BOOL fout,
- BOOL fManagedToNative,
- OverrideProcArgs* pargs,
- UINT* pResID,
- UINT argidx,
- UINT nativeStackOffset);
-
-
-};
-#endif // !FEATURE_CORECLR
class ILArgIteratorMarshaler : public ILMarshaler
diff --git a/src/vm/ilstubcache.cpp b/src/vm/ilstubcache.cpp
index 9cd904aec7..ff6bdc0335 100644
--- a/src/vm/ilstubcache.cpp
+++ b/src/vm/ilstubcache.cpp
@@ -531,47 +531,6 @@ MethodDesc* ILStubCache::GetStubMethodDesc(
}
}
-#ifndef FEATURE_CORECLR
- //
- // Publish ETW events for IL stubs
- //
- if (bFireETWCacheHitEvent)
- {
- if (ETW_EVENT_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, ILStubCacheHit))
- {
-
- SString strNamespaceOrClassName, strMethodName, strMethodSignature;
- UINT64 uModuleId = 0;
-
- if (pTargetMD)
- {
- pTargetMD->GetMethodInfoWithNewSig(strNamespaceOrClassName, strMethodName, strMethodSignature);
- uModuleId = (UINT64)pTargetMD->GetModule()->GetAddrModuleID();
- }
-
- DWORD dwToken = 0;
- if (pTargetMD)
- dwToken = pTargetMD->GetMemberDef();
-
- //
- // Truncate string fields. Make sure the whole event is less than 64KB
- //
- TruncateUnicodeString(strNamespaceOrClassName, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strMethodName, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
- TruncateUnicodeString(strMethodSignature, ETW_IL_STUB_EVENT_STRING_FIELD_MAXSIZE);
-
- FireEtwILStubCacheHit(
- GetClrInstanceId(), // ClrInstanceId
- uModuleId, // ModuleIdentifier
- (UINT64)pMD, // StubMethodIdentifier
- dwToken, // ManagedInteropMethodToken
- strNamespaceOrClassName.GetUnicode(), // ManagedInteropMethodNamespace
- strMethodName.GetUnicode(), // ManagedInteropMethodName
- strMethodSignature.GetUnicode() // ManagedInteropMethodSignature
- );
- }
- }
-#endif // !FEATURE_CORECLR
if (!pMD)
{
diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp
index b367dff45f..f4dc236b80 100644
--- a/src/vm/interoputil.cpp
+++ b/src/vm/interoputil.cpp
@@ -294,7 +294,6 @@ static const BinderMethodID s_stubsDisposableToClosable[] =
METHOD__IDISPOSABLE_TO_ICLOSABLE_ADAPTER__CLOSE
};
-#ifdef FEATURE_CORECLR
DEFINE_ASM_QUAL_TYPE_NAME(NCCWINRT_ASM_QUAL_TYPE_NAME, g_INotifyCollectionChanged_WinRTName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(NCCMA_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedToManagedAdapterName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(NCCWA_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedToWinRTAdapterName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
@@ -306,20 +305,6 @@ DEFINE_ASM_QUAL_TYPE_NAME(CMDMA_ASM_QUAL_TYPE_NAME, g_ICommandToManagedAdapterNa
DEFINE_ASM_QUAL_TYPE_NAME(CMDWA_ASM_QUAL_TYPE_NAME, g_ICommandToWinRTAdapterName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(NCCEHWINRT_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventHandler_WinRT, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(PCEHWINRT_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventHandler_WinRT_Name, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#else
-DEFINE_ASM_QUAL_TYPE_NAME(NCCWINRT_ASM_QUAL_TYPE_NAME, g_INotifyCollectionChanged_WinRTName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NCCMA_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedToManagedAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NCCWA_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedToWinRTAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NPCWINRT_ASM_QUAL_TYPE_NAME, g_INotifyPropertyChanged_WinRTName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NPCMA_ASM_QUAL_TYPE_NAME, g_NotifyPropertyChangedToManagedAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NPCWA_ASM_QUAL_TYPE_NAME, g_NotifyPropertyChangedToWinRTAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(CMDWINRT_ASM_QUAL_TYPE_NAME, g_ICommand_WinRTName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(CMDMA_ASM_QUAL_TYPE_NAME, g_ICommandToManagedAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(CMDWA_ASM_QUAL_TYPE_NAME, g_ICommandToWinRTAdapterName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(NCCEHWINRT_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventHandler_WinRT, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-DEFINE_ASM_QUAL_TYPE_NAME(PCEHWINRT_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventHandler_WinRT_Name, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-
-#endif
const WinRTInterfaceRedirector::NonMscorlibRedirectedInterfaceInfo WinRTInterfaceRedirector::s_rNonMscorlibInterfaceInfos[3] =
{
@@ -6942,12 +6927,6 @@ TypeHandle GetClassFromIInspectable(IUnknown* pUnk, bool *pfSupportsIInspectable
LPCWSTR pwszClassName = winrtClassName.GetRawBuffer(&cchClassName);
SString ssClassName(SString::Literal, pwszClassName, cchClassName);
-#ifndef FEATURE_CORECLR
- if (ETW_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATE_DYNAMICTYPEUSAGE_KEYWORD))
- {
- FireEtwIInspectableRuntimeClassName(pwszClassName, GetClrInstanceId());
- }
-#endif
// Check a cache to see if this has already been looked up.
AppDomain *pDomain = GetAppDomain();
diff --git a/src/vm/invokeutil.cpp b/src/vm/invokeutil.cpp
index f53c8fe546..63979a3b21 100644
--- a/src/vm/invokeutil.cpp
+++ b/src/vm/invokeutil.cpp
@@ -1551,14 +1551,6 @@ void InvokeUtil::CanAccessClass(RefSecContext* pCtx,
InvokeUtil::CheckAccessClass(pCtx, pClass, checkAccessForImplicitValueTypeCtor);
-#ifndef FEATURE_CORECLR
- // Reflection invocation should turn critical method access into a full demand of full trust
- // for level 2 assemblies.
- if (InvokeUtil::IsCriticalWithConversionToFullDemand(pClass))
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST);
- }
-#endif //FEATURE_CORECLR
}
#ifndef DACCESS_COMPILE
@@ -1579,30 +1571,12 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth,
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- // Security checks are expensive as they involve stack walking. Avoid them if we can.
- // In immersive we don't allow private reflection to framework code. So we need to perform
- // the access check even if all the domains on the stack are fully trusted.
- if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess() && !pParentMT->GetAssembly()->IsDisabledPrivateReflection())
- return;
-#endif // FEATURE_CORECLR
InvokeUtil::CheckAccessMethod(pSCtx,
pParentMT,
pInstanceMT,
pMeth);
-#ifndef FEATURE_CORECLR
- // Reflection invocation should turn critical method access into a full demand of full trust
- // for level 2 assemblies.
- if (fCriticalToFullDemand && InvokeUtil::IsCriticalWithConversionToFullDemand(pMeth, pParentMT))
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST);
-
- // No need to do any more checks if a full trust full demand has succeeded.
- return;
- }
-#endif //FEATURE_CORECLR
if (pMeth->RequiresLinktimeCheck())
{
@@ -1648,7 +1622,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth,
GCPROTECT_END();
-#ifdef FEATURE_CORECLR
if (pMeth->IsNDirect() ||
(pMeth->IsComPlusCall() && !pMeth->IsInterface()))
{
@@ -1664,27 +1637,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth,
}
}
-#else // FEATURE_CORECLR
- // We perform automatic linktime checks for UnmanagedCode in three cases:
- // o P/Invoke calls.
- // o Calls through an interface that have a suppress runtime check
- // attribute on them (these are almost certainly interop calls).
- // o Interop calls made through method impls.
- if (pMeth->IsNDirect() ||
- (pMeth->IsInterface() &&
- (pMeth->GetMDImport()->GetCustomAttributeByName(pParentMT->GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK ||
- pMeth->GetMDImport()->GetCustomAttributeByName(pMeth->GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK) ) ||
- (pMeth->IsComPlusCall() && !pMeth->IsInterface()))
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_UNMANAGED_CODE);
- }
-#endif // FEATURE_CORECLR
}
// @todo:
@@ -1712,9 +1664,6 @@ void InvokeUtil::CanAccessMethod(MethodDesc* pMeth,
}
}
-#ifndef FEATURE_CORECLR
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_SKIP_VER);
-#endif // !FEATURE_CORECLR
}
}
#endif // #ifndef DACCESS_COMPILE
@@ -1734,14 +1683,6 @@ void InvokeUtil::CanAccessField(RefSecContext* pCtx,
InvokeUtil::CheckAccessField(pCtx, pTargetMT, pInstanceMT, pTargetField);
-#ifndef FEATURE_CORECLR
- // Reflection invocation should turn critical method access into a full demand of full trust
- // for level 2 assemblies.
- if (InvokeUtil::IsCriticalWithConversionToFullDemand(pTargetField, pInstanceMT))
- {
- Security::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_FULL_TRUST);
- }
-#endif //FEATURE_CORECLR
}
//
@@ -1990,7 +1931,6 @@ AccessCheckOptions::AccessCheckType InvokeUtil::GetInvocationAccessCheckType(BOO
AppDomain * pAppDomain = GetAppDomain();
-#ifdef FEATURE_CORECLR
if (pAppDomain->GetSecurityDescriptor()->IsFullyTrusted())
// Ignore transparency so that reflection invocation is consistenct with LCG.
@@ -1999,14 +1939,6 @@ AccessCheckOptions::AccessCheckType InvokeUtil::GetInvocationAccessCheckType(BOO
return AccessCheckOptions::kMemberAccess;
-#else // !FEATURE_CORECLR
- return
- AppX::IsAppXProcess() ?
- (Security::AllDomainsOnStackFullyTrusted() ?
- AccessCheckOptions::kUserCodeOnlyRestrictedMemberAccessNoTransparency :
- AccessCheckOptions::kUserCodeOnlyRestrictedMemberAccess) :
- AccessCheckOptions::kRestrictedMemberAccess;
-#endif //FEATURE_CORECLR
}
#endif // CROSSGEN_COMPILE
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index c96b68ba63..6d4fd897c4 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -63,9 +63,7 @@
#include "gccover.h"
#endif // HAVE_GCCOVER
-#ifdef FEATURE_CORECLR
#include "runtimehandles.h"
-#endif
//========================================================================
//
@@ -5830,13 +5828,11 @@ HCIMPL2(void, JIT_DelegateSecurityCheck, CORINFO_CLASS_HANDLE delegateHnd, CORIN
{
FCALL_CONTRACT;
-#ifdef FEATURE_CORECLR
// If we're in full trust, then we don't enforce the delegate binding rules
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
{
return;
}
-#endif // FEATURE_CORECLR
// Tailcall to the real implementation
ENDFORBIDGC();
@@ -6107,16 +6103,9 @@ NOINLINE HCIMPL1(void, JIT_VerificationRuntimeCheck_Internal, CORINFO_METHOD_HAN
HELPER_METHOD_FRAME_BEGIN_NOPOLL();
{
-#ifdef FEATURE_CORECLR
// Transparent methods that contains unverifiable code is not allowed.
MethodDesc *pMethod = GetMethod(methHnd_);
SecurityTransparent::ThrowMethodAccessException(pMethod);
-#else // FEATURE_CORECLR
- //
- // inject a full-demand for unmanaged code permission at runtime
- // around methods in transparent assembly that contains unverifiable code
- Security::SpecialDemand(SSWT_DECLARATIVE_DEMAND, SECURITY_UNMANAGED_CODE);
-#endif // FEATURE_CORECLR
}
HELPER_METHOD_FRAME_END_POLL();
}
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index f710dcf3eb..8ea9016179 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -160,11 +160,9 @@ BOOL ModifyCheckForDynamicMethod(DynamicResolver *pResolver,
{
*pAccessCheckType = AccessCheckOptions::kRestrictedMemberAccess;
-#ifdef FEATURE_CORECLR
// For compatibility, don't do transparency checks from dynamic methods in FT CoreCLR.
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
*pAccessCheckType = AccessCheckOptions::kRestrictedMemberAccessNoTransparency;
-#endif // FEATURE_CORECLR
#ifdef FEATURE_COMPRESSEDSTACK
if (dwSecurityFlags & DynamicResolver::HasCreationContext)
@@ -173,11 +171,9 @@ BOOL ModifyCheckForDynamicMethod(DynamicResolver *pResolver,
}
else
{
-#ifdef FEATURE_CORECLR
// For compatibility, don't do transparency checks from dynamic methods in FT CoreCLR.
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
*pAccessCheckType = AccessCheckOptions::kNormalAccessNoTransparency;
-#endif // FEATURE_CORECLR
}
return doAccessCheck;
@@ -537,14 +533,12 @@ CEEInfo::ConvToJitSig(
IfFailThrow(sig.GetCallingConvInfo(&data));
sigRet->callConv = (CorInfoCallConv) data;
-#if defined(FEATURE_CORECLR)
if ((isCallConv(sigRet->callConv, IMAGE_CEE_CS_CALLCONV_VARARG)) ||
(isCallConv(sigRet->callConv, IMAGE_CEE_CS_CALLCONV_NATIVEVARARG)))
{
// This signature corresponds to a method that uses varargs, which are not supported.
COMPlusThrow(kInvalidProgramException, IDS_EE_VARARG_NOT_SUPPORTED);
}
-#endif // FEATURE_CORECLR
// Skip number of type arguments
if (sigRet->callConv & IMAGE_CEE_CS_CALLCONV_GENERIC)
@@ -5588,11 +5582,9 @@ void CEEInfo::getCallInfo(
//This just throws.
if (pCalleeForSecurity->RequiresLinktimeCheck())
{
-#ifdef FEATURE_CORECLR
//hostProtectionAttribute(HPA) can be removed for coreclr mscorlib.dll
//So if the call to LinktimeCheckMethod() is only b'coz of HPA then skip it
if (!pCalleeForSecurity->RequiresLinkTimeCheckHostProtectionOnly())
-#endif
Security::LinktimeCheckMethod(pCallerForSecurity->GetAssembly(), pCalleeForSecurity);
}
@@ -5630,11 +5622,7 @@ void CEEInfo::getCallInfo(
pCalleeForSecurity,
NULL,
accessCheckOptions,
-#ifdef FEATURE_CORECLR
FALSE,
-#else
- TRUE,
-#endif //FEATURE_CORECLR
TRUE
);
@@ -5691,7 +5679,6 @@ void CEEInfo::getCallInfo(
{
BOOL fNeedsTransparencyCheck = TRUE;
-#ifdef FEATURE_CORECLR
// All LCG methods are transparent in CoreCLR. When we switch from PT
// to FT most user assemblies will become opportunistically critical.
// If a LCG method calls a method in such an assembly it will stop working.
@@ -5704,7 +5691,6 @@ void CEEInfo::getCallInfo(
// See also AccessCheckOptions::DemandMemberAccess.
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted() && pCallerForSecurity->IsLCGMethod())
fNeedsTransparencyCheck = FALSE;
-#endif // FEATURE_CORECLR
if (fNeedsTransparencyCheck)
{
@@ -5818,9 +5804,7 @@ BOOL CEEInfo::canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
doCheck = ModifyCheckForDynamicMethod(GetMethod(hCaller)->AsDynamicMethodDesc()->GetResolver(),
&accessingType, &accessCheckOptions, &pIgnored);
if (accessCheckOptions == AccessCheckOptions::kRestrictedMemberAccess
-#ifdef FEATURE_CORECLR
|| accessCheckOptions == AccessCheckOptions::kRestrictedMemberAccessNoTransparency
-#endif //FEATURE_CORECLR
)
doCheck = FALSE;
}
@@ -9784,11 +9768,7 @@ void CEEInfo::getEEInfo(CORINFO_EE_INFO *pEEInfoOut)
pEEInfoOut->osPageSize = OS_PAGE_SIZE;
pEEInfoOut->maxUncheckedOffsetForNullObject = MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT;
-#if defined(FEATURE_CORECLR)
pEEInfoOut->targetAbi = CORINFO_CORECLR_ABI;
-#else
- pEEInfoOut->targetAbi = CORINFO_DESKTOP_ABI;
-#endif
OSVERSIONINFO sVerInfo;
sVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -11803,10 +11783,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
CorJitResult ret = CORJIT_SKIPPED; // Note that CORJIT_SKIPPED is an error exit status code
-#if !defined(FEATURE_CORECLR)
- // Ask the JIT to generate desktop-quirk-compatible code.
- jitFlags.Set(CORJIT_FLAGS::CORJIT_FLAG_DESKTOP_QUIRKS);
-#endif
comp->setJitFlags(jitFlags);
@@ -11818,14 +11794,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
BEGIN_SO_TOLERANT_CODE(GetThread());
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- ret = getJit()->compileMethod( comp,
- info,
- CORJIT_FLAGS::CORJIT_FLAG_CALL_GETJITFLAGS,
- nativeEntry,
- nativeSizeOfCode);
-
-#else // defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
#if defined(ALLOW_SXS_JIT) && !defined(CROSSGEN_COMPILE)
if (FAILED(ret) && jitMgr->m_alternateJit
@@ -11923,7 +11891,6 @@ CorJitResult invokeCompileMethodHelper(EEJitManager *jitMgr,
}
#endif // !defined(CROSSGEN_COMPILE)
-#endif // defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
#if defined(FEATURE_GDBJIT)
if (SUCCEEDED(ret) && *nativeEntry != NULL)
@@ -12130,12 +12097,10 @@ CORJIT_FLAGS GetDebuggerCompileFlags(Module* pModule, CORJIT_FLAGS flags)
{
STANDARD_VM_CONTRACT;
-#ifdef FEATURE_CORECLR
//Right now if we don't have a debug interface on CoreCLR, we can't generate debug info. So, in those
//cases don't attempt it.
if (!g_pDebugInterface)
return flags;
-#endif //FEATURE_CORECLR
#ifdef DEBUGGING_SUPPORTED
diff --git a/src/vm/jitinterface.h b/src/vm/jitinterface.h
index df9e1d764c..d6dd5d2e65 100644
--- a/src/vm/jitinterface.h
+++ b/src/vm/jitinterface.h
@@ -413,59 +413,11 @@ extern "C"
void STDCALL JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle);
};
-#ifndef FEATURE_CORECLR
-//
-// Obfluscators that are hacking into the JIT expect certain methods to exist in certain places of CEEInfo vtable. Add artifical slots
-// to the vtable to avoid breaking apps by .NET 4.5 in-place update.
-//
-
-class ICorMethodInfo_Hack
-{
-public:
- virtual const char* __stdcall ICorMethodInfo_Hack_getMethodName (CORINFO_METHOD_HANDLE ftnHnd, const char** scopeName) = 0;
-};
-
-class ICorModuleInfo_Hack
-{
-public:
- virtual void ICorModuleInfo_Hack_dummy() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
-};
-
-class ICorClassInfo_Hack
-{
-public:
- virtual void ICorClassInfo_Hack_dummy1() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy2() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy3() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy4() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy5() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy6() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy7() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy8() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy9() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy10() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy11() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy12() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy13() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
- virtual void ICorClassInfo_Hack_dummy14() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
-
- virtual mdMethodDef __stdcall ICorClassInfo_Hack_getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod) = 0;
-};
-
-class ICorStaticInfo_Hack : public virtual ICorMethodInfo_Hack, public virtual ICorModuleInfo_Hack, public virtual ICorClassInfo_Hack
-{
- virtual void ICorStaticInfo_Hack_dummy() { LIMITED_METHOD_CONTRACT; UNREACHABLE(); };
-};
-
-#endif // FEATURE_CORECLR
/*********************************************************************/
/*********************************************************************/
class CEEInfo : public ICorJitInfo
-#ifndef FEATURE_CORECLR
- , public virtual ICorStaticInfo_Hack
-#endif
{
friend class CEEDynamicCodeInfo;
diff --git a/src/vm/metasig.h b/src/vm/metasig.h
index d4443e9c47..d317b421d6 100644
--- a/src/vm/metasig.h
+++ b/src/vm/metasig.h
@@ -339,10 +339,6 @@ DEFINE_METASIG_T(SM(RefDateTimeOffset_RefDateTimeNative_RetVoid, r(g(DATE_TIME_O
DEFINE_METASIG_T(SM(RealProxy_Class_RetBool, C(REAL_PROXY) C(CLASS), F))
#endif
-#ifndef FEATURE_CORECLR
-DEFINE_METASIG_T(SM(ExecutionContext_ContextCallback_Object_Bool_RetVoid, \
- C(EXECUTIONCONTEXT) C(CONTEXTCALLBACK) j F, v))
-#endif
#if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
DEFINE_METASIG_T(SM(SecurityContext_ContextCallback_Object_RetVoid, \
C(SECURITYCONTEXT) C(CONTEXTCALLBACK) j, v))
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index 07636d6950..c38128118d 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -31,9 +31,6 @@
#include "jitinterface.h"
#include "runtimehandles.h"
#include "eventtrace.h"
-#ifndef FEATURE_CORECLR
-#include "fxretarget.h"
-#endif
#include "interoputil.h"
#include "prettyprintsig.h"
#include "formattype.h"
@@ -5227,36 +5224,6 @@ LPVOID NDirectMethodDesc::FindEntryPoint(HINSTANCE hMod) const
DWORD nbytes = (DWORD)(strlen(GetEntrypointName()) + 1);
szAnsiEntrypointName[nbytes] = '\0'; // Add an extra '\0'.
-#if !defined(FEATURE_CORECLR) && defined(_WIN64)
- //
- // Forward {Get|Set}{Window|Class}Long to their corresponding Ptr version
- //
-
- // LONG SetWindowLong( HWND hWnd, int nIndex, LONG dwNewLong);
- // LONG_PTR SetWindowLongPtr(HWND hWnd, int nIndex, LONG_PTR dwNewLong);
- //
- // LONG GetWindowLong( HWND hWnd, int nIndex);
- // LONG_PTR GetWindowLongPtr(HWND hWnd, int nIndex);
- //
- // DWORD GetClassLong( HWND hWnd, int nIndex);
- // ULONG_PTR GetClassLongPtr( HWND hWnd, int nIndex);
- //
- // DWORD SetClassLong( HWND hWnd, int nIndex, LONG dwNewLong);
- // ULONG_PTR SetClassLongPtr( HWND hWnd, int nIndex, LONG_PTR dwNewLong);
-
- if (!SString::_stricmp(GetEntrypointName(), "SetWindowLong") ||
- !SString::_stricmp(GetEntrypointName(), "GetWindowLong") ||
- !SString::_stricmp(GetEntrypointName(), "SetClassLong") ||
- !SString::_stricmp(GetEntrypointName(), "GetClassLong"))
- {
- szAnsiEntrypointName[nbytes-1] = 'P';
- szAnsiEntrypointName[nbytes+0] = 't';
- szAnsiEntrypointName[nbytes+1] = 'r';
- szAnsiEntrypointName[nbytes+2] = '\0';
- szAnsiEntrypointName[nbytes+3] = '\0';
- nbytes += 3;
- }
-#endif // !FEATURE_CORECLR && _WIN64
// If the program wants the ANSI api or if Unicode APIs are unavailable.
if (IsNativeAnsi())
@@ -5279,25 +5246,6 @@ LPVOID NDirectMethodDesc::FindEntryPoint(HINSTANCE hMod) const
if (!pFunc)
{
-#if !defined(FEATURE_CORECLR)
- if (hMod == CLRGetModuleHandle(W("kernel32.dll")))
- {
- szAnsiEntrypointName[nbytes-1] = '\0';
- if (0==strcmp(szAnsiEntrypointName, "MoveMemory") ||
- 0==strcmp(szAnsiEntrypointName, "CopyMemory"))
- {
- pFunc = GetProcAddress(hMod, funcName = "RtlMoveMemory");
- }
- else if (0==strcmp(szAnsiEntrypointName, funcName = "FillMemory"))
- {
- pFunc = GetProcAddress(hMod, funcName = "RtlFillMemory");
- }
- else if (0==strcmp(szAnsiEntrypointName, funcName = "ZeroMemory"))
- {
- pFunc = GetProcAddress(hMod, funcName = "RtlZeroMemory");
- }
- }
-#endif // !FEATURE_CORECLR
#if defined(_TARGET_X86_)
/* try mangled names only for __stdcalls */
@@ -5365,29 +5313,6 @@ void MethodDesc::ComputeSuppressUnmanagedCodeAccessAttr(IMDInternalImport *pImpo
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- // We only care about this bit for NDirect and ComPlusCall
- if (!IsNDirect() && !IsComPlusCall())
- return;
-
- BOOL hasAttr = FALSE;
- HRESULT hr = pImport->GetCustomAttributeByName(GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL);
- IfFailThrow(hr);
- hasAttr = (hr == S_OK);
-
-
- if (IsNDirect())
- ((NDirectMethodDesc*)this)->SetSuppressUnmanagedCodeAccessAttr(hasAttr);
-
-#ifdef FEATURE_COMINTEROP
- if (IsComPlusCall())
- ((ComPlusCallMethodDesc*)this)->SetSuppressUnmanagedCodeAccessAttr(hasAttr);
-#endif
-
-#endif // FEATURE_COMINTEROP
}
//*******************************************************************************
@@ -5402,7 +5327,6 @@ BOOL MethodDesc::HasNativeCallableAttribute()
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
HRESULT hr = GetMDImport()->GetCustomAttributeByName(GetMemberDef(),
g_NativeCallableAttribute,
NULL,
@@ -5411,7 +5335,6 @@ BOOL MethodDesc::HasNativeCallableAttribute()
{
return TRUE;
}
-#endif //FEATURE_CORECLR
return FALSE;
}
@@ -5421,27 +5344,7 @@ BOOL MethodDesc::HasSuppressUnmanagedCodeAccessAttr()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return TRUE;
-#else // FEATURE_CORECLR
-
- // In AppX processes, there is only one full trust AppDomain, so there is never any need to do a security
- // callout on interop stubs
- if (AppX::IsAppXProcess())
- {
- return TRUE;
- }
-
- if (IsNDirect())
- return ((NDirectMethodDesc*)this)->HasSuppressUnmanagedCodeAccessAttr();
-#ifdef FEATURE_COMINTEROP
- else if (IsComPlusCall())
- return ((ComPlusCallMethodDesc*)this)->HasSuppressUnmanagedCodeAccessAttr();
-#endif // FEATURE_COMINTEROP
- else
- return FALSE;
-
-#endif // FEATURE_CORECLR
}
#ifdef FEATURE_COMINTEROP
diff --git a/src/vm/method.hpp b/src/vm/method.hpp
index 499112d149..75ff246dc3 100644
--- a/src/vm/method.hpp
+++ b/src/vm/method.hpp
@@ -2673,22 +2673,6 @@ public:
return (ndirect.m_wFlags & kNativeNoMangle) != 0;
}
-#ifndef FEATURE_CORECLR
- BOOL HasSuppressUnmanagedCodeAccessAttr() const
- {
- LIMITED_METHOD_CONTRACT;
-
- return (ndirect.m_wFlags & kHasSuppressUnmanagedCodeAccess) != 0;
- }
-
- void SetSuppressUnmanagedCodeAccessAttr(BOOL value)
- {
- LIMITED_METHOD_CONTRACT;
-
- if (value)
- ndirect.m_wFlags |= kHasSuppressUnmanagedCodeAccess;
- }
-#endif
DWORD GetECallID() const
{
@@ -3101,32 +3085,6 @@ public:
return m_pComPlusCallInfo->m_pEventProviderMD;
}
-#ifndef FEATURE_CORECLR
-
- BOOL HasSuppressUnmanagedCodeAccessAttr()
- {
- LIMITED_METHOD_CONTRACT;
-
- if (m_pComPlusCallInfo != NULL)
- {
- return (m_pComPlusCallInfo->m_flags & ComPlusCallInfo::kHasSuppressUnmanagedCodeAccess) != 0;
- }
-
- // it is possible that somebody will call this before we initialized m_pComPlusCallInfo
- return (GetMDImport()->GetCustomAttributeByName(GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK);
- }
-
- void SetSuppressUnmanagedCodeAccessAttr(BOOL value)
- {
- LIMITED_METHOD_CONTRACT;
-
- if (value)
- FastInterlockOr(reinterpret_cast<DWORD *>(&m_pComPlusCallInfo->m_flags), ComPlusCallInfo::kHasSuppressUnmanagedCodeAccess);
- }
-#endif // FEATURE_CORECLR
BOOL RequiresArgumentWrapping()
{
diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp
index 6fee50b9b1..1c3deb5995 100644
--- a/src/vm/methodtable.cpp
+++ b/src/vm/methodtable.cpp
@@ -9785,23 +9785,7 @@ bool MethodTable::ClassRequiresUnmanagedCodeCheck()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
return false;
-#else
- // all WinRT types have an imaginary [SuppressUnmanagedCodeSecurity] attribute on them
- if (IsProjectedFromWinRT())
- return false;
-
- // In AppX processes, there is only one full trust AppDomain, so there is never any need to do a security
- // callout on interop stubs
- if (AppX::IsAppXProcess())
- return false;
-
- return GetMDImport()->GetCustomAttributeByName(GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_FALSE;
-#endif // FEATURE_CORECLR
}
#endif // !DACCESS_COMPILE
diff --git a/src/vm/methodtable.inl b/src/vm/methodtable.inl
index d91d52ca6e..cf79ffe2e0 100644
--- a/src/vm/methodtable.inl
+++ b/src/vm/methodtable.inl
@@ -373,26 +373,18 @@ inline BOOL MethodTable::HasFieldsWhichMustBeInited()
inline BOOL MethodTable::SupportsAutoNGen()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- return GetAssembly()->SupportsAutoNGen();
-#else
return FALSE;
-#endif
}
//==========================================================================================
inline BOOL MethodTable::RunCCTorAsIfNGenImageExists()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- return this->SupportsAutoNGen();
-#else
#ifdef FEATURE_CORESYSTEM
return TRUE; // On our coresystem builds we will always be using triton in the customer scenario.
#else
return FALSE;
#endif
-#endif
}
//==========================================================================================
diff --git a/src/vm/mlinfo.cpp b/src/vm/mlinfo.cpp
index 74bd536969..e5138db97f 100644
--- a/src/vm/mlinfo.cpp
+++ b/src/vm/mlinfo.cpp
@@ -52,19 +52,11 @@
DEFINE_ASM_QUAL_TYPE_NAME(URI_ASM_QUAL_TYPE_NAME, g_SystemUriClassName, g_SystemRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_FXKeyToken);
DEFINE_ASM_QUAL_TYPE_NAME(NCCEVENTARGS_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventArgsName, g_ObjectModelAsmName, VER_ASSEMBLYVERSION_STR, g_FXKeyToken);
-#ifdef FEATURE_CORECLR
DEFINE_ASM_QUAL_TYPE_NAME(NCCEVENTARGS_MARSHALER_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventArgsMarshalerName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#else
- DEFINE_ASM_QUAL_TYPE_NAME(NCCEVENTARGS_MARSHALER_ASM_QUAL_TYPE_NAME, g_NotifyCollectionChangedEventArgsMarshalerName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#endif
DEFINE_ASM_QUAL_TYPE_NAME(PCEVENTARGS_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventArgsName, g_ObjectModelAsmName, VER_ASSEMBLYVERSION_STR, g_FXKeyToken);
-#ifdef FEATURE_CORECLR
DEFINE_ASM_QUAL_TYPE_NAME(PCEVENTARGS_MARSHALER_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventArgsMarshalerName, g_SystemRuntimeWindowsRuntimeAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#else
- DEFINE_ASM_QUAL_TYPE_NAME(PCEVENTARGS_MARSHALER_ASM_QUAL_TYPE_NAME, g_PropertyChangedEventArgsMarshalerName, g_SystemAsmName, VER_ASSEMBLYVERSION_STR, g_ECMAKeyToken);
-#endif
#define OLECOLOR_TO_SYSTEMCOLOR_METH_NAME "FromOle"
@@ -1523,9 +1515,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
CorNativeType nativeType = NATIVE_TYPE_DEFAULT;
Assembly *pAssembly = pModule->GetAssembly();
-#ifndef FEATURE_CORECLR
- BOOL fNeedsCopyCtor = FALSE;
-#endif // !FEATURE_CORECLR
m_BestFit = BestFit;
m_ThrowOnUnmappableChar = ThrowOnUnmappableChar;
m_ms = ms;
@@ -1636,23 +1625,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
IfFailGoto(sig.GetElemType(NULL), lFail);
mtype = sig.PeekElemTypeNormalized(pModule, pTypeContext);
-#ifndef FEATURE_CORECLR // no copy ctor support in CoreCLR
- // Check for Copy Constructor Modifier - peek closed elem type here to prevent ELEMENT_TYPE_VALUETYPE
- // turning into a primitive.
- if (sig.PeekElemTypeClosed(pModule, pTypeContext) == ELEMENT_TYPE_VALUETYPE)
- {
- // Skip ET_BYREF
- IfFailGoto(sigtmp.GetByte(NULL), lFail);
-
- if (sigtmp.HasCustomModifier(pModule, "Microsoft.VisualC.NeedsCopyConstructorModifier", ELEMENT_TYPE_CMOD_REQD) ||
- sigtmp.HasCustomModifier(pModule, "System.Runtime.CompilerServices.IsCopyConstructed", ELEMENT_TYPE_CMOD_REQD) )
- {
- mtype = ELEMENT_TYPE_VALUETYPE;
- fNeedsCopyCtor = TRUE;
- m_byref = FALSE;
- }
- }
-#endif // !FEATURE_CORECLR
}
else
{
@@ -1695,21 +1667,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
IfFailGoto(E_FAIL, lFail);
}
-#ifndef FEATURE_CORECLR
- // Check for Copy Constructor Modifier
- if (sigtmp.HasCustomModifier(pModule, "Microsoft.VisualC.NeedsCopyConstructorModifier", ELEMENT_TYPE_CMOD_REQD) ||
- sigtmp.HasCustomModifier(pModule, "System.Runtime.CompilerServices.IsCopyConstructed", ELEMENT_TYPE_CMOD_REQD) )
- {
- mtype = mtype2;
-
- // Keep the sig pointer in sync with mtype (skip ELEMENT_TYPE_PTR) because for the rest
- // of this method we are pretending that the parameter is a value type passed by-value.
- IfFailGoto(sig.GetElemType(NULL), lFail);
-
- fNeedsCopyCtor = TRUE;
- m_byref = FALSE;
- }
-#endif // !FEATURE_CORECLR
}
}
else
@@ -2804,29 +2761,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
}
else
{
-#ifndef FEATURE_CORECLR
- if (fNeedsCopyCtor)
- {
- if (m_ms == MARSHAL_SCENARIO_WINRT)
- {
- // our WinRT-optimized GetCOMIPFromRCW helpers don't support copy
- // constructor stubs so make sure that this marshaler will not be used
- m_resID = IDS_EE_BADMARSHAL_WINRT_COPYCTOR;
- IfFailGoto(E_FAIL, lFail);
- }
-
- MethodDesc *pCopyCtor;
- MethodDesc *pDtor;
- FindCopyCtor(pModule, m_pMT, &pCopyCtor);
- FindDtor(pModule, m_pMT, &pDtor);
-
- m_args.mm.m_pMT = m_pMT;
- m_args.mm.m_pCopyCtor = pCopyCtor;
- m_args.mm.m_pDtor = pDtor;
- m_type = MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR;
- }
- else
-#endif // !FEATURE_CORECLR
#ifdef _TARGET_X86_
// JIT64 is not aware of normalized value types and this optimization
// (returning small value types by value in registers) is already done in JIT64.
@@ -2908,7 +2842,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
lExit:
#ifdef FEATURE_COMINTEROP
-#ifdef FEATURE_CORECLR
//Field scenario is not blocked here because we don't want to block loading structs that
//have the types which we are blocking, but never pass it to Interop.
@@ -2948,7 +2881,6 @@ lExit:
COMPlusThrow(kPlatformNotSupportedException, m_resID);
}
-#endif // FEATURE_CORECLR
if (IsWinRTScenario() && !IsSupportedForWinRT(m_type))
{
@@ -3559,9 +3491,6 @@ UINT16 MarshalInfo::GetNativeSize(MarshalType mtype, MarshalScenario ms)
{
case MARSHAL_TYPE_BLITTABLEVALUECLASS:
case MARSHAL_TYPE_VALUECLASS:
-#ifndef FEATURE_CORECLR
- case MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR:
-#endif // !FEATURE_CORECLR
return (UINT16) m_pMT->GetNativeSize();
default:
@@ -4213,9 +4142,6 @@ DispParamMarshaler *MarshalInfo::GenerateDispParamMarshaler()
case MARSHAL_TYPE_BLITTABLEVALUECLASS:
case MARSHAL_TYPE_BLITTABLEPTR:
case MARSHAL_TYPE_LAYOUTCLASSPTR:
-#ifndef FEATURE_CORECLR
- case MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR:
-#endif
pDispParamMarshaler = new DispParamRecordMarshaler(m_pMT);
break;
@@ -4519,11 +4445,6 @@ VOID MarshalInfo::MarshalTypeToString(SString& strMarshalType, BOOL fSizeIsSpeci
case MARSHAL_TYPE_ARGITERATOR:
strRetVal = W("ArgIterator");
break;
-#ifndef FEATURE_CORECLR
- case MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR:
- strRetVal = W("blittable value class with copy constructor");
- break;
-#endif // FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
case MARSHAL_TYPE_OBJECT:
strRetVal = W("VARIANT");
@@ -5269,7 +5190,6 @@ void ArrayMarshalInfo::InitElementInfo(CorNativeType arrayNativeType, MarshalInf
}
}
-#ifdef FEATURE_CORECLR
// Avoid throwing exceptions for any managed structs that have layouts and have types of fields that gets default to those banned types by default
// We don't know if they will be passed to native code anyway, and the right place to make the check is in the marshallers
if (AppX::IsAppXProcess() && ms != MarshalInfo::MARSHAL_SCENARIO_FIELD)
@@ -5286,7 +5206,6 @@ void ArrayMarshalInfo::InitElementInfo(CorNativeType arrayNativeType, MarshalInf
if (set_error)
COMPlusThrow(kPlatformNotSupportedException, m_resID);
}
-#endif // FEATURE_CORECLR
// If we are exporting, we need to substitute the VTHACK_* VARTYPE with the actual
// types as expressed in the type library.
diff --git a/src/vm/mlinfo.h b/src/vm/mlinfo.h
index f66c9c6bd8..d1b46065e4 100644
--- a/src/vm/mlinfo.h
+++ b/src/vm/mlinfo.h
@@ -301,14 +301,6 @@ public:
return m_pWinRTPCEventArgsToSystemPCEventArgsMD;
}
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- BOOL IsEventArgsHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return (pMD == m_pSystemNCCEventArgsToWinRTNCCEventArgsMD || pMD == m_pWinRTNCCEventArgsToSystemNCCEventArgsMD ||
- pMD == m_pSystemPCEventArgsToWinRTPCEventArgsMD || pMD == m_pWinRTPCEventArgsToSystemPCEventArgsMD);
- }
-#endif // #if defined(_DEBUG) && !defined(FEATURE_CORECLR)
private:
TypeHandle m_hndSystemNCCEventArgsType;
@@ -384,13 +376,6 @@ public:
return m_SystemUriOriginalStringGetterMD;
}
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- BOOL IsUriHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return pMD == m_SystemUriCtorMD || pMD == m_SystemUriOriginalStringGetterMD;
- }
-#endif // #if defined(_DEBUG) && !defined(FEATURE_CORECLR)
private:
TypeHandle m_hndSystemUriType;
@@ -429,13 +414,6 @@ public:
return m_SystemColorToOleColorMD;
}
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- BOOL IsOleColorHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return pMD == m_OleColorToSystemColorMD || pMD == m_SystemColorToOleColorMD;
- }
-#endif // #if defined(_DEBUG) && !defined(FEATURE_CORECLR)
private:
TypeHandle m_hndColorType;
@@ -470,25 +448,6 @@ public:
UriMarshalingInfo *GetUriMarshalingInfo();
EventArgsMarshalingInfo *GetEventArgsMarshalingInfo();
-#if defined(_DEBUG) && !defined(FEATURE_CORECLR)
- BOOL IsOleColorHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return m_pOleColorInfo != NULL && m_pOleColorInfo->IsOleColorHelperMethod(pMD);
- }
-
- BOOL IsUriHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return m_pUriInfo != NULL && m_pUriInfo->IsUriHelperMethod(pMD);
- }
-
- BOOL IsEventArgsHelperMethod(MethodDesc *pMD)
- {
- LIMITED_METHOD_CONTRACT;
- return m_pEventArgsInfo != NULL && m_pEventArgsInfo->IsEventArgsHelperMethod(pMD);
- }
-#endif // #if defined(_DEBUG) && !defined(FEATURE_CORECLR)
#endif // FEATURE_COMINTEROP
diff --git a/src/vm/mtypes.h b/src/vm/mtypes.h
index 603409b3dc..71241efa78 100644
--- a/src/vm/mtypes.h
+++ b/src/vm/mtypes.h
@@ -56,7 +56,7 @@ DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPWSTR_BUFFER, WSTRBufferMarshaler,
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_LPSTR_BUFFER, CSTRBufferMarshaler, false)
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_UTF8_BUFFER, UTF8BufferMarshaler, false)
-#if defined(FEATURE_COMINTEROP) || !defined(FEATURE_CORECLR)
+#if defined(FEATURE_COMINTEROP)
// CoreCLR doesn't have any support for marshalling interface pointers.
// Not even support for fake CCWs.
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_INTERFACE, InterfaceMarshaler, true)
@@ -89,9 +89,6 @@ DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_VALUECLASS, ValueClassMa
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_REFERENCECUSTOMMARSHALER, ReferenceCustomMarshaler, false)
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_ARGITERATOR, ArgIteratorMarshaler, false)
-#ifndef FEATURE_CORECLR
-DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_BLITTABLEVALUECLASSWITHCOPYCTOR, BlittableValueClassWithCopyCtorMarshaler, false)
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
DEFINE_MARSHALER_TYPE(MARSHAL_TYPE_OBJECT, ObjectMarshaler, false)
diff --git a/src/vm/multicorejit.cpp b/src/vm/multicorejit.cpp
index 7660fd1895..98b290ec82 100644
--- a/src/vm/multicorejit.cpp
+++ b/src/vm/multicorejit.cpp
@@ -356,12 +356,8 @@ ModuleRecord::ModuleRecord(unsigned lenName, unsigned lenAsmName)
wLoadLevel = 0;
// Extra data
lenModuleName = (unsigned short) lenName;
-#if defined(FEATURE_CORECLR)
lenAssemblyName = (unsigned short) lenAsmName;
recordID += RoundUp(lenModuleName) + RoundUp(lenAssemblyName);
-#else
- recordID += RoundUp(lenModuleName);
-#endif
}
@@ -375,7 +371,6 @@ bool RecorderModuleInfo::SetModule(Module * pMod)
unsigned lenModuleName = (unsigned) strlen(pModuleName);
simpleName.Set((const BYTE *) pModuleName, lenModuleName); // SBuffer::Set copies over name
-#if defined(FEATURE_CORECLR)
SString sAssemblyName;
StackScratchBuffer scratch;
pMod->GetAssembly()->GetManifestFile()->GetDisplayName(sAssemblyName);
@@ -383,7 +378,6 @@ bool RecorderModuleInfo::SetModule(Module * pMod)
LPCUTF8 pAssemblyName = sAssemblyName.GetUTF8(scratch);
unsigned lenAssemblyName = sAssemblyName.GetCount();
assemblyName.Set((const BYTE *) pAssemblyName, lenAssemblyName);
-#endif
#if defined(FEATURE_APPX_BINDER)
@@ -422,12 +416,8 @@ HRESULT MulticoreJitRecorder::WriteModuleRecord(IStream * pStream, const Recorde
const void * pModuleName = module.simpleName;
unsigned lenModuleName = module.simpleName.GetSize();
-#if defined(FEATURE_CORECLR)
const void * pAssemblyName = module.assemblyName;
unsigned lenAssemblyName = module.assemblyName.GetSize();
-#else
- unsigned lenAssemblyName = 0;
-#endif
ModuleRecord mod(lenModuleName, lenAssemblyName);
@@ -442,12 +432,10 @@ HRESULT MulticoreJitRecorder::WriteModuleRecord(IStream * pStream, const Recorde
{
hr = WriteString(pModuleName, lenModuleName, pStream);
-#if defined(FEATURE_CORECLR)
if (SUCCEEDED(hr))
{
hr = WriteString(pAssemblyName, lenAssemblyName, pStream);
}
-#endif
}
return hr;
@@ -719,9 +707,6 @@ HRESULT MulticoreJitModuleEnumerator::EnumerateLoadedModules(AppDomain * pDomain
while (appIt.Next(pDomainAssembly.This()) && SUCCEEDED(hr))
{
-#if !defined(FEATURE_CORECLR)
- if (! pDomainAssembly->IsSystem())
-#endif
{
hr = HandleAssembly(pDomainAssembly);
}
@@ -854,9 +839,6 @@ void MulticoreJitRecorder::PreRecordFirstMethod()
// When running under Appx or CoreCLR for K, AppDomain is normally not shut down properly (CLR in hybrid case, or Alt-F4 shutdown),
// So we only allow writing out after profileWriteTimeout seconds
-#if !defined(FEATURE_CORECLR)
- if (m_fAppxMode)
-#endif
{
// Get the timeout in seconds.
int profileWriteTimeout = (int)CLRConfig::GetConfigValue(CLRConfig::INTERNAL_MultiCoreJitProfileWriteDelay);
@@ -1061,11 +1043,7 @@ HRESULT MulticoreJitRecorder::StartProfile(const wchar_t * pRoot, const wchar_t
NewHolder<MulticoreJitProfilePlayer> player(new (nothrow) MulticoreJitProfilePlayer(
m_pDomain,
-#if defined(FEATURE_CORECLR)
m_pBinderContext,
-#else
- NULL,
-#endif
nSession,
m_fAppxMode));
@@ -1235,11 +1213,7 @@ void MulticoreJitManager::StartProfile(AppDomain * pDomain, ICLRPrivBinder *pBin
{
MulticoreJitRecorder * pRecorder = new (nothrow) MulticoreJitRecorder(
pDomain,
-#if defined(FEATURE_CORECLR)
pBinderContext,
-#else
- NULL,
-#endif
m_fAppxMode);
if (pRecorder != NULL)
@@ -1473,17 +1447,6 @@ void MulticoreJitManager::RecordModuleLoad(Module * pModule, FileLoadLevel loadL
STANDARD_VM_CONTRACT;
-#if defined(FEATURE_APPX_BINDER) && !defined(FEATURE_CORECLR)
- // When running under Appx, allow framework assembly / first party winmd to load
- // load-level change not allowed in the background thread, unless for resource DLL (loaded for exception throwing), but this could still happen.
- _ASSERTE(! GetThread()->HasThreadStateNC(Thread::TSNC_CallingManagedCodeDisabled) || ModuleHasNoCode(pModule)
- || m_fAppxMode && IsLoadOkay(pModule));
-
-#elif !defined(FEATURE_CORECLR)
-
- _ASSERTE(! GetThread()->HasThreadStateNC(Thread::TSNC_CallingManagedCodeDisabled) || ModuleHasNoCode(pModule));
-
-#endif
if (m_fRecorderActive)
{
diff --git a/src/vm/multicorejitimpl.h b/src/vm/multicorejitimpl.h
index 58a9df7827..d7152a729b 100644
--- a/src/vm/multicorejitimpl.h
+++ b/src/vm/multicorejitimpl.h
@@ -179,9 +179,7 @@ public:
unsigned short flags;
unsigned short wLoadLevel;
unsigned short lenModuleName;
-#if defined(FEATURE_CORECLR)
unsigned short lenAssemblyName;
-#endif
ModuleRecord(unsigned lenName = 0, unsigned lenAssemblyName = 0);
@@ -201,7 +199,6 @@ public:
return (const char *) (this + 1); // after this record
}
-#if defined(FEATURE_CORECLR)
unsigned AssemblyNameLen() const
{
LIMITED_METHOD_CONTRACT;
@@ -213,7 +210,6 @@ public:
{
return GetModuleName() + RoundUp(lenModuleName); // after the module name
}
-#endif
void SetLoadLevel(FileLoadLevel loadLevel)
{
@@ -250,9 +246,7 @@ friend class MulticoreJitRecorder;
private:
ADID m_DomainID;
-#if defined(FEATURE_CORECLR)
ICLRPrivBinder * m_pBinderContext;
-#endif
LONG m_nMySession;
unsigned m_nStartTime;
BYTE * m_pFileBuffer;
@@ -300,9 +294,7 @@ private:
HRESULT ReadCheckFile(const wchar_t * pFileName);
-#if defined(FEATURE_CORECLR)
DomainAssembly * LoadAssembly(SString & assemblyName);
-#endif
public:
@@ -344,9 +336,7 @@ class MulticoreJitRecorder
{
private:
AppDomain * m_pDomain; // AutoStartProfile could be called from SystemDomain
-#if defined(FEATURE_CORECLR)
ICLRPrivBinder * m_pBinderContext;
-#endif
SString m_fullFileName;
MulticoreJitPlayerStat & m_stats;
@@ -393,9 +383,7 @@ public:
LIMITED_METHOD_CONTRACT;
m_pDomain = pDomain;
-#if defined(FEATURE_CORECLR)
m_pBinderContext = pBinderContext;
-#endif
m_JitInfoCount = 0;
m_ModuleCount = 0;
m_ModuleDepCount = 0;
diff --git a/src/vm/multicorejitplayer.cpp b/src/vm/multicorejitplayer.cpp
index 7d13bbc462..adf7a381f4 100644
--- a/src/vm/multicorejitplayer.cpp
+++ b/src/vm/multicorejitplayer.cpp
@@ -373,9 +373,7 @@ MulticoreJitProfilePlayer::MulticoreJitProfilePlayer(AppDomain * pDomain, ICLRPr
LIMITED_METHOD_CONTRACT;
m_DomainID = pDomain->GetId();
-#if defined(FEATURE_CORECLR)
m_pBinderContext = pBinderContext;
-#endif
m_nMySession = nSession;
m_moduleCount = 0;
m_headerModuleCount = 0;
@@ -464,12 +462,10 @@ bool MulticoreJitManager::IsSupportedModule(Module * pModule, bool fMethodJit, b
return false;
}
-#if defined(FEATURE_CORECLR)
if (pFile->GetPath().IsEmpty()) // Ignore in-memory modules
{
return false;
}
-#endif
if (! fMethodJit)
@@ -550,10 +546,8 @@ bool MulticoreJitProfilePlayer::CompileMethodDesc(Module * pModule, MethodDesc *
m_stats.m_nTryCompiling ++;
-#if defined(FEATURE_CORECLR)
// Reset the flag to allow managed code to be called in multicore JIT background thread from this routine
ThreadStateNCStackHolder holder(-1, Thread::TSNC_CallingManagedCodeDisabled);
-#endif
// MakeJitWorker calls back to MulticoreJitCodeStorage::StoreMethodCode under MethodDesc lock
pMD->MakeJitWorker(& header, CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND));
@@ -886,7 +880,6 @@ bool MulticoreJitProfilePlayer::HandleModuleDependency(unsigned jitInfo)
PlayerModuleInfo & mod = m_pModules[moduleTo];
-#if defined(FEATURE_CORECLR)
// Load the module if necessary.
if (!mod.m_pModule)
{
@@ -927,7 +920,6 @@ bool MulticoreJitProfilePlayer::HandleModuleDependency(unsigned jitInfo)
}
}
}
-#endif
if (mod.UpdateNeedLevel((FileLoadLevel) level))
{
@@ -941,7 +933,6 @@ bool MulticoreJitProfilePlayer::HandleModuleDependency(unsigned jitInfo)
return true;
}
-#if defined(FEATURE_CORECLR)
DomainAssembly * MulticoreJitProfilePlayer::LoadAssembly(SString & assemblyName)
{
STANDARD_VM_CONTRACT;
@@ -992,7 +983,6 @@ DomainAssembly * MulticoreJitProfilePlayer::LoadAssembly(SString & assemblyName)
return pDomainAssembly;
}
-#endif
inline bool MethodJifInfo(unsigned inst)
@@ -1052,17 +1042,6 @@ HRESULT MulticoreJitProfilePlayer::HandleMethodRecord(unsigned * buffer, int cou
}
else
{
-#if !defined(FEATURE_CORECLR)
- if (m_nBlockingCount != 0)
- {
- if (! GroupWaitForModuleLoad(m_stats.m_nTotalMethod + pos)) // wait for blocking modules
- {
- goto Abort;
- }
-
- _ASSERTE(m_nBlockingCount == 0);
- }
-#endif
// To reduce contention with foreground thread, walk backward within the group of methods Jittable methods, not broken apart by dependency
{
@@ -1093,11 +1072,7 @@ HRESULT MulticoreJitProfilePlayer::HandleMethodRecord(unsigned * buffer, int cou
PlayerModuleInfo & mod = m_pModules[inst >> 24];
-#if defined(FEATURE_CORECLR)
_ASSERTE(mod.IsModuleLoaded());
-#else
- _ASSERTE(mod.IsModuleLoaded() && ! mod.IsLowerLevel());
-#endif
if (mod.m_enableJit)
{
@@ -1313,9 +1288,7 @@ HRESULT MulticoreJitProfilePlayer::PlayProfile()
const ModuleRecord * pRec = (const ModuleRecord * ) pBuffer;
if (((unsigned)(pRec->lenModuleName
-#if defined(FEATURE_CORECLR)
+ pRec->lenAssemblyName
-#endif
) > (rcdLen - sizeof(ModuleRecord))) ||
(m_moduleCount >= m_headerModuleCount))
{
diff --git a/src/vm/nativeoverlapped.cpp b/src/vm/nativeoverlapped.cpp
index d0afbb648a..1f622275c6 100644
--- a/src/vm/nativeoverlapped.cpp
+++ b/src/vm/nativeoverlapped.cpp
@@ -61,13 +61,6 @@ FCIMPL3(void, CheckVMForIOPacket, LPOVERLAPPED* lpOverlapped, DWORD* errorCode,
// no user delegate to callback
_ASSERTE((overlapped->m_iocbHelper == NULL) || !"This is benign, but should be optimized");
-#ifndef FEATURE_CORECLR
- if (g_pAsyncFileStream_AsyncResultClass)
- {
- SetAsyncResultProperties(overlapped, *errorCode, *numBytes);
- }
- else
-#endif // !FEATURE_CORECLR
{
//We're not initialized yet, go back to the Vm, and process the packet there.
ThreadpoolMgr::StoreOverlappedInfoInThread(pThread, *errorCode, *numBytes, key, *lpOverlapped);
diff --git a/src/vm/ngenoptout.cpp b/src/vm/ngenoptout.cpp
index b192c4a5f0..50b47782a9 100644
--- a/src/vm/ngenoptout.cpp
+++ b/src/vm/ngenoptout.cpp
@@ -10,28 +10,3 @@
#include "common.h"
-#ifndef FEATURE_CORECLR
-#include "ngenoptout.h"
-#include "assemblynamelist.h"
-
-AssemblyNameList g_NgenOptoutList;
-
-BOOL IsNativeImageOptedOut(IAssemblyName* pName)
-{
- WRAPPER_NO_CONTRACT
- return g_NgenOptoutList.Lookup(pName) != NULL;
-}
-
-void AddNativeImageOptOut(IAssemblyName* pName)
-{
- WRAPPER_NO_CONTRACT
- pName->AddRef();
- g_NgenOptoutList.Add(pName);
-}
-// HRESULT
-HRESULT RuntimeIsNativeImageOptedOut(IAssemblyName* pName)
-{
- WRAPPER_NO_CONTRACT
- return IsNativeImageOptedOut(pName) ? S_OK :S_FALSE;
-}
-#endif // FEATURE_CORECLR
diff --git a/src/vm/object.cpp b/src/vm/object.cpp
index b219eb9e50..ba5610d377 100644
--- a/src/vm/object.cpp
+++ b/src/vm/object.cpp
@@ -1393,9 +1393,6 @@ void Object::ValidateHeap(Object *from, BOOL bDeep)
#ifdef FEATURE_REMOTING
this == OBJECTREFToObject(((ThreadBaseObject *)from)->m_ExposedContext) ||
#endif
-#ifndef FEATURE_CORECLR
- this == OBJECTREFToObject(((ThreadBaseObject *)from)->m_ExecutionContext) ||
-#endif
false))
{
if (((ThreadBaseObject *)from)->m_InternalThread)
diff --git a/src/vm/object.h b/src/vm/object.h
index f45cdbd9dd..f6a8f9b1ab 100644
--- a/src/vm/object.h
+++ b/src/vm/object.h
@@ -1731,79 +1731,6 @@ typedef LogicalCallContextObject* LOGICALCALLCONTEXTREF;
#endif // FEATURE_REMOTING
-#ifndef FEATURE_CORECLR
-class ExecutionContextObject : public Object
-{
- friend class MscorlibBinder;
-
- // These fields are also defined in the managed representation. (ExecutionContext.cs) If you
- // add or change these fields you must also change the managed code so that
- // it matches these. This is necessary so that the object is the proper
- // size.
-private :
-#ifdef FEATURE_CAS_POLICY
- OBJECTREF _hostExecutionContext;
-#endif // FEATURE_CAS_POLICY
- OBJECTREF _syncContext;
- OBJECTREF _syncContextNoFlow;
-#if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
- SECURITYCONTEXTREF _securityContext;
-#endif // #if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
-#ifdef FEATURE_REMOTING
- LOGICALCALLCONTEXTREF _logicalCallContext;
- OBJECTREF _illogicalCallContext;
-#endif // #ifdef FEATURE_REMOTING
- INT32 _flags;
- OBJECTREF _localValues;
- OBJECTREF _localChangeNotifications;
-
-public:
- OBJECTREF GetSynchronizationContext()
- {
- LIMITED_METHOD_CONTRACT;
- return _syncContext;
- }
-#if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
- SECURITYCONTEXTREF GetSecurityContext()
- {
- LIMITED_METHOD_CONTRACT;
- return _securityContext;
- }
-#endif // #if defined(FEATURE_IMPERSONATION) || defined(FEATURE_COMPRESSEDSTACK)
-#ifdef FEATURE_REMOTING
- LOGICALCALLCONTEXTREF GetLogicalCallContext()
- {
- LIMITED_METHOD_CONTRACT;
- return _logicalCallContext;
- }
- void SetLogicalCallContext(LOGICALCALLCONTEXTREF ref)
- {
- WRAPPER_NO_CONTRACT;
- SetObjectReferenceUnchecked((OBJECTREF*)&_logicalCallContext, (OBJECTREF)ref);
- }
- OBJECTREF GetIllogicalCallContext()
- {
- LIMITED_METHOD_CONTRACT;
- return _illogicalCallContext;
- }
- void SetIllogicalCallContext(OBJECTREF ref)
- {
- WRAPPER_NO_CONTRACT;
- SetObjectReferenceUnchecked((OBJECTREF*)&_illogicalCallContext, ref);
- }
-#endif //#ifdef FEATURE_REMOTING
-#ifdef FEATURE_COMPRESSEDSTACK
- COMPRESSEDSTACKREF GetCompressedStack()
- {
- WRAPPER_NO_CONTRACT;
- if (_securityContext != NULL)
- return _securityContext->GetCompressedStack();
- return NULL;
- }
-#endif // #ifdef FEATURE_COMPRESSEDSTACK
-
-};
-#endif //FEATURE_CORECLR
@@ -1821,9 +1748,6 @@ typedef REF<ArrayBase> ARRAYBASEREF;
#ifdef FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
typedef SynchronizationContextObject* SYNCHRONIZATIONCONTEXTREF;
#endif // FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
-#ifndef FEATURE_CORECLR
-typedef ExecutionContextObject* EXECUTIONCONTEXTREF;
-#endif
typedef CultureInfoBaseObject* CULTUREINFOBASEREF;
typedef PTR_ArrayBase ARRAYBASEREF;
#endif
@@ -1849,9 +1773,6 @@ class CultureInfoBaseObject : public Object
private:
OBJECTREF compareInfo;
OBJECTREF textInfo;
-#ifndef FEATURE_CORECLR
- OBJECTREF regionInfo;
-#endif // !FEATURE_CORECLR
OBJECTREF numInfo;
OBJECTREF dateTimeInfo;
OBJECTREF calendar;
@@ -2064,12 +1985,8 @@ private:
#ifdef FEATURE_REMOTING
OBJECTREF m_ExposedContext;
#endif
-#ifdef FEATURE_CORECLR
OBJECTREF m_ExecutionContext;
OBJECTREF m_SynchronizationContext;
-#else
- EXECUTIONCONTEXTREF m_ExecutionContext;
-#endif
OBJECTREF m_Name;
OBJECTREF m_Delegate;
#ifdef FEATURE_LEAK_CULTURE_INFO
@@ -2193,37 +2110,13 @@ public:
#endif // FEATURE_LEAK_CULTURE_INFO
#ifdef FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
-#ifdef FEATURE_CORECLR
OBJECTREF GetSynchronizationContext()
{
LIMITED_METHOD_CONTRACT;
return m_SynchronizationContext;
}
-#else // !FEATURE_CORECLR
- OBJECTREF GetSynchronizationContext()
- {
- LIMITED_METHOD_CONTRACT;
- if (m_ExecutionContext != NULL)
- {
- return m_ExecutionContext->GetSynchronizationContext();
- }
- return NULL;
- }
-#endif // FEATURE_CORECLR
#endif // FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
-#ifndef FEATURE_CORECLR
- OBJECTREF GetExecutionContext()
- {
- LIMITED_METHOD_CONTRACT;
- return (OBJECTREF)m_ExecutionContext;
- }
- void SetExecutionContext(OBJECTREF ref)
- {
- LIMITED_METHOD_CONTRACT;
- SetObjectReferenceUnchecked((OBJECTREF*)&m_ExecutionContext, ref);
- }
-#endif //!FEATURE_CORECLR
#ifdef FEATURE_COMPRESSEDSTACK
COMPRESSEDSTACKREF GetCompressedStack()
{
@@ -2497,46 +2390,6 @@ class AppDomainBaseObject : public MarshalByRefObjectBaseObject
#endif // FEATURE_EXCEPTION_NOTIFICATIONS
};
-#ifndef FEATURE_CORECLR
-// The managed definition of AppDomainSortingSetupInfo is in BCL\System\Globalization\AppDomainSortingSetupInfo.cs
-class AppDomainSortingSetupInfoObject : public Object
-{
- friend class MscorlibBinder;
-
- protected:
- INT_PTR m_pfnIsNLSDefinedString;
- INT_PTR m_pfnCompareStringEx;
- INT_PTR m_pfnLCMapStringEx;
- INT_PTR m_pfnFindNLSStringEx;
- INT_PTR m_pfnCompareStringOrdinal;
- INT_PTR m_pfnGetNLSVersionEx;
- INT_PTR m_pfnFindStringOrdinal;
- CLR_BOOL m_useV2LegacySorting;
- CLR_BOOL m_useV4LegacySorting;
-
- protected:
- AppDomainSortingSetupInfoObject() { LIMITED_METHOD_CONTRACT; }
- ~AppDomainSortingSetupInfoObject() { LIMITED_METHOD_CONTRACT; }
-
- public:
- CLR_BOOL UseV2LegacySorting() { LIMITED_METHOD_CONTRACT; return m_useV2LegacySorting; }
- CLR_BOOL UseV4LegacySorting() { LIMITED_METHOD_CONTRACT; return m_useV4LegacySorting; }
-
- INT_PTR GetPFNIsNLSDefinedString() { LIMITED_METHOD_CONTRACT; return m_pfnIsNLSDefinedString; }
- INT_PTR GetPFNCompareStringEx() { LIMITED_METHOD_CONTRACT; return m_pfnCompareStringEx; }
- INT_PTR GetPFNLCMapStringEx() { LIMITED_METHOD_CONTRACT; return m_pfnLCMapStringEx; }
- INT_PTR GetPFNFindNLSStringEx() { LIMITED_METHOD_CONTRACT; return m_pfnFindNLSStringEx; }
- INT_PTR GetPFNCompareStringOrdinal() { LIMITED_METHOD_CONTRACT; return m_pfnCompareStringOrdinal; }
- INT_PTR GetPFNGetNLSVersionEx() { LIMITED_METHOD_CONTRACT; return m_pfnGetNLSVersionEx; }
- INT_PTR GetPFNFindStringOrdinal() { LIMITED_METHOD_CONTRACT; return m_pfnFindStringOrdinal; }
-};
-typedef DPTR(AppDomainSortingSetupInfoObject) PTR_AppDomainSortingSetupInfoObject;
-#ifdef USE_CHECKED_OBJECTREFS
-typedef REF<AppDomainSortingSetupInfoObject> APPDOMAINSORTINGSETUPINFOREF;
-#else
-typedef AppDomainSortingSetupInfoObject* APPDOMAINSORTINGSETUPINFOREF;
-#endif // USE_CHECKED_OBJECTREFS
-#endif // FEATURE_CORECLR
// The managed definition of AppDomainSetup is in BCL\System\AppDomainSetup.cs
class AppDomainSetupObject : public Object
@@ -2557,9 +2410,6 @@ class AppDomainSetupObject : public Object
STRINGREF m_AppDomainManagerType;
OBJECTREF m_CompatFlags;
STRINGREF m_TargetFrameworkName;
-#ifndef FEATURE_CORECLR
- APPDOMAINSORTINGSETUPINFOREF m_AppDomainSortingSetupInfo;
-#endif // FEATURE_CORECLR
INT32 m_LoaderOptimization;
#ifdef FEATURE_COMINTEROP
CLR_BOOL m_DisableInterfaceCache;
@@ -2575,9 +2425,6 @@ class AppDomainSetupObject : public Object
~AppDomainSetupObject() { LIMITED_METHOD_CONTRACT; }
public:
-#ifndef FEATURE_CORECLR
- APPDOMAINSORTINGSETUPINFOREF GetAppDomainSortingSetupInfo() { LIMITED_METHOD_CONTRACT; return m_AppDomainSortingSetupInfo; }
-#endif // FEATURE_CORECLR
#ifdef FEATURE_RANDOMIZED_STRING_HASHING
BOOL UseRandomizedStringHashing() { LIMITED_METHOD_CONTRACT; return (BOOL) m_UseRandomizedStringHashing; }
#endif // FEATURE_RANDOMIZED_STRING_HASHING
diff --git a/src/vm/olevariant.cpp b/src/vm/olevariant.cpp
index 75483fd5fe..a15a1979e2 100644
--- a/src/vm/olevariant.cpp
+++ b/src/vm/olevariant.cpp
@@ -2729,12 +2729,10 @@ void OleVariant::MarshalOleVariantForObject(OBJECTREF * const & pObj, VARIANT *p
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
COMPlusThrow(kPlatformNotSupportedException, IDS_EE_BADMARSHAL_TYPE_VARIANTASOBJECT);
}
-#endif // FEATURE_CORECLR
SafeVariantClear(pOle);
@@ -2859,12 +2857,10 @@ void OleVariant::MarshalOleRefVariantForObject(OBJECTREF *pObj, VARIANT *pOle)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
COMPlusThrow(kPlatformNotSupportedException, IDS_EE_BADMARSHAL_TYPE_VARIANTASOBJECT);
}
-#endif // FEATURE_CORECLR
HRESULT hr = MarshalCommonOleRefVariantForObject(pObj, pOle);
@@ -3084,12 +3080,10 @@ void OleVariant::MarshalObjectForOleVariant(const VARIANT * pOle, OBJECTREF * co
}
CONTRACT_END;
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
COMPlusThrow(kPlatformNotSupportedException, IDS_EE_BADMARSHAL_TYPE_VARIANTASOBJECT);
}
-#endif // FEATURE_CORECLR
#ifdef MDA_SUPPORTED
MdaInvalidVariant* pProbe = MDA_GET_ASSISTANT(InvalidVariant);
diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp
index 86785e2417..4cc8859f98 100644
--- a/src/vm/pefile.cpp
+++ b/src/vm/pefile.cpp
@@ -83,10 +83,6 @@ PEFile::PEFile(PEImage *identity, BOOL fCheckAuthenticodeSignature/*=TRUE*/) :
m_pMDImport(NULL),
m_pImporter(NULL),
m_pEmitter(NULL),
-#ifndef FEATURE_CORECLR
- m_pAssemblyImporter(NULL),
- m_pAssemblyEmitter(NULL),
-#endif
m_pMetadataLock(::new SimpleRWLock(PREEMPTIVE, LOCK_TYPE_DEFAULT)),
m_refCount(1),
m_hash(NULL),
@@ -945,42 +941,6 @@ CHECK PEFile::CheckLoaded(BOOL bAllowNativeSkip/*=TRUE*/)
CHECK_OK;
}
-#ifndef FEATURE_CORECLR
-// ------------------------------------------------------------
-// Hash support
-// ------------------------------------------------------------
-
-#ifndef SHA1_HASH_SIZE
-#define SHA1_HASH_SIZE 20
-#endif
-
-void PEFile::GetSHA1Hash(SBuffer &result)
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- PRECONDITION(CheckValue(result));
- THROWS;
- MODE_ANY;
- GC_TRIGGERS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- // Cache the SHA1 hash in a buffer
- if (m_hash == NULL)
- {
- // We shouldn't have to compute a SHA1 hash in any scenarios
- // where the image opening should be suppressed.
- EnsureImageOpened();
-
- m_hash = new InlineSBuffer<SHA1_HASH_SIZE>();
- GetILimage()->ComputeHash(CALG_SHA1, *m_hash);
- }
-
- result.Set(*m_hash);
-}
-#endif // FEATURE_CORECLR
// ------------------------------------------------------------
// Metadata access
@@ -1242,9 +1202,7 @@ void PEFile::OpenMDImport_Unsafe()
return;
#ifdef FEATURE_PREJIT
if (m_nativeImage != NULL
-#ifdef FEATURE_CORECLR
&& m_nativeImage->GetMDImport() != NULL
-#endif
)
{
// Use native image for metadata
@@ -1297,58 +1255,6 @@ void PEFile::OpenEmitter()
pIMDEmit->Release();
}
-#ifndef FEATURE_CORECLR
-void PEFile::OpenAssemblyImporter()
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- // Make sure internal MD is in RW format.
- ConvertMDInternalToReadWrite();
-
- // Get the interface
- IMetaDataAssemblyImport *pIMDAImport = NULL;
- IfFailThrow(GetMetaDataPublicInterfaceFromInternal((void*)GetPersistentMDImport(),
- IID_IMetaDataAssemblyImport,
- (void **)&pIMDAImport));
-
- // Atomically swap it into the field (release it if we lose the race)
- if (FastInterlockCompareExchangePointer(&m_pAssemblyImporter, pIMDAImport, NULL) != NULL)
- pIMDAImport->Release();
-}
-
-void PEFile::OpenAssemblyEmitter()
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- THROWS;
- GC_NOTRIGGER;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- // Make sure internal MD is in RW format.
- ConvertMDInternalToReadWrite();
-
- IMetaDataAssemblyEmit *pIMDAssemblyEmit = NULL;
- IfFailThrow(GetMetaDataPublicInterfaceFromInternal((void*)GetPersistentMDImport(),
- IID_IMetaDataAssemblyEmit,
- (void **)&pIMDAssemblyEmit));
-
- // Atomically swap it into the field (release it if we lose the race)
- if (FastInterlockCompareExchangePointer(&m_pAssemblyEmitter, pIMDAssemblyEmit, NULL) != NULL)
- pIMDAssemblyEmit->Release();
-}
-#endif // FEATURE_CORECLR
void PEFile::ReleaseMetadataInterfaces(BOOL bDestructor, BOOL bKeepNativeData/*=FALSE*/)
{
@@ -1362,18 +1268,6 @@ void PEFile::ReleaseMetadataInterfaces(BOOL bDestructor, BOOL bKeepNativeData/*=
}
CONTRACTL_END;
_ASSERTE(bDestructor || !m_bHasPersistentMDImport);
-#ifndef FEATURE_CORECLR
- if (m_pAssemblyImporter != NULL)
- {
- m_pAssemblyImporter->Release();
- m_pAssemblyImporter = NULL;
- }
- if(m_pAssemblyEmitter)
- {
- m_pAssemblyEmitter->Release();
- m_pAssemblyEmitter=NULL;
- }
-#endif
if (m_pImporter != NULL)
{
@@ -1440,10 +1334,6 @@ void PEFile::CheckAuthenticodeSignature()
// Failing to find a signature is OK.
LPWSTR pFileName = (LPWSTR) GetPath().GetUnicode();
DWORD dwAuthFlags = COR_NOUI|COR_NOPOLICY;
-#ifndef FEATURE_CORECLR
- // Authenticode Verification Start
- FireEtwAuthenticodeVerificationStart_V1(dwAuthFlags, 0, pFileName, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
HRESULT hr = ::GetPublisher(pFileName,
NULL,
@@ -1451,10 +1341,6 @@ void PEFile::CheckAuthenticodeSignature()
&pCor,
&size);
-#ifndef FEATURE_CORECLR
- // Authenticode Verification End
- FireEtwAuthenticodeVerificationStop_V1(dwAuthFlags, (ULONG)hr, pFileName, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
if( SUCCEEDED(hr) ) {
DWORD index = 0;
@@ -1743,17 +1629,10 @@ static void RuntimeVerifyLog(DWORD level, LoggableAssembly *pLogAsm, const WCHAR
static const LPCWSTR CorCompileRuntimeDllNames[NUM_RUNTIME_DLLS] =
{
-#ifdef FEATURE_CORECLR
MAKEDLLNAME_W(W("coreclr")),
-#else
- MAKEDLLNAME_W(W("CLR")),
-#endif
MAKEDLLNAME_W(W("clrjit"))
};
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-static LPCWSTR s_ngenCompilerDllName = NULL;
-#endif //!FEATURE_CORECLR && !CROSSGEN_COMPILE
LPCWSTR CorCompileGetRuntimeDllName(CorCompileRuntimeDlls id)
{
@@ -1767,36 +1646,6 @@ LPCWSTR CorCompileGetRuntimeDllName(CorCompileRuntimeDlls id)
}
CONTRACTL_END;
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- if (id == NGEN_COMPILER_INFO)
- {
- // The NGen compiler needs to be handled differently as it can be customized,
- // unlike the other runtime DLLs.
-
- if (s_ngenCompilerDllName == NULL)
- {
- // Check if there is an override for the compiler DLL
- LPCWSTR ngenCompilerOverride = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_NGen_JitName);
-
- if (ngenCompilerOverride == NULL)
- {
- s_ngenCompilerDllName = DEFAULT_NGEN_COMPILER_DLL_NAME;
- }
- else
- {
- if (wcsstr(ngenCompilerOverride, W(".dll")) == NULL)
- {
- EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE,
- NGEN_COMPILER_OVERRIDE_KEY W(" should have a .DLL suffix"));
- }
-
- s_ngenCompilerDllName = ngenCompilerOverride;
- }
- }
-
- return s_ngenCompilerDllName;
- }
-#endif //!FEATURE_CORECLR && !CROSSGEN_COMPILE
return CorCompileRuntimeDllNames[id];
}
@@ -1823,33 +1672,17 @@ extern HMODULE CorCompileGetRuntimeDll(CorCompileRuntimeDlls id)
CONTRACTL_END;
// Currently special cased for every entry.
-#ifdef FEATURE_CORECLR
static_assert_no_msg(NUM_RUNTIME_DLLS == 2);
static_assert_no_msg(CORECLR_INFO == 0);
-#else // !FEATURE_CORECLR
- static_assert_no_msg(NUM_RUNTIME_DLLS == 2);
- static_assert_no_msg(CLR_INFO == 0);
- static_assert_no_msg(NGEN_COMPILER_INFO == 1);
-#endif // else FEATURE_CORECLR
HMODULE hMod = NULL;
// Try to load the correct DLL
switch (id)
{
-#ifdef FEATURE_CORECLR
case CORECLR_INFO:
hMod = GetCLRModule();
break;
-#else // !FEATURE_CORECLR
- case CLR_INFO:
- hMod = GetCLRModule();
- break;
-
- case NGEN_COMPILER_INFO:
- hMod = s_ngenCompilerDll;
- break;
-#endif // else FEATURE_CORECLR
default:
COMPlusThrowNonLocalized(kExecutionEngineException,
@@ -1869,68 +1702,6 @@ static BOOL RuntimeVerifyNativeImageTimestamps(const CORCOMPILE_VERSION_INFO *in
{
STANDARD_VM_CONTRACT;
-#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- //
- // We will automatically fail any zap files which were compiled with different runtime dlls.
- // This is so that we don't load bad ngen images after recompiling or patching the runtime.
- //
-
- for (DWORD index = 0; index < NUM_RUNTIME_DLLS; index++)
- {
- HMODULE hMod = CorCompileGetRuntimeDll((CorCompileRuntimeDlls)index);
-
- if (hMod == NULL)
- {
- // Unless this is an NGen worker process, we don't want to load JIT compiler just to do a timestamp check.
- // In an ideal case, all assemblies have native images, and JIT compiler never needs to be loaded at runtime.
- // Loading JIT compiler just to check its timestamp would reduce the benefits of have native images.
- // Since CLR and JIT are intended to be serviced together, the possibility of accidentally using native
- // images created by an older JIT is very small, and is deemed an acceptable risk.
- // Note that when multiple JIT compilers are used (e.g., clrjit.dll and compatjit.dll on x64 in .NET 4.6),
- // they must all be in the same patch family.
- if (!IsCompilationProcess())
- continue;
-
- // If we are doing ngen, then eagerly make sure all the system
- // dependencies are loaded. Else ICorCompileInfo::CheckAssemblyZap()
- // will not work correctly.
-
- LPCWSTR wszDllName = CorCompileGetRuntimeDllName((CorCompileRuntimeDlls)index);
- if (FAILED(g_pCLRRuntime->LoadLibrary(wszDllName, &hMod)))
- {
- EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("Unable to load CLR DLL during ngen"));
- }
- }
-
- _ASSERTE(hMod != NULL);
-
- PEDecoder pe(hMod);
-
- // Match NT header timestamp and checksum to test DLL identity
-
- if ((info->runtimeDllInfo[index].timeStamp == pe.GetTimeDateStamp()
- || info->runtimeDllInfo[index].timeStamp == 0)
- && (info->runtimeDllInfo[index].virtualSize == pe.GetVirtualSize()
- || info->runtimeDllInfo[index].virtualSize == 0))
- {
- continue;
- }
-
- {
- // set "ComPlus_CheckNGenImageTimeStamp" to 0 to ignore time-stamp-checking
- static ConfigDWORD checkNGenImageTimeStamp;
- BOOL enforceCheck = checkNGenImageTimeStamp.val(CLRConfig::EXTERNAL_CheckNGenImageTimeStamp);
-
- RuntimeVerifyLog(enforceCheck ? LL_ERROR : LL_WARNING,
- pLogAsm,
- W("Compiled with different CLR DLL (%s). Exact match expected."),
- CorCompileGetRuntimeDllName((CorCompileRuntimeDlls)index));
-
- if (enforceCheck)
- return FALSE;
- }
- }
-#endif // !CROSSGEN_COMPILE && !FEATURE_CORECLR
return TRUE;
}
@@ -1955,12 +1726,8 @@ BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
if (!image->CheckNativeHeaderVersion())
{
-#ifdef FEATURE_CORECLR
// Wrong native image version is fatal error on CoreCLR
ThrowHR(COR_E_NI_AND_RUNTIME_VERSION_MISMATCH);
-#else
- return FALSE;
-#endif
}
CORCOMPILE_VERSION_INFO *info = image->GetNativeVersionInfo();
@@ -1970,15 +1737,10 @@ BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
LoggablePEAssembly logAsm(this);
if (!RuntimeVerifyNativeImageVersion(info, &logAsm))
{
-#ifdef FEATURE_CORECLR
// Wrong native image version is fatal error on CoreCLR
ThrowHR(COR_E_NI_AND_RUNTIME_VERSION_MISMATCH);
-#else
- return FALSE;
-#endif
}
-#ifdef FEATURE_CORECLR
CorCompileConfigFlags configFlags = PEFile::GetNativeImageConfigFlagsWithOverrides();
if (IsSystem())
@@ -1999,36 +1761,10 @@ BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
{
return FALSE;
}
-#else
- //
- // Check image flavor. Skip this check in RuntimeVerifyNativeImageVersion called from fusion - fusion is responsible for choosing the right flavor.
- //
- if (!RuntimeVerifyNativeImageFlavor(info, &logAsm))
- {
- return FALSE;
- }
-#endif
return TRUE;
}
-#ifndef FEATURE_CORECLR
-//===========================================================================================================
-// Validates that an NI matches the required flavor (debug, instrumented, etc.)
-//
-//===========================================================================================================
-BOOL RuntimeVerifyNativeImageFlavor(const CORCOMPILE_VERSION_INFO *info, LoggableAssembly *pLogAsm)
-{
- STANDARD_VM_CONTRACT;
-
- CorCompileConfigFlags configFlags = PEFile::GetNativeImageConfigFlagsWithOverrides();
-
- if ((info->wConfigFlags & configFlags) != configFlags)
- return FALSE;
-
- return TRUE;
-}
-#endif
//===========================================================================================================
// Validates that an NI matches the running CLR, OS, CPU, etc.
@@ -2100,18 +1836,6 @@ BOOL RuntimeVerifyNativeImageVersion(const CORCOMPILE_VERSION_INFO *info, Loggab
}
#endif // CROSSGEN_COMPILE
-#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
- //
- // Check the right JIT compiler
- //
-
- bool nativeImageBuiltWithRyuJit = ((info->wCodegenFlags & CORCOMPILE_CODEGEN_USE_RYUJIT) != 0);
- if (UseRyuJit() != nativeImageBuiltWithRyuJit)
- {
- RuntimeVerifyLog(LL_ERROR, pLogAsm, W("JIT compiler used to generate native image doesn't match current JIT compiler."));
- return FALSE;
- }
-#endif
//
// The zap is up to date.
@@ -2990,11 +2714,7 @@ PEAssembly::PEAssembly(
m_creator(clr::SafeAddRef(creator)),
m_bIsFromGAC(FALSE),
m_bIsOnTpaList(FALSE)
-#ifdef FEATURE_CORECLR
,m_fProfileAssembly(0)
-#else
- ,m_fStrongNameBypassed(FALSE)
-#endif
{
CONTRACTL
{
@@ -3621,18 +3341,6 @@ PEAssembly *PEAssembly::DoOpenMemory(
if (!image->CheckILFormat())
ThrowHR(COR_E_BADIMAGEFORMAT, BFA_BAD_IL);
-#if !defined(FEATURE_CORECLR)
- if(pBinderToUse != NULL && !isIntrospectionOnly)
- {
- ReleaseHolder<ICLRPrivAssembly> pAsm;
- ReleaseHolder<IAssemblyName> pAssemblyName;
- IfFailThrow(pBinderToUse->BindAssemblyExplicit(image, &pAssemblyName, &pAsm));
- PEAssembly* pFile = nullptr;
- IfFailThrow(GetAppDomain()->BindHostedPrivAssembly(pParentAssembly, pAsm, pAssemblyName, &pFile));
- _ASSERTE(pFile);
- RETURN pFile;
- }
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_FUSION
RETURN new PEAssembly(image, NULL, NULL, NULL, NULL, NULL, NULL, pParentAssembly, FALSE, isIntrospectionOnly);
@@ -4203,35 +3911,13 @@ void PEAssembly::VerifyStrongName()
// checked, to handle the case where we are not loading m_image.
EnsureImageOpened();
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
- if (IsWindowsRuntime())
- {
- // Winmd files are always loaded in full trust.
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- m_fStrongNameVerified = TRUE;
- return;
- }
-#endif
-#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
if (m_nativeImage == NULL && !GetILimage()->IsTrustedNativeImage())
-#else
- if (!GetILimage()->IsTrustedNativeImage())
-#endif
{
if (!GetILimage()->CheckILFormat())
ThrowHR(COR_E_BADIMAGEFORMAT);
}
-#if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
- // Do not validate strong name signature during CrossGen. This is necessary
- // to make build-lab scenarios to work.
- if (IsCompilationProcess())
- {
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- }
- else
-#endif
// Check the strong name if present.
if (IsIntrospectionOnly())
{
@@ -4239,59 +3925,16 @@ void PEAssembly::VerifyStrongName()
// need to do module hash checks.
m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
}
-#if !defined(FEATURE_CORECLR)
- //We do this to early out for WinMD files that are unsigned but have NI images as well.
- else if (!HasStrongNameSignature())
- {
-#ifdef FEATURE_CAS_POLICY
- // We only check module hashes if there is a strong name or Authenticode signature
- if (m_certificate == NULL)
- {
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- }
-#endif
- }
-#endif // !defined(FEATURE_CORECLR)
else
{
-#ifdef FEATURE_CORECLR
// Runtime policy on CoreCLR is to skip verification of ALL assemblies
m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
m_fStrongNameVerified = TRUE;
-#else
- DWORD verifyOutputFlags = 0;
- HRESULT hr = GetILimage()->VerifyStrongName(&verifyOutputFlags);
-
- if (SUCCEEDED(hr))
- {
- // Strong name verified or delay sign OK'ed.
- // We will skip verification of modules in the delay signed case.
-
- if ((verifyOutputFlags & SN_OUTFLAG_WAS_VERIFIED) == 0)
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- }
- else
- {
- // Strong name missing or error. Throw in the latter case.
- if (hr != CORSEC_E_MISSING_STRONGNAME)
- ThrowHR(hr);
-
-#ifdef FEATURE_CAS_POLICY
- // Since we are not strong named, don't check module hashes.
- // (Unless we have a security certificate, in which case check anyway.)
-
- if (m_certificate == NULL)
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
-#endif
- }
-
-#endif // FEATURE_CORECLR
}
m_fStrongNameVerified = TRUE;
}
-#ifdef FEATURE_CORECLR
BOOL PEAssembly::IsProfileAssembly()
{
CONTRACTL
@@ -4324,7 +3967,6 @@ BOOL PEAssembly::IsProfileAssembly()
m_fProfileAssembly = bProfileAssembly ? 1 : -1;
return bProfileAssembly;
}
-#endif // FEATURE_CORECLR
// ------------------------------------------------------------
// Descriptive strings
@@ -5097,26 +4739,6 @@ LPCWSTR PEFile::GetPathForErrorMessages()
}
}
-#ifndef FEATURE_CORECLR
-BOOL PEAssembly::IsReportedToUsageLog()
-{
- LIMITED_METHOD_CONTRACT;
- BOOL fReported = TRUE;
-
- if (!IsDynamic())
- fReported = m_identity->IsReportedToUsageLog();
-
- return fReported;
-}
-
-void PEAssembly::SetReportedToUsageLog()
-{
- LIMITED_METHOD_CONTRACT;
-
- if (!IsDynamic())
- m_identity->SetReportedToUsageLog();
-}
-#endif // !FEATURE_CORECLR
#ifdef DACCESS_COMPILE
TADDR PEFile::GetMDInternalRWAddress()
@@ -5149,12 +4771,10 @@ PTR_ICLRPrivBinder PEFile::GetBindingContext()
PTR_ICLRPrivBinder pBindingContext = NULL;
-#if defined(FEATURE_CORECLR)
// Mscorlib is always bound in context of the TPA Binder. However, since it gets loaded and published
// during EEStartup *before* TPAbinder is initialized, we dont have a binding context to publish against.
// Thus, we will always return NULL for its binding context.
if (!IsSystem())
-#endif // defined(FEATURE_CORECLR)
{
pBindingContext = dac_cast<PTR_ICLRPrivBinder>(GetHostAssembly());
}
diff --git a/src/vm/pefile.h b/src/vm/pefile.h
index 413d08c185..7bb13a7977 100644
--- a/src/vm/pefile.h
+++ b/src/vm/pefile.h
@@ -194,9 +194,6 @@ public:
BOOL Equals(PEImage *pImage);
#endif // DACCESS_COMPILE
-#ifndef FEATURE_CORECLR
- BOOL IsShareable();
-#endif
void GetMVID(GUID *pMvid);
@@ -572,10 +569,6 @@ protected:
#endif
IMetaDataImport2 *m_pImporter;
IMetaDataEmit *m_pEmitter;
-#ifndef FEATURE_CORECLR
- IMetaDataAssemblyImport *m_pAssemblyImporter;
- IMetaDataAssemblyEmit *m_pAssemblyEmitter;
-#endif
SimpleRWLock *m_pMetadataLock;
Volatile<LONG> m_refCount;
SBuffer *m_hash; // cached SHA1 hash value
@@ -728,19 +721,6 @@ class PEAssembly : public PEFile
// Public API
// ------------------------------------------------------------
-#if !defined(FEATURE_CORECLR)
- static PEAssembly * Open(
- PEAssembly * pParentAssembly,
- PEImage * pPEImageIL,
- PEImage * pPEImageNI,
- ICLRPrivAssembly * pHostAssembly,
- BOOL fIsIntrospectionOnly);
-
- static PEAssembly * Open(
- PEAssembly * pParentAssembly,
- PEImage * pPEImageIL,
- BOOL isIntrospectionOnly = FALSE);
-#else //!FEATURE_CORECLR
// CoreCLR's PrivBinder PEAssembly creation entrypoint
static PEAssembly * Open(
PEAssembly * pParent,
@@ -748,7 +728,6 @@ class PEAssembly : public PEFile
PEImage * pPEImageNI,
ICLRPrivAssembly * pHostAssembly,
BOOL fIsIntrospectionOnly = FALSE);
-#endif //!FEATURE_CORECLR
// This opens the canonical mscorlib.dll
#ifdef FEATURE_FUSION
@@ -846,9 +825,7 @@ class PEAssembly : public PEFile
// ------------------------------------------------------------
BOOL IsSourceGAC();
-#ifdef FEATURE_CORECLR
BOOL IsProfileAssembly();
-#endif // FEATURE_CORECLR
ULONG HashIdentity();
#ifdef FEATURE_FUSION
@@ -968,10 +945,6 @@ class PEAssembly : public PEFile
#endif
#endif
-#ifndef FEATURE_CORECLR
- BOOL IsReportedToUsageLog();
- void SetReportedToUsageLog();
-#endif // !FEATURE_CORECLR
protected:
@@ -1067,11 +1040,7 @@ class PEAssembly : public PEFile
// things
SString m_sTextualIdentity;
#endif
-#ifdef FEATURE_CORECLR
int m_fProfileAssembly; // Tri-state cache
-#else
- BOOL m_fStrongNameBypassed;
-#endif
public:
PTR_PEFile GetCreator()
diff --git a/src/vm/pefile.inl b/src/vm/pefile.inl
index 09cb89f548..76040e3551 100644
--- a/src/vm/pefile.inl
+++ b/src/vm/pefile.inl
@@ -179,23 +179,6 @@ inline BOOL PEFile::IsMarkedAsContentTypeWindowsRuntime()
return (IsAfContentType_WindowsRuntime(GetFlags()));
}
-#ifndef FEATURE_CORECLR
-inline BOOL PEFile::IsShareable()
-{
- CONTRACTL
- {
- PRECONDITION(CheckPointer(m_identity));
- MODE_ANY;
- THROWS;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- if (!m_identity->HasID())
- return FALSE;
- return TRUE ;
-}
-#endif
inline void PEFile::GetMVID(GUID *pMvid)
{
@@ -525,9 +508,6 @@ inline IMDInternalImport* PEFile::GetPersistentMDImport()
CONTRACT_END;
*/
SUPPORTS_DAC;
-#ifndef FEATURE_CORECLR
-_ASSERTE(m_bHasPersistentMDImport);
-#endif
#if !defined(__GNUC__)
_ASSERTE(!IsResource());
@@ -624,46 +604,6 @@ inline IMetaDataEmit *PEFile::GetEmitter()
RETURN m_pEmitter;
}
-#ifndef FEATURE_CORECLR
-inline IMetaDataAssemblyImport *PEFile::GetAssemblyImporter()
-{
- CONTRACT(IMetaDataAssemblyImport *)
- {
- INSTANCE_CHECK;
- MODE_ANY;
- GC_NOTRIGGER;
- PRECONDITION(!IsResource());
- POSTCONDITION(CheckPointer(RETVAL));
- PRECONDITION(m_bHasPersistentMDImport);
- THROWS;
- }
- CONTRACT_END;
-
- if (m_pAssemblyImporter == NULL)
- OpenAssemblyImporter();
-
- RETURN m_pAssemblyImporter;
-}
-
-inline IMetaDataAssemblyEmit *PEFile::GetAssemblyEmitter()
-{
- CONTRACT(IMetaDataAssemblyEmit *)
- {
- INSTANCE_CHECK;
- MODE_ANY;
- GC_NOTRIGGER;
- PRECONDITION(!IsResource());
- POSTCONDITION(CheckPointer(RETVAL));
- PRECONDITION(m_bHasPersistentMDImport);
- }
- CONTRACT_END;
-
- if (m_pAssemblyEmitter == NULL)
- OpenAssemblyEmitter();
-
- RETURN m_pAssemblyEmitter;
-}
-#endif // FEATURE_CORECLR
#endif // DACCESS_COMPILE
@@ -1391,7 +1331,7 @@ inline BOOL PEFile::IsPtrInILImage(PTR_CVOID data)
if (HasOpenedILimage())
{
-#if defined(FEATURE_PREJIT) && defined(FEATURE_CORECLR)
+#if defined(FEATURE_PREJIT)
if (m_openedILimage == m_nativeImage)
{
// On Apollo builds, we sometimes open the native image into the slot
@@ -1946,25 +1886,6 @@ inline BOOL PEAssembly::IsFullySigned()
}
}
-#ifndef FEATURE_CORECLR
-//---------------------------------------------------------------------------------------
-//
-// Mark that an assembly has had its strong name verification bypassed
-//
-
-inline void PEAssembly::SetStrongNameBypassed()
-{
- LIMITED_METHOD_CONTRACT;
- m_fStrongNameBypassed = TRUE;
-}
-
-inline BOOL PEAssembly::NeedsModuleHashChecks()
-{
- LIMITED_METHOD_CONTRACT;
-
- return ((m_flags & PEFILE_SKIP_MODULE_HASH_CHECKS) == 0) && !m_fStrongNameBypassed;
-}
-#endif // FEATURE_CORECLR
#ifdef FEATURE_CAS_POLICY
//---------------------------------------------------------------------------------------
diff --git a/src/vm/peimage.cpp b/src/vm/peimage.cpp
index 09b4176e22..1bb479c486 100644
--- a/src/vm/peimage.cpp
+++ b/src/vm/peimage.cpp
@@ -475,103 +475,13 @@ BOOL PEImage::Equals(PEImage *pImage)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// PEImage is always unique on CoreCLR so a simple pointer check is sufficient
_ASSERTE(m_bInHashMap || GetPath().IsEmpty());
_ASSERTE(pImage->m_bInHashMap || pImage->GetPath().IsEmpty());
return dac_cast<TADDR>(pImage) == dac_cast<TADDR>(this);
-#else // FEATURE_CORECLR
- if (pImage == this)
- return TRUE;
-
- if (GetPath().IsEmpty())
- {
-#ifdef FEATURE_FUSION
- if (m_fIsIStream && pImage->m_fIsIStream)
- {
- return (m_StreamAsmId == pImage->m_StreamAsmId) && (m_dwStreamModuleId == pImage->m_dwStreamModuleId);
- }
-#endif
-
- return FALSE;
- }
- else
- {
- BOOL ret = FALSE;
- HRESULT hr;
- EX_TRY
- {
- if (PathEquals(GetPath(), pImage->GetPath()))
- ret = TRUE;
- }
- EX_CATCH_HRESULT(hr); //<TODO>ignores failure!</TODO>
- return ret;
- }
-#endif // FEATURE_CORECLR
}
-#ifndef FEATURE_CORECLR
-void PEImage::ComputeHash(ALG_ID algorithm, SBuffer &result)
-{
- CONTRACTL
- {
- INSTANCE_CHECK;
- PRECONDITION(CheckStartup());
- PRECONDITION(CheckValue(result));
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- PEImageLayoutHolder pview(GetLayout(PEImageLayout::LAYOUT_FLAT,PEImage::LAYOUT_CREATEIFNEEDED));
-
- if (algorithm == CALG_SHA1)
- {
- SHA1Hash hasher;
- hasher.AddData((BYTE *) pview->GetBase(), pview->GetSize());
- result.Set(hasher.GetHash(), SHA1_HASH_SIZE);
- return;
- }
-
- DWORD size = 0;
- if(!StrongNameHashSize(algorithm, &size))
- {
- ThrowHR(StrongNameErrorInfo());
- }
-
- BYTE *buffer = result.OpenRawBuffer(size);
-
- DWORD hashSize;
- IfFailThrow(GetHashFromBlob((BYTE *) pview->GetBase(), pview->GetSize(), &algorithm, buffer, size, &hashSize));
-
- _ASSERTE(size == hashSize);
-
- result.CloseRawBuffer(hashSize);
-}
-
-CHECK PEImage::CheckHash(ALG_ID algorithm, const void *pbHash, COUNT_T cbHash)
-{
- CONTRACT_CHECK
- {
- INSTANCE_CHECK;
- PRECONDITION(CheckStartup());
- INSTANCE_CHECK;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACT_CHECK_END;
-
- StackSBuffer hash;
- ComputeHash(algorithm, hash);
-
- CHECK(hash.Equals((const BYTE *) pbHash, cbHash));
-
- CHECK_OK;
-}
-#endif // FEATURE_CORECLR
IMDInternalImport* PEImage::GetMDImport()
{
@@ -1419,9 +1329,6 @@ PEImage::PEImage():
m_bIsTrustedNativeImage(FALSE),
m_bIsNativeImageInstall(FALSE),
m_bPassiveDomainOnly(FALSE),
-#ifndef FEATURE_CORECLR
- m_fReportedToUsageLog(FALSE),
-#endif // !FEATURE_CORECLR
m_bInHashMap(FALSE),
#ifdef METADATATRACKER_DATA
m_pMDTracker(NULL),
@@ -1523,34 +1430,12 @@ PTR_PEImageLayout PEImage::GetLayoutInternal(DWORD imageLayoutMask,DWORD flags)
{
PEImageLayout * pLoadLayout = NULL;
-#ifdef FEATURE_CORECLR
if (m_bIsTrustedNativeImage || IsFile())
{
// For CoreCLR, try to load all files via LoadLibrary first. If LoadLibrary did not work, retry using
// regular mapping - but not for native images.
pLoadLayout = PEImageLayout::Load(this, TRUE /* bNTSafeLoad */, m_bIsTrustedNativeImage /* bThrowOnError */);
}
-#else
- if (m_bIsTrustedNativeImage)
- {
- pLoadLayout = PEImageLayout::Load(this, FALSE);
- }
- else if (m_bIsNativeImageInstall)
- {
- // When ESB (extended secure boot) is enabled, a native image that is being installed can
- // only be loaded flat.
- PEImageLayout* pFlatLayout=PEImageLayout::LoadFlat(GetFileHandle(),this);
- SetLayout(IMAGE_FLAT,pFlatLayout);
- pLoadLayout = new ConvertedImageLayout(pFlatLayout);
- }
-#ifdef FEATURE_READYTORUN
- else if (ReadyToRunInfo::IsReadyToRunEnabled() && IsFile())
- {
- pLoadLayout = PEImageLayout::Load(this, FALSE, FALSE);
- }
-#endif // FEATURE_READYTORUN
-
-#endif // FEATURE_CORECLR
if (pLoadLayout != NULL)
{
@@ -1569,46 +1454,9 @@ PTR_PEImageLayout PEImage::GetLayoutInternal(DWORD imageLayoutMask,DWORD flags)
// since LoadLibrary is needed if we are to actually load code.
if (pLayout->HasCorHeader() && pLayout->IsILOnly())
{
-#ifdef FEATURE_CORECLR
// For CoreCLR, IL only images will always be mapped. We also dont bother doing the conversion of PE header on 64bit,
// as done below for the desktop case, as there is no appcompat burden for CoreCLR on 64bit to have that conversion done.
fMarkAnyCpuImageAsLoaded = true;
-#else // !FEATURE_CORECLR
-
-#ifdef _WIN64
- // When attempting to load an assembly using LoadLibrary on x64,
- // the execution will go via the shell-shim that will try to determine
- // if the assembly is ILOnly with Pe32 header (i.e. built as anycpu). If it is,
- // it will convert the in-memory PEheader of the image to be PE32+ (i.e. mark it as 64bit image).
- //
- // Since we are trying to avoid mapping twice for ILOnly images by simply memory mapping them,
- // we should emulate the shell-shim behaviour for 64bit. This will allow inproc-components (e.g. ASP.NET),
- // which check for Pe32+ header, to continue working as expected.
- //
- // If we fail for some reason to change the header, in retail build, we will simply fallback to the double-loading behaviour without
- // any functional problems.
- if (pLayout->Has32BitNTHeaders())
- {
- fMarkAnyCpuImageAsLoaded = pLayout->ConvertILOnlyPE32ToPE64();
- }
- else
- {
- // Before assuming that PE32+ file can be loaded, confirm that
- // it is the expected machine type. This will ensure AMD64 does not load ARM64 or IA64 assemblies (and likewise).
- // If the machine type does not match, the Loader will fail the load at a later point.
- if (pLayout->GetMachine() == IMAGE_FILE_MACHINE_NATIVE)
- {
- fMarkAnyCpuImageAsLoaded = true; // PE32+ (aka native 64bit) binaries dont require any extra processing.
- }
- }
-#else // !_WIN64
- // Why can we not blindly assume that on 32bit OS, image should always be loaded? This is because it is possible to load
- // PE32+ image and map it to the 32bit process in WOW64.
- if (pLayout->Has32BitNTHeaders())
- fMarkAnyCpuImageAsLoaded = true;
-#endif // _WIN64
-
-#endif // FEATURE_CORECLR
}
pLayout.SuppressRelease();
@@ -1717,36 +1565,8 @@ void PEImage::Load()
}
else
{
-#ifdef FEATURE_CORECLR
if(m_pLayouts[IMAGE_LOADED]==NULL)
SetLayout(IMAGE_LOADED,PEImageLayout::Load(this,TRUE));
-#else
-
- //as part of Load() call we may initialize loaded image in DllMain
- //so we have to leave the lock and be prepared that when PEImageLayout::Load returns
- //m_pLayouts[IMAGE_LOADED] is set to something else
- lock.Release();
-
- FileHandleHolder pProtect=GetProtectingFileHandle(FALSE);
-
- // if the image is IL-only, try to load it in the safe manner
-
- // using the Internal function here because we are under the writer lock
- PEImageLayoutHolder pLayout=GetLayoutInternal(PEImageLayout::LAYOUT_ANY,0);
- BOOL bPreferSafeLoad=(pLayout && pLayout->IsILOnly());
-
- // Always use safe load during NGen to avoid running unmanaged code in IJW assemblies
- if (IsCompilationProcess())
- bPreferSafeLoad = TRUE;
-
- PEImageLayoutHolder pLoaded(PEImageLayout::Load(this,bPreferSafeLoad));
-
- lock.Acquire();
-
- if(m_pLayouts[IMAGE_LOADED]==NULL)
- SetLayout(IMAGE_LOADED,pLoaded.Extract());
-
-#endif // FEATURE_CORECLR
}
}
diff --git a/src/vm/peimage.h b/src/vm/peimage.h
index a7fe50e1e4..4a153b9304 100644
--- a/src/vm/peimage.h
+++ b/src/vm/peimage.h
@@ -261,13 +261,6 @@ public:
void VerifyIsAssembly();
void VerifyIsNIAssembly();
-#ifndef FEATURE_CORECLR
- BOOL IsReportedToUsageLog();
- void SetReportedToUsageLog();
-#ifndef DACCESS_COMPILE
- HRESULT GetILFingerprint(IILFingerprint **ppFingerprint);
-#endif //!DACCESS_COMPILE
-#endif //!FEATURE_CORECLR
static void GetAll(SArray<PEImage*> &images);
@@ -359,9 +352,6 @@ private:
BOOL m_bIsTrustedNativeImage;
BOOL m_bIsNativeImageInstall;
BOOL m_bPassiveDomainOnly;
-#ifndef FEATURE_CORECLR
- BOOL m_fReportedToUsageLog;
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_LAZY_COW_PAGES
BOOL m_bAllocatedLazyCOWPages;
#endif // FEATURE_LAZY_COW_PAGES
diff --git a/src/vm/peimage.inl b/src/vm/peimage.inl
index 4d913ea02b..6a0b3a07fb 100644
--- a/src/vm/peimage.inl
+++ b/src/vm/peimage.inl
@@ -405,47 +405,6 @@ inline const BOOL PEImage::HasStrongNameSignature()
#ifndef DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR)
-inline const HRESULT PEImage::VerifyStrongName(DWORD* verifyOutputFlags)
-{
- WRAPPER_NO_CONTRACT;
- _ASSERTE(verifyOutputFlags);
- if (m_bSignatureInfoCached)
- {
- if (SUCCEEDED(m_hrSignatureInfoStatus))
- *verifyOutputFlags=m_dwSignatureInfo;
- return m_hrSignatureInfoStatus;
- }
-
- BOOL result = FALSE;
-
- PEImageLayoutHolder pLayout(GetLayout(PEImageLayout::LAYOUT_FLAT,0));
- if(pLayout!=NULL)
- {
- result = StrongNameSignatureVerificationFromImage((BYTE *) pLayout->GetBase(), pLayout->GetSize(),
- SN_INFLAG_INSTALL|SN_INFLAG_ALL_ACCESS,
- verifyOutputFlags);
- }
- else
- {
- CONSISTENCY_CHECK(!GetPath().IsEmpty());
- _ASSERTE(IsFileLocked());
- result = StrongNameSignatureVerification(GetPath(),
- SN_INFLAG_INSTALL|SN_INFLAG_ALL_ACCESS|SN_INFLAG_RUNTIME,
- verifyOutputFlags);
- }
-
- HRESULT hr=result?S_OK: StrongNameErrorInfo();
-
- if (SUCCEEDED(hr) || !Exception::IsTransient(hr))
- {
- m_hrSignatureInfoStatus=hr;
- m_dwSignatureInfo=*verifyOutputFlags;
- m_bSignatureInfoCached=TRUE;
- }
- return hr;
-}
-#endif // !FEATURE_CORECLR
#endif // !DACCESS_COMPILE
@@ -579,59 +538,6 @@ inline void PEImage::Init(LPCWSTR pPath)
}
#ifndef DACCESS_COMPILE
-#if !defined(FEATURE_CORECLR)
-/*static*/
-inline PTR_PEImage PEImage::FindByLongPath(LPCWSTR pPath)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- PRECONDITION(s_hashLock.OwnedByCurrentThread());
- }
- CONTRACTL_END;
-
- PathString sLongPath;
- COUNT_T nLen = WszGetLongPathName(pPath, sLongPath);
-
- // Check for any kind of error other than an insufficient buffer result.
- if (nLen == 0)
- {
- HRESULT hr=HRESULT_FROM_WIN32(GetLastError());
- if(Exception::IsTransient(hr))
- ThrowHR(hr);
- return (PEImage*)INVALIDENTRY;
- }
- return FindByPath(sLongPath.GetUnicode());
-}
-
-/*static*/
-inline PTR_PEImage PEImage::FindByShortPath(LPCWSTR pPath)
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- PRECONDITION(s_hashLock.OwnedByCurrentThread());
- }
- CONTRACTL_END;
-
- PathString sShortPath;
- COUNT_T nLen = WszGetShortPathName(pPath, sShortPath);
-
- // Check for any kind of error other than an insufficient buffer result.
- if (nLen == 0)
- {
- HRESULT hr=HRESULT_FROM_WIN32(GetLastError());
- if(Exception::IsTransient(hr))
- ThrowHR(hr);
- return (PEImage*)INVALIDENTRY;
- }
- return FindByPath(sShortPath.GetUnicode());
-}
-#endif // !FEATURE_CORECLR
/*static*/
inline PTR_PEImage PEImage::FindByPath(LPCWSTR pPath)
@@ -673,13 +579,6 @@ inline PTR_PEImage PEImage::OpenImage(LPCWSTR pPath, MDInternalImportFlags flags
PEImage* found = FindByPath(pPath);
-#if !defined(FEATURE_CORECLR)
- if(found == (PEImage*) INVALIDENTRY && (flags & MDInternalImport_CheckLongPath))
- found=FindByLongPath(pPath);
-
- if(found == (PEImage*) INVALIDENTRY && (flags & MDInternalImport_CheckShortPath))
- found=FindByShortPath(pPath);
-#endif
if (found == (PEImage*) INVALIDENTRY)
{
@@ -874,19 +773,6 @@ inline void PEImage::GetPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine)
}
-#ifndef FEATURE_CORECLR
-inline BOOL PEImage::IsReportedToUsageLog()
-{
- LIMITED_METHOD_CONTRACT;
- return m_fReportedToUsageLog;
-}
-
-inline void PEImage::SetReportedToUsageLog()
-{
- LIMITED_METHOD_CONTRACT;
- m_fReportedToUsageLog = TRUE;
-}
-#endif // !FEATURE_CORECLR
#ifndef DACCESS_COMPILE
inline void PEImage::AllocateLazyCOWPages()
diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp
index 2b50adefb8..a84136a5bc 100644
--- a/src/vm/peimagelayout.cpp
+++ b/src/vm/peimagelayout.cpp
@@ -258,47 +258,6 @@ void PEImageLayout::ApplyBaseRelocations()
}
#endif // FEATURE_PREJIT
-#ifndef FEATURE_CORECLR
-// Event Tracing for Windows is used to log data for performance and functional testing purposes.
-// The events in this structure are used to measure the time taken by PE image mapping. This is useful to reliably measure the
-// performance of the assembly loader by subtracting the time taken by the possibly I/O-intensive work of PE image mapping.
-struct ETWLoaderMappingPhaseHolder { // Special-purpose holder structure to ensure the LoaderMappingPhaseEnd ETW event is fired when returning from a function.
- StackSString ETWCodeBase;
- DWORD _dwAppDomainId;
- BOOL initialized;
-
- ETWLoaderMappingPhaseHolder(){
- LIMITED_METHOD_CONTRACT;
- _dwAppDomainId = ETWAppDomainIdNotAvailable;
- initialized = FALSE;
- }
-
- void Init(DWORD dwAppDomainId, SString wszCodeBase) {
- _dwAppDomainId = dwAppDomainId;
-
- EX_TRY
- {
- ETWCodeBase.Append(wszCodeBase);
- ETWCodeBase.Normalize(); // Ensures that the later cast to LPCWSTR does not throw.
- }
- EX_CATCH
- {
- ETWCodeBase.Clear();
- }
- EX_END_CATCH(RethrowTransientExceptions)
-
- FireEtwLoaderMappingPhaseStart(_dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, ETWCodeBase.IsEmpty() ? NULL : (LPCWSTR)ETWCodeBase, NULL, GetClrInstanceId());
-
- initialized = TRUE;
- }
-
- ~ETWLoaderMappingPhaseHolder() {
- if (initialized) {
- FireEtwLoaderMappingPhaseEnd(_dwAppDomainId, ETWLoadContextNotAvailable, ETWFieldUnused, ETWLoaderLoadTypeNotAvailable, ETWCodeBase.IsEmpty() ? NULL : (LPCWSTR)ETWCodeBase, NULL, GetClrInstanceId());
- }
- }
-};
-#endif // FEATURE_CORECLR
RawImageLayout::RawImageLayout(const void *flat, COUNT_T size,PEImage* pOwner)
{
@@ -316,12 +275,6 @@ RawImageLayout::RawImageLayout(const void *flat, COUNT_T size,PEImage* pOwner)
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
if (size)
{
@@ -355,12 +308,6 @@ RawImageLayout::RawImageLayout(const void *mapped, PEImage* pOwner, BOOL bTakeOw
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
if (bTakeOwnership)
{
@@ -392,12 +339,6 @@ ConvertedImageLayout::ConvertedImageLayout(PEImageLayout* source)
PEFingerprintVerificationHolder verifyHolder(source->m_pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
if (!source->HasNTHeaders())
EEFileLoadException::Throw(GetPath(), COR_E_BADIMAGEFORMAT);
@@ -447,12 +388,6 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner)
#ifndef FEATURE_PAL
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
// Let OS map file for us
@@ -461,23 +396,12 @@ MappedImageLayout::MappedImageLayout(HANDLE hFile, PEImage* pOwner)
if (m_FileMap == NULL)
{
#ifndef CROSSGEN_COMPILE
-#ifdef FEATURE_CORECLR
// There is no reflection-only load on CoreCLR and so we can always throw an error here.
// It is important on Windows Phone. All assemblies that we load must have SEC_IMAGE set
// so that the OS can perform signature verification.
ThrowLastError();
-#else // FEATURE_CORECLR
-
- // We need to ensure any signature validation errors are caught if Extended Secure Boot (ESB) is on.
- // Also, we have to always throw here during NGen to ensure that the signature validation is never skipped.
- if (GetLastError() != ERROR_BAD_EXE_FORMAT || IsCompilationProcess())
- {
- ThrowLastError();
- }
-
-#endif // FEATURE_CORECLR
#endif // CROSSGEN_COMPILE
return;
@@ -624,12 +548,6 @@ LoadedImageLayout::LoadedImageLayout(PEImage* pOwner, BOOL bNTSafeLoad, BOOL bTh
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
DWORD dwFlags = GetLoadWithAlteredSearchPathFlag();
if (bNTSafeLoad)
@@ -667,12 +585,6 @@ FlatImageLayout::FlatImageLayout(HANDLE hFile, PEImage* pOwner)
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
COUNT_T size = SafeGetFileSize(hFile, NULL);
if (size == 0xffffffff && GetLastError() != NOERROR)
@@ -710,12 +622,6 @@ StreamImageLayout::StreamImageLayout(IStream* pIStream,PEImage* pOwner)
PEFingerprintVerificationHolder verifyHolder(pOwner); // Do not remove: This holder ensures the IL file hasn't changed since the runtime started making assumptions about it.
-#ifndef FEATURE_CORECLR
- ETWLoaderMappingPhaseHolder loaderMappingPhaseHolder;
- if (ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, TRACE_LEVEL_INFORMATION, CLR_PRIVATEBINDING_KEYWORD)) {
- loaderMappingPhaseHolder.Init(GetAppDomain() ? GetAppDomain()->GetId().m_dwId : ETWAppDomainIdNotAvailable, GetPath());
- }
-#endif // FEATURE_CORECLR
STATSTG statStg;
IfFailThrow(pIStream->Stat(&statStg, STATFLAG_NONAME));
diff --git a/src/vm/profilinghelper.cpp b/src/vm/profilinghelper.cpp
index 1dd60b47e1..b1fb228acb 100644
--- a/src/vm/profilinghelper.cpp
+++ b/src/vm/profilinghelper.cpp
@@ -138,9 +138,6 @@
#include "profilinghelper.inl"
#include "eemessagebox.h"
-#if defined(FEATURE_PROFAPI_EVENT_LOGGING) && !defined(FEATURE_CORECLR)
-#include <eventmsg.h>
-#endif // FEATURE_PROFAPI_EVENT_LOGGING) && !FEATURE_CORECLR
#ifdef FEATURE_PROFAPI_ATTACH_DETACH
#include "profattach.h"
@@ -398,30 +395,8 @@ void ProfilingAPIUtility::LogProfEventVA(
AppendSupplementaryInformation(iStringResourceID, &messageToLog);
-#if defined(FEATURE_CORECLR)
// CoreCLR on Windows ouputs debug strings for diagnostic messages.
WszOutputDebugString(messageToLog);
-#else
- // Get the user SID for the current process, so it can be provided to the event
- // logging API, which will then fill out the "User" field in the event log entry. If
- // this fails, that's not fatal. We can just pass NULL for the PSID, and the "User"
- // field will be left blank.
- PSID psid = NULL;
- HRESULT hr = GetCurrentProcessUserSid(&psid);
- if (FAILED(hr))
- {
- // No biggie. Just pass in a NULL psid, and the User field will be empty
- _ASSERTE(psid == NULL);
- }
-
- // On desktop CLR builds, the profiling API uses the event log for end-user-friendly
- // diagnostic messages.
- ReportEventCLR(wEventType, // wType
- 0, // wCategory
- COR_Profiler, // dwEventID
- psid, // lpUserSid
- &messageToLog); // uh duh
-#endif // FEATURE_CORECLR
#endif // FEATURE_PROFAPI_EVENT_LOGGING
}
@@ -732,11 +707,7 @@ HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup()
// Find out if profiling is enabled
DWORD fProfEnabled = 0;
-#ifdef FEATURE_CORECLR
fProfEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_ENABLE_PROFILING);
-#else //FEATURE_CORECLR
- fProfEnabled = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_ENABLE_PROFILING);
-#endif //FEATURE_CORECLR
// If profiling is not enabled, return.
if (fProfEnabled == 0)
@@ -751,7 +722,6 @@ HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup()
NewArrayHolder<WCHAR> wszClsid(NULL);
NewArrayHolder<WCHAR> wszProfilerDLL(NULL);
-#ifdef FEATURE_CORECLR
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER, &wszClsid));
#if defined(_TARGET_X86_)
@@ -763,19 +733,6 @@ HRESULT ProfilingAPIUtility::AttemptLoadProfilerForStartup()
{
IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_CORECLR_PROFILER_PATH, &wszProfilerDLL));
}
-#else // FEATURE_CORECLR
- IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER, &wszClsid));
-
-#if defined(_TARGET_X86_)
- IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH_32, &wszProfilerDLL));
-#elif defined(_TARGET_AMD64_)
- IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH_64, &wszProfilerDLL));
-#endif
- if(wszProfilerDLL == NULL)
- {
- IfFailRet(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_COR_PROFILER_PATH, &wszProfilerDLL));
- }
-#endif // FEATURE_CORECLR
// If the environment variable doesn't exist, profiling is not enabled.
if (wszClsid == NULL)
diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp
index da66dbde44..18702d7b60 100644
--- a/src/vm/proftoeeinterfaceimpl.cpp
+++ b/src/vm/proftoeeinterfaceimpl.cpp
@@ -4727,16 +4727,10 @@ HRESULT ProfToEEInterfaceImpl::SetILInstrumentedCodeMap(FunctionID functionId,
if (!pMethodDesc ->IsRestored())
return CORPROF_E_DATAINCOMPLETE;
-#ifdef FEATURE_CORECLR
if (g_pDebugInterface == NULL)
{
return CORPROF_E_DEBUGGING_DISABLED;
}
-#else
- // g_pDebugInterface is initialized on startup on desktop CLR, regardless of whether a debugger
- // or profiler is loaded. So it should always be available.
- _ASSERTE(g_pDebugInterface != NULL);
-#endif // FEATURE_CORECLR
COR_IL_MAP * rgNewILMapEntries = new (nothrow) COR_IL_MAP[cILMapEntries];
@@ -5181,16 +5175,10 @@ HRESULT ProfToEEInterfaceImpl::GetILToNativeMapping2(FunctionID functionId,
return E_INVALIDARG;
}
-#ifdef FEATURE_CORECLR
if (g_pDebugInterface == NULL)
{
return CORPROF_E_DEBUGGING_DISABLED;
}
-#else
- // g_pDebugInterface is initialized on startup on desktop CLR, regardless of whether a debugger
- // or profiler is loaded. So it should always be available.
- _ASSERTE(g_pDebugInterface != NULL);
-#endif // FEATURE_CORECLR
return (g_pDebugInterface->GetILToNativeMapping(pMD, cMap, pcMap, map));
#else
@@ -8681,11 +8669,7 @@ HRESULT ProfToEEInterfaceImpl::GetRuntimeInformation(USHORT * pClrInstanceId,
if (pRuntimeType != NULL)
{
-#ifdef FEATURE_CORECLR
*pRuntimeType = COR_PRF_CORE_CLR;
-#else // FEATURE_CORECLR
- *pRuntimeType = COR_PRF_DESKTOP_CLR;
-#endif // FEATURE_CORECLR
}
if (pMajorVersion != NULL)
diff --git a/src/vm/readytoruninfo.cpp b/src/vm/readytoruninfo.cpp
index a0e44ceaf3..b1be026a6c 100644
--- a/src/vm/readytoruninfo.cpp
+++ b/src/vm/readytoruninfo.cpp
@@ -491,13 +491,8 @@ PTR_ReadyToRunInfo ReadyToRunInfo::Initialize(Module * pModule, AllocMemTracker
if (!pLayout->IsNativeMachineFormat())
{
-#ifdef FEATURE_CORECLR
// For CoreCLR, be strict about disallowing machine mismatches.
COMPlusThrowHR(COR_E_BADIMAGEFORMAT);
-#else
- DoLog("Ready to Run disabled - mismatched architecture");
- return NULL;
-#endif
}
#ifdef FEATURE_NATIVE_IMAGE_GENERATION
diff --git a/src/vm/reflectclasswriter.h b/src/vm/reflectclasswriter.h
index 486a25a78f..afd33c067b 100644
--- a/src/vm/reflectclasswriter.h
+++ b/src/vm/reflectclasswriter.h
@@ -91,11 +91,6 @@ public:
m_pOnDiskEmitter = pOnDiskEmitter;
}
-#ifndef FEATURE_CORECLR
- //HRESULT EnsureCeeFileGenCreated(DWORD corhFlags = COMIMAGE_FLAGS_ILONLY, DWORD peFlags = ICEE_CREATE_FILE_PURE_IL);
- HRESULT EnsureCeeFileGenCreated(DWORD corhFlags, DWORD peFlags);
- HRESULT DestroyCeeFileGen();
-#endif
~RefClassWriter();
};
diff --git a/src/vm/reflectioninvocation.cpp b/src/vm/reflectioninvocation.cpp
index 4a2be35581..6311bdf65d 100644
--- a/src/vm/reflectioninvocation.cpp
+++ b/src/vm/reflectioninvocation.cpp
@@ -234,13 +234,6 @@ FCIMPL5(void, ReflectionInvocation::PerformVisibilityCheckOnField, FieldDesc *pF
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- // Security checks are expensive as they involve stack walking. Avoid them if we can.
- // In immersive we don't allow private reflection to framework code. So we need to perform
- // the access check even if all the domains on the stack are fully trusted.
- if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess())
- return;
-#endif
REFLECTCLASSBASEREF refDeclaringType = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(pDeclaringTypeUNSAFE);
@@ -262,9 +255,6 @@ FCIMPL5(void, ReflectionInvocation::PerformVisibilityCheckOnField, FieldDesc *pF
bool targetRemoted = FALSE;
-#ifndef FEATURE_CORECLR
- targetRemoted = targetObj != NULL && InvokeUtil::IsTargetRemoted(pFieldDesc, targetObj->GetMethodTable());
-#endif //FEATURE_CORECLR
RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetRemoted));
@@ -593,16 +583,6 @@ FCIMPL6(Object*, RuntimeTypeHandle::CreateInstance, ReflectClassBaseObject* refT
if (!securityOff)
{
-#ifndef FEATURE_CORECLR
- // Security checks are expensive as they involve stack walking. Avoid them if we can.
- // In immersive we don't allow private reflection to framework code. So we need to perform
- // the access check even if all the domains on the stack are fully trusted.
- if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess())
- {
- bNeedAccessCheck = false;
- }
- else
-#endif //FEATURE_CORECLR
{
// Public critical types cannot be accessed by transparent callers
bNeedAccessCheck = !pVMT->IsExternallyVisible() || Security::TypeRequiresTransparencyCheck(pVMT);
@@ -871,109 +851,6 @@ FCIMPL1(DWORD, ReflectionInvocation::GetSpecialSecurityFlags, ReflectMethodObjec
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-
-// Can not inline this function.
-#ifdef _MSC_VER
-__declspec(noinline)
-#endif
-void PerformSecurityCheckHelper(Object *targetUnsafe, MethodDesc *pMeth, MethodTable* pParentMT, DWORD dwFlags)
-{
- CONTRACTL {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
-
- PRECONDITION(CheckPointer(pMeth));
- }
- CONTRACTL_END;
-
- OBJECTREF target (targetUnsafe);
- GCPROTECT_BEGIN (target);
- FrameWithCookie<DebuggerSecurityCodeMarkFrame> __dbgSecFrame;
-
- bool targetRemoted = false;
-
-#ifndef FEATURE_CORECLR
- targetRemoted = target != NULL && InvokeUtil::IsTargetRemoted(pMeth, target->GetMethodTable());
-#endif //FEATURE_CORECLR
-
- RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetRemoted));
-
- MethodTable* pInstanceMT = NULL;
- if (target != NULL) {
- if (!target->GetTypeHandle().IsTypeDesc())
- pInstanceMT = target->GetTypeHandle().AsMethodTable();
- }
-
-#ifdef FEATURE_CORECLR
- if (dwFlags & (INVOCATION_FLAGS_RISKY_METHOD|INVOCATION_FLAGS_IS_DELEGATE_CTOR))
- {
- // On CoreCLR we assert that "dangerous" methods (see IsDangerousMethods) can only
- // be reflection-invoked by platform code (C or SC).
-
- // Also, for delegates, in desktop we used to demand unmanaged
- // code permission for this since it's hard to validate the target address.
- // Here we just restrict access to Critical code.
- MethodDesc *pCallerMD = sCtx.GetCallerMethod();
-
- if (pCallerMD && Security::IsMethodTransparent(pCallerMD))
- {
- ThrowMethodAccessException(pCallerMD, pMeth, FALSE, IDS_E_TRANSPARENT_REFLECTION);
- }
- }
-
- if (dwFlags & (INVOCATION_FLAGS_NEED_SECURITY|INVOCATION_FLAGS_CONSTRUCTOR_INVOKE))
-#endif
- {
-
- if (dwFlags & INVOCATION_FLAGS_CONSTRUCTOR_INVOKE)
- InvokeUtil::CanAccessMethod(pMeth,
- pParentMT,
- pInstanceMT,
- &sCtx,
- TRUE /*fCriticalToFullDemand*/);
- else
- InvokeUtil::CanAccessMethod(pMeth,
- pParentMT,
- pInstanceMT,
- &sCtx,
- TRUE /*fCriticalToFullDemand*/,
- (dwFlags & INVOCATION_FLAGS_IS_CTOR) != 0 /*checkSkipVer*/);
- }
-
- __dbgSecFrame.Pop();
- GCPROTECT_END();
-}
-
-FCIMPL4(void, ReflectionInvocation::PerformSecurityCheck, Object *target, MethodDesc *pMeth, ReflectClassBaseObject *pParentUNSAFE, DWORD dwFlags) {
- CONTRACTL {
- FCALL_CHECK;
- PRECONDITION(CheckPointer(pMeth));
- }
- CONTRACTL_END;
-
-#ifndef FEATURE_CORECLR
- // Security checks are expensive as they involve stack walking. Avoid them if we can.
- // In immersive we don't allow private reflection to framework code. So we need to perform
- // the access check even if all the domains on the stack are fully trusted.
- if (Security::AllDomainsOnStackFullyTrusted() && !AppX::IsAppXProcess())
- return;
-#endif
-
- REFLECTCLASSBASEREF refParent = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(pParentUNSAFE);
-
- HELPER_METHOD_FRAME_BEGIN_1(refParent);
- //CAUTION: PerformSecurityCheckHelper could trigger GC!
-
- TypeHandle parent = refParent != NULL ? refParent->GetType() : TypeHandle();
- PerformSecurityCheckHelper(target,pMeth,parent.GetMethodTable(),dwFlags);
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-#endif // FEATURE_CORECLR
/****************************************************************************/
/* boxed Nullable<T> are represented as a boxed T, so there is no unboxed
@@ -1207,9 +1084,7 @@ void DECLSPEC_NORETURN ThrowInvokeMethodException(MethodDesc * pMethod, OBJECTRE
GCPROTECT_BEGIN(targetException);
#if defined(_DEBUG) && !defined(FEATURE_PAL)
-#ifdef FEATURE_CORECLR
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
if (!CLRException::IsPreallocatedExceptionObject(targetException))
{
@@ -1258,9 +1133,7 @@ void DECLSPEC_NORETURN ThrowInvokeMethodException(MethodDesc * pMethod, OBJECTRE
OBJECTREF except = InvokeUtil::CreateTargetExcept(&targetException);
#ifndef FEATURE_PAL
-#ifdef FEATURE_CORECLR
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
struct
{
@@ -1961,9 +1834,6 @@ FCIMPL4(Object*, RuntimeFieldHandle::GetValueDirect, ReflectFieldObject *pFieldU
bool targetRemoted = false;
-#ifndef FEATURE_CORECLR
- targetRemoted = !targetType.IsNull() && InvokeUtil::IsTargetRemoted(pField, targetType.AsMethodTable());
-#endif //FEATURE_CORECLR
RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetRemoted));
@@ -2144,9 +2014,6 @@ FCIMPL5(void, RuntimeFieldHandle::SetValueDirect, ReflectFieldObject *pFieldUNSA
// security and consistency checks
bool targetRemoted = false;
-#ifndef FEATURE_CORECLR
- targetRemoted = targetType.IsNull() && InvokeUtil::IsTargetRemoted(pField, targetType.AsMethodTable());
-#endif //FEATURE_CORECLR
RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType(targetRemoted));
@@ -2344,10 +2211,8 @@ FCIMPL1(void, ReflectionInvocation::RunClassConstructor, ReflectClassBaseObject
HELPER_METHOD_FRAME_BEGIN_1(refType);
// We perform the access check only on CoreCLR for backward compatibility.
-#ifdef FEATURE_CORECLR
RefSecContext sCtx(InvokeUtil::GetInvocationAccessCheckType());
InvokeUtil::CanAccessClass(&sCtx, pMT);
-#endif //FEATURE_CORECLR
pMT->CheckRestore();
pMT->EnsureInstanceActive();
@@ -2389,116 +2254,6 @@ FCIMPL1(void, ReflectionInvocation::RunModuleConstructor, ReflectModuleBaseObjec
}
FCIMPLEND
-#ifndef FEATURE_CORECLR
-// This method triggers a given method to be jitted
-FCIMPL3(void, ReflectionInvocation::PrepareMethod, ReflectMethodObject* pMethodUNSAFE, TypeHandle *pInstantiation, UINT32 cInstantiation)
-{
- CONTRACTL {
- FCALL_CHECK;
- PRECONDITION(CheckPointer(pMethodUNSAFE, NULL_OK));
- PRECONDITION(CheckPointer(pInstantiation, NULL_OK));
- }
- CONTRACTL_END;
-
- REFLECTMETHODREF refMethod = (REFLECTMETHODREF)ObjectToOBJECTREF(pMethodUNSAFE);
-
- if (refMethod == NULL)
- FCThrowArgumentVoidEx(kArgumentException, NULL, W("InvalidOperation_HandleIsNotInitialized"));
-
- MethodDesc *pMD = refMethod->GetMethod();
-
- HELPER_METHOD_FRAME_BEGIN_1(refMethod);
-
- if (pMD->IsAbstract())
- COMPlusThrowArgumentNull(W("method"), W("Argument_CannotPrepareAbstract"));
-
- pMD->CheckRestore();
-
- MethodTable * pExactMT = pMD->GetMethodTable();
- if (pInstantiation != NULL)
- {
- // We were handed an instantiation, check that the method expects it and the right number of types has been provided (the
- // caller supplies one array containing the class instantiation immediately followed by the method instantiation).
- if (cInstantiation != (pMD->GetNumGenericMethodArgs() + pMD->GetNumGenericClassArgs()))
- COMPlusThrow(kArgumentException, W("Argument_InvalidGenericInstantiation"));
-
- // We need to find the actual class and/or method instantiations, even though we've been passed them. This is an issue of
- // lifetime -- the instantiation passed in will go away at some point whereas preparation of the method has the potential to
- // persist a copy of the instantiation pointer. By finding the actual instantiation we get a stable pointer whose lifetime
- // is at least as long as the data generated by preparation.
-
- // Check we've got a reasonable looking instantiation.
- if (!Generics::CheckInstantiation(Instantiation(pInstantiation, cInstantiation)))
- COMPlusThrow(kArgumentException, W("Argument_InvalidGenericInstantiation"));
- for (ULONG i = 0; i < cInstantiation; i++)
- if (pInstantiation[i].ContainsGenericVariables())
- COMPlusThrow(kArgumentException, W("Argument_InvalidGenericInstantiation"));
-
- // Load the exact type of the method if it needs to be instantiated (because it's a generic type definition, e.g. C<T>, or a
- // shared type instantiation, e.g. C<Object>).
- if (pExactMT->IsGenericTypeDefinition() || pExactMT->IsSharedByGenericInstantiations())
- {
- TypeHandle thExactType = ClassLoader::LoadGenericInstantiationThrowing(pMD->GetModule(),
- pMD->GetMethodTable()->GetCl(),
- Instantiation(pInstantiation, pMD->GetNumGenericClassArgs()));
- pExactMT = thExactType.AsMethodTable();
- }
-
- // As for the class we might need to find a method desc with an exact instantiation if the one we have is too vague.
- // Note: IsGenericMethodDefinition implies ContainsGenericVariables so there's no need to check it separately.
- if (pMD->IsSharedByGenericInstantiations() || pMD->ContainsGenericVariables())
- pMD = MethodDesc::FindOrCreateAssociatedMethodDesc(pMD,
- pExactMT,
- FALSE,
- Instantiation(&pInstantiation[pMD->GetNumGenericClassArgs()], pMD->GetNumGenericMethodArgs()),
- FALSE);
- }
- else
- {
- // No instantiation provided, the method better not be expecting one.
-
- // Methods that are generic definitions (e.g. C.Foo<U>) and those that are shared (e.g. C<Object>.Foo, C.Foo<Object>) need
- // extra instantiation data.
- // Note: IsGenericMethodDefinition implies ContainsGenericVariables so there's no need to check it separately.
- if (pMD->IsSharedByGenericInstantiations() || pMD->ContainsGenericVariables())
- COMPlusThrow(kArgumentException, W("Argument_InvalidGenericInstantiation"));
-
- // The rest of the cases (non-generics related methods, instantiating stubs, methods instantiated over non-shared types
- // etc.) should be able to provide their instantiation for us as necessary.
- }
-
- // Go prepare the method at the specified instantiation.
- PrepareMethodDesc(pMD, pExactMT->GetInstantiation(), pMD->GetMethodInstantiation());
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-// This method triggers a given delegate to be prepared. This involves preparing the
-// delegate's Invoke method and preparing the target of that Invoke. In the case of
-// a multi-cast delegate, we rely on the fact that each individual component was prepared
-// prior to the Combine. If our event sinks perform the Combine, this is always true.
-// If the client calls Combine himself, he is responsible for his own preparation.
-FCIMPL1(void, ReflectionInvocation::PrepareDelegate, Object* delegateUNSAFE)
-{
- CONTRACTL {
- FCALL_CHECK;
- PRECONDITION(CheckPointer(delegateUNSAFE, NULL_OK));
- }
- CONTRACTL_END;
-
- if (delegateUNSAFE == NULL)
- return;
-
- OBJECTREF delegate = ObjectToOBJECTREF(delegateUNSAFE);
- HELPER_METHOD_FRAME_BEGIN_1(delegate);
-
- PrepareDelegateHelper(&delegate, FALSE);
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL1(void, ReflectionInvocation::PrepareContractedDelegate, Object * delegateUNSAFE)
{
diff --git a/src/vm/reflectioninvocation.h b/src/vm/reflectioninvocation.h
index 7f72b61cd8..a05a202e87 100644
--- a/src/vm/reflectioninvocation.h
+++ b/src/vm/reflectioninvocation.h
@@ -50,10 +50,6 @@ public:
static FCDECL1(void, RunClassConstructor, ReflectClassBaseObject *pTypeUNSAFE);
static FCDECL1(void, RunModuleConstructor, ReflectModuleBaseObject *pModuleUNSAFE);
-#ifndef FEATURE_CORECLR
- static FCDECL3(void, PrepareMethod, ReflectMethodObject* pMethodUNSAFE, TypeHandle *pInstantiation, UINT32 cInstantiation);
- static FCDECL1(void, PrepareDelegate, Object* delegateUNSAFE);
-#endif // !FEATURE_CORECLR
static FCDECL1(void, PrepareContractedDelegate, Object* delegateUNSAFE);
static FCDECL0(void, ProbeForSufficientStack);
static FCDECL0(void, EnsureSufficientExecutionStack);
diff --git a/src/vm/rejit.cpp b/src/vm/rejit.cpp
index 0b6e922831..7bbd0e2f71 100644
--- a/src/vm/rejit.cpp
+++ b/src/vm/rejit.cpp
@@ -447,16 +447,10 @@ HRESULT ProfilerFunctionControl::SetILInstrumentedCodeMap(ULONG cILMapEntries, C
return E_INVALIDARG;
}
-#ifdef FEATURE_CORECLR
if (g_pDebugInterface == NULL)
{
return CORPROF_E_DEBUGGING_DISABLED;
}
-#else
- // g_pDebugInterface is initialized on startup on desktop CLR, regardless of whether a debugger
- // or profiler is loaded. So it should always be available.
- _ASSERTE(g_pDebugInterface != NULL);
-#endif // FEATURE_CORECLR
// copy the il map and il map entries into the corresponding fields.
diff --git a/src/vm/rexcep.h b/src/vm/rexcep.h
index 3ff4963996..2089c27172 100644
--- a/src/vm/rexcep.h
+++ b/src/vm/rexcep.h
@@ -109,12 +109,8 @@
//
DEFINE_EXCEPTION(g_ReflectionNS, AmbiguousMatchException, false, COR_E_AMBIGUOUSMATCH)
-#ifdef FEATURE_CORECLR
// ApplicationException is removed in CoreCLR
#define kApplicationException kException
-#else
-DEFINE_EXCEPTION(g_SystemNS, ApplicationException, false, COR_E_APPLICATION)
-#endif // FEATURE_CORECLR
DEFINE_EXCEPTION(g_SystemNS, AppDomainUnloadedException, false, COR_E_APPDOMAINUNLOADED)
DEFINE_EXCEPTION(g_SystemNS, ArithmeticException, false, COR_E_ARITHMETIC)
@@ -142,12 +138,8 @@ DEFINE_EXCEPTION(g_SystemNS, BadImageFormatException, true,
META_E_BAD_SIGNATURE,
COR_E_LOADING_WINMD_REFERENCE_ASSEMBLY)
-#ifdef FEATURE_CORECLR
// CannotUnloadAppDomainException is removed in CoreCLR
#define kCannotUnloadAppDomainException kException
-#else
-DEFINE_EXCEPTION(g_SystemNS, CannotUnloadAppDomainException, false, COR_E_CANNOTUNLOADAPPDOMAIN)
-#endif // FEATURE_CORECLR
DEFINE_EXCEPTION(g_CodeContractsNS, ContractException, false, COR_E_CODECONTRACTFAILED)
@@ -160,9 +152,6 @@ DEFINE_EXCEPTION(g_ReflectionNS, CustomAttributeFormatException, false, C
#if defined(FEATURE_X509) || defined(FEATURE_CRYPTO)
DEFINE_EXCEPTION(g_CryptographyNS, CryptographicException, false, CORSEC_E_CRYPTO)
#endif // FEATURE_X509 || FEATURE_CRYPTO
-#ifndef FEATURE_CORECLR
-DEFINE_EXCEPTION(g_CryptographyNS, CryptographicUnexpectedOperationException, false, CORSEC_E_CRYPTO_UNEX_OPER)
-#endif // FEATURE_CORECLR
DEFINE_EXCEPTION(g_SystemNS, DataMisalignedException, false, COR_E_DATAMISALIGNED)
@@ -327,9 +316,7 @@ DEFINE_EXCEPTION(g_SystemNS, NotImplementedException, false, E
DEFINE_EXCEPTION(g_SystemNS, OutOfMemoryException, false, E_OUTOFMEMORY, CTL_E_OUTOFMEMORY, STD_CTL_SCODE(31001))
-#ifdef FEATURE_CORECLR
DEFINE_EXCEPTION(g_SystemNS, CrossAppDomainMarshaledException, false, E_FAIL)
-#endif //FEATURE_CORECLR
#ifdef FEATURE_ISOSTORE
DEFINE_EXCEPTION(g_IsolatedStorageNS, IsolatedStorageException, true,
diff --git a/src/vm/runtimecallablewrapper.cpp b/src/vm/runtimecallablewrapper.cpp
index 29999a7dad..dace892bf7 100644
--- a/src/vm/runtimecallablewrapper.cpp
+++ b/src/vm/runtimecallablewrapper.cpp
@@ -541,49 +541,9 @@ IClassFactory *ComClassFactory::GetIClassFactory()
StackSString ssServer;
if (FAILED(Clr::Util::Com::FindServerUsingCLSID(m_rclsid, ssServer)))
{
-#ifndef FEATURE_CORECLR
- // If there is no server entry, then that implies the CLSID could be implemented by CLR.DLL itself,
- // if the CLSID is one of the special ones implemented by the CLR. We need to check against the
- // specific list of CLSIDs here because CLR.DLL-implemented CLSIDs and managed class-implemented
- // CLSIDs look the same until you start interating the subkeys. For now, the set of CLSIDs implemented
- // by CLR.DLL is a short and tractable list, but at some point it might become worthwhile to move over
- // to the more generalized solution of looking for the entries that identify when the CLSID is
- // implemented by a managed type to avoid having to maintain the hardcoded list.
- if (IsClrHostedLegacyComObject(m_rclsid))
- {
- PDllGetClassObject pFN = NULL;
- hr = g_pCLRRuntime->GetProcAddress("DllGetClassObjectInternal", reinterpret_cast<void**>(&pFN));
-
- if (FAILED(hr))
- hr = g_pCLRRuntime->GetProcAddress("DllGetClassObject", reinterpret_cast<void**>(&pFN));
-
- if (SUCCEEDED(hr))
- hr = pFN(m_rclsid, IID_IClassFactory, (void**)&pClassFactory);
- }
-#endif
}
else
{
-#ifndef FEATURE_CORECLR
- // @CORESYSTODO: ?
-
- // There is a SxS DLL that implements this CLSID.
- // NOTE: It is standard practise for RCWs and P/Invokes to leak their module handles,
- // as there is no automated mechanism for the runtime to call CanUnloadDllNow.
- HMODULE hServer = NULL;
- if (SUCCEEDED(hr = g_pCLRRuntime->LoadLibrary(ssServer.GetUnicode(), &hServer)))
- {
- PDllGetClassObject pFN = reinterpret_cast<PDllGetClassObject>(GetProcAddress(hServer, "DllGetClassObject"));
- if (pFN != NULL)
- {
- hr = pFN(m_rclsid, IID_IClassFactory, (void**)&pClassFactory);
- }
- else
- {
- hr = HRESULT_FROM_GetLastError();
- }
- }
-#endif
}
}
#endif // FEATURE_CLASSIC_COMINTEROP
@@ -3107,12 +3067,10 @@ IUnknown *RCW::GetWellKnownInterface(REFIID riid)
// make sure it is on the right thread
IDispatch *RCW::GetIDispatch()
{
-#ifdef FEATURE_CORECLR
if (AppX::IsAppXProcess())
{
COMPlusThrow(kPlatformNotSupportedException, IDS_EE_ERROR_IDISPATCH);
}
-#endif // FEATURE_CORECLR
WRAPPER_NO_CONTRACT;
return (IDispatch *)GetWellKnownInterface(IID_IDispatch);
@@ -4574,9 +4532,7 @@ bool RCW::SupportsMngStdInterface(MethodTable *pItfMT)
if (pItfMT == MscorlibBinder::GetExistingClass(CLASS__IENUMERABLE))
{
SafeComHolder<IDispatch> pDisp = NULL;
-#ifdef FEATURE_CORECLR
if (!AppX::IsAppXProcess())
-#endif // FEATURE_CORECLR
{
// Get the IDispatch on the current thread.
pDisp = GetIDispatch();
diff --git a/src/vm/runtimehandles.cpp b/src/vm/runtimehandles.cpp
index 65aeb45f97..32a9674da5 100644
--- a/src/vm/runtimehandles.cpp
+++ b/src/vm/runtimehandles.cpp
@@ -352,13 +352,6 @@ FCIMPL3(void, RuntimeMethodHandle::CheckLinktimeDemands, ReflectMethodObject *pM
}
}
-#ifndef FEATURE_CORECLR
- if (pCallee->RequiresLinktimeCheck())
- {
- Module *pModule = refModule->GetModule();
- Security::LinktimeCheckMethod(pDecoratedModule->GetAssembly(), pCallee);
- }
-#endif // !FEATURE_CORECLR
}
HELPER_METHOD_FRAME_END();
}
@@ -568,43 +561,6 @@ FCIMPLEND
-#ifndef FEATURE_CORECLR
-FCIMPL2(FC_BOOL_RET, RuntimeTypeHandle::IsEquivalentTo, ReflectClassBaseObject *rtType1UNSAFE, ReflectClassBaseObject *rtType2UNSAFE)
-{
- FCALL_CONTRACT;
-
- BOOL bResult = FALSE;
-
- REFLECTCLASSBASEREF rtType1 = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(rtType1UNSAFE);
- REFLECTCLASSBASEREF rtType2 = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(rtType2UNSAFE);
-
- HELPER_METHOD_FRAME_BEGIN_RET_2(rtType1, rtType2);
- if (rtType1 == NULL)
- COMPlusThrowArgumentNull(W("rtType1"));
- if (rtType2 == NULL)
- COMPlusThrowArgumentNull(W("rtType2"));
-
- bResult = rtType1->GetType().IsEquivalentTo(rtType2->GetType());
- HELPER_METHOD_FRAME_END();
-
- FC_RETURN_BOOL(bResult);
-}
-FCIMPLEND
-
-FCIMPL1(FC_BOOL_RET, RuntimeTypeHandle::IsEquivalentType, ReflectClassBaseObject *rtTypeUNSAFE)
-{
- FCALL_CONTRACT;
-
- BOOL bResult = FALSE;
-
- TypeHandle typeHandle = rtTypeUNSAFE->GetType();
- if (!typeHandle.IsTypeDesc())
- bResult = typeHandle.AsMethodTable()->GetClass()->IsEquivalentType();
-
- FC_RETURN_BOOL(bResult);
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
FCIMPL1(FC_BOOL_RET, RuntimeTypeHandle::IsWindowsRuntimeObjectType, ReflectClassBaseObject *rtTypeUNSAFE)
diff --git a/src/vm/runtimehandles.h b/src/vm/runtimehandles.h
index e203bd02ba..bd3dc49f88 100644
--- a/src/vm/runtimehandles.h
+++ b/src/vm/runtimehandles.h
@@ -158,10 +158,6 @@ public:
static FCDECL2(FC_BOOL_RET, TypeEQ, Object* left, Object* right);
static FCDECL2(FC_BOOL_RET, TypeNEQ, Object* left, Object* right);
-#ifndef FEATURE_CORECLR
- static FCDECL2(FC_BOOL_RET, IsEquivalentTo, ReflectClassBaseObject *rtType1UNSAFE, ReflectClassBaseObject *rtType2UNSAFE);
- static FCDECL1(FC_BOOL_RET, IsEquivalentType, ReflectClassBaseObject *rtTypeUNSAFE);
-#endif // !FEATURE_CORECLR
#ifdef FEATURE_COMINTEROP
static FCDECL1(FC_BOOL_RET, IsWindowsRuntimeObjectType, ReflectClassBaseObject *rtTypeUNSAFE);
diff --git a/src/vm/security.cpp b/src/vm/security.cpp
index 95c16bf5cd..2afb946467 100644
--- a/src/vm/security.cpp
+++ b/src/vm/security.cpp
@@ -41,31 +41,13 @@ void Security::DeleteSharedSecurityDescriptor(ISharedSecurityDescriptor *descrip
delete static_cast<SharedSecurityDescriptor *>(descriptor);
}
-#ifndef FEATURE_CORECLR
-IPEFileSecurityDescriptor* Security::CreatePEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile)
-{
- WRAPPER_NO_CONTRACT;
-
- return static_cast<IPEFileSecurityDescriptor*>(new PEFileSecurityDescriptor(pDomain, pPEFile));
-}
-#endif
BOOL Security::IsTransparencyEnforcementEnabled()
{
LIMITED_METHOD_CONTRACT;
-#ifdef FEATURE_CORECLR
// No transparency enforcement in .NET Core
return FALSE;
-#else
-
-#ifdef _DEBUG
- if (g_pConfig->DisableTransparencyEnforcement())
- return FALSE;
-#endif
-
- return TRUE;
-#endif // FEATURE_CORECLR
}
//---------------------------------------------------------------------------------------
diff --git a/src/vm/security.h b/src/vm/security.h
index 9b87d98f28..2f91e66aba 100644
--- a/src/vm/security.h
+++ b/src/vm/security.h
@@ -160,9 +160,6 @@ namespace Security
IAssemblySecurityDescriptor* CreateAssemblySecurityDescriptor(AppDomain *pDomain, DomainAssembly *pAssembly, LoaderAllocator *pLoaderAllocator);
ISharedSecurityDescriptor* CreateSharedSecurityDescriptor(Assembly* pAssembly);
void DeleteSharedSecurityDescriptor(ISharedSecurityDescriptor *descriptor);
-#ifndef FEATURE_CORECLR
- IPEFileSecurityDescriptor* CreatePEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile);
-#endif
inline void SetDefaultAppDomainProperty(IApplicationSecurityDescriptor* pASD);
inline void SetDefaultAppDomainEvidenceProperty(IApplicationSecurityDescriptor* pASD);
@@ -326,9 +323,6 @@ public:
virtual void PropagatePermissionSet(OBJECTREF GrantedPermissionSet, OBJECTREF DeniedPermissionSet, DWORD dwSpecialFlags) = 0;
-#ifndef FEATURE_CORECLR
- virtual BOOL AllowApplicationSpecifiedAppDomainManager() = 0;
-#endif
// Check to make sure that security will allow this assembly to load. Throw an exception if the
// assembly should be forbidden from loading for security related purposes
@@ -345,13 +339,6 @@ public:
virtual Assembly* GetAssembly() = 0;
};
-#ifndef FEATURE_CORECLR
-class IPEFileSecurityDescriptor : public ISecurityDescriptor
-{
-public:
- virtual BOOL AllowBindingRedirects() = 0;
-};
-#endif
#include "security.inl"
#include "securitydeclarative.inl"
diff --git a/src/vm/security.inl b/src/vm/security.inl
index aa8c57087b..0d5bf24019 100644
--- a/src/vm/security.inl
+++ b/src/vm/security.inl
@@ -538,43 +538,8 @@ inline BOOL Security::CanSkipVerification(MethodDesc * pMD)
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// Always skip verification on CoreCLR
return TRUE;
-#else
-
- // Special case the System.Object..ctor:
- // System.Object..ctor is not verifiable according to current verifier rules (that require to call the base
- // class ctor). But since we want System.Object..ctor() to be marked transparent, it cannot be unverifiable
- // (v4 security rules prohibit transparent code from being unverifiable)
-
-#ifndef DACCESS_COMPILE
- if (g_pObjectCtorMD == pMD)
- return TRUE;
-#endif
-
- // In AppX, all dynamic code (dynamic assemblies and dynamic methods) should be verified..
- if (AppX::IsAppXProcess() && !AppX::IsAppXDesignMode())
- {
- if (pMD->IsLCGMethod() || pMD->GetAssembly()->IsDynamic())
- return FALSE;
- }
-
- BOOL fCanSkipVerification = Security::CanSkipVerification(pMD->GetAssembly()->GetDomainAssembly());
- if (fCanSkipVerification)
- {
- // check for transparency
- if (SecurityTransparent::IsMethodTransparent(pMD))
- {
- ModuleSecurityDescriptor *pModuleSecDesc = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pMD->GetAssembly());
- if (!pModuleSecDesc->CanTransparentCodeSkipVerification())
- {
- return FALSE;
- }
- }
- }
- return fCanSkipVerification;
-#endif // !FEATURE_CORECLR
}
#endif //!DACCESS_COMPILE
diff --git a/src/vm/securitydeclarative.cpp b/src/vm/securitydeclarative.cpp
index 0cff572d42..3fd96d56dc 100644
--- a/src/vm/securitydeclarative.cpp
+++ b/src/vm/securitydeclarative.cpp
@@ -269,14 +269,7 @@ DeclActionInfo* SecurityDeclarative::DetectDeclActions(MethodDesc *pMeth, DWORD
if (pClass->HasSuppressUnmanagedCodeAccessAttr())
{
-#ifdef FEATURE_CORECLR
hr = S_OK;
-#else
- hr = pInternalImport->GetCustomAttributeByName(pMT->GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL);
-#endif // FEATURE_CORECLR
if (hr != S_OK)
{
g_IBCLogger.LogEEClassCOWTableAccess(pMT);
@@ -536,15 +529,7 @@ HRESULT SecurityDeclarative::GetDeclarationFlags(IMDInternalImport *pInternalImp
BOOL hasSuppressUnmanagedCodeAccessAttr;
if (pfHasSuppressUnmanagedCodeAccessAttr == NULL)
{
-#ifdef FEATURE_CORECLR
hasSuppressUnmanagedCodeAccessAttr = TRUE;
-#else
- hasSuppressUnmanagedCodeAccessAttr =
- (pInternalImport->GetCustomAttributeByName(token,
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK);
-#endif
}
else
hasSuppressUnmanagedCodeAccessAttr = *pfHasSuppressUnmanagedCodeAccessAttr;
@@ -1049,29 +1034,6 @@ void SecurityDeclarative::CheckLinkDemandAgainstAppDomain(MethodDesc *pMD)
if (gc.refMethodNonCasDemands != NULL)
CheckNonCasDemand(&gc.refMethodNonCasDemands);
-#ifndef FEATURE_CORECLR
- // On CORECLR, we do this from the JIT callouts if the caller is transparent: if caller is critical, no checks needed
-
- // We perform automatic linktime checks for UnmanagedCode in three cases:
- // o P/Invoke calls (shouldn't get these here, but let's be paranoid).
- // o Calls through an interface that have a suppress runtime check
- // attribute on them (these are almost certainly interop calls).
- // o Interop calls made through method impls.
- // Just walk the stack in these cases, they'll be extremely rare and the
- // perf delta isn't that huge.
- if (pMD->IsNDirect() ||
- (pMD->IsInterface() &&
- (pMD->GetMDImport()->GetCustomAttributeByName(pMD->GetMethodTable()->GetCl(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK ||
- pMD->GetMDImport()->GetCustomAttributeByName(pMD->GetMemberDef(),
- COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI,
- NULL,
- NULL) == S_OK) ) ||
- (pMD->IsComPlusCall() && !pMD->IsInterface()))
- SecurityStackWalk::SpecialDemand(SSWT_LATEBOUND_LINKDEMAND, SECURITY_UNMANAGED_CODE);
-#endif // FEATURE_CORECLR
GCPROTECT_END();
}
diff --git a/src/vm/securitydescriptor.cpp b/src/vm/securitydescriptor.cpp
index a14095a981..d8af752e2e 100644
--- a/src/vm/securitydescriptor.cpp
+++ b/src/vm/securitydescriptor.cpp
@@ -270,157 +270,5 @@ OBJECTREF PEFileSecurityDescriptor::BuildEvidence(PEFile *pPEFile, const OBJECTR
#endif // FEATURE_CAS_POLICY
-#ifndef FEATURE_CORECLR
-BOOL PEFileSecurityDescriptor::QuickIsFullyTrusted()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- }
- CONTRACTL_END;
-
-#ifdef CROSSGEN_COMPILE
- return TRUE;
-#else
- if (!m_pAppDomain->GetSecurityDescriptor()->IsLegacyCasPolicyEnabled())
- {
- return TRUE;
- }
- else if (m_pAppDomain->IsCompilationDomain())
- {
- return TRUE;
- }
- else
- {
- return CheckQuickCache(SecurityConfig::FullTrustAll, GetZone());
- }
-#endif
-}
-
-#ifndef CROSSGEN_COMPILE
-//---------------------------------------------------------------------------------------
-//
-// Get the evidence for this PE file
-//
-
-OBJECTREF PEFileSecurityDescriptor::GetEvidence()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- PRECONDITION(m_pAppDomain == GetAppDomain());
- INJECT_FAULT(COMPlusThrowOM());
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- // If we already have evidence, then just return that
- if (IsEvidenceComputed())
- return ObjectFromLazyHandle(m_hAdditionalEvidence, m_pLoaderAllocator);
-
- struct
- {
- OBJECTREF objHostProvidedEvidence;
- OBJECTREF objEvidence;
- }
- gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
- BEGIN_SO_INTOLERANT_CODE(GetThread());
-
-#if CHECK_APP_DOMAIN_LEAKS
- if (g_pConfig->AppDomainLeaks())
- _ASSERTE(gc.objHostProvidedEvidence == NULL || GetAppDomain() == gc.objHostProvidedEvidence->GetAppDomain());
-#endif // CHECK_APP_DOMAIN_LEAKS
-
- gc.objHostProvidedEvidence = ObjectFromLazyHandle(m_hAdditionalEvidence, m_pLoaderAllocator);
- gc.objEvidence = PEFileSecurityDescriptor::BuildEvidence(m_pPEFile, gc.objHostProvidedEvidence);
- SetEvidence(gc.objEvidence);
-
-#if CHECK_APP_DOMAIN_LEAKS
- if (g_pConfig->AppDomainLeaks())
- _ASSERTE(gc.objEvidence == NULL || GetAppDomain() == gc.objEvidence->GetAppDomain());
-#endif // CHECK_APP_DOMAIN_LEAKS
-
- END_SO_INTOLERANT_CODE;
-
- GCPROTECT_END();
-
- return gc.objEvidence;
-}
-
-DWORD PEFileSecurityDescriptor::GetZone()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- PRECONDITION(m_pAppDomain->GetSecurityDescriptor()->IsLegacyCasPolicyEnabled());
- }
- CONTRACTL_END;
-
- SecZone dwZone = NoZone;
- BEGIN_SO_INTOLERANT_CODE(GetThread());
-
- StackSString codebase;
- BYTE rbUniqueID[MAX_SIZE_SECURITY_ID];
- DWORD cbUniqueID = sizeof(rbUniqueID);
-
- m_pPEFile->GetSecurityIdentity(codebase, &dwZone, 0, rbUniqueID, &cbUniqueID);
- END_SO_INTOLERANT_CODE;
- return dwZone;
-}
-#endif // !CROSSGEN_COMPILE
-
-void PEFileSecurityDescriptor::Resolve()
-{
- CONTRACTL {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- INJECT_FAULT(COMPlusThrowOM(););
- } CONTRACTL_END;
-
- if (IsResolved())
- return;
- ResolveWorker();
-}
-
-void PEFileSecurityDescriptor::ResolveWorker()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- SetGrantedPermissionSet(NULL, NULL, 0xFFFFFFFF);
-}
-
-BOOL PEFileSecurityDescriptor::AllowBindingRedirects()
-{
- CONTRACTL {
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- PRECONDITION(IsResolved());
- } CONTRACTL_END;
-
- ETWOnStartup (AllowBindingRedirs_V1, AllowBindingRedirsEnd_V1);
-
- return CheckSpecialFlag(1 << SECURITY_BINDING_REDIRECTS);
-}
-
-#endif // FEATURE_CORECLR
#endif // !DACCESS_COMPILE
diff --git a/src/vm/securitydescriptor.h b/src/vm/securitydescriptor.h
index 06c096f4ee..26e46633dc 100644
--- a/src/vm/securitydescriptor.h
+++ b/src/vm/securitydescriptor.h
@@ -168,32 +168,6 @@ public:
#endif
};
-#ifndef FEATURE_CORECLR
-class PEFileSecurityDescriptor : public SecurityDescriptorBase<IPEFileSecurityDescriptor>
-{
-public:
- virtual BOOL AllowBindingRedirects();
- BOOL QuickIsFullyTrusted();
- virtual VOID Resolve();
-
-#ifndef DACCESS_COMPILE
- inline PEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile);
-#endif
-
-#ifdef FEATURE_CAS_POLICY
- virtual OBJECTREF GetEvidence();
- DWORD GetZone();
-#endif // FEATURE_CAS_POLICY
-
-
-#ifdef FEATURE_CAS_POLICY
- static
- OBJECTREF BuildEvidence(PEFile *pPEFile, const OBJECTREF& objHostSuppliedEvidence);
-#endif // FEATURE_CAS_POLICY
-private:
- VOID ResolveWorker();
-};
-#endif // !FEATURE_CORECLR
#include "securitydescriptor.inl"
diff --git a/src/vm/securitydescriptor.inl b/src/vm/securitydescriptor.inl
index 8d571f9fa1..8351389ef4 100644
--- a/src/vm/securitydescriptor.inl
+++ b/src/vm/securitydescriptor.inl
@@ -94,16 +94,5 @@ inline SecurityDescriptorBase<IT>::SecurityDescriptorBase(AppDomain *pAppDomain,
}
#endif // !DACCESS_COMPILE
-#ifndef FEATURE_CORECLR
-
-#ifndef DACCESS_COMPILE
-inline PEFileSecurityDescriptor::PEFileSecurityDescriptor(AppDomain* pDomain, PEFile *pPEFile) :
- SecurityDescriptorBase<IPEFileSecurityDescriptor>(pDomain, NULL,pPEFile, pDomain->GetLoaderAllocator())
-{
- LIMITED_METHOD_CONTRACT
-}
-#endif // !DACCESS_COMPILE
-
-#endif // !FEATURE_CORECLR
#endif // #define __SECURITYDESCRIPTOR_INL__
diff --git a/src/vm/securitydescriptorappdomain.cpp b/src/vm/securitydescriptorappdomain.cpp
index a09276bf20..e50db588f0 100644
--- a/src/vm/securitydescriptorappdomain.cpp
+++ b/src/vm/securitydescriptorappdomain.cpp
@@ -321,9 +321,6 @@ BOOL ApplicationSecurityDescriptor::IsDefaultAppDomain() const
{
LIMITED_METHOD_CONTRACT;
return m_fIsDefaultAppdomain
-#ifndef FEATURE_CORECLR
- && !m_fHomogeneous
-#endif // FEATURE_CORECLR
;
}
diff --git a/src/vm/securitydescriptorassembly.cpp b/src/vm/securitydescriptorassembly.cpp
index 715d956123..be9e70e5aa 100644
--- a/src/vm/securitydescriptorassembly.cpp
+++ b/src/vm/securitydescriptorassembly.cpp
@@ -613,15 +613,6 @@ OBJECTREF AssemblySecurityDescriptor::GetAdditionalEvidence()
}
#endif // FEATURE_CAS_POLICY
-#ifndef FEATURE_CORECLR
-BOOL AssemblySecurityDescriptor::AllowApplicationSpecifiedAppDomainManager()
-{
- WRAPPER_NO_CONTRACT;
-
- // Only fully trusted assemblies are allowed to specify their AppDomainManager in a config file
- return this->IsFullyTrusted();
-}
-#endif // FEATURE_CORECLR
// Check to make sure that security will allow this assembly to load. Throw an exception if the assembly
// should be forbidden from loading for security related purposes
diff --git a/src/vm/securitydescriptorassembly.h b/src/vm/securitydescriptorassembly.h
index 1db30bb13e..68023d670b 100644
--- a/src/vm/securitydescriptorassembly.h
+++ b/src/vm/securitydescriptorassembly.h
@@ -123,9 +123,6 @@ public:
#endif // !DACCESS_COMPILE
#endif // FEATURE_CAS_POLICY
-#ifndef FEATURE_CORECLR
- virtual BOOL AllowApplicationSpecifiedAppDomainManager();
-#endif // !FEATURE_CORECLR
virtual void CheckAllowAssemblyLoad();
diff --git a/src/vm/securitymeta.cpp b/src/vm/securitymeta.cpp
index 3101416bae..dcb2eb765f 100644
--- a/src/vm/securitymeta.cpp
+++ b/src/vm/securitymeta.cpp
@@ -56,9 +56,6 @@ void FieldSecurityDescriptor::VerifyDataComputed()
return;
}
-#ifndef FEATURE_CORECLR
- FieldSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
// If we've setup a breakpoint when we compute the transparency of this field, then stop in the debugger
@@ -283,9 +280,6 @@ void MethodSecurityDescriptor::ComputeCriticalTransparentInfo()
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- MethodSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
MethodTable* pMT = m_pMD->GetMethodTable();
@@ -739,72 +733,6 @@ void MethodSecurityDescriptor::InvokeInheritanceChecks(MethodDesc *pChildMD)
}
}
-#ifndef FEATURE_CORECLR
- // Check CAS Inheritance
-
- // Early out if we're fully trusted
- if (SecurityDeclarative::FullTrustCheckForLinkOrInheritanceDemand(pChildMD->GetAssembly()))
- {
- return;
- }
-
- if (HasInheritanceDeclarativeSecurity())
- {
-#ifdef CROSSGEN_COMPILE
- // NGen is always full trust. This path should be unreachable.
- CrossGenNotSupported("HasInheritanceDeclarativeSecurity()");
-#else // CROSSGEN_COMPILE
- GCX_COOP();
-
- OBJECTREF refCasDemands = NULL;
- PsetCacheEntry* pCasDemands = NULL;
-
- HRESULT hr = GetDeclaredPermissionsWithCache(dclInheritanceCheck, &refCasDemands, &pCasDemands);
- if (refCasDemands != NULL)
- {
- _ASSERTE(pCasDemands != NULL);
-
- // See if inheritor's assembly has passed this demand before
- AssemblySecurityDescriptor *pInheritorAssem = static_cast<AssemblySecurityDescriptor*>(pChildMD->GetAssembly()->GetSecurityDescriptor());
- BOOL fSkipCheck = pInheritorAssem->AlreadyPassedDemand(pCasDemands);
-
- if (!fSkipCheck)
- {
- GCPROTECT_BEGIN(refCasDemands);
-
- // Perform the check (it's really just a LinkDemand)
- SecurityStackWalk::LinkOrInheritanceCheck(pChildMD->GetAssembly()->GetSecurityDescriptor(), refCasDemands, pChildMD->GetAssembly(), dclInheritanceCheck);
-
- // Demand passed. Add it to the Inheritor's assembly's list of passed demands
- pInheritorAssem->TryCachePassedDemand(pCasDemands);
-
- GCPROTECT_END();
- }
- }
-
- // @todo -- non cas shouldn't be used for inheritance demands...
-
- // Check non-CAS Inheritance
- OBJECTREF refNonCasDemands = NULL;
- hr = GetDeclaredPermissionsWithCache( dclNonCasInheritance, &refNonCasDemands, NULL);
- if (refNonCasDemands != NULL)
- {
- _ASSERTE(((PERMISSIONSETREF)refNonCasDemands)->CheckedForNonCas() && "Declarative permissions should have been checked for nonCAS in PermissionSet.CreateSerialized");
- if (((PERMISSIONSETREF)refNonCasDemands)->ContainsNonCas())
- {
- GCPROTECT_BEGIN(refNonCasDemands);
-
- // Perform the check
- MethodDescCallSite demand(METHOD__PERMISSION_SET__DEMAND_NON_CAS, &refNonCasDemands);
- ARG_SLOT arg = ObjToArgSlot(refNonCasDemands);
- demand.Call(&arg);
-
- GCPROTECT_END();
- }
- }
-#endif // CROSSGEN_COMPILE
- }
-#endif // FEATURE_CORECLR
}
MethodSecurityDescriptor::MethodImplementationIterator::MethodImplementationIterator(MethodDesc *pMD)
@@ -1099,9 +1027,6 @@ void TypeSecurityDescriptor::ComputeCriticalTransparentInfo()
}
CONTRACTL_END;
-#ifndef FEATURE_CORECLR
- TypeSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
// If we've setup a breakpoint when we compute the transparency of this type, then stop in the debugger now
@@ -1240,9 +1165,6 @@ void TypeSecurityDescriptor::ComputeCriticalTransparentInfo()
// Update the cached values in the EE Class.
g_IBCLogger.LogEEClassCOWTableAccess(m_pMT);
pClass->SetCriticalTransparentInfo(
-#ifndef FEATURE_CORECLR
- typeFlags & (TypeSecurityDescriptorFlags_IsCritical | TypeSecurityDescriptorFlags_IsAllCritical),
-#endif // FEATURE_CORECLR
typeFlags & TypeSecurityDescriptorFlags_IsTreatAsSafe,
typeFlags & TypeSecurityDescriptorFlags_IsAllTransparent,
typeFlags & TypeSecurityDescriptorFlags_IsAllCritical);
@@ -1484,73 +1406,6 @@ void TypeSecurityDescriptor::InvokeInheritanceChecks(MethodTable* pChildMT)
}
}
-#ifndef FEATURE_CORECLR
- // Fast path check
- if (SecurityDeclarative::FullTrustCheckForLinkOrInheritanceDemand(pChildMT->GetAssembly()))
- {
- return;
- }
-
- if (HasInheritanceDeclarativeSecurity())
- {
-#ifdef CROSSGEN_COMPILE
- // NGen is always full trust. This path should be unreachable.
- CrossGenNotSupported("HasInheritanceDeclarativeSecurity()");
-#else // CROSSGEN_COMPILE
- GCX_COOP();
-
- // If we have a class that requires inheritance checks,
- // then we require a thread to perform the checks.
- // We won't have a thread when some of the system classes
- // are preloaded, so make sure that none of them have
- // inheritance checks.
- _ASSERTE(GetThread() != NULL);
-
- struct
- {
- OBJECTREF refCasDemands;
- OBJECTREF refNonCasDemands;
- }
- gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
-
- EEClass *pClass = m_pMT->GetClass();
- if (pClass->RequiresCasInheritanceCheck())
- {
- GetDeclaredPermissionsWithCache(dclInheritanceCheck, &gc.refCasDemands, NULL);
- }
-
- if (pClass->RequiresNonCasInheritanceCheck())
- {
- GetDeclaredPermissionsWithCache(dclNonCasInheritance, &gc.refNonCasDemands, NULL);
- }
-
- if (gc.refCasDemands != NULL)
- {
- SecurityStackWalk::LinkOrInheritanceCheck(pChildMT->GetAssembly()->GetSecurityDescriptor(),
- gc.refCasDemands,
- pChildMT->GetAssembly(),
- dclInheritanceCheck);
- }
-
- if (gc.refNonCasDemands != NULL)
- {
- _ASSERTE(((PERMISSIONSETREF)gc.refNonCasDemands)->CheckedForNonCas() && "Declarative permissions should have been checked for nonCAS in PermissionSet.CreateSerialized");
- if(((PERMISSIONSETREF)gc.refNonCasDemands)->ContainsNonCas())
- {
- MethodDescCallSite demand(METHOD__PERMISSION_SET__DEMAND_NON_CAS, &gc.refNonCasDemands);
-
- ARG_SLOT arg = ObjToArgSlot(gc.refNonCasDemands);
- demand.Call(&arg);
- }
- }
-
- GCPROTECT_END();
-#endif // CROSSGEN_COMPILE
- }
-#endif // FEATURE_CORECLR
}
// Module security descriptor contains static security information about the module
@@ -1571,9 +1426,6 @@ void ModuleSecurityDescriptor::VerifyDataComputed()
return;
}
-#ifndef FEATURE_CORECLR
- ModuleSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
// Read the security attributes from the assembly
Assembly *pAssembly = m_pModule->GetAssembly();
@@ -1584,17 +1436,6 @@ void ModuleSecurityDescriptor::VerifyDataComputed()
TokenSecurityDescriptorFlags tokenFlags = GetTokenFlags();
-#ifndef FEATURE_CORECLR
- // Make sure we understand the security rule set being asked for
- if (GetSecurityRuleSet() < SecurityRuleSet_Min || GetSecurityRuleSet() > SecurityRuleSet_Max)
- {
- // Unknown rule set - fail to load this module
- SString strAssemblyName;
- pAssembly->GetDisplayName(strAssemblyName);
- COMPlusThrow(kFileLoadException, IDS_E_UNKNOWN_SECURITY_RULESET, strAssemblyName.GetUnicode());
- }
-
-#endif // !FEATURE_CORECLR
// Get a transparency behavior object for the assembly.
const SecurityTransparencyBehavior *pTransparencyBehavior =
@@ -1707,40 +1548,6 @@ void ModuleSecurityDescriptor::VerifyDataComputed()
_ASSERTE(m_flags == moduleFlags);
}
-#ifndef FEATURE_CORECLR
-
-// Determine if this assembly was build against a version of the runtime that only supported legacy transparency
-BOOL ModuleSecurityDescriptor::AssemblyVersionRequiresLegacyTransparency()
-{
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- SO_INTOLERANT;
- }
- CONTRACTL_END;
-
- BOOL fIsLegacyAssembly = FALSE;
-
- // Check the manifest version number to see if we're a v1 or v2 assembly. We specifically check for the
- // manifest version to come back as a string that starts with either v1 or v2; if we get anything
- // unexpected, we'll just use the default transparency implementation
- LPCSTR szVersion = NULL;
- IMDInternalImport *pmdImport = m_pModule->GetAssembly()->GetManifestImport();
- if (SUCCEEDED(pmdImport->GetVersionString(&szVersion)))
- {
- if (szVersion != NULL && strlen(szVersion) > 2)
- {
- fIsLegacyAssembly = szVersion[0] == 'v' &&
- (szVersion[1] == '1' || szVersion[1] == '2');
- }
- }
-
- return fIsLegacyAssembly;
-}
-
-#endif // !FEATURE_CORECLR
ModuleSecurityDescriptor* ModuleSecurityDescriptor::GetModuleSecurityDescriptor(Assembly *pAssembly)
{
@@ -1938,31 +1745,6 @@ TokenSecurityDescriptorFlags TokenSecurityDescriptor::ReadSecurityAttributes(IMD
{
flags |= TokenSecurityDescriptorFlags_Critical;
-#ifndef FEATURE_CORECLR
- // Check the SecurityCriticalScope parameter
- const BYTE *pbAttributeBlob;
- ULONG cbAttributeBlob;
-
- if (FAILED(pmdImport->GetCustomAttributeAsBlob(
- currentAttribute,
- reinterpret_cast<const void **>(&pbAttributeBlob),
- &cbAttributeBlob)))
- {
- continue;
- }
- CustomAttributeParser cap(pbAttributeBlob, cbAttributeBlob);
- if (SUCCEEDED(cap.SkipProlog()))
- {
- UINT32 dwCriticalFlags;
- if (SUCCEEDED(cap.GetU4(&dwCriticalFlags)))
- {
- if (dwCriticalFlags == SecurityCriticalFlags_All)
- {
- flags |= TokenSecurityDescriptorFlags_AllCritical;
- }
- }
- }
-#endif // !FEATURE_CORECLR
}
else if (strcmp(g_SecuritySafeCriticalAttribute + sizeof(g_SecurityNS), szAttributeName) == 0)
{
@@ -1972,30 +1754,6 @@ TokenSecurityDescriptorFlags TokenSecurityDescriptor::ReadSecurityAttributes(IMD
{
flags |= TokenSecurityDescriptorFlags_Transparent;
}
-#ifndef FEATURE_CORECLR
- else if (strcmp(g_SecurityRulesAttribute + sizeof(g_SecurityNS), szAttributeName) == 0)
- {
- const BYTE *pbAttributeBlob;
- ULONG cbAttributeBlob;
-
- if (FAILED(pmdImport->GetCustomAttributeAsBlob(
- currentAttribute,
- reinterpret_cast<const void **>(&pbAttributeBlob),
- &cbAttributeBlob)))
- {
- continue;
- }
-
- TokenSecurityDescriptorFlags securityRulesFlags =
- ParseSecurityRulesAttribute(pbAttributeBlob, cbAttributeBlob);
-
- flags |= securityRulesFlags;
- }
- else if (strcmp(g_SecurityTreatAsSafeAttribute + sizeof(g_SecurityNS), szAttributeName) == 0)
- {
- flags |= TokenSecurityDescriptorFlags_TreatAsSafe;
- }
-#endif // !FEATURE_CORECLR
}
}
@@ -2023,9 +1781,6 @@ void TokenSecurityDescriptor::VerifySemanticDataComputed()
return;
}
-#ifndef FEATURE_CORECLR
- TokenSecurityDescriptorTransparencyEtwEvents etw(this);
-#endif // !FEATURE_CORECLR
bool fIsSemanticallyCritical = false;
bool fIsSemanticallyTreatAsSafe = false;
diff --git a/src/vm/securitymeta.h b/src/vm/securitymeta.h
index d2e3743cbe..403133cf74 100644
--- a/src/vm/securitymeta.h
+++ b/src/vm/securitymeta.h
@@ -629,17 +629,10 @@ public:
// Get the rule set the assembly uses
inline SecurityRuleSet GetSecurityRuleSet();
-#ifndef FEATURE_CORECLR
- // Can fully trusted transparent code bypass verification
- inline BOOL CanTransparentCodeSkipVerification();
-#endif // !FEATURE_CORECLR
// Does the assembly allow partially trusted callers
inline BOOL IsAPTCA();
-#ifndef FEATURE_CORECLR
- BOOL AssemblyVersionRequiresLegacyTransparency();
-#endif // !FEATURE_CORECLR
private:
// Helper class which fires transparency calculation begin/end ETW events
diff --git a/src/vm/securitymeta.inl b/src/vm/securitymeta.inl
index 6eb488d78c..11da444841 100644
--- a/src/vm/securitymeta.inl
+++ b/src/vm/securitymeta.inl
@@ -411,30 +411,8 @@ inline BOOL MethodSecurityDescriptor::IsDeclSecurityCASDemandsOnly(DWORD dwMethD
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// Non-CAS demands are not supported in CoreCLR
return TRUE;
-#else
- GCX_COOP();
-
- PsetCacheEntry *tokenSetIndexes[dclMaximumValue + 1];
- SecurityDeclarative::DetectDeclActionsOnToken(_mdToken, dwMethDeclFlags, tokenSetIndexes, pInternalImport);
- SecurityProperties sp(dwMethDeclFlags);
- if (!sp.FDemandsOnly())
- return FALSE;
-
- DWORD dwLocalAction;
- bool builtInCASPermsOnly = true;
- for (dwLocalAction = 0; dwLocalAction <= dclMaximumValue && builtInCASPermsOnly; dwLocalAction++)
- {
- if (tokenSetIndexes[dwLocalAction] != NULL)
- {
- builtInCASPermsOnly = builtInCASPermsOnly && (tokenSetIndexes[dwLocalAction]->ContainsBuiltinCASPermsOnly(dwLocalAction));
- }
- }
-
- return (builtInCASPermsOnly); // we only get here if there are only demands...so it suffices to return this value directly
-#endif
}
#ifndef DACCESS_COMPILE
@@ -632,9 +610,6 @@ inline BOOL TypeSecurityDescriptor::IsCritical()
}
return pClass->IsAllCritical()
-#ifndef FEATURE_CORECLR
- || pClass->IsCritical()
-#endif // !FEATURE_CORECLR
;
}
@@ -1101,16 +1076,6 @@ inline BOOL ModuleSecurityDescriptor::IsMixedTransparency()
return !IsAllCritical() && !IsAllTransparent();
}
-#ifndef FEATURE_CORECLR
-
-inline BOOL ModuleSecurityDescriptor::CanTransparentCodeSkipVerification()
-{
- WRAPPER_NO_CONTRACT;
- VerifyDataComputed();
- return !!(m_flags & ModuleSecurityDescriptorFlags_SkipFullTrustVerification);
-}
-
-#endif // !FEATURE_CORECLR
#if defined(FEATURE_CORESYSTEM)
inline BOOL ModuleSecurityDescriptor::IsAPTCA()
@@ -1139,12 +1104,6 @@ inline SecurityRuleSet ModuleSecurityDescriptor::GetSecurityRuleSet()
{
return ::GetSecurityRuleSet(tokenFlags);
}
-#ifndef FEATURE_CORECLR
- else if (AssemblyVersionRequiresLegacyTransparency())
- {
- return SecurityRuleSet_Level1;
- }
-#endif // !FEATURE_CORECLR
else
{
// The assembly hasn't specified the rule set that it needs to use. We'll just use the default rule
diff --git a/src/vm/securitypolicy.cpp b/src/vm/securitypolicy.cpp
index fe1da90b8d..03910a2311 100644
--- a/src/vm/securitypolicy.cpp
+++ b/src/vm/securitypolicy.cpp
@@ -790,34 +790,6 @@ void QCALLTYPE SecurityPolicy::GetDeviceName(LPCWSTR wszDriveLetter, QCall::Stri
{
QCALL_CONTRACT;
-#if !defined(FEATURE_CORECLR)
- BEGIN_QCALL;
-
- WCHAR networkName[MAX_LONGPATH];
- DWORD networkNameSize = MAX_LONGPATH;
- ZeroMemory( networkName, sizeof( networkName ) );
-
- UINT driveType = WszGetDriveType( wszDriveLetter );
- if (driveType == DRIVE_REMOVABLE ||
- driveType == DRIVE_FIXED ||
- driveType == DRIVE_CDROM ||
- driveType == DRIVE_RAMDISK)
- {
- retDeviceName.Set( wszDriveLetter );
- goto lExit;
- }
-
- if (WszWNetGetConnection(wszDriveLetter, networkName, &networkNameSize) != NO_ERROR)
- {
- goto lExit;
- }
-
- retDeviceName.Set( networkName );
-
-lExit: ;
-
- END_QCALL;
-#endif // !FEATURE_CORECLR
}
#ifdef FEATURE_CAS_POLICY
diff --git a/src/vm/securitypolicy.h b/src/vm/securitypolicy.h
index d22eceb11e..3166f7fd24 100644
--- a/src/vm/securitypolicy.h
+++ b/src/vm/securitypolicy.h
@@ -36,9 +36,6 @@ class SystemNative;
class NDirect;
class SystemDomain;
class AssemblySecurityDescriptor;
-#ifndef FEATURE_CORECLR
-class PEFileSecurityDescriptor;
-#endif
class SharedSecurityDescriptor;
class SecurityStackWalkData;
class DemandStackWalk;
diff --git a/src/vm/securitytransparentassembly.cpp b/src/vm/securitytransparentassembly.cpp
index f798df159f..c1823fc034 100644
--- a/src/vm/securitytransparentassembly.cpp
+++ b/src/vm/securitytransparentassembly.cpp
@@ -324,7 +324,6 @@ BOOL SecurityTransparent::CheckCriticalAccess(AccessCheckContext* pContext,
return TRUE;
}
-#ifdef FEATURE_CORECLR
// On the coreCLR, a method can be transparent even if the containing type is marked Critical.
// This will happen when that method is an override of a base transparent method, and the type that
// contains the override is marked Critical. And that's the only case it can happen.
@@ -334,7 +333,6 @@ BOOL SecurityTransparent::CheckCriticalAccess(AccessCheckContext* pContext,
{
return TRUE;
}
-#endif // FEATURE_CORECLR
// an attached profiler may wish to have these checks suppressed
if (Security::BypassSecurityChecksForProfiler(pCurrentMD))
@@ -395,41 +393,9 @@ BOOL SecurityTransparent::IsAllowedToAssert(MethodDesc *pMD)
return TRUE;
}
-#ifdef FEATURE_CORECLR
// On CoreCLR only critical code may ever assert - there are no compatibility reasons to allow
// transparent asserts.
return FALSE;
-#else // !FEATURE_CORECLR
- // We must be in a heterogenous AppDomain for transparent asserts to work
- if (GetAppDomain()->GetSecurityDescriptor()->IsHomogeneous())
- {
- return FALSE;
- }
-
- ModuleSecurityDescriptor *pMSD = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pMD->GetAssembly());
-
- // Only assemblies whose version requires them to use legacy transparency (rather than assemblies which
- // get legacy transparency via RuleSet.Level1) can assert from transparent code
- if (!pMSD->AssemblyVersionRequiresLegacyTransparency())
- {
- return FALSE;
- }
-
- // Finally, the assembly must not have had any of the transparency attributes on it
- const TokenSecurityDescriptorFlags transparencyAwareFlags =
- TokenSecurityDescriptorFlags_AllCritical | // [SecurityCritical(SecurityCriticalScope.All)]
- TokenSecurityDescriptorFlags_Critical | // [SecurityCritical]
- TokenSecurityDescriptorFlags_SafeCritical | // [SecuritySafeCritical]
- TokenSecurityDescriptorFlags_Transparent | // [SecurityTransparent]
- TokenSecurityDescriptorFlags_TreatAsSafe; // [SecurityTreatAsSafe]
- TokenSecurityDescriptorFlags moduleAttributes = pMSD->GetTokenFlags();
- if ((moduleAttributes & transparencyAwareFlags) != TokenSecurityDescriptorFlags_None)
- {
- return FALSE;
- }
-
- return TRUE;
-#endif // FEATURE_CORECLR
}
// Functor class to aid in determining if a type requires a transparency check
@@ -528,40 +494,6 @@ CorInfoCanSkipVerificationResult SecurityTransparent::JITCanSkipVerification(Met
CorInfoCanSkipVerificationResult canSkipVerif = hasSkipVerificationPermisson ? CORINFO_VERIFICATION_CAN_SKIP : CORINFO_VERIFICATION_CANNOT_SKIP;
-#ifndef FEATURE_CORECLR
- // also check to see if the method is marked transparent
- if (hasSkipVerificationPermisson)
- {
- if (pDomainAssembly == GetAppDomain()->GetAnonymouslyHostedDynamicMethodsAssembly())
- {
- // This assembly is FullTrust. However, it cannot contain unverifiable code.
- // The JIT compiler is not hardened to deal with invalid code. Hence, we cannot
- // return CORINFO_VERIFICATION_RUNTIME_CHECK for IL that could have been generated
- // by a low-trust assembly.
- canSkipVerif = CORINFO_VERIFICATION_CANNOT_SKIP;
- }
- // also check to see if the method is marked transparent
- else if (SecurityTransparent::IsMethodTransparent(pMD))
- {
- // If the assembly requested that even its transparent members not be verified, then we can skip
- // verification. Otherwise, we need to either inject a runtime demand in the v2 model, or fail
- // verification in the v4 model.
- ModuleSecurityDescriptor *pModuleSecDesc = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pMD->GetAssembly());
- if (pModuleSecDesc->CanTransparentCodeSkipVerification())
- {
- canSkipVerif = CORINFO_VERIFICATION_CAN_SKIP;
- }
- else if (pMD->GetAssembly()->GetSecurityTransparencyBehavior()->CanTransparentCodeSkipVerification())
- {
- canSkipVerif = CORINFO_VERIFICATION_RUNTIME_CHECK;
- }
- else
- {
- canSkipVerif = CORINFO_VERIFICATION_CANNOT_SKIP;
- }
- }
- }
-#endif //FEATURE_CORECLR
return canSkipVerif;
}
@@ -587,14 +519,6 @@ CorInfoCanSkipVerificationResult SecurityTransparent::JITCanSkipVerification(Dom
{
// In CoreCLR, do not enable transparency checks here. We depend on this method being "honest" in
// JITCanSkipVerification to skip transparency checks on profile assemblies.
-#ifndef FEATURE_CORECLR
- ModuleSecurityDescriptor *pMsd = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pAssembly->GetAssembly());
- if (pMsd->IsAllTransparent() &&
- pAssembly->GetAssembly()->GetSecurityTransparencyBehavior()->CanTransparentCodeSkipVerification())
- {
- canSkipVerif = CORINFO_VERIFICATION_RUNTIME_CHECK;
- }
-#endif // !FEATURE_CORECLR
}
return canSkipVerif;
@@ -620,34 +544,6 @@ bool SecurityTransparent::SecurityCalloutQuickCheck(MethodDesc *pCallerMD)
// In coreclr, we modified the logic in the callout to also do some transparency method access checks
// These checks need to happen regardless of trust level and we shouldn't be bailing out early
// just because we happen to be in Full Trust
-#ifndef FEATURE_CORECLR
- // See if we need to process this callout for real, or if we can bail out early before setting up a HMF,
- // and spending a lot of time processing the transparency evaluation. The simplest case where we can do
- // this is if the caller is critical. In that case, we know that the caller is allowed to do whatever
- // it wants, so we quit out.
- //
- // Additionally, if the caller is using SecurityRuleSet.Level1, which turns transparency violations into
- // security demands, we can bail out early if we know for sure all demands will succeed on the current
- // call stack. (Note: this remains true as long as we don't start generating callouts for transparent
- // level 1 calling critical level 1, or transparent level 1 doing an assert, which are the only two
- // violations which do not succeed in the face of a successful demand).
- if (pCallerMD->IsCritical())
- {
- return true;
- }
- else
- {
- // The caller is transparent, so let's see if demands can cause transparency violations to succeed,
- // and also if all demands issued from this context will succeed.
- const SecurityTransparencyBehavior *pCallerTransparency = pCallerMD->GetAssembly()->TryGetSecurityTransparencyBehavior();
- if (pCallerTransparency != NULL &&
- pCallerTransparency->CanTransparentCodeCallLinkDemandMethods() &&
- SecurityStackWalk::HasFlagsOrFullyTrustedIgnoreMode(0))
- {
- return true;
- }
- }
-#endif // !FEATURE_CORECLR
return false;
}
@@ -947,7 +843,6 @@ VOID SecurityTransparent::EnforceTransparentDelegateChecks(MethodTable* pDelegat
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
// We only enforce delegate binding rules in partial trust
if (GetAppDomain()->GetSecurityDescriptor()->IsFullyTrusted())
return;
@@ -958,7 +853,6 @@ VOID SecurityTransparent::EnforceTransparentDelegateChecks(MethodTable* pDelegat
TypeString::AppendType(strDelegateType, pDelegateMT, TypeString::FormatNamespace | TypeString::FormatAngleBrackets| TypeString::FormatSignature);
COMPlusThrowHR(COR_E_METHODACCESS, IDS_E_DELEGATE_BINDING_TRANSPARENCY, strDelegateType.GetUnicode(), strMethod.GetUnicode());
-#endif // FEATURE_CORECLR
}
#endif // CROSSGEN_COMPILE
@@ -1482,199 +1376,6 @@ public:
}
};
-#ifndef FEATURE_CORECLR
-
-//---------------------------------------------------------------------------------------
-//
-// Transparency behavior implementation for v2 assemblies
-//
-
-class LegacyTransparencyBehaviorImpl : public ISecurityTransparencyImpl
-{
-public:
- // Get bits that indicate how transparency should behave in different situations
- virtual SecurityTransparencyBehaviorFlags GetBehaviorFlags() const
- {
- LIMITED_METHOD_CONTRACT;
- return SecurityTransparencyBehaviorFlags_IntroducedCriticalsMayAddTreatAsSafe |
- SecurityTransparencyBehaviorFlags_OpportunisticIsSafeCriticalMethods |
- SecurityTransparencyBehaviorFlags_PartialTrustImpliesAllTransparent |
- SecurityTransparencyBehaviorFlags_PublicImpliesTreatAsSafe |
- SecurityTransparencyBehaviorFlags_TransparentCodeCanCallLinkDemand |
- SecurityTransaprencyBehaviorFlags_TransparentCodeCanCallUnmanagedCode |
- SecurityTransparencyBehaviorFlags_TransparentCodeCanSkipVerification |
- SecurityTransparencyBehaviorFlags_UnsignedImpliesAPTCA;
- }
-
- // Legacy transparency field behavior mappings:
- // Attribute Behavior
- // -----------------------------------------------------
- // Critical (any) Critical
- // SafeCritical Safe critical
- // TAS (no critical) No effect
- // TAS (with any critical) Safe critical
- virtual FieldSecurityDescriptorFlags MapFieldAttributes(TokenSecurityDescriptorFlags tokenFlags) const
- {
- WRAPPER_NO_CONTRACT;
-
- // Legacy transparency behaves the same for fields as the current transparency model, so we just forward
- // this call to that implementation.
- TransparencyBehaviorImpl forwardImpl;
- return forwardImpl.MapFieldAttributes(tokenFlags);
- }
-
-
- // Legacy transparency method behavior mappings:
- // Attribute Behavior
- // -----------------------------------------------------
- // Critical (any) Critical
- // SafeCritical Safe critical
- // TAS (no critical) No effect
- // TAS (with any critical) Safe critical
- virtual MethodSecurityDescriptorFlags MapMethodAttributes(TokenSecurityDescriptorFlags tokenFlags) const
- {
- WRAPPER_NO_CONTRACT;
-
- // Legacy transparency behaves the same for methods as the current transparency model, so we just forward
- // this call to that implementation.
- TransparencyBehaviorImpl forwardImpl;
- return forwardImpl.MapMethodAttributes(tokenFlags);
- }
-
- // Legacy transparency module behavior mappings:
- // Attribute Behavior
- // -----------------------------------------------------
- // APTCA APTCA
- // ConditionlAPTCA Exception
- // Critical (scoped) Mixed transparency
- // Critical (all) All critical
- // SafeCritical All safe critical
- // TAS (no critical) No effect
- // TAS (with scoped critical) No effect
- // TAS (with all critical) All safe critical
- // Transparent All transparent
- //
- // Having no transparent, critical, or safe critical attributes means that the assembly should have all
- // transparent types and all safe critical methods.
- virtual ModuleSecurityDescriptorFlags MapModuleAttributes(TokenSecurityDescriptorFlags tokenFlags) const
- {
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- SO_INTOLERANT;
- }
- CONTRACTL_END;
-
- ModuleSecurityDescriptorFlags moduleFlags = ModuleSecurityDescriptorFlags_None;
- bool fShouldBeOpportunisticallyCritical = true;
-
- if (tokenFlags & TokenSecurityDescriptorFlags_APTCA)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsAPTCA;
- }
-
- if (tokenFlags & TokenSecurityDescriptorFlags_Transparent)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsAllTransparent;
- fShouldBeOpportunisticallyCritical = false;
- }
-
- if (tokenFlags & TokenSecurityDescriptorFlags_Critical)
- {
- fShouldBeOpportunisticallyCritical = false;
-
- // If we're critical, but not all critical that means we're mixed.
- if (tokenFlags & TokenSecurityDescriptorFlags_AllCritical)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsAllCritical;
-
- // If we're all critical and treat as safe, that means we're safe critical
- if (tokenFlags & TokenSecurityDescriptorFlags_TreatAsSafe)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsTreatAsSafe;
- }
- }
- }
-
- // SafeCritical always means Critical + TreatAsSafe; we can get in this case for legacy assemblies if the
- // assembly is actually a v4 assembly which is using the Legacy attribute.
- if (tokenFlags & TokenSecurityDescriptorFlags_SafeCritical)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_IsAllCritical |
- ModuleSecurityDescriptorFlags_IsTreatAsSafe;
- fShouldBeOpportunisticallyCritical = false;
- }
-
- // If we didn't find an attribute that indicates the assembly cares about transparency, then it is
- // opportunistically critical.
- if (fShouldBeOpportunisticallyCritical)
- {
- _ASSERTE(!(moduleFlags & ModuleSecurityDescriptorFlags_IsAllTransparent));
- _ASSERTE(!(moduleFlags & ModuleSecurityDescriptorFlags_IsAllCritical));
-
- moduleFlags |= ModuleSecurityDescriptorFlags_IsOpportunisticallyCritical;
- }
-
- // If the token asks to not have IL verification done in full trust, propigate that to the module
- if (tokenFlags & TokenSecurityDescriptorFlags_SkipFullTrustVerification)
- {
- moduleFlags |= ModuleSecurityDescriptorFlags_SkipFullTrustVerification;
- }
-
- return moduleFlags;
- }
-
- // Legacy transparency type behavior mappings:
- // Attribute Behavior
- // -----------------------------------------------------
- // Critical (scoped) Critical, but not all critical
- // Critical (all) All critical
- // SafeCritical All safe critical
- // TAS (no critical) No effect on the type, but save TAS bit for members of the type
- // TAS (with scoped critical) SafeCritical, but not all critical
- // TAS (with all critical) All SafeCritical
- virtual TypeSecurityDescriptorFlags MapTypeAttributes(TokenSecurityDescriptorFlags tokenFlags) const
- {
- CONTRACTL
- {
- THROWS;
- GC_TRIGGERS;
- SO_INTOLERANT;
- }
- CONTRACTL_END;
-
- TypeSecurityDescriptorFlags typeFlags = TypeSecurityDescriptorFlags_None;
-
- if (tokenFlags & TokenSecurityDescriptorFlags_Critical)
- {
- typeFlags |= TypeSecurityDescriptorFlags_IsCritical;
-
- // We only consider all critical if the critical attribute was present
- if (tokenFlags & TokenSecurityDescriptorFlags_AllCritical)
- {
- typeFlags |= TypeSecurityDescriptorFlags_IsAllCritical;
- }
- }
-
- // SafeCritical always means all critical + TAS
- if (tokenFlags & TokenSecurityDescriptorFlags_SafeCritical)
- {
- typeFlags |= TypeSecurityDescriptorFlags_IsCritical |
- TypeSecurityDescriptorFlags_IsAllCritical |
- TypeSecurityDescriptorFlags_IsTreatAsSafe;
- }
-
- if (tokenFlags & TokenSecurityDescriptorFlags_TreatAsSafe)
- {
- typeFlags |= TypeSecurityDescriptorFlags_IsTreatAsSafe;
- }
-
- return typeFlags;
- }
-};
-
-#endif // !FEATURE_CORECLR
//
// Shared transparency behavior objects
@@ -1720,13 +1421,6 @@ const SecurityTransparencyBehavior *GetOrCreateTransparencyBehavior(SecurityTran
// static
SecurityTransparencyBehavior *SecurityTransparencyBehavior::s_pStandardTransparencyBehavior = NULL;
-#ifndef FEATURE_CORECLR
-
-// Transpraency behavior object for v2 transparent assemblies
-// static
-SecurityTransparencyBehavior *SecurityTransparencyBehavior::s_pLegacyTransparencyBehavior = NULL;
-
-#endif // !FEATURE_CORECLR
//---------------------------------------------------------------------------------------
//
@@ -1749,14 +1443,6 @@ const SecurityTransparencyBehavior *SecurityTransparencyBehavior::GetTransparenc
}
CONTRACT_END;
-#ifndef FEATURE_CORECLR
- if (ruleSet == SecurityRuleSet_Level1)
- {
- // Level 1 rules - v2.0 behavior
- RETURN(GetOrCreateTransparencyBehavior<LegacyTransparencyBehaviorImpl>(&s_pLegacyTransparencyBehavior));
- }
- else
-#endif // FEATURE_CORECLR;
{
// Level 2 rules - v4.0 behavior
RETURN(GetOrCreateTransparencyBehavior<TransparencyBehaviorImpl>(&s_pStandardTransparencyBehavior));
diff --git a/src/vm/sha1.h b/src/vm/sha1.h
index 0dd70f64a7..23ea8d2c3e 100644
--- a/src/vm/sha1.h
+++ b/src/vm/sha1.h
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
//
-#if defined(FEATURE_CORECLR)
#ifndef SHA1_H_
#define SHA1_H_
@@ -49,6 +48,3 @@ public:
};
#endif // SHA1_H_
-#else // !defined(FEATURE_CORECLR)
-#include "crypto/sha1.h"
-#endif // defined(FEATURE_CORECLR)
diff --git a/src/vm/stdinterfaces.cpp b/src/vm/stdinterfaces.cpp
index c80ec3fe22..2765b2e223 100644
--- a/src/vm/stdinterfaces.cpp
+++ b/src/vm/stdinterfaces.cpp
@@ -626,219 +626,8 @@ HRESULT GetITypeLibForAssembly(Assembly *pAssembly, ITypeLib **ppTLB, int bAutoC
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
//@CORESYSTODO: what to do?
return E_FAIL;
-#else
-
- HRESULT hr = S_OK; // A result.
- CQuickWSTRBase rName; // Library (scope) or file name.
- int bResize=false; // If true, had to resize the buffer to hold the name.
- LPCWSTR szModule=0; // The module name.
- GUID guid; // A GUID.
- ITypeLib *pITLB=0; // The TypeLib.
- Module *pModule; // The assembly's module.
- WCHAR rcDrive[_MAX_DRIVE]; // Module's drive letter.
- WCHAR rcDir[_MAX_DIR]; // Module's directory.
- WCHAR rcFname[_MAX_FNAME]; // Module's file name.
- USHORT wMajor; // Major version number.
- USHORT wMinor; // Minor version number.
-
- rName.Init();
-
- // Check to see if we have a cached copy.
- pITLB = pAssembly->GetTypeLib();
- if (pITLB)
- {
- // Check to see if the cached value is -1. This indicate that we tried
- // to export the typelib but that the export failed.
- if (pITLB == (ITypeLib*)-1)
- {
- hr = E_FAIL;
- goto ReturnHR;
- }
-
- // We have a cached copy so return it.
- *ppTLB = pITLB;
- hr = S_OK;
- goto ReturnHR;
- }
-
- // Retrieve the name of the module.
- pModule = pAssembly->GetManifestModule();
-
- EX_TRY
- {
- // SString::ConvertToUnicode is THROW_UNLESS_NORMALIZED
- szModule = pModule->GetPath();
- }
- EX_CATCH_HRESULT(hr);
- IfFailGo(hr);
-
- // Retrieve the guid for typelib that would be generated from the assembly.
- IfFailGo(GetTypeLibGuidForAssembly(pAssembly, &guid));
-
- // If the typelib is for the runtime library, we'd better know where it is.
- if (guid == LIBID_ComPlusRuntime)
- {
- ULONG dwSize = (ULONG)rName.MaxSize();
- while (FAILED(GetInternalSystemDirectory(rName.Ptr(), &dwSize)))
- {
- IfFailGo(rName.ReSizeNoThrow(dwSize=(ULONG)rName.MaxSize()*2));
- }
-
- IfFailGo(rName.ReSizeNoThrow(dwSize + wcslen(g_pwBaseLibraryTLB) + 3));
- wcscat_s(rName.Ptr(), rName.Size(), g_pwBaseLibraryTLB);
- hr = LoadTypeLibExWithFlags(rName.Ptr(), flags, &pITLB);
- goto ErrExit;
- }
-
- // Retrieve the major and minor version number.
- IfFailGo(GetTypeLibVersionForAssembly(pAssembly, &wMajor, &wMinor));
-
- // Maybe the module was imported from COM, and we can get the libid of the existing typelib.
- if (pAssembly->IsImportedFromTypeLib())
- {
- hr = LoadRegTypeLibWithFlags(guid, wMajor, wMinor, flags, &pITLB);
- if (SUCCEEDED(hr))
- goto ErrExit;
-
- // Try just the Assembly version
- pAssembly->GetVersion(&wMajor, &wMinor, NULL, NULL);
- hr = LoadRegTypeLibWithFlags(guid, wMajor, wMinor, flags, &pITLB);
- if (SUCCEEDED(hr))
- goto ErrExit;
-
- // Try loading the highest registered version.
- hr = LoadRegTypeLibWithFlags(guid, -1, -1, flags, &pITLB);
- if (SUCCEEDED(hr))
- goto ErrExit;
-
- // The module is known to be imported, so no need to try conversion.
-
- // Set the error info for most callers.
- VMPostError(TLBX_E_CIRCULAR_EXPORT2, szModule);
-
- // Set the hr for the case where we're trying to load a type library to
- // resolve a type reference from another library. The error message will
- // be posted where more information is available.
- if (hr == TYPE_E_LIBNOTREGISTERED)
- hr = TLBX_W_LIBNOTREGISTERED;
- else
- hr = TLBX_E_CANTLOADLIBRARY;
-
- IfFailGo(hr);
- }
-
- // Try to load the registered typelib.
- hr = LoadRegTypeLibWithFlags(guid, wMajor, wMinor, flags, &pITLB);
- if(hr == S_OK)
- goto ErrExit;
-
- // Try just the Assembly version
- pAssembly->GetVersion(&wMajor, &wMinor, NULL, NULL);
- hr = LoadRegTypeLibWithFlags(guid, wMajor, wMinor, flags, &pITLB);
- if (SUCCEEDED(hr))
- goto ErrExit;
-
- // If that fails, try loading the highest registered version.
- hr = LoadRegTypeLibWithFlags(guid, -1, -1, flags, &pITLB);
- if(hr == S_OK)
- goto ErrExit;
-
- // If caller only wants registered typelibs, exit now, with error from prior call.
- if (flags & TlbExporter_OnlyReferenceRegistered)
- goto ErrExit;
-
- // If we haven't managed to find the typelib so far try and load the typelib by name.
- hr = LoadTypeLibExWithFlags(szModule, flags, &pITLB);
- if(hr == S_OK)
- {
- // Check libid.
- TLIBATTR *pTlibAttr;
- int bMatch;
-
- IfFailGo(pITLB->GetLibAttr(&pTlibAttr));
- bMatch = pTlibAttr->guid == guid;
- pITLB->ReleaseTLibAttr(pTlibAttr);
-
- if (bMatch)
- {
- goto ErrExit;
- }
- else
- {
- SafeReleasePreemp(pITLB);
- pITLB = NULL;
- hr = TLBX_E_CANTLOADLIBRARY;
- }
- }
-
- // Add a ".tlb" extension and try again.
- IfFailGo(rName.ReSizeNoThrow((int)(wcslen(szModule) + 5)));
- // Check if szModule already has an extension.
- LPCWSTR ext;
- size_t extSize;
- SplitPathInterior(szModule, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &ext, &extSize);
- if (ext != nullptr)
- {
- // szModule already has an extension. Make a copy without the extension.
- wcsncpy_s(rName.Ptr(), rName.Size(), szModule, ext - szModule);
- }
- else
- {
- // szModule does not have an extension. Copy the whole string.
- wcscpy_s(rName.Ptr(), rName.Size(), szModule);
- }
- wcscat_s(rName.Ptr(), rName.Size(), W(".tlb"));
-
- hr = LoadTypeLibExWithFlags(rName.Ptr(), flags, &pITLB);
- if(hr == S_OK)
- {
- // Check libid.
- TLIBATTR *pTlibAttr;
- int bMatch;
- IfFailGo(pITLB->GetLibAttr(&pTlibAttr));
- bMatch = pTlibAttr->guid == guid;
- pITLB->ReleaseTLibAttr(pTlibAttr);
- if (bMatch)
- {
- goto ErrExit;
- }
- else
- {
- SafeReleasePreemp(pITLB);
- pITLB = NULL;
- hr = TLBX_E_CANTLOADLIBRARY;
- }
- }
-
- // If the auto create flag is set then try and export the typelib from the module.
- if (bAutoCreate)
- {
- // Try to export the typelib right now.
- // This is FTL export (Fractionally Too Late).
- hr = ExportTypeLibFromLoadedAssemblyNoThrow(pAssembly, 0, &pITLB, 0, flags);
- if (FAILED(hr))
- {
- // If the export failed then remember it failed by setting the typelib
- // to -1 on the assembly.
- pAssembly->SetTypeLib((ITypeLib *)-1);
- IfFailGo(hr);
- }
- }
-
-ErrExit:
- // If we successfully opened (or created) the typelib, cache a pointer, and return it to caller.
- if (pITLB)
- {
- pAssembly->SetTypeLib(pITLB);
- *ppTLB = pITLB;
- }
-ReturnHR:
- rName.Destroy();
- return hr;
-#endif //FEATURE_CORECLR
} // HRESULT GetITypeLibForAssembly()
@@ -2764,13 +2553,6 @@ HRESULT GetSpecialMarshaler(IMarshal* pMarsh, SimpleComCallWrapper* pSimpleWrap,
// In case of APPX process we always use the standard marshaller.
// In Non-APPX process use standard marshalling for everything except in-proc servers.
// In case of CoreCLR, we always use the standard marshaller as well.
-#if !defined(FEATURE_CORECLR)
- if (!AppX::IsAppXProcess() && (dwDestContext == MSHCTX_INPROC))
- {
- *ppMarshalRet = NULL;
- return S_OK;
- }
-#endif // !FEATURE_CORECLR
SafeComHolderPreemp<IUnknown> pMarshalerObj = NULL;
IfFailRet(CoCreateFreeThreadedMarshaler(NULL, &pMarshalerObj));
@@ -3084,49 +2866,8 @@ HRESULT __stdcall ManagedObject_GetSerializedBuffer(IManagedObject *pManaged,
}
CONTRACTL_END;
-#ifdef FEATURE_CORECLR
_ASSERTE(!"NYI");
return E_NOTIMPL;
-#else // FEATURE_CORECLR
-
- HRESULT hr = S_OK;
- if (pBStr == NULL)
- return E_POINTER;
-
- *pBStr = NULL;
-
- BEGIN_EXTERNAL_ENTRYPOINT(&hr)
- {
- GCX_COOP_THREAD_EXISTS(GET_THREAD());
-
- SimpleComCallWrapper *pSimpleWrap = SimpleComCallWrapper::GetWrapperFromIP( pManaged );
- ComCallWrapper *pComCallWrap = pSimpleWrap->GetMainWrapper();
-
- _ASSERTE(pComCallWrap != NULL);
-
- //@todo don't allow serialization of Configured objects through DCOM
- _ASSERTE(GetThread()->GetDomain()->GetId() == pSimpleWrap->GetDomainID());
-
- BOOL fLegacyMode = (GetAppDomain()->GetComOrRemotingFlag() == COMorRemoting_LegacyMode);
-
- OBJECTREF oref = pComCallWrap->GetObjectRef();
- GCPROTECT_BEGIN(oref)
- {
- // GetSerializedBuffer is only called in cross-runtime/cross-process scenarios so we pass
- // fCrossRuntime=TRUE unless we are in legacy mode
- if (!ConvertObjectToBSTR(&oref, !fLegacyMode, pBStr))
- {
- // ConvertObjectToBSTR returning FALSE is equivalent to throwing SerializationException
- hr = COR_E_SERIALIZATION;
- }
- }
- GCPROTECT_END();
- }
- END_EXTERNAL_ENTRYPOINT;
-
- return hr;
-
-#endif // FEATURE_CORECLR
}
//------------------------------------------------------------------------------------------
diff --git a/src/vm/stubhelpers.cpp b/src/vm/stubhelpers.cpp
index cbe1d37c94..20f76cdc5e 100644
--- a/src/vm/stubhelpers.cpp
+++ b/src/vm/stubhelpers.cpp
@@ -373,42 +373,6 @@ FORCEINLINE static void *GetCOMIPFromRCW_GetTarget(IUnknown *pUnk, ComPlusCallIn
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
-#ifdef _TARGET_X86_
- // m_pInterceptStub is either NULL if we never called on this method, -1 if we're not
- // hosted, or the host hook stub if we are hosted. The stub will extract the real target
- // from the 'this' argument.
- PVOID pInterceptStub = VolatileLoadWithoutBarrier(&pComInfo->m_pInterceptStub);
-
- if (pInterceptStub != (LPVOID)-1)
- {
- if (pInterceptStub != NULL)
- {
- return pInterceptStub;
- }
-
- if (NDirect::IsHostHookEnabled() || pComInfo->HasCopyCtorArgs())
- {
- return NULL;
- }
-
- if (!EnsureWritablePagesNoThrow(&pComInfo->m_pInterceptStub, sizeof(pComInfo->m_pInterceptStub)))
- {
- return NULL;
- }
-
- pComInfo->m_pInterceptStub = (LPVOID)-1;
- }
-#else // _TARGET_X86_
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- if (NDirect::IsHostHookEnabled())
- {
- // There's one static stub on !_TARGET_X86_.
- return (LPVOID)GetEEFuncEntryPoint(PInvokeStubForHost);
- }
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
-#endif // _TARGET_X86_
-#endif // FEATURE_CORECLR
LPVOID *lpVtbl = *(LPVOID **)pUnk;
return lpVtbl[pComInfo->m_cachedComSlot];
@@ -435,44 +399,6 @@ NOINLINE static IUnknown* GetCOMIPFromRCWHelper(LPVOID pFCall, OBJECTREF pSrc, M
pRetUnk.Release();
}
-#ifndef FEATURE_CORECLR
-#ifdef _TARGET_X86_
- GCX_PREEMP();
- Stub *pInterceptStub = NULL;
-
- if (pComInfo->m_pInterceptStub == NULL)
- {
- if (pComInfo->HasCopyCtorArgs())
- {
- // static stub that gets its arguments in a thread-static field
- pInterceptStub = NDirect::GetStubForCopyCtor();
- }
-
- if (NDirect::IsHostHookEnabled())
- {
- pInterceptStub = pComInfo->GenerateStubForHost(
- pMD->GetDomain()->GetLoaderAllocator()->GetStubHeap(),
- pInterceptStub);
- }
-
- EnsureWritablePages(&pComInfo->m_pInterceptStub);
-
- if (pInterceptStub != NULL)
- {
- if (InterlockedCompareExchangeT(&pComInfo->m_pInterceptStub,
- (LPVOID)pInterceptStub->GetEntryPoint(),
- NULL) != NULL)
- {
- pInterceptStub->DecRef();
- }
- }
- else
- {
- pComInfo->m_pInterceptStub = (LPVOID)-1;
- }
- }
-#endif // _TARGET_X86_
-#endif // !FEATURE_CORECLR
*ppTarget = GetCOMIPFromRCW_GetTarget(pRetUnk, pComInfo);
_ASSERTE(*ppTarget != NULL);
@@ -1285,109 +1211,7 @@ FCIMPL2(void*, StubHelpers::GetDelegateTarget, DelegateObject *pThisUNSAFE, UINT
}
FCIMPLEND
-#ifndef FEATURE_CORECLR // CAS
-static void DoDeclarativeActionsForPInvoke(MethodDesc* pCurrent)
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- THROWS;
- SO_INTOLERANT;
- }
- CONTRACTL_END;
-
- MethodSecurityDescriptor MDSecDesc(pCurrent);
- MethodSecurityDescriptor::LookupOrCreateMethodSecurityDescriptor(&MDSecDesc);
-
- DeclActionInfo* pRuntimeDeclActionInfo = MDSecDesc.GetRuntimeDeclActionInfo();
- if (pRuntimeDeclActionInfo != NULL)
- {
- // Tell the debugger not to start on any managed code that we call in this method
- FrameWithCookie<DebuggerSecurityCodeMarkFrame> __dbgSecFrame;
-
- Security::DoDeclarativeActions(pCurrent, pRuntimeDeclActionInfo, NULL, &MDSecDesc);
-
- // Pop the debugger frame
- __dbgSecFrame.Pop();
- }
-}
-#endif // FEATURE_CORECLR
-
-#ifndef FEATURE_CORECLR
-#ifndef _WIN64
-FCIMPL3(void*, StubHelpers::GetFinalStubTarget, LPVOID pStubArg, LPVOID pUnmngThis, DWORD dwFlags)
-{
- CONTRACTL
- {
- FCALL_CHECK;
- PRECONDITION(SF_IsForwardStub(dwFlags));
- }
- CONTRACTL_END;
-
- if (SF_IsCALLIStub(dwFlags))
- {
- // stub argument is the target
- return pStubArg;
- }
- else if (SF_IsDelegateStub(dwFlags))
- {
- // stub argument is not used but we pass _methodPtrAux which is the target
- return pStubArg;
- }
- else if (SF_IsCOMStub(dwFlags))
- {
- // stub argument is a ComPlusCallMethodDesc
- ComPlusCallMethodDesc *pCMD = (ComPlusCallMethodDesc *)pStubArg;
- LPVOID *lpVtbl = *(LPVOID **)pUnmngThis;
- return lpVtbl[pCMD->m_pComPlusCallInfo->m_cachedComSlot];
- }
- else // P/Invoke
- {
- // secret stub argument is an NDirectMethodDesc
- NDirectMethodDesc *pNMD = (NDirectMethodDesc *)pStubArg;
- return pNMD->GetNativeNDirectTarget();
- }
-}
-FCIMPLEND
-#endif // !_WIN64
-
-FCIMPL1(void, StubHelpers::DemandPermission, NDirectMethodDesc *pNMD)
-{
- FCALL_CONTRACT;
- // ETWOnStartup (SecurityCatchCall, SecurityCatchCallEnd); // this is messing up HMF below
-
- if (pNMD != NULL)
- {
- g_IBCLogger.LogMethodDescAccess(pNMD);
-
- if (pNMD->IsInterceptedForDeclSecurity())
- {
- if (pNMD->IsInterceptedForDeclSecurityCASDemandsOnly() &&
- SecurityStackWalk::HasFlagsOrFullyTrusted(1 << SECURITY_UNMANAGED_CODE))
- {
- // Track perfmon counters. Runtime security checks.
- Security::IncrementSecurityPerfCounter();
- }
- else
- {
- HELPER_METHOD_FRAME_BEGIN_0();
- DoDeclarativeActionsForPInvoke(pNMD);
- HELPER_METHOD_FRAME_END();
- }
- }
- }
- else
- {
- // This is either CLR->COM or delegate P/Invoke (we don't call this helper for CALLI).
- HELPER_METHOD_FRAME_BEGIN_0();
- SecurityStackWalk::SpecialDemand(SSWT_DECLARATIVE_DEMAND, SECURITY_UNMANAGED_CODE);
- HELPER_METHOD_FRAME_END();
- }
-}
-FCIMPLEND
-#endif // !FEATURE_CORECLR
FCIMPL2(void, StubHelpers::ThrowInteropParamException, UINT resID, UINT paramIdx)
{
diff --git a/src/vm/stubhelpers.h b/src/vm/stubhelpers.h
index b64d2868d8..f7577d7a44 100644
--- a/src/vm/stubhelpers.h
+++ b/src/vm/stubhelpers.h
@@ -95,12 +95,6 @@ public:
static FCDECL1(void*, GetNDirectTarget, NDirectMethodDesc* pNMD);
static FCDECL2(void*, GetDelegateTarget, DelegateObject *pThisUNSAFE, UINT_PTR *ppStubArg);
-#ifndef FEATURE_CORECLR
-#ifndef _WIN64
- static FCDECL3(void*, GetFinalStubTarget, LPVOID pStubArg, LPVOID pUnmngThis, DWORD dwFlags);
-#endif // !_WIN64
- static FCDECL1(void, DemandPermission, NDirectMethodDesc *pNMD);
-#endif // !FEATURE_CORECLR
static FCDECL2(void, ThrowInteropParamException, UINT resID, UINT paramIdx);
static FCDECL1(Object*, GetHRExceptionObject, HRESULT hr);
diff --git a/src/vm/syncblk.cpp b/src/vm/syncblk.cpp
index 171a8d3bb7..826507e535 100644
--- a/src/vm/syncblk.cpp
+++ b/src/vm/syncblk.cpp
@@ -3298,10 +3298,6 @@ bool AwareLock::Contention(INT32 timeOut)
COUNTER_ONLY(GetPerfCounters().m_LocksAndThreads.cContention++);
-#ifndef FEATURE_CORECLR
- // Fire a contention start event for a managed contention
- FireEtwContentionStart_V1(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
LogContention();
Thread *pCurThread = GetThread();
@@ -3406,9 +3402,6 @@ entered: ;
Enter();
bEntered = TRUE;
}
-#ifndef FEATURE_CORECLR
- FireEtwContentionStop(ETW::ContentionLog::ContentionStructs::ManagedContention, GetClrInstanceId());
-#endif // !FEATURE_CORECLR
return bEntered;
}
diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp
index 5bb9bf35d7..3c90c87c1e 100644
--- a/src/vm/threads.cpp
+++ b/src/vm/threads.cpp
@@ -612,14 +612,6 @@ void Thread::ChooseThreadCPUGroupAffinity()
if (!CPUGroupInfo::CanEnableGCCPUGroups() || !CPUGroupInfo::CanEnableThreadUseAllCpuGroups())
return;
-#ifndef FEATURE_CORECLR
- // We only handle the non-hosted case here. If CLR is hosted, the hosting
- // process controls the physical OS Threads. If CLR is not hosted, we can
- // set thread group affinity on OS threads directly.
- HostComHolder<IHostTask> pHostTask (GetHostTaskWithAddRef());
- if (pHostTask != NULL)
- return;
-#endif //!FEATURE_CORECLR
//Borrow the ThreadStore Lock here: Lock ThreadStore before distributing threads
ThreadStoreLockHolder TSLockHolder(TRUE);
@@ -652,14 +644,6 @@ void Thread::ClearThreadCPUGroupAffinity()
if (!CPUGroupInfo::CanEnableGCCPUGroups() || !CPUGroupInfo::CanEnableThreadUseAllCpuGroups())
return;
-#ifndef FEATURE_CORECLR
- // We only handle the non-hosted case here. If CLR is hosted, the hosting
- // process controls the physical OS Threads. If CLR is not hosted, we can
- // set thread group affinity on OS threads directly.
- HostComHolder<IHostTask> pHostTask (GetHostTaskWithAddRef());
- if (pHostTask != NULL)
- return;
-#endif //!FEATURE_CORECLR
ThreadStoreLockHolder TSLockHolder(TRUE);
@@ -1919,11 +1903,6 @@ Thread::Thread()
m_dwLockCount = 0;
m_dwBeginLockCount = 0;
-#ifndef FEATURE_CORECLR
- m_dwBeginCriticalRegionCount = 0;
- m_dwCriticalRegionCount = 0;
- m_dwThreadAffinityCount = 0;
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
dbg_m_cSuspendedThreads = 0;
@@ -2898,106 +2877,6 @@ HANDLE Thread::CreateUtilityThread(Thread::StackSizeBucket stackSizeBucket, LPTH
return hThread;
}
-#ifndef FEATURE_CORECLR
-/*
- The following are copied from MSDN:
- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/thread_stack_size.asp
-
- To change the initially committed stack space, use the dwStackSize parameter of the CreateThread,
- CreateRemoteThread, or CreateFiber function. This value is rounded up to the nearest page.
- Generally, the reserve size is the default reserve size specified in the executable header.
- However, if the initially committed size specified by dwStackSize is larger than the default reserve size,
- the reserve size is this new commit size rounded up to the nearest multiple of 1 MB.
-
- To change the reserved stack size, set the dwCreationFlags parameter of CreateThread or CreateRemoteThread
- to STACK_SIZE_PARAM_IS_A_RESERVATION and use the dwStackSize parameter. In this case, the initially
- committed size is the default size specified in the executable header.
-
-*/
-BOOL Thread::CheckThreadStackSize(SIZE_T *pSizeToCommitOrReserve,
- BOOL isSizeToReserve // When TRUE, the previous argument is the stack size to reserve.
- // Otherwise, it is the size to commit.
- )
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- //g_SystemInfo is global pointer to SYSTEM_INFO struct
- SIZE_T dwAllocSize = (SIZE_T)g_SystemInfo.dwAllocationGranularity;
- SIZE_T dwPageSize = (SIZE_T)g_SystemInfo.dwPageSize;
-
- //Don't want users creating threads
- // with a stackSize request < 256K
- //This value may change up or down as we see fit so don't doc to user
- //
- if(isSizeToReserve && 0x40000 > (*pSizeToCommitOrReserve))
- {
- *pSizeToCommitOrReserve = 0x40000;
- }
-
- *pSizeToCommitOrReserve = ALIGN(*pSizeToCommitOrReserve, dwAllocSize);
-
- //
- // Let's get the stack sizes from the PE file that started process.
- //
- SIZE_T ExeSizeOfStackReserve = 0;
- SIZE_T ExeSizeOfStackCommit = 0;
-
- if (!GetProcessDefaultStackSize(&ExeSizeOfStackReserve, &ExeSizeOfStackCommit))
- return FALSE;
-
- // Now let's decide which sizes OS are going to use.
- SIZE_T sizeToReserve = 0;
- SIZE_T sizeToCommit = 0;
-
- if (isSizeToReserve) {
- // The passed-in *pSizeToCommitOrReserve is the stack size to reserve.
- sizeToReserve = *pSizeToCommitOrReserve;
- // OS will use ExeSizeOfStackCommit as the commited size.
- sizeToCommit = ExeSizeOfStackCommit;
- }
- else {
- // The passed-in *pSizeToCommitOrReserve is the stack size to commit.
- sizeToCommit = *pSizeToCommitOrReserve;
- // OS will use ExeSizeOfStackReserve as the reserved size.
- sizeToReserve = ExeSizeOfStackReserve;
-
- // However, if the initially committed size specified by dwStackSize is larger than
- // the default reserve size, the reserve size is this new commit size rounded up to
- // the nearest multiple of 1 MB.
- if (sizeToCommit > ExeSizeOfStackReserve) {
- sizeToReserve = ALIGN(sizeToCommit, 0x1000000);
- }
-
- if (!g_pConfig->GetDisableCommitThreadStack())
- {
- // We will commit the full stack when a thread starts. But if the PageFile is full, we may hit
- // stack overflow at random places during startup.
- // Therefore if we are unlikely to obtain space from PageFile, we will fail creation of a thread.
-
- *pSizeToCommitOrReserve = sizeToReserve - HARD_GUARD_REGION_SIZE;
-
- // OS's behavior is not consistent on if guard page is marked when we ask OS to commit the stack
- // up to 2nd to last page.
- // On Win2k3, the 2nd to last page is marked with guard bit.
- // On WinXP, the 2nd to last page is not marked with guard bit.
- // To be safe, we will not commit the 2nd to last page.
- *pSizeToCommitOrReserve -= HARD_GUARD_REGION_SIZE;
- // To make it more interesting, on X64, if we request to commit stack except the last two pages,
- // OS commit the whole stack, and mark the last two pages as guard page.
- *pSizeToCommitOrReserve -= 2*HARD_GUARD_REGION_SIZE;
- }
- }
-
- // Ok, we now know what sizes OS will use to create the thread.
- // Check to see if we have the room for guard pages.
- return ThreadWillCreateGuardPage(sizeToReserve, sizeToCommit);
-}
-#endif // FEATURE_CORECLR
BOOL Thread::GetProcessDefaultStackSize(SIZE_T* reserveSize, SIZE_T* commitSize)
{
@@ -3059,7 +2938,6 @@ BOOL Thread::CreateNewOSThread(SIZE_T sizeToCommitOrReserve, LPTHREAD_START_ROUT
HANDLE h = NULL;
DWORD dwCreationFlags = CREATE_SUSPENDED;
-#ifdef FEATURE_CORECLR
dwCreationFlags |= STACK_SIZE_PARAM_IS_A_RESERVATION;
#ifndef FEATURE_PAL // the PAL does its own adjustments as necessary
@@ -3070,29 +2948,6 @@ BOOL Thread::CreateNewOSThread(SIZE_T sizeToCommitOrReserve, LPTHREAD_START_ROUT
sizeToCommitOrReserve = OS_PAGE_SIZE + 1;
}
#endif // !FEATURE_PAL
-#else
- if(sizeToCommitOrReserve != 0)
- {
- dwCreationFlags |= STACK_SIZE_PARAM_IS_A_RESERVATION;
-
- //
- // In this case we also force CommitThreadStack to commit the whole stack, even if we're configured not to do so.
- // The config value is used to reduce the resource usage for default stack allocations; for non-default allocations,
- // we assume the user has given us the correct size (and they're really going to need it). This way we don't
- // need to offer a Thread constructor that takes a confusing "stack size param is a commit size" parameter.
- //
- SetThreadStateNC(TSNC_ForceStackCommit);
- }
-
- // Check that we will have (reserved and never committed) guard pages at the end of the stack.
- // If this call returns false then it will lead to an OOM exception on return.
- // This is reasonable since a large stack was requested and we couldn't get it.
- if(!CheckThreadStackSize(&sizeToCommitOrReserve,
- (sizeToCommitOrReserve != 0)))
- {
- return FALSE;
- }
-#endif
intermediateThreadParam* lpThreadArgs = new (nothrow) intermediateThreadParam;
if (lpThreadArgs == NULL)
@@ -4236,10 +4091,6 @@ DWORD MsgWaitHelper(int numWaiters, HANDLE* phEvent, BOOL bWaitAll, DWORD millis
// So on CoreCLR (where FEATURE_COMINTEROP is not currently defined) we can actually reach this point.
// We can't fix this, because it's a breaking change, so we just won't assert here.
// The result is that WaitAll on an STA thread in CoreCLR will behave stragely, as described above.
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORECLR)
- else
- _ASSERTE(!"WaitAll in an STA with more than one handle will deadlock");
-#endif
}
if (bWaitAll)
@@ -7707,81 +7558,6 @@ __declspec(noinline) void AllocateSomeStack(){
BOOL Thread::CommitThreadStack(Thread* pThreadOptional)
{
-#ifndef FEATURE_CORECLR
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- if (FAILED(CLRSetThreadStackGuarantee(STSGuarantee_Force)))
- return FALSE;
-
- if (g_pConfig->GetDisableCommitThreadStack() && (pThreadOptional == NULL || !pThreadOptional->HasThreadStateNC(TSNC_ForceStackCommit)))
- return TRUE;
-
-
- // This is a temporary fix for VSWhidbey 259155. In CommitThreadStack() we determine the bounds of the
- // region between the guard page and the hard guard region for a thread's stack and then commit that
- // region. Sometimes we cross a page boundary while calculating the bounds or doing the commit (in
- // VirtualQuery or VirtualAlloc), such that the guard page is moved after we've already gotten it's
- // location. When that happens we commit too many pages and destroy the guard page. To fix this we
- // do a small stack allocation that ensures that we have enough stack space for all of the
- // CommitThreadStack() work
-
- AllocateSomeStack();
-
- // Grab the info about the first region of the stack. First, we grab the region where we are now (&tmpMBI),
- // then we use the allocation base of that to grab the first region.
- MEMORY_BASIC_INFORMATION tmpMBI;
- SIZE_T dwRes;
-
- dwRes = ClrVirtualQuery((const void *)&tmpMBI, &tmpMBI, sizeof(MEMORY_BASIC_INFORMATION));
-
- if (sizeof(MEMORY_BASIC_INFORMATION) != dwRes)
- {
- return FALSE;
- }
-
- dwRes = ClrVirtualQuery((const void *)((BYTE*)tmpMBI.AllocationBase + HARD_GUARD_REGION_SIZE), &tmpMBI, sizeof(MEMORY_BASIC_INFORMATION));
-
- if (sizeof(MEMORY_BASIC_INFORMATION) != dwRes)
- {
- return FALSE;
- }
-
- // We commit the reserved part of the stack, if necessary, minus one page for the "hard" guard page.
- if (tmpMBI.State == MEM_RESERVE)
- {
- // Note: we leave the "hard" guard region uncommitted.
- void *base = (BYTE*)tmpMBI.AllocationBase + HARD_GUARD_REGION_SIZE;
-
- // We are committing a page on stack. If we call host for this operation,
- // host needs to avoid adding it to the memory consumption. Therefore
- // we call into OS directly.
-#undef VirtualAlloc
- void *p = VirtualAlloc(base,
- tmpMBI.RegionSize,
- MEM_COMMIT,
- PAGE_READWRITE);
-#define VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect) \
- Dont_Use_VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect)
-
- if (p != base )
- {
- DWORD err = GetLastError();
- STRESS_LOG2(LF_EH, LL_ALWAYS,
- "Thread::CommitThreadStack: failed to commit stack for TID 0x%x with error 0x%x\n",
- ::GetCurrentThreadId(), err);
-
- return FALSE;
- }
- }
-
- INDEBUG(DebugLogStackMBIs());
-
-#endif
return TRUE;
}
@@ -8802,10 +8578,6 @@ void Thread::EnterContextRestricted(Context *pContext, ContextTransitionFrame *p
{
pFrame->SetLockCount(m_dwBeginLockCount);
m_dwBeginLockCount = m_dwLockCount;
-#ifndef FEATURE_CORECLR
- pFrame->SetCriticalRegionCount(m_dwBeginCriticalRegionCount);
- m_dwBeginCriticalRegionCount = m_dwCriticalRegionCount;
-#endif // !FEATURE_CORECLR
}
if (m_Context == pContext) {
@@ -8849,22 +8621,6 @@ void Thread::EnterContextRestricted(Context *pContext, ContextTransitionFrame *p
PushDomain(pDomain->GetId());
STRESS_LOG1(LF_APPDOMAIN, LL_INFO100000, "Entering into ADID=%d\n", pDomain->GetId().m_dwId);
-#ifndef FEATURE_CORECLR
- //
- // Push execution contexts (that could contain call context) into frame to avoid leaks
- //
-
- if (IsExposedObjectSet())
- {
- THREADBASEREF ref = (THREADBASEREF) ObjectFromHandle(m_ExposedObject);
- _ASSERTE(ref != NULL);
- if (ref->GetExecutionContext() != NULL)
- {
- pFrame->SetReturnExecutionContext(ref->GetExecutionContext());
- ref->SetExecutionContext(NULL);
- }
- }
-#endif //!FEATURE_CORECLR
//
// Store the last thrown object in the ContextTransitionFrame before we null it out
@@ -8989,10 +8745,6 @@ void Thread::ReturnToContext(ContextTransitionFrame *pFrame)
m_dwLockCount = m_dwBeginLockCount;
m_dwBeginLockCount = pFrame->GetLockCount();
-#ifndef FEATURE_CORECLR
- m_dwCriticalRegionCount = m_dwBeginCriticalRegionCount;
- m_dwBeginCriticalRegionCount = pFrame->GetCriticalRegionCount();
-#endif // !FEATURE_CORECLR
}
@@ -9068,18 +8820,6 @@ void Thread::ReturnToContext(ContextTransitionFrame *pFrame)
if (fChangedDomains)
{
-#ifndef FEATURE_CORECLR
- //
- // Pop execution contexts (could contain call context) from frame if applicable
- //
-
- if (IsExposedObjectSet())
- {
- THREADBASEREF ref = (THREADBASEREF) ObjectFromHandle(m_ExposedObject);
- _ASSERTE(ref != NULL);
- ref->SetExecutionContext(pFrame->GetReturnExecutionContext());
- }
-#endif //!FEATURE_CORECLR
// Do this last so that thread is not labeled as out of the domain until all cleanup is done.
ADID adid=pCurrentDomain->GetId();
@@ -9192,11 +8932,9 @@ void Thread::RaiseCrossContextExceptionHelper(Exception* pEx, ContextTransitionF
// Ensure that IP for WatsonBucketing has been collected if the exception is preallocated.
#ifdef _DEBUG
-#ifdef FEATURE_CORECLR
// On CoreCLR, Watson may not be enabled. Thus, we should
// skip this.
if (IsWatsonEnabled())
-#endif // FEATURE_CORECLR
{
if (CLRException::IsPreallocatedExceptionObject(CLRException::GetThrowableFromException(pEx)))
{
@@ -9491,11 +9229,7 @@ void DECLSPEC_NORETURN Thread::RaiseCrossContextException(Exception* pExOrig, Co
switch (kind)
{
case kLastException:
-#ifdef FEATURE_CORECLR
gc.pMarshaledThrowable = gc.orBlob;
-#else
- AppDomainHelper::UnmarshalObject(GetAppDomain(), &gc.orBlob, &gc.pMarshaledThrowable);
-#endif //FEATURE_CORECLR
break;
case kOutOfMemoryException:
@@ -10225,7 +9959,6 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO
{
_ASSERTE(flags == MTCSF_NormalBase);
-#ifdef FEATURE_CORECLR
if(!IsSingleAppDomain())
{
// This assert shouldnt be hit in CoreCLR since:
@@ -10239,11 +9972,9 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO
// So, if this is hit, something is not right!
_ASSERTE(!"How come a managed thread in CoreCLR has suffered unhandled exception in DefaultDomain?");
}
-#endif // FEATURE_CORECLR
LOG((LF_EH, LL_INFO100, "ThreadBaseRedirectingFilter: setting TSNC_ProcessedUnhandledException\n"));
-#if defined(FEATURE_CORECLR)
//
// In the default domain, when an exception goes unhandled on a managed thread whose threadbase is in the VM (e.g. explicitly spawned threads,
// ThreadPool threads, finalizer thread, etc), CLR can end up in the unhandled exception processing path twice.
@@ -10271,7 +10002,6 @@ static LONG ThreadBaseRedirectingFilter(PEXCEPTION_POINTERS pExceptionInfo, LPVO
// will fail to honor the host policy (e.g. swallow unhandled exception). Thus, the 2nd unhandled exception may end up crashing the app when it should not.
//
if (IsSingleAppDomain() && (ret != EXCEPTION_EXECUTE_HANDLER))
-#endif // defined(FEATURE_CORECLR)
{
// Since we have already done unhandled exception processing for it, we dont want it
// to happen again if our UEF gets invoked upon returning back to the OS.
@@ -10321,9 +10051,7 @@ static void ManagedThreadBase_DispatchOuter(ManagedThreadCallState *pCallState)
TryParam *pTryParam;
Thread *pThread;
-#ifdef FEATURE_CORECLR
BOOL *pfHadException;
-#endif // FEATURE_CORECLR
#ifdef WIN64EXCEPTIONS
Frame *pFrame;
@@ -10333,10 +10061,8 @@ static void ManagedThreadBase_DispatchOuter(ManagedThreadCallState *pCallState)
args.pTryParam = &param;
args.pThread = pThread;
-#ifdef FEATURE_CORECLR
BOOL fHadException = TRUE;
args.pfHadException = &fHadException;
-#endif // FEATURE_CORECLR
#ifdef WIN64EXCEPTIONS
args.pFrame = pFrame;
@@ -10368,13 +10094,10 @@ static void ManagedThreadBase_DispatchOuter(ManagedThreadCallState *pCallState)
}
PAL_ENDTRY;
-#ifdef FEATURE_CORECLR
*(pArgs->pfHadException) = FALSE;
-#endif // FEATURE_CORECLR
}
PAL_FINALLY
{
-#ifdef FEATURE_CORECLR
// If we had a breakpoint exception that has gone unhandled,
// then switch to the correct AD context. Its fine to do this
// here because:
@@ -10386,7 +10109,6 @@ static void ManagedThreadBase_DispatchOuter(ManagedThreadCallState *pCallState)
{
ReturnToPreviousAppDomain();
}
-#endif // FEATURE_CORECLR
catchFrame.Pop();
}
PAL_ENDTRY;
@@ -11720,13 +11442,6 @@ void Thread::InternalReset(BOOL fFull, BOOL fNotFinalizerThread, BOOL fThreadObj
FullResetThread();
}
-#ifndef FEATURE_CORECLR
- _ASSERTE (m_dwCriticalRegionCount == 0);
- m_dwCriticalRegionCount = 0;
-
- _ASSERTE (m_dwThreadAffinityCount == 0);
- m_dwThreadAffinityCount = 0;
-#endif // !FEATURE_CORECLR
//m_MarshalAlloc.Collapse(NULL);
@@ -11850,9 +11565,6 @@ HRESULT Thread::Reset(BOOL fFull)
ResetThreadStateNC(TSNC_UnbalancedLocks);
m_dwLockCount = 0;
-#ifndef FEATURE_CORECLR
- m_dwCriticalRegionCount = 0;
-#endif // !FEATURE_CORECLR
InternalSwitchOut();
m_OSThreadId = SWITCHED_OUT_FIBER_OSID;
@@ -12227,9 +11939,6 @@ HRESULT Thread::LocksHeld(SIZE_T *pLockCount)
LIMITED_METHOD_CONTRACT;
*pLockCount = m_dwLockCount;
-#ifndef FEATURE_CORECLR
- *pLockCount += m_dwCriticalRegionCount;
-#endif // !FEATURE_CORECLR
return S_OK;
}
@@ -12823,37 +12532,6 @@ void Thread::BeginThreadAffinity()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- if (!CLRTaskHosted())
- {
- return;
- }
-
- if (IsGCSpecialThread() || IsDbgHelperSpecialThread())
- {
- return;
- }
-
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- IHostTaskManager *pManager = CorHost2::GetHostTaskManager();
-
- HRESULT hr;
-
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- hr = pManager->BeginThreadAffinity();
- END_SO_TOLERANT_CODE_CALLING_HOST;
- _ASSERTE (hr == S_OK);
- Thread *pThread = GetThread();
-
- if (pThread)
- {
- pThread->IncThreadAffinityCount();
-#ifdef _DEBUG
- pThread->AddFiberInfo(Thread::ThreadTrackInfo_Affinity);
-#endif
- }
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
-#endif // !FEATURE_CORECLR
}
@@ -12862,40 +12540,6 @@ void Thread::EndThreadAffinity()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- if (!CLRTaskHosted())
- {
- return;
- }
-
- if (IsGCSpecialThread() || IsDbgHelperSpecialThread())
- {
- return;
- }
-
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- IHostTaskManager *pManager = CorHost2::GetHostTaskManager();
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
-
- Thread *pThread = GetThread();
- if (pThread)
- {
- pThread->DecThreadAffinityCount ();
-#ifdef _DEBUG
- pThread->AddFiberInfo(Thread::ThreadTrackInfo_Affinity);
-#endif
- }
-
-#ifdef FEATURE_INCLUDE_ALL_INTERFACES
- HRESULT hr = S_OK;
-
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- hr = pManager->EndThreadAffinity();
- END_SO_TOLERANT_CODE_CALLING_HOST;
-
- _ASSERTE (hr == S_OK);
-#endif // FEATURE_INCLUDE_ALL_INTERFACES
-#endif // !FEATURE_CORECLR
}
void Thread::SetupThreadForHost()
diff --git a/src/vm/threads.h b/src/vm/threads.h
index 0d0dd30cae..a7f400e7dc 100644
--- a/src/vm/threads.h
+++ b/src/vm/threads.h
@@ -585,12 +585,7 @@ inline Thread* GetThreadNULLOk()
#endif
//***************************************************************************
-#if defined(_DEBUG) && defined(_TARGET_X86_) && !defined(FEATURE_CORECLR)
- #define HAS_TRACK_CXX_EXCEPTION_CODE_HACK 1
- #define TRACK_CXX_EXCEPTION_CODE_HACK
-#else
#define HAS_TRACK_CXX_EXCEPTION_CODE_HACK 0
-#endif
// manifest constant for waiting in the exposed classlibs
const INT32 INFINITE_TIMEOUT = -1;
@@ -1641,13 +1636,6 @@ public:
// in the object header to store it.
DWORD m_ThreadId;
- #if HAS_TRACK_CXX_EXCEPTION_CODE_HACK // do we have C++ exception code tracking?
- // It's very hard to deal with SEH properly using C++ catch handlers. The
- // following field is updated with the correct SEH exception whenever a C++
- // __CxxFrameHandler3 call is made on this thread. If you grab it at the
- // top of a C++ catch(...), it's likely to be correct.
- DWORD m_LastCxxSEHExceptionCode;
- #endif // HAS_TRACK_CXX_EXCEPTION_CODE_HACK
// RWLock state
LockEntry *m_pHead;
@@ -1790,12 +1778,6 @@ public:
private:
DWORD m_dwBeginLockCount; // lock count when the thread enters current domain
-#ifndef FEATURE_CORECLR
- DWORD m_dwBeginCriticalRegionCount; // lock count when the thread enters current domain
- DWORD m_dwCriticalRegionCount;
-
- DWORD m_dwThreadAffinityCount;
-#endif // !FEATURE_CORECLR
#ifdef _DEBUG
DWORD dbg_m_cSuspendedThreads;
@@ -1888,68 +1870,19 @@ public:
LIMITED_METHOD_CONTRACT;
_ASSERTE(m_dwLockCount >= m_dwBeginLockCount);
-#ifndef FEATURE_CORECLR
- _ASSERTE(m_dwCriticalRegionCount >= m_dwBeginCriticalRegionCount);
-#endif // !FEATURE_CORECLR
// Equivalent to (m_dwLockCount != m_dwBeginLockCount ||
// m_dwCriticalRegionCount ! m_dwBeginCriticalRegionCount),
// but without branching instructions
BOOL fHasLock = (m_dwLockCount ^ m_dwBeginLockCount);
-#ifndef FEATURE_CORECLR
- fHasLock |= (m_dwCriticalRegionCount ^ m_dwBeginCriticalRegionCount);
-#endif // !FEATURE_CORECLR
return fHasLock;
}
-#ifndef FEATURE_CORECLR
- inline void BeginCriticalRegion()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- if (CLRHosted())
- {
- m_dwCriticalRegionCount ++;
- _ASSERTE (m_dwCriticalRegionCount != 0);
- }
- }
-
- inline void EndCriticalRegion()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- if (CLRHosted())
- {
- _ASSERTE (m_dwCriticalRegionCount > 0);
- m_dwCriticalRegionCount --;
- }
- }
-
- inline void BeginCriticalRegion_NoCheck()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- m_dwCriticalRegionCount ++;
- _ASSERTE (m_dwCriticalRegionCount != 0);
- }
-
- inline void EndCriticalRegion_NoCheck()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- _ASSERTE (m_dwCriticalRegionCount > 0);
- m_dwCriticalRegionCount --;
- }
-#endif // !FEATURE_CORECLR
inline BOOL HasCriticalRegion()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- return m_dwCriticalRegionCount != 0;
-#else
return FALSE;
-#endif
}
inline DWORD GetNewHashCode()
@@ -2000,45 +1933,11 @@ public:
static void BeginThreadAffinity();
static void EndThreadAffinity();
-#ifndef FEATURE_CORECLR
- inline void IncThreadAffinityCount()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- m_dwThreadAffinityCount++;
- _ASSERTE (m_dwThreadAffinityCount > 0);
- }
- inline void DecThreadAffinityCount()
- {
- LIMITED_METHOD_CONTRACT;
- _ASSERTE (GetThread() == this);
- _ASSERTE (m_dwThreadAffinityCount > 0);
- m_dwThreadAffinityCount --;
- }
-
- static void BeginThreadAffinityAndCriticalRegion()
- {
- LIMITED_METHOD_CONTRACT;
- BeginThreadAffinity();
- GetThread()->BeginCriticalRegion();
- }
-
- static void EndThreadAffinityAndCriticalRegion()
- {
- LIMITED_METHOD_CONTRACT;
- GetThread()->EndCriticalRegion();
- EndThreadAffinity();
- }
-#endif // !FEATURE_CORECLR
BOOL HasThreadAffinity()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_CORECLR
- return m_dwThreadAffinityCount > 0;
-#else
return FALSE;
-#endif
}
private:
@@ -2636,11 +2535,7 @@ private:
//
// In Telesto, we don't support true appdomain marshaling so the "orBlob" is in fact an
// agile wrapper object whose ToString() echoes the original exception's ToString().
-#ifdef FEATURE_CORECLR
typedef OBJECTREF ORBLOBREF;
-#else
- typedef U1ARRAYREF ORBLOBREF;
-#endif
RaiseCrossContextResult TryRaiseCrossContextException(Exception **ppExOrig,
Exception *pException,
@@ -3007,10 +2902,6 @@ public:
static bool SysStartSuspendForDebug(AppDomain *pAppDomain);
static bool SysSweepThreadsForDebug(bool forceSync);
static void SysResumeFromDebug(AppDomain *pAppDomain);
-#ifndef FEATURE_CORECLR
- void UserSuspendThread();
- BOOL UserResumeThread();
-#endif // FEATURE_CORECLR
void UserSleep(INT32 time);
@@ -3983,9 +3874,6 @@ private:
// For getting a thread to a safe point. A client waits on the event, which is
// set by the thread when it reaches a safe spot.
-#ifndef FEATURE_CORECLR
- void FinishSuspendingThread();
-#endif // FEATURE_CORECLR
void SetSafeEvent();
public:
@@ -5605,10 +5493,6 @@ public:
LCID GetThreadCultureIdNoThrow(Thread *pThread, BOOL bUICulture);
-#ifndef FEATURE_CORECLR
-// Request/Remove Thread Affinity for the current thread
-typedef StateHolder<Thread::BeginThreadAffinityAndCriticalRegion, Thread::EndThreadAffinityAndCriticalRegion> ThreadAffinityAndCriticalRegionHolder;
-#endif // !FEATURE_CORECLR
typedef StateHolder<Thread::BeginThreadAffinity, Thread::EndThreadAffinity> ThreadAffinityHolder;
typedef Thread::ForbidSuspendThreadHolder ForbidSuspendThreadHolder;
diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp
index cdfbd79497..d65f3a3af9 100644
--- a/src/vm/threadsuspend.cpp
+++ b/src/vm/threadsuspend.cpp
@@ -3328,32 +3328,6 @@ void Thread::RareDisablePreemptiveGC()
#endif // PROFILING_SUPPORTED
-#if !defined(FEATURE_CORECLR) // simple hosting
- // First, check to see if there's an IDbgThreadControl interface that needs
- // notification of the suspension
- if (m_State & TS_DebugSuspendPending)
- {
- IDebuggerThreadControl *pDbgThreadControl = CorHost::GetDebuggerThreadControl();
-
- if (pDbgThreadControl)
- pDbgThreadControl->ThreadIsBlockingForDebugger();
-
- }
-
- if (CLRGCHosted())
- {
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- CorHost2::GetHostGCManager()->ThreadIsBlockingForSuspension();
- END_SO_TOLERANT_CODE_CALLING_HOST;
- }
-
- // If not, check to see if there's an IGCThreadControl interface that needs
- // notification of the suspension
- IGCThreadControl *pGCThreadControl = CorHost::GetGCThreadControl();
-
- if (pGCThreadControl)
- pGCThreadControl->ThreadIsBlockingForSuspension();
-#endif // !defined(FEATURE_CORECLR)
DWORD status = S_OK;
SetThreadStateNC(TSNC_WaitUntilGCFinished);
@@ -3453,32 +3427,6 @@ void Thread::RareDisablePreemptiveGC()
#endif // PROFILING_SUPPORTED
-#if !defined(FEATURE_CORECLR) // simple hosting
- // First, check to see if there's an IDbgThreadControl interface that needs
- // notification of the suspension
- if (m_State & TS_DebugSuspendPending)
- {
- IDebuggerThreadControl *pDbgThreadControl = CorHost::GetDebuggerThreadControl();
-
- if (pDbgThreadControl)
- pDbgThreadControl->ThreadIsBlockingForDebugger();
-
- }
-
- if (CLRGCHosted())
- {
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- CorHost2::GetHostGCManager()->ThreadIsBlockingForSuspension();
- END_SO_TOLERANT_CODE_CALLING_HOST;
- }
-
- // If not, check to see if there's an IGCThreadControl interface that needs
- // notification of the suspension
- IGCThreadControl *pGCThreadControl = CorHost::GetGCThreadControl();
-
- if (pGCThreadControl)
- pGCThreadControl->ThreadIsBlockingForSuspension();
-#endif // !defined(FEATURE_CORECLR)
// The thread is blocked for shutdown. We do not concern for GC violation.
CONTRACT_VIOLATION(GCViolation);
@@ -3819,34 +3767,12 @@ void Thread::RareEnablePreemptiveGC()
// Life's much simpler this way...
-#if !defined(FEATURE_CORECLR) // simple hosting
- // Check to see if there's an IDbgThreadControl interface that needs
- // notification of the suspension
- if (m_State & TS_DebugSuspendPending)
- {
- IDebuggerThreadControl *pDbgThreadControl = CorHost::GetDebuggerThreadControl();
-
- if (pDbgThreadControl)
- pDbgThreadControl->ThreadIsBlockingForDebugger();
-
- }
-#endif // !defined(FEATURE_CORECLR)
#endif // DEBUGGING_SUPPORTED
#ifdef LOGGING
-#if !defined(FEATURE_CORECLR) // simple hosting
- if (!CorHost::IsDebuggerSpecialThread(GetThreadId()))
-#endif // !defined(FEATURE_CORECLR)
{
LOG((LF_CORDB, LL_INFO1000, "[0x%x] SUSPEND: suspended while enabling gc.\n", GetThreadId()));
}
-#if !defined(FEATURE_CORECLR) // simple hosting
- else
- {
- LOG((LF_CORDB, LL_INFO1000,
- "[0x%x] ALERT: debugger special thread did not suspend while enabling gc.\n", GetThreadId()));
- }
-#endif // !defined(FEATURE_CORECLR)
#endif
WaitSuspendEvents(); // sets bits, too
@@ -4186,20 +4112,8 @@ void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason)
// Notify the interface of the pending suspension
switch (reason) {
case RedirectReason_GCSuspension:
-#if !defined(FEATURE_CORECLR) // simple hosting
- if (CorHost::GetGCThreadControl())
- CorHost::GetGCThreadControl()->ThreadIsBlockingForSuspension();
- if (CLRGCHosted())
- {
- NotifyHostOnGCSuspension();
- }
-#endif // !defined(FEATURE_CORECLR)
break;
case RedirectReason_DebugSuspension:
-#if !defined(FEATURE_CORECLR) // simple hosting
- if (CorHost::GetDebuggerThreadControl() && CorHost::IsDebuggerSpecialThread(pThread->GetThreadId()))
- CorHost::GetDebuggerThreadControl()->ThreadIsBlockingForDebugger();
-#endif // !defined(FEATURE_CORECLR)
break;
case RedirectReason_UserSuspension:
// Do nothing;
@@ -4857,21 +4771,6 @@ HRESULT ThreadSuspend::SuspendRuntime(ThreadSuspend::SUSPEND_REASON reason)
STRESS_LOG1(LF_SYNC, LL_INFO1000, "Thread::SuspendRuntime(reason=0x%x)\n", reason);
-#if !defined(FEATURE_CORECLR) // simple hosting
- // Alert the host that a GC is starting, in case the host is scheduling threads
- // for non-runtime tasks during GC.
- IGCThreadControl *pGCThreadControl = CorHost::GetGCThreadControl();
-
- if (pGCThreadControl)
- pGCThreadControl->SuspensionStarting();
-
- if (CLRGCHosted())
- {
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- CorHost2::GetHostGCManager()->SuspensionStarting();
- END_SO_TOLERANT_CODE_CALLING_HOST;
- }
-#endif // !defined(FEATURE_CORECLR)
#ifdef PROFILING_SUPPORTED
// If the profiler desires information about GCs, then let it know that one
@@ -5562,33 +5461,6 @@ void ThreadSuspend::ResumeRuntime(BOOL bFinishedGC, BOOL SuspendSucceded)
// Notify everyone who cares, that this suspension is over, and this thread is going to go do other things.
//
-#if !defined(FEATURE_CORECLR) // simple hosting
- // Alert the host that a GC is ending, in case the host is scheduling threads
- // for non-runtime tasks during GC.
- IGCThreadControl *pGCThreadControl = CorHost::GetGCThreadControl();
-
- if (pGCThreadControl)
- {
- // If we the suspension was for a GC, tell the host what generation GC.
- DWORD Generation = (bFinishedGC
- ? GCHeapUtilities::GetGCHeap()->GetCondemnedGeneration()
- : ~0U);
-
- pGCThreadControl->SuspensionEnding(Generation);
- }
-
- if (CLRGCHosted())
- {
- // If we the suspension was for a GC, tell the host what generation GC.
- DWORD Generation = (bFinishedGC
- ? GCHeapUtilities::GetGCHeap()->GetCondemnedGeneration()
- : ~0U);
-
- BEGIN_SO_TOLERANT_CODE_CALLING_HOST(GetThread());
- CorHost2::GetHostGCManager()->SuspensionEnding(Generation);
- END_SO_TOLERANT_CODE_CALLING_HOST;
- }
-#endif // !defined(FEATURE_CORECLR)
#ifdef PROFILING_SUPPORTED
// Need to give resume event for the GC thread
@@ -5961,13 +5833,6 @@ bool Thread::SysStartSuspendForDebug(AppDomain *pAppDomain)
// Caller is expected to be holding the ThreadStore lock
_ASSERTE(ThreadStore::HoldingThreadStore() || IsAtProcessExit());
-#if !defined(FEATURE_CORECLR) // simple hosting
- // If there is a debugging thread control object, tell it we're suspending the Runtime.
- IDebuggerThreadControl *pDbgThreadControl = CorHost::GetDebuggerThreadControl();
-
- if (pDbgThreadControl)
- pDbgThreadControl->StartBlockingForDebugger(0);
-#endif // !defined(FEATURE_CORECLR)
// NOTE::NOTE::NOTE::NOTE::NOTE
// This function has parallel logic in SuspendRuntime. Please make
@@ -6341,16 +6206,6 @@ void Thread::SysResumeFromDebug(AppDomain *pAppDomain)
LOG((LF_CORDB, LL_INFO1000, "RESUME: starting resume AD:0x%x.\n", pAppDomain));
-#if !defined(FEATURE_CORECLR) // simple hosting
- // Notify the client that it should release any threads that it had doing work
- // while the runtime was debugger-suspended.
- IDebuggerThreadControl *pIDTC = CorHost::GetDebuggerThreadControl();
- if (pIDTC)
- {
- LOG((LF_CORDB, LL_INFO1000, "RESUME: notifying IDebuggerThreadControl client.\n"));
- pIDTC->ReleaseAllRuntimeThreads();
- }
-#endif // !defined(FEATURE_CORECLR)
// Make sure we completed the previous sync
_ASSERTE(m_DebugWillSyncCount == -1);
@@ -6407,321 +6262,6 @@ void Thread::SysResumeFromDebug(AppDomain *pAppDomain)
LOG((LF_CORDB, LL_INFO1000, "RESUME: resume complete. Trap count: %d\n", g_TrapReturningThreads.Load()));
}
-#ifndef FEATURE_CORECLR
-
-// Suspend a thread at the system level. We distinguish between user suspensions,
-// and system suspensions so that a VB program cannot resume a thread we have
-// suspended for GC.
-//
-// This service won't return until the suspension is complete. This deserves some
-// explanation. The thread is considered to be suspended if it can make no further
-// progress within the EE. For example, a thread that has exited the EE via
-// COM Interop or N/Direct is considered suspended -- if we've arranged it so that
-// the thread cannot return back to the EE without blocking.
-void Thread::UserSuspendThread()
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- // Read the general comments on thread suspension earlier, to understand why we
- // take these locks.
-
- // GC can occur in here:
- STRESS_LOG0(LF_SYNC, LL_INFO100, "UserSuspendThread obtain lock\n");
- ThreadStoreLockHolder tsl;
-
- // User suspensions (e.g. from VB and C#) are distinguished from internal
- // suspensions so a poorly behaved program cannot resume a thread that the system
- // has suspended for GC.
- if (m_State & TS_UserSuspendPending)
- {
- // This thread is already experiencing a user suspension, so ignore the
- // new request.
- _ASSERTE(!ThreadStore::HoldingThreadStore(this));
- }
- else
- if (this != GetThread())
- {
- // First suspension of a thread other than the current one.
- if (m_State & TS_Unstarted)
- {
- // There is an important window in here. T1 can call T2.Start() and then
- // T2.Suspend(). Suspend is disallowed on an unstarted thread. But from T1's
- // point of view, T2 is started. In reality, T2 hasn't been scheduled by the
- // OS, so it is still an unstarted thread. We don't want to perform a normal
- // suspension on it in this case, because it is currently contributing to the
- // PendingThreadCount. We want to get it fully started before we suspend it.
- // This is particularly important if its background status is changing
- // underneath us because otherwise we might not detect that the process should
- // be exited at the right time.
- //
- // It turns out that this is a simple situation to implement. We are holding
- // the ThreadStoreLock. TransferStartedThread will likewise acquire that
- // lock. So if we detect it, we simply set a bit telling the thread to
- // suspend itself. This is NOT the normal suspension request because we don't
- // want the thread to suspend until it has fully started.
- FastInterlockOr((ULONG *) &m_State, TS_SuspendUnstarted);
- }
- else if (m_State & (TS_Detached | TS_Dead))
- {
- return;
- }
- else
- {
- // We just want to trap this thread if it comes back into cooperative mode
- SetupForSuspension(TS_UserSuspendPending);
- m_SafeEvent.Reset();
-
- // Pause it so we can operate on it without it squirming under us.
-RetrySuspension:
- // We can not allocate memory after we suspend a thread.
- // Otherwise, we may deadlock the process when CLR is hosted.
- ThreadStore::AllocateOSContext();
-
- SuspendThreadResult str = SuspendThread();
-
- // The only safe place to suspend a thread asynchronously is if it is in
- // fully interruptible cooperative JIT code. Preemptive mode can hold all
- // kinds of locks that make it unsafe to suspend. All other cases are
- // handled somewhat synchronously (e.g. through hijacks, GC mode toggles, etc.)
- //
- // For example, on a SMP if the thread is blocked waiting for the ThreadStore
- // lock, it can cause a deadlock if we suspend it (even though it is in
- // preemptive mode).
- //
- // If a thread is in preemptive mode (including the tricky optimized N/Direct
- // case), we can just mark it for suspension. It will make no further progress
- // in the EE.
- if (str == STR_NoStressLog)
- {
- // We annot assume anything about the thread's current state.
- goto RetrySuspension;
- }
- else if (!m_fPreemptiveGCDisabled)
- {
- MarkForSuspension(TS_UserSuspendPending);
-
- // Let the thread run until it reaches a safe spot.
- if (str == STR_Success)
- {
- ResumeThread();
- }
- }
- else if (str == STR_Failure || str == STR_UnstartedOrDead)
- {
- // The thread cannot be unstarted, as we have already
- // checked for that above.
- _ASSERTE(!(m_State & TS_Unstarted));
-
- // Nothing to do if the thread has already terminated.
- }
- else if (str == STR_SwitchedOut)
- {
- goto RetrySuspension;
- }
- else
- {
- _ASSERTE(str == STR_Success);
-#if defined(FEATURE_HIJACK) && !defined(PLATFORM_UNIX)
- WorkingOnThreadContextHolder workingOnThreadContext(this);
- if (workingOnThreadContext.Acquired() && HandledJITCase())
- {
- _ASSERTE(m_fPreemptiveGCDisabled);
- // Redirect thread so we can capture a good thread context
- // (GetThreadContext is not sufficient, due to an OS bug).
- // If we don't succeed (should only happen on Win9X, due to
- // a different OS bug), we must resume the thread and try
- // again.
- if (!CheckForAndDoRedirectForUserSuspend())
- {
- ResumeThread();
- goto RetrySuspension;
- }
- }
-#endif // FEATURE_HIJACK && !PLATFORM_UNIX
-
- // Thread is executing in cooperative mode. We're going to have to
- // move it to a safe spot.
- MarkForSuspension(TS_UserSuspendPending);
-
- // Let the thread run until it reaches a safe spot.
- ResumeThread();
-
- // wait until it leaves cooperative GC mode or is JIT suspended
- FinishSuspendingThread();
- }
- }
- }
- else
- {
- GCX_PREEMP();
- SetupForSuspension(TS_UserSuspendPending);
- MarkForSuspension(TS_UserSuspendPending);
-
- // prepare to block ourselves
- tsl.Release();
- _ASSERTE(!ThreadStore::HoldingThreadStore(this));
-
- WaitSuspendEvents();
- }
-}
-
-
-// if the only suspension of this thread is user imposed, resume it. But don't
-// resume from any system suspensions (like GC).
-BOOL Thread::UserResumeThread()
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- }
- CONTRACTL_END;
-
- // If we are attempting to resume when we aren't in a user suspension,
- // its an error.
- BOOL res = FALSE;
-
- // Note that the model does not count. In other words, you can call Thread.Suspend()
- // five times and Thread.Resume() once. The result is that the thread resumes.
-
- STRESS_LOG0(LF_SYNC, INFO3, "UserResumeThread obtain lock\n");
- ThreadStoreLockHolder TSLockHolder;
-
- // If we have marked a thread for suspension, while that thread is still starting
- // up, simply remove the bit to resume it.
- if (m_State & TS_SuspendUnstarted)
- {
- _ASSERTE((m_State & TS_UserSuspendPending) == 0);
- FastInterlockAnd((ULONG *) &m_State, ~TS_SuspendUnstarted);
- res = TRUE;
- }
-
- // If we are still trying to suspend the thread, forget about it.
- if (m_State & TS_UserSuspendPending)
- {
- ReleaseFromSuspension(TS_UserSuspendPending);
- SetSafeEvent();
- res = TRUE;
- }
-
- return res;
-}
-
-
-// We are asynchronously trying to suspend this thread. Stay here until we achieve
-// that goal (in fully interruptible JIT code), or the thread dies, or it leaves
-// the EE (in which case the Pending flag will cause it to synchronously suspend
-// itself later, or if the thread tells us it is going to synchronously suspend
-// itself because of hijack activity, etc.
-void Thread::FinishSuspendingThread()
-{
- CONTRACTL {
- NOTHROW;
- if (GetThread()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
- }
- CONTRACTL_END;
-
- DWORD res;
-
- // There are two threads of interest -- the current thread and the thread we are
- // going to wait for. Since the current thread is about to wait, it's important
- // that it be in preemptive mode at this time.
-
-#if _DEBUG
- DWORD dbgTotalTimeout = 0;
-#endif
-
- // Wait for us to enter the ping period, then check if we are in interruptible
- // JIT code.
- while (TRUE)
- {
- ThreadSuspend::UnlockThreadStore();
- res = m_SafeEvent.Wait(PING_JIT_TIMEOUT,FALSE);
- STRESS_LOG0(LF_SYNC, INFO3, "FinishSuspendingThread obtain lock\n");
- ThreadSuspend::LockThreadStore(ThreadSuspend::SUSPEND_OTHER);
-
- if (res == WAIT_TIMEOUT)
- {
-#ifdef _DEBUG
- if ((dbgTotalTimeout += PING_JIT_TIMEOUT) >= g_pConfig->SuspendDeadlockTimeout())
- {
- _ASSERTE(!"Timeout detected trying to synchronously suspend a thread");
- dbgTotalTimeout = 0;
- }
-#endif
- // Suspend the thread and see if we are in interruptible code (placing
- // a hijack if warranted).
-#if defined(FEATURE_HIJACK) && !defined(PLATFORM_UNIX)
- RetrySuspension:
-#endif
- // The thread is detached/dead. Suspend is no op.
- if (m_State & (TS_Detached | TS_Dead))
- {
- return;
- }
-
- // We can not allocate memory after we suspend a thread.
- // Otherwise, we may deadlock the process when CLR is hosted.
- ThreadStore::AllocateOSContext();
-
- SuspendThreadResult str = SuspendThread();
-
- if (m_fPreemptiveGCDisabled && str == STR_Success)
- {
-#if defined(FEATURE_HIJACK) && !defined(PLATFORM_UNIX)
- WorkingOnThreadContextHolder workingOnThreadContext(this);
- if (workingOnThreadContext.Acquired() && HandledJITCase())
- {
- _ASSERTE(m_State & TS_UserSuspendPending);
- // Redirect thread so we can capture a good thread context
- // (GetThreadContext is not sufficient, due to an OS bug).
- // If we don't succeed (should only happen on Win9X, due to
- // a different OS bug), we must resume the thread and try
- // again.
- if (!CheckForAndDoRedirectForUserSuspend())
- {
- ResumeThread();
- goto RetrySuspension;
- }
- }
-#endif // FEATURE_HIJACK && !PLATFORM_UNIX
- // Keep trying...
- ResumeThread();
- }
- else if (!m_fPreemptiveGCDisabled)
- {
- // The thread has transitioned out of the EE. It can't get back in
- // without synchronously suspending itself. We can now return to our
- // caller since this thread cannot make further progress within the
- // EE.
- if (str == STR_Success)
- {
- ResumeThread();
- }
- break;
- }
- else if (str == STR_SwitchedOut)
- {
- // The task has been switched out while in Cooperative GC mode.
- // We will wait for the thread again.
- }
- }
- else
- {
- // SafeEvent has been set so we don't need to actually suspend. Either
- // the thread died, or it will enter a synchronous suspension based on
- // the UserSuspendPending bit.
- _ASSERTE(res == WAIT_OBJECT_0);
- _ASSERTE(!ThreadStore::HoldingThreadStore(this));
- break;
- }
- }
-}
-
-#endif // FEATURE_CORECLR
void Thread::SetSafeEvent()
@@ -7008,12 +6548,6 @@ StackWalkAction SWCB_GetExecutionState(CrawlFrame *pCF, VOID *pData)
else
#endif // FEATURE_CONSERVATIVE_GC
{
-#ifndef HIJACK_NONINTERRUPTIBLE_THREADS
- if (!pES->m_IsInterruptible)
- {
- notJittedCase = true;
- }
-#else // HIJACK_NONINTERRUPTIBLE_THREADS
// if we're not interruptible right here, we need to determine the
// return address for hijacking.
if (!pES->m_IsInterruptible)
@@ -7087,7 +6621,6 @@ StackWalkAction SWCB_GetExecutionState(CrawlFrame *pCF, VOID *pData)
action = SWA_CONTINUE;
#endif // !WIN64EXCEPTIONS
}
-#endif // HIJACK_NONINTERRUPTIBLE_THREADS
}
// else we are successfully out of here with SWA_ABORT
}
@@ -7162,7 +6695,6 @@ void STDCALL OnHijackWorker(HijackArgs * pArgs)
}
CONTRACTL_END;
-#ifdef HIJACK_NONINTERRUPTIBLE_THREADS
Thread *thread = GetThread();
#ifdef FEATURE_STACK_PROBE
@@ -7205,9 +6737,6 @@ void STDCALL OnHijackWorker(HijackArgs * pArgs)
#endif // _DEBUG
frame.Pop();
-#else
- PORTABILITY_ASSERT("OnHijackWorker not implemented on this platform.");
-#endif // HIJACK_NONINTERRUPTIBLE_THREADS
}
ReturnKind GetReturnKindFromMethodTable(Thread *pThread, EECodeInfo *codeInfo)
diff --git a/src/vm/util.cpp b/src/vm/util.cpp
index 28546642a1..ac0da8d3de 100644
--- a/src/vm/util.cpp
+++ b/src/vm/util.cpp
@@ -2455,13 +2455,6 @@ HMODULE CLRGetCurrentModuleHandle()
return hMod;
}
-#ifndef FEATURE_CORECLR
-static ICLRRuntimeInfo *GetCLRRuntime()
-{
- LIMITED_METHOD_CONTRACT;
- return g_pCLRRuntime;
-}
-#endif // !FEATURE_CORECLR
#endif // !FEATURE_PAL
@@ -2486,12 +2479,6 @@ void * __stdcall GetCLRFunction(LPCSTR FunctionName)
{
func = (void*)EEHeapFreeInProcessHeap;
}
-#ifndef FEATURE_CORECLR
- else if (strcmp(FunctionName, "GetCLRRuntime") == 0)
- {
- func = (void*)GetCLRRuntime;
- }
-#endif // !FEATURE_CORECLR
else if (strcmp(FunctionName, "ShutdownRuntimeWithoutExiting") == 0)
{
func = (void*)ShutdownRuntimeWithoutExiting;
diff --git a/src/vm/util.hpp b/src/vm/util.hpp
index d81eedb0df..4a213b7e75 100644
--- a/src/vm/util.hpp
+++ b/src/vm/util.hpp
@@ -1294,35 +1294,7 @@ public:
extern LONG g_OLEAUT32_Loaded;
-#ifndef FEATURE_CORECLR
-#define ENSURE_OLEAUT32_LOADED() \
-{ \
- /* Should only be used in FCALL */ \
- _ASSERTE (__me != 0); \
- if (g_OLEAUT32_Loaded == 0) \
- { \
- /* CLRLoadLibrary/CLRFreeLibrary claim they trigger, but this */ \
- /* isn't really true in this case because we're loading oleaut32 */ \
- /* which we know doesn't contain any managed code in its DLLMain */ \
- CONTRACT_VIOLATION(GCViolation|SOToleranceViolation); \
- HMODULE hMod = CLRLoadLibrary(W("oleaut32")); \
- if (hMod == NULL) \
- { \
- __FCThrow(__me, kOutOfMemoryException, 0, 0, 0, 0); \
- } \
- else \
- { \
- if (FastInterlockExchange(&g_OLEAUT32_Loaded, 1) == 1) \
- { \
- CLRFreeLibrary(hMod); \
- } \
- } \
- } \
-} \
-INDEBUG(DisableDelayLoadCheckForOleaut32 _disableOleaut32Check);
-#else // !FEATURE_CORECLR
#define ENSURE_OLEAUT32_LOADED()
-#endif // !FEATURE_CORECLR
BOOL DbgIsExecutable(LPVOID lpMem, SIZE_T length);
diff --git a/src/vm/vars.cpp b/src/vm/vars.cpp
index cc1662b618..37538752c6 100644
--- a/src/vm/vars.cpp
+++ b/src/vm/vars.cpp
@@ -85,9 +85,6 @@ GPTR_IMPL(MethodTable, g_pThreadClass);
#ifdef FEATURE_CER
GPTR_IMPL(MethodTable, g_pCriticalFinalizerObjectClass);
#endif
-#ifndef FEATURE_CORECLR
-GPTR_IMPL(MethodTable, g_pAsyncFileStream_AsyncResultClass);
-#endif // !FEATURE_CORECLR
GPTR_IMPL(MethodTable, g_pFreeObjectMethodTable);
GPTR_IMPL(MethodTable, g_pOverlappedDataClass);
@@ -138,9 +135,6 @@ GPTR_IMPL(RCWCleanupList,g_pRCWCleanupList);
// <TODO> @TODO Remove eventually - </TODO> determines whether the verifier throws an exception when something fails
bool g_fVerifierOff;
-#ifndef FEATURE_CORECLR
-IAssemblyUsageLog *g_pIAssemblyUsageLogGac;
-#endif
// <TODO> @TODO - PROMOTE. </TODO>
OBJECTHANDLE g_pPreallocatedOutOfMemoryException;
diff --git a/src/vm/vars.hpp b/src/vm/vars.hpp
index cad41d7442..d586e31a6d 100644
--- a/src/vm/vars.hpp
+++ b/src/vm/vars.hpp
@@ -66,9 +66,6 @@ typedef unsigned short wchar_t;
#include <corpriv.h>
#include <cordbpriv.h>
-#ifndef FEATURE_CORECLR
-#include <metahost.h>
-#endif // !FEATURE_CORECLR
#include "eeprofinterfaces.h"
#include "eehash.h"
@@ -416,9 +413,6 @@ GPTR_DECL(MethodTable, g_pThreadClass);
#ifdef FEATURE_CER
GPTR_DECL(MethodTable, g_pCriticalFinalizerObjectClass);
#endif
-#ifndef FEATURE_CORECLR
-GPTR_DECL(MethodTable, g_pAsyncFileStream_AsyncResultClass);
-#endif // !FEATURE_CORECLR
GPTR_DECL(MethodTable, g_pOverlappedDataClass);
GPTR_DECL(MethodTable, g_TypedReferenceMT);
@@ -445,9 +439,6 @@ GPTR_DECL(MethodDesc, g_pObjectFinalizerMD);
//<TODO> @TODO Remove eventually - determines whether the verifier throws an exception when something fails</TODO>
EXTERN bool g_fVerifierOff;
-#ifndef FEATURE_CORECLR
-EXTERN IAssemblyUsageLog *g_pIAssemblyUsageLogGac;
-#endif
// Global System Information
extern SYSTEM_INFO g_SystemInfo;
@@ -567,12 +558,6 @@ EXTERN Volatile<BOOL> g_fEEStarted;
EXTERN BOOL g_fComStarted;
#endif
-#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
-//
-// Pointer to the activated CLR interface provided by the shim.
-//
-EXTERN ICLRRuntimeInfo *g_pCLRRuntime;
-#endif
//
// Global state variables indicating which stage of shutdown we are in