summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/debug/daccess/enummem.cpp2
-rw-r--r--src/debug/daccess/nidump.cpp7
-rw-r--r--src/inc/dacvars.h4
-rw-r--r--src/vm/CMakeLists.txt7
-rw-r--r--src/vm/appdomain.cpp4
-rw-r--r--src/vm/ceeload.cpp20
-rw-r--r--src/vm/ceeload.h10
-rw-r--r--src/vm/class.cpp3
-rw-r--r--src/vm/class.h4
-rw-r--r--src/vm/class.inl2
-rw-r--r--src/vm/compile.cpp2
-rw-r--r--src/vm/constrainedexecutionregion.cpp5
-rw-r--r--src/vm/constrainedexecutionregion.h3
-rw-r--r--src/vm/crossgen/CMakeLists.txt7
-rw-r--r--src/vm/dataimage.cpp2
-rw-r--r--src/vm/gchelpers.cpp2
-rw-r--r--src/vm/jitinterface.cpp4
-rw-r--r--src/vm/method.cpp2
-rw-r--r--src/vm/methodtablebuilder.cpp2
-rw-r--r--src/vm/prestub.cpp4
-rw-r--r--src/vm/reflectioninvocation.cpp6
-rw-r--r--src/vm/runtimecallablewrapper.cpp1
-rw-r--r--src/vm/threadsuspend.cpp8
-rw-r--r--src/vm/vars.cpp4
-rw-r--r--src/vm/vars.hpp4
-rw-r--r--tests/src/JIT/Regression/CLR-x86-JIT/V2.0-RTM/b475589/b475589.il71
-rw-r--r--tests/src/JIT/Regression/CLR-x86-JIT/V2.0-RTM/b475589/b475589.ilproj40
27 files changed, 106 insertions, 124 deletions
diff --git a/src/debug/daccess/enummem.cpp b/src/debug/daccess/enummem.cpp
index ec808be006..d66af05769 100644
--- a/src/debug/daccess/enummem.cpp
+++ b/src/debug/daccess/enummem.cpp
@@ -292,7 +292,9 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pValueTypeClass.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pEnumClass.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pThreadClass.EnumMem(); )
+#ifdef FEATURE_CER
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pCriticalFinalizerObjectClass.EnumMem(); )
+#endif
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pFreeObjectMethodTable.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pObjectCtorMD.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_fHostConfig.EnumMem(); )
diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp
index c07229aa63..5ba218d23b 100644
--- a/src/debug/daccess/nidump.cpp
+++ b/src/debug/daccess/nidump.cpp
@@ -4088,6 +4088,7 @@ void NativeImageDumper::DumpModule( PTR_Module module )
(int)(module->m_maxDynamicEntries
* sizeof(*(module->m_pDynamicStaticsInfo))));
+#ifdef FEATURE_CER
DisplayWriteFieldInt( m_dwReliabilityContract,
module->m_dwReliabilityContract, Module, MODULE );
@@ -4105,6 +4106,7 @@ void NativeImageDumper::DumpModule( PTR_Module module )
offsetof(Module, m_pCerNgenRootTable),
fieldsize(Module, m_pCerNgenRootTable) );
}
+#endif
_ASSERTE(module->m_debuggerSpecificData.m_pDynamicILCrst == NULL);
@@ -4152,6 +4154,7 @@ bool NativeImageDumper::isPrecode(TADDR maybePrecode)
return !!module->IsZappedPrecode(maybePrecode);
}
+#ifdef FEATURE_CER
void NativeImageDumper::DumpNgenRootTable( PTR_CerNgenRootTable table,
const char * name, unsigned offset,
unsigned fieldSize )
@@ -4231,6 +4234,8 @@ void NativeImageDumper::DumpNgenRootTable( PTR_CerNgenRootTable table,
DisplayEndStructure( MODULE ); //CERNgenRootTable
}
+#endif // FEATURE_CER
+
void NativeImageDumper::IterateTypeDefToMTCallback( TADDR mtTarget,
TADDR flags,
PTR_LookupMapBase map,
@@ -9034,12 +9039,14 @@ NativeImageDumper::DumpEEClassForMethodTable( PTR_MethodTable mt )
DisplayWriteFieldInt( m_cbModuleDynamicID, pClassOptional->m_cbModuleDynamicID,
EEClassOptionalFields, EECLASSES );
+#ifdef FEATURE_CER
/* REVISIT_TODO Fri 10/14/2005
* Use the macros from ConstrainedExecutionRegion.cpp on this?
*/
DisplayWriteFieldUInt( m_dwReliabilityContract,
clazz->GetReliabilityContract(),
EEClassOptionalFields, EECLASSES );
+#endif
DisplayWriteFieldEnumerated( m_SecProps, clazz->GetSecurityProperties()->dwFlags,
EEClassOptionalFields, s_SecurityProperties, W("|"),
diff --git a/src/inc/dacvars.h b/src/inc/dacvars.h
index 0f13cff801..4df214203a 100644
--- a/src/inc/dacvars.h
+++ b/src/inc/dacvars.h
@@ -234,7 +234,9 @@ DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pOverlappedDataClass, ::g_pOve
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pValueTypeClass, ::g_pValueTypeClass)
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pEnumClass, ::g_pEnumClass)
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pThreadClass, ::g_pThreadClass)
+#ifdef FEATURE_CER
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pCriticalFinalizerObjectClass, ::g_pCriticalFinalizerObjectClass)
+#endif
#ifndef FEATURE_CORECLR
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pAsyncFileStream_AsyncResultClass, ::g_pAsyncFileStream_AsyncResultClass)
#endif // !FEATURE_CORECLR
@@ -251,7 +253,9 @@ DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pBaseRuntimeClass, ::g_pBaseRu
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pICastableInterface, ::g_pICastableInterface)
#endif // FEATURE_ICASTABLE
+#ifdef FEATURE_CER
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pPrepareConstrainedRegionsMethod, ::g_pPrepareConstrainedRegionsMethod)
+#endif
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pExecuteBackoutCodeHelperMethod, ::g_pExecuteBackoutCodeHelperMethod)
DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pObjectCtorMD, ::g_pObjectCtorMD)
diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt
index 0b3e44dca3..8179a58101 100644
--- a/src/vm/CMakeLists.txt
+++ b/src/vm/CMakeLists.txt
@@ -155,7 +155,6 @@ set(VM_SOURCES_WKS
comthreadpool.cpp
comutilnative.cpp
comwaithandle.cpp
- constrainedexecutionregion.cpp
coverage.cpp
customattribute.cpp
custommarshalerinfo.cpp
@@ -242,6 +241,12 @@ set(VM_SOURCES_WKS
${VM_SOURCES_GDBJIT}
)
+if(FEATURE_CER)
+ list(APPEND VM_SOURCES_WKS
+ constrainedexecutionregion.cpp
+ )
+endif(FEATURE_CER)
+
if(FEATURE_EVENT_TRACE)
list(APPEND VM_SOURCES_WKS
eventtrace.cpp
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 293db54396..0ee260e3ef 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -2949,6 +2949,7 @@ void SystemDomain::LoadBaseSystemClasses()
g_pExecutionEngineExceptionClass = MscorlibBinder::GetException(kExecutionEngineException);
g_pThreadAbortExceptionClass = MscorlibBinder::GetException(kThreadAbortException);
+#ifdef FEATURE_CER
// Used for determining whether a class has a critical finalizer
// To determine whether a class has a critical finalizer, we
// currently will simply see if it's parent class has a critical
@@ -2957,6 +2958,7 @@ void SystemDomain::LoadBaseSystemClasses()
// here.
g_pCriticalFinalizerObjectClass = MscorlibBinder::GetClass(CLASS__CRITICAL_FINALIZER_OBJECT);
_ASSERTE(g_pCriticalFinalizerObjectClass->HasCriticalFinalizer());
+#endif
// used by gc to handle predefined agility checking
g_pThreadClass = MscorlibBinder::GetClass(CLASS__THREAD);
@@ -2986,7 +2988,9 @@ void SystemDomain::LoadBaseSystemClasses()
// Load a special marker method used to detect Constrained Execution Regions
// at jit time.
+#ifdef FEATURE_CER
g_pPrepareConstrainedRegionsMethod = MscorlibBinder::GetMethod(METHOD__RUNTIME_HELPERS__PREPARE_CONSTRAINED_REGIONS);
+#endif
g_pExecuteBackoutCodeHelperMethod = MscorlibBinder::GetMethod(METHOD__RUNTIME_HELPERS__EXECUTE_BACKOUT_CODE_HELPER);
// Make sure that FCall mapping for Monitor.Enter is initialized. We need it in case Monitor.Enter is used only as JIT helper.
diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp
index feb9f85607..c95fbac16e 100644
--- a/src/vm/ceeload.cpp
+++ b/src/vm/ceeload.cpp
@@ -1656,6 +1656,7 @@ void Module::Destruct()
m_InstMethodHashTableCrst.Destroy();
m_ISymUnmanagedReaderCrst.Destroy();
+#ifdef FEATURE_CER
if (m_pCerPrepInfo)
{
_ASSERTE(m_pCerCrst != NULL);
@@ -1672,6 +1673,7 @@ void Module::Destruct()
}
if (m_pCerCrst)
delete m_pCerCrst;
+#endif // FEATURE_CER
if (m_debuggerSpecificData.m_pDynamicILCrst)
{
@@ -1702,8 +1704,10 @@ void Module::Destruct()
}
#ifdef FEATURE_PREJIT
+#ifdef FEATURE_CER
if (m_pCerNgenRootTable && (m_dwTransientFlags & M_CER_ROOT_TABLE_ON_HEAP))
delete m_pCerNgenRootTable;
+#endif
if (HasNativeImage())
{
@@ -3154,6 +3158,7 @@ BOOL Module::IsPreV4Assembly()
return !!(m_dwPersistedFlags & IS_PRE_V4_ASSEMBLY);
}
+#ifdef FEATURE_CER
DWORD Module::GetReliabilityContract()
{
CONTRACTL
@@ -3180,6 +3185,7 @@ DWORD Module::GetReliabilityContract()
return m_dwReliabilityContract;
}
+#endif // FEATURE_CER
ArrayDPTR(FixupPointer<PTR_MethodTable>) ModuleCtorInfo::GetGCStaticMTs(DWORD index)
{
@@ -9860,10 +9866,12 @@ void Module::PrepareTypesForSave(DataImage *image)
PrepareRemotableMethodInfo(pMT);
#endif // FEATURE_REMOTING
+#ifdef FEATURE_CER
// If this module defines any CriticalFinalizerObject derived classes,
// then we'll prepare these types for Constrained Execution Regions (CER) now.
// (Normally they're prepared at object instantiation time, a little too late for ngen).
PrepareCriticalType(pMT);
+#endif // FEATURE_CER
}
}
@@ -9947,7 +9955,9 @@ void Module::Save(DataImage *image)
// Cache values of all persisted flags computed from custom attributes
IsNoStringInterning();
IsRuntimeWrapExceptions();
+#ifdef FEATURE_CER
GetReliabilityContract();
+#endif
IsPreV4Assembly();
HasDefaultDllImportSearchPathsAttribute();
@@ -10302,10 +10312,12 @@ void Module::Save(DataImage *image)
m_nPropertyNameSet * sizeof(BYTE),
DataImage::ITEM_PROPERTY_NAME_SET);
+#ifdef FEATURE_CER
// Save Constrained Execution Region (CER) fixup information (used to eagerly fixup trees of methods to avoid any runtime
// induced failures when invoking the tree).
if (m_pCerNgenRootTable != NULL)
m_pCerNgenRootTable->Save(image, profileData);
+#endif
// Sort the list of RVA statics in an ascending order wrt the RVA
// and save them.
@@ -10761,6 +10773,7 @@ void Module::PlaceMethod(DataImage *image, MethodDesc *pMD, DWORD profilingFlags
image->PlaceStructureForAddress(pMD, CORCOMPILE_SECTION_WRITE);
}
+#ifdef FEATURE_CER
if (profilingFlags & (1 << ReadCerMethodList))
{
// protect against stale IBC data
@@ -10771,6 +10784,7 @@ void Module::PlaceMethod(DataImage *image, MethodDesc *pMD, DWORD profilingFlags
image->PlaceStructureForAddress(m_pCerNgenRootTable->GetList(pMD), CORCOMPILE_SECTION_HOT);
}
}
+#endif // FEATURE_CER
if (profilingFlags & (1 << WriteMethodPrecode))
{
@@ -11314,6 +11328,7 @@ void Module::Fixup(DataImage *image)
image->ZeroField(m_FileReferencesMap.pTable, 0,
m_FileReferencesMap.GetSize() * sizeof(void*));
+#ifdef FEATURE_CER
//
// Fixup Constrained Execution Regions restoration records.
//
@@ -11330,6 +11345,7 @@ void Module::Fixup(DataImage *image)
// Zero out fields we always compute at runtime lazily.
image->ZeroField(this, offsetof(Module, m_pCerPrepInfo), sizeof(m_pCerPrepInfo));
image->ZeroField(this, offsetof(Module, m_pCerCrst), sizeof(m_pCerCrst));
+#endif // FEATURE_CER
image->ZeroField(this, offsetof(Module, m_debuggerSpecificData), sizeof(m_debuggerSpecificData));
@@ -15593,7 +15609,7 @@ FieldDesc *Module::LookupFieldDef(mdFieldDef token)
#endif // DACCESS_COMPILE
-#ifndef DACCESS_COMPILE
+#if !defined(DACCESS_COMPILE) && defined(FEATURE_CER)
// Access to CerPrepInfo, the structure used to track CERs prepared at runtime (as opposed to ngen time). GetCerPrepInfo will
// return the structure associated with the given method desc if it exists or NULL otherwise. CreateCerPrepInfo will get the
@@ -15745,7 +15761,7 @@ void Module::RestoreCer(MethodDesc *pMD)
#endif // FEATURE_PREJIT
-#endif // !DACCESS_COMPILE
+#endif // !DACCESS_COMPILE && FEATURE_CER
diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h
index d9944c15f7..d15bd6b3d1 100644
--- a/src/vm/ceeload.h
+++ b/src/vm/ceeload.h
@@ -3394,10 +3394,12 @@ public:
//-----------------------------------------------------------------------------------------
BOOL IsPreV4Assembly();
+#ifdef FEATURE_CER
//-----------------------------------------------------------------------------------------
// Get reliability contract info, see ConstrainedExecutionRegion.cpp for details.
//-----------------------------------------------------------------------------------------
DWORD GetReliabilityContract();
+#endif
//-----------------------------------------------------------------------------------------
// Parse/Return NeutralResourcesLanguageAttribute if it exists (updates Module member variables at ngen time)
@@ -3406,13 +3408,15 @@ public:
protected:
+#ifdef FEATURE_CER
Volatile<DWORD> m_dwReliabilityContract;
+#endif
// initialize Crst controlling the Dynamic IL hashtables
void InitializeDynamicILCrst();
-#ifndef DACCESS_COMPILE
public:
+#if !defined(DACCESS_COMPILE) && defined(FEATURE_CER)
// Support for getting and creating information about Constrained Execution Regions rooted in this module.
@@ -3443,7 +3447,7 @@ public:
LIMITED_METHOD_CONTRACT;
return m_pCerCrst;
}
-#endif // !DACCESS_COMPILE
+#endif // !DACCESS_COMPILE && FEATURE_CER
#ifdef FEATURE_CORECLR
void VerifyAllMethods();
@@ -3456,11 +3460,13 @@ public:
}
private:
+#ifdef FEATURE_CER
EEPtrHashTable *m_pCerPrepInfo; // Root methods prepared for Constrained Execution Regions
Crst *m_pCerCrst; // Mutex protecting update access to both of the above hashes
#ifdef FEATURE_PREJIT
CerNgenRootTable *m_pCerNgenRootTable; // Root methods of CERs found during ngen and requiring runtime restoration
#endif
+#endif
// This struct stores the data used by the managed debugging infrastructure. If it turns out that
// the debugger is increasing the size of the Module class by too much, we can consider allocating
diff --git a/src/vm/class.cpp b/src/vm/class.cpp
index 961df2a104..0b9efd54ef 100644
--- a/src/vm/class.cpp
+++ b/src/vm/class.cpp
@@ -19,6 +19,7 @@
#include "constrainedexecutionregion.h"
#include "customattribute.h"
#include "encee.h"
+#include "typestring.h"
#ifdef FEATURE_COMINTEROP
#include "comcallablewrapper.h"
@@ -2490,12 +2491,14 @@ MethodTable::GetSubstitutionForParent(
#endif //!DACCESS_COMPILE
+#ifdef FEATURE_CER
//*******************************************************************************
DWORD EEClass::GetReliabilityContract()
{
LIMITED_METHOD_CONTRACT;
return HasOptionalFields() ? GetOptionalFields()->m_dwReliabilityContract : RC_NULL;
}
+#endif // FEATURE_CER
//*******************************************************************************
#ifdef FEATURE_PREJIT
diff --git a/src/vm/class.h b/src/vm/class.h
index f19b9818ec..391955d578 100644
--- a/src/vm/class.h
+++ b/src/vm/class.h
@@ -703,7 +703,9 @@ class EEClassOptionalFields
#define MODULE_NON_DYNAMIC_STATICS ((DWORD)-1)
DWORD m_cbModuleDynamicID;
+#ifdef FEATURE_CER
DWORD m_dwReliabilityContract;
+#endif
SecurityProperties m_SecProps;
@@ -1768,12 +1770,14 @@ public:
// Cached class level reliability contract info, see ConstrainedExecutionRegion.cpp for details.
DWORD GetReliabilityContract();
+#ifdef FEATURE_CER
inline void SetReliabilityContract(DWORD dwValue)
{
LIMITED_METHOD_CONTRACT;
_ASSERTE(HasOptionalFields());
GetOptionalFields()->m_dwReliabilityContract = dwValue;
}
+#endif
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
// Get number of eightbytes used by a struct passed in registers.
diff --git a/src/vm/class.inl b/src/vm/class.inl
index 9362a8328f..7d5c74d586 100644
--- a/src/vm/class.inl
+++ b/src/vm/class.inl
@@ -50,7 +50,9 @@ inline void EEClassOptionalFields::Init()
m_WinRTRedirectedTypeIndex = WinMDAdapter::RedirectedTypeIndex_Invalid;
#endif // FEATURE_COMINTEROP
m_cbModuleDynamicID = MODULE_NON_DYNAMIC_STATICS;
+#ifdef FEATURE_CER
m_dwReliabilityContract = RC_NULL;
+#endif
m_SecProps = 0;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
m_numberEightBytes = 0;
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp
index bbd52f7932..721005efd9 100644
--- a/src/vm/compile.cpp
+++ b/src/vm/compile.cpp
@@ -6603,7 +6603,9 @@ void CEEPreloader::PrePrepareMethodIfNecessary(CORINFO_METHOD_HANDLE hMethod)
{
STANDARD_VM_CONTRACT;
+#ifdef FEATURE_CER
::PrePrepareMethodIfNecessary(hMethod);
+#endif
}
static void SetStubMethodDescOnInteropMethodDesc(MethodDesc* pInteropMD, MethodDesc* pStubMD, bool fReverseStub)
diff --git a/src/vm/constrainedexecutionregion.cpp b/src/vm/constrainedexecutionregion.cpp
index d256c43424..77b944c416 100644
--- a/src/vm/constrainedexecutionregion.cpp
+++ b/src/vm/constrainedexecutionregion.cpp
@@ -1745,10 +1745,6 @@ void PrepopulateGenericHandleCache(DictionaryLayout *pDictionaryLayout,
MethodDesc *pMD,
MethodTable *pMT)
{
-#ifdef FEATURE_CORECLR
- // Disable this function in CoreCLR to work around https://github.com/dotnet/corefx/issues/12412.
- LIMITED_METHOD_CONTRACT;
-#else
CONTRACTL {
THROWS;
GC_TRIGGERS;
@@ -1772,7 +1768,6 @@ void PrepopulateGenericHandleCache(DictionaryLayout *pDictionaryLayout,
}
pOverflows = pOverflows->GetNextLayout();
}
-#endif // FEATURE_CORECLR
}
#ifdef FEATURE_PREJIT
diff --git a/src/vm/constrainedexecutionregion.h b/src/vm/constrainedexecutionregion.h
index 93ceb63010..4b41b2570e 100644
--- a/src/vm/constrainedexecutionregion.h
+++ b/src/vm/constrainedexecutionregion.h
@@ -13,6 +13,7 @@
#ifndef __CONSTRAINED_EXECUTION_REGION_H
#define __CONSTRAINED_EXECUTION_REGION_H
+#ifdef FEATURE_CER
#include <corhlpr.h>
#include <typestring.h>
@@ -560,4 +561,6 @@ private:
#endif
};
+#endif // FEATURE_CER
+
#endif
diff --git a/src/vm/crossgen/CMakeLists.txt b/src/vm/crossgen/CMakeLists.txt
index c2392a2d9a..c6ef163d53 100644
--- a/src/vm/crossgen/CMakeLists.txt
+++ b/src/vm/crossgen/CMakeLists.txt
@@ -16,7 +16,6 @@ set(VM_CROSSGEN_SOURCES
../comdelegate.cpp
../codeman.cpp
../compile.cpp
- ../constrainedexecutionregion.cpp
../custommarshalerinfo.cpp
../domainfile.cpp
../baseassemblyspec.cpp
@@ -97,6 +96,12 @@ set(VM_CROSSGEN_SOURCES
../crossgencompile.cpp
)
+if(FEATURE_CER)
+ list(APPEND VM_CROSSGEN_SOURCES
+ ../constrainedexecutionregion.cpp
+ )
+endif(FEATURE_CER)
+
if(FEATURE_READYTORUN)
list(APPEND VM_CROSSGEN_SOURCES
../readytoruninfo.cpp
diff --git a/src/vm/dataimage.cpp b/src/vm/dataimage.cpp
index 83ff0a4f9f..e90c7e6a0e 100644
--- a/src/vm/dataimage.cpp
+++ b/src/vm/dataimage.cpp
@@ -896,8 +896,10 @@ void DataImage::FixupRVAs()
FixupModuleRVAs();
FixupRvaStructure();
+#ifdef FEATURE_CER
if (m_module->m_pCerNgenRootTable != NULL)
m_module->m_pCerNgenRootTable->FixupRVAs(this);
+#endif
// Dev11 bug 181494 instrumentation
if (m_Fixups.GetCount() != m_iCurrentFixup) EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
diff --git a/src/vm/gchelpers.cpp b/src/vm/gchelpers.cpp
index 6b7a7a7386..20a3a29540 100644
--- a/src/vm/gchelpers.cpp
+++ b/src/vm/gchelpers.cpp
@@ -1006,8 +1006,10 @@ OBJECTREF AllocateObject(MethodTable *pMT
g_IBCLogger.LogMethodTableAccess(pMT);
SetTypeHandleOnThreadForAlloc(TypeHandle(pMT));
+#ifdef FEATURE_CER
if (pMT->HasCriticalFinalizer())
PrepareCriticalFinalizerObject(pMT);
+#endif
#ifdef FEATURE_COMINTEROP
#ifdef FEATURE_COMINTEROP_UNMANAGED_ACTIVATION
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index 64b951f584..fac4cb44f2 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -5038,6 +5038,7 @@ void CEEInfo::getCallInfo(
}
+#ifdef FEATURE_CER
if (pMD == g_pPrepareConstrainedRegionsMethod && !isVerifyOnly())
{
MethodDesc * methodFromContext = GetMethodFromContext(pResolvedToken->tokenContext);
@@ -5059,6 +5060,7 @@ void CEEInfo::getCallInfo(
}
}
}
+#endif // FEATURE_CER
TypeHandle exactType = TypeHandle(pResolvedToken->hClass);
@@ -8378,6 +8380,7 @@ bool CEEInfo::canTailCall (CORINFO_METHOD_HANDLE hCaller,
}
}
+#ifdef FEATURE_CER
// We cannot tail call from a root CER method, the thread abort algorithm to
// detect CERs depends on seeing such methods on the stack.
if (IsCerRootMethod(pCaller))
@@ -8386,6 +8389,7 @@ bool CEEInfo::canTailCall (CORINFO_METHOD_HANDLE hCaller,
szFailReason = "Caller is a CER root";
goto exit;
}
+#endif // FEATURE_CER
result = true;
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index 14651239a7..7afe0e9de2 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -3249,6 +3249,7 @@ bool MethodDesc::CanSkipDoPrestub (
return false;
}
+#ifdef FEATURE_CER
// Can't hard bind to a method which contains one or more Constrained Execution Region roots (we need to force the prestub to
// execute for such methods).
if (ContainsPrePreparableCerRoot(this))
@@ -3256,6 +3257,7 @@ bool MethodDesc::CanSkipDoPrestub (
*pReason = CORINFO_INDIRECT_CALL_CER;
return false;
}
+#endif // FEATURE_CER
// Check whether our methoddesc needs restore
if (NeedsRestore(GetAppDomain()->ToCompilationDomain()->GetTargetImage(), TRUE))
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index 48bfb542ac..ab55f11ced 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -191,6 +191,7 @@ MethodTableBuilder::CreateClass( Module *pModule,
pEEClass->GetSecurityProperties()->SetFlags(dwSecFlags, dwNullDeclFlags);
}
+#ifdef FEATURE_CER
// Cache class level reliability contract info.
DWORD dwReliabilityContract = ::GetReliabilityContract(pInternalImport, cl);
if (dwReliabilityContract != RC_NULL)
@@ -201,6 +202,7 @@ MethodTableBuilder::CreateClass( Module *pModule,
pEEClass->SetReliabilityContract(dwReliabilityContract);
}
+#endif // FEATURE_CER
if (fHasLayout)
pEEClass->SetHasLayout();
diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp
index 7a977fc979..f28bcb10e2 100644
--- a/src/vm/prestub.cpp
+++ b/src/vm/prestub.cpp
@@ -1215,12 +1215,12 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT)
RETURN GetStableEntryPoint();
}
-#ifdef FEATURE_PREJIT
+#if defined(FEATURE_PREJIT) && defined(FEATURE_CER)
// If this method is the root of a CER call graph and we've recorded this fact in the ngen image then we're in the prestub in
// order to trip any runtime level preparation needed for this graph (P/Invoke stub generation/library binding, generic
// dictionary prepopulation etc.).
GetModule()->RestoreCer(this);
-#endif // FEATURE_PREJIT
+#endif // FEATURE_PREJIT && FEATURE_CER
#ifdef FEATURE_COMINTEROP
/************************** INTEROP *************************/
diff --git a/src/vm/reflectioninvocation.cpp b/src/vm/reflectioninvocation.cpp
index 9847c0575a..4edecdd2c6 100644
--- a/src/vm/reflectioninvocation.cpp
+++ b/src/vm/reflectioninvocation.cpp
@@ -2508,6 +2508,7 @@ FCIMPL1(void, ReflectionInvocation::PrepareContractedDelegate, Object * delegate
}
CONTRACTL_END;
+#ifdef FEATURE_CER
if (delegateUNSAFE == NULL)
return;
@@ -2517,9 +2518,11 @@ FCIMPL1(void, ReflectionInvocation::PrepareContractedDelegate, Object * delegate
PrepareDelegateHelper(&delegate, TRUE);
HELPER_METHOD_FRAME_END();
+#endif // FEATURE_CER
}
FCIMPLEND
+#ifdef FEATURE_CER
void ReflectionInvocation::PrepareDelegateHelper(OBJECTREF *pDelegate, BOOL onlyContractedMethod)
{
CONTRACTL {
@@ -2601,6 +2604,7 @@ void ReflectionInvocation::PrepareDelegateHelper(OBJECTREF *pDelegate, BOOL only
onlyContractedMethod);
}
}
+#endif // FEATURE_CER
FCIMPL0(void, ReflectionInvocation::ProbeForSufficientStack)
{
@@ -2847,6 +2851,7 @@ FCIMPL3(void, ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup, Object* co
if (gc.backoutDelegate == NULL)
COMPlusThrowArgumentNull(W("backoutCode"));
+#ifdef FEATURE_CER
if (!IsCompilationProcess())
{
// Delegates are prepared as part of the ngen process, so only prepare the backout
@@ -2857,6 +2862,7 @@ FCIMPL3(void, ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup, Object* co
// attempt to run the backout code.
PrepareMethodDesc(g_pExecuteBackoutCodeHelperMethod, Instantiation(), Instantiation(), FALSE, TRUE);
}
+#endif // FEATURE_CER
ExecuteCodeWithGuaranteedCleanupHelper(&gc);
diff --git a/src/vm/runtimecallablewrapper.cpp b/src/vm/runtimecallablewrapper.cpp
index 8aeaec606a..359b6896bc 100644
--- a/src/vm/runtimecallablewrapper.cpp
+++ b/src/vm/runtimecallablewrapper.cpp
@@ -42,6 +42,7 @@ class Object;
#include "olevariant.h"
#include "interopconverter.h"
#include "constrainedexecutionregion.h"
+#include "typestring.h"
#ifdef FEATURE_REMOTING
#include "crossdomaincalls.h"
#endif
diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp
index 732529faa3..0d16d908b1 100644
--- a/src/vm/threadsuspend.cpp
+++ b/src/vm/threadsuspend.cpp
@@ -754,6 +754,7 @@ static StackWalkAction TAStackCrawlCallBackWorker(CrawlFrame* pCf, StackCrawlCon
}
#undef METHODNAME
+#ifdef FEATURE_CER
// If we're asking about CERs and we don't yet have a definite answer either way then take a closer look at the current method.
if (pData->eType & StackCrawlContext::SCC_CheckWithinCer && !pData->fUnprotectedCode && !pData->fWithinCer)
{
@@ -775,6 +776,7 @@ static StackWalkAction TAStackCrawlCallBackWorker(CrawlFrame* pCf, StackCrawlCon
pData->fUnprotectedCode = true;
}
}
+#endif // FEATURE_CER
// If we weren't asked about EH clauses then we can return now (stop the stack trace if we have a definitive answer on the CER
// question, move to the next frame otherwise).
@@ -1122,6 +1124,7 @@ struct CerStackCrawlContext
bool m_fWithinCer; // The result
};
+#ifdef FEATURE_CER
// Callback used on the stack crawl described above.
StackWalkAction CerStackCrawlCallBack(CrawlFrame *pCf, void *pData)
{
@@ -1164,6 +1167,7 @@ StackWalkAction CerStackCrawlCallBack(CrawlFrame *pCf, void *pData)
// Otherwise everything looks OK so far and we need to investigate the next frame.
return SWA_CONTINUE;
}
+#endif // FEATURE_CER
// Determine whether the method at the given depth in the thread's execution stack is executing within a CER.
BOOL Thread::IsWithinCer(CrawlFrame *pCf)
@@ -1175,6 +1179,9 @@ BOOL Thread::IsWithinCer(CrawlFrame *pCf)
}
CONTRACTL_END;
+#ifndef FEATURE_CER
+ return FALSE;
+#else
// There had better be a method associated with this frame.
MethodDesc *pMD = pCf->GetFunction();
_ASSERTE(pMD != NULL);
@@ -1291,6 +1298,7 @@ BOOL Thread::IsWithinCer(CrawlFrame *pCf)
_ASSERTE(!sContext.m_fFirstFrame);
return sContext.m_fWithinCer;
+#endif // FEATURE_CER
}
#if defined(_TARGET_AMD64_) && defined(FEATURE_HIJACK)
diff --git a/src/vm/vars.cpp b/src/vm/vars.cpp
index eeef71ed7c..8d19a5c20e 100644
--- a/src/vm/vars.cpp
+++ b/src/vm/vars.cpp
@@ -83,7 +83,9 @@ GPTR_IMPL(MethodTable, g_pMulticastDelegateClass);
GPTR_IMPL(MethodTable, g_pValueTypeClass);
GPTR_IMPL(MethodTable, g_pEnumClass);
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
@@ -104,7 +106,9 @@ GPTR_IMPL(MethodTable, g_pICastableInterface);
#endif // FEATURE_ICASTABLE
+#ifdef FEATURE_CER
GPTR_IMPL(MethodDesc, g_pPrepareConstrainedRegionsMethod);
+#endif
GPTR_IMPL(MethodDesc, g_pExecuteBackoutCodeHelperMethod);
GPTR_IMPL(MethodDesc, g_pObjectCtorMD);
diff --git a/src/vm/vars.hpp b/src/vm/vars.hpp
index 4c45a0a65e..712543c2b1 100644
--- a/src/vm/vars.hpp
+++ b/src/vm/vars.hpp
@@ -418,7 +418,9 @@ GPTR_DECL(MethodTable, g_pFreeObjectMethodTable);
GPTR_DECL(MethodTable, g_pValueTypeClass);
GPTR_DECL(MethodTable, g_pEnumClass);
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
@@ -437,7 +439,9 @@ GPTR_DECL(MethodTable, g_pBaseRuntimeClass);
GPTR_DECL(MethodTable, g_pICastableInterface);
#endif // FEATURE_ICASTABLE
+#ifdef FEATURE_CER
GPTR_DECL(MethodDesc, g_pPrepareConstrainedRegionsMethod);
+#endif
GPTR_DECL(MethodDesc, g_pExecuteBackoutCodeHelperMethod);
GPTR_DECL(MethodDesc, g_pObjectCtorMD);
diff --git a/tests/src/JIT/Regression/CLR-x86-JIT/V2.0-RTM/b475589/b475589.il b/tests/src/JIT/Regression/CLR-x86-JIT/V2.0-RTM/b475589/b475589.il
deleted file mode 100644
index dce3d692f8..0000000000
--- a/tests/src/JIT/Regression/CLR-x86-JIT/V2.0-RTM/b475589/b475589.il
+++ /dev/null
@@ -1,71 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-.assembly extern System.Console
-{
- .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
- .ver 4:0:0:0
-}
-
-.assembly extern mscorlib { auto }
-.assembly b475598 {}
-.module b475589.exe
-
-.class Program
-{
- .method static void Nasty()
- {
- .maxstack 2
-
- call void [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::PrepareConstrainedRegions()
- br start_try
-
- start_catch:
- ldstr "Cathed!"
- call void [System.Console]System.Console::WriteLine(string)
- leave.s end
- end_catch:
-
- start_try:
- newobj instance void [mscorlib]System.Exception::.ctor()
- throw
- end_try:
-
- end:
- ret
-
- .try start_try to end_try catch [mscorlib]System.Exception handler start_catch to end_catch
- }
- .method static int32 Main(string[] args)
- {
- .maxstack 2
- .entrypoint
-
-
- start_try:
-
- call void Program::Nasty()
- leave.s end_failure
-
- end_try:
- start_catch:
-
- leave.s end_success
- end_catch:
-
- end_success:
- ldstr "Test SUCCESS"
- call void [System.Console]System.Console::WriteLine(string)
- ldc.i4 100
- ret
-
- end_failure:
- ldstr "Test FAILURE"
- call void [System.Console]System.Console::WriteLine(string)
- ldc.i4 -1
- ret
-
- .try start_try to end_try catch [mscorlib]System.NotSupportedException handler start_catch to end_catch
- }
-} \ No newline at end of file
diff --git a/tests/src/JIT/Regression/CLR-x86-JIT/V2.0-RTM/b475589/b475589.ilproj b/tests/src/JIT/Regression/CLR-x86-JIT/V2.0-RTM/b475589/b475589.ilproj
deleted file mode 100644
index 14ed64f690..0000000000
--- a/tests/src/JIT/Regression/CLR-x86-JIT/V2.0-RTM/b475589/b475589.ilproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>$(MSBuildProjectName)</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <FileAlignment>512</FileAlignment>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <PropertyGroup>
-
- </PropertyGroup>
- <ItemGroup>
- <Compile Include="b475589.il" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
- </PropertyGroup>
-</Project> \ No newline at end of file