From 9b10bd324f8bf40efb521abd35031132572e2616 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 11 Nov 2015 16:47:09 -0800 Subject: [PATCH] Improve FEATURE_NATIVE_IMAGE_GENERATION ifdefs --- src/vm/appdomain.cpp | 2 +- src/vm/ceeload.cpp | 2 ++ src/vm/compile.h | 6 +++--- src/vm/domainfile.cpp | 4 ++++ src/vm/jitinterface.cpp | 12 ++++++------ 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 8327adf..1aa549c 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -14836,7 +14836,7 @@ PTR_DomainAssembly AppDomain::FindAssembly(PTR_ICLRPrivAssembly pHostAssembly) #endif //FEATURE_HOSTED_BINDER -#if !defined(DACCESS_COMPILE) && defined(FEATURE_CORECLR) +#if !defined(DACCESS_COMPILE) && defined(FEATURE_CORECLR) && defined(FEATURE_NATIVE_IMAGE_GENERATION) void ZapperSetBindingPaths(ICorCompilationDomain *pDomain, SString &trustedPlatformAssemblies, SString &platformResourceRoots, SString &appPaths, SString &appNiPaths) { diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index ac8e3b9..6fa1e44 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -1167,10 +1167,12 @@ BOOL Module::CanCacheWinRTTypeByGuid(MethodTable *pMT) if (WinRTTypeNameConverter::IsRedirectedWinRTSourceType(pMT)) return FALSE; +#ifdef FEATURE_NATIVE_IMAGE_GENERATION // Don't cache in a module that's not the NGen target, since the result // won't be saved, and since the such a module might be read-only. if (GetAppDomain()->ToCompilationDomain()->GetTargetModule() != this) return FALSE; +#endif return TRUE; } diff --git a/src/vm/compile.h b/src/vm/compile.h index 034f751..e19d93e 100644 --- a/src/vm/compile.h +++ b/src/vm/compile.h @@ -115,9 +115,7 @@ CEEPreloader::AddFixup, which forwards it to the zapper #ifndef COMPILE_H_ #define COMPILE_H_ -#ifndef FEATURE_PREJIT -#error FEATURE_PREJIT is required for this file -#endif // FEATURE_PREJIT +#ifdef FEATURE_NATIVE_IMAGE_GENERATION struct ZapperLoaderModuleTableKey { ZapperLoaderModuleTableKey(Module *pDefinitionModule, @@ -923,4 +921,6 @@ class CompilationDomain : public AppDomain, void SetDependencyEmitter(IMetaDataAssemblyEmit *pEmitter); }; +#endif // FEATURE_NATIVE_IMAGE_GENERATION + #endif // COMPILE_H_ diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp index c0619f4..7d25cdc 100644 --- a/src/vm/domainfile.cpp +++ b/src/vm/domainfile.cpp @@ -897,6 +897,7 @@ BOOL DomainFile::IsZapRequired() g_pConfig->RequireZaps() == EEConfig::REQUIRE_ZAPS_SUPPORTED) return FALSE; +#ifdef FEATURE_NATIVE_IMAGE_GENERATION if (IsCompilationProcess()) { // Ignore the assembly being ngened. @@ -919,6 +920,7 @@ BOOL DomainFile::IsZapRequired() if (fileIsBeingNGened) return FALSE; } +#endif return TRUE; } @@ -997,6 +999,7 @@ void DomainFile::ClearNativeImageStress() // Different app-domains should make different decisions hash ^= HashString(this->GetAppDomain()->GetFriendlyName()); +#ifdef FEATURE_NATIVE_IMAGE_GENERATION // Since DbgRandomOnHashAndExe() is not so random under ngen.exe, also // factor in the module being compiled if (this->GetAppDomain()->IsCompilationDomain()) @@ -1006,6 +1009,7 @@ void DomainFile::ClearNativeImageStress() if (module) hash ^= HashStringA(module->GetSimpleName()); } +#endif if (DbgRandomOnHashAndExe(hash, float(stressPercentage)/100)) { diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 2fb5db6..04f8244 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -3340,7 +3340,7 @@ void CEEInfo::ComputeRuntimeLookupForSharedGenericToken(DictionaryEntryKind entr BOOL fInstrument = FALSE; -#ifdef FEATURE_PREJIT +#ifdef FEATURE_NATIVE_IMAGE_GENERATION // This will make sure that when IBC logging is turned on we will go through a version // of JIT_GenericHandle which logs the access. Note that we still want the dictionaries // to be populated to prepopulate the types at NGen time. @@ -3349,7 +3349,7 @@ void CEEInfo::ComputeRuntimeLookupForSharedGenericToken(DictionaryEntryKind entr { fInstrument = TRUE; } -#endif // FEATURE_PREJIT +#endif // FEATURE_NATIVE_IMAGE_GENERATION // If we've got a method type parameter of any kind then we must look in the method desc arg if (pContextMD->RequiresInstMethodDescArg()) @@ -5176,13 +5176,13 @@ void * CEEInfo::getArrayInitializationData( if (!pField || !pField->IsRVA() || (pField->LoadSize() < size) -#ifdef FEATURE_PREJIT +#ifdef FEATURE_NATIVE_IMAGE_GENERATION // This will make sure that when IBC logging is on, the array initialization happens thru // COMArrayInfo::InitializeArray. This gives a place to put the IBC probe that can help // separate hold and cold RVA blobs. || (IsCompilingForNGen() && GetAppDomain()->ToCompilationDomain()->m_fForceInstrument) -#endif // FEATURE_PREJIT +#endif // FEATURE_NATIVE_IMAGE_GENERATION ) { result = NULL; @@ -6764,14 +6764,14 @@ CorInfoHelpFunc CEEInfo::getSecurityPrologHelper(CORINFO_METHOD_HANDLE ftn) JIT_TO_EE_TRANSITION(); -#ifdef FEATURE_PREJIT +#ifdef FEATURE_NATIVE_IMAGE_GENERATION // This will make sure that when IBC logging is on, we call the slow helper with IBC probe if (IsCompilingForNGen() && GetAppDomain()->ToCompilationDomain()->m_fForceInstrument) { result = CORINFO_HELP_SECURITY_PROLOG_FRAMED; } -#endif // FEATURE_PREJIT +#endif // FEATURE_NATIVE_IMAGE_GENERATION if (result == CORINFO_HELP_UNDEF) { -- 2.7.4