From 618e798e3ba00e8b95158fd1d7081ca91cc43bf5 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 8 Mar 2016 00:41:21 -0800 Subject: Delete dead code - Delete BINDER, STANDALONE_BINDER and MDIL ifdefs --- src/binder/assemblybinder.cpp | 16 +- src/binder/clrprivbinderassemblyloadcontext.cpp | 4 +- src/binder/clrprivbindercoreclr.cpp | 8 +- src/binder/inc/assembly.hpp | 8 +- src/binder/inc/assemblybinder.hpp | 14 +- src/binder/inc/clrprivbinderassemblyloadcontext.h | 4 +- src/binder/inc/clrprivbindercoreclr.h | 4 +- src/gc/gc.h | 12 - src/gc/gcdesc.h | 4 +- src/gcinfo/gcinfoencoder.cpp | 5 - src/inc/appxutil.h | 4 - src/inc/check.inl | 8 +- src/inc/clrconfigvalues.h | 19 - src/inc/clrhost.h | 6 - src/inc/clrprivbinderutil.h | 9 - src/inc/contract.h | 4 - src/inc/corcompile.h | 66 +- src/inc/cordebuginfo.h | 4 - src/inc/coregen.h | 7 +- src/inc/corerror.xml | 6 - src/inc/ex.h | 68 - src/inc/gcinfo.h | 446 +---- src/inc/jithelpers.h | 482 +++--- src/inc/metadata.h | 2 - src/inc/switches.h | 2 +- src/inc/unsafe.h | 2 - src/inc/utilcode.h | 9 +- src/inc/volatile.h | 2 - src/inc/zapper.h | 15 +- src/jit/DIRS.proj | 2 +- src/md/runtime/mdinternalro.cpp | 17 - src/pal/prebuilt/corerror/mscorurt.rc | 1 - src/pal/prebuilt/inc/corerror.h | 1 - src/tools/crossgen/crossgen.cpp | 89 - src/vm/appdomain.hpp | 76 +- src/vm/appdomain.inl | 4 - src/vm/appxutil.h | 2 +- src/vm/binder.h | 2 +- src/vm/callingconvention.h | 6 +- src/vm/ceeload.cpp | 32 - src/vm/ceeload.h | 141 +- src/vm/class.cpp | 1281 -------------- src/vm/class.h | 56 +- src/vm/classhash.h | 7 - src/vm/clrprivbinderutil.cpp | 8 +- src/vm/clrprivbinderwinrt.cpp | 61 +- src/vm/clrprivbinderwinrt.h | 8 +- src/vm/clrprivtypecachewinrt.h | 32 +- src/vm/clsload.hpp | 10 - src/vm/common.h | 11 - src/vm/compile.cpp | 355 +--- src/vm/compile.h | 37 +- src/vm/constrainedexecutionregion.h | 4 - src/vm/contractimpl.h | 7 - src/vm/coreassemblyspec.cpp | 4 +- src/vm/corebindresult.cpp | 4 - src/vm/crossdomaincalls.cpp | 2 - src/vm/crossdomaincalls.h | 4 +- src/vm/crst.h | 20 - src/vm/dataimage.cpp | 45 +- src/vm/dataimage.h | 12 - src/vm/debuginfostore.cpp | 38 - src/vm/decodemd.h | 2 - src/vm/dllimport.cpp | 10 +- src/vm/domainfile.cpp | 12 - src/vm/ecall.cpp | 4 - src/vm/eehash.h | 2 - src/vm/exceptmacros.h | 4 - src/vm/fcall.h | 2 +- src/vm/field.h | 120 +- src/vm/fieldmarshaler.h | 81 - src/vm/genericdict.h | 4 - src/vm/generics.inl | 8 - src/vm/i386/cgencpu.h | 4 - src/vm/i386/stublinkerx86.h | 4 - src/vm/ilstubcache.cpp | 2 - src/vm/ilstubcache.h | 8 +- src/vm/instmethhash.h | 4 - src/vm/method.hpp | 181 +- src/vm/method.inl | 6 - src/vm/methodimpl.h | 3 - src/vm/methodtable.cpp | 19 - src/vm/methodtable.h | 46 +- src/vm/methodtablebuilder.cpp | 13 +- src/vm/methodtablebuilder.h | 11 - src/vm/ngenhash.h | 8 - src/vm/object.h | 14 +- src/vm/object.inl | 5 - src/vm/peimagelayout.cpp | 24 - src/vm/peimagelayout.h | 3 - src/vm/simplerwlock.hpp | 13 - src/vm/staticallocationhelpers.inl | 84 +- src/vm/stublink.h | 2 - src/vm/syncblk.h | 13 +- src/vm/threadstatics.h | 20 +- src/vm/typedesc.h | 23 +- src/vm/typehandle.h | 4 - src/vm/util.hpp | 4 - src/vm/vars.hpp | 11 - src/vm/winrtredirector.h | 5 - src/vm/zapsig.cpp | 26 +- src/vm/zapsig.h | 32 - src/zap/zapcode.cpp | 61 +- src/zap/zapcode.h | 167 +- src/zap/zapheaders.cpp | 2 - src/zap/zapimage.cpp | 1839 ++------------------- src/zap/zapimage.h | 281 ---- src/zap/zapimport.cpp | 18 +- src/zap/zapinfo.cpp | 24 +- src/zap/zapinfo.h | 10 - src/zap/zapinnerptr.h | 14 +- src/zap/zapmetadata.cpp | 582 ------- src/zap/zapmetadata.h | 63 - src/zap/zapper.cpp | 139 +- src/zap/zaprelocs.cpp | 66 - src/zap/zaprelocs.h | 72 - src/zap/zapwriter.h | 8 - 117 files changed, 449 insertions(+), 7357 deletions(-) (limited to 'src') diff --git a/src/binder/assemblybinder.cpp b/src/binder/assemblybinder.cpp index 1e760ee80a..a4ad3c1798 100644 --- a/src/binder/assemblybinder.cpp +++ b/src/binder/assemblybinder.cpp @@ -51,7 +51,7 @@ BOOL IsCompilationProcess(); extern BOOL RuntimeIsLegacyNetCF(DWORD adid); #endif -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) #include "clrprivbindercoreclr.h" #include "clrprivbinderassemblyloadcontext.h" // Helper function in the VM, invoked by the Binder, to invoke the host assembly resolver @@ -60,7 +60,7 @@ extern HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadCon // Helper to check if we have a host assembly resolver set extern BOOL RuntimeCanUseAppPathAssemblyResolver(DWORD adid); -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) namespace BINDER_SPACE { @@ -1115,12 +1115,12 @@ namespace BINDER_SPACE // Dynamic binds need to be always considered a failure for binding closures IF_FAIL_GO(FUSION_E_APP_DOMAIN_LOCKED); } -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) else if (IgnoreRefDefMatch(dwBindFlags)) { // Skip RefDef matching if we have been asked to. } -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) else { // Can't give higher serciving than already bound @@ -1444,13 +1444,13 @@ namespace BINDER_SPACE bool fUseAppPathsBasedResolver = !excludeAppPaths; -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) // If Host Assembly Resolver is specified, then we will use that as the override for the default resolution mechanism (that uses AppPath probing). if (fUseAppPathsBasedResolver && !RuntimeCanUseAppPathAssemblyResolver(pApplicationContext->GetAppDomainId())) { fUseAppPathsBasedResolver = false; } -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) // This loop executes twice max. First time through we probe AppNiPaths, the second time we probe AppPaths bool parseNiPaths = true; @@ -1863,7 +1863,7 @@ namespace BINDER_SPACE #endif //CROSSGEN_COMPILE -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) HRESULT AssemblyBinder::BindUsingHostAssemblyResolver (/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin, /* in */ AssemblyName *pAssemblyName, /* in */ IAssemblyName *pIAssemblyName, @@ -1996,7 +1996,7 @@ Exit: BINDER_LOG_LEAVE_HR(W("AssemblyBinder::BindUsingPEImage"), hr); return hr; } -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) }; diff --git a/src/binder/clrprivbinderassemblyloadcontext.cpp b/src/binder/clrprivbinderassemblyloadcontext.cpp index 237ec1a19c..57f4ee72c4 100644 --- a/src/binder/clrprivbinderassemblyloadcontext.cpp +++ b/src/binder/clrprivbinderassemblyloadcontext.cpp @@ -8,7 +8,7 @@ #include "clrprivbinderassemblyloadcontext.h" #include "clrprivbinderutil.h" -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) using namespace BINDER_SPACE; @@ -272,4 +272,4 @@ CLRPrivBinderAssemblyLoadContext::CLRPrivBinderAssemblyLoadContext() m_pTPABinder = NULL; } -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) diff --git a/src/binder/clrprivbindercoreclr.cpp b/src/binder/clrprivbindercoreclr.cpp index 9ea6eba04f..a2fb1c8237 100644 --- a/src/binder/clrprivbindercoreclr.cpp +++ b/src/binder/clrprivbindercoreclr.cpp @@ -62,7 +62,7 @@ HRESULT CLRPrivBinderCoreCLR::BindAssemblyByName(IAssemblyName *pIAssemblyNa hr = BindAssemblyByNameWorker(pAssemblyName, &pCoreCLRFoundAssembly, false /* excludeAppPaths */); -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) if ((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) || (hr == FUSION_E_APP_DOMAIN_LOCKED) || (hr == FUSION_E_REF_DEF_MISMATCH)) { @@ -93,7 +93,7 @@ HRESULT CLRPrivBinderCoreCLR::BindAssemblyByName(IAssemblyName *pIAssemblyNa } } } -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) IF_FAIL_GO(hr); @@ -106,7 +106,7 @@ Exit:; return hr; } -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) HRESULT CLRPrivBinderCoreCLR::BindUsingPEImage( /* in */ PEImage *pPEImage, /* in */ BOOL fIsNativeImage, /* [retval][out] */ ICLRPrivAssembly **ppAssembly) @@ -178,7 +178,7 @@ Exit:; return hr; } -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) HRESULT CLRPrivBinderCoreCLR::VerifyBind(IAssemblyName *AssemblyName, ICLRPrivAssembly *pAssembly, diff --git a/src/binder/inc/assembly.hpp b/src/binder/inc/assembly.hpp index 0df53ad833..5b8425a3d1 100644 --- a/src/binder/inc/assembly.hpp +++ b/src/binder/inc/assembly.hpp @@ -25,9 +25,9 @@ #include "clrprivbindercoreclr.h" #endif // !defined(FEATURE_FUSION) -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) #include "clrprivbinderassemblyloadcontext.h" -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) STDAPI BinderAcquirePEImage(LPCTSTR szAssemblyPath, PEImage **ppPEImage, @@ -207,9 +207,9 @@ public: friend class ::CLRPrivBinderCoreCLR; #endif // !defined(FEATURE_FUSION) -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) friend class ::CLRPrivBinderAssemblyLoadContext; -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) }; // This is a fast version which goes around the COM interfaces and directly diff --git a/src/binder/inc/assemblybinder.hpp b/src/binder/inc/assemblybinder.hpp index d5f3277180..87d6491a92 100644 --- a/src/binder/inc/assemblybinder.hpp +++ b/src/binder/inc/assemblybinder.hpp @@ -74,7 +74,7 @@ namespace BINDER_SPACE /* out */ Assembly **ppAssembly, /* in */ LPCTSTR szMDAssemblyPath = NULL); -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) static HRESULT BindUsingHostAssemblyResolver (/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin, /* in */ AssemblyName *pAssemblyName, /* in */ IAssemblyName *pIAssemblyName, @@ -86,9 +86,9 @@ namespace BINDER_SPACE /* in */ PEKIND peKind, /* in */ IMDInternalImport *pIMetaDataAssemblyImport, /* [retval] [out] */ Assembly **ppAssembly); -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) - static HRESULT TranslatePEToArchitectureType(DWORD *pdwPAFlags, PEKIND *PeKind); + static HRESULT TranslatePEToArchitectureType(DWORD *pdwPAFlags, PEKIND *PeKind); protected: enum @@ -97,10 +97,10 @@ namespace BINDER_SPACE BIND_CACHE_FAILURES = 0x01, BIND_CACHE_RERUN_BIND = 0x02, BIND_IGNORE_DYNAMIC_BINDS = 0x04 -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) , BIND_IGNORE_REFDEF_MATCH = 0x8 -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) }; static BOOL IgnoreDynamicBinds(DWORD dwBindFlags) @@ -118,12 +118,12 @@ namespace BINDER_SPACE return ((dwBindFlags & BIND_CACHE_RERUN_BIND) != 0); } -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) static BOOL IgnoreRefDefMatch(DWORD dwBindFlags) { return ((dwBindFlags & BIND_IGNORE_REFDEF_MATCH) != 0); } -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) static HRESULT BindByName(/* in */ ApplicationContext *pApplicationContext, /* in */ AssemblyName *pAssemblyName, diff --git a/src/binder/inc/clrprivbinderassemblyloadcontext.h b/src/binder/inc/clrprivbinderassemblyloadcontext.h index 91a4b6e0b7..83113f4633 100644 --- a/src/binder/inc/clrprivbinderassemblyloadcontext.h +++ b/src/binder/inc/clrprivbinderassemblyloadcontext.h @@ -10,7 +10,7 @@ #include "applicationcontext.hpp" #include "clrprivbindercoreclr.h" -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) namespace BINDER_SPACE { @@ -82,5 +82,5 @@ private: INT_PTR m_ptrManagedAssemblyLoadContext; }; -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) #endif // __CLRPRIVBINDERASSEMBLYLOADCONTEXT_H__ diff --git a/src/binder/inc/clrprivbindercoreclr.h b/src/binder/inc/clrprivbindercoreclr.h index 250c3f8589..e906e01b12 100644 --- a/src/binder/inc/clrprivbindercoreclr.h +++ b/src/binder/inc/clrprivbindercoreclr.h @@ -67,11 +67,11 @@ public: HRESULT PreBindByteArray(PEImage *pPEImage, BOOL fInspectionOnly); #endif // CROSSGEN_COMPILE -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) HRESULT BindUsingPEImage( /* in */ PEImage *pPEImage, /* in */ BOOL fIsNativeImage, /* [retval][out] */ ICLRPrivAssembly **ppAssembly); -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) HRESULT BindAssemblyByNameWorker( BINDER_SPACE::AssemblyName *pAssemblyName, diff --git a/src/gc/gc.h b/src/gc/gc.h index 51c067718a..154b8164b4 100644 --- a/src/gc/gc.h +++ b/src/gc/gc.h @@ -14,14 +14,10 @@ Module Name: #ifndef __GC_H #define __GC_H -#ifndef BINDER - #ifdef PROFILING_SUPPORTED #define GC_PROFILING //Turn on profiling #endif // PROFILING_SUPPORTED -#endif - /* * Promotion Function Prototypes */ @@ -380,17 +376,11 @@ public: static GCHeap *GetGCHeap() { -#ifdef CLR_STANDALONE_BINDER - return NULL; -#else LIMITED_METHOD_CONTRACT; _ASSERTE(g_pGCHeap != NULL); return g_pGCHeap; -#endif } - -#ifndef CLR_STANDALONE_BINDER #ifndef DACCESS_COMPILE static BOOL IsGCInProgress(BOOL bConsiderGCStart = FALSE) @@ -505,8 +495,6 @@ public: } #endif // DACCESS_COMPILE -#endif // !CLR_STANDALONE_BINDER - private: typedef enum { diff --git a/src/gc/gcdesc.h b/src/gc/gcdesc.h index dfb91cce17..7cc132a640 100644 --- a/src/gc/gcdesc.h +++ b/src/gc/gcdesc.h @@ -168,9 +168,9 @@ public: { // If it doesn't contain pointers, there isn't a GCDesc PTR_MethodTable mt(pMT); -#ifndef BINDER + _ASSERTE(mt->ContainsPointersOrCollectible()); -#endif + return PTR_CGCDesc(mt); } diff --git a/src/gcinfo/gcinfoencoder.cpp b/src/gcinfo/gcinfoencoder.cpp index cc4bb52ac4..5d04cf371b 100644 --- a/src/gcinfo/gcinfoencoder.cpp +++ b/src/gcinfo/gcinfoencoder.cpp @@ -280,11 +280,6 @@ private: unsigned m_curBase; }; - -#ifdef MDIL -#define MUST_CALL_JITALLOCATOR_FREE 1 -#endif - class LiveStateFuncs { public: diff --git a/src/inc/appxutil.h b/src/inc/appxutil.h index 3ea33eac2a..2892ab7dd8 100644 --- a/src/inc/appxutil.h +++ b/src/inc/appxutil.h @@ -12,10 +12,6 @@ #include "appmodel.h" #include "fusionsetup.h" -#if defined(CLR_STANDALONE_BINDER) -#include "windowsstring.h" -#endif // CLR_STANDALONE_BINDER - #define PACKAGE_FILTER_CLR_DEFAULT (PACKAGE_FILTER_HEAD|PACKAGE_FILTER_DIRECT) diff --git a/src/inc/check.inl b/src/inc/check.inl index 33d100c7ec..9a3597ef81 100644 --- a/src/inc/check.inl +++ b/src/inc/check.inl @@ -23,10 +23,8 @@ inline LONG *CHECK::InitTls() #pragma pop_macro("HeapAlloc") #pragma pop_macro("GetProcessHeap") -#ifndef CLR_STANDALONE_BINDER ClrFlsSetValue(TlsIdx_Check, pCount); ClrFlsAssociateCallback(TlsIdx_Check, ReleaseCheckTls); -#endif //!CLR_STANDALONE_BINDER return pCount; } @@ -49,7 +47,7 @@ FORCEINLINE BOOL CHECK::EnterAssert() if (s_neverEnforceAsserts) return FALSE; -#if defined(_DEBUG_IMPL) && !defined(CLR_STANDALONE_BINDER) +#ifdef _DEBUG_IMPL m_pCount = (LONG *)ClrFlsGetValue(TlsIdx_Check); if (!m_pCount) { @@ -74,14 +72,14 @@ FORCEINLINE BOOL CHECK::EnterAssert() FORCEINLINE void CHECK::LeaveAssert() { -#if defined(_DEBUG_IMPL) && !defined(CLR_STANDALONE_BINDER) +#ifdef _DEBUG_IMPL *m_pCount = 0; #endif } FORCEINLINE BOOL CHECK::IsInAssert() { -#if defined(_DEBUG_IMPL) && !defined(CLR_STANDALONE_BINDER) +#ifdef _DEBUG_IMPL if (!m_pCount) m_pCount = (LONG *)ClrFlsGetValue(TlsIdx_Check); diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index e364d3a2a8..22d43cd8f0 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -703,27 +703,8 @@ CONFIG_STRING_INFO(INTERNAL_NgenBind_ZapForbidList, W("NgenBind_ZapForbid RETAIL_CONFIG_DWORD_INFO(EXTERNAL_NgenBind_OptimizeNonGac, W("NgenBind_OptimizeNonGac"), 0, "Skip loading IL image outside of GAC when NI can be loaded") -// -// MDIL -// -RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_JIT_MDIL_MIN_TOKEN, W("JIT_MDIL_MIN_TOKEN"), 0, "TBD", CLRConfig::REGUTIL_default) -RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_JIT_MDIL_MAX_TOKEN, W("JIT_MDIL_MAX_TOKEN"), 0xffffffff, "TBD", CLRConfig::REGUTIL_default) -RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_JitDisassembleMDIL, W("JitDisassembleMDIL"), 0, "TBD", CLRConfig::REGUTIL_default) -RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_JitListMDILtoNative, W("JitListMDILtoNative"), 0, "TBD", CLRConfig::REGUTIL_default) -RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_MDIL_BREAK_ON, W("MDIL_BREAK_ON"), "TBD", CLRConfig::REGUTIL_default) CONFIG_DWORD_INFO_EX(INTERNAL_SymDiffDump, W("SymDiffDump"), 0, "Used to create the map file while binding the assembly. Used by SemanticDiffer", CLRConfig::REGUTIL_default) -// MDIL stress -CONFIG_DWORD_INFO(INTERNAL_TritonStressSeed, W("TritonStressSeed"), 0, "Seed used for random number used to drive mdil stress modes") -CONFIG_DWORD_INFO(INTERNAL_TritonStressLogFlags, W("TritonStressLogFlags"), 3, "Triton stress logging") -CONFIG_DWORD_INFO(INTERNAL_TritonStressPartialMDIL, W("TritonStressPartialMDIL"), 0, "This stress mode will cause some number of methods to abort MDIL compilation. This should trigger them to fall back to JIT at runtime.") -CONFIG_DWORD_INFO(INTERNAL_TritonStressPartialCTL, W("TritonStressPartialCTL"), 0, "This stress mode will cause some number of types from this module to fail to generate CTL.") -CONFIG_DWORD_INFO(INTERNAL_TritonStressTypeLoad, W("TritonStressTypeLoad"), 0, "Triton Stress of type loading in mdilbind, parameter is LoadStressFlag") -CONFIG_DWORD_INFO(INTERNAL_TritonStressMethodLoad, W("TritonStressMethodLoad"), 0, "Triton Stress of method loading in mdilbind, parameter is LoadStressFlag") -CONFIG_DWORD_INFO(INTERNAL_TritonStressFieldLoad, W("TritonStressFieldLoad"), 0, "Triton Stress of field loading in mdilbind, parameter is LoadStressFlag") -CONFIG_DWORD_INFO(INTERNAL_TritonStressAssemblyLoad, W("TritonStressAssemblyLoad"), 0, "Triton Stress of assembly loading in mdilbind, parameter is LoadStressFlag") -RETAIL_CONFIG_DWORD_INFO(INTERNAL_MdilNIGenDefaultFailureMode, W("MdilNIGenDefaultFailureMode"), 0, "Override default failure mode of mdil ni generation") - // // NGEN // diff --git a/src/inc/clrhost.h b/src/inc/clrhost.h index c6c25bb9ba..8cd9e3e9c2 100644 --- a/src/inc/clrhost.h +++ b/src/inc/clrhost.h @@ -55,9 +55,7 @@ #endif // _DEBUG -#ifndef CLR_STANDALONE_BINDER IExecutionEngine *GetExecutionEngine(); -#endif IEEMemoryManager *GetEEMemoryManager(); LPVOID ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect); @@ -84,7 +82,6 @@ void ClrFlsAssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback); typedef LPVOID* (*CLRFLSGETBLOCK)(); extern CLRFLSGETBLOCK __ClrFlsGetBlock; -#ifndef CLR_STANDALONE_BINDER // Combining getter/setter into a single call inline void ClrFlsIncrementValue(DWORD slot, int increment) { @@ -193,7 +190,6 @@ inline void ClrFlsSetValue(DWORD slot, void *pData) END_PRESERVE_LAST_ERROR; } } -#endif //!CLR_STANDALONE_BINDER typedef LPVOID (*FastAllocInProcessHeapFunc)(DWORD dwFlags, SIZE_T dwBytes); extern FastAllocInProcessHeapFunc __ClrAllocInProcessHeap; @@ -611,7 +607,6 @@ public: // At places where want to allocate stress log, we need to first check if we are allowed to do so. // If ClrTlsInfo doesn't exist for this thread, we take it as can alloc -#ifndef CLR_STANDALONE_BINDER inline bool IsInCantAllocRegion () { size_t count = 0; @@ -624,7 +619,6 @@ inline bool IsInCantAllocRegion () } // for stress log the rule is more restrict, we have to check the global counter too extern BOOL IsInCantAllocStressLogRegion(); -#endif // !CLR_STANDALONE_BINDER #include "genericstackprobe.inl" diff --git a/src/inc/clrprivbinderutil.h b/src/inc/clrprivbinderutil.h index c66b5bfab5..129e90388e 100644 --- a/src/inc/clrprivbinderutil.h +++ b/src/inc/clrprivbinderutil.h @@ -22,17 +22,12 @@ #include "strongnameholders.h" //===================================================================================================================== -#ifndef CLR_STANDALONE_BINDER #define STANDARD_BIND_CONTRACT \ CONTRACTL { \ NOTHROW; \ GC_TRIGGERS; \ MODE_PREEMPTIVE; \ } CONTRACTL_END -#else -#define MODE_ANY -#define STANDARD_BIND_CONTRACT -#endif //===================================================================================================================== // Forward declarations @@ -94,7 +89,6 @@ namespace CLRPrivBinderUtil } //===================================================================================================================== -#ifndef CLR_STANDALONE_BINDER #ifdef FEATURE_FUSION class CLRPrivAssemblyBindResultWrapper : public IUnknownCommon< @@ -214,7 +208,6 @@ namespace CLRPrivBinderUtil Crst m_lock; }; // class CLRPrivAssemblyBindResultWrapper #endif // FEATURE_FUSION -#endif // !CLR_STANDALONE_BINDER //================================================================================================================= // Used to create an identity-only ICLRPrivAssembly from an ICLRPrivBinder. This is currently used when @@ -858,7 +851,6 @@ namespace CLRPrivBinderUtil }; // class HSTRINGArrayHolder #endif // FEATURE_COMINTEROP -#ifndef CLR_STANDALONE_BINDER //////////////////////////////////////////////////////////////////////////////////////////////////// ///// ----------------------------- Questionable stuff ------------------------------------------- @@ -875,7 +867,6 @@ namespace CLRPrivBinderUtil BOOL CompareHostBinderSpecs(AssemblySpec* a1, AssemblySpec* a2); /** PLACEHOLDER - the same issue as CompareHostBinderSpecs applies to hashing assemblyspecs **/ -#endif // !CLR_STANDALONE_BINDER } // namespace CLRPrivBinderUtil #endif // __CLRPRIVBINDERUTIL_H__ diff --git a/src/inc/contract.h b/src/inc/contract.h index f70fa24505..dd66d2a6e0 100644 --- a/src/inc/contract.h +++ b/src/inc/contract.h @@ -1838,11 +1838,7 @@ typedef __SafeToUsePostCondition __PostConditionOK; // GC_NOTRIGGER allowed but not currently enforced at runtime #define GC_NOTRIGGER STATIC_CONTRACT_GC_NOTRIGGER -#ifndef CLR_STANDALONE_BINDER #define GC_TRIGGERS static_assert(false, "TriggersGC not supported in utilcode contracts") -#else -#define GC_TRIGGERS -#endif #ifdef ENABLE_CONTRACTS_IMPL template diff --git a/src/inc/corcompile.h b/src/inc/corcompile.h index e3e159fcb3..02fd018506 100644 --- a/src/inc/corcompile.h +++ b/src/inc/corcompile.h @@ -351,7 +351,6 @@ struct CORCOMPILE_VIRTUAL_SECTION_INFO CORCOMPILE_SECTION_TYPE(CompressedMaps) \ CORCOMPILE_SECTION_TYPE(Debug) \ CORCOMPILE_SECTION_TYPE(BaseRelocs) \ - CORCOMPILE_SECTION_TYPE(MDILData) \ // Hot: Items are frequently accessed ( Indicated by either IBC data, or // statically known ) @@ -1240,10 +1239,6 @@ class ICorCompilePreloader virtual BOOL IsUncompiledMethod(CORINFO_METHOD_HANDLE handle) = 0; -#ifdef MDIL - virtual void AddMDILCodeFlavorsToUncompiledMethods(CORINFO_METHOD_HANDLE handle) = 0; -#endif - // Return a method handle that was previously registered and // hasn't been compiled already, and remove it from the set // of uncompiled methods. @@ -1468,16 +1463,6 @@ typedef void (__stdcall *DEFINETOKEN_CALLBACK)(LPVOID pModuleContext, CORINFO_MO typedef HRESULT (__stdcall *CROSS_DOMAIN_CALLBACK)(LPVOID pArgs); -#ifdef MDIL -enum MDILCompilationFlags -{ - MDILCompilationFlags_None = 0, - MDILCompilationFlags_CreateMDIL = 1, - MDILCompilationFlags_MinimalMDIL = 2, - MDILCompilationFlags_NoMDIL = 4, -}; -#endif // MDIL - class ICorCompileInfo { public: @@ -1515,9 +1500,6 @@ class ICorCompileInfo BOOL fForceProfiling, BOOL fForceInstrument, BOOL fForceFulltrustDomain -#ifdef MDIL - , MDILCompilationFlags mdilCompilationFlags -#endif ) = 0; // calls pfnCallback in the specified domain @@ -1591,7 +1573,6 @@ class ICorCompileInfo CORINFO_MODULE_HANDLE *pHandle ) = 0; -#ifndef BINDER #ifndef FEATURE_CORECLR // Check if the assembly supports automatic NGen virtual BOOL SupportsAutoNGen( @@ -1604,7 +1585,6 @@ class ICorCompileInfo HANDLE *pModules, COUNT_T nModules ) = 0; -#endif #endif // Checks to see if an up to date zap exists for the @@ -1616,27 +1596,6 @@ class ICorCompileInfo LPDWORD cAssemblyManifestModulePath ) = 0; -#ifdef MDIL - // Get details of trust assigned to image - virtual DWORD GetMdilModuleSecurityFlags( - CORINFO_ASSEMBLY_HANDLE assembly - ) = 0; - - // Check to see if the no string interning optimization is permitted. - virtual BOOL CompilerRelaxationNoStringInterningPermitted( - CORINFO_ASSEMBLY_HANDLE assembly - ) = 0; - - // Check to see if the non Exception derived exceptions should be wrapped. - virtual BOOL RuntimeCompatibilityWrapExceptions( - CORINFO_ASSEMBLY_HANDLE assembly - ) = 0; - - virtual DWORD CERReliabilityContract( - CORINFO_ASSEMBLY_HANDLE assembly - ) = 0; -#endif // MDIL - // Sets up the compilation target in the EE virtual HRESULT SetCompilationTarget( CORINFO_ASSEMBLY_HANDLE assembly, @@ -1665,9 +1624,7 @@ class ICorCompileInfo CORINFO_ASSEMBLY_HANDLE hAssembly, CORINFO_ASSEMBLY_HANDLE hAssemblyDependency, LoadHintEnum *loadHint, - // TritonTODO: should this be inside ifdef? - LoadHintEnum *defaultLoadHint = NULL // for MDIL we want to separate the default load hint on the assembly - // from the load hint on the dependency + LoadHintEnum *defaultLoadHint = NULL ) = 0; // Returns information on how the assembly has been loaded @@ -1843,13 +1800,6 @@ class ICorCompileInfo CorProfileData *profileData ) = 0; -#ifdef MDIL - // Returns whether or not a method should be compiled. S_OK for yes, S_FALSE for no. - virtual HRESULT ShouldCompile( - CORINFO_METHOD_HANDLE methodHandle - ) = 0; -#endif // MDIL - // Gets the codebase URL for the assembly virtual void GetAssemblyCodeBase( CORINFO_ASSEMBLY_HANDLE hAssembly, @@ -1900,16 +1850,6 @@ class ICorCompileInfo // true if the method has [NativeCallableAttribute] virtual BOOL IsNativeCallableMethod(CORINFO_METHOD_HANDLE handle) = 0; -#ifdef CLR_STANDALONE_BINDER - virtual HRESULT GetMetadataRvaInfo( - OUT DWORD *pFirstMethodRvaOffset, - OUT DWORD *pMethodDefRecordSize, - OUT DWORD *pMethodDefCount, - OUT DWORD *pFirstFieldRvaOffset, - OUT DWORD *pFieldRvaRecordSize, - OUT DWORD *pFieldRvaCount) = 0; -#endif - virtual BOOL GetIsGeneratingNgenPDB() = 0; virtual void SetIsGeneratingNgenPDB(BOOL fGeneratingNgenPDB) = 0; @@ -1961,10 +1901,6 @@ extern "C" unsigned __stdcall PartialNGenStressPercentage(); // create a PDB dumping all functions in hAssembly into pdbPath extern "C" HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath); -#ifdef MDIL -extern bool g_fIsNGenEmbedILProcess; -#endif // MDIL - #if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) extern bool g_fNGenMissingDependenciesOk; #endif diff --git a/src/inc/cordebuginfo.h b/src/inc/cordebuginfo.h index 1da99ece96..b065c5fc06 100644 --- a/src/inc/cordebuginfo.h +++ b/src/inc/cordebuginfo.h @@ -189,10 +189,6 @@ public: VLT_COUNT, VLT_INVALID, -#ifdef MDIL - VLT_MDIL_SYMBOLIC = 0x20 -#endif - }; struct VarLoc diff --git a/src/inc/coregen.h b/src/inc/coregen.h index a44aeb4d4d..5ca7334e92 100644 --- a/src/inc/coregen.h +++ b/src/inc/coregen.h @@ -14,12 +14,7 @@ #define NGENWORKER_FLAGS_APPCOMPATWP8 0x0002 #define NGENWORKER_FLAGS_MISSINGDEPENDENCIESOK 0x0004 #define NGENWORKER_FLAGS_FULLTRUSTDOMAIN 0x0008 -#ifdef MDIL -#define NGENWORKER_FLAGS_CREATEMDIL 0x0010 -#define NGENWORKER_FLAGS_MINIMAL_MDIL 0x0040 -#define NGENWORKER_FLAGS_EMBEDMDIL 0x0080 -#define NGENWORKER_FLAGS_NOMDIL 0x0100 -#endif + #define NGENWORKER_FLAGS_WINMD_RESILIENT 0x1000 #define NGENWORKER_FLAGS_READYTORUN 0x2000 #define NGENWORKER_FLAGS_NO_METADATA 0x4000 diff --git a/src/inc/corerror.xml b/src/inc/corerror.xml index 98d41ea845..a859cfac5d 100644 --- a/src/inc/corerror.xml +++ b/src/inc/corerror.xml @@ -4375,12 +4375,6 @@ The operation was cancelled. - - COR_E_UNSUPPORTEDMDIL - "Valid IL which cannot be compiled into MDIL." - Valid IL which cannot be compiled into MDIL. We will skip MDIL compilation and fall back to JIT. - - COR_E_INSUFFICIENTMEMORY Not enough memory was available for an operation. diff --git a/src/inc/ex.h b/src/inc/ex.h index af1d0f558c..80b9aa0a07 100644 --- a/src/inc/ex.h +++ b/src/inc/ex.h @@ -18,70 +18,7 @@ void RetailAssertIfExpectedClean(); // Defined in src/utilcode/debug #define EX_TRY_HOLDER #endif // FEATURE_PAL -#ifdef CLR_STANDALONE_BINDER - -#define INCONTRACT(x) - -#define EX_THROW(type, value) throw type(value) - -void DECLSPEC_NORETURN ThrowLastError(); - -#define EX_TRY \ - try \ - { \ - EX_TRY_HOLDER \ - -#define EX_CATCH_HRESULT(_hr) } catch (HRESULT hr) { _hr = hr; } -#define EX_CATCH } catch(...) -#define EX_END_CATCH(a) -#define EX_RETHROW throw -#define EX_SWALLOW_NONTERMINAL } catch(...) {} -#define EX_END_CATCH_UNREACHABLE -#define EX_CATCH_HRESULT_NO_ERRORINFO(_hr) \ - EX_CATCH \ - { \ - (_hr) = GET_EXCEPTION()->GetHR(); \ - _ASSERTE(FAILED(_hr)); \ - } \ - EX_END_CATCH(SwallowAllExceptions) - -void DECLSPEC_NORETURN ThrowHR(HRESULT hr); -inline void DECLSPEC_NORETURN ThrowHR(HRESULT hr, int msgId) -{ - throw hr; -} -void DECLSPEC_NORETURN ThrowHR(HRESULT hr, SString const &msg); - -#define GET_EXCEPTION() ((Exception*)NULL) - -void DECLSPEC_NORETURN ThrowWin32(DWORD err); - -inline void IfFailThrow(HRESULT hr) -{ - WRAPPER_NO_CONTRACT; - - if (FAILED(hr)) - { - ThrowHR(hr); - } -} - -/* -inline HRESULT OutOfMemory() -{ - LEAF_CONTRACT; - return (E_OUTOFMEMORY); -} -*/ -#define COMPlusThrowNonLocalized(key, msg) throw msg - -// Set if fatal error (like stack overflow or out of memory) occurred in this process. -extern HRESULT g_hrFatalError; - -#endif //CLR_STANDALONE_BINDER - #include "sstring.h" -#ifndef CLR_STANDALONE_BINDER #include "crtwrap.h" #include "winwrap.h" #include "corerror.h" @@ -94,8 +31,6 @@ extern HRESULT g_hrFatalError; #define _DEBUG_IMPL 1 #endif -#endif //!CLR_STANDALONE_BINDER - //=========================================================================================== // These abstractions hide the difference between legacy desktop CLR's (that don't support @@ -664,8 +599,6 @@ class OutOfMemoryException : public Exception virtual BOOL IsPreallocatedException() { return bIsPreallocated; } }; -#ifndef CLR_STANDALONE_BINDER - template class CAutoTryCleanup { @@ -1583,5 +1516,4 @@ inline HRESULT IfTransientFailThrow(HRESULT hr) // Set if fatal error (like stack overflow or out of memory) occurred in this process. GVAL_DECL(HRESULT, g_hrFatalError); -#endif // !CLR_STANDALONE_BINDER #endif // _EX_H_ diff --git a/src/inc/gcinfo.h b/src/inc/gcinfo.h index adacff4140..bb80620f31 100644 --- a/src/inc/gcinfo.h +++ b/src/inc/gcinfo.h @@ -31,7 +31,7 @@ const unsigned byref_OFFSET_FLAG = 0x1; // the offset is an interior ptr const unsigned pinned_OFFSET_FLAG = 0x2; // the offset is a pinned ptr const unsigned this_OFFSET_FLAG = 0x2; // the offset is "this" -#if defined(_TARGET_X86_) || defined(_TARGET_ARM_) +#ifdef _TARGET_X86_ #ifndef FASTCALL #define FASTCALL __fastcall @@ -114,264 +114,13 @@ enum infoHdrAdjust { #include -#ifdef BINDER -#ifdef TARGET_ARM - -#define NUM_PRESERVED_REGS 9 - -enum RegMask -{ - RBM_NONE= 0x0000, - RBM_R0 = 0x0001, - RBM_R1 = 0x0002, - RBM_R2 = 0x0004, - RBM_R3 = 0x0008, - RBM_R4 = 0x0010, // callee saved - RBM_R5 = 0x0020, // callee saved - RBM_R6 = 0x0040, // callee saved - RBM_R7 = 0x0080, // callee saved - RBM_R8 = 0x0100, // callee saved - RBM_R9 = 0x0200, // callee saved - RBM_R10 = 0x0400, // callee saved - RBM_R11 = 0x0800, // callee saved - RBM_R12 = 0x1000, - RBM_SP = 0x2000, - RBM_LR = 0x4000, // callee saved, but not valid to be alive across a call! - RBM_PC = 0x8000, - RBM_RETVAL = RBM_R0, - RBM_CALLEE_SAVED_REGS = (RBM_R4|RBM_R5|RBM_R6|RBM_R7|RBM_R8|RBM_R9|RBM_R10|RBM_R11|RBM_LR), - RBM_CALLEE_SAVED_REG_COUNT = 9, - // Special case: LR is callee saved, but may not appear as a live GC ref except - // in the leaf frame because calls will trash it. Therefore, we ALSO consider - // it a scratch register. - RBM_SCRATCH_REGS = (RBM_R0|RBM_R1|RBM_R2|RBM_R3|RBM_R12|RBM_LR), - RBM_SCRATCH_REG_COUNT = 6, - - // TritonToDo: is frame pointer part of the saved registers? (stackwalker related) - RBM_SAVED = (RBM_R4|RBM_R5|RBM_R6|RBM_R7|RBM_R8|RBM_R9|RBM_R10|RBM_R11|RBM_LR), - // TritonToDo: CHECK: is this the correct set of registers? - RBM_VOLATILE = (RBM_R0|RBM_R1|RBM_R2|RBM_R3|RBM_R12|RBM_LR), - RBM_ALLCODEGEN = (RBM_SAVED | RBM_VOLATILE), -}; - -enum RegNumber -{ - RN_R0 = 0, - RN_R1 = 1, - RN_R2 = 2, - RN_R3 = 3, - RN_R4 = 4, - RN_R5 = 5, - RN_R6 = 6, - RN_R7 = 7, - RN_R8 = 8, - RN_R9 = 9, - RN_R10 = 10, - RN_R11 = 11, - RN_R12 = 12, - RN_SP = 13, - RN_LR = 14, - RN_PC = 15, - - RN_NONE = 16, -}; - -enum CalleeSavedRegNum -{ - CSR_NUM_R4 = 0x00, - CSR_NUM_R5 = 0x01, - CSR_NUM_R6 = 0x02, - CSR_NUM_R7 = 0x03, - CSR_NUM_R8 = 0x04, - CSR_NUM_R9 = 0x05, - CSR_NUM_R10 = 0x06, - CSR_NUM_R11 = 0x07, - // NOTE: LR is omitted because it may not be live except as a 'scratch' reg -}; - -enum CalleeSavedRegMask -{ - CSR_MASK_NONE = 0x00, - CSR_MASK_R4 = 0x001, - CSR_MASK_R5 = 0x002, - CSR_MASK_R6 = 0x004, - CSR_MASK_R7 = 0x008, - CSR_MASK_R8 = 0x010, - CSR_MASK_R9 = 0x020, - CSR_MASK_R10 = 0x040, - CSR_MASK_R11 = 0x080, - CSR_MASK_LR = 0x100, - - CSR_MASK_ALL = 0x1ff, - CSR_MASK_HIGHEST = 0x100, -}; - -enum ScratchRegNum -{ - SR_NUM_R0 = 0x00, - SR_NUM_R1 = 0x01, - SR_NUM_R2 = 0x02, - SR_NUM_R3 = 0x03, - SR_NUM_R12 = 0x04, - SR_NUM_LR = 0x05, -}; - -enum ScratchRegMask -{ - SR_MASK_NONE = 0x00, - SR_MASK_R0 = 0x01, - SR_MASK_R1 = 0x02, - SR_MASK_R2 = 0x04, - SR_MASK_R3 = 0x08, - SR_MASK_R12 = 0x10, - SR_MASK_LR = 0x20, -}; - -#else // TARGET_ARM - -#ifdef TARGET_X64 -#define NUM_PRESERVED_REGS 8 -#else -#define NUM_PRESERVED_REGS 4 -#endif - -enum RegMask -{ - RBM_NONE = 0x0000, - RBM_EAX = 0x0001, - RBM_ECX = 0x0002, - RBM_EDX = 0x0004, - RBM_EBX = 0x0008, // callee saved - RBM_ESP = 0x0010, - RBM_EBP = 0x0020, // callee saved - RBM_ESI = 0x0040, // callee saved - RBM_EDI = 0x0080, // callee saved - - RBM_R8 = 0x0100, - RBM_R9 = 0x0200, - RBM_R10 = 0x0400, - RBM_R11 = 0x0800, - RBM_R12 = 0x1000, // callee saved - RBM_R13 = 0x2000, // callee saved - RBM_R14 = 0x4000, // callee saved - RBM_R15 = 0x8000, // callee saved - - RBM_RETVAL = RBM_EAX, - -#ifdef TARGET_X64 - // TritonToDo: is RBM_EBP part of the saved registers? (stackwalker related) - RBM_SAVED = (RBM_EDI|RBM_ESI|RBM_EBX|RBM_R12|RBM_R13|RBM_R14|RBM_R15), - //TritonToDo: CHECK: is this the correct set? - RBM_VOLATILE = (RBM_EAX|RBM_ECX|RBM_EDX|RBM_R8|RBM_R9|RBM_R10|RBM_R11), - RBM_ALLCODEGEN = (RBM_SAVED | RBM_VOLATILE), - - RBM_CALLEE_SAVED_REGS = (RBM_EDI|RBM_ESI|RBM_EBX|RBM_EBP|RBM_R12|RBM_R13|RBM_R14|RBM_R15), - RBM_CALLEE_SAVED_REG_COUNT = 8, - RBM_SCRATCH_REGS = (RBM_EAX|RBM_ECX|RBM_EDX|RBM_R8|RBM_R9|RBM_R10|RBM_R11), - RBM_SCRATCH_REG_COUNT = 7, -#else - RBM_SAVED = (RBM_ESI | RBM_EDI | RBM_EBX), - RBM_VOLATILE = (RBM_EAX | RBM_ECX | RBM_EDX), - RBM_ALLCODEGEN = (RBM_SAVED | RBM_VOLATILE), - - RBM_CALLEE_SAVED_REGS = (RBM_EDI|RBM_ESI|RBM_EBX|RBM_EBP), - RBM_CALLEE_SAVED_REG_COUNT = 4, - RBM_SCRATCH_REGS = (RBM_EAX|RBM_ECX|RBM_EDX), - RBM_SCRATCH_REG_COUNT = 3, -#endif // TARGET_X64 -}; - -enum RegNumber -{ - RN_EAX = 0, - RN_ECX = 1, - RN_EDX = 2, - RN_EBX = 3, - RN_ESP = 4, - RN_EBP = 5, - RN_ESI = 6, - RN_EDI = 7, - RN_R8 = 8, - RN_R9 = 9, - RN_R10 = 10, - RN_R11 = 11, - RN_R12 = 12, - RN_R13 = 13, - RN_R14 = 14, - RN_R15 = 15, - - RN_NONE = 16, -}; - -enum CalleeSavedRegNum -{ - CSR_NUM_RBX = 0x00, - CSR_NUM_RSI = 0x01, - CSR_NUM_RDI = 0x02, - CSR_NUM_RBP = 0x03, - CSR_NUM_R12 = 0x04, - CSR_NUM_R13 = 0x05, - CSR_NUM_R14 = 0x06, - CSR_NUM_R15 = 0x07, -}; - -enum CalleeSavedRegMask -{ - CSR_MASK_NONE = 0x00, - CSR_MASK_RBX = 0x01, - CSR_MASK_RSI = 0x02, - CSR_MASK_RDI = 0x04, - CSR_MASK_RBP = 0x08, - CSR_MASK_R12 = 0x10, - CSR_MASK_R13 = 0x20, - CSR_MASK_R14 = 0x40, - CSR_MASK_R15 = 0x80, - -#ifdef TARGET_X64 - CSR_MASK_ALL = 0xFF, - CSR_MASK_HIGHEST = 0x80, -#else - CSR_MASK_ALL = 0x0F, - CSR_MASK_HIGHEST = 0x08, -#endif -}; - -enum ScratchRegNum -{ - SR_NUM_RAX = 0x00, - SR_NUM_RCX = 0x01, - SR_NUM_RDX = 0x02, - SR_NUM_R8 = 0x03, - SR_NUM_R9 = 0x04, - SR_NUM_R10 = 0x05, - SR_NUM_R11 = 0x06, -}; - -enum ScratchRegMask -{ - SR_MASK_NONE = 0x00, - SR_MASK_RAX = 0x01, - SR_MASK_RCX = 0x02, - SR_MASK_RDX = 0x04, - SR_MASK_R8 = 0x08, - SR_MASK_R9 = 0x10, - SR_MASK_R10 = 0x20, - SR_MASK_R11 = 0x40, -}; - -#endif // TARGET_ARM - -#endif // BINDER - // Working set optimization: saving 12 * 128 = 1536 bytes in infoHdrShortcut struct InfoHdr; struct InfoHdrSmall { unsigned char prologSize; // 0 unsigned char epilogSize; // 1 -#if !defined(BINDER) || !defined(TARGET_ARM) unsigned char epilogCount : 3; // 2 [0:2] -#endif unsigned char epilogAtEnd : 1; // 2 [3] unsigned char ediSaved : 1; // 2 [4] which callee-saved regs are pushed onto stack unsigned char esiSaved : 1; // 2 [5] @@ -410,20 +159,6 @@ struct InfoHdr : public InfoHdrSmall { unsigned int syncEndOffset; // 27,28,29,30 // 31 bytes total -#ifdef BINDER -#ifdef TARGET_ARM - unsigned int calleeSavedRegMask : NUM_PRESERVED_REGS; // 9 bits - unsigned int parmRegsPushed : 1; // 1 if the prolog pushed R0-R3 on entry, 0 otherwise - unsigned int genericContextFlags : 2; - unsigned int epilogCount; - int callerSpToPspSlotOffset; // offset of PSP slot relative to incoming SP - // only valid if handlers == 1 - int outgoingArgSize; // >= 0 - - int genericContextOffset; - int securityObjectOffset; // relative to caller SP -#endif -#endif // Checks whether "this" is compatible with "target". // It is not an exact bit match as "this" could have some @@ -466,185 +201,6 @@ struct InfoHdr : public InfoHdrSmall { return true; } - -#ifdef BINDER - void Init() - { - memset(this, 0, sizeof(InfoHdr)); - } - - void SetPrologSize(UInt32 sizeInBytes) - { - prologSize = sizeInBytes; - _ASSERTE(prologSize == sizeInBytes); - } - - void SetEpilogSize(UInt32 sizeInBytes) - { - epilogSize = sizeInBytes; - _ASSERTE(epilogSize == sizeInBytes); - } - - void SetEpilogCount(UInt32 count, bool isAtEnd) - { - epilogCount = count; - epilogAtEnd = isAtEnd ? 1 : 0; - - _ASSERTE(epilogCount == count); - _ASSERTE((count == 1) || !isAtEnd); - } - - void SetReturnPopSize(UInt32 popSizeInBytes) - { - _ASSERTE(0 == (popSizeInBytes % POINTER_SIZE)); -#ifdef TARGET_ARM - _ASSERTE(GetReturnPopSize() <= (int)popSizeInBytes); -#else - _ASSERTE(GetReturnPopSize() == 0 || GetReturnPopSize() == (int)popSizeInBytes); -#endif - argCount = popSizeInBytes / POINTER_SIZE; - } - - void SetFrameSize(UInt32 frameSizeInBytes) - { - _ASSERTE(0 == (frameSizeInBytes % POINTER_SIZE)); - frameSize = frameSizeInBytes / POINTER_SIZE; - } - - void SetRegSaved(CalleeSavedRegMask regMask) - { - _ASSERTE((regMask & ~CSR_MASK_ALL) == CSR_MASK_NONE); -#ifndef TARGET_ARM //TritonToDo - if (regMask & CSR_MASK_RSI) - esiSaved = true; - if (regMask & CSR_MASK_RDI) - ediSaved = true; - if (regMask & CSR_MASK_RBX) - ebxSaved = true; - if (regMask & CSR_MASK_RBP) - ebpSaved = true; -#else - calleeSavedRegMask = regMask; -#endif - } - - void SetSavedRegs(CalleeSavedRegMask regMask) - { -#ifndef TARGET_ARM //TritonToDo - esiSaved = (regMask & CSR_MASK_RSI) != 0; - ediSaved = (regMask & CSR_MASK_RDI) != 0; - ebxSaved = (regMask & CSR_MASK_RBX) != 0; - ebpSaved = (regMask & CSR_MASK_RBP) != 0; -#else - calleeSavedRegMask |= regMask; -#endif - } - - void SetFramePointer(RegNumber regNum, UInt32 offsetInBytes) - { - if (regNum == RN_NONE) - { - ebpFrame = 0; - } - else - { -#ifndef TARGET_ARM //TritonToDo - _ASSERTE(regNum == RN_EBP); -#else -#ifdef CLR_STANDALONE_BINDER - _ASSERTE(regNum == RN_R11); -#else - _ASSERTE(regNum == RN_R7); // REDHAWK -#endif -#endif - ebpFrame = 1; - } - -#ifdef TARGET_X64 - ASSERT((offsetInBytes % 0x10) == 0); - UInt32 offsetInSlots = offsetInBytes / 0x10; - if (offsetInSlots < 7) - { - x64_framePtrOffsetSmall = offsetInSlots; - x64_framePtrOffset = 0; - } - else - { - x64_framePtrOffsetSmall = 7; - x64_framePtrOffset = offsetInSlots - 7; - } -#else - _ASSERTE(offsetInBytes == 0); -#endif // TARGET_X64 - } - - int GetFrameSize() - { - return frameSize*POINTER_SIZE; - } - - int GetReturnPopSize() // returned in bytes - { - return argCount*POINTER_SIZE; - } - - int GetPreservedRegsSaveSize() const // returned in bytes - { -#ifndef TARGET_ARM //TritonToDo - return (ediSaved + esiSaved + ebxSaved + ebpSaved)*POINTER_SIZE; -#else - UInt32 count = 0; - UInt32 mask = calleeSavedRegMask; - while (mask != 0) - { - count += mask & 1; - mask >>= 1; - } - return (int) count * POINTER_SIZE; -#endif - } - - CalleeSavedRegMask GetSavedRegs() - { - unsigned result = CSR_MASK_NONE; -#ifndef TARGET_ARM //TritonToDo - if (ediSaved) - result |= CSR_MASK_RDI; - if (esiSaved) - result |= CSR_MASK_RSI; - if (ebxSaved) - result |= CSR_MASK_RBX; - if (ebpSaved) - result |= CSR_MASK_RBP; - return (CalleeSavedRegMask)result; -#else - return (CalleeSavedRegMask) calleeSavedRegMask; -#endif - } - - bool HasFramePointer() - { - return ebpFrame; - } - - bool IsRegSaved(CalleeSavedRegMask reg) - { - return (0 != (GetSavedRegs() & reg)); - } - -#ifdef TARGET_ARM - UInt32 GetEpilogCount() - { - return epilogCount; - } - - bool IsEpilogAtEnd() - { - return epilogAtEnd != 0; - } -#endif // TARGET_ARM - -#endif // BINDER }; diff --git a/src/inc/jithelpers.h b/src/inc/jithelpers.h index 308ad54e97..a6fd8f819c 100644 --- a/src/inc/jithelpers.h +++ b/src/inc/jithelpers.h @@ -25,387 +25,351 @@ #endif -// This file now also associates jit helpers and Mdil helpers (last column) -// Unless JITHELPER1 or DYNAMICJITHELPER1 are defined, this information is -// completely filtered out. -// MDILHelpers.h defines for each MDIL helper the expected signature, non-retail -// builds check that an MDIL helper's signature matches the corresponding -// jit helper's signature. -// -// See the definition of CorInfoHelpFunc in corinfo.h for more details. -// -#ifndef DYNAMICJITHELPER1 -#define DYNAMICJITHELPER1(code,fn,sig,mdilhelper) DYNAMICJITHELPER(code,fn,sig) -#endif - -// PuCLR Integration note: I [maxmg] saw we changed JITHELPER macro to JITHELPER1 in order to map -// the MDIL helpers, it seems to me we can rename the macro names to JITHELPER again and merge -// both macros into one. - -#ifndef JITHELPER1 -#define JITHELPER1(code,fn,sig,mdilhelper) JITHELPER(code,fn,sig) -#endif - // pfnHelper is set to NULL if it is a stubbed helper. // It will be set in InitJITHelpers2 - JITHELPER1(CORINFO_HELP_UNDEF, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_UNDEF, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) // Arithmetic - JITHELPER1(CORINFO_HELP_DIV, JIT_Div, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DIV) - JITHELPER1(CORINFO_HELP_MOD, JIT_Mod, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_MOD) - JITHELPER1(CORINFO_HELP_UDIV, JIT_UDiv, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_UDIV) - JITHELPER1(CORINFO_HELP_UMOD, JIT_UMod, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_UMOD) + JITHELPER(CORINFO_HELP_DIV, JIT_Div, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_MOD, JIT_Mod, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_UDIV, JIT_UDiv, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_UMOD, JIT_UMod, CORINFO_HELP_SIG_8_STACK) // CORINFO_HELP_DBL2INT, CORINFO_HELP_DBL2UINT, and CORINFO_HELP_DBL2LONG get // patched for CPUs that support SSE2 (P4 and above). #if !defined(_WIN64) - JITHELPER1(CORINFO_HELP_LLSH, JIT_LLsh, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_LLSH) - JITHELPER1(CORINFO_HELP_LRSH, JIT_LRsh, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_LRSH) - JITHELPER1(CORINFO_HELP_LRSZ, JIT_LRsz, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_LRSZ) + JITHELPER(CORINFO_HELP_LLSH, JIT_LLsh, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_LRSH, JIT_LRsh, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_LRSZ, JIT_LRsz, CORINFO_HELP_SIG_REG_ONLY) #else - JITHELPER1(CORINFO_HELP_LLSH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_LLSH) - JITHELPER1(CORINFO_HELP_LRSH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_LRSH) - JITHELPER1(CORINFO_HELP_LRSZ, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_LRSZ) + JITHELPER(CORINFO_HELP_LLSH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + JITHELPER(CORINFO_HELP_LRSH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + JITHELPER(CORINFO_HELP_LRSZ, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #endif - JITHELPER1(CORINFO_HELP_LMUL, JIT_LMul, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_LMUL) - JITHELPER1(CORINFO_HELP_LMUL_OVF, JIT_LMulOvf, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_LMUL_OVF) - JITHELPER1(CORINFO_HELP_ULMUL_OVF, JIT_ULMulOvf, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_ULMUL_OVF) - JITHELPER1(CORINFO_HELP_LDIV, JIT_LDiv, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_LDIV) - JITHELPER1(CORINFO_HELP_LMOD, JIT_LMod, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_LMOD) - JITHELPER1(CORINFO_HELP_ULDIV, JIT_ULDiv, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_ULDIV) - JITHELPER1(CORINFO_HELP_ULMOD, JIT_ULMod, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_ULMOD) - JITHELPER1(CORINFO_HELP_LNG2DBL, JIT_Lng2Dbl, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_LNG2DBL) - JITHELPER1(CORINFO_HELP_ULNG2DBL, JIT_ULng2Dbl, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_ULNG2DBL) - DYNAMICJITHELPER1(CORINFO_HELP_DBL2INT, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DBL2INT) /* use long version */ - JITHELPER1(CORINFO_HELP_DBL2INT_OVF, JIT_Dbl2IntOvf, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DBL2INT_OVF) - DYNAMICJITHELPER1(CORINFO_HELP_DBL2LNG, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DBL2LNG) - JITHELPER1(CORINFO_HELP_DBL2LNG_OVF, JIT_Dbl2LngOvf, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DBL2LNG_OVF) - DYNAMICJITHELPER1(CORINFO_HELP_DBL2UINT, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DBL2UINT) /* use long version */ - JITHELPER1(CORINFO_HELP_DBL2UINT_OVF, JIT_Dbl2UIntOvf, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DBL2UINT_OVF) - JITHELPER1(CORINFO_HELP_DBL2ULNG, JIT_Dbl2ULng, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DBL2ULNG) - JITHELPER1(CORINFO_HELP_DBL2ULNG_OVF, JIT_Dbl2ULngOvf, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_DBL2ULNG_OVF) - JITHELPER1(CORINFO_HELP_FLTREM, JIT_FltRem, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_FLTREM) - JITHELPER1(CORINFO_HELP_DBLREM, JIT_DblRem, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_DBLREM) - JITHELPER1(CORINFO_HELP_FLTROUND, JIT_FloatRound, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_FLTROUND) - JITHELPER1(CORINFO_HELP_DBLROUND, JIT_DoubleRound, CORINFO_HELP_SIG_16_STACK, MDIL_HELP_DBLROUND) + JITHELPER(CORINFO_HELP_LMUL, JIT_LMul, CORINFO_HELP_SIG_16_STACK) + JITHELPER(CORINFO_HELP_LMUL_OVF, JIT_LMulOvf, CORINFO_HELP_SIG_16_STACK) + JITHELPER(CORINFO_HELP_ULMUL_OVF, JIT_ULMulOvf, CORINFO_HELP_SIG_16_STACK) + JITHELPER(CORINFO_HELP_LDIV, JIT_LDiv, CORINFO_HELP_SIG_16_STACK) + JITHELPER(CORINFO_HELP_LMOD, JIT_LMod, CORINFO_HELP_SIG_16_STACK) + JITHELPER(CORINFO_HELP_ULDIV, JIT_ULDiv, CORINFO_HELP_SIG_16_STACK) + JITHELPER(CORINFO_HELP_ULMOD, JIT_ULMod, CORINFO_HELP_SIG_16_STACK) + JITHELPER(CORINFO_HELP_LNG2DBL, JIT_Lng2Dbl, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_ULNG2DBL, JIT_ULng2Dbl, CORINFO_HELP_SIG_8_STACK) + DYNAMICJITHELPER(CORINFO_HELP_DBL2INT, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_DBL2INT_OVF, JIT_Dbl2IntOvf, CORINFO_HELP_SIG_8_STACK) + DYNAMICJITHELPER(CORINFO_HELP_DBL2LNG, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_DBL2LNG_OVF, JIT_Dbl2LngOvf, CORINFO_HELP_SIG_8_STACK) + DYNAMICJITHELPER(CORINFO_HELP_DBL2UINT, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_DBL2UINT_OVF, JIT_Dbl2UIntOvf, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_DBL2ULNG, JIT_Dbl2ULng, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_DBL2ULNG_OVF, JIT_Dbl2ULngOvf, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_FLTREM, JIT_FltRem, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_DBLREM, JIT_DblRem, CORINFO_HELP_SIG_16_STACK) + JITHELPER(CORINFO_HELP_FLTROUND, JIT_FloatRound, CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_DBLROUND, JIT_DoubleRound, CORINFO_HELP_SIG_16_STACK) // Allocating a new object #ifdef FEATURE_REMOTING - JITHELPER1(CORINFO_HELP_NEW_CROSSCONTEXT, JIT_NewCrossContext, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_NEW_CROSSCONTEXT) + JITHELPER(CORINFO_HELP_NEW_CROSSCONTEXT, JIT_NewCrossContext, CORINFO_HELP_SIG_REG_ONLY) #else - JITHELPER1(CORINFO_HELP_NEW_CROSSCONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_NEW_CROSSCONTEXT) + JITHELPER(CORINFO_HELP_NEW_CROSSCONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #endif - JITHELPER1(CORINFO_HELP_NEWFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_NEWFAST) - DYNAMICJITHELPER1(CORINFO_HELP_NEWSFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_NEWSFAST) - DYNAMICJITHELPER1(CORINFO_HELP_NEWSFAST_ALIGN8, JIT_New, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_NEWSFAST_ALIGN8) - JITHELPER1(CORINFO_HELP_NEW_MDARR, JIT_NewMDArr,CORINFO_HELP_SIG_8_VA, MDIL_HELP_NEW_MDARR) - JITHELPER1(CORINFO_HELP_NEWARR_1_DIRECT, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_NEWARR_1_OBJ, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_NEWARR_1_VC, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_NEWARR_1_ALIGN8, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - - JITHELPER1(CORINFO_HELP_STRCNS, JIT_StrCns, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_STRCNS) - JITHELPER1(CORINFO_HELP_STRCNS_CURRENT_MODULE, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_NEWFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8, JIT_New, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_NEW_MDARR, JIT_NewMDArr,CORINFO_HELP_SIG_8_VA) + JITHELPER(CORINFO_HELP_NEWARR_1_DIRECT, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_OBJ, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_VC, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_ALIGN8, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY) + + JITHELPER(CORINFO_HELP_STRCNS, JIT_StrCns, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_STRCNS_CURRENT_MODULE, NULL, CORINFO_HELP_SIG_REG_ONLY) // Object model - JITHELPER1(CORINFO_HELP_INITCLASS, JIT_InitClass, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_INITCLASS) - JITHELPER1(CORINFO_HELP_INITINSTCLASS, JIT_InitInstantiatedClass, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_INITINSTCLASS) - - JITHELPER1(CORINFO_HELP_ISINSTANCEOFINTERFACE,JIT_IsInstanceOfInterface, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_ISINSTANCEOFINTERFACE) - JITHELPER1(CORINFO_HELP_ISINSTANCEOFARRAY, JIT_IsInstanceOfArray,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_ISINSTANCEOFARRAY) - JITHELPER1(CORINFO_HELP_ISINSTANCEOFCLASS, JIT_IsInstanceOfClass,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_ISINSTANCEOFCLASS) - JITHELPER1(CORINFO_HELP_ISINSTANCEOFANY, JIT_IsInstanceOfAny,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - - JITHELPER1(CORINFO_HELP_CHKCASTINTERFACE, JIT_ChkCastInterface,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_CHKCASTINTERFACE) - JITHELPER1(CORINFO_HELP_CHKCASTARRAY, JIT_ChkCastArray, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_CHKCASTARRAY) - JITHELPER1(CORINFO_HELP_CHKCASTCLASS, JIT_ChkCastClass, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_CHKCASTCLASS) - JITHELPER1(CORINFO_HELP_CHKCASTANY, JIT_ChkCastAny, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - - JITHELPER1(CORINFO_HELP_CHKCASTCLASS_SPECIAL,JIT_ChkCastClassSpecial,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_CHKCASTCLASS_SPECIAL) - DYNAMICJITHELPER1(CORINFO_HELP_BOX, JIT_Box, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_BOX_NULLABLE, JIT_Box, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_UNBOX, JIT_Unbox, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_UNBOX_NULLABLE, JIT_Unbox_Nullable, CORINFO_HELP_SIG_4_STACK, MDIL_HELP_UNBOX_NULLABLE) - JITHELPER1(CORINFO_HELP_GETREFANY, JIT_GetRefAny, CORINFO_HELP_SIG_8_STACK, MDIL_HELP_GETREFANY) + JITHELPER(CORINFO_HELP_INITCLASS, JIT_InitClass, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_INITINSTCLASS, JIT_InitInstantiatedClass, CORINFO_HELP_SIG_REG_ONLY) + + JITHELPER(CORINFO_HELP_ISINSTANCEOFINTERFACE,JIT_IsInstanceOfInterface, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_ISINSTANCEOFARRAY, JIT_IsInstanceOfArray,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_ISINSTANCEOFCLASS, JIT_IsInstanceOfClass,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_ISINSTANCEOFANY, JIT_IsInstanceOfAny,CORINFO_HELP_SIG_REG_ONLY) + + JITHELPER(CORINFO_HELP_CHKCASTINTERFACE, JIT_ChkCastInterface,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_CHKCASTARRAY, JIT_ChkCastArray, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_CHKCASTCLASS, JIT_ChkCastClass, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_CHKCASTANY, JIT_ChkCastAny, CORINFO_HELP_SIG_REG_ONLY) + + JITHELPER(CORINFO_HELP_CHKCASTCLASS_SPECIAL,JIT_ChkCastClassSpecial,CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_BOX, JIT_Box, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_BOX_NULLABLE, JIT_Box, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_UNBOX, JIT_Unbox, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_UNBOX_NULLABLE, JIT_Unbox_Nullable, CORINFO_HELP_SIG_4_STACK) + JITHELPER(CORINFO_HELP_GETREFANY, JIT_GetRefAny, CORINFO_HELP_SIG_8_STACK) #if defined(_TARGET_ARM_) - DYNAMICJITHELPER1(CORINFO_HELP_ARRADDR_ST, JIT_Stelem_Ref, CORINFO_HELP_SIG_4_STACK, MDIL_HELP_ARRADDR_ST) + DYNAMICJITHELPER(CORINFO_HELP_ARRADDR_ST, JIT_Stelem_Ref, CORINFO_HELP_SIG_4_STACK) #else - JITHELPER1(CORINFO_HELP_ARRADDR_ST, JIT_Stelem_Ref, CORINFO_HELP_SIG_4_STACK, MDIL_HELP_ARRADDR_ST) + JITHELPER(CORINFO_HELP_ARRADDR_ST, JIT_Stelem_Ref, CORINFO_HELP_SIG_4_STACK) #endif // _TARGET_ARM_ - JITHELPER1(CORINFO_HELP_LDELEMA_REF, JIT_Ldelema_Ref, CORINFO_HELP_SIG_4_STACK, MDIL_HELP_LDELEMA_REF) + JITHELPER(CORINFO_HELP_LDELEMA_REF, JIT_Ldelema_Ref, CORINFO_HELP_SIG_4_STACK) // Exceptions - JITHELPER1(CORINFO_HELP_THROW, IL_Throw, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_RETHROW, IL_Rethrow, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_USER_BREAKPOINT, JIT_UserBreakpoint, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_USER_BREAKPOINT) - JITHELPER1(CORINFO_HELP_RNGCHKFAIL, JIT_RngChkFail, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_RNGCHKFAIL) - JITHELPER1(CORINFO_HELP_OVERFLOW, JIT_Overflow, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_OVERFLOW) - JITHELPER1(CORINFO_HELP_THROWDIVZERO, JIT_ThrowDivZero, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_THROW, IL_Throw, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_RETHROW, IL_Rethrow, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_USER_BREAKPOINT, JIT_UserBreakpoint, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_RNGCHKFAIL, JIT_RngChkFail, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_OVERFLOW, JIT_Overflow, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_THROWDIVZERO, JIT_ThrowDivZero, CORINFO_HELP_SIG_REG_ONLY) #if COR_JIT_EE_VERSION > 460 - JITHELPER1(CORINFO_HELP_THROWNULLREF, JIT_ThrowNullRef, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_THROWNULLREF, JIT_ThrowNullRef, CORINFO_HELP_SIG_REG_ONLY) #endif // COR_JIT_EE_VERSION - JITHELPER1(CORINFO_HELP_INTERNALTHROW, JIT_InternalThrow, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_INTERNALTHROW) - JITHELPER1(CORINFO_HELP_VERIFICATION, IL_VerificationError,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_VERIFICATION) - JITHELPER1(CORINFO_HELP_SEC_UNMGDCODE_EXCPT, JIT_SecurityUnmanagedCodeException, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_SEC_UNMGDCODE_EXCPT) - JITHELPER1(CORINFO_HELP_FAIL_FAST, JIT_FailFast, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_FAIL_FAST) - JITHELPER1(CORINFO_HELP_METHOD_ACCESS_EXCEPTION,JIT_ThrowMethodAccessException, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_METHOD_ACCESS_EXCEPTION) - JITHELPER1(CORINFO_HELP_FIELD_ACCESS_EXCEPTION,JIT_ThrowFieldAccessException, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_FIELD_ACCESS_EXCEPTION) - JITHELPER1(CORINFO_HELP_CLASS_ACCESS_EXCEPTION,JIT_ThrowClassAccessException, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_CLASS_ACCESS_EXCEPTION) + JITHELPER(CORINFO_HELP_INTERNALTHROW, JIT_InternalThrow, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_VERIFICATION, IL_VerificationError,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SEC_UNMGDCODE_EXCPT, JIT_SecurityUnmanagedCodeException, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_FAIL_FAST, JIT_FailFast, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_METHOD_ACCESS_EXCEPTION,JIT_ThrowMethodAccessException, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_FIELD_ACCESS_EXCEPTION,JIT_ThrowFieldAccessException, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_CLASS_ACCESS_EXCEPTION,JIT_ThrowClassAccessException, CORINFO_HELP_SIG_REG_ONLY) #ifdef WIN64EXCEPTIONS - JITHELPER1(CORINFO_HELP_ENDCATCH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_ENDCATCH) + JITHELPER(CORINFO_HELP_ENDCATCH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #else - JITHELPER1(CORINFO_HELP_ENDCATCH, JIT_EndCatch, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_ENDCATCH) + JITHELPER(CORINFO_HELP_ENDCATCH, JIT_EndCatch, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #endif #ifdef _TARGET_AMD64_ - DYNAMICJITHELPER1(CORINFO_HELP_MON_ENTER, JIT_MonEnterWorker, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MON_ENTER) - DYNAMICJITHELPER1(CORINFO_HELP_MON_EXIT, JIT_MonExitWorker, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MON_EXIT) - DYNAMICJITHELPER1(CORINFO_HELP_MON_ENTER_STATIC, JIT_MonEnterStatic,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MON_ENTER_STATIC) - DYNAMICJITHELPER1(CORINFO_HELP_MON_EXIT_STATIC, JIT_MonExitStatic,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MON_EXIT_STATIC) + DYNAMICJITHELPER(CORINFO_HELP_MON_ENTER, JIT_MonEnterWorker, CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_MON_EXIT, JIT_MonExitWorker, CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_MON_ENTER_STATIC, JIT_MonEnterStatic,CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_MON_EXIT_STATIC, JIT_MonExitStatic,CORINFO_HELP_SIG_REG_ONLY) #else - JITHELPER1(CORINFO_HELP_MON_ENTER, JIT_MonEnterWorker, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MON_ENTER) - JITHELPER1(CORINFO_HELP_MON_EXIT, JIT_MonExitWorker, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MON_EXIT) - JITHELPER1(CORINFO_HELP_MON_ENTER_STATIC, JIT_MonEnterStatic,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MON_ENTER_STATIC) - JITHELPER1(CORINFO_HELP_MON_EXIT_STATIC, JIT_MonExitStatic,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MON_EXIT_STATIC) + JITHELPER(CORINFO_HELP_MON_ENTER, JIT_MonEnterWorker, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_MON_EXIT, JIT_MonExitWorker, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_MON_ENTER_STATIC, JIT_MonEnterStatic,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_MON_EXIT_STATIC, JIT_MonExitStatic,CORINFO_HELP_SIG_REG_ONLY) #endif - JITHELPER1(CORINFO_HELP_GETCLASSFROMMETHODPARAM, JIT_GetClassFromMethodParam, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETCLASSFROMMETHODPARAM) - JITHELPER1(CORINFO_HELP_GETSYNCFROMCLASSHANDLE, JIT_GetSyncFromClassHandle, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETSYNCFROMCLASSHANDLE) + JITHELPER(CORINFO_HELP_GETCLASSFROMMETHODPARAM, JIT_GetClassFromMethodParam, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETSYNCFROMCLASSHANDLE, JIT_GetSyncFromClassHandle, CORINFO_HELP_SIG_REG_ONLY) // Security callout support - JITHELPER1(CORINFO_HELP_SECURITY_PROLOG, JIT_Security_Prolog,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_SECURITY_PROLOG) - JITHELPER1(CORINFO_HELP_SECURITY_PROLOG_FRAMED, JIT_Security_Prolog_Framed,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_SECURITY_PROLOG_FRAMED) + JITHELPER(CORINFO_HELP_SECURITY_PROLOG, JIT_Security_Prolog,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SECURITY_PROLOG_FRAMED, JIT_Security_Prolog_Framed,CORINFO_HELP_SIG_REG_ONLY) - JITHELPER1(CORINFO_HELP_METHOD_ACCESS_CHECK, JIT_MethodAccessCheck,CORINFO_HELP_SIG_8_STACK, MDIL_HELP_METHOD_ACCESS_CHECK) - JITHELPER1(CORINFO_HELP_FIELD_ACCESS_CHECK, JIT_FieldAccessCheck,CORINFO_HELP_SIG_4_STACK, MDIL_HELP_FIELD_ACCESS_CHECK) - JITHELPER1(CORINFO_HELP_CLASS_ACCESS_CHECK, JIT_ClassAccessCheck,CORINFO_HELP_SIG_4_STACK, MDIL_HELP_CLASS_ACCESS_CHECK) + JITHELPER(CORINFO_HELP_METHOD_ACCESS_CHECK, JIT_MethodAccessCheck,CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_FIELD_ACCESS_CHECK, JIT_FieldAccessCheck,CORINFO_HELP_SIG_4_STACK) + JITHELPER(CORINFO_HELP_CLASS_ACCESS_CHECK, JIT_ClassAccessCheck,CORINFO_HELP_SIG_4_STACK) - JITHELPER1(CORINFO_HELP_DELEGATE_SECURITY_CHECK, JIT_DelegateSecurityCheck,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_DELEGATE_SECURITY_CHECK) + JITHELPER(CORINFO_HELP_DELEGATE_SECURITY_CHECK, JIT_DelegateSecurityCheck,CORINFO_HELP_SIG_REG_ONLY) // Verification runtime callout support - JITHELPER1(CORINFO_HELP_VERIFICATION_RUNTIME_CHECK, JIT_VerificationRuntimeCheck,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_VERIFICATION_RUNTIME_CHECK) + JITHELPER(CORINFO_HELP_VERIFICATION_RUNTIME_CHECK, JIT_VerificationRuntimeCheck,CORINFO_HELP_SIG_REG_ONLY) // GC support - DYNAMICJITHELPER1(CORINFO_HELP_STOP_FOR_GC, JIT_RareDisableHelper,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_STOP_FOR_GC) + DYNAMICJITHELPER(CORINFO_HELP_STOP_FOR_GC, JIT_RareDisableHelper,CORINFO_HELP_SIG_REG_ONLY) #ifdef ENABLE_FAST_GCPOLL_HELPER - DYNAMICJITHELPER1(CORINFO_HELP_POLL_GC, JIT_PollGC, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_POLL_GC) + DYNAMICJITHELPER(CORINFO_HELP_POLL_GC, JIT_PollGC, CORINFO_HELP_SIG_REG_ONLY) #else - JITHELPER1(CORINFO_HELP_POLL_GC, JIT_PollGC, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_POLL_GC) + JITHELPER(CORINFO_HELP_POLL_GC, JIT_PollGC, CORINFO_HELP_SIG_REG_ONLY) #endif - JITHELPER1(CORINFO_HELP_STRESS_GC, JIT_StressGC, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_STRESS_GC) + JITHELPER(CORINFO_HELP_STRESS_GC, JIT_StressGC, CORINFO_HELP_SIG_REG_ONLY) - JITHELPER1(CORINFO_HELP_CHECK_OBJ, JIT_CheckObj, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_CHECK_OBJ) + JITHELPER(CORINFO_HELP_CHECK_OBJ, JIT_CheckObj, CORINFO_HELP_SIG_REG_ONLY) // GC Write barrier support - DYNAMICJITHELPER1(CORINFO_HELP_ASSIGN_REF, JIT_WriteBarrier, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_ASSIGN_REF) - DYNAMICJITHELPER1(CORINFO_HELP_CHECKED_ASSIGN_REF, JIT_CheckedWriteBarrier,CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_CHECKED_ASSIGN_REF) - JITHELPER1(CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, JIT_WriteBarrierEnsureNonHeapTarget,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_ASSIGN_REF_ENSURE_NONHEAP) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF, JIT_WriteBarrier, CORINFO_HELP_SIG_NO_ALIGN_STUB) + DYNAMICJITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF, JIT_CheckedWriteBarrier,CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, JIT_WriteBarrierEnsureNonHeapTarget,CORINFO_HELP_SIG_REG_ONLY) - DYNAMICJITHELPER1(CORINFO_HELP_ASSIGN_BYREF, JIT_ByRefWriteBarrier,CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_ASSIGN_BYREF) + DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_BYREF, JIT_ByRefWriteBarrier,CORINFO_HELP_SIG_NO_ALIGN_STUB) - JITHELPER1(CORINFO_HELP_ASSIGN_STRUCT, JIT_StructWriteBarrier,CORINFO_HELP_SIG_4_STACK, MDIL_HELP_ASSIGN_STRUCT) + JITHELPER(CORINFO_HELP_ASSIGN_STRUCT, JIT_StructWriteBarrier,CORINFO_HELP_SIG_4_STACK) // Accessing fields - JITHELPER1(CORINFO_HELP_GETFIELD8, JIT_GetField8,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETFIELD8) - JITHELPER1(CORINFO_HELP_SETFIELD8, JIT_SetField8,CORINFO_HELP_SIG_4_STACK, MDIL_HELP_SETFIELD8) - JITHELPER1(CORINFO_HELP_GETFIELD16, JIT_GetField16,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETFIELD16) - JITHELPER1(CORINFO_HELP_SETFIELD16, JIT_SetField16,CORINFO_HELP_SIG_4_STACK, MDIL_HELP_SETFIELD16) - JITHELPER1(CORINFO_HELP_GETFIELD32, JIT_GetField32,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETFIELD32) - JITHELPER1(CORINFO_HELP_SETFIELD32, JIT_SetField32,CORINFO_HELP_SIG_4_STACK, MDIL_HELP_SETFIELD32) - JITHELPER1(CORINFO_HELP_GETFIELD64, JIT_GetField64,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETFIELD64) - JITHELPER1(CORINFO_HELP_SETFIELD64, JIT_SetField64,CORINFO_HELP_SIG_8_STACK, MDIL_HELP_SETFIELD64) - JITHELPER1(CORINFO_HELP_GETFIELDOBJ, JIT_GetFieldObj,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETFIELDOBJ) - JITHELPER1(CORINFO_HELP_SETFIELDOBJ, JIT_SetFieldObj,CORINFO_HELP_SIG_4_STACK, MDIL_HELP_SETFIELDOBJ) - JITHELPER1(CORINFO_HELP_GETFIELDSTRUCT, JIT_GetFieldStruct,CORINFO_HELP_SIG_8_STACK, MDIL_HELP_GETFIELDSTRUCT) - JITHELPER1(CORINFO_HELP_SETFIELDSTRUCT, JIT_SetFieldStruct,CORINFO_HELP_SIG_8_STACK, MDIL_HELP_SETFIELDSTRUCT) - JITHELPER1(CORINFO_HELP_GETFIELDFLOAT, JIT_GetFieldFloat,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETFIELDFLOAT) - JITHELPER1(CORINFO_HELP_SETFIELDFLOAT, JIT_SetFieldFloat,CORINFO_HELP_SIG_4_STACK, MDIL_HELP_SETFIELDFLOAT) - JITHELPER1(CORINFO_HELP_GETFIELDDOUBLE, JIT_GetFieldDouble,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETFIELDDOUBLE) - JITHELPER1(CORINFO_HELP_SETFIELDDOUBLE, JIT_SetFieldDouble,CORINFO_HELP_SIG_8_STACK, MDIL_HELP_SETFIELDDOUBLE) - - JITHELPER1(CORINFO_HELP_GETFIELDADDR, JIT_GetFieldAddr,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETFIELDADDR) + JITHELPER(CORINFO_HELP_GETFIELD8, JIT_GetField8,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SETFIELD8, JIT_SetField8,CORINFO_HELP_SIG_4_STACK) + JITHELPER(CORINFO_HELP_GETFIELD16, JIT_GetField16,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SETFIELD16, JIT_SetField16,CORINFO_HELP_SIG_4_STACK) + JITHELPER(CORINFO_HELP_GETFIELD32, JIT_GetField32,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SETFIELD32, JIT_SetField32,CORINFO_HELP_SIG_4_STACK) + JITHELPER(CORINFO_HELP_GETFIELD64, JIT_GetField64,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SETFIELD64, JIT_SetField64,CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_GETFIELDOBJ, JIT_GetFieldObj,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SETFIELDOBJ, JIT_SetFieldObj,CORINFO_HELP_SIG_4_STACK) + JITHELPER(CORINFO_HELP_GETFIELDSTRUCT, JIT_GetFieldStruct,CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_SETFIELDSTRUCT, JIT_SetFieldStruct,CORINFO_HELP_SIG_8_STACK) + JITHELPER(CORINFO_HELP_GETFIELDFLOAT, JIT_GetFieldFloat,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SETFIELDFLOAT, JIT_SetFieldFloat,CORINFO_HELP_SIG_4_STACK) + JITHELPER(CORINFO_HELP_GETFIELDDOUBLE, JIT_GetFieldDouble,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_SETFIELDDOUBLE, JIT_SetFieldDouble,CORINFO_HELP_SIG_8_STACK) + + JITHELPER(CORINFO_HELP_GETFIELDADDR, JIT_GetFieldAddr,CORINFO_HELP_SIG_REG_ONLY) #ifdef FEATURE_REMOTING - JITHELPER1(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, JIT_GetStaticFieldAddr_Context,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETSTATICFIELDADDR_CONTEXT) + JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, JIT_GetStaticFieldAddr_Context,CORINFO_HELP_SIG_REG_ONLY) #else - JITHELPER1(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_GETSTATICFIELDADDR_CONTEXT) + JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #endif #if COR_JIT_EE_VERSION > 460 #ifdef FEATURE_MIXEDMODE // TLS - JITHELPER1(CORINFO_HELP_GETSTATICFIELDADDR_TLS, JIT_GetStaticFieldAddr_Tls,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETSTATICFIELDADDR_TLS) + JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, JIT_GetStaticFieldAddr_Tls,CORINFO_HELP_SIG_REG_ONLY) #else // FEATURE_MIXEDMODE - JITHELPER1(CORINFO_HELP_GETSTATICFIELDADDR_TLS, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_GETSTATICFIELDADDR_TLS) + JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #endif // FEATURE_MIXEDMODE #else // COR_JIT_EE_VERSION - JITHELPER1(CORINFO_HELP_GETSTATICFIELDADDR_TLS, JIT_GetStaticFieldAddr_Tls,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETSTATICFIELDADDR_TLS) + JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, JIT_GetStaticFieldAddr_Tls,CORINFO_HELP_SIG_REG_ONLY) #endif // COR_JIT_EE_VERSION - JITHELPER1(CORINFO_HELP_GETGENERICS_GCSTATIC_BASE, JIT_GetGenericsGCStaticBase,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE, JIT_GetGenericsNonGCStaticBase,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_GETGENERICS_GCSTATIC_BASE, JIT_GetGenericsGCStaticBase,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE, JIT_GetGenericsNonGCStaticBase,CORINFO_HELP_SIG_REG_ONLY) #ifdef _TARGET_X86_ - DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, NULL, CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, NULL, CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, NULL, CORINFO_HELP_SIG_REG_ONLY) + DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,NULL, CORINFO_HELP_SIG_REG_ONLY) #else - DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, JIT_GetSharedNonGCStaticBase, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, JIT_GetSharedGCStaticBaseNoCtor, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_UNDEF) - DYNAMICJITHELPER1(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,JIT_GetSharedNonGCStaticBaseNoCtor, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_UNDEF) + DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, JIT_GetSharedNonGCStaticBase, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, JIT_GetSharedGCStaticBaseNoCtor, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,JIT_GetSharedNonGCStaticBaseNoCtor, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #endif - JITHELPER1(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedGCStaticBaseDynamicClass,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedNonGCStaticBaseDynamicClass,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS, JIT_ClassInitDynamicClass,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedGCStaticBaseDynamicClass,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedNonGCStaticBaseDynamicClass,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS, JIT_ClassInitDynamicClass,CORINFO_HELP_SIG_REG_ONLY) // Thread statics - JITHELPER1(CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE, JIT_GetGenericsGCThreadStaticBase,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETGENERICS_NONGCTHREADSTATIC_BASE, JIT_GetGenericsNonGCThreadStaticBase,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE, JIT_GetSharedGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE, JIT_GetSharedNonGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR, JIT_GetSharedGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR, JIT_GetSharedNonGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedNonGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE, JIT_GetGenericsGCThreadStaticBase,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETGENERICS_NONGCTHREADSTATIC_BASE, JIT_GetGenericsNonGCThreadStaticBase,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE, JIT_GetSharedGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE, JIT_GetSharedNonGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR, JIT_GetSharedGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR, JIT_GetSharedNonGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedNonGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY) // Debugger - JITHELPER1(CORINFO_HELP_DBG_IS_JUST_MY_CODE, JIT_DbgIsJustMyCode,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_DBG_IS_JUST_MY_CODE) + JITHELPER(CORINFO_HELP_DBG_IS_JUST_MY_CODE, JIT_DbgIsJustMyCode,CORINFO_HELP_SIG_REG_ONLY) /* Profiling enter/leave probe addresses */ - DYNAMICJITHELPER1(CORINFO_HELP_PROF_FCN_ENTER, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK, MDIL_HELP_PROF_FCN_ENTER) - DYNAMICJITHELPER1(CORINFO_HELP_PROF_FCN_LEAVE, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK, MDIL_HELP_PROF_FCN_LEAVE) - DYNAMICJITHELPER1(CORINFO_HELP_PROF_FCN_TAILCALL, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK, MDIL_HELP_PROF_FCN_TAILCALL) + DYNAMICJITHELPER(CORINFO_HELP_PROF_FCN_ENTER, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK) + DYNAMICJITHELPER(CORINFO_HELP_PROF_FCN_LEAVE, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK) + DYNAMICJITHELPER(CORINFO_HELP_PROF_FCN_TAILCALL, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK) // Miscellaneous - JITHELPER1(CORINFO_HELP_BBT_FCN_ENTER, JIT_LogMethodEnter,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_BBT_FCN_ENTER) + JITHELPER(CORINFO_HELP_BBT_FCN_ENTER, JIT_LogMethodEnter,CORINFO_HELP_SIG_REG_ONLY) - JITHELPER1(CORINFO_HELP_PINVOKE_CALLI, GenericPInvokeCalliHelper, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_PINVOKE_CALLI) + JITHELPER(CORINFO_HELP_PINVOKE_CALLI, GenericPInvokeCalliHelper, CORINFO_HELP_SIG_NO_ALIGN_STUB) - JITHELPER1(CORINFO_HELP_TAILCALL, JIT_TailCall, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_TAILCALL) + JITHELPER(CORINFO_HELP_TAILCALL, JIT_TailCall, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) - JITHELPER1(CORINFO_HELP_GETCURRENTMANAGEDTHREADID, JIT_GetCurrentManagedThreadId, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_GETCURRENTMANAGEDTHREADID) + JITHELPER(CORINFO_HELP_GETCURRENTMANAGEDTHREADID, JIT_GetCurrentManagedThreadId, CORINFO_HELP_SIG_REG_ONLY) #ifdef _WIN64 // On Windows X64, the last argument is ignored. JITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, JIT_InitPInvokeFrame, CORINFO_HELP_SIG_REG_ONLY) #else - DYNAMICJITHELPER1(CORINFO_HELP_INIT_PINVOKE_FRAME, NULL, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_INIT_PINVOKE_FRAME) + DYNAMICJITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, NULL, CORINFO_HELP_SIG_REG_ONLY) #endif #ifdef _TARGET_X86_ - JITHELPER1(CORINFO_HELP_MEMSET, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_MEMSET) - JITHELPER1(CORINFO_HELP_MEMCPY, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_MEMCPY) + JITHELPER(CORINFO_HELP_MEMSET, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + JITHELPER(CORINFO_HELP_MEMCPY, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) #else - JITHELPER1(CORINFO_HELP_MEMSET, JIT_MemSet, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MEMSET) - JITHELPER1(CORINFO_HELP_MEMCPY, JIT_MemCpy, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_MEMCPY) + JITHELPER(CORINFO_HELP_MEMSET, JIT_MemSet, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_MEMCPY, JIT_MemCpy, CORINFO_HELP_SIG_REG_ONLY) #endif // Generics - JITHELPER1(CORINFO_HELP_RUNTIMEHANDLE_METHOD, JIT_GenericHandleMethod, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_RUNTIMEHANDLE_METHOD) - JITHELPER1(CORINFO_HELP_RUNTIMEHANDLE_METHOD_LOG,JIT_GenericHandleMethodLogging, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_RUNTIMEHANDLE_METHOD_LOG) - JITHELPER1(CORINFO_HELP_RUNTIMEHANDLE_CLASS, JIT_GenericHandleClass, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_RUNTIMEHANDLE_CLASS) - JITHELPER1(CORINFO_HELP_RUNTIMEHANDLE_CLASS_LOG, JIT_GenericHandleClassLogging, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_RUNTIMEHANDLE_CLASS_LOG) -#if defined(FEATURE_CORECLR) && defined(_TARGET_ARM_) // MDIL - // These helpers are required for MDIL backward compatibility only. They are not used by current JITed code. - JITHELPER1(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_OBSOLETE, JIT_GetRuntimeTypeHandle, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE) - JITHELPER1(CORINFO_HELP_METHODDESC_TO_RUNTIMEMETHODHANDLE_OBSOLETE, JIT_GetRuntimeMethodHandle, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_METHODDESC_TO_RUNTIMEMETHODHANDLE) - JITHELPER1(CORINFO_HELP_FIELDDESC_TO_RUNTIMEFIELDHANDLE_OBSOLETE, JIT_GetRuntimeFieldHandle, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_FIELDDESC_TO_RUNTIMEFIELDHANDLE) -#else - JITHELPER1(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_METHODDESC_TO_RUNTIMEMETHODHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_FIELDDESC_TO_RUNTIMEFIELDHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB, MDIL_HELP_UNDEF) -#endif // MDIL - JITHELPER1(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, JIT_GetRuntimeType, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_TYPEHANDLE_TO_RUNTIMETYPE) - // This helper is not needed for MDIL - MDIL does not support IL instructions that this helper is needed for - JITHELPER1(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL, JIT_GetRuntimeType_MaybeNull, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, JIT_GetRuntimeMethodStub,CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD) - JITHELPER1(CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, JIT_GetRuntimeFieldStub, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD) - - JITHELPER1(CORINFO_HELP_VIRTUAL_FUNC_PTR, JIT_VirtualFunctionPointer, CORINFO_HELP_SIG_4_STACK, MDIL_HELP_VIRTUAL_FUNC_PTR) - //JITHELPER1(CORINFO_HELP_VIRTUAL_FUNC_PTR_LOG,JIT_VirtualFunctionPointerLogging) - - JITHELPER1(CORINFO_HELP_READYTORUN_NEW, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_READYTORUN_NEWARR_1, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_READYTORUN_ISINSTANCEOF, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_READYTORUN_CHKCAST, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_READYTORUN_STATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD, JIT_GenericHandleMethod, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD_LOG,JIT_GenericHandleMethodLogging, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_CLASS, JIT_GenericHandleClass, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_CLASS_LOG, JIT_GenericHandleClassLogging, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + JITHELPER(CORINFO_HELP_METHODDESC_TO_RUNTIMEMETHODHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + JITHELPER(CORINFO_HELP_FIELDDESC_TO_RUNTIMEFIELDHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB) + JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, JIT_GetRuntimeType, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL, JIT_GetRuntimeType_MaybeNull, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, JIT_GetRuntimeMethodStub,CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, JIT_GetRuntimeFieldStub, CORINFO_HELP_SIG_REG_ONLY) + + JITHELPER(CORINFO_HELP_VIRTUAL_FUNC_PTR, JIT_VirtualFunctionPointer, CORINFO_HELP_SIG_4_STACK) + //JITHELPER(CORINFO_HELP_VIRTUAL_FUNC_PTR_LOG,JIT_VirtualFunctionPointerLogging) + + JITHELPER(CORINFO_HELP_READYTORUN_NEW, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_READYTORUN_NEWARR_1, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_READYTORUN_ISINSTANCEOF, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_READYTORUN_CHKCAST, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_READYTORUN_STATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB) #if COR_JIT_EE_VERSION > 460 - JITHELPER1(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB) #endif // COR_JIT_EE_VERSION - JITHELPER1(CORINFO_HELP_EE_PRESTUB, ThePreStub, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_EE_PRESTUB) + JITHELPER(CORINFO_HELP_EE_PRESTUB, ThePreStub, CORINFO_HELP_SIG_NO_ALIGN_STUB) #if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM_) - JITHELPER1(CORINFO_HELP_EE_PRECODE_FIXUP, PrecodeFixupThunk, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_EE_PRECODE_FIXUP) + JITHELPER(CORINFO_HELP_EE_PRECODE_FIXUP, PrecodeFixupThunk, CORINFO_HELP_SIG_NO_ALIGN_STUB) #else - JITHELPER1(CORINFO_HELP_EE_PRECODE_FIXUP, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_EE_PRECODE_FIXUP) + JITHELPER(CORINFO_HELP_EE_PRECODE_FIXUP, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB) #endif - JITHELPER1(CORINFO_HELP_EE_PINVOKE_FIXUP, NDirectImportThunk, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_EE_PINVOKE_FIXUP) + JITHELPER(CORINFO_HELP_EE_PINVOKE_FIXUP, NDirectImportThunk, CORINFO_HELP_SIG_NO_ALIGN_STUB) - JITHELPER1(CORINFO_HELP_EE_VSD_FIXUP, StubDispatchFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_EE_VSD_FIXUP) - JITHELPER1(CORINFO_HELP_EE_EXTERNAL_FIXUP, ExternalMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_EE_EXTERNAL_FIXUP) - JITHELPER1(CORINFO_HELP_EE_VTABLE_FIXUP, VirtualMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_EE_VTABLE_FIXUP) + JITHELPER(CORINFO_HELP_EE_VSD_FIXUP, StubDispatchFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_EE_EXTERNAL_FIXUP, ExternalMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_EE_VTABLE_FIXUP, VirtualMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB) #if (defined(_TARGET_X86_) || defined(_TARGET_ARM_)) && defined(FEATURE_REMOTING) - JITHELPER1(CORINFO_HELP_EE_REMOTING_THUNK, PrecodeRemotingThunk, CORINFO_HELP_SIG_UNDEF, MDIL_HELP_EE_REMOTING_THUNK) + JITHELPER(CORINFO_HELP_EE_REMOTING_THUNK, PrecodeRemotingThunk, CORINFO_HELP_SIG_UNDEF) #else - JITHELPER1(CORINFO_HELP_EE_REMOTING_THUNK, NULL, CORINFO_HELP_SIG_UNDEF, MDIL_HELP_EE_REMOTING_THUNK) + JITHELPER(CORINFO_HELP_EE_REMOTING_THUNK, NULL, CORINFO_HELP_SIG_UNDEF) #endif // We do not need this to be saved in ngen images on Mac64 since the exception dispatch // is not done via the OS and thus, there wont be any need to know this information // by anyone. #if !defined(_TARGET_X86_) - JITHELPER1(CORINFO_HELP_EE_PERSONALITY_ROUTINE, ProcessCLRException, CORINFO_HELP_SIG_UNDEF, MDIL_HELP_EE_PERSONALITY_ROUTINE) - JITHELPER1(CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET, ProcessCLRException,CORINFO_HELP_SIG_UNDEF, MDIL_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET) + JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE, ProcessCLRException, CORINFO_HELP_SIG_UNDEF) + JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET, ProcessCLRException,CORINFO_HELP_SIG_UNDEF) #else - JITHELPER1(CORINFO_HELP_EE_PERSONALITY_ROUTINE, NULL, CORINFO_HELP_SIG_UNDEF, MDIL_HELP_EE_PERSONALITY_ROUTINE) - JITHELPER1(CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET, NULL, CORINFO_HELP_SIG_UNDEF, MDIL_HELP_UNDEF ) + JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE, NULL, CORINFO_HELP_SIG_UNDEF) + JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET, NULL, CORINFO_HELP_SIG_UNDEF) #endif #ifdef _TARGET_X86_ - JITHELPER1(CORINFO_HELP_ASSIGN_REF_EAX, JIT_WriteBarrierEAX, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_ASSIGN_REF_EAX) - JITHELPER1(CORINFO_HELP_ASSIGN_REF_EBX, JIT_WriteBarrierEBX, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_ASSIGN_REF_EBX) - JITHELPER1(CORINFO_HELP_ASSIGN_REF_ECX, JIT_WriteBarrierECX, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_ASSIGN_REF_ECX) - JITHELPER1(CORINFO_HELP_ASSIGN_REF_ESI, JIT_WriteBarrierESI, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_ASSIGN_REF_ESI) - JITHELPER1(CORINFO_HELP_ASSIGN_REF_EDI, JIT_WriteBarrierEDI, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_ASSIGN_REF_EDI) - JITHELPER1(CORINFO_HELP_ASSIGN_REF_EBP, JIT_WriteBarrierEBP, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_ASSIGN_REF_EBP) - - JITHELPER1(CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, JIT_CheckedWriteBarrierEAX, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_CHECKED_ASSIGN_REF_EAX) - JITHELPER1(CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, JIT_CheckedWriteBarrierEBX, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_CHECKED_ASSIGN_REF_EBX) - JITHELPER1(CORINFO_HELP_CHECKED_ASSIGN_REF_ECX, JIT_CheckedWriteBarrierECX, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_CHECKED_ASSIGN_REF_ECX) - JITHELPER1(CORINFO_HELP_CHECKED_ASSIGN_REF_ESI, JIT_CheckedWriteBarrierESI, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_CHECKED_ASSIGN_REF_ESI) - JITHELPER1(CORINFO_HELP_CHECKED_ASSIGN_REF_EDI, JIT_CheckedWriteBarrierEDI, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_CHECKED_ASSIGN_REF_EDI) - JITHELPER1(CORINFO_HELP_CHECKED_ASSIGN_REF_EBP, JIT_CheckedWriteBarrierEBP, CORINFO_HELP_SIG_NO_ALIGN_STUB, MDIL_HELP_CHECKED_ASSIGN_REF_EBP) + JITHELPER(CORINFO_HELP_ASSIGN_REF_EAX, JIT_WriteBarrierEAX, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_ASSIGN_REF_EBX, JIT_WriteBarrierEBX, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_ASSIGN_REF_ECX, JIT_WriteBarrierECX, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_ASSIGN_REF_ESI, JIT_WriteBarrierESI, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_ASSIGN_REF_EDI, JIT_WriteBarrierEDI, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_ASSIGN_REF_EBP, JIT_WriteBarrierEBP, CORINFO_HELP_SIG_NO_ALIGN_STUB) + + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, JIT_CheckedWriteBarrierEAX, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, JIT_CheckedWriteBarrierEBX, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ECX, JIT_CheckedWriteBarrierECX, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ESI, JIT_CheckedWriteBarrierESI, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EDI, JIT_CheckedWriteBarrierEDI, CORINFO_HELP_SIG_NO_ALIGN_STUB) + JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBP, JIT_CheckedWriteBarrierEBP, CORINFO_HELP_SIG_NO_ALIGN_STUB) #endif -#if defined(MDIL) && defined(_TARGET_ARM_) - JITHELPER1(CORINFO_HELP_ALLOCA, NULL, CORINFO_HELP_SIG_UNDEF, MDIL_HELP_ALLOCA) -#endif //MDIL - -// PuCLR Integration note: -// JbTodo: This helper definition is missing it's MDIL helper counterpart. - JITHELPER1(CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, JIT_LoopCloneChoiceAddr, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) -// JbTodo: This helper definition is missing it's MDIL helper counterpart. - JITHELPER1(CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, JIT_DebugLogLoopCloning, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, JIT_LoopCloneChoiceAddr, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, JIT_DebugLogLoopCloning, CORINFO_HELP_SIG_REG_ONLY) #if COR_JIT_EE_VERSION > 460 - JITHELPER1(CORINFO_HELP_THROW_ARGUMENTEXCEPTION, JIT_ThrowArgumentException, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, JIT_ThrowArgumentOutOfRangeException, CORINFO_HELP_SIG_REG_ONLY, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_THROW_ARGUMENTEXCEPTION, JIT_ThrowArgumentException, CORINFO_HELP_SIG_REG_ONLY) + JITHELPER(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, JIT_ThrowArgumentOutOfRangeException, CORINFO_HELP_SIG_REG_ONLY) - JITHELPER1(CORINFO_HELP_JIT_PINVOKE_BEGIN, NULL, CORINFO_HELP_SIG_UNDEF, MDIL_HELP_UNDEF) - JITHELPER1(CORINFO_HELP_JIT_PINVOKE_END, NULL, CORINFO_HELP_SIG_UNDEF, MDIL_HELP_UNDEF) + JITHELPER(CORINFO_HELP_JIT_PINVOKE_BEGIN, NULL, CORINFO_HELP_SIG_UNDEF) + JITHELPER(CORINFO_HELP_JIT_PINVOKE_END, NULL, CORINFO_HELP_SIG_UNDEF) #endif // COR_JIT_EE_VERSION -#undef JITHELPER1 -#undef DYNAMICJITHELPER1 +#undef JITHELPER +#undef DYNAMICJITHELPER #undef JITHELPER #undef DYNAMICJITHELPER diff --git a/src/inc/metadata.h b/src/inc/metadata.h index b92a021226..8fcf493a23 100644 --- a/src/inc/metadata.h +++ b/src/inc/metadata.h @@ -14,10 +14,8 @@ #ifndef _METADATA_H_ #define _METADATA_H_ -#ifndef BINDER #include "../md/inc/metamodelro.h" #include "../md/inc/liteweightstgdb.h" -#endif class UTSemReadWrite; diff --git a/src/inc/switches.h b/src/inc/switches.h index 73d66c8e8f..1e5dc6bbee 100644 --- a/src/inc/switches.h +++ b/src/inc/switches.h @@ -224,7 +224,7 @@ // are treated as potential pinned interior pointers. When enabled, the runtime flag COMPLUS_GCCONSERVATIVE // determines dynamically whether GC is conservative. Note that appdomain unload, LCG and unloadable assemblies // do not work reliably with conservative GC. -#if defined(FEATURE_CORECLR) && !defined(BINDER) +#ifdef FEATURE_CORECLR #define FEATURE_CONSERVATIVE_GC 1 #endif diff --git a/src/inc/unsafe.h b/src/inc/unsafe.h index 939f9f1578..ba4a166fb1 100644 --- a/src/inc/unsafe.h +++ b/src/inc/unsafe.h @@ -11,9 +11,7 @@ // should we just check proper inclusion? #include -#ifndef CLR_STANDALONE_BINDER #include "staticcontract.h" -#endif inline VOID UnsafeEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection) { diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h index b9e902f995..b9985a8b25 100644 --- a/src/inc/utilcode.h +++ b/src/inc/utilcode.h @@ -4711,7 +4711,7 @@ public: #endif // !FEATURE_PAL }; -#if !defined(DACCESS_COMPILE) && !defined(CLR_STANDALONE_BINDER) +#if !defined(DACCESS_COMPILE) // check if current thread is a GC thread (concurrent or server) inline BOOL IsGCSpecialThread () @@ -4895,7 +4895,7 @@ inline BOOL IsStackWalkerThread() STATIC_CONTRACT_MODE_ANY; STATIC_CONTRACT_CANNOT_TAKE_LOCK; -#if defined(DACCESS_COMPILE) || defined(CLR_STANDALONE_BINDER) +#if defined(DACCESS_COMPILE) return FALSE; #else return ClrFlsGetValue (TlsIdx_StackWalkerWalkingThread) != NULL; @@ -4910,13 +4910,13 @@ inline BOOL IsGCThread () STATIC_CONTRACT_SUPPORTS_DAC; STATIC_CONTRACT_SO_TOLERANT; -#if !defined(DACCESS_COMPILE) && !defined(CLR_STANDALONE_BINDER) +#if !defined(DACCESS_COMPILE) return IsGCSpecialThread () || IsSuspendEEThread (); #else return FALSE; #endif } -#ifndef CLR_STANDALONE_BINDER + class ClrFlsThreadTypeSwitch { public: @@ -5007,7 +5007,6 @@ private: PVOID m_PreviousValue; PredefinedTlsSlots m_slot; }; -#endif // !CLR_STANDALONE_BINDER //********************************************************************************* diff --git a/src/inc/volatile.h b/src/inc/volatile.h index 496bff64a3..8de299590e 100644 --- a/src/inc/volatile.h +++ b/src/inc/volatile.h @@ -58,9 +58,7 @@ #ifndef _VOLATILE_H_ #define _VOLATILE_H_ -#ifndef CLR_STANDALONE_BINDER #include "staticcontract.h" -#endif // // This code is extremely compiler- and CPU-specific, and will need to be altered to diff --git a/src/inc/zapper.h b/src/inc/zapper.h index 9e47ed3d23..9534c49eb3 100644 --- a/src/inc/zapper.h +++ b/src/inc/zapper.h @@ -131,12 +131,8 @@ class Zapper bool m_fForceFullTrust; -#ifdef MDIL - bool m_fEmbedMDIL; -#endif + SString m_outputFilename; - SString m_outputFilename; // output target when coregen is emitting a combined IL/MDIL file. - // (an empty string here (temporarily) indicates the use of the depecrated /createmdil sitch.) public: struct assemblyDependencies @@ -354,12 +350,8 @@ class Zapper // The arguments control which native image of mscorlib to use. // This matters for hardbinding. -#ifdef BINDER - void InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument, ICorCompileInfo *compileInfo, ICorDynamicInfo *dynamicInfo); -#else void InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument); void LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT ICorJitCompiler** ppICorJitCompiler); -#endif #ifdef FEATURE_FUSION HRESULT TryEnumerateFusionCache(LPCWSTR assemblyName, bool fPrint, bool fDelete); @@ -460,11 +452,6 @@ class Zapper void SetAppCompatWP8(bool val); #endif -#ifdef MDIL - void SetEmbedMDIL(bool val); - void SetCompilerFlag(DWORD val); -#endif - void SetForceFullTrust(bool val); #endif // FEATURE_CORECLR || CROSSGEN_COMPILE diff --git a/src/jit/DIRS.proj b/src/jit/DIRS.proj index 3e4c86b5a4..6d1c06d3f0 100644 --- a/src/jit/DIRS.proj +++ b/src/jit/DIRS.proj @@ -31,7 +31,7 @@ diff --git a/src/md/runtime/mdinternalro.cpp b/src/md/runtime/mdinternalro.cpp index baab06e95e..d16d2b02eb 100644 --- a/src/md/runtime/mdinternalro.cpp +++ b/src/md/runtime/mdinternalro.cpp @@ -3646,23 +3646,6 @@ HRESULT MDInternalRO::GetTableInfoWithIndex( // return size void **pTable, // [OUT] pointer to table at index void **pTableSize) // [OUT] size of table at index { -#ifdef MDIL - HRESULT hr = NOERROR; - - if (!pTable || !pTableSize) - IfFailGo(E_INVALIDARG); - - if (index == TBL_COUNT+MDPoolUSBlobs) - { - MetaData::DataBlob dataBlob; - m_LiteWeightStgdb.m_MiniMd.m_UserStringHeap.GetAllData(&dataBlob); - *pTable = dataBlob.GetDataPointer(); - *pTableSize = (void*)(ULONG_PTR)m_LiteWeightStgdb.m_MiniMd.m_UserStringHeap.GetUnalignedSize(); - return S_OK; - - } -ErrExit: -#endif _ASSERTE(!"NYI"); return E_NOTIMPL; } // MDInternalRO::GetTableInfoWithIndex diff --git a/src/pal/prebuilt/corerror/mscorurt.rc b/src/pal/prebuilt/corerror/mscorurt.rc index caa432d51a..28da8f91ce 100644 --- a/src/pal/prebuilt/corerror/mscorurt.rc +++ b/src/pal/prebuilt/corerror/mscorurt.rc @@ -653,7 +653,6 @@ BEGIN MSG_FOR_URT_HR(COR_E_PLATFORMNOTSUPPORTED) "Operation is not supported on this platform." MSG_FOR_URT_HR(COR_E_INVALIDPROGRAM) "Invalid IL or CLR metadata." MSG_FOR_URT_HR(COR_E_OPERATIONCANCELED) "The operation was cancelled." - MSG_FOR_URT_HR(COR_E_UNSUPPORTEDMDIL) "Valid IL which cannot be compiled into MDIL." MSG_FOR_URT_HR(COR_E_DEVICESNOTSUPPORTED) "Devices not supported." MSG_FOR_URT_HR(COR_E_DATAMISALIGNED) "A datatype misalignment was detected in a load or store instruction." MSG_FOR_URT_HR(COR_E_CODECONTRACTFAILED) "A managed code contract (ie, precondition, postcondition, invariant, or assert) failed." diff --git a/src/pal/prebuilt/inc/corerror.h b/src/pal/prebuilt/inc/corerror.h index 7ec0ddceae..d4d4495297 100644 --- a/src/pal/prebuilt/inc/corerror.h +++ b/src/pal/prebuilt/inc/corerror.h @@ -758,7 +758,6 @@ #define COR_E_PLATFORMNOTSUPPORTED EMAKEHR(0x1539) #define COR_E_INVALIDPROGRAM EMAKEHR(0x153a) #define COR_E_OPERATIONCANCELED EMAKEHR(0x153b) -#define COR_E_UNSUPPORTEDMDIL EMAKEHR(0x153c) #define COR_E_INSUFFICIENTMEMORY EMAKEHR(0x153d) #define COR_E_RUNTIMEWRAPPED EMAKEHR(0x153e) #define COR_E_DEVICESNOTSUPPORTED EMAKEHR(0x1540) diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp index 16a2819511..2e8e3334fe 100644 --- a/src/tools/crossgen/crossgen.cpp +++ b/src/tools/crossgen/crossgen.cpp @@ -98,9 +98,6 @@ void PrintLogoHelper() Output(W("Microsoft (R) CoreCLR Native Image ")); #else Output(W("Microsoft (R) CLR Native Image ")); -#endif -#ifdef MDIL - Output(W("/ MDIL ")); #endif Outputf(W("Generator - Version %S\n"), VER_FILEVERSION_STR); Outputf(W("%S\n"), VER_LEGALCOPYRIGHT_LOGO_STR); @@ -123,12 +120,7 @@ void PrintUsageHelper() W(" /partialtrust - Assembly will be run in a partial trust domain.\n") #endif W(" /in - Specifies input filename (optional)\n") -#ifdef MDIL - W(" /out - Specifies output filename (optional with native images,\n") - W(" required with MDIL)\n") -#else W(" /out - Specifies output filename (optional)\n") -#endif #ifdef FEATURE_CORECLR W(" /Trusted_Platform_Assemblies \n") W(" - List of assemblies treated as trusted platform\n") @@ -172,14 +164,6 @@ void PrintUsageHelper() W(" /PreWP8App - Set the Windows Phone 8 \"Quirks\" mode, namely AppDomainCompatSwitch=\n") W(" WindowsPhone_3.7.0.0 or WindowsPhone_3.8.0.0.\n") #endif -#ifdef MDIL - W(" MDIL Generation Parameters\n") - W(" /mdil - Generate MDIL rather than native code. Requires presence of /out switch.\n") - W(" /nomdil - create MDIL image with no MDIL code or CTL data structures, use to force\n") - W(" fall back to JIT\n") - W(" /EmbedMDIL - Embed a previously created mdil data in IL image into native image.\n") - W(" /fxmdil - Generate framework assembly MDIL images containing minimal MDIL\n") -#endif // MDIL #ifdef FEATURE_WINMD_RESILIENT W(" WinMD Parameters\n") W(" /WinMDResilient - Generate images resilient to WinMD dependency changes.\n") @@ -504,8 +488,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) argc = argc2; argv = argv2; - bool fCopySourceToOut = false; - // By default, Crossgen will assume code-generation for fulltrust domains unless /PartialTrust switch is specified dwFlags |= NGENWORKER_FLAGS_FULLTRUSTDOMAIN; @@ -556,34 +538,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) dwFlags |= NGENWORKER_FLAGS_APPCOMPATWP8; } #endif -#ifdef MDIL - else if (MatchParameter(*argv, W("mdil"))) - { - dwFlags |= NGENWORKER_FLAGS_CREATEMDIL; - } - else if (MatchParameter(*argv, W("fxmdil"))) - { - dwFlags |= NGENWORKER_FLAGS_MINIMAL_MDIL | NGENWORKER_FLAGS_CREATEMDIL; - } - else if (MatchParameter(*argv, W("EmbedMDIL"))) - { - dwFlags |= NGENWORKER_FLAGS_EMBEDMDIL; - } - else if (MatchParameter(*argv, W("NoMDIL"))) - { - dwFlags |= NGENWORKER_FLAGS_NOMDIL; - } -#else // !MDIL - else if (MatchParameter(*argv, W("mdil")) || MatchParameter(*argv, W("fxmdil")) || MatchParameter(*argv, W("NoMDIL"))) - { - // Copy the "in" file as the "out" file - fCopySourceToOut = true; - } - else if (MatchParameter(*argv, W("EmbedMDIL"))) - { - // Dont do anything - simply generate the NI - } -#endif #ifdef FEATURE_WINMD_RESILIENT else if (MatchParameter(*argv, W("WinMDResilient"))) { @@ -826,49 +780,6 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) exit(INVALID_ARGUMENTS); } -#ifdef MDIL - if (pwzOutputFilename == NULL) - { - if (dwFlags & NGENWORKER_FLAGS_CREATEMDIL) - { - Output(W("You must specify an output filename (/out )\n")); - exit(INVALID_ARGUMENTS); - } - } - - if ((dwFlags & NGENWORKER_FLAGS_EMBEDMDIL) && (dwFlags & NGENWORKER_FLAGS_CREATEMDIL)) - { - Output(W("The /EmbedMDIL switch cannot be used with the /mdil or /createmdil switch.\n")); - exit(INVALID_ARGUMENTS); - } - - if ((dwFlags & NGENWORKER_FLAGS_NOMDIL) && !(dwFlags & NGENWORKER_FLAGS_CREATEMDIL)) - { - Output(W("The /NoMDIL switch must be used with the /mdil or /createmdil switch.\n")); - exit(INVALID_ARGUMENTS); - } -#else // !MDIL - if (fCopySourceToOut == true) - { - if (pwzOutputFilename == NULL) - { - Output(W("You must specify an output filename (/out )\n")); - exit(INVALID_ARGUMENTS); - } - if (CopyFileW(pwzFilename, pwzOutputFilename, FALSE) == 0) - { - DWORD dwLastError = GetLastError(); - OutputErrf(W("Error: x86 copy failed for \"%s\" (0x%08x)\n"), pwzFilename, HRESULT_FROM_WIN32(dwLastError)); - } - else - { - Outputf(W("[x86] %s generated successfully\n"),pwzOutputFilename); - } - - return 0; - } -#endif //MDIL - if (fCreatePDB && (dwFlags != 0)) { Output(W("The /CreatePDB switch cannot be used with other switches, except /lines and the various path switches.\n")); diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp index 5fd185e100..0ec336dffa 100644 --- a/src/vm/appdomain.hpp +++ b/src/vm/appdomain.hpp @@ -15,7 +15,6 @@ #ifndef _APPDOMAIN_H #define _APPDOMAIN_H -#ifndef CLR_STANDALONE_BINDER #include "eventtrace.h" #include "assembly.hpp" #include "clsload.hpp" @@ -50,17 +49,6 @@ #include "winrttypenameconverter.h" #endif // FEATURE_COMINTEROP -#else // CLR_STANDALONE_BINDER -class DomainFile; -class CPUSTUBLINKER; -struct CodeLabel; -class IdDispenser; -typedef DPTR(OBJECTREF) PTR_OBJECTREF; -typedef DPTR(DomainFile) PTR_DomainFile; -typedef DPTR(IdDispenser) PTR_IdDispenser; -#include "..\md\winmd\inc\adapter.h" -#endif // CLR_STANDALONE_BINDER - #include "appxutil.h" class BaseDomain; @@ -288,7 +276,6 @@ struct DomainLocalModule return &m_pGCStatics; } -#ifndef CLR_STANDALONE_BINDER // Returns bytes so we can add offsets inline PTR_BYTE GetGCStaticsBasePointer(MethodTable * pMT) { @@ -321,7 +308,6 @@ struct DomainLocalModule return dac_cast(this); } } -#endif // !CLR_STANDALONE_BINDER inline DynamicClassInfo* GetDynamicClassInfo(DWORD n) { @@ -333,7 +319,6 @@ struct DomainLocalModule return &m_pDynamicClassTable[n]; } -#ifndef CLR_STANDALONE_BINDER // These helpers can now return null, as the debugger may do queries on a type // before the calls to PopulateClass happen inline PTR_BYTE GetDynamicEntryGCStaticsBasePointer(DWORD n, PTR_LoaderAllocator pLoaderAllocator) @@ -397,7 +382,6 @@ struct DomainLocalModule return retval; } -#endif // CLR_STANDALONE_BINDER FORCEINLINE PTR_DynamicClassInfo GetDynamicClassInfoIfInitialized(DWORD n) { @@ -466,7 +450,6 @@ struct DomainLocalModule return offsetof(DomainLocalModule, m_pDataBlob); } -#ifndef CLR_STANDALONE_BINDER FORCEINLINE MethodTable * GetMethodTableFromClassDomainID(DWORD dwClassDomainID) { DWORD rid = (DWORD)(dwClassDomainID) + 1; @@ -476,8 +459,7 @@ struct DomainLocalModule PREFIX_ASSUME(pMT != NULL); return pMT; } -#endif // CLR_STANDALONE_BINDER - + private: friend void EmitFastGetSharedStaticBase(CPUSTUBLINKER *psl, CodeLabel *init, bool bCCtorCheck); @@ -520,8 +502,6 @@ public: }; // struct DomainLocalModule -#ifndef CLR_STANDALONE_BINDER - typedef DPTR(class DomainLocalBlock) PTR_DomainLocalBlock; class DomainLocalBlock { @@ -3006,52 +2986,6 @@ public: return dac_cast(this); } -#ifdef MDIL - void SetMDILCompilationDomain() - { - - LIMITED_METHOD_CONTRACT; - - _ASSERTE(IsCompilationDomain()); - m_dwFlags |= MDIL_COMPILATION_DOMAIN; - } - - BOOL IsMDILCompilationDomain() - { - - LIMITED_METHOD_CONTRACT; - return m_dwFlags & MDIL_COMPILATION_DOMAIN; - } - - void SetMinimalMDILCompilationDomain() - { - LIMITED_METHOD_CONTRACT; - - _ASSERTE(IsCompilationDomain()); - m_dwFlags |= MINIMAL_MDIL_COMPILATION_DOMAIN; - } - - BOOL IsMinimalMDILCompilationDomain() - { - LIMITED_METHOD_CONTRACT; - return m_dwFlags & MINIMAL_MDIL_COMPILATION_DOMAIN; - } - - void SetNoMDILCompilationDomain() - { - LIMITED_METHOD_CONTRACT; - - _ASSERTE(IsCompilationDomain()); - m_dwFlags |= NO_MDIL_COMPILATION_DOMAIN; - } - - BOOL IsNoMDILCompilationDomain() - { - LIMITED_METHOD_CONTRACT; - return m_dwFlags & NO_MDIL_COMPILATION_DOMAIN; - } -#endif // MDIL - void SetCanUnload() { LIMITED_METHOD_CONTRACT; @@ -3983,11 +3917,6 @@ 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 MDIL - MDIL_COMPILATION_DOMAIN = 0x040000, // Are we generating MDIL? - MINIMAL_MDIL_COMPILATION_DOMAIN = 0x080000, // Are we generating platform MDIL? - NO_MDIL_COMPILATION_DOMAIN = 0x100000, // Are we generating a file we believe will fail on the Triton code path -#endif #ifdef FEATURE_CORECLR ENABLE_SKIP_PLAT_CHECKS = 0x200000, // Skip various assembly checks (like platform check) ENABLE_ASSEMBLY_LOADFILE = 0x400000, // Allow Assembly.LoadFile in CoreCLR @@ -5444,7 +5373,4 @@ public: }; #endif // !DACCESS_COMPILE && !CROSSGEN_COMPILE - -#endif // !CLR_STANDALONE_BINDER - #endif diff --git a/src/vm/appdomain.inl b/src/vm/appdomain.inl index 579224bcbb..a7720f6f52 100644 --- a/src/vm/appdomain.inl +++ b/src/vm/appdomain.inl @@ -15,8 +15,6 @@ #ifndef _APPDOMAIN_I #define _APPDOMAIN_I -#ifndef BINDER - #ifndef DACCESS_COMPILE #include "appdomain.hpp" @@ -326,8 +324,6 @@ inline PTR_LoaderAllocator AppDomain::GetLoaderAllocator() return PTR_LoaderAllocator(PTR_HOST_MEMBER_TADDR(AppDomain,this,m_LoaderAllocator)); } -#endif // !BINDER - /* static */ inline DWORD DomainLocalModule::DynamicEntry::GetOffsetOfDataBlob() { diff --git a/src/vm/appxutil.h b/src/vm/appxutil.h index 92dac4e948..1e18fcce04 100644 --- a/src/vm/appxutil.h +++ b/src/vm/appxutil.h @@ -13,7 +13,7 @@ namespace AppX { -#if defined(FEATURE_APPX) && !defined(CROSSGEN_COMPILE) && !defined(CLR_STANDALONE_BINDER) +#if defined(FEATURE_APPX) && !defined(CROSSGEN_COMPILE) //----------------------------------------------------------------------------------- // Returns true if running in an AppX process with Designer Mode enabled. bool IsAppXDesignMode(); diff --git a/src/vm/binder.h b/src/vm/binder.h index fbfce47142..8e26bdd255 100644 --- a/src/vm/binder.h +++ b/src/vm/binder.h @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. -#if !defined(_BINDERMODULE_H_) && !defined(CLR_STANDALONE_BINDER) +#ifndef _BINDERMODULE_H_ #define _BINDERMODULE_H_ class DataImage; diff --git a/src/vm/callingconvention.h b/src/vm/callingconvention.h index 55fbfd0469..fbf966f4c6 100644 --- a/src/vm/callingconvention.h +++ b/src/vm/callingconvention.h @@ -1492,11 +1492,7 @@ void ArgIteratorTemplate::ForceSigWalk() _ASSERTE(!FORBIDGC_LOADER_USE_ENABLED()); CONTRACT_VIOLATION(ThrowsViolation); #endif -#ifdef BINDER - IfFailThrow(COR_E_NOTSUPPORTED); -#else COMPlusThrow(kNotSupportedException); -#endif } #endif } @@ -1553,7 +1549,7 @@ void ArgIteratorTemplate::ForceSigWalk() int endOfs = ofs + stackElemSize; if (endOfs > maxOffset) { -#if !defined(DACCESS_COMPILE) && !defined(BINDER) +#if !defined(DACCESS_COMPILE) if (endOfs > MAX_ARG_SIZE) { #ifdef _DEBUG diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 664af1e111..359948937e 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -1865,8 +1865,6 @@ PTR_Module Module::ComputePreferredZapModule(Module * pDefinitionModule, // Is pModule likely a dependency of pOtherModule? Heuristic used by preffered zap module algorithm. // It can return both false positives and negatives. // -// Keep in sync with tools\mdilbind\mdilmodule.cpp -// static bool IsLikelyDependencyOf(Module * pModule, Module * pOtherModule) { CONTRACTL @@ -9199,26 +9197,11 @@ void Module::ExpandAll(DataImage *image) mdToken tk; DWORD assemblyFlags = GetAssembly()->GetFlags(); - // construct a compact layout writer if necessary -#ifdef MDIL - ICompactLayoutWriter *pCompactLayoutWriter = NULL; - if (!GetAppDomain()->IsNoMDILCompilationDomain()) - { - pCompactLayoutWriter = ICompactLayoutWriter::MakeCompactLayoutWriter(this, image->m_pZapImage); - } -#endif //MDIL // // Explicitly load the global class. // MethodTable *pGlobalMT = GetGlobalMethodTable(); -#ifdef MDIL - if (pCompactLayoutWriter != NULL && pGlobalMT != NULL) - { - EEClass *pGlocalClass = pGlobalMT->GetClass(); - pGlocalClass->WriteCompactLayout(pCompactLayoutWriter, image->m_pZapImage); - } -#endif //MDIL // // Load all classes. This also fills out the @@ -9265,15 +9248,6 @@ void Module::ExpandAll(DataImage *image) if (t.IsNull()) // Skip this type continue; -#ifdef MDIL - if (pCompactLayoutWriter != NULL) - { - MethodTable *pMT = t.AsMethodTable(); - EEClass *pClass = pMT->GetClass(); - pClass->WriteCompactLayout(pCompactLayoutWriter, image->m_pZapImage); - } -#endif // MDIL - if (!t.HasInstantiation()) { EEClassHashEntry_t *pBucket = NULL; @@ -9526,12 +9500,6 @@ void Module::ExpandAll(DataImage *image) m_pBinder->BindAll(); } -#ifdef MDIL - if (pCompactLayoutWriter) - { - pCompactLayoutWriter->Flush(); - } -#endif // MDIL } // Module::ExpandAll /* static */ diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h index 6af3a22c3b..f3d6bd5b8a 100644 --- a/src/vm/ceeload.h +++ b/src/vm/ceeload.h @@ -12,8 +12,6 @@ #ifndef CEELOAD_H_ #define CEELOAD_H_ -#ifndef CLR_STANDALONE_BINDER - #include "common.h" #ifdef FEATURE_FUSION #include @@ -52,37 +50,6 @@ #include "readytoruninfo.h" #endif -#else // CLR_STANDALONE_BINDER - -#include "volatile.h" -#include "crst.h" -#include "bitmask.h" -#include "arraylist.h" - -#define VPTR(type) type* -typedef DPTR(class Assembly) PTR_Assembly; -typedef DPTR(class Binder) PTR_Binder; -typedef DPTR(class CGrowableStream) PTR_CGrowableStream; -typedef DPTR(struct DomainLocalModule) PTR_DomainLocalModule; -typedef DPTR(class EEClassHashTable) PTR_EEClassHashTable; -typedef DPTR(class EETypeHashTable) PTR_EETypeHashTable; -typedef DPTR(class FieldDesc) PTR_FieldDesc; -typedef DPTR(class InstMethodHashTable) PTR_InstMethodHashTable; -typedef DPTR(class LoaderHeap) PTR_LoaderHeap; -typedef DPTR(class MethodDesc) PTR_MethodDesc; -typedef DPTR(class MethodTable) PTR_MethodTable; -typedef VPTR(class PEFile) PTR_PEFile; -typedef DPTR(class ProfilingBlobTable) PTR_ProfilingBlobTable; -typedef DPTR(class TypeVarTypeDesc) PTR_TypeVarTypeDesc; -template class FixupPointer; - -class EEPtrHashTable; -class ISymUnmanagedReader; -class NgenStats; - -#endif // CLR_STANDALONE_BINDER - - class PELoader; class Stub; class MethodDesc; @@ -280,13 +247,11 @@ public: TADDR GetValueFromCompressedMap(DWORD rid); #ifndef DACCESS_COMPILE -#ifndef CLR_STANDALONE_BINDER void CreateHotItemList(DataImage *image, CorProfileData *profileData, int table, BOOL fSkipNullEntries = FALSE); void Save(DataImage *image, DataImage::ItemKind kind, CorProfileData *profileData, int table, BOOL fCopyValues = FALSE); void SaveUncompressedMap(DataImage *image, DataImage::ItemKind kind, BOOL fCopyValues = FALSE); void ConvertSavedMapToUncompressed(DataImage *image, DataImage::ItemKind kind); void Fixup(DataImage *image, BOOL fFixupEntries = TRUE); -#endif // !CLR_STANDALONE_BINDER #endif // !DACCESS_COMPILE #ifdef _DEBUG @@ -507,23 +472,12 @@ public: // Place holder types for RID maps that store cross-module references -#ifndef CLR_STANDALONE_BINDER - class TypeRef { }; typedef DPTR(class TypeRef) PTR_TypeRef; class MemberRef { }; typedef DPTR(class MemberRef) PTR_MemberRef; -#else // CLR_STANDALONE_BINDER - -struct TypeRef; -typedef DPTR(struct TypeRef) PTR_TypeRef; - -struct MemberRef; -typedef DPTR(struct MemberRef) PTR_MemberRef; - -#endif // CLR_STANDALONE_BINDER // flag used to mark member ref pointers to field descriptors in the member ref cache #define IS_FIELD_MEMBER_REF ((TADDR)0x00000002) @@ -579,8 +533,6 @@ struct NGenLayoutInfo DWORD m_rvaFilterPersonalityRoutine; }; -#ifndef CLR_STANDALONE_BINDER - // // VASigCookies are allocated to encapsulate a varargs call signature. // A reference to the cookie is embedded in the code stream. Cookies @@ -620,12 +572,6 @@ struct VASigCookieBlock VASigCookie m_cookies[kVASigCookieBlockSize]; }; -#else // CLR_STANDALONE_BINDER - -struct VASigCookieBlock; - -#endif // CLR_STANDALONE_BINDER - // This lookup table persists the information about boxed statics into the ngen'ed image // which allows one to the type static initialization without touching expensive EEClasses. Note // that since the persisted info is stored at ngen time as opposed to class layout time, @@ -697,7 +643,6 @@ struct ModuleCtorInfo return hashVal; }; -#ifndef CLR_STANDALONE_BINDER ArrayDPTR(FixupPointer) GetGCStaticMTs(DWORD index); #ifdef FEATURE_PREJIT @@ -755,12 +700,11 @@ struct ModuleCtorInfo } }; #endif // FEATURE_PREJIT -#endif // CLR_STANDALONE_BINDER }; -#if defined(FEATURE_PREJIT) && !defined(CLR_STANDALONE_BINDER) +#ifdef FEATURE_PREJIT // For IBC Profiling we collect signature blobs for instantiated types. // For such instantiated types and methods we create our own ibc token @@ -1059,7 +1003,7 @@ public: DWORD MethodTableRestoreNumReasons[TotalMethodTables + 1]; }; -#endif // FEATURE_PREJIT && !CLR_STANDALONE_BINDER +#endif // FEATURE_PREJIT // // A Module is the primary unit of code packaging in the runtime. It @@ -1120,8 +1064,6 @@ typedef SHash DynamicILBlobTable; typedef DPTR(DynamicILBlobTable) PTR_DynamicILBlobTable; -#ifndef CLR_STANDALONE_BINDER - // declare an array type of COR_IL_MAP entries typedef ArrayDPTR(COR_IL_MAP) ARRAY_PTR_COR_IL_MAP; @@ -1220,8 +1162,6 @@ public: static bool IsNull(const element_t &e) { LIMITED_METHOD_DAC_CONTRACT; return e.m_methodToken == mdMethodDefNil; } }; -#endif // CLR_STANDALONE_BINDER - // ESymbolFormat specified the format used by a symbol stream typedef enum { @@ -1230,9 +1170,6 @@ typedef enum eSymbolFormatILDB /* ILDB format from ildbsymbols.dll */ }ESymbolFormat; -#ifdef CLR_STANDALONE_BINDER -class ILOffsetMappingTraits; -#endif // Hash table of profiler-provided instrumented IL offset mapping, keyed by the MethodDef token typedef SHash ILOffsetMappingTable; @@ -1453,16 +1390,6 @@ struct ThreadLocalModule; class Module { -#ifdef CLR_STANDALONE_BINDER - friend class MdilModule; - - // CLR's Module has some virtual methods, and therefore has a vtable. The binder's version doesn't have - // any virtual methods, but for compatibility with CLR it must have a vtable. So a dummy virtual method - // is defined here. The vtable address is zeroed out in Module::Fixup before saved in native image, - // and reset to the correct value in Module ctor when the native image is loaded. - virtual void DummyVirtualMethod() {} -#endif - #ifdef DACCESS_COMPILE friend class ClrDataAccess; friend class NativeImageDumper; @@ -1590,12 +1517,8 @@ private: ESymbolFormat m_symbolFormat; // Active dependencies -#ifndef CLR_STANDALONE_BINDER ArrayList m_activeDependencies; -#else - // Avoid calling ctor/dtor, since the binder only needs a placeholder. - ArrayListStatic m_activeDependencies; -#endif + SynchronizedBitMask m_unconditionalDependencies; ULONG m_dwNumberOfActivations; @@ -1683,8 +1606,6 @@ private: #endif public: - -#ifndef CLR_STANDALONE_BINDER LookupMap::Iterator EnumerateTypeDefs() { LIMITED_METHOD_CONTRACT; @@ -1692,7 +1613,6 @@ public: return LookupMap::Iterator(&m_TypeDefToMethodTableMap); } -#endif // Hash of available types by name PTR_EEClassHashTable m_pAvailableClasses; @@ -1791,13 +1711,6 @@ private: CORCOMPILE_METHOD_PROFILE_LIST *m_methodProfileList; #if defined(FEATURE_COMINTEROP) - - #if defined(CLR_STANDALONE_BINDER) - - private: PTR_GuidToMethodTableHashTable m_AlwaysNull_pGuidToTypeHash; - - #else // !defined(CLR_STANDALONE_BINDER) - public: #ifndef DACCESS_COMPILE @@ -1811,8 +1724,6 @@ private: private: PTR_GuidToMethodTableHashTable m_pGuidToTypeHash; // A map from GUID to Type, for the "WinRT-interesting" types - #endif // !defined(CLR_STANDALONE_BINDER) - #endif // defined(FEATURE_COMINTEROP) #endif // FEATURE_PREJIT @@ -1823,8 +1734,6 @@ private: #ifdef FEATURE_PREJIT struct TokenProfileData { -#ifndef CLR_STANDALONE_BINDER - static TokenProfileData *CreateNoThrow(void); TokenProfileData() @@ -1848,7 +1757,6 @@ private: RidBitmap tokenBitmaps[CORBBTPROF_TOKEN_MAX_NUM_FLAGS]; } m_formats[SectionFormatCount]; -#endif // CLR_STANDALONE_BINDER } *m_tokenProfileData; // Stats for prejit log @@ -1873,8 +1781,6 @@ protected: // Domain that the IJW fixups were applied in ADID m_DomainIdOfIJWFixups; -#ifndef CLR_STANDALONE_BINDER - public: ADID GetDomainIdOfIJWFixups() { @@ -1890,11 +1796,8 @@ public: m_DomainIdOfIJWFixups = id; } -#endif // CLR_STANDALONE_BINDER #endif // FEATURE_MIXEDMODE -#ifndef CLR_STANDALONE_BINDER - protected: void CreateDomainThunks(); @@ -2727,14 +2630,10 @@ public: #endif BOOL MightContainMatchingProperty(mdProperty tkProperty, ULONG nameHash); -#endif //CLR_STANDALONE_BINDER - private: ArrayDPTR(BYTE) m_propertyNameSet; DWORD m_nPropertyNameSet; -#ifndef CLR_STANDALONE_BINDER - public: // Debugger stuff @@ -2800,16 +2699,12 @@ public: return &m_ModuleCtorInfo; } -#endif // CLR_STANDALONE_BINDER - private: #ifdef FEATURE_MIXEDMODE class MUThunkHash *m_pMUThunkHash; #endif // FEATURE_MIXEDMODE -#ifndef CLR_STANDALONE_BINDER - public: #ifndef DACCESS_COMPILE BOOL Equals(Module *pModule) { WRAPPER_NO_CONTRACT; return m_file->Equals(pModule->m_file); } @@ -2994,11 +2889,7 @@ public: // Turn triggers from this module into runtime checks void EnableModuleFailureTriggers(Module *pModule, AppDomain *pDomain); -#endif // !CLR_STANDALONE_BINDER - #ifdef FEATURE_PREJIT -#ifndef CLR_STANDALONE_BINDER - BOOL IsZappedCode(PCODE code); BOOL IsZappedPrecode(PCODE code); @@ -3094,18 +2985,12 @@ public: // ExpandAll() depending on more information that may now be available // (after all the methods have been compiled) -#else // CLR_STANDALONE_BINDER -public: -#endif // CLR_STANDALONE_BINDER - void Save(DataImage *image); void Arrange(DataImage *image); void PlaceType(DataImage *image, TypeHandle th, DWORD profilingFlags); void PlaceMethod(DataImage *image, MethodDesc *pMD, DWORD profilingFlags); void Fixup(DataImage *image); -#ifndef CLR_STANDALONE_BINDER - bool AreAllClassesFullyLoaded(); // Precompute type-specific auxiliary information saved into NGen image @@ -3242,10 +3127,8 @@ public: FastInterlockOr(&m_dwTransientFlags, MODULE_SAVED); } -#endif // !CLR_STANDALONE_BINDER #endif // FEATURE_PREJIT -#ifndef CLR_STANDALONE_BINDER #ifdef _DEBUG //Similar to the ExpandAll we use for NGen, this forces jitting of all methods in a module. This is //used for debug purposes though. @@ -3267,10 +3150,7 @@ public: static DWORD EncodeModuleHelper(void* pModuleContext, Module *pReferencedModule); static void TokenDefinitionHelper(void* pModuleContext, Module *pReferencedModule, DWORD index, mdToken* token); -#endif // CLR_STANDALONE_BINDER - public: -#ifndef CLR_STANDALONE_BINDER MethodTable* MapZapType(UINT32 typeID); void SetDynamicIL(mdToken token, TADDR blobAddress, BOOL fTemporaryOverride); @@ -3378,7 +3258,6 @@ public: LIMITED_METHOD_CONTRACT; return (SIZE_T*) &m_ModuleID; } -#endif // !CLR_STANDALONE_BINDER static SIZE_T GetOffsetOfModuleID() { @@ -3386,7 +3265,6 @@ public: return offsetof(Module, m_ModuleID); } -#ifndef CLR_STANDALONE_BINDER PTR_DomainLocalModule GetDomainLocalModule(AppDomain *pDomain); #ifndef DACCESS_COMPILE @@ -3402,8 +3280,6 @@ public: #endif // FEATURE_PREJIT void EnumRegularStaticGCRefs (AppDomain* pAppDomain, promote_func* fn, ScanContext* sc); - -#endif // CLR_STANDALONE_BINDER protected: @@ -3612,12 +3488,12 @@ private: // is not called for each fixup PTR_Assembly *m_NativeMetadataAssemblyRefMap; -#endif // !defined(CLR_STANDALONE_BINDER) && defined(FEATURE_PREJIT) +#endif // defined(FEATURE_PREJIT) public: ModuleSecurityDescriptor* m_pModuleSecurityDescriptor; -#if !defined(CLR_STANDALONE_BINDER) && !defined(DACCESS_COMPILE) && defined(FEATURE_PREJIT) +#if !defined(DACCESS_COMPILE) && defined(FEATURE_PREJIT) PTR_Assembly GetNativeMetadataAssemblyRefFromCache(DWORD rid) { PTR_Assembly * NativeMetadataAssemblyRefMap = VolatileLoadWithoutBarrier(&m_NativeMetadataAssemblyRefMap); @@ -3630,12 +3506,9 @@ public: } void SetNativeMetadataAssemblyRefInCache(DWORD rid, PTR_Assembly pAssembly); -#endif // !defined(CLR_STANDALONE_BINDER) && !defined(DACCESS_COMPILE) && defined(FEATURE_PREJIT) +#endif // !defined(DACCESS_COMPILE) && defined(FEATURE_PREJIT) }; - -#ifndef CLR_STANDALONE_BINDER - // // A ReflectionModule is a module created by reflection // @@ -3847,6 +3720,4 @@ struct VASigCookieEx : public VASigCookie bool IsSingleAppDomain(); -#endif // CLR_STANDALONE_BINDER - #endif // !CEELOAD_H_ diff --git a/src/vm/class.cpp b/src/vm/class.cpp index ff937c02ac..961df2a104 100644 --- a/src/vm/class.cpp +++ b/src/vm/class.cpp @@ -26,10 +26,6 @@ #include "runtimecallablewrapper.h" #endif // FEATURE_COMINTEROP -#ifdef MDIL -#include "security.h" -#endif - //#define DEBUG_LAYOUT #define SORT_BY_RID @@ -3466,1280 +3462,3 @@ void EEClass::SetPackableField(EEClassFieldId eField, DWORD dwValue) _ASSERTE(!m_fFieldsArePacked); GetPackedFields()->SetUnpackedField(eField, dwValue); } - -#ifndef DACCESS_COMPILE -#ifdef MDIL -//------------------------------------------------------------------------------- -void EEClass::WriteCompactLayout(ICompactLayoutWriter *pICLW, ZapImage *pZapImage) -{ - STANDARD_VM_CONTRACT; - - EX_TRY - { - IfFailThrow(WriteCompactLayoutHelper(pICLW)); - } - EX_CATCH - { - // This catch will prevent type load/assembly load failures that occur during CTL generation to - // not bring down the MDIL generation phase. - SString message; - GET_EXCEPTION()->GetMessage(message); - GetSvcLogger()->Printf(LogLevel_Warning, W("%s while generating CTL for typedef 0x%x\n"), message.GetUnicode(), GetMethodTable()->GetCl()); - } - EX_END_CATCH(RethrowCorruptingExceptions) -} - -//------------------------------------------------------------------------------- -HRESULT EEClass::WriteCompactLayoutHelper(ICompactLayoutWriter *pICLW) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - MethodTable * pMT = GetMethodTable(); - Module *pModule = pMT->GetModule(); - IMDInternalImport *pMDImport = pModule->GetMDImport(); - - // Prepare the CTL writer for writing a type - pICLW->Reset(); - - // - // Gather high level information about the type: flags, and tokens for - // the type, it's base, and it's enclosing type (if any). - // - - DWORD flags = 0; - mdToken tkType = pMT->GetCl(); - mdToken tkBaseType = mdTokenNil; - pMDImport->GetTypeDefProps(tkType, &flags, &tkBaseType); - - mdTypeDef tkEnclosingType = mdTokenNil; - pMDImport->GetNestedClassProps(tkType, &tkEnclosingType); - - // - // Get the count for the number of interfaces from metadata - // - - HENUMInternalHolder hEnumInterfaceImpl(pMDImport); - hEnumInterfaceImpl.EnumInit(mdtInterfaceImpl, tkType); - DWORD interfaceCount = hEnumInterfaceImpl.EnumGetCount(); - - // - // Get the count of fields introduced by this type. - // - - DWORD fieldCount = pMT->GetNumIntroducedInstanceFields() + GetNumStaticFields(); - - // - // Count the total number of declared methods for this class - // - - DWORD declaredMethodCount = 0; - DWORD unboxingStubCount = 0; - DWORD declaredVirtualMethodCount = 0; - { // If this in any way proves to be a speed issue it could - // be done more efficiently by just iterating the MethodDescChunks - // and just adding the counts of each chunk together. For now this - // is the preferred abstraction to use. - MethodTable::IntroducedMethodIterator it(GetMethodTable()); - for (; it.IsValid(); it.Next()) - { - MethodDesc *pMD = it.GetMethodDesc(); - - // unboxing stubs need to be handled specially - // we don't want to report them - the fact that they are - // in the method table and have method descs is a CLR - // implementation detail. - // however, we need to know their number so we can correct - // internal counts that include them - if (pMD->IsUnboxingStub()) - ++unboxingStubCount; - else - { - if (pMD->IsVirtual()) - declaredVirtualMethodCount++; - ++declaredMethodCount; - } - } - } - - // - // Calculate how many virtual methods contribute to overrides and how - // many contribute to new slots - // - - DWORD nonVirtualMethodCount = pMT->GetNumMethods() - unboxingStubCount - pMT->GetNumVirtuals(); - DWORD newVirtualMethodCount = pMT->GetNumVirtuals() - pMT->GetNumParentVirtuals(); - if (newVirtualMethodCount > declaredVirtualMethodCount) - { - // this should only happen for transparent proxy, which has special rules - _ASSERTE(pMT->IsTransparentProxy()); - newVirtualMethodCount = declaredVirtualMethodCount; - } - DWORD overrideVirtualMethodCount = declaredMethodCount - nonVirtualMethodCount - newVirtualMethodCount; - if (overrideVirtualMethodCount > declaredVirtualMethodCount) - { - // this should only happen for transparent proxy, which has special rules - _ASSERTE(pMT->IsTransparentProxy()); - overrideVirtualMethodCount = declaredVirtualMethodCount; - } - - // - // Generic types are prefixed by their number of type arguments - if (pMT->HasInstantiation()) - { - pICLW->GenericType(pMT->GetNumGenericArgs()); - Instantiation inst = GetMethodTable()->GetInstantiation(); - BYTE *varianceInfo = GetVarianceInfo(); - for (DWORD i = 0; i < inst.GetNumArgs(); i++) - { - CorGenericParamAttr flags = GetVarianceOfTypeParameter(varianceInfo, i); - pICLW->GenericParameter(inst[i].AsGenericVariable()->GetToken(), flags); - } - } - - _ASSERTE((pMT == GetMethodTable())); - if (GetMethodTable()->IsComObjectType()) - { -// printf("Com object type: %08x\n", tkType); - flags |= ICompactLayoutWriter::CF_COMOBJECTTYPE; - } - - if (IsEquivalentType()) - { - flags |= ICompactLayoutWriter::CF_TYPE_EQUIVALENT; - } - -#ifdef FEATURE_COMINTEROP - if (IsComClassInterface()) - { -// printf("Com class interface type: %08x\n", tkType); - flags |= ICompactLayoutWriter::CF_COMCLASSINTERFACE; - } - - if (IsComEventItfType()) - { -// printf("Com event interface type: %08x\n", tkType); - flags |= ICompactLayoutWriter::CF_COMEVENTINTERFACE; - } -#endif // FEATURE_COMINTEROP - - if (GetMethodTable()->HasFixedAddressVTStatics()) - { - flags |= ICompactLayoutWriter::CF_FIXED_ADDRESS_VT_STATICS; - } - -#ifdef FEATURE_COMINTEROP - if (IsInterface()) - { - switch (GetMethodTable()->GetComInterfaceType()) - { - case ifDual: flags |= ICompactLayoutWriter::CF_DUAL; break; - case ifVtable: flags |= ICompactLayoutWriter::CF_VTABLE; break; - case ifDispatch: flags |= ICompactLayoutWriter::CF_DISPATCH; break; - case ifInspectable: flags |= ICompactLayoutWriter::CF_INSPECTABLE; break; - default: (!"assert unexpected com interface type"); break; - } - } -#endif // FEATURE_COMINTEROP - - if (GetMethodTable()->DependsOnEquivalentOrForwardedStructs()) - { - flags |= ICompactLayoutWriter::CF_DEPENDS_ON_COM_IMPORT_STRUCTS; - } - - if (GetMethodTable()->HasFinalizer()) - { - _ASSERTE(!IsInterface()); - flags |= ICompactLayoutWriter::CF_FINALIZER; - if (GetMethodTable()->HasCriticalFinalizer()) - flags |= ICompactLayoutWriter::CF_CRITICALFINALIZER; - } - - - // Force computation of transparency bits into EEClass->m_VMFlags - Security::IsTypeTransparent(GetMethodTable()); - - if ((m_VMFlags & VMFLAG_TRANSPARENCY_MASK) == VMFLAG_TRANSPARENCY_UNKNOWN) - printf("Transparency unknown of type: %08x unknown?????\n", tkType); - - - if (m_VMFlags & VMFLAG_CONTAINS_STACK_PTR) - flags |= ICompactLayoutWriter::CF_CONTAINS_STACK_PTR; - - // If the class is marked as unsafe value class we need to filter out those classes - // that get marked only "by inheritance" (they contain a field of a type that is marked). - // In CTL we will mark only the classes that are marked expicitly via a custom attribute. - // The binder will propagate this state again during field layout - thereby avoiding - // potentially stale bits. - - // Check that this bit is not already used by somebody else - _ASSERTE((flags & ICompactLayoutWriter::CF_UNSAFEVALUETYPE) == 0); - - if (IsUnsafeValueClass()) - { - // If the class is marked as unsafe value class we need to filter out those classes - // that get the mark only "by inheritance". In CTL we will mark only the classes - // that are marked expicitly in meta-data. - - //printf("%s ", IsMdPublic(flags) ? "Public" : "Intern"); - //printf("Type 0x%08X is unsafe valuetype", tkType); - - HRESULT hr = pMT->GetMDImport()->GetCustomAttributeByName(tkType, - g_CompilerServicesUnsafeValueTypeAttribute, - NULL, NULL); - IfFailThrow(hr); - if (hr == S_OK) - { - //printf(" (directly marked)", tkType); - flags |= ICompactLayoutWriter::CF_UNSAFEVALUETYPE; - } - //printf("\n"); - } - - // - // Now have enough information to start serializing the type. - // - - pICLW->StartType(flags, // CorTypeAttr plus perhaps other flags - tkType, // typedef token for this type - tkBaseType, // type this type is derived from, if any - tkEnclosingType, // type this type is nested in, if any - interfaceCount, // how many times ImplementInterface() will be called - fieldCount, // how many times Field() will be called - declaredMethodCount, // how many times Method() will be called - newVirtualMethodCount, // how many new virtuals this type defines - overrideVirtualMethodCount ); - - DWORD dwPackSize; - hr = pMDImport->GetClassPackSize(GetMethodTable()->GetCl(), &dwPackSize); - if (!FAILED(hr) && dwPackSize != 0) - { - _ASSERTE(dwPackSize == 1 || dwPackSize == 2 || dwPackSize == 4 || dwPackSize == 8 || dwPackSize == 16 || dwPackSize == 32 || dwPackSize == 64 || dwPackSize == 128); - pICLW->PackType(dwPackSize); - } - - IfFailRet(WriteCompactLayoutTypeFlags(pICLW)); - IfFailRet(WriteCompactLayoutSpecialType(pICLW)); - - if (IsInterface() && !HasNoGuid()) - { - GUID guid; - GetMethodTable()->GetGuid(&guid, TRUE); - GuidInfo *guidInfo = GetGuidInfo(); - if (guidInfo != NULL) - pICLW->GuidInformation(guidInfo); - } - - IfFailRet(WriteCompactLayoutFields(pICLW)); - - IfFailRet(WriteCompactLayoutMethods(pICLW)); - IfFailRet(WriteCompactLayoutMethodImpls(pICLW)); - - IfFailRet(WriteCompactLayoutInterfaces(pICLW)); - IfFailRet(WriteCompactLayoutInterfaceImpls(pICLW)); - - - pICLW->EndType(); - - return hr; -} - -//------------------------------------------------------------------------------- -HRESULT EEClass::WriteCompactLayoutTypeFlags(ICompactLayoutWriter *pICLW) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - - DWORD flags = m_VMFlags & VMFLAG_TRANSPARENCY_MASK; - DWORD extendedTypeFlags = 0; - bool needsExtendedTypeFlagsOutput = false; - - if (flags != VMFLAG_TRANSPARENCY_TRANSPARENT) - { - _ASSERTE((VMFLAG_TRANSPARENCY_MASK == 0x1C)); - flags = (flags >> 2); - extendedTypeFlags |= flags; - needsExtendedTypeFlagsOutput = true; - } - else - { - extendedTypeFlags |= EXTENDED_TYPE_FLAG_SF_TRANSPARENT; - } - -#ifdef FEATURE_COMINTEROP - // Handle EXTENDED_TYPE_FLAG_PLATFORM_NEEDS_PER_TYPE_RCW_DATA - // This flag should only be set for platform types (In Windows.winmd, and in mscorlib/system.dll) - bool fBinderHandledNeedsPerTypeRCWDataCase = IsInterface() && GetMethodTable()->GetModule()->GetAssembly()->IsWinMD() && (GetVarianceInfo() != NULL); - - if (!fBinderHandledNeedsPerTypeRCWDataCase && GetMethodTable()->HasRCWPerTypeData()) - { - // This should only happen for runtime components that ship in box. Assert that this is the case. The flag is not a versionable flag. - - // This checks that the assembly is either part of the tpa list, or a winmd file. -#ifdef FEATURE_CORECLR - _ASSERTE("MDIL Compiler has determined that a winrt type needs per-type-RCW data, but is not a platform type." && - (GetMethodTable()->GetModule()->GetAssembly()->GetManifestFile()->IsProfileAssembly() || - GetMethodTable()->GetModule()->GetAssembly()->IsWinMD() || - GetWinRTRedirectedTypeIndex() != WinMDAdapter::RedirectedTypeIndex_Invalid)); -#endif -#ifdef _DEBUG - if (GetMethodTable()->GetModule()->GetAssembly()->IsWinMD()) - { - // If this is a WinMD file, verify the namespace is Windows. something. - DefineFullyQualifiedNameForClass(); - const char * pszFullyQualifiedName = GetFullyQualifiedNameForClass(this->GetMethodTable()); - - if (strncmp(pszFullyQualifiedName, "Windows.", 8) != 0) - { - _ASSERTE(!"MDIL Compiler has determined that a winrt type needs per-type-RCW data, but that the binder will not generate it, and the flag to generate it is not part of versionable MDIL."); - } - } -#endif - extendedTypeFlags |= EXTENDED_TYPE_FLAG_PLATFORM_NEEDS_PER_TYPE_RCW_DATA; - needsExtendedTypeFlagsOutput = true; - } -#endif // FEATURE_COMINTEROP - - if (needsExtendedTypeFlagsOutput) - pICLW->ExtendedTypeFlags(extendedTypeFlags); - - return hr; -} - -#ifdef FEATURE_COMINTEROP -struct RedirectedTypeToSpecialTypeConversion -{ - SPECIAL_TYPE type; -}; - -#define DEFINE_PROJECTED_TYPE(szWinRTNS, szWinRTName, szClrNS, szClrName, nClrAsmIdx, nContractAsmIdx, nWinRTIndex, nClrIndex, nWinMDTypeKind) \ -{ SPECIAL_TYPE_ ## nClrIndex }, - -static const RedirectedTypeToSpecialTypeConversion g_redirectedSpecialTypeInfo[] = -{ -#include "winrtprojectedtypes.h" -}; -#undef DEFINE_PROJECTED_TYPE -#endif - -//------------------------------------------------------------------------------- -HRESULT EEClass::WriteCompactLayoutSpecialType(ICompactLayoutWriter *pICLW) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - SPECIAL_TYPE type = SPECIAL_TYPE_INVALID; -#ifdef FEATURE_COMINTEROP - // All types with winrt redirection indices are special types - WinMDAdapter::RedirectedTypeIndex typeIndex = GetWinRTRedirectedTypeIndex(); - if (typeIndex != WinMDAdapter::RedirectedTypeIndex_Invalid) - { - type = g_redirectedSpecialTypeInfo[typeIndex].type; - } - - // Additionally System.Collections.ICollection and System.Collections.Generics.ICollection are special types - if (this->GetMethodTable()->GetModule()->IsSystem()) - { - DefineFullyQualifiedNameForClass(); - const char * pszFullyQualifiedName = GetFullyQualifiedNameForClass(this->GetMethodTable()); - - if (strcmp(pszFullyQualifiedName, g_CollectionsGenericCollectionItfName) == 0) - { - type = SPECIAL_TYPE_System_Collections_Generic_ICollection; - } - else if (::strcmp(pszFullyQualifiedName, g_CollectionsCollectionItfName) == 0) - { - type = SPECIAL_TYPE_System_Collections_ICollection; - } - } -#endif - - if (type != SPECIAL_TYPE_INVALID) - { - pICLW->SpecialType(type); - } - - return hr; -} - -//------------------------------------------------------------------------------- -HRESULT EEClass::WriteCompactLayoutInterfaces(ICompactLayoutWriter *pICLW) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - - MethodTable *pMT = GetMethodTable(); - IMDInternalImport *pMDImport = pMT->GetModule()->GetMDImport(); - HENUMInternalHolder hEnumInterfaceImpl(pMDImport); - hEnumInterfaceImpl.EnumInit(mdtInterfaceImpl, pMT->GetCl()); - DWORD interfaceCount = hEnumInterfaceImpl.EnumGetCount(); - - for (DWORD i = 0; i < interfaceCount; ++i) - { - mdInterfaceImpl ii; - - if (!hEnumInterfaceImpl.EnumNext(&ii)) - { // Less interfaces than count reports is an error - return E_FAIL; - } - - mdToken tkInterface; - IfFailThrow(pMDImport->GetTypeOfInterfaceImpl(ii, &tkInterface)); - - pICLW->ImplementInterface(tkInterface); - } - - return hr; -} - -//------------------------------------------------------------------------------- -HRESULT EEClass::WriteCompactLayoutInterfaceImpls(ICompactLayoutWriter *pICLW) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - - MethodTable *pMT = GetMethodTable(); - - if (pMT->HasDispatchMap()) - { - DispatchMap::Iterator it(pMT); - for (; it.IsValid(); it.Next()) - { - DispatchMapEntry *pEntry = it.Entry(); - CONSISTENCY_CHECK(pEntry->GetTypeID().IsImplementedInterface()); - - CONSISTENCY_CHECK(pEntry->GetTypeID().GetInterfaceNum() < pMT->GetNumInterfaces()); - MethodTable * pMTItf = - pMT->GetInterfaceMap()[pEntry->GetTypeID().GetInterfaceNum()].GetMethodTable(); - - // - // Determine the interface method token - // - - MethodDesc *pMDItf = pMTItf->GetMethodDescForSlot(pEntry->GetSlotNumber()); - mdToken tkItf = pICLW->GetTokenForMethodDesc(pMDItf, pMTItf); - - // - // Determine the implementation method token - // - -// CONSISTENCY_CHECK(!pEntry->IsVirtuallyMapped()); - MethodDesc *pMDImpl = pMT->GetMethodDescForSlot(pEntry->GetTargetSlotNumber()); - mdToken tkImpl = pICLW->GetTokenForMethodDesc(pMDImpl); - - // - // Serialize - // - - pICLW->ImplementInterfaceMethod(tkItf, tkImpl); - } - } - - return hr; -} - -//------------------------------------------------------------------------------- -struct SortField -{ - int origIndex; - ULONG offset; -}; - -//------------------------------------------------------------------------------- -int _cdecl FieldCmpOffsets(const void *a, const void *b) -{ - LIMITED_METHOD_CONTRACT; - - const SortField *fa = (const SortField *)a; - const SortField *fb = (const SortField *)b; - if (fa->offset < fb->offset) - return -1; - if (fa->offset > fb->offset) - return 1; - return 0; -} - -#ifdef SORT_BY_RID -//------------------------------------------------------------------------------- -struct SortFieldRid -{ - int origIndex; - ULONG rid; -}; - -//------------------------------------------------------------------------------- -int _cdecl FieldCmpRids(const void *a, const void *b) -{ - LIMITED_METHOD_CONTRACT; - - const SortFieldRid *fa = (const SortFieldRid *)a; - const SortFieldRid *fb = (const SortFieldRid *)b; - if (fa->rid < fb->rid) - return -1; - if (fa->rid > fb->rid) - return 1; - return 0; -} - -#endif //SORT_BY_RID -//------------------------------------------------------------------------------- -inline PTR_FieldDesc EEClass::GetFieldDescByIndex(DWORD fieldIndex) -{ - STANDARD_VM_CONTRACT; - - WRAPPER_NO_CONTRACT; - MethodTable * pMT = GetMethodTable(); - CONSISTENCY_CHECK(fieldIndex < (DWORD)(pMT->GetNumIntroducedInstanceFields()) + (DWORD)GetNumStaticFields()); - - // MDIL_NEEDS_REVIEW - // was previously: return GetApproxFieldDescListPtr() + fieldIndex; - - return pMT->GetApproxFieldDescListRaw() + fieldIndex; -} - -HRESULT EEClass::WriteCompactLayoutFields(ICompactLayoutWriter *pICLW) -{ - STANDARD_VM_CONTRACT; - - HRESULT hr = S_OK; - - DWORD dwFieldCount = GetMethodTable()->GetNumIntroducedInstanceFields() + GetNumStaticFields(); - - -#ifdef SORT_BY_RID - typedef CQuickArray SortFieldArray; - SortFieldArray fields; - fields.AllocThrows(dwFieldCount); - for (DWORD i = 0; i < dwFieldCount; i++) - { - FieldDesc *fieldDesc = GetFieldDescByIndex(i); - fields[i].origIndex = i; - fields[i].rid = fieldDesc->GetMemberDef(); - } - - qsort(fields.Ptr(), dwFieldCount, sizeof(SortFieldRid), FieldCmpRids); -#else - // - // Build an index for the fields sorted by offset so that they are serialized - // in the same order as they should be deserialized. - // - - typedef CQuickArray SortFieldArray; - SortFieldArray fields; - fields.AllocThrows(dwFieldCount); - for (DWORD i = 0; i < dwFieldCount; i++) - { - FieldDesc *fieldDesc = GetFieldDescByIndex(i); - fields[i].origIndex = i; - fields[i].offset = fieldDesc->GetOffset(); - } - - qsort(fields.Ptr(), dwFieldCount, sizeof(SortField), FieldCmpOffsets); -#endif - - // - // For each field, gather information and then serialize - // -#ifdef DEBUG_LAYOUT - printf("%s %08x (baseSize = %x instance field bytes = %x number of virtuals = %x):\n", GetMethodTable()->IsValueType() ? "Struct" : "Class", GetMethodTable()->GetCl(), GetMethodTable()->GetBaseSize(), GetMethodTable()->GetNumInstanceFieldBytes(), GetMethodTable()->GetNumVirtuals()); -#endif - - for (DWORD i = 0; i < dwFieldCount; i++) - { - FieldDesc *pFD = GetFieldDescByIndex(fields[i].origIndex); - - mdFieldDef tkField = pFD->GetMemberDef(); - - // - // Determine storage type of the field - // - - ICompactLayoutWriter::FieldStorage fieldStorage = ICompactLayoutWriter::FS_INSTANCE; - if (pFD->IsStatic()) - { - if (pFD->IsThreadStatic()) - { - fieldStorage = ICompactLayoutWriter::FS_THREADLOCAL; - } - else if (pFD->IsContextStatic()) - { - fieldStorage = ICompactLayoutWriter::FS_CONTEXTLOCAL; - } - else if (pFD->IsRVA()) - { - fieldStorage = ICompactLayoutWriter::FS_RVA; - } - else - { - fieldStorage = ICompactLayoutWriter::FS_STATIC; - } - } - - // - // Determine protection of the field - // - - ICompactLayoutWriter::FieldProtection fieldProtection; - switch (pFD->GetFieldProtection()) - { - case fdPrivateScope: - fieldProtection = ICompactLayoutWriter::FP_PRIVATE_SCOPE; - break; - case fdPrivate: - fieldProtection = ICompactLayoutWriter::FP_PRIVATE; - break; - case fdFamANDAssem: - fieldProtection = ICompactLayoutWriter::FP_FAM_AND_ASSEM; - break; - case fdAssembly: - fieldProtection = ICompactLayoutWriter::FP_ASSEMBLY; - break; - case fdFamily: - fieldProtection = ICompactLayoutWriter::FP_FAMILY; - break; - case fdFamORAssem: - fieldProtection = ICompactLayoutWriter::FP_FAM_OR_ASSEM; - break; - case fdPublic: - fieldProtection = ICompactLayoutWriter::FP_PUBLIC; - break; - default: - UNREACHABLE(); - } - - // - // If the field is a ValueType, retrieve the token for it. - // - // NOTE: can't just grab the TypeHandle for the field and return - // that token because the type could reside in another - // metadata scope. - // - - mdToken tkValueType = mdTokenNil; - CorElementType fieldType = pFD->GetFieldType(); - PCCOR_SIGNATURE pSig; - DWORD cbSig; - pFD->GetSig(&pSig, &cbSig); - - SigPointer sigPointer(pSig, cbSig); - sigPointer.GetCallingConv(NULL); - CorElementType elType; - sigPointer.GetElemType(&elType); - switch (elType) - { - case ELEMENT_TYPE_BOOLEAN: - case ELEMENT_TYPE_CHAR: - case ELEMENT_TYPE_I1: - case ELEMENT_TYPE_U1: - case ELEMENT_TYPE_I2: - case ELEMENT_TYPE_U2: - case ELEMENT_TYPE_I4: - case ELEMENT_TYPE_U4: - case ELEMENT_TYPE_I8: - case ELEMENT_TYPE_U8: - case ELEMENT_TYPE_R4: - case ELEMENT_TYPE_R8: - case ELEMENT_TYPE_PTR: - case ELEMENT_TYPE_BYREF: - case ELEMENT_TYPE_I: - case ELEMENT_TYPE_U: - case ELEMENT_TYPE_FNPTR: - _ASSERTE(fieldType == elType); - break; - - case ELEMENT_TYPE_VALUETYPE: - sigPointer.GetToken(&tkValueType); - if (TypeFromToken(tkValueType) != mdtTypeDef) - fieldType = ELEMENT_TYPE_VALUETYPE; - break; - - case ELEMENT_TYPE_VAR: - fieldType = ELEMENT_TYPE_VALUETYPE; - // fall thru - case ELEMENT_TYPE_GENERICINST: - if (fieldType != ELEMENT_TYPE_VALUETYPE) - { - // Force valuetypes not defined in this module from tokens instead of taking advantage of the knowledge - // that this is an enum type. - CorElementType elemTypeGeneric; - IfFailThrow(sigPointer.GetElemType(&elemTypeGeneric)); - if (elemTypeGeneric == ELEMENT_TYPE_VALUETYPE) - { - mdToken tkValueTypeSig; - IfFailThrow(sigPointer.GetToken(&tkValueTypeSig)); - if (TypeFromToken(tkValueTypeSig) != mdtTypeDef) - { - fieldType = ELEMENT_TYPE_VALUETYPE; - } - } - } - tkValueType = pICLW->GetTypeSpecToken(pSig+1, cbSig-1); - break; - - case ELEMENT_TYPE_STRING: - case ELEMENT_TYPE_CLASS: - case ELEMENT_TYPE_OBJECT: - case ELEMENT_TYPE_SZARRAY: - case ELEMENT_TYPE_ARRAY: - _ASSERTE(fieldType == ELEMENT_TYPE_CLASS); - break; - - case ELEMENT_TYPE_MVAR: - printf("elType = %d\n", elType); - _ASSERTE(!"unexpected field type"); - break; - - default: - printf("elType = %d\n", elType); - break; - } - - // - // Record this field - // - - pICLW->Field(tkField, - fieldStorage, - fieldProtection, - fieldType, - (HasExplicitFieldOffsetLayout() || pFD->IsRVA()) ? pFD->GetOffset() : ~0, - tkValueType); - } - -#ifdef DEBUG_LAYOUT - // dump field offsets in token order - mdFieldDef lowestFieldToken = ~0; - for (DWORD i = 0; i < dwFieldCount; i++) - { - FieldDesc *pFD = GetFieldDescByIndex(i); - mdFieldDef tkField = pFD->GetMemberDef(); - if (lowestFieldToken >= tkField) - lowestFieldToken = tkField; - } - // print fields in token order - this is quadratic in the number of fields, - // but it's just debug output after all - - for (DWORD i = 0; i < dwFieldCount; i++) - { - mdFieldDef tkField = lowestFieldToken + i; - bool fFound = false; - for (DWORD i = 0; i < dwFieldCount; i++) - { - FieldDesc *pFD = GetFieldDescByIndex(i); - if (tkField == pFD->GetMemberDef()) - { - printf(" Field %08x of type %x has offset %x\n", tkField, pFD->GetFieldType(), pFD->GetOffset()); - fFound = true; - } - } - if (!fFound) - { - printf(" >>>> Gap for field token %08x\n", tkField); - } - } -#endif - - if (HasLayout()) - { - // see if we have a field marshaler for this field - EEClassLayoutInfo *eeClassLayoutInfo = GetLayoutInfo(); - - FieldMarshaler *pFM = eeClassLayoutInfo->m_pFieldMarshalers; - FieldMarshaler *pFMEnd = (FieldMarshaler*) ((BYTE *)pFM + eeClassLayoutInfo->m_numCTMFields*MAXFIELDMARSHALERSIZE); - while (pFM < pFMEnd) - { -// printf("Field %08x native type = %x external offset = %x\n", tkField, pFM->GetNStructFieldType(), pFM->GetExternalOffset()); - - NStructFieldType type = pFM->GetNStructFieldType(); - DWORD count = 0; - DWORD flags = 0; - DWORD typeToken1 = 0; - DWORD typeToken2 = 0; - -#define NFT_CASE_VERIFICATION_TYPE_NAME(type) nftMissingFromEEClass_WriteCompactLayoutFields_ ## type - - switch (type) - { - NFT_CASE(NFT_NONE) - NFT_CASE(NFT_STRINGUNI) - NFT_CASE(NFT_COPY1) - NFT_CASE(NFT_COPY2) - NFT_CASE(NFT_COPY4) - NFT_CASE(NFT_COPY8) - NFT_CASE(NFT_CBOOL) - NFT_CASE(NFT_DATE) - NFT_CASE(NFT_DECIMAL) - NFT_CASE(NFT_WINBOOL) - NFT_CASE(NFT_SAFEHANDLE) - NFT_CASE(NFT_CRITICALHANDLE) -#ifdef FEATURE_COMINTEROP - NFT_CASE(NFT_BSTR) - NFT_CASE(NFT_VARIANT) - NFT_CASE(NFT_VARIANTBOOL) - NFT_CASE(NFT_CURRENCY) - NFT_CASE(NFT_DATETIMEOFFSET) - NFT_CASE(NFT_HSTRING) - NFT_CASE(NFT_WINDOWSFOUNDATIONHRESULT) - NFT_CASE(NFT_SYSTEMTYPE) -#endif // FEATURE_COMINTEROP - // no additional info for these - break; - - NFT_CASE(NFT_STRINGANSI) - { - FieldMarshaler_StringAnsi *pFM_StringAnsi = (FieldMarshaler_StringAnsi*)pFM; - if (pFM_StringAnsi->GetBestFit()) - flags |= ICompactLayoutWriter::NF_BESTFITMAP; - if (pFM_StringAnsi->GetThrowOnUnmappableChar()) - flags |= ICompactLayoutWriter::NF_THROWONUNMAPPABLECHAR; - } - break; - - NFT_CASE(NFT_FIXEDSTRINGUNI) - { - count = pFM->NativeSize()/sizeof(WCHAR); - } - break; - - NFT_CASE(NFT_FIXEDSTRINGANSI) - { - FieldMarshaler_FixedStringAnsi *pFM_FixedStringAnsi = (FieldMarshaler_FixedStringAnsi*)pFM; - if (pFM_FixedStringAnsi->GetBestFit()) - flags |= ICompactLayoutWriter::NF_BESTFITMAP; - if (pFM_FixedStringAnsi->GetThrowOnUnmappableChar()) - flags |= ICompactLayoutWriter::NF_THROWONUNMAPPABLECHAR; - count = pFM->NativeSize()/sizeof(CHAR); - } - break; - - NFT_CASE(NFT_FIXEDCHARARRAYANSI) - { - FieldMarshaler_FixedCharArrayAnsi *pFM_FixedCharArrayAnsi = (FieldMarshaler_FixedCharArrayAnsi*)pFM; - if (pFM_FixedCharArrayAnsi->GetBestFit()) - flags |= ICompactLayoutWriter::NF_BESTFITMAP; - if (pFM_FixedCharArrayAnsi->GetThrowOnUnmappableChar()) - flags |= ICompactLayoutWriter::NF_THROWONUNMAPPABLECHAR; - count = pFM->NativeSize()/sizeof(CHAR); - } - break; - - NFT_CASE(NFT_FIXEDARRAY) - { - FieldMarshaler_FixedArray *pFM_FixedArray = (FieldMarshaler_FixedArray*)pFM; - MethodTable *pMT = pFM_FixedArray->GetElementTypeHandle().AsMethodTable(); - typeToken1 = pICLW->GetTokenForType(pMT); - - /* do we need this information? there are no accessors... - if (pFM_FixedArray->GetBestFit()) - flags |= ICompactLayoutWriter::NF_BESTFITMAP; - if (pFM_FixedArray->GetThrowOnUnmappableChar()) - flags |= ICompactLayoutWriter::NF_THROWONUNMAPPABLECHAR; - */ - flags |= pFM_FixedArray->GetElementVT() << ICompactLayoutWriter::NF_VARTYPE_SHIFT; - count = pFM->NativeSize()/OleVariant::GetElementSizeForVarType(pFM_FixedArray->GetElementVT(), pMT); - } - break; - - NFT_CASE(NFT_DELEGATE) - { - MethodTable *pMT = ((FieldMarshaler_Delegate*)pFM)->GetMethodTable(); - typeToken1 = pICLW->GetTokenForType(pMT); - } - break; - - NFT_CASE(NFT_ANSICHAR) - { - FieldMarshaler_Ansi *pFM_Ansi = (FieldMarshaler_Ansi*)pFM; - if (pFM_Ansi->GetBestFit()) - flags |= ICompactLayoutWriter::NF_BESTFITMAP; - if (pFM_Ansi->GetThrowOnUnmappableChar()) - flags |= ICompactLayoutWriter::NF_THROWONUNMAPPABLECHAR; - } - break; - - NFT_CASE(NFT_NESTEDLAYOUTCLASS) - { - MethodTable *pMT = ((FieldMarshaler_NestedLayoutClass*)pFM)->GetMethodTable(); - typeToken1 = pICLW->GetTokenForType(pMT); - } - break; - - NFT_CASE(NFT_NESTEDVALUECLASS) - { - MethodTable *pMT = ((FieldMarshaler_NestedValueClass*)pFM)->GetMethodTable(); - typeToken1 = pICLW->GetTokenForType(pMT); - } - break; - -#ifdef FEATURE_COMINTEROP - NFT_CASE(NFT_INTERFACE) - { - FieldMarshaler_Interface *pFM_Interface = (FieldMarshaler_Interface*)pFM; - MethodTable *pMT = pFM_Interface->GetMethodTable(); - typeToken1 = pICLW->GetTokenForType(pMT); - MethodTable *ppItfMT = NULL; - pFM_Interface->GetInterfaceInfo(&ppItfMT, &flags); - typeToken2 = pICLW->GetTokenForType(ppItfMT); - } - break; - - NFT_CASE(NFT_WINDOWSFOUNDATIONIREFERENCE) - { - FieldMarshaler_Nullable *pFM_Nullable = (FieldMarshaler_Nullable*)pFM; - MethodTable *pMT = pFM_Nullable->GetMethodTable(); - typeToken1 = pICLW->GetTokenForType(pMT); - } - break; - -#ifdef FEATURE_CLASSIC_COMINTEROP - NFT_CASE(NFT_SAFEARRAY) - { - FieldMarshaler_SafeArray *pFM_SafeArray = (FieldMarshaler_SafeArray*)pFM; - MethodTable *pMT = pFM_SafeArray->GetElementTypeHandle().AsMethodTable(); - typeToken1 = pICLW->GetTokenForType(pMT); - flags = pFM_SafeArray->GetElementVT() << ICompactLayoutWriter::NF_VARTYPE_SHIFT; - } - break; -#endif //FEATURE_CLASSIC_COMINTEROP - -#endif // FEATURE_COMINTEROP - NFT_CASE(NFT_ILLEGAL) - // do we need this one even? do we need additional info? - break; -#ifndef FEATURE_COMINTEROP - NFT_CASE(NFT_INTERFACE) -#endif - default: -#define NFT_VERIFY_ALL_CASES -#include "nsenumhandleallcases.h" - _ASSERTE(!"unexpected native type"); - break; - - } - - pICLW->NativeField(pFM->GetFieldDesc()->GetMemberDef(), - type, - pFM->GetExternalOffset(), - count, - flags, - typeToken1, - typeToken2); - - ((BYTE*&)pFM) += MAXFIELDMARSHALERSIZE; - } - } - - if (HasExplicitFieldOffsetLayout() || HasLayout() && GetLayoutInfo()->HasExplicitSize()) - { - pICLW->SizeType(GetMethodTable()->GetNumInstanceFieldBytes()); - } - - return hr; -} - -//------------------------------------------------------------------------------- -HRESULT EEClass::WriteCompactLayoutMethods(ICompactLayoutWriter *pICLW) -{ - // we need this iterator because we want the method descs in declaration order, - // but the chunks are in reverse order - class ReversedChunkMethoditerator - { - private: - MethodDesc *m_methodDesc; - public: - ReversedChunkMethoditerator(MethodTable *pMT) - { - m_methodDesc = NULL; - MethodDescChunk *pChunk = pMT->GetClass()->GetChunks(); - if (pChunk == NULL) - return; - while (pChunk->GetNextChunk() != NULL) - pChunk = pChunk->GetNextChunk(); - m_methodDesc = pChunk->GetFirstMethodDesc(); - } - - bool IsValid() - { - return m_methodDesc != NULL; - } - - MethodDesc *GetMethodDesc() - { - return m_methodDesc; - } - - void Next() - { - MethodDescChunk * pChunk = m_methodDesc->GetMethodDescChunk(); - - // Check whether the next MethodDesc is still within the bounds of the current chunk - TADDR pNext = dac_cast(m_methodDesc) + m_methodDesc->SizeOf(); - TADDR pEnd = dac_cast(pChunk) + pChunk->SizeOf(); - - if (pNext < pEnd) - { - // Just skip to the next method in the same chunk - m_methodDesc = PTR_MethodDesc(pNext); - } - else - { - _ASSERTE(pNext == pEnd); - - // We have walked all the methods in the current chunk. Move on - // to the previous chunk. - MethodDescChunk *pPrevChunk = m_methodDesc->GetClass()->GetChunks(); - if (pPrevChunk == pChunk) - m_methodDesc = NULL; - else - { - while (pPrevChunk->GetNextChunk() != pChunk) - pPrevChunk = pPrevChunk->GetNextChunk(); - m_methodDesc = pPrevChunk->GetFirstMethodDesc(); - } - } - } - }; - - HRESULT hr = S_OK; - -// printf("New virtuals of class %08x\n", GetCl()); - - MethodTable *pMT = GetMethodTable(); - DWORD dwNumParentVirtuals = pMT->GetNumParentVirtuals(); - IMDInternalImport *pMDImport = pMT->GetModule()->GetMDImport(); - - ReversedChunkMethoditerator it(GetMethodTable()); - WORD lastNewSlotIndex = 0; - mdMethodDef tkUnboxingStubNeedsImpl = 0; - for (; it.IsValid(); it.Next()) - { - MethodDesc *pMD = it.GetMethodDesc(); - - // skip unboxing stubs - if (pMD->IsUnboxingStub()) - { - if (pMD->IsMethodImpl()) - tkUnboxingStubNeedsImpl = pMD->GetMemberDef(); - continue; - } - - mdMethodDef tkMethod = pMD->GetMemberDef(); - - // - // Gather method information - // - - DWORD dwDeclFlags = pMD->GetAttrs(); - ULONG ulCodeRVA; - DWORD dwImplFlags; - pMDImport->GetMethodImplProps(tkMethod, &ulCodeRVA, &dwImplFlags); - - // - // Figure out if this method overrides a parent method, and - // if so find or generate the corresponding token. - // - - mdToken tkOverrideMethod = mdTokenNil; - WORD slotIndex = pMD->GetSlot(); - if (pMT->IsValueType() && pMD->IsVirtual()) - { - MethodDesc *pBoxedMD = MethodDesc::FindOrCreateAssociatedMethodDesc(pMD, - pMD->GetMethodTable(), - TRUE /* get unboxing entry point */, - pMD->GetMethodInstantiation(), - FALSE /* no allowInstParam */ ); - if (pBoxedMD != NULL) - slotIndex = pBoxedMD->GetSlot(); - } - -#ifdef DEBUG_LAYOUT - if (pMD->IsVirtual()) - printf(" virtual method %08x has slot %x\n", tkMethod, slotIndex); -#endif - if (slotIndex < dwNumParentVirtuals) - { - MethodTable *pParentMT = pMT->GetParentMethodTable(); - MethodDesc *pParentMD = pParentMT->GetMethodDescForSlot(slotIndex)->GetDeclMethodDesc(slotIndex); - tkOverrideMethod = pICLW->GetTokenForMethodDesc(pParentMD); - } - - // - // Figure out the implHints - they consist of the classification - // and various flags for special methods - // - - DWORD dwImplHints = pMD->GetClassification(); - if (pMT->HasDefaultConstructor() && slotIndex == pMT->GetDefaultConstructorSlot()) - dwImplHints |= ICompactLayoutWriter::IH_DEFAULT_CTOR; - else if (pMT->HasClassConstructor() && slotIndex == pMT->GetClassConstructorSlot()) - dwImplHints |= ICompactLayoutWriter::IH_CCTOR; - - if (pMD->IsCtor()) - dwImplHints |= ICompactLayoutWriter::IH_CTOR; - - if (IsDelegate()) - { - DelegateEEClass *delegateEEClass = (DelegateEEClass *)this; - if (pMD == delegateEEClass->m_pInvokeMethod) - dwImplHints |= ICompactLayoutWriter::IH_DELEGATE_INVOKE; - else if (pMD == delegateEEClass->m_pBeginInvokeMethod) - dwImplHints |= ICompactLayoutWriter::IH_DELEGATE_BEGIN_INVOKE; - else if (pMD == delegateEEClass->m_pEndInvokeMethod) - dwImplHints |= ICompactLayoutWriter::IH_DELEGATE_END_INVOKE; - } - - - _ASSERTE((tkUnboxingStubNeedsImpl == 0) || (tkUnboxingStubNeedsImpl == tkMethod) - || !"This depends on unboxing stubs always being processed directly before the method they invoke"); - // cannot use pMD->HasMethodImplSlot() because it has some false positives - // (virtual methods on valuetypes implementing interfaces have the flag bit set - // but an empty list of replaced methods) - if (pMD->IsMethodImpl() || (tkUnboxingStubNeedsImpl == tkMethod)) - { - dwImplHints |= ICompactLayoutWriter::IH_HASMETHODIMPL; - } - - tkUnboxingStubNeedsImpl = 0; - - // Make sure that the transparency is cached in the NGen image - // (code copied from MethodDesc::Save (ngen code path)) - // A side effect of this call is caching the transparency bits - // in the MethodDesc - - Security::IsMethodTransparent(pMD); - - if (pMD->HasCriticalTransparentInfo()) - { - if (pMD->IsTreatAsSafe()) - { - dwImplHints |= ICompactLayoutWriter::IH_TRANSPARENCY_TREAT_AS_SAFE; -// printf(" method %08x is treat as safe\n", tkMethod); - } - else if (pMD->IsTransparent()) - { - dwImplHints |= ICompactLayoutWriter::IH_TRANSPARENCY_TRANSPARENT; -// printf(" method %08x is transparent\n", tkMethod); - } - else if (pMD->IsCritical()) - { - dwImplHints |= ICompactLayoutWriter::IH_TRANSPARENCY_CRITICAL; -// printf(" method %08x is critical\n", tkMethod); - } - else - _ASSERTE(!"one of the above must be true, no?"); - } - else - { - _ASSERTE((dwImplHints & ICompactLayoutWriter::IH_TRANSPARENCY_MASK) == ICompactLayoutWriter::IH_TRANSPARENCY_NO_INFO); -// printf(" method %08x has no critical transparent info\n", tkMethod); - } - - if (!pMD->IsAbstract() && !pMD->IsILStub() && !pMD->IsUnboxingStub() - && pMD->IsIL()) - { - EX_TRY - { - if (pMD->IsVerifiable()) - { - dwImplHints |= ICompactLayoutWriter::IH_IS_VERIFIABLE; - } - } - EX_CATCH - { - // If the method has a security exception, it will fly through IsVerifiable. - // We only expect to see internal CLR exceptions here, so use RethrowCorruptingExceptions - } - EX_END_CATCH(RethrowCorruptingExceptions) - } - - if (pMD->IsVerified()) - { - dwImplHints |= ICompactLayoutWriter::IH_IS_VERIFIED; - } - - // - // Serialize the method - // - - if (IsMdPinvokeImpl(dwDeclFlags)) - { - _ASSERTE(tkOverrideMethod == mdTokenNil); - NDirectMethodDesc *pNMD = (NDirectMethodDesc *)pMD; - PInvokeStaticSigInfo pInvokeStaticSigInfo; - NDirect::PopulateNDirectMethodDesc(pNMD, &pInvokeStaticSigInfo); - - pICLW->PInvokeMethod(dwDeclFlags, - dwImplFlags, - dwImplHints, - tkMethod, - pNMD->GetLibName(), - pNMD->GetEntrypointName(), - pNMD->ndirect.m_wFlags); - } - else - { - if (pMD->IsVirtual() && !tkOverrideMethod) - { -// printf(" Method %08x has new virtual slot %u\n", tkMethod, slotIndex); - // make sure new virtual slot indices are ascending - otherwise, the virtual slot indices - // created by the binder won't be consistent with ngen, which makes mix and match impossible - _ASSERTE(lastNewSlotIndex <= slotIndex); - lastNewSlotIndex = slotIndex; - } - - pICLW->Method(dwDeclFlags, - dwImplFlags, - dwImplHints, - tkMethod, - tkOverrideMethod); - - if (pMD->IsGenericMethodDefinition()) - { - InstantiatedMethodDesc *pIMD = pMD->AsInstantiatedMethodDesc(); - Instantiation inst = pIMD->GetMethodInstantiation(); - for (DWORD i = 0; i < inst.GetNumArgs(); i++) - { - pICLW->GenericParameter(inst[i].AsGenericVariable()->GetToken(), 0); - } - } - } - } - - return hr; -} - -//------------------------------------------------------------------------------- -HRESULT EEClass::WriteCompactLayoutMethodImpls(ICompactLayoutWriter *pICLW) -{ - HRESULT hr = S_OK; - - MethodTable::IntroducedMethodIterator it(GetMethodTable()); - for (; it.IsValid(); it.Next()) - { - MethodDesc *pMDImpl = it.GetMethodDesc(); - if (pMDImpl->IsMethodImpl()) - { // If this is a methodImpl, then iterate all implemented slots - // and serialize the (decl,impl) pair. - // This guarantees that all methodImpls for a particular method - // are "clustered" (if there is more than one) - MethodImpl::Iterator implIt(pMDImpl); - for (; implIt.IsValid(); implIt.Next()) - { - MethodDesc *pMDDecl = implIt.GetMethodDesc(); - // MethodImpls should no longer cover interface methodImpls, as that - // should be captured in the interface dispatch map. - CONSISTENCY_CHECK(!pMDDecl->IsInterface()); - - mdToken tkDecl = pICLW->GetTokenForMethodDesc(pMDDecl); - pICLW->MethodImpl(tkDecl, pMDImpl->GetMemberDef()); - } - } - } - - return hr; -} -#endif //MDIL -#endif diff --git a/src/vm/class.h b/src/vm/class.h index cfb6525194..cad0e0f49c 100644 --- a/src/vm/class.h +++ b/src/vm/class.h @@ -36,7 +36,6 @@ /* * Include Files */ -#ifndef BINDER #include "eecontract.h" #include "argslot.h" #include "vars.hpp" @@ -58,25 +57,13 @@ #include "eeconfig.h" #include "typectxt.h" #include "iterator_util.h" -#endif // BINDER #ifdef FEATURE_COMINTEROP #include "..\md\winmd\inc\adapter.h" #endif #include "packedfields.inl" #include "array.h" -#ifndef BINDER #define IBCLOG(x) g_IBCLogger.##x -#else -#include "gcdesc.h" -#define IBCLOG(x) -#define COUNTER_ONLY(x) -class PrestubMethodFrame; -#endif - -#ifdef MDIL -#include "compactlayoutwriter.h" -#endif VOID DECLSPEC_NORETURN RealCOMPlusThrowHR(HRESULT hr); @@ -255,9 +242,6 @@ class ExplicitFieldTrustHolder : private ExplicitFieldTrust #endif }; -#ifdef BINDER -class InterfaceImplEnum; -#else //******************************************************************************* // Enumerator to traverse the interface declarations of a type, automatically building // a substitution chain on the stack. @@ -299,7 +283,6 @@ public: const Substitution *CurrentSubst() const { LIMITED_METHOD_CONTRACT; return &m_CurrSubst; } mdTypeDef CurrentToken() const { LIMITED_METHOD_CONTRACT; return m_CurrTok; } }; -#endif // BINDER #ifdef FEATURE_COMINTEROP // @@ -400,10 +383,6 @@ class EEClassLayoutInfo #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif private: // size (in bytes) of fixed portion of NStruct. @@ -687,11 +666,6 @@ class EEClassOptionalFields friend class NativeImageDumper; #endif -#ifdef BINDER - friend class MdilModule; - friend class CompactTypeBuilder; -#endif - // // GENERICS RELATED FIELDS. // @@ -850,10 +824,6 @@ class EEClass // DO NOT CREATE A NEW EEClass USING NEW! friend class FieldDesc; friend class CheckAsmOffsets; friend class ClrDataAccess; -#ifdef BINDER - friend class MdilModule; - friend class CompactTypeBuilder; -#endif #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif @@ -1033,19 +1003,6 @@ public: #endif // FEATURE_COMINTEROP public: -#ifndef DACCESS_COMPILE -#ifdef MDIL - void WriteCompactLayout(ICompactLayoutWriter *, ZapImage *); - HRESULT WriteCompactLayoutHelper(ICompactLayoutWriter *); - HRESULT WriteCompactLayoutInterfaces(ICompactLayoutWriter *); - HRESULT WriteCompactLayoutInterfaceImpls(ICompactLayoutWriter *); - HRESULT WriteCompactLayoutFields(ICompactLayoutWriter *); - HRESULT WriteCompactLayoutMethods(ICompactLayoutWriter *); - HRESULT WriteCompactLayoutMethodImpls(ICompactLayoutWriter *); - HRESULT WriteCompactLayoutTypeFlags(ICompactLayoutWriter *pICLW); - HRESULT WriteCompactLayoutSpecialType(ICompactLayoutWriter *pICLW); -#endif // MDIL -#endif /* * Maintain back pointer to statcally hot portion of EEClass. * For an EEClass representing multiple instantiations of a generic type, this is the method table @@ -2022,7 +1979,6 @@ public: GetOptionalFields()->m_pVarianceInfo = pVarianceInfo; } -#ifndef BINDER // Check that a signature blob uses type parameters correctly // in accordance with the variance annotations specified by this class // The position parameter indicates the variance of the context we're in @@ -2035,8 +1991,6 @@ public: Module * pModule, SigPointer sp, CorGenericParamAttr position); -#endif - #if defined(CHECK_APP_DOMAIN_LEAKS) || defined(_DEBUG) public: @@ -2515,9 +2469,6 @@ public: typedef DPTR(ArrayClass) PTR_ArrayClass; -#ifdef BINDER -class MdilModule; -#endif // Dynamically generated array class structure class ArrayClass : public EEClass @@ -2526,11 +2477,8 @@ class ArrayClass : public EEClass friend void EEClass::Fixup(DataImage *image, MethodTable *pMethodTable); #endif -#ifndef BINDER - friend MethodTable* Module::CreateArrayMethodTable(TypeHandle elemTypeHnd, CorElementType arrayKind, unsigned Rank, AllocMemTracker *pamTracker); -#else - friend MdilModule; -#endif + friend MethodTable* Module::CreateArrayMethodTable(TypeHandle elemTypeHnd, CorElementType arrayKind, unsigned Rank, AllocMemTracker *pamTracker); + #ifndef DACCESS_COMPILE ArrayClass() : EEClass(sizeof(ArrayClass)) { LIMITED_METHOD_CONTRACT; } #else diff --git a/src/vm/classhash.h b/src/vm/classhash.h index 6a462ff313..4b796c70c1 100644 --- a/src/vm/classhash.h +++ b/src/vm/classhash.h @@ -21,9 +21,6 @@ typedef struct EEClassHashEntry #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif -#ifdef BINDER - friend class MdilModule; -#endif #ifdef _DEBUG PTR_CUTF8 DebugKey[2]; // Name of the type @@ -79,7 +76,6 @@ public: //NOTICE: look at InsertValue() in ClassLoader, that may be the function you want to use. Use this only // when you are sure you want to insert the value in 'this' table. This function does not deal // with case (as often the class loader has to) -#ifndef BINDER EEClassHashEntry_t *InsertValue(LPCUTF8 pszNamespace, LPCUTF8 pszClassName, PTR_VOID Data, EEClassHashEntry_t *pEncloser, AllocMemTracker *pamTracker); EEClassHashEntry_t *InsertValueIfNotFound(LPCUTF8 pszNamespace, LPCUTF8 pszClassName, PTR_VOID *pData, EEClassHashEntry_t *pEncloser, BOOL IsNested, BOOL *pbFound, AllocMemTracker *pamTracker); EEClassHashEntry_t *InsertValueUsingPreallocatedEntry(EEClassHashEntry_t *pStorageForNewEntry, LPCUTF8 pszNamespace, LPCUTF8 pszClassName, PTR_VOID Data, EEClassHashEntry_t *pEncloser); @@ -92,7 +88,6 @@ public: EEClassHashEntry_t *FindNextNestedClass(NameHandle* pName, PTR_VOID *pData, LookupContext *pContext); EEClassHashEntry_t *FindNextNestedClass(LPCUTF8 pszNamespace, LPCUTF8 pszClassName, PTR_VOID *pData, LookupContext *pContext); EEClassHashEntry_t *FindNextNestedClass(LPCUTF8 pszFullyQualifiedName, PTR_VOID *pData, LookupContext *pContext); -#endif // BINDER BOOL CompareKeys(PTR_EEClassHashEntry pEntry, LPCUTF8 * pKey2); @@ -105,14 +100,12 @@ public: }; static PTR_VOID CompressClassDef(mdToken cl /* either a TypeDef or ExportedType*/); -#ifndef BINDER bool UncompressModuleAndClassDef(PTR_VOID Data, Loader::LoadFlag loadFlag, Module **ppModule, mdTypeDef *pCL, mdExportedType *pmdFoundExportedType); VOID UncompressModuleAndNonExportClassDef(PTR_VOID Data, Module **ppModule, mdTypeDef *pCL); static mdToken UncompressModuleAndClassDef(PTR_VOID Data); -#endif // !BINDER #ifdef DACCESS_COMPILE void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); diff --git a/src/vm/clrprivbinderutil.cpp b/src/vm/clrprivbinderutil.cpp index 859269e6c8..b6871123d9 100644 --- a/src/vm/clrprivbinderutil.cpp +++ b/src/vm/clrprivbinderutil.cpp @@ -39,7 +39,6 @@ LPWSTR CopyStringThrowing( namespace CLRPrivBinderUtil { -#ifndef CLR_STANDALONE_BINDER #ifdef FEATURE_FUSION //----------------------------------------------------------------------------------------------------------------- CLRPrivAssemblyBindResultWrapper::CLRPrivAssemblyBindResultWrapper( @@ -361,7 +360,6 @@ namespace CLRPrivBinderUtil return E_UNEXPECTED; } #endif //FEATURE_FUSION -#endif //!CLR_STANDALONE_BINDER //----------------------------------------------------------------------------------------------------------------- HRESULT VerifyBind( @@ -664,7 +662,6 @@ namespace CLRPrivBinderUtil } #ifdef FEATURE_FUSION -#ifndef CLR_STANDALONE_BINDER //===================================================================================================================== HRESULT AssemblyIdentity::Initialize( AssemblySpec * pSpec) @@ -706,7 +703,6 @@ namespace CLRPrivBinderUtil return hr; } -#endif //!CLR_STANDALONE_BINDER #endif @@ -735,7 +731,7 @@ namespace CLRPrivBinderUtil //////////////////////////////////////////////////////////////////////////////////////////////////// ///// ----------------------------- Direct calls to VM ------------------------------------------- //////////////////////////////////////////////////////////////////////////////////////////////////// -#if !defined(CLR_STANDALONE_BINDER) && defined(FEATURE_APPX_BINDER) +#if defined(FEATURE_APPX_BINDER) ICLRPrivAssembly* RaiseAssemblyResolveEvent(IAssemblyName *pAssemblyName, ICLRPrivAssembly* pRequestingAssembly) { CONTRACT(ICLRPrivAssembly*) @@ -831,5 +827,5 @@ namespace CLRPrivBinderUtil WRAPPER_NO_CONTRACT; return a1->CompareEx(a2, AssemblySpec::ASC_Default); } -#endif //!CLR_STANDALONE_BINDER && FEATURE_APPX +#endif // FEATURE_APPX } // namespace CLRPrivBinderUtil diff --git a/src/vm/clrprivbinderwinrt.cpp b/src/vm/clrprivbinderwinrt.cpp index 12eeb1056a..b82d46cdab 100644 --- a/src/vm/clrprivbinderwinrt.cpp +++ b/src/vm/clrprivbinderwinrt.cpp @@ -10,11 +10,6 @@ //============================================================================================= #include "common.h" // precompiled header -#ifdef CLR_STANDALONE_BINDER -#include "utilcode.h" -#include "sstring.h" -#include "stringarraylist.h" -#endif #ifndef FEATURE_CORECLR #include "assemblyusagelogmanager.h" @@ -52,10 +47,6 @@ #include "../binder/inc/fusionassemblyname.hpp" #endif -#ifdef CLR_STANDALONE_BINDER -#include "fakepeimage.h" -#include "coreclr/corebindresult.inl" -#endif using namespace CLRPrivBinderUtil; @@ -159,7 +150,6 @@ CLRPrivBinderWinRT::CLRPrivBinderWinRT( PRECONDITION(CheckPointer(pWinRtTypeCache)); #ifndef CROSSGEN_COMPILE -#ifndef CLR_STANDALONE_BINDER // - To prevent deadlock with GC thread, we cannot trigger GC while holding the lock // - To prevent deadlock with profiler thread, we cannot allow thread suspension m_MapsLock.Init( @@ -169,7 +159,6 @@ CLRPrivBinderWinRT::CLRPrivBinderWinRT( | CRST_DEBUGGER_THREAD INDEBUG(| CRST_DEBUG_ONLY_CHECK_FORBID_SUSPEND_THREAD))); m_MapsAddLock.Init(CrstCLRPrivBinderMapsAdd); -#endif // CLR_STANDALONE_BINDER #ifdef FEATURE_COMINTEROP_WINRT_DESKTOP_HOST m_localWinMDPathLock.Init(CrstCrstCLRPrivBinderLocalWinMDPath); @@ -830,15 +819,11 @@ CLRPrivBinderWinRT::FindAssemblyByFileName( { LIMITED_METHOD_CONTRACT; STATIC_CONTRACT_CAN_TAKE_LOCK; - -#ifndef CLR_STANDALONE_BINDER + ForbidSuspendThreadHolder suspend; -#endif // !CLR_STANDALONE_BINDER { -#ifndef CLR_STANDALONE_BINDER CrstHolder lock(&m_MapsLock); -#endif // !CLR_STANDALONE_BINDER - + const FileNameToAssemblyWinRTMapEntry * pEntry = m_FileNameToAssemblyMap.LookupPtr(wszFileName); return (pEntry == nullptr) ? nullptr : clr::SafeAddRef(pEntry->m_pAssembly); } @@ -856,10 +841,8 @@ CLRPrivBinderWinRT::AddFileNameToAssemblyMapping( _ASSERTE(pAssembly != nullptr); -#ifndef CLR_STANDALONE_BINDER // We have to serialize all Add operations CrstHolder lock(&m_MapsAddLock); -#endif // !CLR_STANDALONE_BINDER // Wrapper for m_FileNameToAssemblyMap.Add that avoids call out into host FileNameToAssemblyWinRTMap::AddPhases addCall; @@ -869,14 +852,10 @@ CLRPrivBinderWinRT::AddFileNameToAssemblyMapping( { // 2. Take the reader lock which can be taken during stack walking // We cannot call out into host from ForbidSuspend region (i.e. no allocations/deallocations) -#ifndef CLR_STANDALONE_BINDER ForbidSuspendThreadHolder suspend; -#endif // !CLR_STANDALONE_BINDER { -#ifndef CLR_STANDALONE_BINDER CrstHolder lock(&m_MapsLock); -#endif // !CLR_STANDALONE_BINDER - + const FileNameToAssemblyWinRTMapEntry * pEntry = m_FileNameToAssemblyMap.LookupPtr(wszFileName); CLRPrivAssemblyWinRT * pResultAssembly = nullptr; if (pEntry != nullptr) @@ -910,15 +889,11 @@ CLRPrivBinderWinRT::RemoveFileNameToAssemblyMapping( { LIMITED_METHOD_CONTRACT; STATIC_CONTRACT_CAN_TAKE_LOCK; - -#ifndef CLR_STANDALONE_BINDER + ForbidSuspendThreadHolder suspend; -#endif // !CLR_STANDALONE_BINDER { -#ifndef CLR_STANDALONE_BINDER CrstHolder lock(&m_MapsLock); -#endif // !CLR_STANDALONE_BINDER - + m_FileNameToAssemblyMap.Remove(wszFileName); } } @@ -938,14 +913,10 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace( CLRPrivBinderUtil::WStringList * pFileNameList = nullptr; { -#ifndef CLR_STANDALONE_BINDER ForbidSuspendThreadHolder suspend; -#endif // !CLR_STANDALONE_BINDER { -#ifndef CLR_STANDALONE_BINDER CrstHolder lock(&m_MapsLock); -#endif // !CLR_STANDALONE_BINDER - + const NamespaceToFileNameListMapEntry * pEntry = m_NamespaceToFileNameListMap.LookupPtr(wszNamespace); if (pEntry != nullptr) { @@ -1118,7 +1089,6 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace( } else { -#if !defined(CLR_STANDALONE_BINDER) // This code is desktop specific. _ASSERTE(m_fNamespaceResolutionKind == NamespaceResolutionKind_DesignerResolveEvent); @@ -1137,7 +1107,6 @@ CLRPrivBinderWinRT::GetFileNameListForNamespace( EX_RETHROW; } EX_END_CATCH_UNREACHABLE -#endif // !defined(CLR_STANDALONE_BINDER) } #else //CROSSGEN_COMPILE @@ -1191,11 +1160,9 @@ CLRPrivBinderWinRT::AddFileNameListForNamespace( entry.m_wszNamespace = wszEntryNamespace.GetValue(); entry.m_pFileNameList = pFileNameList; -#ifndef CLR_STANDALONE_BINDER // We have to serialize all Add operations CrstHolder lock(&m_MapsAddLock); -#endif // !CLR_STANDALONE_BINDER - + // Wrapper for m_NamespaceToFileNameListMap.Add that avoids call out into host NamespaceToFileNameListMap::AddPhases addCall; @@ -1207,14 +1174,10 @@ CLRPrivBinderWinRT::AddFileNameListForNamespace( { // 2. Take the reader lock which can be taken during stack walking // We cannot call out into host from ForbidSuspend region (i.e. no allocations/deallocations) -#ifndef CLR_STANDALONE_BINDER ForbidSuspendThreadHolder suspend; -#endif // !CLR_STANDALONE_BINDER { -#ifndef CLR_STANDALONE_BINDER CrstHolder lock(&m_MapsLock); -#endif // !CLR_STANDALONE_BINDER - + const NamespaceToFileNameListMapEntry * pEntry = m_NamespaceToFileNameListMap.LookupPtr(wszNamespace); if (pEntry == nullptr) { @@ -1247,7 +1210,6 @@ CLRPrivBinderWinRT::AddFileNameListForNamespace( //===================================================================================================================== // Finds assembly with WinRT type if it is already loaded. // -#ifndef CLR_STANDALONE_BINDER PTR_Assembly CLRPrivBinderWinRT::FindAssemblyForTypeIfLoaded( PTR_AppDomain pAppDomain, @@ -1277,7 +1239,7 @@ CLRPrivBinderWinRT::FindAssemblyForTypeIfLoaded( ForbidSuspendThreadHolder suspend; { CrstHolder lock(&m_MapsLock); - + pNamespaceEntry = m_NamespaceToFileNameListMap.LookupPtr(wszNamespace); if ((pNamespaceEntry == nullptr) || (pNamespaceEntry->m_pFileNameList == nullptr)) { @@ -1341,7 +1303,6 @@ CLRPrivBinderWinRT::FindAssemblyForTypeIfLoaded( return NULL; } // CLRPrivBinderWinRT::FindAssemblyForTypeIfLoaded -#endif // !CLR_STANDALONE_BINDER #ifndef DACCESS_COMPILE @@ -1446,13 +1407,9 @@ ULONG CLRPrivAssemblyWinRT::Release() // when the ref count is 0 (to prevent another thread to AddRef and Release it back to 0 in parallel). // All uses of the map are guarded by the map lock, so we have to decrease the ref count under that // lock (to avoid the chance that 2 threads are running Release to ref count 0 at once). -#ifndef CLR_STANDALONE_BINDER ForbidSuspendThreadHolder suspend; -#endif // !CLR_STANDALONE_BINDER { -#ifndef CLR_STANDALONE_BINDER CrstHolder lock(&m_pBinder->m_MapsLock); -#endif // !CLR_STANDALONE_BINDER cRef = InterlockedDecrement(&m_cRef); if (cRef == 0) { diff --git a/src/vm/clrprivbinderwinrt.h b/src/vm/clrprivbinderwinrt.h index 2f06c962be..438e967d10 100644 --- a/src/vm/clrprivbinderwinrt.h +++ b/src/vm/clrprivbinderwinrt.h @@ -250,15 +250,13 @@ public: // the app paths so the WinRT binder will find 3rd party WinMDs. HRESULT SetApplicationContext(BINDER_SPACE::ApplicationContext *pApplicationContext, SString &appLocalWinMD); #endif -#ifndef CLR_STANDALONE_BINDER // 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( PTR_AppDomain pAppDomain, LPCUTF8 szNamespace, LPCUTF8 szClassName); -#endif // !CLR_STANDALONE_BINDER - + #if defined(FEATURE_COMINTEROP_WINRT_DESKTOP_HOST) && !defined(CROSSGEN_COMPILE) BOOL SetLocalWinMDPath(HSTRING localWinMDPath); #endif // FEATURE_COMINTEROP_WINRT_DESKTOP_HOST && !CROSSGEN_COMPILE @@ -303,12 +301,10 @@ private: FileNameToAssemblyWinRTMap m_FileNameToAssemblyMap; // Lock for the above maps -#ifndef CLR_STANDALONE_BINDER CrstExplicitInit m_MapsLock; // Lock for adding into the above maps, in addition to the read-lock above CrstExplicitInit m_MapsAddLock; -#endif // CLR_STANDALONE_BINDER - + //============================================================================================= PTR_CLRPrivTypeCacheWinRT m_pTypeCache; diff --git a/src/vm/clrprivtypecachewinrt.h b/src/vm/clrprivtypecachewinrt.h index 364e47b4f5..c7fe733b90 100644 --- a/src/vm/clrprivtypecachewinrt.h +++ b/src/vm/clrprivtypecachewinrt.h @@ -15,36 +15,6 @@ #include "internalunknownimpl.h" #include "clrprivbinding.h" -#ifdef CLR_STANDALONE_BINDER -typedef HRESULT (*ContainsTypeFnPtr)( - IUnknown * object, - ICLRPrivAssembly * pAssembly, - LPCWSTR wszTypeName); - -// CLRPrivTypeCacheWinRT proxy object for use by the mdilbind assembly binder. -class CLRPrivTypeCacheWinRT : public IUnknownCommon -{ - ReleaseHolder m_actualCacheObject; - ContainsTypeFnPtr m_containsTypeFunction; -public: - CLRPrivTypeCacheWinRT(IUnknown *object, ContainsTypeFnPtr containsTypeFunction) - { - m_actualCacheObject = clr::SafeAddRef(object); - m_containsTypeFunction = containsTypeFunction; - } - //============================================================================================= - // Class methods - - // S_OK - pAssembly contains type wszTypeName - // S_FALSE - pAssembly does not contain type wszTypeName - HRESULT ContainsType( - ICLRPrivAssembly * pAssembly, - LPCWSTR wszTypeName) - { - return m_containsTypeFunction(m_actualCacheObject, pAssembly, wszTypeName); - } -}; -#else //===================================================================================================================== class CLRPrivTypeCacheWinRT : public IUnknownCommon @@ -98,7 +68,7 @@ private: static CLRPrivTypeCacheWinRT * s_pSingleton; }; // class CLRPrivTypeCaheWinRT -#endif + typedef DPTR(CLRPrivTypeCacheWinRT) PTR_CLRPrivTypeCacheWinRT; #endif // FEATURE_HOSTED_BINDER diff --git a/src/vm/clsload.hpp b/src/vm/clsload.hpp index 2520021fca..bc69620efc 100644 --- a/src/vm/clsload.hpp +++ b/src/vm/clsload.hpp @@ -100,7 +100,6 @@ public: SUPPORTS_DAC; } -#ifndef BINDER NameHandle(Module* pModule, mdToken token) : m_nameSpace(NULL), m_name(NULL), @@ -113,7 +112,6 @@ public: LIMITED_METHOD_CONTRACT; SUPPORTS_DAC; } -#endif // !BINDER NameHandle(const NameHandle & p) { @@ -585,7 +583,6 @@ private: Instantiation classInst, // the type arguments to the type (if any) Instantiation methodInst); // the type arguments to the method (if any) -#ifndef BINDER BOOL FindClassModuleThrowing( const NameHandle * pName, @@ -596,7 +593,6 @@ private: EEClassHashEntry_t ** ppEntry, Module * pLookInThisModuleOnly, Loader::LoadFlag loadFlag); -#endif // !BINDER static PTR_Module ComputeLoaderModuleForCompilation(Module *pDefinitionModule, // the module that declares the generic type or method mdToken token, @@ -721,7 +717,6 @@ public: LoadTypesFlag fLoadTypes = LoadTypes, ClassLoadLevel level = CLASS_LOADED); -#ifndef BINDER // Resolve a TypeRef to a TypeDef // (Just a no-op on TypeDefs) // Return FALSE if operation failed (e.g. type does not exist) @@ -742,7 +737,6 @@ public: mdTypeDef * pTypeDefToken, Loader::LoadFlag loadFlag = Loader::Load, BOOL * pfUsesTypeForwarder = NULL); -#endif // !BINDER static void EnsureLoaded(TypeHandle typeHnd, ClassLoadLevel level = CLASS_LOADED); static void TryEnsureLoaded(TypeHandle typeHnd, ClassLoadLevel level = CLASS_LOADED); @@ -919,7 +913,6 @@ public: IMDInternalImport *pTDImport, mdTypeDef *mtd); -#ifndef BINDER class AvailableClasses_LockHolder : public CrstHolder { public: @@ -929,7 +922,6 @@ public: WRAPPER_NO_CONTRACT; } }; -#endif // !BINDER friend class AvailableClasses_LockHolder; @@ -1077,12 +1069,10 @@ private: EEClassHashEntry_t *pEncloser, AllocMemTracker *pamTracker); -#ifndef BINDER // don't call this directly. TypeHandle LoadTypeHandleForTypeKey_Body(TypeKey *pTypeKey, TypeHandle typeHnd, ClassLoadLevel targetLevel); -#endif //!BINDER #endif //!DACCESS_COMPILE }; // class ClassLoader diff --git a/src/vm/common.h b/src/vm/common.h index 7ea43f9612..123350334b 100644 --- a/src/vm/common.h +++ b/src/vm/common.h @@ -11,15 +11,6 @@ #ifndef _common_h_ #define _common_h_ -#ifdef CLR_STANDALONE_BINDER - -#ifndef CLR_PRIV_BINDER_FOR_MDILBIND -#include "..\tools\mdilbind\common.h" -#endif //!CLR_PRIV_BINDER_FOR_MDILBIND - -#else //CLR_STANDALONE_BINDER - - #if defined(_MSC_VER) && defined(_X86_) && !defined(FPO_ON) #pragma optimize("y", on) // Small critical routines, don't put in EBP frame #define FPO_ON 1 @@ -541,8 +532,6 @@ extern Volatile g_IsPaused; // True if the runtime is Paused for FAS extern CLREventStatic g_ClrResumeEvent; // Event fired when the runtime is resumed after a Pause for FAS INT64 AdditionalWait(INT64 sPauseTime, INT64 sTime, INT64 expDuration); -#endif // CLR_STANDALONE_BINDER - #endif // !_common_h_ diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index c0ee625e8c..88e1d284a8 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -137,11 +137,7 @@ HRESULT CEECompileInfo::CreateDomain(ICorCompilationDomain **ppDomain, BOOL fForceDebug, BOOL fForceProfiling, BOOL fForceInstrument, - BOOL fForceFulltrustDomain -#ifdef MDIL - , MDILCompilationFlags mdilCompilationFlags -#endif - ) + BOOL fForceFulltrustDomain) { STANDARD_VM_CONTRACT; @@ -159,11 +155,7 @@ HRESULT CEECompileInfo::CreateDomain(ICorCompilationDomain **ppDomain, { SystemDomain::LockHolder lh; - pCompilationDomain->Init( -#ifdef MDIL - mdilCompilationFlags -#endif - ); + pCompilationDomain->Init(); } if (pEmitter) @@ -507,7 +499,7 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( TRUE, // fThrowOnFileNotFound &bindResult, - // fNgenExplicitBind: Generally during NGEN / MDIL compilation, this is + // fNgenExplicitBind: Generally during NGEN compilation, this is // TRUE, meaning "I am NGEN, and I am doing an explicit bind to the IL // image, so don't infer the NI and try to open it, because I already // have it open". But if we're executing crossgen /CreatePDB, this should @@ -538,13 +530,6 @@ HRESULT CEECompileInfo::LoadAssemblyByPath( pDomain->ToCompilationDomain()->ComputeAssemblyHardBindList(pAssemblyHolder->GetPersistentMDImport()); #endif -#ifdef MDIL - // MDIL is generated as a special mode of ngen.exe or coregen.exe; normally these two utilities - // would not generate anything if a native image for the requested assembly already exists. - // Of course, this is not the desired behavior when generating MDIL - it should always work. - // We need to prevent loading of the native image when we are generating MDIL. - if (!GetAppDomain()->IsMDILCompilationDomain()) -#endif { // Mark the assembly before it gets fully loaded and NGen image dependencies are verified. This is necessary // to allow skipping compilation if there is NGen image already. @@ -925,90 +910,6 @@ BOOL CEECompileInfo::CheckAssemblyZap( return result; } -#ifdef MDIL -DWORD CEECompileInfo::GetMdilModuleSecurityFlags( - CORINFO_ASSEMBLY_HANDLE assembly) -{ - STANDARD_VM_CONTRACT; - - Assembly *pAssembly = (Assembly*) assembly; - - ModuleSecurityDescriptor *pMSD = ModuleSecurityDescriptor::GetModuleSecurityDescriptor(pAssembly); - - MDILHeader::Flags securityFlags = MDILHeader::MdilModuleSecurityDescriptorFlags_None; - - // Is Microsoft Platform - if (pMSD->IsMicrosoftPlatform()) - securityFlags = (MDILHeader::Flags)(securityFlags | MDILHeader::MdilModuleSecurityDescriptorFlags_IsMicrosoftPlatform); - - // Is every method and type in the assembly transparent - if (pMSD->IsAllTransparent()) - securityFlags = (MDILHeader::Flags)(securityFlags | MDILHeader::MdilModuleSecurityDescriptorFlags_IsAllTransparent); - - // Is every method and type introduced by the assembly critical - if (pMSD->IsAllCritical()) - securityFlags = (MDILHeader::Flags)(securityFlags | MDILHeader::MdilModuleSecurityDescriptorFlags_IsAllCritical); - - // Combined with IsAllCritical - is every method and type introduced by the assembly safe critical - if (pMSD->IsTreatAsSafe()) - securityFlags = (MDILHeader::Flags)(securityFlags | MDILHeader::MdilModuleSecurityDescriptorFlags_IsTreatAsSafe); - - // Does the assembly not care about transparency, and wants the CLR to take care of making sure everything - // is annotated properly in the assembly. - if (pMSD->IsOpportunisticallyCritical()) - securityFlags = (MDILHeader::Flags)(securityFlags | MDILHeader::MdilModuleSecurityDescriptorFlags_IsOpportunisticallyCritical); - - // Partial trust assemblies are forced all-transparent under some conditions. This - // tells us whether that is true for this particular assembly. - if (pMSD->IsAllTransparentDueToPartialTrust()) - securityFlags = (MDILHeader::Flags)(securityFlags | MDILHeader::MdilModuleSecurityDescriptorFlags_TransparentDueToPartialTrust); - -#ifdef FEATURE_APTCA - if (pMSD->IsAPTCA()) -#endif - securityFlags = (MDILHeader::Flags)(securityFlags | MDILHeader::MdilModuleSecurityDescriptorFlags_IsAPTCA); - -#ifndef FEATURE_CORECLR - // Can fully trusted transparent code bypass verification - if (pMSD->CanTransparentCodeSkipVerification()) - securityFlags = (MDILHeader::Flags)(securityFlags | MDILHeader::MdilModuleSecurityDescriptorFlags_SkipFullTrustVerification); -#endif // !FEATURE_CORECLR - - return (DWORD)securityFlags; -} - -BOOL CEECompileInfo::CompilerRelaxationNoStringInterningPermitted( - CORINFO_ASSEMBLY_HANDLE assembly) -{ - STANDARD_VM_CONTRACT; - - Assembly *pAssembly = (Assembly*) assembly; - - return pAssembly->GetManifestModule()->IsNoStringInterning(); -} - -BOOL CEECompileInfo::RuntimeCompatibilityWrapExceptions( - CORINFO_ASSEMBLY_HANDLE assembly) -{ - STANDARD_VM_CONTRACT; - - Assembly *pAssembly = (Assembly*) assembly; - - return pAssembly->GetManifestModule()->IsRuntimeWrapExceptions(); -} - -DWORD CEECompileInfo::CERReliabilityContract( - CORINFO_ASSEMBLY_HANDLE assembly) -{ - STANDARD_VM_CONTRACT; - - Assembly *pAssembly = (Assembly*) assembly; - - return pAssembly->GetManifestModule()->GetReliabilityContract(); -} - -#endif // MDIL - HRESULT CEECompileInfo::SetCompilationTarget(CORINFO_ASSEMBLY_HANDLE assembly, CORINFO_MODULE_HANDLE module) { @@ -1152,23 +1053,6 @@ CORINFO_ASSEMBLY_HANDLE return (CORINFO_ASSEMBLY_HANDLE) GetModule(module)->GetAssembly(); } -#ifdef MDIL -HRESULT CEECompileInfo::ShouldCompile(CORINFO_METHOD_HANDLE method) -{ - STANDARD_VM_CONTRACT; - MethodDesc * pMD = (MethodDesc *)method; - - BOOL fIsMinimalMDIL = GetAppDomain()->IsMinimalMDILCompilationDomain(); - if (fIsMinimalMDIL && !pMD->HasClassOrMethodInstantiation()) - return S_FALSE; - - if (GetAppDomain()->IsNoMDILCompilationDomain()) - return S_FALSE; - - return S_OK; -} -#endif // MDIL - #ifdef FEATURE_FUSION HRESULT CEECompileInfo::GetAssemblyName( CORINFO_ASSEMBLY_HANDLE hAssembly, @@ -1370,9 +1254,7 @@ void GetLoadHint(ASSEMBLY * pAssembly, ASSEMBLY *pAssemblyDependency, HRESULT CEECompileInfo::GetLoadHint(CORINFO_ASSEMBLY_HANDLE hAssembly, CORINFO_ASSEMBLY_HANDLE hAssemblyDependency, LoadHintEnum *loadHint, - LoadHintEnum *defaultLoadHint // for MDIL we want to separate the default load hint on the assembly - // from the load hint on the dependency - ) + LoadHintEnum *defaultLoadHint) { STANDARD_VM_CONTRACT; @@ -5272,199 +5154,6 @@ BOOL CEEPreloader::IsUncompiledMethod(CORINFO_METHOD_HANDLE handle) #endif } -#ifdef MDIL -#define ELEMENT_TYPE_NULLABLE ((CorElementType)0x17) -#define ELEMENT_TYPE_NULLABLE_CANON ((CorElementType)0x1f) -MethodTable *GetMethodTable(CorElementType elType) -{ - switch (elType) - { - default: - assert(!"unexpected element type"); - return g_pCanonMethodTableClass; - - case ELEMENT_TYPE_BOOLEAN: - case ELEMENT_TYPE_CHAR: - case ELEMENT_TYPE_I1: - case ELEMENT_TYPE_U1: - case ELEMENT_TYPE_I2: - case ELEMENT_TYPE_U2: - case ELEMENT_TYPE_I4: - case ELEMENT_TYPE_U4: - case ELEMENT_TYPE_I8: - case ELEMENT_TYPE_U8: - case ELEMENT_TYPE_R4: - case ELEMENT_TYPE_R8: - return MscorlibBinder::LoadPrimitiveType(elType); - - case ELEMENT_TYPE_VALUETYPE: - return MscorlibBinder::GetClass(CLASS__DECIMAL); - - case ELEMENT_TYPE_CLASS: - return g_pCanonMethodTableClass; - - case ELEMENT_TYPE_NULLABLE: - { - MethodTable *pInstMT = NULL; - EX_TRY - { - TypeHandle int32TH = GetMethodTable(ELEMENT_TYPE_I4); - pInstMT = ClassLoader::LoadGenericInstantiationThrowing(g_pNullableClass->GetModule(), - g_pNullableClass->GetCl(), - Instantiation(&int32TH, 1), - ClassLoader::LoadTypes - ).GetMethodTable(); - } - EX_CATCH - { - // do nothing - } - EX_END_CATCH(SwallowAllExceptions) - - return pInstMT; - } - - case ELEMENT_TYPE_NULLABLE_CANON: - { - MethodTable *pInstMT = NULL; - EX_TRY - { - TypeHandle canonTH = g_pCanonMethodTableClass; - pInstMT = ClassLoader::LoadGenericInstantiationThrowing(g_pNullableClass->GetModule(), - g_pNullableClass->GetCl(), - Instantiation(&canonTH, 1), - ClassLoader::LoadTypes - ).GetMethodTable(); - } - EX_CATCH - { - // do nothing - } - EX_END_CATCH(SwallowAllExceptions) - - return pInstMT; - } - } -} - -void CEEPreloader::AddMDILCodeFlavorsToUncompiledMethods(CORINFO_METHOD_HANDLE handle) -{ - STANDARD_VM_CONTRACT; -#if 0 - static CorElementType popularFlavors[] = - { - ELEMENT_TYPE_CLASS, - ELEMENT_TYPE_VALUETYPE, - ELEMENT_TYPE_I4, -// ELEMENT_TYPE_NULLABLE, - ELEMENT_TYPE_R8, - ELEMENT_TYPE_U1, - ELEMENT_TYPE_BOOLEAN, - ELEMENT_TYPE_U2, - ELEMENT_TYPE_I8, - ELEMENT_TYPE_U4, - ELEMENT_TYPE_U8, -// ELEMENT_TYPE_NULLABLE_CANON, - }; - - MethodDesc *pMD = GetMethod(handle); - MethodTable *pMT = pMD->GetMethodTable(); - - DWORD nGenericClassArgs = pMT->GetNumGenericArgs(); - DWORD nGenericMethodArgs = pMD->GetNumGenericMethodArgs(); - DWORD nGenericArgs = nGenericClassArgs + nGenericMethodArgs; - if (nGenericArgs == 0) - return; - DWORD flavorCount = nGenericArgs <= 1 ? COUNTOF(popularFlavors) : COUNTOF(popularFlavors)*COUNTOF(popularFlavors); - DWORD flavorsPerArg = nGenericArgs <= 1 ? COUNTOF(popularFlavors) : COUNTOF(popularFlavors); - - for (DWORD flavor = 1; flavor < flavorCount; flavor++) - { - // First instantiate the declaring type at <...,...,...> - - DWORD dwAllocSize = 0; - if (!ClrSafeInt::multiply(sizeof(TypeHandle), nGenericClassArgs, dwAllocSize)) - ThrowHR(COR_E_OVERFLOW); - - CQuickBytes qbGenericClassArgs; - TypeHandle* pGenericClassArgs = reinterpret_cast(qbGenericClassArgs.AllocThrows(dwAllocSize)); - - DWORD remainder = flavor; - - for (DWORD i = 0; i < nGenericClassArgs; i++) - { - pGenericClassArgs[i] = GetMethodTable(popularFlavors[remainder % flavorsPerArg]); - remainder /= flavorsPerArg; - } - - MethodTable *pInstMT = NULL; - - EX_TRY - { - pInstMT = ClassLoader::LoadGenericInstantiationThrowing(pMT->GetModule(), - pMT->GetCl(), - Instantiation(pGenericClassArgs, nGenericClassArgs), - ClassLoader::LoadTypes - ).GetMethodTable(); - } - EX_CATCH - { - // do nothing - } - EX_END_CATCH(SwallowAllExceptions) - - if (pInstMT == NULL) - { - continue; - } - - // Now instantiate the method at <__Canon,...,__Canon>, creating the shared code. - // This will not create an instantiating stub just yet. - CQuickBytes qbGenericMethodArgs; - TypeHandle *genericMethodArgs = NULL; - - // The rest of this method instantiates a generic method - // Instantiate at "__Canon" if a NULL "genericMethodArgs" is given - if (nGenericMethodArgs) - { - dwAllocSize = 0; - if (!ClrSafeInt::multiply(sizeof(TypeHandle), nGenericMethodArgs, dwAllocSize)) - ThrowHR(COR_E_OVERFLOW); - - genericMethodArgs = reinterpret_cast(qbGenericMethodArgs.AllocThrows(dwAllocSize)); - - - for (DWORD i =0; i < nGenericMethodArgs; i++) - { - genericMethodArgs[i] = GetMethodTable(popularFlavors[remainder % flavorsPerArg]); - remainder /= flavorsPerArg; - } - } - - MethodDesc *pInstMD = NULL; - EX_TRY - { - pInstMD = MethodDesc::FindOrCreateAssociatedMethodDesc( pMD, - pMT, - FALSE, /* don't get unboxing entry point */ - Instantiation(genericMethodArgs, nGenericMethodArgs), - TRUE, - FALSE, - TRUE); - } - EX_CATCH - { - // do nothing - } - EX_END_CATCH(SwallowAllExceptions) - - if (pInstMD != NULL) - AddToUncompiledMethods(pInstMD); - } -#endif -} -#endif - static bool IsTypeAccessibleOutsideItsAssembly(TypeHandle th) { STANDARD_VM_CONTRACT; @@ -5555,12 +5244,6 @@ static bool IsMethodCallableOutsideItsAssembly(MethodDesc * pMD) { STANDARD_VM_CONTRACT; -#ifdef MDIL - // Tracking of referenced methods does not kick in during MDIL compilation, so disable this optimization. - if (GetAppDomain()->IsMDILCompilationDomain()) - return true; -#endif - // Virtual methods can be called via interfaces, etc. We would need to do // more analysis to trim them. For now, assume that they can be referenced outside this assembly. if (pMD->IsVirtual()) @@ -5593,12 +5276,6 @@ void CEEPreloader::AddToUncompiledMethods(MethodDesc *pMD, BOOL fForStubs) return; } -#ifdef MDIL - BOOL fIsMinimalMDIL = GetAppDomain()->IsMinimalMDILCompilationDomain(); - if (fIsMinimalMDIL && (fForStubs || !pMD->HasClassOrMethodInstantiation())) - return; -#endif // MDIL - // If it's already been compiled, don't add it to the set of uncompiled methods if (m_image->GetCodeAddress(pMD) != NULL) return; @@ -6944,15 +6621,7 @@ void CEEPreloader::GenerateMethodStubs( MethodDesc* pMD = GetMethod(hMethod); MethodDesc* pStubMD = NULL; -#ifdef MDIL - // Do not generate IL stubs when generating MDIL - // This prevents versionability concerns around IL stubs exposing internal - // implementation details of the CLR. - if (GetAppDomain()->IsMDILCompilationDomain()) - return; -#endif - - // Do not generate IL stubs when generating MDIL + // Do not generate IL stubs when generating ReadyToRun images // This prevents versionability concerns around IL stubs exposing internal // implementation details of the CLR. if (IsReadyToRunCompilation()) @@ -7524,11 +7193,7 @@ CompilationDomain::~CompilationDomain() } -void CompilationDomain::Init( -#ifdef MDIL - MDILCompilationFlags mdilCompilationFlags -#endif - ) +void CompilationDomain::Init() { STANDARD_VM_CONTRACT; @@ -7543,14 +7208,6 @@ void CompilationDomain::Init( Security::SetDefaultAppDomainProperty(GetSecurityDescriptor()); SetCompilationDomain(); -#ifdef MDIL - if (mdilCompilationFlags & MDILCompilationFlags_CreateMDIL) - SetMDILCompilationDomain(); - if (mdilCompilationFlags & MDILCompilationFlags_MinimalMDIL) - SetMinimalMDILCompilationDomain(); - if (mdilCompilationFlags & MDILCompilationFlags_NoMDIL) - SetNoMDILCompilationDomain(); -#endif #ifndef FEATURE_CORECLR // We need the Compilation Domain to be homogeneous. We've already forced everything to be full trust. diff --git a/src/vm/compile.h b/src/vm/compile.h index 46fec94462..6898c159b2 100644 --- a/src/vm/compile.h +++ b/src/vm/compile.h @@ -194,11 +194,7 @@ class CEECompileInfo : public ICorCompileInfo BOOL fForceDebug, BOOL fForceProfiling, BOOL fForceInstrument, - BOOL fForceFulltrustDomain -#ifdef MDIL - , MDILCompilationFlags mdilCompilationFlags -#endif - ); + BOOL fForceFulltrustDomain); HRESULT MakeCrossDomainCallback( ICorCompilationDomain* pDomain, @@ -252,20 +248,6 @@ class CEECompileInfo : public ICorCompileInfo LPWSTR assemblyManifestModulePath, LPDWORD cAssemblyManifestModulePath); -#ifdef MDIL - DWORD GetMdilModuleSecurityFlags( - CORINFO_ASSEMBLY_HANDLE assembly); - - BOOL CompilerRelaxationNoStringInterningPermitted( - CORINFO_ASSEMBLY_HANDLE assembly); - - BOOL RuntimeCompatibilityWrapExceptions( - CORINFO_ASSEMBLY_HANDLE assembly); - - DWORD CERReliabilityContract( - CORINFO_ASSEMBLY_HANDLE assembly); -#endif //MDIL - HRESULT SetCompilationTarget(CORINFO_ASSEMBLY_HANDLE assembly, CORINFO_MODULE_HANDLE module); @@ -359,10 +341,6 @@ class CEECompileInfo : public ICorCompileInfo ICorCompileDataStore *pData, CorProfileData *profileData); -#if MDIL - HRESULT ShouldCompile(CORINFO_METHOD_HANDLE methodHandle); -#endif // MDIL - #ifdef FEATURE_FUSION HRESULT GetAssemblyName( CORINFO_ASSEMBLY_HANDLE hAssembly, @@ -374,9 +352,7 @@ class CEECompileInfo : public ICorCompileInfo HRESULT GetLoadHint(CORINFO_ASSEMBLY_HANDLE hAssembly, CORINFO_ASSEMBLY_HANDLE hAssemblyDependency, LoadHintEnum *loadHint, - LoadHintEnum *defaultLoadHint = NULL // for MDIL we want to separate the default load hint on the assembly - // from the load hint on the dependency - ); + LoadHintEnum *defaultLoadHint); HRESULT GetAssemblyVersionInfo(CORINFO_ASSEMBLY_HANDLE Handle, CORCOMPILE_VERSION_INFO *pInfo); @@ -603,9 +579,6 @@ class CEEPreloader : public ICorCompilePreloader void MethodReferencedByCompiledCode(CORINFO_METHOD_HANDLE handle); BOOL IsUncompiledMethod(CORINFO_METHOD_HANDLE handle); -#ifdef MDIL - void AddMDILCodeFlavorsToUncompiledMethods(CORINFO_METHOD_HANDLE handle); -#endif private: void AddToUncompiledMethods(MethodDesc *pMethod, BOOL fForStubs); @@ -823,11 +796,7 @@ class CompilationDomain : public AppDomain, ~CompilationDomain(); #endif - void Init( -#ifdef MDIL - MDILCompilationFlags mdilCompilationFlags -#endif - ); + void Init(); HRESULT AddDependency(AssemblySpec *pRefSpec, PEAssembly *pFile); diff --git a/src/vm/constrainedexecutionregion.h b/src/vm/constrainedexecutionregion.h index 29de7dfe79..93ceb63010 100644 --- a/src/vm/constrainedexecutionregion.h +++ b/src/vm/constrainedexecutionregion.h @@ -85,8 +85,6 @@ enum { // Return true if either consistency or cer has not been specified in the encoded DWORD given. #define RC_INCOMPLETE(_encoded) (RC_CONSISTENCY(_encoded) == RC_CONSISTENCY_UNDEFINED || RC_CER(_encoded) == RC_CER_UNDEFINED) -#ifndef CLR_STANDALONE_BINDER - // Look for reliability contracts at the method, class and assembly level and parse them to extract the information we're interested // in from a runtime preparation viewpoint. This information is abstracted in the form of the ReliabilityContractLevel enumeration. ReliabilityContractLevel CheckForReliabilityContract(MethodDesc *pMD); @@ -562,6 +560,4 @@ private: #endif }; -#endif // CLR_STANDALONE_BINDER - #endif diff --git a/src/vm/contractimpl.h b/src/vm/contractimpl.h index 544edd4855..d7aefaf12c 100644 --- a/src/vm/contractimpl.h +++ b/src/vm/contractimpl.h @@ -473,7 +473,6 @@ protected: BOOL m_fUseFatIdsForUniqueness; UINT32 m_entryCount; -#ifndef BINDER //------------------------------------------------------------------------ // Returns the next available ID inline UINT32 GetNextID() @@ -495,7 +494,6 @@ protected: CONSISTENCY_CHECK(id != TYPE_ID_THIS_CLASS); return id; } -#endif public: // Starting values for shared and unshared domains @@ -510,14 +508,12 @@ public: //------------------------------------------------------------------------ // Ctor -#ifndef BINDER TypeIDMap() : m_lock(CrstTypeIDMap, CrstFlags(CRST_REENTRANCY)) { WRAPPER_NO_CONTRACT; static_assert_no_msg(TypeIDProvider::INVALID_TYPE_ID == static_cast(INVALIDENTRY)); } -#endif //------------------------------------------------------------------------ // Dtor @@ -875,7 +871,6 @@ protected: typedef DPTR(class DispatchMap) PTR_DispatchMap; // =========================================================================== -#ifndef BINDER class DispatchMap { protected: @@ -999,8 +994,6 @@ public: }; // class Iterator }; // class DispatchMap -#endif // BINDER - #ifdef LOGGING struct StubDispatchStats { diff --git a/src/vm/coreassemblyspec.cpp b/src/vm/coreassemblyspec.cpp index e5179775ff..caa9f17365 100644 --- a/src/vm/coreassemblyspec.cpp +++ b/src/vm/coreassemblyspec.cpp @@ -341,13 +341,13 @@ HRESULT BaseAssemblySpec::ParseName() if (pIUnknownBinder != NULL) { -#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#if defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) if (pDomain->GetFusionContext() != pDomain->GetTPABinderContext()) { pAppContext = (static_cast(pIUnknownBinder))->GetAppContext(); } else -#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) && !defined(MDILNIGEN) +#endif // defined(FEATURE_HOST_ASSEMBLY_RESOLVER) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) { pAppContext = (static_cast(pIUnknownBinder))->GetAppContext(); } diff --git a/src/vm/corebindresult.cpp b/src/vm/corebindresult.cpp index 853ae35c98..68803e24b9 100644 --- a/src/vm/corebindresult.cpp +++ b/src/vm/corebindresult.cpp @@ -13,10 +13,6 @@ #include "common.h" -#ifdef CLR_STANDALONE_BINDER -#include "coreclr\corebindresult.h" -#endif // CLR_STANDALONE_BINDER - #include "../binder/inc/assembly.hpp" #ifndef FEATURE_FUSION diff --git a/src/vm/crossdomaincalls.cpp b/src/vm/crossdomaincalls.cpp index 9e54e0f44f..b528915a54 100644 --- a/src/vm/crossdomaincalls.cpp +++ b/src/vm/crossdomaincalls.cpp @@ -779,9 +779,7 @@ BOOL CrossDomainChannel::GetTargetAddressFast(DWORD optFlags, MethodTable *pSrvM _ASSERTE(m_pTargetAddress); #ifdef _DEBUG -#ifndef MDIL // Triton binder doesn't have method names available _ASSERTE(!strcmp(m_pSrvMD->GetName(), m_pCliMD->GetName())); -#endif DefineFullyQualifiedNameForClass(); LPCUTF8 szSrvTypeName = GetFullyQualifiedNameForClassNestedAware(pSrvMT); LPCUTF8 pszMethodName = m_pCliMD->GetName(); diff --git a/src/vm/crossdomaincalls.h b/src/vm/crossdomaincalls.h index 7fe08b52d6..6a406547de 100644 --- a/src/vm/crossdomaincalls.h +++ b/src/vm/crossdomaincalls.h @@ -192,7 +192,7 @@ class CrossDomainOptimizationInfo return &(m_rmi[0]); } }; -#ifndef BINDER + class CrossDomainTypeMap { class MTMapEntry @@ -269,4 +269,4 @@ private: }; #endif -#endif // !BINDER + diff --git a/src/vm/crst.h b/src/vm/crst.h index acb51138ae..7b470982d5 100644 --- a/src/vm/crst.h +++ b/src/vm/crst.h @@ -110,8 +110,6 @@ extern bool g_fFinalizerRunOnShutDown; // The CRST. class CrstBase { -#ifndef CLR_STANDALONE_BINDER - // The following classes and methods violate the requirement that Crst usage be // exception-safe, or they satisfy that requirement using techniques other than // Holder objects: @@ -298,8 +296,6 @@ protected: void DebugDestroy(); #endif -#endif // CLR_STANDALONE_BINDER - union { CRITICAL_SECTION m_criticalsection; #ifdef FEATURE_INCLUDE_ALL_INTERFACES @@ -336,8 +332,6 @@ protected: void PreLeave (); #endif //_DEBUG -#ifndef CLR_STANDALONE_BINDER - private: void SetOSCritSec () @@ -415,20 +409,15 @@ private: // Generally, it's better to use a regular CrstHolder, and then use the Release() / Acquire() methods on it. // This just exists to convert legacy OS Critical Section patterns over to holders. typedef DacHolder UnsafeCrstInverseHolder; - -#endif // CLR_STANDALONE_BINDER }; -#ifndef CLR_STANDALONE_BINDER typedef CrstBase::CrstHolder CrstHolder; typedef CrstBase::CrstHolderWithState CrstHolderWithState; -#endif // CLR_STANDALONE_BINDER // The CRST. class Crst : public CrstBase { -#ifndef CLR_STANDALONE_BINDER public: void *operator new(size_t size) { @@ -477,8 +466,6 @@ public: Crst() { LIMITED_METHOD_CONTRACT; } - -#endif // CLR_STANDALONE_BINDER }; typedef DPTR(Crst) PTR_Crst; @@ -487,7 +474,6 @@ typedef DPTR(Crst) PTR_Crst; initialized memory */ class CrstStatic : public CrstBase { -#ifndef CLR_STANDALONE_BINDER public: VOID Init(CrstType crstType, CrstFlags flags = CRST_DEFAULT) { @@ -522,13 +508,11 @@ public: return fSuccess; } -#endif // CLR_STANDALONE_BINDER }; /* to be used as regular variable when a explicit call to Init method is needed */ class CrstExplicitInit : public CrstStatic { -#ifndef CLR_STANDALONE_BINDER public: CrstExplicitInit() { m_dwFlags = 0; @@ -538,10 +522,8 @@ public: Destroy(); #endif } -#endif // CLR_STANDALONE_BINDER }; -#ifndef CLR_STANDALONE_BINDER __inline BOOL IsOwnerOfCrst(LPVOID lock) { WRAPPER_NO_CONTRACT; @@ -555,8 +537,6 @@ __inline BOOL IsOwnerOfCrst(LPVOID lock) #endif } -#endif // CLR_STANDALONE_BINDER - #ifdef TEST_DATA_CONSISTENCY // used for test purposes. Determines if a crst is held. void DebugTryCrst(CrstBase * pLock); diff --git a/src/vm/dataimage.cpp b/src/vm/dataimage.cpp index 506b6b9239..83ff0a4f9f 100644 --- a/src/vm/dataimage.cpp +++ b/src/vm/dataimage.cpp @@ -9,14 +9,11 @@ #ifdef FEATURE_PREJIT #include "dataimage.h" -#ifdef BINDER -#include "mdilmodule.h" -#else // BINDER #include "compile.h" #include "field.h" #include "constrainedexecutionregion.h" -#endif // BINDER + // // Include Zapper infrastructure here // @@ -26,15 +23,9 @@ // and remove the dataimage.cpp completely. // #include "zapper.h" -#ifdef BINDER -#include "zapwriter.h" -#include "zapimage.h" -#include "zapimport.h" -#else #include "../zap/zapwriter.h" #include "../zap/zapimage.h" #include "../zap/zapimport.h" -#endif // BINDER #include "inlinetracking.h" #define NodeTypeForItemKind(kind) ((ZapNodeType)(ZapNodeType_StoredStructure + kind)) @@ -125,23 +116,14 @@ public: static bool IsNull(const element_t &e) { LIMITED_METHOD_CONTRACT; return e == NULL; } }; -#ifdef BINDER -DataImage::DataImage(Module *module, ZapImage *pZapImage) - : m_module(module), -#else // BINDER DataImage::DataImage(Module *module, CEEPreloader *preloader) : m_module(module), m_preloader(preloader), -#endif m_iCurrentFixup(0), // Dev11 bug 181494 instrumentation m_pInternedStructures(NULL), m_pCurrentAssociatedMethodTable(NULL) { -#ifdef BINDER - m_pZapImage = pZapImage; -#else // BINDER m_pZapImage = m_preloader->GetDataStore()->GetZapImage(); -#endif // BINDER m_pZapImage->m_pDataImage = this; m_pInternedStructures = new InternedStructureHashTable(); @@ -174,7 +156,6 @@ void DataImage::PostSave() #endif } -#ifndef BINDER DWORD DataImage::GetMethodProfilingFlags(MethodDesc * pMD) { STANDARD_VM_CONTRACT; @@ -186,7 +167,6 @@ DWORD DataImage::GetMethodProfilingFlags(MethodDesc * pMD) const MethodProfilingData * pData = m_methodProfilingData.LookupPtr(pMD); return (pData != NULL) ? pData->flags : 0; } -#endif void DataImage::SetMethodProfilingFlags(MethodDesc * pMD, DWORD flags) { @@ -209,7 +189,6 @@ void DataImage::Preallocate() { STANDARD_VM_CONTRACT; -#ifndef BINDER // TODO: Move to ZapImage PEDecoder pe((void *)m_module->GetFile()->GetManagedFileContents()); @@ -224,7 +203,6 @@ void DataImage::Preallocate() PREALLOCATE_ARRAY(DataImage::m_Fixups, 0.046, cbILImage); PREALLOCATE_HASHTABLE(DataImage::m_surrogates, 0.0025, cbILImage); PREALLOCATE_HASHTABLE((*DataImage::m_pInternedStructures), 0.0007, cbILImage); -#endif } ZapHeap * DataImage::GetHeap() @@ -389,9 +367,6 @@ static void EncodeTargetOffset(PVOID pLocation, SSIZE_T targetOffset, ZapRelocat // Store the targetOffset into the location of the reloc temporarily switch (type) { -#ifdef BINDER - case IMAGE_REL_BASED_MD_METHODENTRY: -#endif case IMAGE_REL_BASED_PTR: case IMAGE_REL_BASED_RELPTR: *(UNALIGNED TADDR *)pLocation = (TADDR)targetOffset; @@ -422,9 +397,6 @@ static SSIZE_T DecodeTargetOffset(PVOID pLocation, ZapRelocationType type) // Store the targetOffset into the location of the reloc temporarily switch (type) { -#ifdef BINDER - case IMAGE_REL_BASED_MD_METHODENTRY: -#endif case IMAGE_REL_BASED_PTR: case IMAGE_REL_BASED_RELPTR: return (SSIZE_T)*(UNALIGNED TADDR *)pLocation; @@ -607,7 +579,6 @@ void DataImage::NoteReusedStructure(const void *data) } } -#ifndef BINDER // Save the info of an RVA into m_rvaInfoVector. void DataImage::StoreRvaInfo(FieldDesc * pFD, DWORD rva, @@ -626,7 +597,6 @@ void DataImage::StoreRvaInfo(FieldDesc * pFD, m_rvaInfoVector.Append(rvaInfo); } -#endif // qsort compare function. // Primary key: rva (ascending order). Secondary key: size (descending order). @@ -642,7 +612,6 @@ int __cdecl DataImage::rvaInfoVectorEntryCmp(const void* a_, const void* b_) return (int)(b->size - a->size); // Descending order on size } -#ifndef BINDER // Sort the list of RVA statics in an ascending order wrt the RVA and save them. // For RVA structures with the same RVA, we will only store the one with the largest size. void DataImage::SaveRvaStructure() @@ -681,7 +650,6 @@ void DataImage::SaveRvaStructure() previousRvaInfo = rvaInfo; } } -#endif // !BINDER void DataImage::RegisterSurrogate(PVOID ptr, PVOID surrogate) { @@ -926,7 +894,6 @@ void DataImage::FixupRVAs() STANDARD_VM_CONTRACT; FixupModuleRVAs(); -#ifndef BINDER FixupRvaStructure(); if (m_module->m_pCerNgenRootTable != NULL) @@ -935,8 +902,6 @@ void DataImage::FixupRVAs() // Dev11 bug 181494 instrumentation if (m_Fixups.GetCount() != m_iCurrentFixup) EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); -#endif // !BINDER - qsort(&m_Fixups[0], m_Fixups.GetCount(), sizeof(FixupEntry), fixupEntryCmp); // Sentinel @@ -949,14 +914,12 @@ void DataImage::FixupRVAs() m_Fixups.Append(entry); -#ifndef BINDER // Dev11 bug 181494 instrumentation if (m_Fixups.GetCount() -1 != m_iCurrentFixup) EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE); -#endif + m_iCurrentFixup = 0; } -#ifndef BINDER void DataImage::SetRVAsForFields(IMetaDataEmit * pEmit) { for (COUNT_T i=0; iSetRVA(rvaInfo->pFD->GetMemberDef(), dwOffset); } } -#endif // !BINDER void ZapStoredStructure::Save(ZapWriter * pWriter) { @@ -1128,8 +1090,6 @@ void DataImage::FixupModuleRVAs() FixupFieldToNode(m_module->m_pNGenLayoutInfo, offsetof(NGenLayoutInfo, m_rvaFilterPersonalityRoutine), pFilterPersonalityRoutine, 0, IMAGE_REL_BASED_ABSOLUTE); } -#ifndef BINDER - void DataImage::FixupRvaStructure() { STANDARD_VM_CONTRACT; @@ -2571,5 +2531,4 @@ void DataImage::StoreCompressedLayoutMap(LookupMapBase *pMap, ItemKind kind) AddStructureInOrder(pNode); } -#endif // !BINDER #endif // FEATURE_PREJIT diff --git a/src/vm/dataimage.h b/src/vm/dataimage.h index d4420ca47b..5d48a710e7 100644 --- a/src/vm/dataimage.h +++ b/src/vm/dataimage.h @@ -206,11 +206,7 @@ public: InlineTrackingMap *m_inlineTrackingMap; public: -#ifndef CLR_STANDALONE_BINDER DataImage(Module *module, CEEPreloader *preloader); -#else - DataImage(Module *module, ZapImage *pZapImage); -#endif ~DataImage(); void Preallocate(); @@ -400,21 +396,13 @@ public: void FixupMethodDescPointer(MethodDesc * pMD, PVOID p, SSIZE_T offset, ZapRelocationType type); void FixupFieldDescPointer(FieldDesc * pFD, PVOID p, SSIZE_T offset, ZapRelocationType type); -#ifndef CLR_STANDALONE_BINDER void FixupModulePointer(PVOID p, FixupPointer * ppModule); -#else - void FixupModulePointer(PVOID p, FixupPointer * ppModule); -#endif void FixupMethodTablePointer(PVOID p, FixupPointer * ppMT); void FixupTypeHandlePointer(PVOID p, FixupPointer * pth); void FixupMethodDescPointer(PVOID p, FixupPointer * ppMD); void FixupFieldDescPointer(PVOID p, FixupPointer * ppFD); -#ifndef CLR_STANDALONE_BINDER void FixupModulePointer(PVOID p, RelativeFixupPointer * ppModule); -#else - void FixupModulePointer(PVOID p, RelativeFixupPointer * ppModule); -#endif void FixupMethodTablePointer(PVOID p, RelativeFixupPointer * ppMT); void FixupTypeHandlePointer(PVOID p, RelativeFixupPointer * pth); void FixupMethodDescPointer(PVOID p, RelativeFixupPointer * ppMD); diff --git a/src/vm/debuginfostore.cpp b/src/vm/debuginfostore.cpp index 3e09163a21..04e23bdd98 100644 --- a/src/vm/debuginfostore.cpp +++ b/src/vm/debuginfostore.cpp @@ -315,15 +315,6 @@ void DoNativeVarInfo( trans.DoEncodedStackOffset(pVar->loc.vlStk.vlsOffset); break; -#ifdef MDIL - case ICorDebugInfo::VLT_STK | ICorDebugInfo::VLT_MDIL_SYMBOLIC: - case ICorDebugInfo::VLT_STK_BYREF | ICorDebugInfo::VLT_MDIL_SYMBOLIC: // fall through - _ASSERTE(pVar->loc.vlStk.vlsOffset >= 0); - trans.DoEncodedRegIdx(pVar->loc.vlStk.vlsBaseReg); - trans.DoEncodedU32((DWORD&)pVar->loc.vlStk.vlsOffset); - break; -#endif // MDIL - case ICorDebugInfo::VLT_REG_REG: trans.DoEncodedRegIdx(pVar->loc.vlRegReg.vlrrReg1); trans.DoEncodedRegIdx(pVar->loc.vlRegReg.vlrrReg2); @@ -335,43 +326,17 @@ void DoNativeVarInfo( trans.DoEncodedStackOffset(pVar->loc.vlRegStk.vlrsStk.vlrssOffset); break; -#ifdef MDIL - case ICorDebugInfo::VLT_REG_STK | ICorDebugInfo::VLT_MDIL_SYMBOLIC: - _ASSERTE(pVar->loc.vlRegStk.vlrsStk.vlrssOffset >= 0); - trans.DoEncodedRegIdx(pVar->loc.vlRegStk.vlrsReg); - trans.DoEncodedRegIdx(pVar->loc.vlRegStk.vlrsStk.vlrssBaseReg); - trans.DoEncodedU32((DWORD&)pVar->loc.vlRegStk.vlrsStk.vlrssOffset); - break; -#endif // MDIL - case ICorDebugInfo::VLT_STK_REG: trans.DoEncodedStackOffset(pVar->loc.vlStkReg.vlsrStk.vlsrsOffset); trans.DoEncodedRegIdx(pVar->loc.vlStkReg.vlsrStk.vlsrsBaseReg); trans.DoEncodedRegIdx(pVar->loc.vlStkReg.vlsrReg); break; -#ifdef MDIL - case ICorDebugInfo::VLT_STK_REG | ICorDebugInfo::VLT_MDIL_SYMBOLIC: - _ASSERTE(pVar->loc.vlStkReg.vlsrStk.vlsrsOffset >= 0); - trans.DoEncodedU32((DWORD&)pVar->loc.vlStkReg.vlsrStk.vlsrsOffset); - trans.DoEncodedRegIdx(pVar->loc.vlStkReg.vlsrStk.vlsrsBaseReg); - trans.DoEncodedRegIdx(pVar->loc.vlStkReg.vlsrReg); - break; -#endif // MDIL - case ICorDebugInfo::VLT_STK2: trans.DoEncodedRegIdx(pVar->loc.vlStk2.vls2BaseReg); trans.DoEncodedStackOffset(pVar->loc.vlStk2.vls2Offset); break; -#ifdef MDIL - case ICorDebugInfo::VLT_STK2 | ICorDebugInfo::VLT_MDIL_SYMBOLIC: - _ASSERTE(pVar->loc.vlStk2.vls2Offset >= 0); - trans.DoEncodedRegIdx(pVar->loc.vlStk2.vls2BaseReg); - trans.DoEncodedU32((DWORD&)pVar->loc.vlStk2.vls2Offset); - break; -#endif // MDIL - case ICorDebugInfo::VLT_FPSTK: trans.DoEncodedUnsigned(pVar->loc.vlFPstk.vlfReg); break; @@ -670,7 +635,6 @@ void CompressDebugInfo::EnumMemoryRegions(CLRDataEnumMemoryFlags flags, PTR_BYTE } #endif // DACCESS_COMPILE -#ifndef BINDER // Init given a starting address from the start of code. void DebugInfoRequest::InitFromStartingAddr(MethodDesc * pMD, PCODE addrCode) { @@ -745,5 +709,3 @@ void DebugInfoManager::EnumMemoryRegionsForMethodDebugInfo(CLRDataEnumMemoryFlag pJitMan->EnumMemoryRegionsForMethodDebugInfo(flags, pMD); } #endif - -#endif // BINDER diff --git a/src/vm/decodemd.h b/src/vm/decodemd.h index 04626b4f2f..e6c6145bc0 100644 --- a/src/vm/decodemd.h +++ b/src/vm/decodemd.h @@ -53,7 +53,6 @@ private: // -------------------------------------------------------- // This is used to encode a bitstream encoding -#ifndef BINDER class Encoder { public: @@ -75,5 +74,4 @@ private: BOOL signedNumbers; unsigned index; }; -#endif // !BINDER #endif // __DECODEMD_H__ diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp index d75fa1183b..1332c72d1b 100644 --- a/src/vm/dllimport.cpp +++ b/src/vm/dllimport.cpp @@ -2584,15 +2584,7 @@ void NDirectStubLinker::DoNDirect(ILCodeStream *pcsEmit, DWORD dwStubFlags, Meth #endif // FEATURE_COMINTEROP { EmitLoadStubContext(pcsEmit, dwStubFlags); - -#ifdef MDIL - if (GetAppDomain()->IsMDILCompilationDomain()) - { - // GetNDirectTarget is understood by the compiler and generates the CALL_PINVOKE instruction - pcsEmit->EmitCALL(pcsEmit->GetToken(MscorlibBinder::GetMethod(METHOD__STUBHELPERS__GET_NDIRECT_TARGET)), 1, 1); - } - else -#endif // MDIL + { // Perf: inline the helper for now //pcsEmit->EmitCALL(METHOD__STUBHELPERS__GET_NDIRECT_TARGET, 1, 1); diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp index 0c6e4fcdc1..5d2a95ffb2 100644 --- a/src/vm/domainfile.cpp +++ b/src/vm/domainfile.cpp @@ -3447,18 +3447,6 @@ void DomainAssembly::GetOptimizedIdentitySignature(CORCOMPILE_ASSEMBLY_SIGNATURE PEImageLayoutHolder ilLayout(GetFile()->GetAnyILWithRef()); pSignature->timeStamp = ilLayout->GetTimeDateStamp(); pSignature->ilImageSize = ilLayout->GetVirtualSize(); -#ifdef MDIL - if (g_fIsNGenEmbedILProcess) - { - PEImageHolder pILImage(GetFile()->GetILimage()); - DWORD dwActualILSize; - if (pILImage->GetLoadedLayout()->GetILSizeFromMDILCLRCtlData(&dwActualILSize)) - { - // Use actual source IL size instead of MDIL size - pSignature->ilImageSize = dwActualILSize; - } - } -#endif // MDIL } BOOL DomainAssembly::CheckZapDependencyIdentities(PEImage *pNativeImage) diff --git a/src/vm/ecall.cpp b/src/vm/ecall.cpp index 858a5811d5..f3b0099e57 100644 --- a/src/vm/ecall.cpp +++ b/src/vm/ecall.cpp @@ -223,12 +223,8 @@ DWORD ECall::GetIDForMethod(MethodDesc *pMD) } CONTRACTL_END; -#ifndef MDIL // We should not go here for NGened methods - // However, we will come here for MDIL binder generated images because the - // IDs for FCALLS are not exernally known (and certainly not constant). _ASSERTE(!pMD->IsZapped()); -#endif INT ImplsIndex = FindImplsIndexForClass(pMD->GetMethodTable()); if (ImplsIndex < 0) diff --git a/src/vm/eehash.h b/src/vm/eehash.h index e6177e0026..8e92ad35d9 100644 --- a/src/vm/eehash.h +++ b/src/vm/eehash.h @@ -561,10 +561,8 @@ public: } }; -#ifndef BINDER typedef EEHashTable, FALSE> EEPtrHashTable; typedef DPTR(EEPtrHashTable) PTR_EEPtrHashTable; -#endif // !BINDER // Define a hash of generic instantiations (represented by a SigTypeContext). class EEInstantiationHashTableHelper diff --git a/src/vm/exceptmacros.h b/src/vm/exceptmacros.h index 5808102504..250f23140d 100644 --- a/src/vm/exceptmacros.h +++ b/src/vm/exceptmacros.h @@ -483,18 +483,14 @@ extern DWORD g_ExceptionLine; #define ENDCANNOTTHROWCOMPLUSEXCEPTION_SEH() #define COMPlusThrow RealCOMPlusThrow -#ifndef CLR_STANDALONE_BINDER #define COMPlusThrowNonLocalized RealCOMPlusThrowNonLocalized -#endif // !CLR_STANDALONE_BINDER #ifndef DACCESS_COMPILE #define COMPlusThrowHR RealCOMPlusThrowHR #else #define COMPlusThrowHR ThrowHR #endif #define COMPlusThrowWin32 RealCOMPlusThrowWin32 -#ifndef CLR_STANDALONE_BINDER #define COMPlusThrowOM RealCOMPlusThrowOM -#endif // !CLR_STANDALONE_BINDER #ifdef FEATURE_STACK_PROBE #define COMPlusThrowSO RealCOMPlusThrowSO #endif diff --git a/src/vm/fcall.h b/src/vm/fcall.h index a95a2058ba..a952da1294 100644 --- a/src/vm/fcall.h +++ b/src/vm/fcall.h @@ -211,7 +211,7 @@ // -#if !defined(__FCall_h__) && !defined(CLR_STANDALONE_BINDER) +#ifndef __FCall_h__ #define __FCall_h__ #include "gms.h" diff --git a/src/vm/field.h b/src/vm/field.h index cb7bc0a798..e3e3ccd013 100644 --- a/src/vm/field.h +++ b/src/vm/field.h @@ -10,12 +10,8 @@ #ifndef _FIELD_H_ #define _FIELD_H_ -#ifndef BINDER #include "objecthandle.h" #include "excep.h" -#else // BINDER -#include "methodtable.h" -#endif // BINDER // Temporary values stored in FieldDesc m_dwOffset during loading // The high 5 bits must be zero (because in field.h we steal them for other uses), so we must choose values > 0 @@ -40,9 +36,6 @@ class FieldDesc { friend class MethodTableBuilder; -#ifdef BINDER - friend class MdilModule; -#endif // BINDER #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif @@ -99,16 +92,6 @@ class FieldDesc FieldDesc() {}; public: -#ifdef BINDER - // We will need these to implement pseudoinstructions COPY_STRUCT, - // PUSH_STRUCT (versionable struct support). - // They are implemented via a side hash table in MdilModule - DWORD GetFieldValueTypeToken(); - void SetFieldValueTypeToken(DWORD valueTypeToken); - MethodTable *GetFieldFullType(); - void SetFieldFullType(MethodTable *mt); -#endif - #ifdef _DEBUG inline LPUTF8 GetDebugName() { @@ -186,19 +169,6 @@ public: // code:MethodTableBuilder.InitializeFieldDescs#FieldDescTypeMorph return (CorElementType) m_type; } -#ifdef BINDER - void SetFieldType(CorElementType type) - { - - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - // Set in code:FieldDesc.Init which in turn is called from - // code:MethodTableBuilder.InitializeFieldDescs#InitCall which in turn calls - // code:MethodTableBuilder.InitializeFieldDescs#FieldDescTypeMorph - m_type = type; - } -#endif DWORD GetFieldProtection() { @@ -264,7 +234,6 @@ public: DWORD rva; -#ifndef BINDER // I'm discarding a potential error here. According to the code in MDInternalRO.cpp, // we won't get an error if we initially found the RVA. So I'm going to just // assert it never happens. @@ -273,10 +242,6 @@ public: HRESULT hr; hr = GetMDImport()->GetFieldRVA(GetMemberDef(), &rva); _ASSERTE(SUCCEEDED(hr)); -#else // BINDER - BOOL fSucceeded = GetRVAOffsetForFieldDesc(this, &rva); - assert(fSucceeded); -#endif // BINDER return rva; } @@ -310,18 +275,13 @@ public: m_dwOffset = (dwOffset > FIELD_OFFSET_LAST_REAL_OFFSET) ? FIELD_OFFSET_BIG_RVA : dwOffset; -#ifdef BINDER - StoreRVAOffsetForFieldDesc(this, dwOffset); -#endif } - -#ifndef BINDER + BOOL IsILOnlyRVAField() { WRAPPER_NO_CONTRACT; return (IsRVA() && GetModule()->GetFile()->IsILOnly()); } -#endif // !BINDER DWORD IsStatic() const { @@ -483,11 +443,7 @@ public: BOOL IsSharedByGenericInstantiations() { LIMITED_METHOD_DAC_CONTRACT; -#ifndef BINDER return (!IsStatic()) && GetApproxEnclosingMethodTable()->IsSharedByGenericInstantiations(); -#else // BINDER - return FALSE; -#endif // BINDER } BOOL IsFieldOfValueType() @@ -502,9 +458,6 @@ public: return GetApproxEnclosingMethodTable()->GetNumGenericArgs(); } - -#ifndef BINDER - PTR_BYTE GetBaseInDomainLocalModule(DomainLocalModule * pLocalModule) { WRAPPER_NO_CONTRACT; @@ -696,25 +649,7 @@ public: GetEnclosingMethodTable()->CheckRunClassInitThrowing(); } #endif //DACCESS_COMPILE -#endif // !BINDER - -#ifdef BINDER - MdilModule *GetModule() - { - WRAPPER_NO_CONTRACT; - - return GetApproxEnclosingMethodTable()->GetModule(); - } - - MdilModule *GetLoaderModule() - { - WRAPPER_NO_CONTRACT; - // Field Desc's are currently always saved into the same module as their - // corresponding method table. - return GetApproxEnclosingMethodTable()->GetLoaderModule(); - } -#else //!BINDER Module *GetModule() { LIMITED_METHOD_DAC_CONTRACT; @@ -913,7 +848,6 @@ public: WRAPPER_NO_CONTRACT; return GetFieldTypeHandleThrowing(CLASS_LOAD_APPROXPARENTS, TRUE); } -#endif // !BINDER // Given a type handle of an object and a method that comes from some // superclass of the class of that object, find the instantiation of @@ -946,57 +880,5 @@ public: #endif }; -#ifdef BINDER -inline VOID FieldDesc::Init(mdFieldDef mb, CorElementType FieldType, DWORD dwMemberAttrs, BOOL fIsStatic, BOOL fIsRVA, BOOL fIsThreadLocal, BOOL fIsContextLocal, LPCSTR pszFieldName) -{ - - LIMITED_METHOD_CONTRACT; - - // We allow only a subset of field types here - all objects must be set to TYPE_CLASS - // By-value classes are ELEMENT_TYPE_VALUETYPE - _ASSERTE( - FieldType == ELEMENT_TYPE_I1 || - FieldType == ELEMENT_TYPE_BOOLEAN || - FieldType == ELEMENT_TYPE_U1 || - FieldType == ELEMENT_TYPE_I2 || - FieldType == ELEMENT_TYPE_U2 || - FieldType == ELEMENT_TYPE_CHAR || - FieldType == ELEMENT_TYPE_I4 || - FieldType == ELEMENT_TYPE_U4 || - FieldType == ELEMENT_TYPE_I8 || - FieldType == ELEMENT_TYPE_I || - FieldType == ELEMENT_TYPE_U || - FieldType == ELEMENT_TYPE_U8 || - FieldType == ELEMENT_TYPE_R4 || - FieldType == ELEMENT_TYPE_R8 || - FieldType == ELEMENT_TYPE_CLASS || - FieldType == ELEMENT_TYPE_VALUETYPE || - FieldType == ELEMENT_TYPE_PTR || - FieldType == ELEMENT_TYPE_FNPTR - ); - _ASSERTE(fIsStatic || (!fIsRVA && !fIsThreadLocal && !fIsContextLocal)); - _ASSERTE(fIsRVA + fIsThreadLocal + fIsContextLocal <= 1); - - m_mb = RidFromToken(mb); - m_type = FieldType; - m_prot = fdFieldAccessMask & dwMemberAttrs; - m_isStatic = fIsStatic != 0; - m_isRVA = fIsRVA != 0; - m_isThreadLocal = fIsThreadLocal != 0; -#ifdef FEATURE_REMOTING - m_isContextLocal = fIsContextLocal != 0; -#endif - -#ifdef _DEBUG - m_isDangerousAppDomainAgileField = 0; - m_debugName = (LPUTF8)pszFieldName; -#endif - _ASSERTE(GetMemberDef() == mb); // no truncation - _ASSERTE(GetFieldType() == FieldType); - _ASSERTE(GetFieldProtection() == (fdFieldAccessMask & dwMemberAttrs)); - _ASSERTE((BOOL) IsStatic() == (fIsStatic != 0)); -} -#endif // BINDER - #endif // _FIELD_H_ diff --git a/src/vm/fieldmarshaler.h b/src/vm/fieldmarshaler.h index d1f1a011dd..3c06528499 100644 --- a/src/vm/fieldmarshaler.h +++ b/src/vm/fieldmarshaler.h @@ -18,32 +18,17 @@ #ifndef __FieldMarshaler_h__ #define __FieldMarshaler_h__ -#ifdef BINDER - -//TritonToDo: why don't we use the value from vm\\cgencpu.h ?? -#if defined(_X86_) || defined(_ARM_) -#define MAXFIELDMARSHALERSIZE 24 -#else -#error "port field marshaler size" -#endif - -typedef unsigned char U1; - -#else //BINDER #include "util.hpp" #include "mlinfo.h" #include "eeconfig.h" #include "olevariant.h" -#endif // BINDER #ifdef FEATURE_COMINTEROP #endif // FEATURE_COMINTEROP -#ifndef BINDER #ifdef FEATURE_PREJIT #include "compile.h" #endif // FEATURE_PREJIT -#endif // BINDER // Forward refernces class EEClassLayoutInfo; @@ -276,11 +261,6 @@ VOID FmtValueTypeUpdateCLR(LPVOID pProtectedManagedData, MethodTable *pMT, BYTE class FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif - public: VOID UpdateNative(OBJECTREF* pCLRValue, LPVOID pNativeValue, OBJECTREF *ppCleanupWorkListOnStack) const; VOID UpdateCLR(const VOID *pNativeValue, OBJECTREF *ppProtectedCLRValue, OBJECTREF *ppProtectedOldCLRValue) const; @@ -361,11 +341,9 @@ public: } CONTRACTL_END; -#ifndef BINDER #ifdef FEATURE_PREJIT Module::RestoreFieldDescPointer(&m_pFD); #endif // FEATURE_PREJIT -#endif // BINDER } void SetFieldDesc(FieldDesc* pFD) @@ -422,14 +400,12 @@ protected: } CONTRACTL_END; -#ifndef BINDER #ifdef FEATURE_PREJIT Module::RestoreMethodTablePointer(ppMT); #else // FEATURE_PREJIT // without NGEN we only have to make sure that the type is fully loaded ClassLoader::EnsureLoaded(ppMT->GetValue()); #endif // FEATURE_PREJIT -#endif // BINDER } #ifdef _DEBUG @@ -488,11 +464,6 @@ public: //======================================================================= class FieldMarshaler_Nullable : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif - public: FieldMarshaler_Nullable(MethodTable* pMT) @@ -613,10 +584,6 @@ public: //======================================================================= class FieldMarshaler_NestedLayoutClass : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: FieldMarshaler_NestedLayoutClass(MethodTable *pMT) { @@ -691,10 +658,6 @@ private: //======================================================================= class FieldMarshaler_NestedValueClass : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: FieldMarshaler_NestedValueClass(MethodTable *pMT) { @@ -800,10 +763,6 @@ public: //======================================================================= class FieldMarshaler_StringAnsi : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: FieldMarshaler_StringAnsi(BOOL BestFit, BOOL ThrowOnUnmappableChar) : m_BestFitMap(!!BestFit), m_ThrowOnUnmappableChar(!!ThrowOnUnmappableChar) @@ -840,10 +799,6 @@ private: //======================================================================= class FieldMarshaler_FixedStringUni : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: VOID UpdateNativeImpl(OBJECTREF* pCLRValue, LPVOID pNativeValue, OBJECTREF *ppCleanupWorkListOnStack) const; VOID UpdateCLRImpl(const VOID *pNativeValue, OBJECTREF *ppProtectedCLRValue, OBJECTREF *ppProtectedOldCLRValue) const; @@ -867,10 +822,6 @@ private: //======================================================================= class FieldMarshaler_FixedStringAnsi : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: FieldMarshaler_FixedStringAnsi(UINT32 numChar, BOOL BestFitMap, BOOL ThrowOnUnmappableChar) : m_numchar(numChar), m_BestFitMap(!!BestFitMap), m_ThrowOnUnmappableChar(!!ThrowOnUnmappableChar) @@ -908,10 +859,6 @@ private: //======================================================================= class FieldMarshaler_FixedCharArrayAnsi : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: FieldMarshaler_FixedCharArrayAnsi(UINT32 numElems, BOOL BestFit, BOOL ThrowOnUnmappableChar) : m_numElems(numElems), m_BestFitMap(!!BestFit), m_ThrowOnUnmappableChar(!!ThrowOnUnmappableChar) @@ -949,10 +896,6 @@ private: //======================================================================= class FieldMarshaler_FixedArray : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: FieldMarshaler_FixedArray(IMDInternalImport *pMDImport, mdTypeDef cl, UINT32 numElems, VARTYPE vt, MethodTable* pElementMT); @@ -965,12 +908,8 @@ public: { LIMITED_METHOD_CONTRACT; -#ifdef BINDER - return 0; -#else MethodTable *pElementMT = m_arrayType.GetValue().AsArray()->GetArrayElementTypeHandle().GetMethodTable(); return OleVariant::GetElementSizeForVarType(m_vt, pElementMT) * m_numElems; -#endif } TypeHandle GetElementTypeHandle() const @@ -1014,14 +953,12 @@ public: } CONTRACTL_END; -#ifndef BINDER #ifdef FEATURE_PREJIT Module::RestoreTypeHandlePointer(&m_arrayType); #else // FEATURE_PREJIT // without NGEN we only have to make sure that the type is fully loaded ClassLoader::EnsureLoaded(m_arrayType.GetValue()); #endif // FEATURE_PREJIT -#endif FieldMarshaler::RestoreImpl(); } @@ -1053,10 +990,6 @@ private: //======================================================================= class FieldMarshaler_SafeArray : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: VOID UpdateNativeImpl(OBJECTREF* pCLRValue, LPVOID pNativeValue, OBJECTREF *ppCleanupWorkListOnStack) const; @@ -1139,10 +1072,6 @@ private: //======================================================================= class FieldMarshaler_Delegate : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: FieldMarshaler_Delegate(MethodTable* pMT) { @@ -1246,10 +1175,6 @@ public: //======================================================================= class FieldMarshaler_Interface : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: VOID UpdateNativeImpl(OBJECTREF* pCLRValue, LPVOID pNativeValue, OBJECTREF *ppCleanupWorkListOnStack) const; @@ -1594,10 +1519,6 @@ public: class FieldMarshaler_Ansi : public FieldMarshaler { -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: FieldMarshaler_Ansi(BOOL BestFitMap, BOOL ThrowOnUnmappableChar) : m_BestFitMap(!!BestFitMap), m_ThrowOnUnmappableChar(!!ThrowOnUnmappableChar) @@ -1610,7 +1531,6 @@ public: SCALAR_MARSHALER_IMPL(sizeof(CHAR), sizeof(CHAR)) -#ifndef BINDER VOID ScalarUpdateNativeImpl(LPVOID pCLR, LPVOID pNative) const { CONTRACTL @@ -1633,7 +1553,6 @@ public: *((char*)pNative) = c; } -#endif VOID ScalarUpdateCLRImpl(const VOID *pNative, LPVOID pCLR) const { diff --git a/src/vm/genericdict.h b/src/vm/genericdict.h index c40223fed7..e63b3c8f03 100644 --- a/src/vm/genericdict.h +++ b/src/vm/genericdict.h @@ -66,7 +66,6 @@ enum DictionaryEntryKind DeclaringTypeHandleSlot = 7, }; -#ifndef BINDER class DictionaryEntryLayout { public: @@ -156,7 +155,6 @@ public: #endif // FEATURE_PREJIT }; -#endif // BINDER // The type of dictionaries. This is just an abstraction around an open-ended array @@ -264,7 +262,6 @@ class Dictionary public: -#ifndef BINDER #ifdef FEATURE_PREJIT // Fixup the dictionary entries, including the type arguments @@ -295,7 +292,6 @@ class Dictionary DWORD numGenericArgs); void Restore(DWORD numGenericArgs, ClassLoadLevel level); #endif // FEATURE_PREJIT -#endif // BINDER }; #endif diff --git a/src/vm/generics.inl b/src/vm/generics.inl index cb3c65a572..df60ff951e 100644 --- a/src/vm/generics.inl +++ b/src/vm/generics.inl @@ -34,11 +34,7 @@ namespace Generics #ifdef FEATURE_COMINTEROP WORD wNumInterfaces = static_cast(pOldMT->GetNumInterfaces()); -#ifdef CLR_STANDALONE_BINDER - InterfaceInfo_t * pOldIMap = BinderMethodTable::GetInterfaceMap(pOldMT); -#else // !CLR_STANDALONE_BINDER InterfaceInfo_t * pOldIMap = (InterfaceInfo_t *)pOldMT->GetInterfaceMap(); -#endif // !CLR_STANDALONE_BINDER BOOL fHasGuidInfo = FALSE; @@ -77,12 +73,8 @@ namespace Generics { // If the class implements a generic WinRT interface, it needs its own (per-instantiation) // CCW template as the one on EEClass would be shared and hence useless. -#ifdef CLR_STANDALONE_BINDER - MethodTable *pItfMT = pOldIMap[iItf].m_pMethodTable.GetValue(); -#else // !CLR_STANDALONE_BINDER OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(CLASS_LOAD_APPROXPARENTS); MethodTable *pItfMT = pOldIMap[iItf].GetApproxMethodTable(pOldMT->GetLoaderModule()); -#endif // !CLR_STANDALONE_BINDER if (pItfMT->HasInstantiation() && (pItfMT->IsProjectedFromWinRT() || WinRTTypeNameConverter::IsRedirectedType(pItfMT, WinMDAdapter::WinMDTypeKind_PInterface))) { diff --git a/src/vm/i386/cgencpu.h b/src/vm/i386/cgencpu.h index 917d731783..d1684290e4 100644 --- a/src/vm/i386/cgencpu.h +++ b/src/vm/i386/cgencpu.h @@ -294,8 +294,6 @@ inline INT32 rel32UsingJumpStub(INT32 UNALIGNED * pRel32, PCODE target, MethodDe return (INT32)(target - baseAddr); } -#ifndef CLR_STANDALONE_BINDER - #ifdef FEATURE_COMINTEROP inline void emitCOMStubCall (ComCallMethodDesc *pCOMMethod, PCODE target) { @@ -525,8 +523,6 @@ struct HijackArgs }; }; -#endif //!CLR_STANDALONE_BINDER - // ClrFlushInstructionCache is used when we want to call FlushInstructionCache // for a specific architecture in the common code, but not for other architectures. // On IA64 ClrFlushInstructionCache calls the Kernel FlushInstructionCache function diff --git a/src/vm/i386/stublinkerx86.h b/src/vm/i386/stublinkerx86.h index f3785f730a..237fc794d4 100644 --- a/src/vm/i386/stublinkerx86.h +++ b/src/vm/i386/stublinkerx86.h @@ -5,9 +5,7 @@ #ifndef STUBLINKERX86_H_ #define STUBLINKERX86_H_ -#ifndef CLR_STANDALONE_BINDER #include "stublink.h" -#endif // !CLR_STANDALONE_BINDER struct ArrayOpScript; class MetaSig; @@ -158,7 +156,6 @@ class X86CondCode { //---------------------------------------------------------------------- // StubLinker with extensions for generating X86 code. //---------------------------------------------------------------------- -#ifndef CLR_STANDALONE_BINDER class StubLinkerCPU : public StubLinker { public: @@ -438,7 +435,6 @@ class StubLinkerCPU : public StubLinker static void Init(); }; -#endif // !CLR_STANDALONE_BINDER inline TADDR rel32Decode(/*PTR_INT32*/ TADDR pRel32) { diff --git a/src/vm/ilstubcache.cpp b/src/vm/ilstubcache.cpp index 5782d4aeb9..426976a344 100644 --- a/src/vm/ilstubcache.cpp +++ b/src/vm/ilstubcache.cpp @@ -81,7 +81,6 @@ void CreateModuleIndependentSignature(LoaderHeap* pCreationHeap, *pcbNewSig = cbNewSig; } -#ifndef CLR_STANDALONE_BINDER // static MethodDesc* ILStubCache::CreateAndLinkNewILStubMethodDesc(LoaderAllocator* pAllocator, MethodTable* pMT, DWORD dwStubFlags, Module* pSigModule, PCCOR_SIGNATURE pSig, DWORD cbSig, SigTypeContext *pTypeContext, @@ -137,7 +136,6 @@ MethodDesc* ILStubCache::CreateAndLinkNewILStubMethodDesc(LoaderAllocator* pAllo RETURN pStubMD; } -#endif // static MethodDesc* ILStubCache::CreateNewMethodDesc(LoaderHeap* pCreationHeap, MethodTable* pMT, DWORD dwStubFlags, diff --git a/src/vm/ilstubcache.h b/src/vm/ilstubcache.h index abd4363920..732cc8f146 100644 --- a/src/vm/ilstubcache.h +++ b/src/vm/ilstubcache.h @@ -19,9 +19,7 @@ #include "util.hpp" #include "crst.h" #include "ngenhash.h" -#ifndef CLR_STANDALONE_BINDER #include "stubgen.h" -#endif class ILStubHashBlobBase { @@ -85,7 +83,6 @@ public: void AddMethodDescChunkWithLockTaken(MethodDesc *pMD); -#ifndef CLR_STANDALONE_BINDER static MethodDesc* CreateAndLinkNewILStubMethodDesc( LoaderAllocator* pAllocator, MethodTable* pMT, @@ -95,7 +92,7 @@ public: DWORD cbSig, SigTypeContext *pTypeContext, ILStubLinker* pStubLinker); -#endif + MethodTable * GetStubMethodTable() { LIMITED_METHOD_CONTRACT; @@ -187,9 +184,6 @@ private: PTR_MethodDesc pMD; PTR_MethodDesc pStubMD; -#ifdef BINDER - friend class MdilModule; -#endif } StubMethodHashEntry_t; diff --git a/src/vm/instmethhash.h b/src/vm/instmethhash.h index 95d7cd3283..1aa4e59f1e 100644 --- a/src/vm/instmethhash.h +++ b/src/vm/instmethhash.h @@ -65,10 +65,6 @@ private: friend class NativeImageDumper; #endif -#ifdef BINDER - friend class MdilModule; -#endif - PTR_MethodDesc data; } InstMethodHashEntry_t; diff --git a/src/vm/method.hpp b/src/vm/method.hpp index d264a0d48c..0cdba004e1 100644 --- a/src/vm/method.hpp +++ b/src/vm/method.hpp @@ -13,8 +13,6 @@ #ifndef _METHOD_H #define _METHOD_H -#ifndef BINDER - #include "cor.h" #include "util.hpp" #include "clsload.hpp" @@ -31,13 +29,6 @@ #ifndef FEATURE_PREJIT #include "fixuppointer.h" #endif -#else // BINDER - -#include "fixuppointer.h" - -#define COMPLUSCALL_METHOD_DESC_ALIGNPAD_BYTES 3 // # bytes required to pad ComPlusCallMethodDesc to correct size - -#endif // BINDER class Stub; class FCallMethodDesc; @@ -165,15 +156,6 @@ enum MethodDescClassification // Method requires linktime security checks. mdcRequiresLinktimeCheck = 0x0080, -#if defined(CLR_STANDALONE_BINDER) - // Binder optimization - we have already parsed the signature - // of this method desc and it contains no user-defined value types (including enums) - mdcSignatureHasNoValueTypes = 0x0100, - - // This should contain bits used for binder-internal purposes - reset these - // before persisting the method descs - mdcBinderBits = mdcSignatureHasNoValueTypes, -#else // Method requires inheritance security checks. // If this bit is set, then this method demands inheritance permissions // or a method that this method overrides demands inheritance permissions @@ -184,7 +166,6 @@ enum MethodDescClassification // This bit is used as an optimization to avoid looking up overridden methods // during the inheritance check. mdcParentRequiresInheritanceCheck = 0x0200, -#endif // Duplicate method. When a method needs to be placed in multiple slots in the // method table, because it could not be packed into one slot. For eg, a method @@ -303,7 +284,6 @@ public: return (m_bFlags2 & enum_flag2_HasPrecode) != 0; } -#ifndef BINDER inline Precode* GetPrecode() { LIMITED_METHOD_DAC_CONTRACT; @@ -313,7 +293,6 @@ public: PREFIX_ASSUME(pPrecode != NULL); return pPrecode; } -#endif // !BINDER inline BOOL MayHavePrecode() { @@ -328,22 +307,6 @@ public: return !MayHaveNativeCode() || IsRemotingInterceptedViaPrestub(); } -#ifdef BINDER - inline void SetHasPrecode() - { - LIMITED_METHOD_CONTRACT; - m_bFlags2 |= (enum_flag2_HasPrecode | enum_flag2_HasStableEntryPoint); - } - - inline void ResetHasPrecode() - { - - LIMITED_METHOD_CONTRACT; - m_bFlags2 &= ~enum_flag2_HasPrecode; - m_bFlags2 |= enum_flag2_HasStableEntryPoint; - } -#endif // BINDER - void InterlockedUpdateFlags2(BYTE bMask, BOOL fSet); Precode* GetOrCreatePrecode(); @@ -373,7 +336,6 @@ public: void PrecomputeNameHash(); BOOL MightHaveName(ULONG nameHashValue); -#ifndef BINDER FORCEINLINE LPCUTF8 GetNameOnNonArrayClass() { WRAPPER_NO_CONTRACT; @@ -384,7 +346,6 @@ public: } return szName; } -#endif // !BINDER COUNT_T GetStableHash(); @@ -457,13 +418,9 @@ public: FORCEINLINE BOOL IsMethodImpl() { LIMITED_METHOD_DAC_CONTRACT; -#ifndef BINDER // Once we stop allocating dummy MethodImplSlot in MethodTableBuilder::WriteMethodImplData, // the check for NULL will become unnecessary. return HasMethodImplSlot() && (GetMethodImpl()->GetSlots() != NULL); -#else // BINDER - return FALSE; -#endif // BINDER } inline DWORD IsStatic() @@ -567,15 +524,9 @@ public: inline BOOL IsDomainNeutral(); -#ifdef BINDER - MdilModule* GetLoaderModule(); - - MdilModule* GetZapModule(); -#else // !BINDER Module* GetLoaderModule(); Module* GetZapModule(); -#endif // Does this immediate item live in an NGEN module? BOOL IsZapped(); @@ -772,7 +723,6 @@ public: m_bFlags2 |= enum_flag2_CASDemandsOnly; } -#ifndef BINDER // If the method is in an Edit and Contine (EnC) module, then // we DON'T want to backpatch this, ever. We MUST always call // through the precode so that we can update the method. @@ -783,7 +733,6 @@ public: PREFIX_ASSUME(pModule != NULL); return pModule->IsEditAndContinueEnabled(); } -#endif // !BINDER inline BOOL IsNotInline() { @@ -846,7 +795,6 @@ public: BOOL MayBeRemotingIntercepted(); -#ifndef BINDER //================================================================ // Does it represent a one way method call with no out/return parameters? #ifdef FEATURE_REMOTING @@ -867,7 +815,6 @@ public: } #endif // FEATURE_REMOTING -#endif //================================================================ // FCalls. @@ -1000,8 +947,6 @@ public: MethodDesc *GetWrappedMethodDesc(); MethodDesc *GetExistingWrappedMethodDesc(); -#ifndef BINDER - //================================================================== // Access the underlying metadata @@ -1019,7 +964,6 @@ public: } COR_ILMETHOD* GetILHeader(BOOL fAllowOverrides = FALSE); -#endif // !BINDER BOOL HasStoredSig() { @@ -1031,8 +975,6 @@ public: void GetSig(PCCOR_SIGNATURE *ppSig, DWORD *pcSig); SigParser GetSigParser(); -#ifndef BINDER - // Convenience methods for common signature wrapper types. SigPointer GetSigPointer(); @@ -1069,7 +1011,6 @@ public: return pModule->GetRWImporter(); } #endif // !DACCESS_COMPILE -#endif // !BINDER #ifdef FEATURE_COMINTEROP WORD GetComSlot(); @@ -1218,9 +1159,6 @@ public: // class. inline MethodTable* GetCanonicalMethodTable(); -#ifdef BINDER - MdilModule *GetModule(); -#else Module *GetModule() const; Module *GetModule_NoLogging() const; @@ -1231,7 +1169,6 @@ public: PREFIX_ASSUME(pModule != NULL); return pModule->GetAssembly(); } -#endif // !BINDER //================================================================== // The slot number of this method in the corresponding method table. @@ -1271,13 +1208,6 @@ public: { SetRequiresFullSlotNumber(); } -#ifdef CLR_STANDALONE_BINDER - else if (RequiresFullSlotNumber()) - { - ClearRequiresFullSlotNumber(); - m_wSlotNumber = 0; - } -#endif // Set only the portion of m_wSlotNumber we are using if (!RequiresFullSlotNumber()) @@ -1302,15 +1232,6 @@ protected: m_wFlags |= mdcRequiresFullSlotNumber; } -#ifdef CLR_STANDALONE_BINDER - inline void ClearRequiresFullSlotNumber() - { - - LIMITED_METHOD_CONTRACT; - m_wFlags &= ~mdcRequiresFullSlotNumber; - } -#endif - inline DWORD RequiresFullSlotNumber() { LIMITED_METHOD_DAC_CONTRACT; @@ -1333,26 +1254,6 @@ public: return m_wFlags & mdcRequiresLinktimeCheck; } -#if defined(CLR_STANDALONE_BINDER) - inline BOOL SignatureHasNoValueTypes() - { - LIMITED_METHOD_CONTRACT; - return m_wFlags & mdcSignatureHasNoValueTypes; - } - - inline void SetSignatureHasNoValueTypes() - { - LIMITED_METHOD_CONTRACT; - m_wFlags |= mdcSignatureHasNoValueTypes; - } - - // Clear bits used for binder-internal purposes - inline void ClearBinderBits() - { - LIMITED_METHOD_CONTRACT; - m_wFlags &= ~mdcBinderBits; - } -#else inline DWORD RequiresInheritanceCheck() { LIMITED_METHOD_CONTRACT; @@ -1364,7 +1265,6 @@ public: LIMITED_METHOD_CONTRACT; return m_wFlags & mdcParentRequiresInheritanceCheck; } -#endif void SetRequiresLinktimeCheck() { @@ -1372,7 +1272,6 @@ public: m_wFlags |= mdcRequiresLinktimeCheck; } -#ifndef BINDER void SetRequiresInheritanceCheck() { LIMITED_METHOD_CONTRACT; @@ -1384,7 +1283,6 @@ public: LIMITED_METHOD_CONTRACT; m_wFlags |= mdcParentRequiresInheritanceCheck; } -#endif mdMethodDef GetMemberDef() const; mdMethodDef GetMemberDef_NoLogging() const; @@ -1423,11 +1321,7 @@ public: if (!HasPrecode()) return TRUE; -#ifdef BINDER - return TRUE; -#else // !BINDER return GetPrecode()->IsPointingToNativeCode(GetNativeCode()); -#endif // BINDER } // Be careful about races with profiler when using this method. The profiler can @@ -1827,11 +1721,7 @@ public: #else ; #endif -#ifdef BINDER - typedef void (*WalkValueTypeParameterFnPtr)(MdilModule *pModule, mdToken token, const SigParser *ptr, SigTypeContext *pTypeContext, void *pData); -#else typedef void (*WalkValueTypeParameterFnPtr)(Module *pModule, mdToken token, Module *pDefModule, mdToken tkDefToken, const SigParser *ptr, SigTypeContext *pTypeContext, void *pData); -#endif void WalkValueTypeParameters(MethodTable *pMT, WalkValueTypeParameterFnPtr function, void *pData); @@ -1985,19 +1875,19 @@ public: inline BOOL HaveValueTypeParametersBeenWalked() { LIMITED_METHOD_DAC_CONTRACT; -#ifndef CLR_STANDALONE_BINDER + // This should only be asked of non-Zapped MethodDescs, and only during execution (not compilation) _ASSERTE(!IsZapped() && !IsCompilationProcess()); -#endif + return (m_wFlags3AndTokenRemainder & enum_flag3_ValueTypeParametersWalked) != 0; } inline void SetValueTypeParametersWalked() { LIMITED_METHOD_CONTRACT; -#ifndef CLR_STANDALONE_BINDER + _ASSERTE(!IsZapped() && !IsCompilationProcess()); -#endif + InterlockedUpdateFlags3(enum_flag3_ValueTypeParametersWalked, TRUE); } @@ -2035,9 +1925,6 @@ class MethodDescChunk { friend class MethodDesc; friend class CheckAsmOffsets; -#ifdef BINDER - friend class MdilModule; -#endif #if defined(FEATURE_PREJIT) && !defined(DACCESS_COMPILE) friend class MethodDesc::SaveChunk; #endif @@ -2164,7 +2051,6 @@ public: } #endif // !DACCESS_COMPILE -#ifndef BINDER #ifdef FEATURE_PREJIT #ifndef DACCESS_COMPILE inline void RestoreMTPointer(ClassLoadLevel level = CLASS_LOADED) @@ -2174,7 +2060,6 @@ public: } #endif // !DACCESS_COMPILE #endif // FEATURE_PREJIT -#endif // !BINDER #ifndef DACCESS_COMPILE void SetNextChunk(MethodDescChunk *chunk) @@ -2326,9 +2211,7 @@ class StoredSigMethodDesc : public MethodDesc return (PCCOR_SIGNATURE) DacInstantiateTypeByAddress(m_pSig, m_cSig, true); #else // !DACCESS_COMPILE -#ifndef BINDER g_IBCLogger.LogNDirectCodeAccess(this); -#endif return (PCCOR_SIGNATURE)m_pSig; #endif // !DACCESS_COMPILE } @@ -2393,10 +2276,6 @@ class DynamicMethodDesc : public StoredSigMethodDesc #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif -#ifdef MDIL - friend class CompactTypeBuilder; - friend class MdilModule; -#endif protected: PTR_CUTF8 m_pszMethodName; @@ -3030,7 +2909,6 @@ public: // trigger at it link time as well because linking may depend on it - the // cctor may change the target DLL, change DLL search path etc. BOOL IsClassConstructorTriggeredAtLinkTime() -#ifndef CLR_STANDALONE_BINDER { LIMITED_METHOD_CONTRACT; MethodTable * pMT = GetMethodTable(); @@ -3039,25 +2917,18 @@ public: return FALSE; return !pMT->GetClass()->IsBeforeFieldInit(); } -#else - ; -#endif #ifndef DACCESS_COMPILE // In the shared domain and in NGENed code, we will trigger declarer's cctor // in the marshaling stub by calling code:StubHelpers.InitDeclaringType. If // this returns TRUE, the call must not be inlined. BOOL IsClassConstructorTriggeredByILStub() -#ifndef CLR_STANDALONE_BINDER { WRAPPER_NO_CONTRACT; return (IsClassConstructorTriggeredAtLinkTime() && (IsZapped() || GetDomain()->IsSharedDomain() || SystemDomain::GetCurrentDomain()->IsCompilationDomain())); } -#else - ; -#endif #endif //!DACCESS_COMPILE }; //class NDirectMethodDesc @@ -3234,7 +3105,6 @@ public: #ifndef FEATURE_CORECLR -#ifndef BINDER BOOL HasSuppressUnmanagedCodeAccessAttr() { LIMITED_METHOD_CONTRACT; @@ -3250,7 +3120,6 @@ public: NULL, NULL) == S_OK); } -#endif // !BINDER void SetSuppressUnmanagedCodeAccessAttr(BOOL value) { @@ -3357,10 +3226,6 @@ class InstantiatedMethodDesc : public MethodDesc friend class NativeImageDumper; #endif -#ifdef BINDER - friend class CompactTypeBuilder; - friend class MdilModule; -#endif public: // All varities of InstantiatedMethodDesc's support this method. @@ -3376,15 +3241,11 @@ public: // All varieties of InstantiatedMethodDesc's support this method. Instantiation IMD_GetMethodInstantiation() -#ifndef BINDER { LIMITED_METHOD_DAC_CONTRACT; return Instantiation(m_pPerInstInfo->GetInstantiation(), m_wNumGenericArgs); } -#else - ; // The binder requires a special implementation of this method as its methoddesc data structure holds the instantiation in a different way. -#endif PTR_Dictionary IMD_GetMethodDictionary() { @@ -3469,16 +3330,6 @@ public: return NULL; } -#ifdef BINDER - void IMD_SetDictionaryLayout(DictionaryLayout *dictionaryLayout) - { - - LIMITED_METHOD_CONTRACT; - - m_pDictLayout = dictionaryLayout; - } -#endif - MethodDesc* IMD_GetWrappedMethodDesc() { LIMITED_METHOD_CONTRACT; @@ -3591,7 +3442,6 @@ inline PTR_MethodTable MethodDesc::GetMethodTable() const return GetMethodTable_NoLogging(); } -#ifndef BINDER inline DPTR(RelativeFixupPointer) MethodDesc::GetMethodTablePtr() const { LIMITED_METHOD_DAC_CONTRACT; @@ -3607,7 +3457,6 @@ inline MethodTable* MethodDesc::GetCanonicalMethodTable() return GetMethodTable()->GetCanonicalMethodTable(); } -#endif // !BINDER inline mdMethodDef MethodDesc::GetMemberDef_NoLogging() const { @@ -3676,7 +3525,6 @@ inline void MethodDesc::SetMemberDef(mdMethodDef mb) #ifdef _DEBUG -#ifndef BINDER inline BOOL MethodDesc::SanityCheck() { CONTRACTL @@ -3701,18 +3549,13 @@ inline BOOL MethodDesc::SanityCheck() return TRUE; } -#endif // !BINDER #endif // _DEBUG inline BOOL MethodDesc::IsEnCAddedMethod() { LIMITED_METHOD_DAC_CONTRACT; -#ifdef BINDER - return FALSE; -#else // !BINDER return (GetClassification() == mcInstantiated) && AsInstantiatedMethodDesc()->IMD_IsEnCAddedMethod(); -#endif // !BINDER } inline BOOL MethodDesc::HasNonVtableSlot() @@ -3755,22 +3598,6 @@ inline BOOL MethodDesc::HasMethodInstantiation() const return mcInstantiated == GetClassification() && AsInstantiatedMethodDesc()->IMD_HasMethodInstantiation(); } -#ifdef BINDER -inline BOOL MethodDesc::IsTypicalMethodDefinition() const -{ - WRAPPER_NO_CONTRACT; - - if (HasMethodInstantiation() && !IsGenericMethodDefinition()) - return FALSE; - - if (HasClassInstantiation() && !GetMethodTable()->IsGenericTypeDefinition()) - return FALSE; - - return TRUE; -} -#endif // !BINDER - #include "method.inl" - #endif // !_METHOD_H diff --git a/src/vm/method.inl b/src/vm/method.inl index cd2ae11a61..d668216243 100644 --- a/src/vm/method.inl +++ b/src/vm/method.inl @@ -22,13 +22,11 @@ inline InstantiatedMethodDesc* MethodDesc::AsInstantiatedMethodDesc() const return dac_cast(this); } -#ifndef BINDER inline BOOL MethodDesc::IsDomainNeutral() { WRAPPER_NO_CONTRACT; return !IsLCGMethod() && GetDomain()->IsSharedDomain(); } -#endif // !BINDER inline BOOL MethodDesc::IsZapped() { @@ -58,7 +56,6 @@ inline SigParser MethodDesc::GetSigParser() return SigParser(pSig, cSig); } -#ifndef BINDER inline SigPointer MethodDesc::GetSigPointer() { WRAPPER_NO_CONTRACT; @@ -69,7 +66,6 @@ inline SigPointer MethodDesc::GetSigPointer() return SigPointer(pSig, cSig); } -#endif // !BINDER inline PTR_LCGMethodResolver DynamicMethodDesc::GetLCGMethodResolver() { @@ -209,13 +205,11 @@ inline BOOL HasTypeEquivalentStructParameters() } #endif // FEATURE_TYPEEQUIVALENCE -#ifndef BINDER inline ReJitManager * MethodDesc::GetReJitManager() { LIMITED_METHOD_CONTRACT; return GetModule()->GetReJitManager(); } -#endif // !BINDER #endif // _METHOD_INL_ diff --git a/src/vm/methodimpl.h b/src/vm/methodimpl.h index 18d6c97269..0646367f22 100644 --- a/src/vm/methodimpl.h +++ b/src/vm/methodimpl.h @@ -23,9 +23,6 @@ class MethodImpl #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif -#ifdef BINDER - friend class MdilModule; // this allows it to get the offset of pdwSlots and pImplementedMD -#endif PTR_DWORD pdwSlots; // Maintains the slots in sorted order, the first entry is the size DPTR(PTR_MethodDesc) pImplementedMD; diff --git a/src/vm/methodtable.cpp b/src/vm/methodtable.cpp index 401c2a72ab..056c7cb892 100644 --- a/src/vm/methodtable.cpp +++ b/src/vm/methodtable.cpp @@ -7732,25 +7732,6 @@ BOOL MethodTable::IsStructRequiringStackAllocRetBuf() // Disable this optimization. It has limited value (only kicks in on x86, and only for less common structs), // causes bugs and introduces odd ABI differences not compatible with ReadyToRun. return FALSE; - -#if 0 - -#if defined(_WIN64) - // We have not yet updated the 64-bit JIT compiler to follow this directive, so there's - // no reason to stack-allocate the return buffers. - return FALSE; -#elif defined(MDIL) || defined(_TARGET_ARM_) - // WPB 481466 RetBuf GC hole (When jitting on ARM32 CoreCLR.dll MDIL is not defined) - // - // This optimization causes versioning problems for MDIL which we haven't addressed yet - return FALSE; -#else - return IsValueType() - && ContainsPointers() - && GetNumInstanceFieldBytes() <= MaxStructBytesForLocalVarRetBuffBytes; -#endif - -#endif } //========================================================================================== diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h index ecd760d580..b0872c37d7 100644 --- a/src/vm/methodtable.h +++ b/src/vm/methodtable.h @@ -17,7 +17,6 @@ /* * Include Files */ -#ifndef BINDER #include "vars.hpp" #include "cor.h" #include "hash.h" @@ -35,9 +34,6 @@ #include "contractimpl.h" #include "generics.h" #include "fixuppointer.h" -#else -#include "classloadlevel.h" -#endif // !BINDER /* * Forward Declarations @@ -773,12 +769,7 @@ class MethodTable // Special access for setting up String object method table correctly friend class ClassLoader; friend class JIT_TrialAlloc; -#ifndef BINDER friend class Module; -#else - friend class MdilModule; - friend class CompactTypeBuilder; -#endif friend class EEClass; friend class MethodTableBuilder; friend class CheckAsmOffsets; @@ -826,11 +817,7 @@ public: PTR_Module GetLoaderModule(); PTR_LoaderAllocator GetLoaderAllocator(); -#ifndef BINDER void SetLoaderModule(Module* pModule); -#else - void SetLoaderModule(MdilModule* pModule); -#endif void SetLoaderAllocator(LoaderAllocator* pAllocator); // Get the domain local module - useful for static init checks @@ -1491,7 +1478,6 @@ public: NO_SLOT = 0xffff // a unique slot number used to indicate "empty" for fields that record slot numbers }; -#ifndef BINDER // the binder works with a slightly different representation, so remove these PCODE GetSlot(UINT32 slotNumber) { WRAPPER_NO_CONTRACT; @@ -1556,7 +1542,6 @@ public: } void SetSlot(UINT32 slotNum, PCODE slotVal); -#endif //------------------------------------------------------------------- // The VTABLE @@ -2293,15 +2278,6 @@ public: inline PTR_InterfaceInfo GetInterfaceMap(); -#ifdef BINDER - void SetNumInterfaces(DWORD dwNumInterfaces) - { - LIMITED_METHOD_DAC_CONTRACT; - m_wNumInterfaces = (WORD)dwNumInterfaces; - _ASSERTE(m_wNumInterfaces == dwNumInterfaces); - } -#endif - #ifndef DACCESS_COMPILE void SetInterfaceMap(WORD wNumInterfaces, InterfaceInfo_t* iMap); #endif @@ -2722,11 +2698,8 @@ public: // Used for generics and reflection emit in memory DWORD GetModuleDynamicEntryID(); -#ifndef BINDER Module* GetModuleForStatics(); -#else // BINDER - MdilModule* GetModuleForStatics(); -#endif + //------------------------------------------------------------------- // GENERICS DICT INFO // @@ -2734,9 +2707,6 @@ public: // Number of generic arguments, whether this is a method table for // a generic type instantiation, e.g. List or the "generic" MethodTable // e.g. for List. -#ifdef BINDER - DWORD GetNumGenericArgs(); -#else inline DWORD GetNumGenericArgs() { LIMITED_METHOD_DAC_CONTRACT; @@ -2745,7 +2715,6 @@ public: else return 0; } -#endif inline DWORD GetNumDicts() { @@ -2846,7 +2815,7 @@ public: _ASSERTE(g_pObjectClass); return (this == g_pObjectClass); } -#ifndef BINDER + // Is this System.ValueType? inline DWORD IsValueTypeClass() { @@ -2854,13 +2823,6 @@ public: _ASSERTE(g_pValueTypeClass); return (this == g_pValueTypeClass); } -#else // BINDER - // Is this System.ValueType? - bool IsValueTypeClass(); - - // Is this System.Enum? - bool IsEnumClass(); -#endif // BINDER // Is this value type? Returns false for System.ValueType and System.Enum. inline BOOL IsValueType(); @@ -4387,11 +4349,7 @@ private: return dac_cast)>(GetMultipurposeSlotPtr(enum_flag_HasModuleOverride, c_ModuleOverrideOffsets)); } -#ifdef BINDER - void SetModule(PTR_Module pModule); -#else void SetModule(Module * pModule); -#endif /************************************ // diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index b501b0d262..5d291081c7 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -2943,16 +2943,6 @@ MethodTableBuilder::EnumerateClassMethods() } } -#if defined(MDIL) - // Interfaces with sparse vtables are not currently supported in the triton toolchain. - if (GetAppDomain()->IsMDILCompilationDomain()) - { - GetSvcLogger()->Log(W("Warning: Sparse v-table detected.\n")); - BuildMethodTableThrowException(COR_E_BADIMAGEFORMAT, - IDS_CLASSLOAD_BADSPECIALMETHOD, - tok); - } -#endif // defined(MDIL) #ifdef FEATURE_COMINTEROP // Record vtable gap in mapping list. The map is an optional field, so ensure we've allocated // these fields first. @@ -8220,8 +8210,7 @@ VOID MethodTableBuilder::PlaceInstanceFields(MethodTable ** pByValueClassCach if (bmtFP->NumInstanceFieldsOfSize[j] != 0) break; // TODO: since we will refuse to place GC references we should filter them out here. - // otherwise the "back-filling" process stops completely. If you change it here, - // please change it in the corresponding place in src\tools\mdilbind\compactLayoutReader.cpp + // otherwise the "back-filling" process stops completely. // (PlaceInstanceFields) // the following code would fix the issue (a replacement for the code above this comment): // if (bmtFP->NumInstanceFieldsOfSize[j] != 0 && diff --git a/src/vm/methodtablebuilder.h b/src/vm/methodtablebuilder.h index 9ae1e24953..efb61675a5 100644 --- a/src/vm/methodtablebuilder.h +++ b/src/vm/methodtablebuilder.h @@ -43,7 +43,6 @@ public: static const UINT16 INVALID_SLOT_INDEX = static_cast(-1); static const UINT16 MAX_SLOT_INDEX = static_cast(-1) - 10; -#ifndef BINDER // Information gathered by the class loader relating to generics // Fields in this structure are initialized very early in class loading // See code:ClassLoader.CreateTypeHandleForTypeDefThrowing @@ -3017,8 +3016,6 @@ private: DWORD dwR8Fields, DWORD dwTotalFields); -#endif // !BINDER - MethodTable * AllocateNewMT(Module *pLoaderModule, DWORD dwVtableSlots, DWORD dwVirtuals, @@ -3027,14 +3024,8 @@ private: DWORD dwNumDicts, DWORD dwNumTypeSlots, MethodTable *pMTParent, -#ifndef BINDER ClassLoader *pClassLoader, LoaderAllocator *pAllocator, -#else // BINDER - MdilModule *declaringModule, - MdilModule *containingModule, - BOOL fHasDispatchMap, -#endif // BINDER BOOL isIFace, BOOL fDynamicStatics, BOOL fHasGenericsStaticsInfo, @@ -3053,8 +3044,6 @@ private: }; // class MethodTableBuilder -#ifndef BINDER #include "methodtablebuilder.inl" -#endif // !BINDER #endif // !METHODTABLEBUILDER_H diff --git a/src/vm/ngenhash.h b/src/vm/ngenhash.h index 74f57265bc..004d4b80c2 100644 --- a/src/vm/ngenhash.h +++ b/src/vm/ngenhash.h @@ -171,10 +171,6 @@ class NgenHashTable // Nidump knows how to walk this data structure. friend class NativeImageDumper; #endif -#ifdef BINDER - template friend class NGenHashTableBuilder; - friend class MdilModule; -#endif protected: // This opaque structure provides enumeration context when walking the set of entries which share a common @@ -336,10 +332,6 @@ private: #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif -#ifdef BINDER - template friend class NGenHashTableBuilder; - friend class MdilModule; -#endif public: // Allocate and initialize a new list with the given count of buckets and configured to hold no more diff --git a/src/vm/object.h b/src/vm/object.h index e560d1e46a..f9e1be17cb 100644 --- a/src/vm/object.h +++ b/src/vm/object.h @@ -318,7 +318,6 @@ class Object return GetHeader()->GetSyncBlockIndex(); } -#ifndef BINDER ADIndex GetAppDomainIndex(); // Get app domain of object, or NULL if it is agile @@ -331,7 +330,6 @@ class Object // Set app domain of object to given domain - it can only be set once void SetAppDomain(AppDomain *pDomain); -#endif // BINDER #ifdef _DEBUG #ifndef DACCESS_COMPILE @@ -341,9 +339,7 @@ class Object { WRAPPER_NO_CONTRACT; -#ifndef BINDER DEBUG_SetAppDomain(::GetAppDomain()); -#endif } #endif //!DACCESS_COMPILE @@ -1285,7 +1281,6 @@ class BaseObjectWithCachedData : public Object #endif //FEATURE_REMOTING }; -#ifndef BINDER // This is the Class version of the Reflection object. // A Class has adddition information. // For a ReflectClassBaseObject the m_pData is a pointer to a FieldDesc array that @@ -1370,7 +1365,6 @@ public: } }; -#endif // BINDER // This is the Method version of the Reflection object. // A Method has adddition information. @@ -3158,7 +3152,6 @@ typedef RealProxyObject* REALPROXYREF; #endif -#ifndef CLR_STANDALONE_BINDER #ifdef FEATURE_COMINTEROP //------------------------------------------------------------- @@ -3452,7 +3445,6 @@ typedef BStrWrapper* BSTRWRAPPEROBJECTREF; #endif #endif // FEATURE_COMINTEROP -#endif // CLR_STANDALONE_BINDER class StringBufferObject; #ifdef USE_CHECKED_OBJECTREFS @@ -4136,13 +4128,11 @@ private: return GetHeader()->m_thread; } -#ifndef BINDER void SetObjectThread() { WRAPPER_NO_CONTRACT; GetHeader()->m_thread = GetThread(); } -#endif //!BINDER StackTraceElement const * GetData() const { @@ -4271,10 +4261,10 @@ typedef PTR_LoaderAllocatorObject LOADERALLOCATORREF; #endif // FEATURE_COLLECTIBLE_TYPES -#if !defined(DACCESS_COMPILE) && !defined(CLR_STANDALONE_BINDER) +#if !defined(DACCESS_COMPILE) // Define the lock used to access stacktrace from an exception object EXTERN_C SpinLock g_StackTraceArrayLock; -#endif // !defined(DACCESS_COMPILE) && !defined(CLR_STANDALONE_BINDER) +#endif // !defined(DACCESS_COMPILE) // This class corresponds to Exception on the managed side. typedef DPTR(class ExceptionObject) PTR_ExceptionObject; diff --git a/src/vm/object.inl b/src/vm/object.inl index 9c24f551c9..5698321993 100644 --- a/src/vm/object.inl +++ b/src/vm/object.inl @@ -13,7 +13,6 @@ #include "object.h" -#if !defined(BINDER) inline PTR_VOID Object::UnBox() // if it is a value class, get the pointer to the first field { LIMITED_METHOD_DAC_CONTRACT; @@ -174,7 +173,6 @@ inline DWORD ArrayBase::GetNumComponents() const SUPPORTS_DAC; return m_NumComponents; } -#endif //!BINDER inline /* static */ unsigned ArrayBase::GetDataPtrOffset(MethodTable* pMT) { @@ -208,7 +206,6 @@ inline /* static */ unsigned ArrayBase::GetLowerBoundsOffset(MethodTable* pMT) dac_cast(pMT->GetClass())->GetRank() * sizeof(INT32); } -#ifndef BINDER // Get the element type for the array, this works whether the the element // type is stored in the array or not @@ -301,6 +298,4 @@ inline TypeHandle Object::GetGCSafeTypeHandle() const return TypeHandle(pMT); } -#endif //!BINDER - #endif // _OBJECT_INL_ diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp index 8fdf554557..80d2b8747a 100644 --- a/src/vm/peimagelayout.cpp +++ b/src/vm/peimagelayout.cpp @@ -694,30 +694,6 @@ StreamImageLayout::StreamImageLayout(IStream* pIStream,PEImage* pOwner) } #endif // FEATURE_FUSION -#ifdef MDIL -BOOL PEImageLayout::GetILSizeFromMDILCLRCtlData(DWORD* pdwActualILSize) -{ - CONTRACTL - { - THROWS; - GC_NOTRIGGER; - MODE_ANY; - } - CONTRACTL_END; - - IMAGE_SECTION_HEADER* pMDILSection = FindSection(".mdil"); - if (pMDILSection) - { - TADDR pMDILSectionStart = GetRvaData(VAL32(pMDILSection->VirtualAddress)); - MDILHeader* mdilHeader = (MDILHeader*)pMDILSectionStart; - ClrCtlData* pClrCtlData = (ClrCtlData*)(pMDILSectionStart + mdilHeader->hdrSize); - *pdwActualILSize = pClrCtlData->ilImageSize; - return TRUE; - } - return FALSE; -} -#endif // MDIL - #endif // !DACESS_COMPILE diff --git a/src/vm/peimagelayout.h b/src/vm/peimagelayout.h index b6fac344d9..68d6315be4 100644 --- a/src/vm/peimagelayout.h +++ b/src/vm/peimagelayout.h @@ -70,9 +70,6 @@ public: void AddRef(); ULONG Release(); const SString& GetPath(); -#ifdef MDIL - BOOL GetILSizeFromMDILCLRCtlData(DWORD* pdwActualILSize); -#endif // MDIL #ifdef FEATURE_PREJIT void ApplyBaseRelocations(); diff --git a/src/vm/simplerwlock.hpp b/src/vm/simplerwlock.hpp index 9a6e70ab83..7800b8d2a0 100644 --- a/src/vm/simplerwlock.hpp +++ b/src/vm/simplerwlock.hpp @@ -8,9 +8,7 @@ #ifndef _SimpleRWLock_hpp_ #define _SimpleRWLock_hpp_ -#ifndef BINDER #include "threads.h" -#endif class SimpleRWLock; @@ -150,11 +148,7 @@ public: } CONTRACTL_END; m_RWLock = 0; -#ifdef CLR_STANDALONE_BINDER - m_spinCount = 0; -#else m_spinCount = (GetCurrentProcessCpuCount() == 1) ? 0 : 4000; -#endif m_WriterWaiting = FALSE; #ifdef _DEBUG @@ -180,12 +174,6 @@ public: // Acquire the writer lock. void EnterWrite(); -#ifdef BINDER - // Leave the reader lock. - void LeaveRead(); - // Leave the writer lock. - void LeaveWrite(); -#else // !BINDER // Leave the reader lock. void LeaveRead() { @@ -213,7 +201,6 @@ public: DECTHREADLOCKCOUNT(); EE_LOCK_RELEASED(this); } -#endif // !BINDER #endif // DACCESS_COMPILE diff --git a/src/vm/staticallocationhelpers.inl b/src/vm/staticallocationhelpers.inl index 8e978d3d85..a6440f62cc 100644 --- a/src/vm/staticallocationhelpers.inl +++ b/src/vm/staticallocationhelpers.inl @@ -5,8 +5,7 @@ // // -// Helpers used to determine static offset allocation. Placed into an inl file so as to be shareable between -// mdilbind and the vm codebases. +// Helpers used to determine static offset allocation. // // #ifndef StaticAllocationHelpers_INL @@ -15,11 +14,7 @@ // Will return underlying type if it's an enum // ELEMENT_TYPE_VALUETYPE if it is a non enum // ELEMENT_TYPE_END if it doesn't know (we may not want to load other assemblies) -#ifdef CLR_STANDALONE_BINDER -static CorElementType ParseMetadataForStaticsIsValueTypeEnum(MdilModule * pModule, IMetaDataImport2 *pImport, mdToken tk) -#else static CorElementType ParseMetadataForStaticsIsValueTypeEnum(Module * pModule, IMDInternalImport *pImport, mdToken tk) -#endif { STANDARD_VM_CONTRACT; @@ -36,11 +31,7 @@ static CorElementType ParseMetadataForStaticsIsValueTypeEnum(Module * pModule, I mdToken tkParent = 0; DWORD dwParentAttr = 0; -#ifdef CLR_STANDALONE_BINDER - if (FAILED(pImport->GetTypeDefProps(tk, NULL, 0, NULL, &dwParentAttr, &tkParent))) -#else if (FAILED(pImport->GetTypeDefProps(tk, &dwParentAttr, &tkParent))) -#endif { return ELEMENT_TYPE_END; } @@ -50,32 +41,19 @@ static CorElementType ParseMetadataForStaticsIsValueTypeEnum(Module * pModule, I return ELEMENT_TYPE_END; } -#ifdef CLR_STANDALONE_BINDER - WCHAR wszTypeName[MAX_CLASS_NAME]; - ULONG cchTypeName; -#else LPCSTR szName = NULL; LPCSTR szNamespace = NULL; -#endif switch (TypeFromToken(tkParent)) { case mdtTypeDef: -#ifdef CLR_STANDALONE_BINDER - if (FAILED(pImport->GetTypeDefProps(tkParent, wszTypeName, _countof(wszTypeName), &cchTypeName, NULL, NULL))) -#else if (FAILED(pImport->GetNameOfTypeDef(tkParent, &szName, &szNamespace))) -#endif { return ELEMENT_TYPE_END; } break; case mdtTypeRef: -#ifdef CLR_STANDALONE_BINDER - if (FAILED(pImport->GetTypeRefProps(tkParent, NULL, wszTypeName, _countof(wszTypeName), &cchTypeName))) -#else if (FAILED(pImport->GetNameOfTypeRef(tkParent, &szNamespace, &szName))) -#endif { return ELEMENT_TYPE_END; } @@ -84,97 +62,58 @@ static CorElementType ParseMetadataForStaticsIsValueTypeEnum(Module * pModule, I return ELEMENT_TYPE_END; } -#ifndef CLR_STANDALONE_BINDER if (szName == NULL || szNamespace == NULL) { return ELEMENT_TYPE_END; } -#endif - + // If it doesn't inherit from System.Enum, then it must be a value type // Note that loader will not load malformed types so this check is enough -#ifdef CLR_STANDALONE_BINDER - if (wcscmp(wszTypeName, L"System.Enum") != 0) -#else if (strcmp(szName,"Enum") != 0 || strcmp(szNamespace,"System") != 0) -#endif { return ELEMENT_TYPE_VALUETYPE; } // OK, it's an enum; find its instance field and get its type -#ifdef CLR_STANDALONE_BINDER - HCORENUM hEnumFields = NULL; - CloseHCORENUMOnDestruct hEnumFieldsDestruct(pImport, &hEnumFields); - ULONG cFields; - HRESULT hr; -#else HENUMInternalHolder hEnum(pImport); -#endif mdToken tkField; -#ifdef CLR_STANDALONE_BINDER - while (S_OK == (hr = pImport->EnumFields(&hEnumFields, tk, &tkField, 1, &cFields))) -#else hEnum.EnumInit(mdtFieldDef,tk); while (pImport->EnumNext(&hEnum,&tkField)) -#endif { -#ifdef CLR_STANDALONE_BINDER - _ASSERTE(cFields == 1); -#endif PCCOR_SIGNATURE pMemberSignature; DWORD cMemberSignature; // Get the type of the static field. DWORD dwMemberAttribs; -#ifdef CLR_STANDALONE_BINDER - IfFailThrow(pImport->GetFieldProps(tkField, NULL, NULL, 0, NULL, &dwMemberAttribs, &pMemberSignature, &cMemberSignature, NULL, NULL, NULL)); -#else IfFailThrow(pImport->GetFieldDefProps(tkField, &dwMemberAttribs)); -#endif if (!IsFdStatic(dwMemberAttribs)) { -#ifndef CLR_STANDALONE_BINDER IfFailThrow(pImport->GetSigOfFieldDef(tkField, &cMemberSignature, &pMemberSignature)); IfFailThrow(validateTokenSig(tkField,pMemberSignature,cMemberSignature,dwMemberAttribs,pImport)); -#endif - + SigTypeContext typeContext; MetaSig fsig(pMemberSignature, cMemberSignature, pModule, &typeContext, MetaSig::sigField); CorElementType ElementType = fsig.NextArg(); return ElementType; } } - -#ifdef CLR_STANDALONE_BINDER - IfFailThrow(hr); -#endif // no instance field found -- error! return ELEMENT_TYPE_END; } -#ifdef CLR_STANDALONE_BINDER -#define g_ThreadStaticAttributeClassName L"System.ThreadStaticAttribute" -static BOOL GetStaticFieldElementTypeForFieldDef(MdilModule * pModule, IMetaDataImport2 *pImport, mdToken field, CorElementType *pElementType, mdToken *ptkValueTypeToken, int *pkk) -#else static BOOL GetStaticFieldElementTypeForFieldDef(Module * pModule, IMDInternalImport *pImport, mdToken field, CorElementType *pElementType, mdToken *ptkValueTypeToken, int *pkk) -#endif { STANDARD_VM_CONTRACT; PCCOR_SIGNATURE pMemberSignature; DWORD cMemberSignature; DWORD dwMemberAttribs; -#ifdef CLR_STANDALONE_BINDER - IfFailThrow(pImport->GetFieldProps(field, NULL, NULL, 0, NULL, &dwMemberAttribs, &pMemberSignature, &cMemberSignature, NULL, NULL, NULL)); -#else IfFailThrow(pImport->GetFieldDefProps(field, &dwMemberAttribs)); -#endif - + // Skip non-static and literal fields if (!IsFdStatic(dwMemberAttribs) || IsFdLiteral(dwMemberAttribs)) return TRUE; @@ -184,7 +123,7 @@ static BOOL GetStaticFieldElementTypeForFieldDef(Module * pModule, IMDInternalIm g_ThreadStaticAttributeClassName, NULL, NULL); -#if defined(FEATURE_LEGACYNETCF) && defined(CLR_STANDALONE_BINDER) +#if defined(FEATURE_LEGACYNETCF) // Replicate quirk from code:CMiniMd::CommonGetCustomAttributeByNameEx if (FAILED(hr) && RuntimeIsLegacyNetCF(0)) hr = S_FALSE; @@ -197,11 +136,9 @@ static BOOL GetStaticFieldElementTypeForFieldDef(Module * pModule, IMDInternalIm // Get the type of the static field. -#ifndef CLR_STANDALONE_BINDER IfFailThrow(pImport->GetSigOfFieldDef(field, &cMemberSignature, &pMemberSignature)); IfFailThrow(validateTokenSig(field,pMemberSignature,cMemberSignature,dwMemberAttribs,pImport)); -#endif - + SigTypeContext typeContext; // this is an empty type context: is this right? Should we be explicitly excluding all generic types from this iteration? MetaSig fsig(pMemberSignature, cMemberSignature, pModule, &typeContext, MetaSig::sigField); CorElementType ElementType = fsig.NextArg(); @@ -209,13 +146,8 @@ static BOOL GetStaticFieldElementTypeForFieldDef(Module * pModule, IMDInternalIm if (ElementType == ELEMENT_TYPE_VALUETYPE) { // See if we can figure out what the value type is -#ifdef CLR_STANDALONE_BINDER - MdilModule *pTokenModule; - mdToken tk = PeekValueTypeTokenClosed(&fsig.GetArgProps(), pModule, &typeContext, &pTokenModule); -#else Module *pTokenModule; mdToken tk = fsig.GetArgProps().PeekValueTypeTokenClosed(pModule, &typeContext, &pTokenModule); -#endif *ptkValueTypeToken = tk; @@ -223,11 +155,7 @@ static BOOL GetStaticFieldElementTypeForFieldDef(Module * pModule, IMDInternalIm // would have a problem. if (pTokenModule != pModule) { -#ifdef CLR_STANDALONE_BINDER - IfFailThrow(COR_E_BADIMAGEFORMAT); -#else ThrowHR(COR_E_BADIMAGEFORMAT, BFA_METADATA_CORRUPT); -#endif } ElementType = ParseMetadataForStaticsIsValueTypeEnum(pModule, pImport, tk); diff --git a/src/vm/stublink.h b/src/vm/stublink.h index fac88e36e4..8df3499b68 100644 --- a/src/vm/stublink.h +++ b/src/vm/stublink.h @@ -113,9 +113,7 @@ struct StubUnwindInfoHeapSegment #endif }; -#ifndef BINDER VOID UnregisterUnwindInfoInLoaderHeap (UnlockedLoaderHeap *pHeap); -#endif //!BINDER #endif // STUBLINKER_GENERATES_UNWIND_INFO diff --git a/src/vm/syncblk.h b/src/vm/syncblk.h index e7b19c4f84..82930dd636 100644 --- a/src/vm/syncblk.h +++ b/src/vm/syncblk.h @@ -161,7 +161,7 @@ inline void InitializeSpinConstants() { WRAPPER_NO_CONTRACT; -#if !defined(DACCESS_COMPILE) && !defined(BINDER) +#if !defined(DACCESS_COMPILE) g_SpinConstants.dwInitialDuration = g_pConfig->SpinInitialDuration(); g_SpinConstants.dwMaximumDuration = min(g_pConfig->SpinLimitProcCap(), g_SystemInfo.dwNumberOfProcessors) * g_pConfig->SpinLimitProcFactor() + g_pConfig->SpinLimitConstant(); g_SpinConstants.dwBackoffFactor = g_pConfig->SpinBackoffFactor(); @@ -446,7 +446,7 @@ public: #endif // FEATURE_COMINTEROP_UNMANAGED_ACTIVATION #endif // FEATURE_COMINTEROP -#if !defined(DACCESS_COMPILE) && !defined(BINDER) +#if !defined(DACCESS_COMPILE) // set m_pUMEntryThunkOrInterceptStub if not already set - return true if not already set bool SetUMEntryThunk(void* pUMEntryThunk) { @@ -1028,7 +1028,6 @@ class SyncBlockCache return m_bSyncBlockCleanupInProgress; } -#if !defined(BINDER) // Encapsulate a CrstHolder, so that clients of our lock don't have to know // the details of our implementation. class LockHolder : public CrstHolder @@ -1048,7 +1047,6 @@ class SyncBlockCache } }; friend class LockHolder; -#endif #if CHECK_APP_DOMAIN_LEAKS void CheckForUnloadedInstances(ADIndex unloadingIndex); @@ -1103,7 +1101,6 @@ class ObjHeader // bit field -- even in the presence of threaded access. // // This service can only be used to transition from a 0 index to a non-0 index. -#if !defined(BINDER) void SetIndex(DWORD indx) { CONTRACTL @@ -1148,7 +1145,6 @@ class ObjHeader } } } -#endif // !BINDER // Used only during shutdown void ResetIndex() @@ -1253,13 +1249,8 @@ class ObjHeader // retrieve sync block but don't allocate PTR_SyncBlock PassiveGetSyncBlock() { -#if !defined(BINDER) LIMITED_METHOD_DAC_CONTRACT; return g_pSyncTable [(int)GetHeaderSyncBlockIndex()].m_SyncBlock; -#else - _ASSERTE(FALSE); - return NULL; -#endif // BINDER } DWORD GetSyncBlockIndex(); diff --git a/src/vm/threadstatics.h b/src/vm/threadstatics.h index f60e386360..bd52496489 100644 --- a/src/vm/threadstatics.h +++ b/src/vm/threadstatics.h @@ -22,7 +22,6 @@ #ifndef __threadstatics_h__ #define __threadstatics_h__ -#ifndef BINDER #include "vars.hpp" #include "util.hpp" @@ -30,7 +29,6 @@ #include "field.h" #include "methodtable.h" #include "threads.h" -#endif // Defines ObjectHandeList type #include "specialstatics.h" @@ -53,7 +51,7 @@ struct ThreadLocalModule SIZE_T m_padding; #endif BYTE m_pDataBlob[0]; -#ifndef BINDER + inline PTR_BYTE GetGCStaticsBasePointer() { CONTRACTL @@ -70,7 +68,6 @@ struct ThreadLocalModule return dac_cast((PTR_OBJECTREF)((PTRARRAYREF)ObjectFromHandle(m_pGCStatics))->GetDataPtr()); } -#endif inline PTR_BYTE GetGCStaticsBaseHandle() { LIMITED_METHOD_CONTRACT; @@ -114,7 +111,6 @@ struct ThreadLocalModule static SIZE_T GetOffsetOfDataBlob() { return offsetof(ThreadLocalModule, m_pDataBlob); } static SIZE_T GetOffsetOfGCStaticHandle() { return offsetof(ThreadLocalModule, m_pGCStatics); } -#ifndef BINDER inline PTR_OBJECTREF GetPrecomputedGCStaticsBasePointer() { CONTRACTL @@ -131,7 +127,6 @@ struct ThreadLocalModule return (PTR_OBJECTREF)((PTRARRAYREF)ObjectFromHandle(m_pGCStatics))->GetDataPtr(); } -#endif inline OBJECTHANDLE GetPrecomputedGCStaticsBaseHandle() { @@ -159,7 +154,6 @@ struct ThreadLocalModule return &m_pGCStatics; } -#ifndef BINDER // Returns bytes so we can add offsets inline PTR_BYTE GetGCStaticsBasePointer(MethodTable * pMT) { @@ -181,7 +175,6 @@ struct ThreadLocalModule return dac_cast(GetPrecomputedGCStaticsBasePointer()); } } -#endif inline PTR_BYTE GetNonGCStaticsBasePointer(MethodTable * pMT) { @@ -214,7 +207,6 @@ struct ThreadLocalModule return pEntry; } -#ifndef BINDER // These helpers can now return null, as the debugger may do queries on a type // before the calls to PopulateClass happen inline PTR_BYTE GetDynamicEntryGCStaticsBasePointer(DWORD n) @@ -241,7 +233,6 @@ struct ThreadLocalModule return pEntry->GetGCStaticsBasePointer(); } -#endif inline PTR_BYTE GetDynamicEntryNonGCStaticsBasePointer(DWORD n) { @@ -267,7 +258,7 @@ struct ThreadLocalModule return pEntry->GetNonGCStaticsBasePointer(); } -#ifndef BINDER + FORCEINLINE PTR_DynamicClassInfo GetDynamicClassInfoIfInitialized(DWORD n) { WRAPPER_NO_CONTRACT; @@ -366,7 +357,7 @@ struct ThreadLocalModule #ifdef DACCESS_COMPILE void EnumMemoryRegions(CLRDataEnumMemoryFlags flags); #endif -#endif + static DWORD OffsetOfDataBlob() { LIMITED_METHOD_CONTRACT; @@ -394,7 +385,6 @@ private: // Non GC Statics public: -#ifndef BINDER inline PTR_BYTE GetPrecomputedStaticsClassData() { LIMITED_METHOD_CONTRACT @@ -446,14 +436,11 @@ public: } } -#endif #endif }; // struct ThreadLocalModule -#ifndef BINDER - typedef DPTR(struct TLMTableEntry) PTR_TLMTableEntry; struct TLMTableEntry @@ -682,7 +669,6 @@ class ThreadStatics #endif }; -#endif #endif diff --git a/src/vm/typedesc.h b/src/vm/typedesc.h index 748b7fe434..4bc4978543 100644 --- a/src/vm/typedesc.h +++ b/src/vm/typedesc.h @@ -203,7 +203,6 @@ public: PTR_BaseDomain GetDomain(); BOOL IsDomainNeutral(); -#ifndef BINDER PTR_LoaderAllocator GetLoaderAllocator() { SUPPORTS_DAC; @@ -212,7 +211,6 @@ public: } protected: -#endif // !BINDER // See methodtable.h for details of the flags with the same name there enum { @@ -248,9 +246,6 @@ class ParamTypeDesc : public TypeDesc { #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif -#ifdef BINDER - friend class MdilModule; -#endif public: #ifndef DACCESS_COMPILE @@ -277,7 +272,7 @@ public: INDEBUGIMPL(BOOL Verify();) OBJECTREF GetManagedClassObject(); -#ifndef BINDER + OBJECTREF GetManagedClassObjectIfExists() { CONTRACTL @@ -300,7 +295,6 @@ public: LoaderAllocator::GetHandleValueFast(m_hExposedClassObject, &objRet); return objRet; } -#endif TypeHandle GetModifiedType() { @@ -354,9 +348,7 @@ public: { STATIC_CONTRACT_SO_TOLERANT; WRAPPER_NO_CONTRACT; -#ifndef BINDER INDEBUG(Verify()); -#endif } //private: TypeHandle m_Arg; // The type that is being modified @@ -373,7 +365,6 @@ public: return GetTypeParam(); } -#ifndef CLR_STANDALONE_BINDER unsigned GetRank() { WRAPPER_NO_CONTRACT; SUPPORTS_DAC; @@ -383,13 +374,9 @@ public: else return dac_cast(GetMethodTable()->GetClass())->GetRank(); } -#else - unsigned GetRank(); -#endif MethodTable* GetParent() { -#ifndef BINDER WRAPPER_NO_CONTRACT; _ASSERTE(!m_TemplateMT.IsNull()); @@ -397,9 +384,6 @@ public: _ASSERTE(m_TemplateMT.GetValue()->ParentEquals(g_pArrayClass)); return g_pArrayClass; -#else - _ASSERTE(0); -#endif } #ifdef FEATURE_COMINTEROP @@ -460,9 +444,6 @@ class TypeVarTypeDesc : public TypeDesc #ifdef DACCESS_COMPILE friend class NativeImageDumper; #endif -#ifdef BINDER - friend class MdilModule; -#endif public: #ifndef DACCESS_COMPILE @@ -523,7 +504,6 @@ public: } OBJECTREF GetManagedClassObject(); -#ifndef BINDER OBJECTREF GetManagedClassObjectIfExists() { CONTRACTL @@ -546,7 +526,6 @@ public: LoaderAllocator::GetHandleValueFast(m_hExposedClassObject, &objRet); return objRet; } -#endif // Load the owning type. Note that the result is not guaranteed to be full loaded MethodDesc * LoadOwnerMethod(); diff --git a/src/vm/typehandle.h b/src/vm/typehandle.h index 7cdce2159f..72a5656cc3 100644 --- a/src/vm/typehandle.h +++ b/src/vm/typehandle.h @@ -460,11 +460,7 @@ public: // The module where this type lives for the purposes of loading and prejitting // Note: NGen time result might differ from runtime result for parametrized types (generics, arrays, etc.) // See code:ClassLoader::ComputeLoaderModule or file:clsload.hpp#LoaderModule for more information -#ifndef BINDER PTR_Module GetLoaderModule() const; -#else - MdilModule* GetLoaderModule() const; -#endif // The assembly that defined this type (== GetModule()->GetAssembly()) Assembly * GetAssembly() const; diff --git a/src/vm/util.hpp b/src/vm/util.hpp index ff5ab888a8..d81eedb0df 100644 --- a/src/vm/util.hpp +++ b/src/vm/util.hpp @@ -25,7 +25,6 @@ // Prevent the use of UtilMessageBox and WszMessageBox from inside the EE. -#ifndef CLR_STANDALONE_BINDER #undef UtilMessageBoxCatastrophic #undef UtilMessageBoxCatastrophicNonLocalized #undef UtilMessageBoxCatastrophic @@ -44,7 +43,6 @@ #define UtilMessageBoxVA __error("Use one of the EEMessageBox APIs (defined in eemessagebox.h) from inside the EE") #define UtilMessageBoxNonLocalizedVA __error("Use one of the EEMessageBox APIs (defined in eemessagebox.h) from inside the EE") #define WszMessageBox __error("Use one of the EEMessageBox APIs (defined in eemessagebox.h) from inside the EE") -#endif //======================================================================== // More convenient names for integer types of a guaranteed size. @@ -1003,7 +1001,6 @@ typedef Wrapper, VoidFreeWinAllocatedBlock, NULL> WinA #endif // !FEATURE_PAL -#ifndef CLR_STANDALONE_BINDER // For debugging, we can track arbitrary Can't-Stop regions. // In V1.0, this was on the Thread object, but we need to track this for threads w/o a Thread object. FORCEINLINE void IncCantStopCount() @@ -1033,7 +1030,6 @@ inline bool IsInCantStopRegion() return (GetCantStopCount() > 0); } #endif // _DEBUG -#endif // !CLR_STANDALONE_BINDER // PAL does not support per-thread locales. The holder is no-op for FEATURE_PALs diff --git a/src/vm/vars.hpp b/src/vm/vars.hpp index faab0bcd7f..0dfe71d167 100644 --- a/src/vm/vars.hpp +++ b/src/vm/vars.hpp @@ -62,7 +62,6 @@ typedef unsigned short wchar_t; #define _WCHAR_T_DEFINED #endif -#ifndef CLR_STANDALONE_BINDER #include "util.hpp" #include #include @@ -78,8 +77,6 @@ typedef unsigned short wchar_t; #include "certificatecache.h" #endif -#endif //CLR_STANDALONE_BINDER - #include "profilepriv.h" class ClassLoader; @@ -375,8 +372,6 @@ class ClassLoaderList; class Module; class ArrayTypeDesc; -#ifndef BINDER - #define EXTERN extern // For [(desc); -#ifdef BINDER - MdilModule * pVarTypeModule = pTypeVarDesc->GetModule(); -#else Module * pVarTypeModule = pTypeVarDesc->GetModule(); -#endif if (pVarTypeModule != this->context.pInfoModule) { DWORD index = (*this->pfnEncodeModule)(this->context.pModuleContext, pVarTypeModule); @@ -203,25 +195,19 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, // We may need to emit an out-of-module escape sequence // -#ifdef BINDER - MdilModule *pTypeHandleModule = pMT->GetModule(); -#else Module *pTypeHandleModule = pMT->GetModule_NoLogging(); -#endif // If the type handle's module is different that the this->pInfoModule // we will need to add an out-of-module escape for the type // DWORD index = 0; mdToken token = pMT->GetCl_NoLogging(); -#ifndef BINDER #ifdef FEATURE_NATIVE_IMAGE_GENERATION if (pTypeHandleModule != this->context.pInfoModule && !pTypeHandleModule->IsInCurrentVersionBubble()) { pTypeHandleModule = GetAppDomain()->ToCompilationDomain()->GetTargetModule(); token = pTypeHandleModule->LookupTypeRefByMethodTable(pMT); } -#endif #endif if (pTypeHandleModule != this->context.pInfoModule) { @@ -318,7 +304,7 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, return elemType; } -#ifndef BINDER + // // Compare a metadata signature element with a type handle // The type handle must have a fully restored type key, which in turn means that modules for all of its @@ -327,11 +313,7 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, // Hence we can do the signature comparison without incurring any loads or restores. // /*static*/ BOOL ZapSig::CompareSignatureToTypeHandle(PCCOR_SIGNATURE pSig, -#ifdef BINDER - MdilModule* pModule, -#else Module* pModule, -#endif TypeHandle handle, const ZapSig::Context * pZapSigContext) { @@ -356,11 +338,7 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, // // pOrigModule is the original module that contained this ZapSig // -#ifdef BINDER - MdilModule * pOrigModule = pZapSigContext->pInfoModule; -#else Module * pOrigModule = pZapSigContext->pInfoModule; -#endif CorElementType sigType = CorSigUncompressElementType(pSig); CorElementType handleType = handle.GetSignatureCorElementType(); @@ -1433,6 +1411,4 @@ void ZapSig::EncodeField( #endif // DACCESS_COMPILE -#endif // !BINDER - #endif // FEATURE_PREJIT diff --git a/src/vm/zapsig.h b/src/vm/zapsig.h index 04e028f618..14e2238e8b 100644 --- a/src/vm/zapsig.h +++ b/src/vm/zapsig.h @@ -18,17 +18,9 @@ #include "common.h" -#ifdef BINDER -#include "typehandle.h" -#endif - //define function pointer type: EncodeModuleCallback // -#ifdef BINDER -typedef DWORD (*EncodeModuleCallback)(void* pModuleContext, MdilModule *pReferencedModule); -#else typedef DWORD (*EncodeModuleCallback)(void* pModuleContext, Module *pReferencedModule); -#endif enum { // return value when EncodeModule fails ENCODE_MODULE_FAILED = 0xffffffff, @@ -36,11 +28,7 @@ enum { //define function pointer type: TokenDefinitionCallback // -#ifdef BINDER -typedef void (*TokenDefinitionCallback)(void* pModuleContext, MdilModule *pReferencedModule, DWORD index, mdToken* refToken); -#else typedef void (*TokenDefinitionCallback)(void* pModuleContext, Module *pReferencedModule, DWORD index, mdToken* refToken); -#endif class ZapSig { @@ -54,11 +42,7 @@ public: struct Context { -#ifdef BINDER - MdilModule * pInfoModule; // The tokens in this ZapSig are expressed relative to context.pInfoModule -#else Module * pInfoModule; // The tokens in this ZapSig are expressed relative to context.pInfoModule -#endif void * pModuleContext; // This is a code:Module* when we are resolving Ngen fixups or doing an Ibc Profiling run // and is a code:ZapImportTable* when we are running ngen ExternalTokens externalTokens; // When we see a ELEMENT_TYPE_MODULE_ZAPSIG this tells us what type of token follows. @@ -66,11 +50,7 @@ public: Module * GetZapSigModule() const { return (Module*) pModuleContext; } Context( -#ifdef BINDER - MdilModule* _pInfoModule, -#else Module* _pInfoModule, -#endif void* _pModuleContext, ExternalTokens _externalTokens) : pInfoModule(_pInfoModule), pModuleContext(_pModuleContext), @@ -78,11 +58,7 @@ public: { LIMITED_METHOD_CONTRACT; _ASSERTE(externalTokens != IllegalValue); } Context( -#ifdef BINDER - MdilModule* _pInfoModule, -#else Module* _pInfoModule, -#endif Module* _pZapSigModule) : pInfoModule(_pInfoModule), pModuleContext((void*) _pZapSigModule), @@ -93,11 +69,7 @@ public: public: ZapSig( -#ifdef BINDER - MdilModule * _pInfoModule, -#else Module * _pInfoModule, -#endif void * _pModuleContext, ExternalTokens _externalTokens, EncodeModuleCallback _pfnEncodeModule, @@ -129,11 +101,7 @@ public: // Compare a type handle with a signature whose tokens are resolved with respect to pModule // pZapSigContext is used to resolve ELEMENT_TYPE_MODULE_ZAPSIG encodings static BOOL CompareSignatureToTypeHandle(PCCOR_SIGNATURE pSig, -#ifdef BINDER - MdilModule* pModule, -#else Module* pModule, -#endif TypeHandle handle, const ZapSig::Context * pZapSigContext); diff --git a/src/zap/zapcode.cpp b/src/zap/zapcode.cpp index d2cf3827b2..2e7f21590a 100644 --- a/src/zap/zapcode.cpp +++ b/src/zap/zapcode.cpp @@ -345,14 +345,9 @@ void ZapImage::OutputCode(CodeType codeType) ZapNode * pUnwindData = pUnwindInfo->GetUnwindData(); -#if defined(BINDER) && defined(TARGET_THUMB2) - if (pUnwindData != NULL) -#endif + if (!pUnwindData->IsPlaced()) { - if (!pUnwindData->IsPlaced()) - { - pUnwindDataSection->Place(pUnwindData); - } + pUnwindDataSection->Place(pUnwindData); } } @@ -468,10 +463,8 @@ void ZapImage::OutputCodeInfo(CodeType codeType) } #endif // REDHAWK -#ifndef BINDER // in the binder, shift this to an earlier phase because of phase ordering problem (FlushPrecodesAndMethodDescs needs this) if (pMethod->m_pFixupList != NULL && !IsReadyToRunCompilation()) pMethod->m_pFixupInfo = m_pImportTable->PlaceFixups(pMethod->m_pFixupList); -#endif } EndRegion(regionKind); @@ -1170,32 +1163,18 @@ void ZapCodeMethodDescs::Save(ZapWriter * pZapWriter) void ZapMethodEntryPoint::Resolve(ZapImage * pImage) { -#ifdef CLR_STANDALONE_BINDER - if (m_pEntryPoint != NULL) + DWORD rvaValue = pImage->m_pPreloader->MapMethodEntryPoint(GetHandle()); +#ifdef _DEBUG + if (rvaValue == NULL) { - if (m_pEntryPoint->GetType() == ZapNodeType_InnerPtr) - { - ZapInnerPtr *pInnerPtr = (ZapInnerPtr *)m_pEntryPoint; - pInnerPtr->Resolve(); - } - SetRVA(m_pEntryPoint->GetRVA()); + mdMethodDef token; + pImage->GetCompileInfo()->GetMethodDef(GetHandle(), &token); + pImage->Error(token, S_OK, W("MapMethodEntryPoint failed")); } else #endif { - DWORD rvaValue = pImage->m_pPreloader->MapMethodEntryPoint(GetHandle()); -#ifdef _DEBUG - if (rvaValue == NULL) - { - mdMethodDef token; - pImage->GetCompileInfo()->GetMethodDef(GetHandle(), &token); - pImage->Error(token, S_OK, W("MapMethodEntryPoint failed")); - } - else -#endif - { - SetRVA(rvaValue); - } + SetRVA(rvaValue); } } @@ -1239,11 +1218,9 @@ ZapNode * ZapMethodEntryPointTable::CanDirectCall(ZapMethodEntryPoint * pMethodE if (m_pImage->canIntraModuleDirectCall(caller, callee, &reason, pMethodEntryPoint->GetAccessFlags())) { ZapNode * pCode = m_pImage->GetCompiledMethod(callee)->GetCode(); -#ifndef BINDER #ifdef _TARGET_ARM_ pCode = m_pImage->GetInnerPtr(pCode, THUMB_CODE); #endif // _TARGET_ARM_ -#endif // BINDER return pCode; } else @@ -1449,10 +1426,6 @@ void ZapUnwindData::Save(ZapWriter * pZapWriter) pZapWriter->WritePad(dwPad); ULONG personalityRoutine = GetPersonalityRoutine(pImage)->GetRVA(); -#ifdef BINDER - _ASSERTE((personalityRoutine & THUMB_CODE) == 0); - personalityRoutine |= THUMB_CODE; -#endif pZapWriter->Write(&personalityRoutine, sizeof(personalityRoutine)); } @@ -1649,22 +1622,6 @@ void ZapDebugInfoTable::LabelledEntry::Save(ZapWriter * pZapWriter) pZapWriter->Write(&entry, sizeof(entry)); } -#ifdef MDIL -const MdilDebugInfoTable::DebugInfo *MdilDebugInfoTable::GetDebugInfo(COUNT_T offset, COUNT_T cbBlob, const SArray *pBuf) -{ - DebugInfo info(offset, cbBlob, pBuf); - DebugInfo *pNode = m_blobs.Lookup(&info); - if (pNode != NULL) - { - return pNode; - } - - pNode = new (m_pImage->GetHeap()) DebugInfo(offset, cbBlob, pBuf); - m_blobs.Add(pNode); - return pNode; -} -#endif // MDIL - // // ZapProfileData // diff --git a/src/zap/zapcode.h b/src/zap/zapcode.h index 8d32a2325e..d68f9028c1 100644 --- a/src/zap/zapcode.h +++ b/src/zap/zapcode.h @@ -71,15 +71,6 @@ class ZapMethodHeader : public ZapNode CORINFO_METHOD_HANDLE m_handle; CORINFO_CLASS_HANDLE m_classHandle; -#ifdef MDIL - mdMethodDef m_token; -#endif - -#ifdef BINDER - ZapNode * m_pMethodDesc; - ZapNode * m_pEntryPoint; // either the ZapBlob representing the precode - // or m_pCode (if the method can be called directly) -#endif // BINDER ZapBlobWithRelocs * m_pCode; ZapBlobWithRelocs * m_pColdCode; // May be NULL @@ -133,13 +124,6 @@ public: return m_methodIndex; } -#ifdef MDIL - mdMethodDef GetToken() - { - return m_token; - } -#endif - ZapBlobWithRelocs * GetCode() { return m_pCode; @@ -179,36 +163,6 @@ public: return ZapNodeType_MethodHeader; } -#ifdef BINDER - void SetEntryPoint(ZapNode * pEntryPoint) - { - m_pEntryPoint = pEntryPoint; - } - - ZapNode *GetEntryPoint() - { - return m_pEntryPoint; - } - - bool HasMethodDesc() - { - return m_pMethodDesc != NULL; - } - - ZapNode *GetMethodDesc() - { - _ASSERTE(m_pMethodDesc != NULL); - return m_pMethodDesc; - } - - void SetMethodDesc(ZapNode *pMethodDesc) - { - _ASSERTE(m_pMethodDesc == NULL); - m_pMethodDesc = pMethodDesc; - _ASSERTE(m_pMethodDesc != NULL); - } -#endif // BINDER - // Iterate over as many of the methods called by this method // as are easy to determine. Currently this is implemented // by walking the Reloc list and so is only as complete as @@ -247,13 +201,6 @@ protected: { } -#if defined(TARGET_THUMB2) && defined(BINDER) - virtual BOOL IsThumb2Code() - { - return TRUE; - } -#endif - public: static ZapCodeBlob * NewAlignedBlob(ZapWriter * pWriter, PVOID pData, SIZE_T cbSize, SIZE_T cbAlignment); @@ -305,9 +252,7 @@ class ZapMethodEntryPoint : public ZapNode BYTE m_accessFlags; // CORINFO_ACCESS_FLAGS BYTE m_fUsed; // Entrypoint is used - needs to be resolved -#ifdef CLR_STANDALONE_BINDER ZapNode *m_pEntryPoint; // only used for abstract methods to remember the precode -#endif // CLR_STANDALONE_BINDER public: ZapMethodEntryPoint(CORINFO_METHOD_HANDLE handle, CORINFO_ACCESS_FLAGS accessFlags) @@ -341,19 +286,6 @@ public: } void Resolve(ZapImage * pImage); -#ifdef CLR_STANDALONE_BINDER - void SetEntryPoint(ZapNode *entryPoint) - { - m_pEntryPoint = entryPoint; // only used for abstract methods to remember the precode - } -#endif // CLR_STANDALONE_BINDER - -#if defined(TARGET_THUMB2) && defined(BINDER) - virtual BOOL IsThumb2Code() - { - return TRUE; - } -#endif }; class ZapMethodEntryPointTable @@ -430,36 +362,17 @@ class ZapUnwindInfo : public ZapNode ZapNode * m_pUnwindData; -#if defined(TARGET_THUMB2) && defined(BINDER) - DWORD m_packedUnwindData; -#endif - - ZapUnwindInfo * m_pNextFragment; - + public: ZapUnwindInfo(ZapNode * pCode, DWORD dwStartOffset, DWORD dwEndOffset, ZapNode * pUnwindData = NULL) : m_pCode(pCode), m_dwStartOffset(dwStartOffset), m_dwEndOffset(dwEndOffset), -#if defined(TARGET_THUMB2) && defined(BINDER) - m_packedUnwindData(0), -#endif m_pUnwindData(pUnwindData) { } -#if defined(TARGET_THUMB2) && defined(BINDER) - ZapUnwindInfo(ZapNode * pCode, DWORD dwStartOffset, DWORD dwEndOffset, DWORD packedUnwindData) - : m_pCode(pCode), - m_dwStartOffset(dwStartOffset), - m_dwEndOffset(dwEndOffset), - m_packedUnwindData(packedUnwindData), - m_pUnwindData(NULL) - { - } -#endif // TARGET_THUMB2 - ZapNode * GetCode() { return m_pCode; @@ -857,69 +770,6 @@ public: virtual void Save(ZapWriter * pZapWriter); }; -#ifdef MDIL -class MdilDebugInfoTable -{ -public: - MdilDebugInfoTable(ZapImage *pImage) : m_pImage(pImage) { } - - class DebugInfo - { - COUNT_T m_offset; - COUNT_T m_cbSize; - const SArray *m_pBuf; - - public: - DebugInfo(COUNT_T offset, COUNT_T cbSize, const SArray *pBuf) : m_offset(offset), m_cbSize(cbSize), m_pBuf(pBuf) { } - COUNT_T GetOffset() const { return m_offset; } - COUNT_T GetBlobSize() const { return m_cbSize; } - const SArray *GetBuf() const { return m_pBuf; } - const BYTE *GetData() const { return &(*m_pBuf)[m_offset]; } - }; - - const DebugInfo *GetDebugInfo(COUNT_T offset, COUNT_T cbBlob, const SArray *pBuf); - -private: - class SHashTraits : public DefaultSHashTraits - { - public: - typedef const element_t key_t; - - static key_t GetKey(element_t e) - { - LIMITED_METHOD_CONTRACT; - return e; - } - static BOOL Equals(key_t k1, key_t k2) - { - LIMITED_METHOD_CONTRACT; - if (k1->GetBuf() != k2->GetBuf()) - return FALSE; - if (k1->GetBlobSize() != k2->GetBlobSize()) - return FALSE; - return memcmp(k1->GetData(), k2->GetData(), k1->GetBlobSize()) == 0; - } - static count_t Hash(key_t k) - { - LIMITED_METHOD_CONTRACT; - count_t hash = 5381 + (count_t)(k->GetBlobSize() << 7); - - const BYTE *pbData = k->GetData(); - const BYTE *pbDataEnd = pbData + k->GetBlobSize(); - - for (/**/ ; pbData < pbDataEnd; pbData++) - { - hash = ((hash << 5) + hash) ^ *pbData; - } - return hash; - } - }; - - ZapImage * m_pImage; - SHash< NoRemoveSHashTraits < SHashTraits > > m_blobs; -}; -#endif // MDIL - //--------------------------------------------------------------------------------------- // // Zapping of IBC profile data collection area @@ -1080,14 +930,6 @@ public: } virtual void Save(ZapWriter * pZapWriter); - -#if defined(TARGET_THUMB2) && defined(BINDER) - virtual BOOL IsThumb2Code() - { - return TRUE; - } -#endif - }; class ZapLazyHelperThunk : public ZapNode @@ -1115,13 +957,6 @@ public: } virtual void Save(ZapWriter * pZapWriter); - -#if defined(TARGET_THUMB2) && defined(BINDER) - virtual BOOL IsThumb2Code() - { - return TRUE; - } -#endif }; #endif // __ZAPCODE_H__ diff --git a/src/zap/zapheaders.cpp b/src/zap/zapheaders.cpp index 159d3cb072..d8cd6fa7f9 100644 --- a/src/zap/zapheaders.cpp +++ b/src/zap/zapheaders.cpp @@ -187,9 +187,7 @@ void ZapImage::SaveCodeManagerEntry() // // Needed for RT_VERSION. -//#ifndef BINDER #define MAKEINTRESOURCE(v) MAKEINTRESOURCEW(v) -//#endif void ZapVersionResource::Save(ZapWriter * pZapWriter) { diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index 887051a67b..4b9626c70b 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -29,14 +29,6 @@ #include "md5.h" -#ifdef MDIL -#include "WellKnownTypes.h" -struct GuidInfo; -class MethodDesc; -class MethodTable; -#include "CompactLayoutWriter.h" -#endif - // This is RTL_CONTAINS_FIELD from ntdef.h #define CONTAINS_FIELD(Struct, Size, Field) \ ( (((PCHAR)(&(Struct)->Field)) + sizeof((Struct)->Field)) <= (((PCHAR)(Struct))+(Size)) ) @@ -108,11 +100,6 @@ ZapImage::~ZapImage() if (m_pDebugInfoTable != NULL) m_pDebugInfoTable->~ZapDebugInfoTable(); -#ifdef MDIL - if (m_pMdilDebugInfoTable != NULL) - m_pMdilDebugInfoTable->~MdilDebugInfoTable(); -#endif - if (m_pVirtualSectionsTable != NULL) m_pVirtualSectionsTable->~ZapVirtualSectionsTable(); @@ -185,22 +172,6 @@ void ZapImage::InitializeSections() m_pHelperThunks = new (GetHeap()) ZapNode * [CORINFO_HELP_COUNT]; -#ifdef MDIL - if (m_zapper->m_fEmbedMDIL) - { - if (m_cbMdilPESectionData != NULL) - { - ZapBlob *mdilData = ZapBlob::NewAlignedBlob(this, m_pMdilPESectionData, m_cbMdilPESectionData, sizeof(TADDR)); - m_pMDILSection->Place(mdilData); - } - else - { - m_zapper->Error(W("Could not embed mdil data in ni image. MDIL data not present in IL file.\n")); - IfFailThrow(E_INVALIDARG); - } - } -#endif // MDIL - #ifdef FEATURE_CORECLR if (!m_zapper->m_pOpt->m_fNoMetaData) #endif @@ -212,10 +183,6 @@ void ZapImage::InitializeSections() m_pDebugInfoTable = new (GetHeap()) ZapDebugInfoTable(this); m_pDebugSection->Place(m_pDebugInfoTable); -#ifdef MDIL - m_pMdilDebugInfoTable = new (GetHeap()) MdilDebugInfoTable(this); -#endif - m_pBaseRelocs = new (GetHeap()) ZapBaseRelocs(this); m_pBaseRelocsSection->Place(m_pBaseRelocs); @@ -662,20 +629,6 @@ void ZapImage::AllocateVirtualSections() m_pDebugSection = NewVirtualSection(pTextSection, IBCUnProfiledSection | ColdRange | DebugSection, sizeof(DWORD)); } -#ifdef MDIL - { - // - // .mdil section - // - m_pMDILSection = NULL; - if (m_zapper->m_fEmbedMDIL) - { - ZapPhysicalSection * pMDILSection = NewPhysicalSection(".mdil", IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_MEM_READ); - m_pMDILSection = NewVirtualSection(pMDILSection, IBCUnProfiledSection | ColdRange | MDILDataSection); - } - } -#endif - { // // .reloc section @@ -708,10 +661,8 @@ void ZapImage::Preallocate() m_pMethodEntryPoints->Preallocate(cbILImage); m_pWrappers->Preallocate(cbILImage); -#ifndef BINDER if (m_pILMetaData != NULL) m_pILMetaData->Preallocate(cbILImage); -#endif m_pGCInfoTable->Preallocate(cbILImage); #ifdef WIN64EXCEPTIONS m_pUnwindDataTable->Preallocate(cbILImage); @@ -719,30 +670,6 @@ void ZapImage::Preallocate() m_pDebugInfoTable->Preallocate(cbILImage); } -#ifdef BINDER -void ZapImage::SetNativeVersionResource(PVOID pvVersionResourceBlob, SIZE_T cbVersionResource) -{ - ZapNode* pBlob = ZapBlob::NewAlignedBlob(this, pvVersionResourceBlob, cbVersionResource, sizeof(TADDR)); - ZapVersionResource * pWin32VersionResource = new (GetHeap()) ZapVersionResource(pBlob); - m_pWin32ResourceSection->Place(pWin32VersionResource); - m_pWin32ResourceSection->Place(pBlob); - - SetDirectoryEntry(IMAGE_DIRECTORY_ENTRY_RESOURCE, m_pWin32ResourceSection); -} -#endif -#ifdef CLR_STANDALONE_BINDER -void ZapImage::EmitMethodIL(mdToken methodDefToken) -{ - if (m_pILMetaData != NULL) - m_pILMetaData->EmitMethodIL(methodDefToken); -} -void ZapImage::EmitFieldRVA(mdToken fieldDefToken, RVA fieldRVA) -{ - if (m_pILMetaData != NULL) - m_pILMetaData->EmitFieldRVA(fieldDefToken, fieldRVA); -} -#endif - void ZapImage::SetVersionInfo(CORCOMPILE_VERSION_INFO * pVersionInfo) { m_pVersionInfo = new (GetHeap()) ZapVersionInfo(pVersionInfo); @@ -1234,10 +1161,6 @@ HANDLE ZapImage::SaveImage(LPCWSTR wszOutputFileName, CORCOMPILE_NGEN_SIGNATURE if (!IsReadyToRunCompilation()) { m_pPreloader->FixupRVAs(); - -#ifdef CLR_STANDALONE_BINDER - m_pDataImage->FixupRVAs(); -#endif } HANDLE hFile = GenerateFile(wszOutputFileName, pNativeImageSig); @@ -1330,7 +1253,6 @@ void ZapImage::CalculateZapBaseAddress() SIZE_T baseAddress = 0; -#ifndef BINDER // TritonTBD { // Read the actual preferred base address from the disk @@ -1455,7 +1377,6 @@ void ZapImage::CalculateZapBaseAddress() } #endif #endif -#endif // TritonTBD // Apply the calculated base address. @@ -1464,66 +1385,6 @@ void ZapImage::CalculateZapBaseAddress() m_NativeBaseAddress = baseAddress; } -#ifdef MDIL -static WORD ReadWord(BYTE *p) -{ - return p[0] + - p[1]*256; -} - -static DWORD ReadDWord(BYTE *p) -{ - return p[0] + - p[1]*256 + - p[2]*(256*256) + - p[3]*(256*256*256); -} - -#ifdef CLR_STANDALONE_BINDER -#include "mdil.h" -#else -#define CLR_STANDALONE_BINDER -#include "mdil.h" -#undef CLR_STANDALONE_BINDER -#endif - -bool ReadMemory(BYTE *&dataPtr, COUNT_T &dataSize, void *dest, COUNT_T size) -{ - if (dataSize < size) - return false; - - if (dest != NULL) - memcpy(dest, dataPtr, size); - - dataPtr += size; - dataSize -= size; - - return true; -} - -void ZapImage::LoadMDILSection() -{ -#ifdef BINDER - _ASSERTE(!"intentionally unreachable"); -#else - IMAGE_SECTION_HEADER *pMDILSection = m_ModuleDecoder.FindSection(".mdil"); - m_cbMdilPESectionData = 0; - if (pMDILSection) - { - // We got our section - get the start of the section - BYTE* pStartOfMDILSection = static_cast(m_ModuleDecoder.GetBase())+pMDILSection->VirtualAddress; - BYTE* pEndOfMDILSection = pStartOfMDILSection + pMDILSection->Misc.VirtualSize; - if (m_ModuleDecoder.PointerInPE(pEndOfMDILSection - 1)) - { - m_pMdilPESectionData = pStartOfMDILSection; - m_cbMdilPESectionData = pMDILSection->Misc.VirtualSize; - } - } -#endif -} - -#endif // ifdef MDIL - void ZapImage::Open(CORINFO_MODULE_HANDLE hModule, IMetaDataAssemblyEmit *pEmit) { @@ -1571,18 +1432,11 @@ void ZapImage::Open(CORINFO_MODULE_HANDLE hModule, // LoadProfileData(); -#ifdef MDIL -#ifndef BINDER - LoadMDILSection(); -#endif -#endif // // Get metadata of module to be compiled // m_pMDImport = m_zapper->m_pEECompileInfo->GetModuleMetaDataImport(m_hModule); -#ifndef BINDER _ASSERTE(m_pMDImport != NULL); -#endif // !BINDER // // Open new assembly metadata data for writing. We may not use it, @@ -1742,14 +1596,8 @@ void ZapImage::OutputManifestMetadata() fMetadata = TRUE; } -#ifdef CLR_STANDALONE_BINDER - // TritonTBD: A workaround to place a copy of metadata into hello.ni.exe. - fMetadata = TRUE; -#endif - if (fMetadata) { -#ifndef CLR_STANDALONE_BINDER // Metadata creates a new MVID for every instantiation. // However, we want the generated ngen image to always be the same // for the same input. So set the metadata MVID to NGEN_IMAGE_MVID. @@ -1759,33 +1607,10 @@ void ZapImage::OutputManifestMetadata() (void**)&pMDInternalEmit)); IfFailThrow(pMDInternalEmit->ChangeMvid(NGEN_IMAGE_MVID)); -#endif m_pAssemblyMetaData = new (GetHeap()) ZapMetaData(); m_pAssemblyMetaData->SetMetaData(m_pAssemblyEmit); -#ifdef CLR_STANDALONE_BINDER - - // now generate the NativeAssembyManifest - // push down first the assembly references - // we can do this only AFTER we have an instance of ZapMetadata (see a few lines above) - // the order of assembly references is/needs to be in sync with those in CORCOMPILE_DEPENDENCIES - - for (COUNT_T cnt = 0; cnt < m_pNativeManifestData.GetCount(); cnt++) { - m_pAssemblyMetaData->SetAssemblyReference( - m_pNativeManifestData[cnt].m_AssemblyName, - NULL, - m_pNativeManifestData[cnt].m_pNad); - } - - // now provide the assembly/module def relevant data - // please note that his assumes/knows that the last assemblyRef is "self-referential" - m_pAssemblyMetaData->SetAssembly(m_pNativeManifestData[(COUNT_T)m_selfIndex].m_AssemblyName, - NULL, - m_pNativeManifestData[(COUNT_T)m_selfIndex].m_pNad); - -#endif - m_pMetaDataSection->Place(m_pAssemblyMetaData); } } @@ -1865,12 +1690,11 @@ void ZapImage::OutputTables() SetSizeOfStackCommit(m_ModuleDecoder.GetSizeOfStackCommit()); } -#if defined(_TARGET_ARM_) && defined(FEATURE_CORECLR) && defined(FEATURE_CORESYSTEM) && !defined(BINDER) +#if defined(_TARGET_ARM_) && defined(FEATURE_CORECLR) && defined(FEATURE_CORESYSTEM) if (!IsReadyToRunCompilation()) { // On ARM CoreSys builds, crossgen will use 4k file alignment, as requested by Phone perf team - // to improve perf on phones with compressed system partitions. MDIL binder will continue to use - // 512 byte alignment, since there is no plan to compress data partitions. + // to improve perf on phones with compressed system partitions. SetFileAlignment(0x1000); } #elif defined(FEATURE_PAL) @@ -1974,1542 +1798,138 @@ void ZapImage::CompileProfileData() EndRegion(CORINFO_REGION_HOT); } -#ifdef MDIL -static COUNT_T OutputDWord(BYTE *p, DWORD d) -{ - if (p) - { - p[0] = (BYTE)d; - p[1] = (BYTE)(d>>8); - p[2] = (BYTE)(d>>16); - p[3] = (BYTE)(d>>24); - } - return 4; -} - -void ZapImage::UnifyGenericInstances_MDIL(ZapInfo::MDILGenericMethodDesc *pMD) -{ - // we have unified on the last arg during generation - now we do the rest - bool change; - do - { - change = false; - for (int argToUnify = 0; argToUnify < pMD->arity; argToUnify++) - { - for (ZapInfo::MDILGenericMethodDesc *p = pMD; p != NULL; p = p->next) - { - ZapInfo::MDILGenericMethodDesc *prev = p; - for (ZapInfo::MDILGenericMethodDesc *q = p->next; q != NULL; q = q->next) - { - // we have grouped identical bodies together in the list, so if the body is - // not the same, we can give up - no more identical bodies will be encountered - if (q->mdilCodeOffs != p->mdilCodeOffs || q->debugInfoOffs != p->debugInfoOffs) - break; - - // if the flavors of p and q agree except for one position, we can merge q into p - if (ZapInfo::ArgFlavorsMatchExcept(q->flavorSet, p->flavorSet, pMD->arity, argToUnify)) - { -// GetSvcLogger()->Printf(W("merged generic bodies %08x + %08x\n"), p->flavorSet[argToUnify], q->flavorSet[argToUnify]); - p->flavorSet[argToUnify] |= q->flavorSet[argToUnify]; - - // delete q from the list - _ASSERT(prev->next == q); - prev->next = q->next; - q = prev; - change = true; - } - else - { - prev = q; - } - } - } - } - } - while (change); -} - -COUNT_T ZapImage::EncodeGenericInstance_MDIL(ZapInfo::MDILGenericMethodDesc *pMD) +void ZapImage::Compile() { - // count how many instances we have - COUNT_T count = 0; - for (ZapInfo::MDILGenericMethodDesc *p = pMD; p != NULL; p = p->next) - { - count++; - } - - // compute the size to allocate in m_genericInstPool - size_t size = sizeof(ZapInfo::MDILInstHeader) + 2*count*sizeof(DWORD) + count*pMD->arity*sizeof(ZapInfo::FlavorSet); - size = AlignUp(size, sizeof(DWORD)); + // + // First, compile methods in the load order array. + // + bool doNothingNgen = false; +#ifdef _DEBUG + static ConfigDWORD fDoNothingNGen; + doNothingNgen = !!fDoNothingNGen.val(CLRConfig::INTERNAL_ZapDoNothing); +#endif - // as usual, we put some dummy stuff at the very beginning - if (m_genericInstPool.GetCount() == 0) + if (!doNothingNgen) { - m_genericInstPool.SetCount(sizeof(DWORD)); - OutputDWord(&m_genericInstPool[0], 'MDGI'); - } - COUNT_T genericInstOffs = m_genericInstPool.GetCount(); - m_genericInstPool.SetCount(genericInstOffs + (COUNT_T)size); + // + // Compile the methods specified by the IBC profile data + // + CompileProfileData(); - ZapInfo::MDILInstHeader *pMIH = (ZapInfo::MDILInstHeader *)&m_genericInstPool[genericInstOffs]; - pMIH->m_arity = pMD->arity; - pMIH->m_flags = 0; - pMIH->m_instCount = count; + BeginRegion(CORINFO_REGION_COLD); - DWORD *mdilCodeOffsets = (DWORD *)(pMIH + 1); - ZapInfo::FlavorSet *flavorSets = (ZapInfo::FlavorSet *)(mdilCodeOffsets + 2*count); - - for (ZapInfo::MDILGenericMethodDesc *p = pMD; p != NULL; p = p->next) - { - _ASSERTE(p->mdilCodeOffs < m_codeBuffer [GENERIC_CODE].GetCount()); - _ASSERTE(p->debugInfoOffs < m_debugInfoBuffer[GENERIC_CODE].GetCount()); + IMDInternalImport * pMDImport = m_pMDImport; - *mdilCodeOffsets++ = p->mdilCodeOffs; - *mdilCodeOffsets++ = p->debugInfoOffs; - for (int i = 0; i < pMD->arity; i++) - *flavorSets++ = p->flavorSet[i]; - } - return genericInstOffs; -} + HENUMInternalHolder hEnum(pMDImport); + hEnum.EnumAllInit(mdtMethodDef); -int ZapImage::CheckForUnmerged(ZapInfo::MDILGenericMethodDesc tab[], int last, ZapInfo::FlavorSet flavorsToMatch, WCHAR *message) -{ - int arity = tab[last].arity; - if (flavorsToMatch == 0) - { - for (int i = 0; i < last; i++) - { - if (ZapInfo::ArgFlavorsMatchExcept(tab[last].flavorSet, tab[i].flavorSet, arity, arity)) - { - GetSvcLogger()->Printf(W("%s"), message); - return 1; - } - } - } - else - { - for (int j = 0; j < arity; j++) + mdMethodDef md; + while (pMDImport->EnumNext(&hEnum, &md)) { - for (int i = 0; i < last; i++) + if (m_pILMetaData != NULL) { - if (ZapInfo::ArgFlavorsMatchExcept(tab[last].flavorSet, tab[i].flavorSet, arity, j) && - tab[last].flavorSet[j] != tab[i].flavorSet[j] && (tab[last].flavorSet[j] & flavorsToMatch) && (tab[i].flavorSet[j] & flavorsToMatch)) - { - GetSvcLogger()->Printf(W("%s"), message); - return 1; - } + // Copy IL for all methods. We treat errors during copying IL + // over as fatal error. These errors are typically caused by + // corrupted IL images. + // + m_pILMetaData->EmitMethodIL(md); } - } - } - return 0; -} -void ZapImage::EncodeGenericInstances_MDIL() -{ - // make sure m_methodRidCount and m_mapMethodRidToOffs are big enough - COUNT_T mappingCount = m_mapGenericMethodToDesc.GetCount(); - if (m_methodRidCount < mappingCount) - m_methodRidCount = mappingCount; - if (m_mapMethodRidToOffs.GetCount() < mappingCount) - { - COUNT_T oldCount = m_mapMethodRidToOffs.GetCount(); - m_mapMethodRidToOffs.SetCount(mappingCount); - for (COUNT_T i = oldCount; i < mappingCount; i++) - m_mapMethodRidToOffs[i] = 0; - } - - COUNT_T methodCount = 0; - COUNT_T instanceCount = 0; - COUNT_T uniqueBodyCount = 0; - COUNT_T uniqueBodySize = 0; - COUNT_T unmergedInstances = 0; - COUNT_T unmergedFloatDoubleInstances = 0; - COUNT_T unmergedSmallIntInstances = 0; - COUNT_T unmergedIntUIntInstances = 0; - COUNT_T unmergedIntInstances = 0; - COUNT_T unmergedLongULongInstances = 0; - COUNT_T unmergedFloatStructInstances = 0; - COUNT_T unmergedLongStructInstances = 0; - COUNT_T unmergedLongFloatInstances = 0; - COUNT_T unmergedNullableInstances = 0; - COUNT_T unmergedSharedStructInstances = 0; - COUNT_T unmergedStructInstances = 0; - - for (COUNT_T i = 0; i < m_mapGenericMethodToDesc.GetCount(); i++) - { - ZapInfo::MDILGenericMethodDesc *pMD = m_mapGenericMethodToDesc[i]; - if (pMD == NULL) - continue; - - methodCount++; - - UnifyGenericInstances_MDIL(pMD); - -#if 0 // def _DEBUG - DWORD prevMdilCodeOffs = 0; - COUNT_T uniqueBodyCountForThisMethod = 0; - COUNT_T uniqueBodySizeForThisMethod = 0; - COUNT_T instanceCountForThisMethod = 0; - for (ZapInfo::MDILGenericMethodDesc *p = pMD; p != NULL; p = p->next) - { - instanceCountForThisMethod++; - if (prevMdilCodeOffs != p->mdilCodeOffs) - { - uniqueBodyCountForThisMethod++; - uniqueBodySizeForThisMethod += p->mdilCodeSize; - prevMdilCodeOffs = p->mdilCodeOffs; - } - } - GetSvcLogger()->Printf(W("%u Instances for generic method %08x - %u unique bodies totalling %u bytes\n"), - instanceCountForThisMethod, TokenFromRid(i, mdtMethodDef), - uniqueBodyCountForThisMethod, - uniqueBodySizeForThisMethod); - - instanceCount += instanceCountForThisMethod; - uniqueBodyCount += uniqueBodyCountForThisMethod; - uniqueBodySize += uniqueBodySizeForThisMethod; - const size_t MD_TABLE_SIZE = 256; - ZapInfo::MDILGenericMethodDesc mdTab[MD_TABLE_SIZE]; - COUNT_T mdCount = 0; - for (ZapInfo::MDILGenericMethodDesc *p = pMD; p != NULL; p = p->next) - { - if (mdCount < MD_TABLE_SIZE) - { - mdTab[mdCount] = *p; - mdCount++; - } + // + // Compile the remaining methods that weren't compiled during the CompileProfileData phase + // + TryCompileMethodDef(md, 0); } - qsort(mdTab, mdCount, sizeof(mdTab[0]), ZapInfo::CmpMDILGenericMethodDesc); - for (COUNT_T mdInx = 0; mdInx < mdCount; mdInx++) + // Compile any generic code which lands in this LoaderModule + // that resulted from the above compilations + CORINFO_METHOD_HANDLE handle = m_pPreloader->NextUncompiledMethod(); + while (handle != NULL) { - if (mdInx >= 1 && !ZapInfo::ArgFlavorsMatchExcept(mdTab[mdInx-1].flavorSet, mdTab[mdInx].flavorSet, mdTab[mdInx].arity, mdTab[mdInx].arity-1)) - GetSvcLogger()->Printf(W("\n")); - - GetSvcLogger()->Printf(W(" %08x(%4u): "), mdTab[mdInx].mdilCodeOffs, mdTab[mdInx].mdilCodeSize); - for (int j = 0; j < mdTab[mdInx].arity; j++) - { - GetSvcLogger()->Printf(W(" %08x"), mdTab[mdInx].flavorSet[j]); - } - unmergedInstances += CheckForUnmerged(mdTab, mdInx, 0, W(" - unmerged instance")); - - const ZapInfo::FlavorSet FLOAT_DOUBLE = (1 << ELEMENT_TYPE_R4)|(1 << ELEMENT_TYPE_R8); - unmergedFloatDoubleInstances += CheckForUnmerged(mdTab, mdInx, FLOAT_DOUBLE, W(" - unmerged float/double instance")); - - const ZapInfo::FlavorSet SMALL_INT = (1 << ELEMENT_TYPE_BOOLEAN)|(1 << ELEMENT_TYPE_CHAR)|(1 << ELEMENT_TYPE_I1)|(1 << ELEMENT_TYPE_U1)|(1 << ELEMENT_TYPE_I2)|(1 << ELEMENT_TYPE_U2); - unmergedSmallIntInstances += CheckForUnmerged(mdTab, mdInx, SMALL_INT, W(" - unmerged small int instance")); - - const ZapInfo::FlavorSet REGULAR_INT = (1 << ELEMENT_TYPE_I4)|(1 << ELEMENT_TYPE_U4)|(1 << ELEMENT_TYPE_I)|(1 << ELEMENT_TYPE_U); - unmergedIntUIntInstances += CheckForUnmerged(mdTab, mdInx, REGULAR_INT, W(" - unmerged int/uint instance")); - - const ZapInfo::FlavorSet REGISTER_INT = SMALL_INT|REGULAR_INT; - unmergedIntInstances += CheckForUnmerged(mdTab, mdInx, REGISTER_INT, W(" - unmerged int instance")); - - const ZapInfo::FlavorSet LONG_INT = (1 << ELEMENT_TYPE_I8)|(1 << ELEMENT_TYPE_U8); - unmergedLongULongInstances += CheckForUnmerged(mdTab, mdInx, LONG_INT, W(" - unmerged long/ulong instance")); - - const ZapInfo::FlavorSet LONG_STRUCT = LONG_INT|(1 << ELEMENT_TYPE_VALUETYPE); - unmergedLongStructInstances += CheckForUnmerged(mdTab, mdInx, LONG_STRUCT, W(" - unmerged long/struct instance")); - - const ZapInfo::FlavorSet LONG_FLOAT = LONG_INT|FLOAT_DOUBLE; - unmergedLongFloatInstances += CheckForUnmerged(mdTab, mdInx, LONG_FLOAT, W(" - unmerged long/float instance")); - - const ZapInfo::FlavorSet FLOAT_STRUCT = FLOAT_DOUBLE|(1 << ELEMENT_TYPE_VALUETYPE); - unmergedFloatStructInstances += CheckForUnmerged(mdTab, mdInx, FLOAT_STRUCT, W(" - unmerged float/struct instance")); - - const ZapInfo::FlavorSet NULLABLE_STRUCT = (1 << ELEMENT_TYPE_VALUETYPE)|(1 << 0x17); - unmergedNullableInstances += CheckForUnmerged(mdTab, mdInx, NULLABLE_STRUCT, W(" - unmerged nullable instance")); - - const ZapInfo::FlavorSet SHARED_STRUCT = (1 << ELEMENT_TYPE_VALUETYPE)|(1 << 0x1e); - unmergedSharedStructInstances += CheckForUnmerged(mdTab, mdInx, SHARED_STRUCT, W(" - unmerged shared struct instance")); + TryCompileInstantiatedMethod(handle, 0); + handle = m_pPreloader->NextUncompiledMethod(); + } - const ZapInfo::FlavorSet STRUCT = (1 << ELEMENT_TYPE_VALUETYPE)|(1 << 0x17)|(1 << 0x1e)|(1 << 0x1f); - unmergedStructInstances += CheckForUnmerged(mdTab, mdInx, STRUCT, W(" - unmerged struct instance")); + EndRegion(CORINFO_REGION_COLD); - GetSvcLogger()->Printf(W("\n")); + // If we want ngen to fail when we create partial ngen images we can + // throw an NGEN failure HRESULT here. +#if 0 + if (m_zapper->m_failed) + { + ThrowHR(NGEN_E_TP_PARTIAL_IMAGE); } #endif - COUNT_T genericInstOffs = EncodeGenericInstance_MDIL(pMD); - _ASSERT(m_mapMethodRidToOffs[i] == 0); - m_mapMethodRidToOffs[i] = GENERIC_METHOD_REF | genericInstOffs; } -#if 0 //def _DEBUG - for (COUNT_T i = 0; i < m_mapGenericMethodToDesc.GetCount(); i++) - { - ZapInfo::MDILGenericMethodDesc *pMD = m_mapGenericMethodToDesc[i]; - if (pMD == NULL) - continue; - - // 0 the mdilCodeOffs and unify - the result tells us what we have covered... - for (ZapInfo::MDILGenericMethodDesc *p = pMD; p != NULL; p = p->next) - p->mdilCodeOffs = 0; + // Compute a preferred class layout order based on analyzing the graph + // of which classes contain calls to other classes. + ComputeClassLayoutOrder(); - UnifyGenericInstances_MDIL(pMD); + // Sort the unprofiled methods by this preferred class layout, if available + if (m_fHasClassLayoutOrder) + { + SortUnprofiledMethodsByClassLayoutOrder(); + } - GetSvcLogger()->Printf(W("Instances for generic method %08x\n"), TokenFromRid(i, mdtMethodDef)); + if (IsReadyToRunCompilation()) + { + // Pretend that no methods are trained, so that everything is in single code section + // READYTORUN: FUTURE: More than one code section + m_iUntrainedMethod = 0; + } - const size_t MD_TABLE_SIZE = 256; - ZapInfo::MDILGenericMethodDesc mdTab[MD_TABLE_SIZE]; - COUNT_T mdCount = 0; - for (ZapInfo::MDILGenericMethodDesc *p = pMD; p != NULL; p = p->next) - { - if (mdCount < MD_TABLE_SIZE) - { - mdTab[mdCount] = *p; - mdCount++; - } - } - qsort(mdTab, mdCount, sizeof(mdTab[0]), ZapInfo::CmpMDILGenericMethodDesc); + OutputCode(ProfiledHot); + OutputCode(Unprofiled); + OutputCode(ProfiledCold); - for (COUNT_T mdInx = 0; mdInx < mdCount; mdInx++) - { - if (mdInx >= 1 && !ZapInfo::ArgFlavorsMatchExcept(mdTab[mdInx-1].flavorSet, mdTab[mdInx].flavorSet, mdTab[mdInx].arity, mdTab[mdInx].arity-1)) - GetSvcLogger()->Printf(W("\n")); + OutputCodeInfo(ProfiledHot); + OutputCodeInfo(ProfiledCold); // actually both Unprofiled and ProfiledCold - for (int j = 0; j < mdTab[mdInx].arity; j++) - { - GetSvcLogger()->Printf(W(" %08x"), mdTab[mdInx].flavorSet[j]); - } + OutputGCInfo(); + OutputProfileData(); - GetSvcLogger()->Printf(W("\n")); - } +#ifdef FEATURE_READYTORUN_COMPILER + if (IsReadyToRunCompilation()) + { + OutputEntrypointsTableForReadyToRun(); + OutputDebugInfoForReadyToRun(); } - - GetSvcLogger()->Printf(W("%u instances and %u unique bodies for %u generic methods\n"), instanceCount, uniqueBodyCount, methodCount); - GetSvcLogger()->Printf(W("%u unmerged instances\n"), unmergedInstances); - GetSvcLogger()->Printf(W("%u unmerged float/double instances\n"), unmergedFloatDoubleInstances); - GetSvcLogger()->Printf(W("%u unmerged small int instances\n"), unmergedSmallIntInstances); - GetSvcLogger()->Printf(W("%u unmerged int/uint instances\n"), unmergedIntUIntInstances); - GetSvcLogger()->Printf(W("%u unmerged int instances\n"), unmergedIntInstances); - GetSvcLogger()->Printf(W("%u unmerged long/ulong instances\n"), unmergedLongULongInstances); - GetSvcLogger()->Printf(W("%u unmerged long/struct instances\n"), unmergedLongStructInstances); - GetSvcLogger()->Printf(W("%u unmerged long/float instances\n"), unmergedLongFloatInstances); - GetSvcLogger()->Printf(W("%u unmerged float/struct instances\n"), unmergedFloatStructInstances); - GetSvcLogger()->Printf(W("%u unmerged nullable instances\n"), unmergedNullableInstances); - GetSvcLogger()->Printf(W("%u unmerged shared struct instances\n"), unmergedSharedStructInstances); - GetSvcLogger()->Printf(W("%u unmerged struct instances\n"), unmergedStructInstances); - - GetSvcLogger()->Printf(W("%u unique generic body size\n"), uniqueBodySize); - - GetSvcLogger()->Printf(W("%u unmerged generic methods\n"), m_unmergedGenericCount); - GetSvcLogger()->Printf(W("%u merged generic methods\n"), m_mergedGenericCount); - GetSvcLogger()->Printf(W("%u unmerged generic code size\n"), m_unmergedGenericSize); - GetSvcLogger()->Printf(W("%u merged generic code size\n"), m_mergedGenericSize); + else #endif -} - - - -//---------------------------------------------------------------------------------- -// Copies the specified number of bytes from fpIn to fpOut. -//---------------------------------------------------------------------------------- -static bool fcopy(FILE *fpIn, FILE *fpOut, size_t cbBytes) -{ - size_t cbNumBytesLeft = cbBytes; - - while (cbNumBytesLeft) { - byte buffer[PAGE_SIZE]; - size_t cbNumBytesForThisPass = min(cbNumBytesLeft, sizeof(buffer)); - if (1 != fread(buffer, cbNumBytesForThisPass, 1, fpIn)) - return false; - if (1 != fwrite(buffer, cbNumBytesForThisPass, 1, fpOut)) - return false; - cbNumBytesLeft -= cbNumBytesForThisPass; + OutputDebugInfo(); } - return true; } - -//---------------------------------------------------------------------------------- -// Writes the specified number of bytes at a specific position in the output file. -//---------------------------------------------------------------------------------- -static bool fwriteat(FILE *fpOut, ULONG position, const void *pBytes, size_t cbBytes) +struct CompileMethodStubContext { - if (0 != fseek(fpOut, position, SEEK_SET)) - return false; - if (1 != fwrite(pBytes, cbBytes, 1, fpOut)) - return false; - return true; -} + ZapImage * pImage; + unsigned methodProfilingDataFlags; + ZapImage::CompileStatus enumCompileStubResult; -//---------------------------------------------------------------------------------- -// Writes out zeroes to "fp" until the file position is a multiple of "align". -//---------------------------------------------------------------------------------- -static bool fzerofilluntilaligned(LONG align, FILE *fp) -{ - LONG pos = ftell(fp); - LONG endpoint = (LONG)ALIGN_UP(pos, align); - for (LONG i = pos; i < endpoint; i++) + CompileMethodStubContext(ZapImage * _image, unsigned _methodProfilingDataFlags) { - BYTE zero = 0; - if (1 != fwrite(&zero, 1, 1, fp)) - return false; + pImage = _image; + methodProfilingDataFlags = _methodProfilingDataFlags; + enumCompileStubResult = ZapImage::NOT_COMPILED; } - return true; -} - - -//---------------------------------------------------------------------------------- -// When we insert the .MDIL section, we insert bytes into two portions of the IL image. -// -// - Insertion point #1 starts at the end of the original section table (we need a new -// entry for the .MDIL section.) In practice, this always pushes the section table -// into a new FileAlignment page and thus requires bumping everything below -// by other (FileAlignment - sizeof(IMAGE_SECTION_HEADER)) bytes to preserve alignment. -// -// For simplicity, we do this whether or not the section table actually spilled over. -// -// -// - Insertion point #2 starts after the last original section contents. We insert -// the contents of the .MDIL section here. -// -// The bytes in between the insertion points are blitted to the output file -// (except for a few needed fixups.) -// -// It was also attempted to reduce the number of insertion points to 1 by -// inserting the .MDIL contents before the other sections. But PEDecoder boots -// any PE whose section table isn't sorted by both RawData and RVA addresses so -// this pulled the cord on that idea. -//---------------------------------------------------------------------------------- -enum FIXUPREGIONID -{ - FIXUPREGIONID_SECTIONCONTENTS = 0, // region from end of original section table to end of final original section contents. - FIXUPREGIONID_CERTIFICATES = 1, // region from end of section contents to end of file (WIN_CERTIFICATE stuff goes here.) - FIXUPREGIONID_COUNT = 2, - }; +//----------------------------------------------------------------------------- +// This method is a callback function use to compile any IL_STUBS that are +// associated with a normal IL method. It is called from CompileMethodStubIfNeeded +// via the function pointer stored in the CompileMethodStubContext. +// It handles the temporary change to the m_compilerFlags and removes any flags +// that we don't want set when compiling IL_STUBS. +//----------------------------------------------------------------------------- -//---------------------------------------------------------------------------------- -// We create an array of these, sorted by m_start. The array is terminated by -// an entry whose m_start is the size of the input file. -//---------------------------------------------------------------------------------- -struct FixupRegion +// static void __stdcall +void ZapImage::TryCompileMethodStub(LPVOID pContext, CORINFO_METHOD_HANDLE hStub, DWORD dwJitFlags) { - ULONG m_start; // Position of first byte of region (in the input file) - ULONG m_delta; // Amount to add to make it correct for the output file. -}; - -static DWORD FixupPosition(const FixupRegion *pFixupRegions, ULONG inputPosition, ULONG *pOutputPosition) -{ - ULONG delta = 0; - while (inputPosition >= pFixupRegions->m_start) - { - delta = pFixupRegions->m_delta; - if (delta == ((ULONG)(-1))) - return ERROR_BAD_FORMAT; // A FilePointer read from the input file is out of range. - - pFixupRegions++; - } - *pOutputPosition = inputPosition + delta; - return ERROR_SUCCESS; -} - - -//---------------------------------------------------------------------------------- -// Creates a copy of the input IL file with a new ".mdil" section attached. -//---------------------------------------------------------------------------------- -static DWORD EmbedMdilIntoILFile(FILE *inputFile, FILE *outputFile, LPCWSTR inputFileName, ZapImage *pZapImage) -{ -#ifdef BINDER - _ASSERTE(!"intentionally unreachable"); - return E_NOTIMPL; -#else - - _ASSERTE(0 == ftell(inputFile)); - _ASSERTE(0 == ftell(outputFile)); - - - static const BYTE aMDILSectionName[IMAGE_SIZEOF_SHORT_NAME] = {'.','m','d','i','l',0,0,0}; - - NewHolder oldImageSectionHeaders; - - //----------------------------------------------------------------------------------------- - // Read the PE headers. - //----------------------------------------------------------------------------------------- - IMAGE_DOS_HEADER dosHeader; - if (fread(&dosHeader, sizeof(dosHeader), 1, inputFile) != 1) goto ioerror; - if (dosHeader.e_magic != IMAGE_DOS_SIGNATURE) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": Expected 'MZ' at offset 0.\n"), inputFileName); - goto error; // No 'MZ' - } - - size_t cbPEOffset = dosHeader.e_lfanew; - if (0 != fseek(inputFile, cbPEOffset, SEEK_SET)) goto ioerror; - DWORD peSignature; - if (1 != fread(&peSignature, sizeof(peSignature), 1, inputFile)) goto ioerror; - if (peSignature != IMAGE_NT_SIGNATURE) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": Expected 'PE\\0\\0' at offset 0x%x.\n"), inputFileName, ftell(inputFile) - sizeof(peSignature)); - goto error; // No 'PE\0\0' - } - - ULONG positionOfImageFileHeader = ftell(inputFile); - IMAGE_FILE_HEADER imageFileHeader; - if (1 != fread(&imageFileHeader, sizeof(imageFileHeader), 1, inputFile)) goto ioerror; - const int numberOfSections = imageFileHeader.NumberOfSections; - - if (numberOfSections <= 0 || numberOfSections > 2048) // crude buffer overflow guard - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": Suspicious value for IMAGE_FILE_HEADER.NumberOfSections: %d.\n"), inputFileName, numberOfSections); - goto error; // No 'PE\0\0' - } - - ULONG positionOfImageOptionalHeader = ftell(inputFile); - IMAGE_OPTIONAL_HEADER32 imageOptionalHeader; - if (1 != fread(&imageOptionalHeader, sizeof(imageOptionalHeader), 1, inputFile)) goto error; - if (imageOptionalHeader.Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC) //0x10b - { - // No 0x10b magic. Thus, not a 32-bit header. (If you saw 0x20b here, this is a PE with a 64-bit header.) - if (imageOptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": This is a 64-bit image.\n"), inputFileName); - } - else - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": Unexpected IMAGE_OPTIONAL_HEADER.Magic value: 0x%x.\n"), - inputFileName, - (unsigned int)(imageOptionalHeader.Magic)); } - - goto error; - } - - if (imageOptionalHeader.NumberOfRvaAndSizes != IMAGE_NUMBEROF_DIRECTORY_ENTRIES) - { - // Expected 16 IMAGE_DATA_DIRECTORY entries (an assumption hard-coded into the struct definition of IMAGE_OPTIONAL_HEADER32) - pZapImage->GetZapper()->Error(W("Error: \"%ws\": Unexpected IMAGE_OPTIONAL_HEADER.NumberOfRvaAndSizes value: 0x%x.\n"), - inputFileName, - (unsigned int)(imageOptionalHeader.NumberOfRvaAndSizes)); - goto error; - } - - - //----------------------------------------------------------------------------------------- - // Read the IMAGE_SECTION_HEADER array. - //----------------------------------------------------------------------------------------- - if (NULL == (oldImageSectionHeaders = new (nothrow) IMAGE_SECTION_HEADER[numberOfSections])) goto oomerror; - size_t rvaForNewSection = 0; - int sectionIndexOfPreexistingMidlSection = -1; - ULONG endOfLastOriginalPhysicalSector = 0; - ULONG positionOfOriginalSectionTable = ftell(inputFile); - for (int sidx = 0; sidx < numberOfSections; sidx++) - { - ULONG positionOfSectionHeader = ftell(inputFile); - if (1 != fread(&oldImageSectionHeaders[sidx], sizeof(IMAGE_SECTION_HEADER), 1, inputFile)) goto ioerror; - if (0 == memcmp(aMDILSectionName, oldImageSectionHeaders[sidx].Name, IMAGE_SIZEOF_SHORT_NAME)) - { - // If we are asked to generate MDIL, but the current file already has MDIL section, - // we change the section name, and then put in new MDIL section. The old MDIL section will not - // be put into final ni image. - // This is support phone build which puts IL with MDIL on device. - sectionIndexOfPreexistingMidlSection = sidx; - } - - // Pointer and Size of RawData must be aligned. - if (0 != oldImageSectionHeaders[sidx].PointerToRawData % imageOptionalHeader.FileAlignment) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": Section #%d: PointerToRawData not aligned with IMAGE_OPTIONAL_HEADER.FileAlignment.\n"), inputFileName, (sidx + 1)); - goto error; - } - if (0 != oldImageSectionHeaders[sidx].SizeOfRawData % imageOptionalHeader.FileAlignment) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": Section #%d: SizeOfRawData not aligned with IMAGE_OPTIONAL_HEADER.FileAlignment.\n"), inputFileName, (sidx + 1)); - goto error; - } - - endOfLastOriginalPhysicalSector = max(endOfLastOriginalPhysicalSector, oldImageSectionHeaders[sidx].PointerToRawData + oldImageSectionHeaders[sidx].SizeOfRawData); - - size_t spaceNeededForThisSection = ALIGN_UP(oldImageSectionHeaders[sidx].Misc.VirtualSize, imageOptionalHeader.SectionAlignment); - size_t nextFreeRva = oldImageSectionHeaders[sidx].VirtualAddress + spaceNeededForThisSection; - if (nextFreeRva > rvaForNewSection) - rvaForNewSection = nextFreeRva; - } - ULONG positionOfFirstByteAfterOriginalSectionTable = ftell(inputFile); - - //----------------------------------------------------------------------------------------- - // Block copy everything to the end of the original section table. - //----------------------------------------------------------------------------------------- - if (0 != fseek(inputFile, 0, SEEK_SET)) goto ioerror; - if (!fcopy(inputFile, outputFile, positionOfFirstByteAfterOriginalSectionTable)) goto ioerror; - - //----------------------------------------------------------------------------------------- - // Write out the new .mdil section header. (It is not quite filled out yet so this - // is simply the easiest way to advance the file pointer.) - //----------------------------------------------------------------------------------------- - IMAGE_SECTION_HEADER mdilSectionHeader; - memset(&mdilSectionHeader, 0, sizeof(mdilSectionHeader)); - memcpy(mdilSectionHeader.Name, aMDILSectionName, IMAGE_SIZEOF_SHORT_NAME); - mdilSectionHeader.VirtualAddress = rvaForNewSection; - mdilSectionHeader.SizeOfRawData = 0xcccccccc; // Will need fixup later - mdilSectionHeader.PointerToRawData = 0xcccccccc; // Will need fixup later - mdilSectionHeader.Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ; - - ULONG outputPositionOfMdilSectionHeader = ftell(outputFile); - if (1 != fwrite(&mdilSectionHeader, sizeof(mdilSectionHeader), 1, outputFile)) goto ioerror; - - //----------------------------------------------------------------------------------------- - // Adding the extra section header can (and usually does) cause the section table to spill - // over into a new FileAlignment page. In such a case, we have to bump all the section contents - // by FileAlignment bytes. - // - // For simplicity (and since C# always ends up on this case anyway), always bump even if not - // necessary. - //----------------------------------------------------------------------------------------- - for (ULONG i = 0; i < imageOptionalHeader.FileAlignment - sizeof(IMAGE_SECTION_HEADER); i++) - { - BYTE zero = 0; - if (1 != fwrite(&zero, sizeof(zero), 1, outputFile)) goto ioerror; - } - - //----------------------------------------------------------------------------------------- - // Block copy everything from the end of the original section table to the end of the section contents. - //----------------------------------------------------------------------------------------- - ULONG sizeOfOriginalSectionContents = endOfLastOriginalPhysicalSector - positionOfFirstByteAfterOriginalSectionTable; - if (0 != fseek(inputFile, positionOfFirstByteAfterOriginalSectionTable, SEEK_SET)) goto error; - if (!fcopy(inputFile, outputFile, sizeOfOriginalSectionContents)) goto ioerror; - - - //----------------------------------------------------------------------------------------- - // Write out the actual MDIL - //----------------------------------------------------------------------------------------- - mdilSectionHeader.PointerToRawData = ftell(outputFile); - // Our previous alignment checks on the section's PointerToRawData and SizeOfRawData should guarantee this assert - _ASSERTE(0 == (mdilSectionHeader.PointerToRawData % imageOptionalHeader.FileAlignment)); - DWORD errorCode = pZapImage->Write_MDIL(outputFile); - if (errorCode != ERROR_SUCCESS) - return errorCode; - - //----------------------------------------------------------------------------------------- - // Add pad bytes after the MDIL to satisfy the section alignment requirement. - //----------------------------------------------------------------------------------------- - mdilSectionHeader.Misc.VirtualSize = ftell(outputFile) - mdilSectionHeader.PointerToRawData; - mdilSectionHeader.SizeOfRawData = (DWORD)ALIGN_UP(mdilSectionHeader.Misc.VirtualSize, imageOptionalHeader.FileAlignment); - if (!fzerofilluntilaligned(imageOptionalHeader.FileAlignment, outputFile)) goto ioerror; - - //----------------------------------------------------------------------------------------- - // Copy out any stuff after the section contents (e.g. WIN_CERTIFICATE) - //----------------------------------------------------------------------------------------- - if (0 != fseek(inputFile, 0, SEEK_END)) goto ioerror; - ULONG inputFileSize = ftell(inputFile); - ULONG sizeOfStuffAfterSectionContents = inputFileSize - endOfLastOriginalPhysicalSector; - if (0 != fseek(inputFile, endOfLastOriginalPhysicalSector, SEEK_SET)) goto ioerror; - if (!fcopy(inputFile, outputFile, sizeOfStuffAfterSectionContents)) goto ioerror; - ULONG outputFileSize = ftell(outputFile); - - - //========================================================================================= - // End of pass 1. Now do fixups. - //========================================================================================= - - //----------------------------------------------------------------------------------------- - // Record the various regions and their fixup data for easy lookup. - //----------------------------------------------------------------------------------------- - FixupRegion aFixupRegions[FIXUPREGIONID_COUNT + 1]; - memset(&aFixupRegions, 0xcc, sizeof(aFixupRegions)); - - aFixupRegions[FIXUPREGIONID_SECTIONCONTENTS].m_start = positionOfFirstByteAfterOriginalSectionTable; - aFixupRegions[FIXUPREGIONID_SECTIONCONTENTS].m_delta = imageOptionalHeader.FileAlignment; - - - aFixupRegions[FIXUPREGIONID_CERTIFICATES].m_start = endOfLastOriginalPhysicalSector; - aFixupRegions[FIXUPREGIONID_CERTIFICATES].m_delta = outputFileSize - inputFileSize; - - aFixupRegions[FIXUPREGIONID_COUNT].m_start = inputFileSize; - aFixupRegions[FIXUPREGIONID_COUNT].m_delta = (ULONG)(-1); - - - //----------------------------------------------------------------------------------------- - // IMAGE_FILE_HEADER.NumberOfSections is one bigger. Duh. - //----------------------------------------------------------------------------------------- - WORD newNumberOfSections = imageFileHeader.NumberOfSections + 1; - if (!fwriteat(outputFile, - positionOfImageFileHeader + offsetof(IMAGE_FILE_HEADER, NumberOfSections), - &newNumberOfSections, - sizeof(newNumberOfSections))) - goto ioerror; - - //----------------------------------------------------------------------------------------- - // We added a new .MDIL section so add its size to IMAGE_OPTIONAL_HEADER.SizeOfInitializedData. - //----------------------------------------------------------------------------------------- - DWORD newSizeOfInitializedData = imageOptionalHeader.SizeOfInitializedData + mdilSectionHeader.SizeOfRawData; - if (!fwriteat(outputFile, - positionOfImageOptionalHeader + offsetof(IMAGE_OPTIONAL_HEADER, SizeOfInitializedData), - &newSizeOfInitializedData, - sizeof(newSizeOfInitializedData))) - goto ioerror; - - if (0 != (imageOptionalHeader.SizeOfImage % imageOptionalHeader.SectionAlignment)) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": IMAGE_OPTIONAL_HEADER.SizeOfImage not aligned with IMAGE_OPTIONAL_HEADER.SectionAlignment.\n"), inputFileName); - goto error; // Incoming PE format violation: SizeOfImage not a multple of SectionAlignment - } - - //----------------------------------------------------------------------------------------- - // We added a new .MDIL section so add its in-memory size requirements to IMAGE_OPTIONAL_HEADER.SizeOfImage. - //----------------------------------------------------------------------------------------- - DWORD newSizeOfImage = imageOptionalHeader.SizeOfImage + (DWORD)ALIGN_UP(mdilSectionHeader.Misc.VirtualSize, imageOptionalHeader.SectionAlignment); - if (!fwriteat(outputFile, - positionOfImageOptionalHeader + offsetof(IMAGE_OPTIONAL_HEADER, SizeOfImage), - &newSizeOfImage, - sizeof(newSizeOfImage))) - goto ioerror; - - //----------------------------------------------------------------------------------------- - // We added a new IMAGE_SECTION_HEADER so recompute IMAGE_OPTIONAL_HEADER.SizeOfHeaders - //----------------------------------------------------------------------------------------- - ULONG newSizeOfHeaders = (ULONG)(ALIGN_UP(outputPositionOfMdilSectionHeader + sizeof(IMAGE_SECTION_HEADER), imageOptionalHeader.FileAlignment)); - - if (newSizeOfHeaders > oldImageSectionHeaders[0].VirtualAddress) - { - // A corner case that can only come up if the input file has a ridiculously low SectionAlignment (512 bytes) or - // a ridiculous number of sections (50). - pZapImage->GetZapper()->Error( - W("Tool limitation: \"%ws\": Could not embed MDIL into image as there is not enough room to grow the section header table without ") - W("modifying the section RVAs. Modifying section RVAs is not supported by this tool. It may be possible to avoid this ") - W("by rebuilding the input image with a smaller FileAlignment or a larger SectionAlignment. We are sorry for the inconvenience.\n"), - inputFileName); - goto error; - } - - if (!fwriteat(outputFile, - positionOfImageOptionalHeader + offsetof(IMAGE_OPTIONAL_HEADER, SizeOfHeaders), - &newSizeOfHeaders, - sizeof(newSizeOfHeaders))) - goto ioerror; - - //----------------------------------------------------------------------------------------- - // We bumped the section contents by FileAlignment so add that to the original section headers PointerToRawData values. - //----------------------------------------------------------------------------------------- - for (int sidx = 0; sidx < imageFileHeader.NumberOfSections; sidx++) - { - DWORD newPointerToRawData = oldImageSectionHeaders[sidx].PointerToRawData + aFixupRegions[FIXUPREGIONID_SECTIONCONTENTS].m_delta; - if (!fwriteat(outputFile, - positionOfOriginalSectionTable + sidx * sizeof(IMAGE_SECTION_HEADER) + offsetof(IMAGE_SECTION_HEADER, PointerToRawData), - &newPointerToRawData, - sizeof(newPointerToRawData))) - - goto ioerror; - } - - - //----------------------------------------------------------------------------------------- - // We've now fully filled in the .MDIL section header. Rewrite it. - //----------------------------------------------------------------------------------------- - if (!fwriteat(outputFile, - outputPositionOfMdilSectionHeader, - &mdilSectionHeader, - sizeof(mdilSectionHeader))) - goto ioerror; - - //----------------------------------------------------------------------------------------- - // Some joker gave us an input with a .MDIL section already in it. Rename it - // and the binder will drop it over the side. - //----------------------------------------------------------------------------------------- - if (sectionIndexOfPreexistingMidlSection != -1) - { - BYTE nameMangler = '0' + sectionIndexOfPreexistingMidlSection; - if (!fwriteat(outputFile, - positionOfOriginalSectionTable + - sectionIndexOfPreexistingMidlSection * sizeof(IMAGE_SECTION_HEADER) - + offsetof(IMAGE_SECTION_HEADER, Name) - + 4, - &nameMangler, - sizeof(nameMangler))) - goto ioerror; - } - - - //----------------------------------------------------------------------------------------- - // IMAGE_FILE_HEADER.PointerToSymbolTable is always supposed to be 0 for managed PE's. - // If you remove this restriction, you'll need to add fixup code. - //----------------------------------------------------------------------------------------- - if (imageFileHeader.PointerToSymbolTable != 0) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": IMAGE_FILE_HEADER.PointerToSymbolTable expected to be 0.\n"), inputFileName); - goto error; - } - - //----------------------------------------------------------------------------------------- - // IMAGE_DEBUG_DIRECTORY if present has an absolute file pointer to RSDS structure. Fix it up. - //----------------------------------------------------------------------------------------- - ULONG rvaOfOldImageDebugDirectory = imageOptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress; - if (rvaOfOldImageDebugDirectory != 0) - { - if (0 != (imageOptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size % sizeof(IMAGE_DEBUG_DIRECTORY))) - { - // Yes, we have real MP apps that trigger this... - pZapImage->GetZapper()->Warning(W("Warning: \"%ws\": DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size expected to be a multiple of %d.\n"), inputFileName, sizeof(IMAGE_DEBUG_DIRECTORY)); - } - else - { - int sidx; - for (sidx = 0; sidx < numberOfSections; sidx++) - { - if (rvaOfOldImageDebugDirectory >= oldImageSectionHeaders[sidx].VirtualAddress && - rvaOfOldImageDebugDirectory < oldImageSectionHeaders[sidx].VirtualAddress + oldImageSectionHeaders[sidx].Misc.VirtualSize) - { - ULONG positionOfOldImageDebugDirectory = - oldImageSectionHeaders[sidx].PointerToRawData + - rvaOfOldImageDebugDirectory - - oldImageSectionHeaders[sidx].VirtualAddress; - - ULONG positionOfNewImageDebugDirectory; - DWORD errorResult = FixupPosition(aFixupRegions, positionOfOldImageDebugDirectory, &positionOfNewImageDebugDirectory); - if (errorResult != ERROR_SUCCESS) - goto error; - - DWORD numImageDebugDirectories = imageOptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size / sizeof(IMAGE_DEBUG_DIRECTORY); - for (DWORD i = 0; i < numImageDebugDirectories; i++) - { - if (0 != fseek(inputFile, positionOfOldImageDebugDirectory, SEEK_SET)) goto ioerror; - IMAGE_DEBUG_DIRECTORY imageDebugDirectory; - if (1 != fread(&imageDebugDirectory, sizeof(imageDebugDirectory), 1, inputFile)) goto ioerror; - - ULONG positionOfNewDebugRawData = 0xcccccccc; - errorResult = FixupPosition(aFixupRegions, imageDebugDirectory.PointerToRawData, &positionOfNewDebugRawData); - if (errorResult != ERROR_SUCCESS) - { - if (errorResult != ERROR_BAD_FORMAT) - goto error; - - // Don't make this a fatal error: not everyone sets IMAGE_DEBUG_DIRECTORY.PointerToRawData correctly. - pZapImage->GetZapper()->Warning(W("Warning: \"%ws\": IMAGE_DEBUG_DIRECTORY.PointerToRawData has an out of range value: 0x%x.\n"), inputFileName, imageDebugDirectory.PointerToRawData); - } - else - { - if (!fwriteat(outputFile, positionOfNewImageDebugDirectory + offsetof(IMAGE_DEBUG_DIRECTORY, PointerToRawData), &positionOfNewDebugRawData, sizeof(positionOfNewDebugRawData))) - goto error; - } - - positionOfOldImageDebugDirectory += sizeof(IMAGE_DEBUG_DIRECTORY); - positionOfNewImageDebugDirectory += sizeof(IMAGE_DEBUG_DIRECTORY); - } - break; - } - } - if (sidx == numberOfSections) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress points outside the bounds of the image: 0x%x.\n"), inputFileName, rvaOfOldImageDebugDirectory); - goto error; // Could not resolve IMAGE_DEBUG_DIRECTORY rva. - } - } - } - - - //----------------------------------------------------------------------------------------- - // The WIN_CERTIFICATE structure, if present, is stored at the end of the PE file outside of - // any section. The so-called "rva" at IMAGE_DATA_DIRECTORY[4] is actually an absolute file position. - //----------------------------------------------------------------------------------------- - ULONG oldPositionOfWinCertificate = imageOptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress; - if (oldPositionOfWinCertificate != 0) - { - ULONG newPositionOfWinCertificate; - DWORD errorCode = FixupPosition(aFixupRegions, oldPositionOfWinCertificate, &newPositionOfWinCertificate); - if (errorCode != ERROR_SUCCESS) - { - pZapImage->GetZapper()->Error(W("Error: \"%ws\": DataDirectory[IMAGE_DIRECTORY_ENTRY_SECURITY].VirtualAddress points outside the bounds of the image: 0x%x.\n"), inputFileName, oldPositionOfWinCertificate); - goto error; - } - - if (!fwriteat(outputFile, - positionOfImageOptionalHeader - + offsetof(IMAGE_OPTIONAL_HEADER, DataDirectory) - + sizeof(IMAGE_DATA_DIRECTORY) * IMAGE_DIRECTORY_ENTRY_SECURITY - + offsetof(IMAGE_DATA_DIRECTORY, VirtualAddress), - &newPositionOfWinCertificate, - sizeof(newPositionOfWinCertificate))) - { - goto ioerror; - } - } - - //----------------------------------------------------------------------------------------- - // Force NX_COMPAT and DYNAMIC_BASE so secure OS loaders can load the image (obfuscators - // tend to strip these off) - //----------------------------------------------------------------------------------------- - DWORD newDllCharacteristics = imageOptionalHeader.DllCharacteristics | IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE | IMAGE_DLLCHARACTERISTICS_NX_COMPAT; - if (!fwriteat(outputFile, - positionOfImageOptionalHeader + offsetof(IMAGE_OPTIONAL_HEADER, DllCharacteristics), - &newDllCharacteristics, - sizeof(newDllCharacteristics))) - goto error; - - //========================================================================================= - // End of final pass. Output complete. - //========================================================================================= - - return ERROR_SUCCESS; - -ioerror: - pZapImage->GetZapper()->Error(W("Error: \"%ws\": Unexpected end of file.\n"), inputFileName); - return E_FAIL; - -oomerror: - return E_OUTOFMEMORY; - -error: - return ERROR_BAD_FORMAT; -#endif // BINDER -} - - - -void ZapImage::Output_MDIL() -{ -#ifdef BINDER - _ASSERTE(!"intentionally unreachable"); -#else - - - StackSString outputFileName(m_zapper->GetOutputFileName()); - FILE *outputFile = _wfopen(outputFileName.GetUnicode(), W("wb")); - if (outputFile == NULL) - return; - - FILE *inputFile = _wfopen(m_pModuleFileName, W("rb")); - if (!inputFile) goto error; - - DWORD errorCode = EmbedMdilIntoILFile(inputFile, outputFile, m_pModuleFileName, this); - if (errorCode != ERROR_SUCCESS) - { - SetLastError(errorCode); - goto error; - } - - fclose(inputFile); - fclose(outputFile); - - // GetSvcLogger()->Printf(W("finished generating %s file\n"), outputFileName.GetUnicode()); - return; - - -error: - DWORD dwLastError = GetLastError(); - fclose(inputFile); - fclose(outputFile); - WszDeleteFile(outputFileName.GetUnicode()); - m_zapper->Error(W("Could not create %ls file\n"), outputFileName.GetUnicode()); - SetLastError(dwLastError); - ThrowLastError(); -#endif // BINDER -} - - -//---------------------------------------------------------------------------------- -// Writes out the MDIL blob. -//---------------------------------------------------------------------------------- -DWORD ZapImage::Write_MDIL(FILE *outputFile) -{ -#ifdef BINDER - _ASSERTE(!"intentionally unreachable"); - return E_NOTIMPL; -#else - - if (m_pICLW != NULL) - { - delete m_pICLW; - m_pICLW = NULL; - } - MDILHeader mdilHeader; - memset(&mdilHeader, 0, sizeof(mdilHeader)); - - if (m_methodRidCount == 0) - { - m_mapMethodRidToOffs.SetCount(1); - m_mapMethodRidToOffs[0] = 0xcafedead; - m_methodRidCount = 1; - } - - DWORD totalCodeSize = 0; - DWORD totalDebugInfoSize = 0; - for (int codeKind = GENERIC_CODE; codeKind < CODE_KIND_COUNT; codeKind++) - { - if (m_codeOffs[codeKind] < sizeof(DWORD) && codeKind == GENERIC_CODE) - { - _ASSERTE(m_codeOffs[codeKind] == 0); - m_codeBuffer[codeKind].SetCount(sizeof(DWORD)); - m_codeOffs[codeKind] = sizeof(DWORD); - - OutputDWord(&m_codeBuffer[codeKind][0], 'MDCD'); - - } - totalCodeSize += m_codeOffs[codeKind]; - totalDebugInfoSize += m_debugInfoBuffer[codeKind].GetCount(); - } - - EncodeGenericInstances_MDIL(); - - // turns out we actually need an exact method count - IMDInternalImport * pMDImport = m_pMDImport; - HENUMInternalHolder hEnum(pMDImport); - hEnum.EnumAllInit(mdtMethodDef); - m_methodRidCount = hEnum.EnumGetCount() + m_stubMethodCount + 1; - if (m_methodRidCount < m_mapMethodRidToOffs.GetCount()) - { - for (COUNT_T i = m_methodRidCount; i < m_mapMethodRidToOffs.GetCount(); i++) - _ASSERTE(m_mapMethodRidToOffs[i] == 0); - } - else if (m_mapMethodRidToOffs.GetCount() < m_methodRidCount) - { - COUNT_T oldCount = m_mapMethodRidToOffs.GetCount(); - m_mapMethodRidToOffs.SetCount(m_methodRidCount); - for (COUNT_T i = oldCount; i < m_methodRidCount; i++) - m_mapMethodRidToOffs[i] = 0; - } - - - // conceptually, the code buffers for generic and non-generic code should be treated as one buffer - // that implies that we need to add the size of the generic code buffer to offsets in the non-generic code - // buffer - for (COUNT_T methodRid = 0; methodRid < m_mapMethodRidToOffs.GetCount(); methodRid++) - { - if ((m_mapMethodRidToOffs[methodRid] != 0) && - ((m_mapMethodRidToOffs[methodRid] & GENERIC_METHOD_REF) == 0)) - { - m_mapMethodRidToOffs[methodRid] += m_codeOffs[GENERIC_CODE]; - } - } - - for (COUNT_T methodRid = 0; methodRid < m_mapMethodRidToDebug.GetCount(); methodRid++) - { - if (m_mapMethodRidToDebug[methodRid] != 0xFFFFFFFF) - m_mapMethodRidToDebug[methodRid] += m_debugInfoBuffer[GENERIC_CODE].GetCount(); - else - m_mapMethodRidToDebug[methodRid] = 0; - } - - - mdilHeader.hdrSize = sizeof(mdilHeader); - mdilHeader.magic = 'MDIL'; - mdilHeader.version = MDIL_VERSION_CURRENT; - mdilHeader.methodMapCount = m_methodRidCount; - mdilHeader.extModuleCount = m_extModRef.GetCount(); - mdilHeader.genericInstSize = m_genericInstPool.GetCount(); - mdilHeader.extTypeCount = m_extTypeRef.GetCount(); - mdilHeader.extMemberCount = m_extMemberRef.GetCount(); - mdilHeader.namePoolSize = m_namePool.GetCount(); - mdilHeader.codeSize = totalCodeSize; - mdilHeader.typeMapCount = m_typeRidCount; - mdilHeader.typeSpecCount = m_typeSpecToOffs.GetCount(); - mdilHeader.methodSpecCount = m_methodSpecToOffs.GetCount(); - mdilHeader.signatureCount = m_signatureToOffs.GetCount(); - mdilHeader.typeSize = m_compactLayoutOffs; - mdilHeader.userStringPoolSize = m_userStringPool.GetCount(); - mdilHeader.stubSize = m_stubBuffer.GetCount(); - mdilHeader.stubAssocSize = m_stubAssocBuffer.GetCount(); - mdilHeader.debugMapCount = m_mapMethodRidToDebug.GetCount(); - mdilHeader.debugInfoSize = totalDebugInfoSize; - - mdilHeader.genericCodeSize = m_codeOffs[GENERIC_CODE]; - mdilHeader.genericDebugInfoSize = m_debugInfoBuffer[GENERIC_CODE].GetCount(); - - mdilHeader.compilerVersionMajor = VER_MAJORVERSION; - mdilHeader.compilerVersionMinor = VER_MINORVERSION; - mdilHeader.compilerVersionBuildNumber = VER_PRODUCTBUILD; - mdilHeader.compilerVersionPrivateBuildNumber = VER_PRODUCTBUILD_QFE; - - mdilHeader.subVersion = MDIL_SUB_VERSION_CURRENT; - - if (m_wellKnownTypesTable.GetCount() != 0) - { - assert(m_wellKnownTypesTable.GetCount() == WKT_COUNT); - mdilHeader.flags |= MDILHeader::WellKnownTypesPresent; - } - - LoadHintEnum loadHint = LoadDefault; - LoadHintEnum defaultLoadHint = LoadDefault; - GetCompileInfo()->GetLoadHint(m_zapper->m_hAssembly, - m_zapper->m_hAssembly, - &loadHint, - &defaultLoadHint); - if (defaultLoadHint == LoadAlways) - { - mdilHeader.flags |= MDILHeader::IsEagerlyLoaded; - } - - mdilHeader.flags |= GetCompileInfo()->GetMdilModuleSecurityFlags(m_zapper->m_hAssembly); - - if (GetCompileInfo()->CompilerRelaxationNoStringInterningPermitted(m_zapper->m_hAssembly)) - { - mdilHeader.flags |= MDILHeader::CompilerRelaxationNoStringInterning; - } - - if (GetCompileInfo()->CompilerRelaxationNoStringInterningPermitted(m_zapper->m_hAssembly)) - { - mdilHeader.flags |= MDILHeader::RuntimeCompatibilityRuntimeWrappedExceptions; - } - - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MINIMAL_MDIL) - { - mdilHeader.flags |= MDILHeader::MinimalMDILImage; - } - - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_NO_MDIL) - { - mdilHeader.flags |= MDILHeader::NoMDILImage; - } - - mdilHeader.cerReliabilityContract = GetCompileInfo()->CERReliabilityContract(m_zapper->m_hAssembly); - - // reset architecture mask - mdilHeader.flags &= ~MDILHeader::TargetArch_Mask; - -#if defined(_TARGET_X86_) - mdilHeader.flags |= MDILHeader::TargetArch_X86; -#elif defined(_TARGET_ARM_) - mdilHeader.flags |= MDILHeader::TargetArch_ARM; -#elif defined(_TARGET_AMD64_) - mdilHeader.flags |= MDILHeader::TargetArch_AMD64; -#else -#error unexpected target architecture (neither x86, ARM, or AMD64) -#endif //_TARGET_X86_ - - mdilHeader.entryPointToken = m_ModuleDecoder.GetEntryPointToken(); - mdilHeader.subsystem = m_ModuleDecoder.GetSubsystem(); - { - // Read the actual preferred base address from the disk - - // Note that we are reopening the file here. We are not guaranteed to get the same file. - // The worst thing that can happen is that we will read a bogus preferred base address from the file. - HandleHolder hFile(WszCreateFile(m_pModuleFileName, - GENERIC_READ, - FILE_SHARE_READ|FILE_SHARE_DELETE, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL)); - if (hFile == INVALID_HANDLE_VALUE) - ThrowLastError(); - - HandleHolder hFileMap(WszCreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)); - if (hFileMap == NULL) - ThrowLastError(); - - MapViewHolder base(MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, 0)); - if (base == NULL) - ThrowLastError(); - - DWORD dwFileLen = SafeGetFileSize(hFile, 0); - if (dwFileLen == INVALID_FILE_SIZE) - ThrowLastError(); - - PEDecoder peFlat((void *)base, (COUNT_T)dwFileLen); - - mdilHeader.baseAddress = peFlat.GetPreferredBase(); - } - - mdilHeader.platformID = MDILHeader::PlatformID_Triton; - - ClrCtlData clrCtlData; - SArray blobData; - const void *pPublicKey = NULL; - ULONG cbPublicKey = 0; - ULONG cbPublicKeyToken = 0; - BYTE* pKeyToken = NULL; - - AssemblyMetaDataInternal metaData; - LPCSTR pModuleName; - LPCSTR pAssemblyName; - DWORD flags; - memset(&clrCtlData, 0, sizeof(clrCtlData)); - clrCtlData.hdrSize = sizeof(clrCtlData); - - m_pMDImport->GetScopeProps(&pModuleName, &clrCtlData.MVID); - m_pMDImport->GetAssemblyProps( - TokenFromRid(1, mdtAssembly), // [IN] The Assembly for which to get the properties. - &pPublicKey, - &cbPublicKey, - NULL, // [OUT] Hash Algorithm - &pAssemblyName, // [OUT] Buffer to fill with name - &metaData, // [OUT] Assembly Metadata (version, locale, etc.) - &flags); // [OUT] Flags - - clrCtlData.assemblyName = m_assemblyName; - clrCtlData.locale = m_locale; - clrCtlData.majorVersion = metaData.usMajorVersion; - clrCtlData.minorVersion = metaData.usMinorVersion; - clrCtlData.buildNumber = metaData.usBuildNumber; - clrCtlData.revisionNumber = metaData.usRevisionNumber; - if (cbPublicKey > 0) { - if ((flags & afPublicKey)!= 0) { - clrCtlData.hasPublicKey = 1; - } - clrCtlData.cbPublicKey = cbPublicKey; - clrCtlData.publicKeyBlob = blobData.GetCount(); - blobData.SetCount(clrCtlData.publicKeyBlob + clrCtlData.cbPublicKey); - memcpy_s(&blobData[(COUNT_T)clrCtlData.publicKeyBlob], clrCtlData.cbPublicKey, pPublicKey, cbPublicKey); - - if (StrongNameTokenFromPublicKey((BYTE*)pPublicKey, cbPublicKey, - &pKeyToken, &cbPublicKeyToken)) - { - if (cbPublicKeyToken > 0 && cbPublicKeyToken == sizeof(clrCtlData.publicKeyToken)) { - memcpy(&clrCtlData.publicKeyToken, pKeyToken, cbPublicKeyToken); - clrCtlData.cbPublicKeyToken = cbPublicKeyToken; - clrCtlData.hasPublicKeyToken = true; - } - } - - } - - CORCOMPILE_VERSION_INFO versionInfo; - IfFailThrow(m_zapper->m_pEECompileInfo->GetAssemblyVersionInfo(m_zapper->m_hAssembly, &versionInfo)); - - mdilHeader.timeDateStamp = versionInfo.sourceAssembly.timeStamp; - clrCtlData.ilImageSize = versionInfo.sourceAssembly.ilImageSize; - clrCtlData.wcbSNHash = 0; - clrCtlData.snHashBlob = blobData.GetCount(); - - clrCtlData.cbTPBandName = 0; - clrCtlData.tpBandNameBlob = blobData.GetCount(); - - clrCtlData.extTypeRefExtendCount = m_extTypeRefExtend.GetCount(); - clrCtlData.extMemberRefExtendCount = m_extMemberRefExtend.GetCount(); - - clrCtlData.neutralResourceCultureNameLen = m_neutralResourceCultureNameLen; - clrCtlData.neutralResourceCultureName = m_cultureName; - clrCtlData.neutralResourceFallbackLocation = m_neutralResourceFallbackLocation; - - mdilHeader.blobDataSize = blobData.GetCount() * sizeof(blobData[0]); - - if ((versionInfo.wConfigFlags & CORCOMPILE_CONFIG_DEBUG) != 0) - { - mdilHeader.flags |= MDILHeader::DebuggableMDILCode; - if ((versionInfo.wConfigFlags & CORCOMPILE_CONFIG_DEBUG_DEFAULT) != 0) - mdilHeader.flags |= MDILHeader::DebuggableILAssembly; - } - else - { - // Current CLR doesn't allow non-debuggable native image to be generated from debuggable assembly. - _ASSERTE((versionInfo.wConfigFlags & CORCOMPILE_CONFIG_DEBUG_DEFAULT) != 0); - } - - //----------------------------------------------------------------------------------------- - // Write out the MDIL blob. - //----------------------------------------------------------------------------------------- - if (fwrite(&mdilHeader, sizeof(mdilHeader), 1, outputFile) != 1) goto error; - m_pMDImport->GetRvaOffsetData(&clrCtlData.firstMethodRvaOffset, &clrCtlData.methodDefRecordSize, &clrCtlData.methodDefCount, - &clrCtlData.firstFieldRvaOffset, &clrCtlData.fieldRvaRecordSize, &clrCtlData.fieldRvaCount); - if (fwrite(&clrCtlData, sizeof(clrCtlData), 1, outputFile) != 1) goto error; - - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_NO_MDIL) - { - // If this is a no MDIL image, we are already done. - goto success; - } - - if (blobData.GetCount() > 0) - { - if(fwrite(&blobData[0], blobData.GetCount() * sizeof(blobData[0]), 1, outputFile) != 1) goto error; - } - - if (mdilHeader.flags & MDILHeader::WellKnownTypesPresent - && fwrite(&m_wellKnownTypesTable[0], m_wellKnownTypesTable.GetCount()*sizeof(m_wellKnownTypesTable[0]), 1, outputFile) != 1) goto error; - if (m_typeRidCount != 0 - && fwrite(&m_mapTypeRidToOffs[0], m_typeRidCount *sizeof(m_mapTypeRidToOffs[0]), 1, outputFile) != 1) goto error; - if (fwrite(&m_mapMethodRidToOffs[0], m_methodRidCount *sizeof(m_mapMethodRidToOffs[0]), 1, outputFile) != 1) goto error; - if (mdilHeader.genericInstSize != 0 - && fwrite(&m_genericInstPool[0], mdilHeader.genericInstSize*sizeof(m_genericInstPool[0]), 1, outputFile) != 1) goto error; - if (fwrite(&m_extModRef[0], m_extModRef.GetCount() *sizeof(m_extModRef[0]), 1, outputFile) != 1) goto error; - if (fwrite(&m_extTypeRef[0], m_extTypeRef.GetCount() *sizeof(m_extTypeRef[0]), 1, outputFile) != 1) goto error; - if (fwrite(&m_extMemberRef[0], m_extMemberRef.GetCount()*sizeof(m_extMemberRef[0]), 1, outputFile) != 1) goto error; - if (mdilHeader.typeSpecCount > 0 - && fwrite(&m_typeSpecToOffs[0], m_typeSpecToOffs.GetCount()*sizeof(m_typeSpecToOffs[0]), 1, outputFile) != 1) goto error; - if (mdilHeader.methodSpecCount > 0 - && fwrite(&m_methodSpecToOffs[0], m_methodSpecToOffs.GetCount()*sizeof(m_methodSpecToOffs[0]),1,outputFile) != 1) goto error; - if (mdilHeader.signatureCount > 0 - && fwrite(&m_signatureToOffs[0], m_signatureToOffs.GetCount()*sizeof(m_signatureToOffs[0]), 1,outputFile) != 1) goto error; - if (fwrite(&m_namePool[0], sizeof(m_namePool[0]), m_namePool.GetCount(), outputFile) != m_namePool.GetCount()) goto error; - if (m_compactLayoutOffs > 0 - && fwrite(&m_compactLayoutBuffer[0], m_compactLayoutOffs *sizeof(m_compactLayoutBuffer[0]),1, outputFile) != 1) goto error; - if (mdilHeader.userStringPoolSize > 0 - && fwrite(&m_userStringPool[0], sizeof(m_userStringPool[0]),m_userStringPool.GetCount(), outputFile) != m_userStringPool.GetCount()) goto error; - if (fwrite(&m_codeBuffer[GENERIC_CODE][0], m_codeOffs[GENERIC_CODE], 1, outputFile) != 1) goto error; - //write out the non-generic code immediatly after the generic code. - if (m_codeOffs[NON_GENERIC_CODE] != 0 && fwrite(&m_codeBuffer[NON_GENERIC_CODE][0], m_codeOffs[NON_GENERIC_CODE], 1, outputFile) != 1) goto error; - if (mdilHeader.stubSize > 0 - && fwrite(&m_stubBuffer[0], mdilHeader.stubSize*sizeof(m_stubBuffer[0]), 1, outputFile) != 1) goto error; - if (mdilHeader.stubAssocSize > 0 - && fwrite(&m_stubAssocBuffer[0], mdilHeader.stubAssocSize*sizeof(m_stubAssocBuffer[0]), 1, outputFile) != 1) goto error; - if (mdilHeader.debugMapCount > 0 - && fwrite(&m_mapMethodRidToDebug[0], mdilHeader.debugMapCount*sizeof(m_mapMethodRidToDebug[0]), 1, outputFile) != 1) goto error; - if (m_debugInfoBuffer[GENERIC_CODE].GetCount() > 0 - && fwrite(&m_debugInfoBuffer[GENERIC_CODE][0], m_debugInfoBuffer[GENERIC_CODE].GetCount(), 1, outputFile) != 1) goto error; - //write out the non-generic debug info immediately after the generic debug info - if (m_debugInfoBuffer[NON_GENERIC_CODE].GetCount() > 0 - && fwrite(&m_debugInfoBuffer[NON_GENERIC_CODE][0], m_debugInfoBuffer[NON_GENERIC_CODE].GetCount(),1, outputFile) != 1) goto error; - - - if (m_extTypeRefExtend.GetCount() > 0) - { - if (fwrite(&m_extTypeRefExtend[0], m_extTypeRefExtend.GetCount()*sizeof(m_extTypeRefExtend[0]), 1, outputFile) != 1) goto error; - } - if (m_extMemberRefExtend.GetCount() > 0) - { - if (fwrite(&m_extMemberRefExtend[0], m_extMemberRefExtend.GetCount()*sizeof(m_extMemberRefExtend[0]), 1, outputFile) != 1) goto error; - } - - -success: - return ERROR_SUCCESS; - -error: - DWORD dwLastError = GetLastError(); - if (dwLastError == ERROR_SUCCESS) - dwLastError = E_FAIL; - return dwLastError; -#endif // BINDER -} - -void ZapImage::FlushCompactLayoutData(mdToken typeToken, BYTE *pData, ULONG cData) -{ -#ifndef BINDER - // Save the data in m_compactLayoutBuffer - COUNT_T dataSize = m_compactLayoutBuffer.GetCount(); - if (dataSize < sizeof(DWORD)) - { - assert(dataSize == 0); - m_compactLayoutBuffer.SetCount(10000); - memcpy(&m_compactLayoutBuffer[0], "CMPL", sizeof(DWORD)); - m_compactLayoutOffs = sizeof(DWORD); - } - COUNT_T desiredSize = m_compactLayoutOffs + cData; - while (m_compactLayoutBuffer.GetCount() < desiredSize) - m_compactLayoutBuffer.SetCount(m_compactLayoutBuffer.GetCount()*2); - memcpy(&m_compactLayoutBuffer[(COUNT_T)m_compactLayoutOffs], pData, cData); - - COUNT_T rid = RidFromToken(typeToken); - if (TypeFromToken(typeToken) == mdtTypeSpec) - { - assert(rid < m_typeSpecToOffs.GetCount()); - m_typeSpecToOffs[rid] = m_compactLayoutOffs; - } - else if (TypeFromToken(typeToken) == mdtMethodSpec) - { - assert(rid < m_methodSpecToOffs.GetCount()); - m_methodSpecToOffs[rid] = m_compactLayoutOffs; - } - else if (TypeFromToken(typeToken) == mdtSignature) - { - assert(rid < m_signatureToOffs.GetCount()); - m_signatureToOffs[rid] = m_compactLayoutOffs; - } - else if (TypeFromToken(typeToken) == mdtMemberRef) - { - assert(rid < m_extMemberRefExtend.GetCount()); - m_extMemberRefExtend[rid].signature = m_compactLayoutOffs; - } - else - { - assert(TypeFromToken(typeToken) == mdtTypeDef); - // Remember the offset in m_mapTypeRidToOffs - COUNT_T mappingCount = m_mapTypeRidToOffs.GetCount(); - if (mappingCount <= rid) - { - if (mappingCount == 0) - { - m_typeRidCount = 0; - m_mapTypeRidToOffs.SetCount(1000); - } - while (m_mapTypeRidToOffs.GetCount() <= rid) - m_mapTypeRidToOffs.SetCount(m_mapTypeRidToOffs.GetCount()*2); - COUNT_T newMappingCount = m_mapTypeRidToOffs.GetCount(); - for (COUNT_T i = mappingCount; i < newMappingCount; i++) - m_mapTypeRidToOffs[i] = 0; - m_typeRidCount = rid+1; - } - if (m_typeRidCount < rid+1) - m_typeRidCount = rid+1; - m_mapTypeRidToOffs[rid] = m_compactLayoutOffs; - } - m_compactLayoutOffs += cData; -#endif // !BINDER -} - -void ZapImage::FlushStubData(BYTE *pStubSize, ULONG cStubSize, - BYTE *pStubData, ULONG cStubData, - BYTE *pStubAssocData, ULONG cStubAssocData) -{ - // Save the data in m_stubBuffer and m_stubAssocBuffer - m_stubBuffer.SetCount(cStubSize + cStubData); - memcpy(&m_stubBuffer[0], pStubSize, cStubSize); - memcpy(&m_stubBuffer[(COUNT_T)cStubSize], pStubData, cStubData); - - m_stubAssocBuffer.SetCount(cStubAssocData); - memcpy(&m_stubAssocBuffer[0], pStubAssocData, cStubAssocData); -} - -// Flush the user string pool -void ZapImage::FlushUserStringPool(BYTE *pData, ULONG cData) -{ - m_userStringPool.SetCount(AlignUp(cData, sizeof(DWORD))); - memcpy(&m_userStringPool[0], pData, cData); -} - -void ZapImage::FlushWellKnownTypes(DWORD *wellKnownTypesTable, SIZE_T count) -{ - m_wellKnownTypesTable.SetCount((DWORD)count); - memcpy(&m_wellKnownTypesTable[0], wellKnownTypesTable, count*sizeof(wellKnownTypesTable[0])); -} -#endif - -void ZapImage::Compile() -{ - // - // First, compile methods in the load order array. - // - bool doNothingNgen = false; -#ifdef _DEBUG - static ConfigDWORD fDoNothingNGen; - doNothingNgen = !!fDoNothingNGen.val(CLRConfig::INTERNAL_ZapDoNothing); -#endif - -#ifdef MDIL - // Reset stream (buffer) only when we are really generating MDIL (instead of just an empty MDIL section) - if ((m_zapper->m_pOpt->m_compilerFlags & (CORJIT_FLG_MDIL|CORJIT_FLG_NO_MDIL)) == CORJIT_FLG_MDIL) - { - GetCompactLayoutWriter()->Reset(); - } -#endif - - if (!doNothingNgen) - { - // - // Compile the methods specified by the IBC profile data - // - CompileProfileData(); - - BeginRegion(CORINFO_REGION_COLD); - - - IMDInternalImport * pMDImport = m_pMDImport; - - HENUMInternalHolder hEnum(pMDImport); - hEnum.EnumAllInit(mdtMethodDef); - - mdMethodDef md; - while (pMDImport->EnumNext(&hEnum, &md)) - { - if (m_pILMetaData != NULL) - { - // Copy IL for all methods. We treat errors during copying IL - // over as fatal error. These errors are typically caused by - // corrupted IL images. - // - m_pILMetaData->EmitMethodIL(md); - } - - // - // Compile the remaining methods that weren't compiled during the CompileProfileData phase - // - TryCompileMethodDef(md, 0); - } - - // Compile any generic code which lands in this LoaderModule - // that resulted from the above compilations - CORINFO_METHOD_HANDLE handle = m_pPreloader->NextUncompiledMethod(); - while (handle != NULL) - { - TryCompileInstantiatedMethod(handle, 0); - handle = m_pPreloader->NextUncompiledMethod(); - } - - EndRegion(CORINFO_REGION_COLD); - - // If we want ngen to fail when we create partial ngen images we can - // throw an NGEN failure HRESULT here. -#if 0 - if (m_zapper->m_failed) - { - ThrowHR(NGEN_E_TP_PARTIAL_IMAGE); - } -#endif - - } - - // Compute a preferred class layout order based on analyzing the graph - // of which classes contain calls to other classes. - ComputeClassLayoutOrder(); - - // Sort the unprofiled methods by this preferred class layout, if available - if (m_fHasClassLayoutOrder) - { - SortUnprofiledMethodsByClassLayoutOrder(); - } - -#ifdef MDIL - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) - { - if (!(m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_NO_MDIL)) - { - GetCompactLayoutWriter()->FlushStubData(); - } - Output_MDIL(); - } - else -#endif - { - if (IsReadyToRunCompilation()) - { - // Pretend that no methods are trained, so that everything is in single code section - // READYTORUN: FUTURE: More than one code section - m_iUntrainedMethod = 0; - } - - OutputCode(ProfiledHot); - OutputCode(Unprofiled); - OutputCode(ProfiledCold); - - OutputCodeInfo(ProfiledHot); - OutputCodeInfo(ProfiledCold); // actually both Unprofiled and ProfiledCold - - OutputGCInfo(); - OutputProfileData(); - -#ifdef FEATURE_READYTORUN_COMPILER - if (IsReadyToRunCompilation()) - { - OutputEntrypointsTableForReadyToRun(); - OutputDebugInfoForReadyToRun(); - } - else -#endif - { - OutputDebugInfo(); - } - } -} - -struct CompileMethodStubContext -{ - ZapImage * pImage; - unsigned methodProfilingDataFlags; - ZapImage::CompileStatus enumCompileStubResult; - - CompileMethodStubContext(ZapImage * _image, unsigned _methodProfilingDataFlags) - { - pImage = _image; - methodProfilingDataFlags = _methodProfilingDataFlags; - enumCompileStubResult = ZapImage::NOT_COMPILED; - } -}; - -//----------------------------------------------------------------------------- -// This method is a callback function use to compile any IL_STUBS that are -// associated with a normal IL method. It is called from CompileMethodStubIfNeeded -// via the function pointer stored in the CompileMethodStubContext. -// It handles the temporary change to the m_compilerFlags and removes any flags -// that we don't want set when compiling IL_STUBS. -//----------------------------------------------------------------------------- - -// static void __stdcall -void ZapImage::TryCompileMethodStub(LPVOID pContext, CORINFO_METHOD_HANDLE hStub, DWORD dwJitFlags) -{ - STANDARD_VM_CONTRACT; + STANDARD_VM_CONTRACT; // The caller must always set the IL_STUB flag _ASSERTE((dwJitFlags & CORJIT_FLG_IL_STUB) != 0); @@ -3526,16 +1946,6 @@ void ZapImage::TryCompileMethodStub(LPVOID pContext, CORINFO_METHOD_HANDLE hStub CORJIT_FLG_DEBUG_INFO); mdMethodDef md = mdMethodDefNil; -#ifdef MDIL - if (pImage->m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) - { - md = pImage->GetCompactLayoutWriter()->GetNextStubToken(); - if (md == mdMethodDefNil) - return; - - pImage->m_stubMethodCount++; - } -#endif // MDIL pCompileContext->enumCompileStubResult = pImage->TryCompileMethodWorker(hStub, md, pCompileContext->methodProfilingDataFlags); @@ -3615,13 +2025,11 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodDef(mdMethodDef md, unsigned m } else { -#ifndef BINDER Exception *ex = GET_EXCEPTION(); HRESULT hrException = ex->GetHR(); StackSString message; - if (hrException != COR_E_UNSUPPORTEDMDIL) - ex->GetMessage(message); + ex->GetMessage(message); CorZapLogLevel level; @@ -3641,12 +2049,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodDef(mdMethodDef md, unsigned m level = CORZAP_LOGLEVEL_INFO; } - if (hrException != COR_E_UNSUPPORTEDMDIL) - m_zapper->Print(level, W("%s while compiling method token 0x%x\n"), message.GetUnicode(), md); -#else - m_zapper->PrintErrorMessage(CORZAP_LOGLEVEL_ERROR, GET_EXCEPTION()); - m_zapper->Error(W(" while compiling method token 0x%x\n"), md); -#endif + m_zapper->Print(level, W("%s while compiling method token 0x%x\n"), message.GetUnicode(), md); result = LOOKUP_FAILED; @@ -3674,12 +2077,6 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodDef(mdMethodDef md, unsigned m m_pPreloader->GenerateMethodStubs(handle, m_zapper->m_pOpt->m_ngenProfileImage, &TryCompileMethodStub, &context); - -#ifdef MDIL - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) - m_pPreloader->AddMDILCodeFlavorsToUncompiledMethods(handle); -#endif - } return methodCompileStatus; @@ -3755,15 +2152,6 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h if (GetCompileInfo()->HasCustomAttribute(handle, "System.Runtime.BypassNGenAttribute")) return NOT_COMPILED; -#ifdef MDIL - // This is a quick workaround to opt specific methods out of MDIL generation to work around bugs. - if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) - { - if (GetCompileInfo()->HasCustomAttribute(handle, "System.Runtime.BypassMdilAttribute")) - return NOT_COMPILED; - } -#endif - #ifdef FEATURE_READYTORUN_COMPILER // This is a quick workaround to opt specific methods out of ReadyToRun compilation to work around bugs. if (IsReadyToRunCompilation()) @@ -3821,7 +2209,6 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h } EX_CATCH { -#ifndef BINDER // Continue unwinding if fatal error was hit. if (FAILED(g_hrFatalError)) ThrowHR(g_hrFatalError); @@ -3830,8 +2217,7 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h HRESULT hrException = ex->GetHR(); StackSString message; - if (hrException != COR_E_UNSUPPORTEDMDIL) - ex->GetMessage(message); + ex->GetMessage(message); CorZapLogLevel level; @@ -3851,12 +2237,8 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h level = CORZAP_LOGLEVEL_INFO; } - if (hrException != COR_E_UNSUPPORTEDMDIL) - m_zapper->Print(level, W("%s while compiling method %s\n"), message.GetUnicode(), zapInfo.m_currentMethodName.GetUnicode()); -#else - m_zapper->PrintErrorMessage(CORZAP_LOGLEVEL_ERROR, GET_EXCEPTION()); - m_zapper->Error(W(" while compiling method %s\n"), zapInfo.m_currentMethodName.GetUnicode()); -#endif + m_zapper->Print(level, W("%s while compiling method %s\n"), message.GetUnicode(), zapInfo.m_currentMethodName.GetUnicode()); + result = COMPILE_FAILED; m_zapper->m_failed = TRUE; @@ -4072,11 +2454,7 @@ HRESULT ZapImage::PrintTokenDescription(CorZapLogLevel level, mdToken token) fullName.SetUTF8(szName); } -#ifdef BINDER - m_zapper->Error(W("%s"), fullName.GetUnicode()); -#else m_zapper->Print(level, W("%s"), fullName.GetUnicode()); -#endif return S_OK; } @@ -4264,12 +2642,6 @@ HRESULT ZapImage::parseProfileData() // Parse the section table // -#ifndef BINDER - _ASSERTE(TypeProfilingData == FirstTokenFlagSection + TBL_TypeDef); - _ASSERTE(MethodProfilingData == FirstTokenFlagSection + TBL_Method); - _ASSERTE(SectionFormatCount >= FirstTokenFlagSection + TBL_COUNT + 4); -#endif - for (ULONG i = 0; i < sectionHeader->NumEntries; i++) { CORBBTPROF_SECTION_TABLE_ENTRY *entry; @@ -5149,7 +3521,6 @@ ZapImage * ZapImage::GetZapImage() return this; } -#ifndef BINDER void ZapImage::FileNotFoundError(LPCWSTR pszMessage) { SString message(pszMessage); @@ -5178,7 +3549,6 @@ void ZapImage::FileNotFoundError(LPCWSTR pszMessage) fileNotFoundErrorsTable.Append(message); } -#endif void ZapImage::Error(mdToken token, HRESULT hr, LPCWSTR message) { @@ -5191,19 +3561,6 @@ void ZapImage::Error(mdToken token, HRESULT hr, LPCWSTR message) CorZapLogLevel level = CORZAP_LOGLEVEL_ERROR; -#ifndef BINDER - if (RuntimeFileNotFound(hr) || (hr == CORSEC_E_INVALID_STRONGNAME)) - { - // FileNotFound errors here can be converted into a single error string per ngen compile, - // and the detailed error is available with verbose logging - if (m_zapper->m_pOpt->m_ignoreErrors && message != NULL) - { - FileNotFoundError(message); - level = CORZAP_LOGLEVEL_INFO; - } - } -#endif - if (m_zapper->m_pOpt->m_ignoreErrors) { #ifdef CROSSGEN_COMPILE @@ -5245,11 +3602,9 @@ ZapNode * ZapImage::GetHelperThunk(CorInfoHelpFunc ftnNum) if (pHelperThunk == NULL) { pHelperThunk = new (GetHeap()) ZapHelperThunk(ftnNum); -#ifndef BINDER #ifdef _TARGET_ARM_ pHelperThunk = GetInnerPtr(pHelperThunk, THUMB_CODE); #endif -#endif // !BINDER m_pHelperThunks[ftnNum] = pHelperThunk; } diff --git a/src/zap/zapimage.h b/src/zap/zapimage.h index f4eed3dd5a..9fc10d2604 100644 --- a/src/zap/zapimage.h +++ b/src/zap/zapimage.h @@ -13,11 +13,6 @@ #ifndef __ZAPIMAGE_H__ #define __ZAPIMAGE_H__ - -#ifdef CLR_STANDALONE_BINDER -#include "nativedata.h" -#endif - class ZapMetaData; class ZapILMetaData; class ZapCorHeader; @@ -141,10 +136,6 @@ enum ZapImportSectionType #include "zapinfo.h" #include "zapcode.h" -#ifdef MDIL -class ICompactLayoutWriter; -#endif - class ZapImage : public ZapWriter , public ICorCompileDataStore @@ -227,9 +218,6 @@ public: ZapVirtualSection * m_pColdUnwindDataSection; #endif // defined(WIN64EXCEPTIONS) -#ifdef MDIL - ZapVirtualSection * m_pMDILSection; -#endif // Preloader sections ZapVirtualSection * m_pPreloadSections[CORCOMPILE_SECTION_COUNT]; @@ -246,17 +234,6 @@ public: private: IMetaDataAssemblyEmit *m_pAssemblyEmit; // native image manifest ZapMetaData * m_pAssemblyMetaData; -#ifdef CLR_STANDALONE_BINDER - SArray m_pNativeManifestData; -public: -#ifdef BINDER - static const ULONG m_selfIndex = 0; // position of "self dependency" in m_pNativeManifestData -#else - ULONG m_selfIndex; // position of "self dependency" in m_pNativeManifestData -#endif // BINDER - -private: -#endif ZapVersionInfo * m_pVersionInfo; ZapDependencies * m_pDependencies; @@ -308,9 +285,6 @@ private: ZapVirtualSectionsTable * m_pVirtualSectionsTable; ZapDebugInfoTable * m_pDebugInfoTable; -#ifdef MDIL - MdilDebugInfoTable * m_pMdilDebugInfoTable; -#endif ZapILMetaData * m_pILMetaData; @@ -392,10 +366,8 @@ private: ProfileDataHashTable profileDataHashTable; -#ifndef BINDER SArray fileNotFoundErrorsTable; void FileNotFoundError(LPCWSTR pszMessage); -#endif // BINDER public: struct ProfileDataSection @@ -601,239 +573,6 @@ private: __out_ecount(dwPdbFileNameBufferSize) char * pwszPdbFileName, DWORD dwPdbFileNameBufferSize); -#ifdef MDIL - void LoadMDILSection(); - - void MethodCompileComplete_MDIL(BYTE *pCode, ULONG cCode); - - void Output_MDIL(); -public: - DWORD Write_MDIL(FILE *outputFile); -private: - void EncodeGenericInstances_MDIL(); - - void UnifyGenericInstances_MDIL(ZapInfo::MDILGenericMethodDesc *pMD); - - COUNT_T EncodeGenericInstance_MDIL(ZapInfo::MDILGenericMethodDesc *pMD); - - enum CodeKind - { - GENERIC_CODE, - NON_GENERIC_CODE, - CODE_KIND_COUNT, - }; - - SArray m_codeBuffer[CODE_KIND_COUNT]; // the buffer holding the finished MDIL code - // for all compiled methods, including a method header - // indicating the length, and the exception tables - // the first four bytes are a magic DWORD, so offset 0 is invalid - // we wish to keep MDIL code possibly referenced from dependencies - // (currently only generic code) separate from MDIL code only used - // during translation of the module itself - ULONG m_codeOffs[CODE_KIND_COUNT]; // code offset of the header of the current method - - SArray m_mapMethodRidToOffs; // offset in code buffer for each method def rid. - // 0 means no MDIL code available. - static const ULONG GENERIC_METHOD_REF = 0x80000000; // hi bit on means this is a reference to a generic method descriptor - // that in turn points to the method bodies - - ULONG m_methodRidCount; // number of valid entries in the m_mapMethodRidToOffs table - - ULONG m_mergedGenericSize; - ULONG m_unmergedGenericSize; - ULONG m_mergedGenericCount; - ULONG m_unmergedGenericCount; - - ULONG m_stubMethodCount; - - ULONG m_assemblyName; - ULONG m_locale; - AssemblyMetaDataInternal m_assemblyData; - ULONG m_neutralResourceCultureNameLen; - DWORD m_cultureName; - USHORT m_neutralResourceFallbackLocation; - - SArray m_mapGenericMethodToDesc; // maps a method rid to a list of instances - - SArray m_genericInstPool; // where the flavor -> mdil body maps are stored - - BYTE * m_pMdilPESectionData; - DWORD m_cbMdilPESectionData; - struct ModuleZapImage - { - CORINFO_MODULE_HANDLE m_module; - ZapImage *m_zapImage; - }; - - SArray m_mdilImages; - - int CheckForUnmerged(ZapInfo::MDILGenericMethodDesc tab[], int last, ZapInfo::FlavorSet flavorsToMatch, __in_z WCHAR *message); - - ICompactLayoutWriter *m_pICLW; - - SArray m_stubBuffer; // the buffer holding all IL stub descriptions - SArray m_stubAssocBuffer; // the buffer with method -> IL stub associations - - SArray m_debugInfoBuffer[CODE_KIND_COUNT]; // the buffer holding the debug info for all compiled methods - // the first four bytes are a magic DWORD, so offset 0 is invalid - // as for code, we want to keep information possibly referenced from dependencies - // (currently only generic code) separate from information used only - // during translation of the module itself so we keep two buffers - SArray m_mapMethodRidToDebug; // offset in debug info buffer for each method def rid. - // before adjusting the offsets to account for the generic code buffer: - // 0xFFFFFFFF indicates no debug data and 0 is a valid offset - // after adjusting the offsets, aka what is written to file: - // 0xFFFFFFFF is valid (albeit never generated) and 0 indicates no debug data - -public: - - Zapper *GetZapper() - { - return m_zapper; - } - - // remember the assembly data - void SetAssemblyNameAndLocale(ULONG assembly, ULONG locale, AssemblyMetaDataInternal *assemblyData) { - m_assemblyName = assembly; - m_locale = locale; - m_assemblyData = *assemblyData; - } - - // Set neutral resource culture information - void SetNeutralResourceInfo(ULONG neutralResourceCultureNameLen, DWORD cultureName, USHORT neutralResourceFallbackLocation) - { - m_neutralResourceCultureNameLen = neutralResourceCultureNameLen; - m_cultureName = cultureName; - m_neutralResourceFallbackLocation = neutralResourceFallbackLocation; - } - - // Should compact layout info be generated? - bool DoCompactLayout() - { - return (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) != 0; - } - - // Flush a serialized representation of a type - void FlushCompactLayoutData(mdToken typeToken, BYTE *pData, ULONG cData); - - // Flush the IL stub data - void FlushStubData(BYTE *pStubSize, ULONG cStubSize, - BYTE *pStubData, ULONG cStubData, - BYTE *pStubAssocData, ULONG cStubAssocData); - - // Flush the user string pool - void FlushUserStringPool(BYTE *pData, ULONG cData); - - // Flush the well known types table - void FlushWellKnownTypes(DWORD *wellKnownTypesTable, SIZE_T count); - - struct ExtModRef - { - enum ExtModRefFlags - { - NO_FLAGS = 0x0000, - IS_FROM_IL_METADATA = 0x0001, - IS_EAGERLY_BOUND = 0x0002, - IS_MODULE_REF = 0x0004, - IS_LOCAL_MODULE = 0x0008, - }; - - ULONG name; // offset of name in name pool - ExtModRefFlags flags; - }; - - SArray m_extModRef; - - SArray m_namePool; - - struct ExtTypeRef - { - ULONG module : 14; // 16383 max modules to import from - ULONG ordinal : 18; // 262143 max types within a module - // Just like metadata does today, I'm planning to use - // wider tables when necessary - }; - -#ifndef BINDER - SArray m_extTypeRef; - - struct ExtTypeRefExtend - { - ULONG resolutionScope; // Rid in ExtTypeRef table of containing type (currently only used for nested types, all other type have a 0) - ULONG name_space; // offset of namespace in name pool - ULONG name; // offset of name in name pool - }; - - SArray m_extTypeRefExtend; -#endif // !BINDER - - struct ExtMemberRef - { - ULONG typeRid : 15; // 32767 max types to import - ULONG isTypeSpec : 1; - ULONG isField : 1; // is this a field or a method? - ULONG ordinal : 15; // 32767 max fields or methods in a type - // Just like metadata does today, I'm planning to use - // wider tables when necessary - }; - - SArray m_extMemberRef; - -#ifndef BINDER - struct ExtMemberRefExtend - { - ULONG name; // offset of name in name pool - ULONG signature; // offset of signature. - }; - - SArray m_extMemberRefExtend; -#endif // !BINDER - - SArray m_typeSpecToOffs; - SArray m_methodSpecToOffs; - SArray m_signatureToOffs; - SArray m_compactLayoutBuffer; // the buffer holding the finished compact layout data - // the first four bytes are a magic DWORD, so offset 0 is invalid - - void SetCompactLayoutWriter(ICompactLayoutWriter *pICLW) - { - m_pICLW = pICLW; - } - - ICompactLayoutWriter *GetCompactLayoutWriter() - { - return m_pICLW; - } - -#ifdef BINDER - void Output() - { - OutputCode(ProfiledHot); - OutputCode(Unprofiled); - OutputCode(ProfiledCold); - - OutputCodeInfo(ProfiledHot); - OutputCodeInfo(ProfiledCold); // actually both Unprofiled and ProfiledCold - - OutputGCInfo(); - OutputDebugInfo(); - OutputProfileData(); - } -#ifdef CLR_STANDALONE_BINDER - void EmitMethodIL(mdToken methodDefToken); - void EmitFieldRVA(mdToken fieldDefToken, RVA fieldRVA); -#endif -#endif - -private: - - SArray m_mapTypeRidToOffs; // offset in compact layout buffer for each typedef rid - ULONG m_compactLayoutOffs; // offset of the current type in the compact layout data - ULONG m_typeRidCount; // number of valid entries in the m_mapTypeRidToOffs table - SArray m_userStringPool; // this is the user string pool exactly like it is in meta data - SArray m_wellKnownTypesTable; // this is an array of type def tokens for the well known types -#endif - public: ZapImage(Zapper *zapper); virtual ~ZapImage(); @@ -886,19 +625,10 @@ public: void Preload(); void LinkPreload(); -#ifdef BINDER - void SetNativeVersionResource(PVOID pvVersionResourceBlob, SIZE_T cbVersionResource); -#endif void SetVersionInfo(CORCOMPILE_VERSION_INFO * pVersionInfo); void SetDependencies(CORCOMPILE_DEPENDENCY *pDependencies, DWORD cDependencies); void SetPdbFileName(const SString &strFileName); -#ifdef CLR_STANDALONE_BINDER - void AddNativeDependency (NativeManifestData * pNativeManifestData) { - m_pNativeManifestData.Append(*pNativeManifestData); - } -#endif - #ifdef WIN64EXCEPTIONS void SetRuntimeFunctionsDirectoryEntry(); #endif @@ -1082,17 +812,6 @@ public: CompileStatus CompileProfileDataWorker(mdToken token, unsigned methodProfilingDataFlags); void CompileProfileData(); -#ifdef CLR_STANDALONE_BINDER - PEDecoder *GetPEDecoder() - { - return &m_ModuleDecoder; - } - - ZapMethodEntryPoint *GetMethodEntryPoint(CORINFO_METHOD_HANDLE handle, CORINFO_ACCESS_FLAGS accessFlags) - { - return m_pMethodEntryPoints->GetMethodEntryPoint(handle, accessFlags); - } -#endif }; class BinaryWriter diff --git a/src/zap/zapimport.cpp b/src/zap/zapimport.cpp index ab23cdab02..c1947a96f0 100644 --- a/src/zap/zapimport.cpp +++ b/src/zap/zapimport.cpp @@ -481,13 +481,6 @@ public: return ZapNodeType_ExternalMethodThunk; } -#if defined(TARGET_THUMB2) && defined(BINDER) - virtual BOOL IsThumb2Code() - { - return TRUE; - } -#endif - virtual void EncodeSignature(ZapImportTable * pTable, SigBuilder * pSigBuilder) { CORINFO_METHOD_HANDLE handle = (CORINFO_METHOD_HANDLE)GetHandle(); @@ -810,13 +803,6 @@ public: return ZapNodeType_VirtualMethodThunk; } -#if defined(TARGET_THUMB2) && defined(BINDER) - virtual BOOL IsThumb2Code() - { - return TRUE; - } -#endif - virtual void EncodeSignature(ZapImportTable * pTable, SigBuilder * pSigBuilder) { // Virtual import thunks do not have signatures @@ -2119,7 +2105,7 @@ void ZapImportTable::PlaceIndirectHelperThunk(ZapNode * pImport) ZapNode * ZapImportTable::GetIndirectHelperThunk(ReadyToRunHelper helperNum, PVOID pArg) { ZapNode * pImport = GetImport((void *)helperNum, pArg); -#if defined(_TARGET_ARM_) && !defined(BINDER) +#if defined(_TARGET_ARM_) pImport = m_pImage->GetInnerPtr(pImport, THUMB_CODE); #endif return pImport; @@ -2142,7 +2128,7 @@ ZapNode * ZapImportTable::GetPlacedIndirectHelperThunk(ReadyToRunHelper helperNu } if (!pImport->IsPlaced()) PlaceIndirectHelperThunk(pImport); -#if defined(_TARGET_ARM_) && !defined(BINDER) +#if defined(_TARGET_ARM_) pImport = m_pImage->GetInnerPtr(pImport, THUMB_CODE); #endif return pImport; diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp index 0b9d0a6a42..bac75b23d0 100644 --- a/src/zap/zapinfo.cpp +++ b/src/zap/zapinfo.cpp @@ -397,9 +397,6 @@ void ZapInfo::ProcessReferences() void ZapInfo::CompileMethod() { -#ifdef BINDER - _ASSERTE(!"intentionally unreachable"); -#else PRECONDITION(m_zapper->m_pJitCompiler != NULL); InitMethodName(); @@ -525,10 +522,8 @@ void ZapInfo::CompileMethod() #endif PublishCompiledMethod(); -#endif // BINDER } -#ifndef BINDER #ifndef FEATURE_FULL_NGEN class MethodCodeComparer { @@ -757,7 +752,6 @@ COUNT_T ZapImage::MethodCodeTraits::Hash(key_t k) return hash; } #endif -#endif void ZapInfo::PublishCompiledMethod() { @@ -787,12 +781,6 @@ void ZapInfo::PublishCompiledMethod() pMethod->m_pExceptionInfo = m_pExceptionInfo; pMethod->m_pFixupList = EmitFixupList(); -#ifdef BINDER - // in the binder, do this here instead of a later phase because of phase ordering problem (FlushPrecodesAndMethodDescs needs this) - // compare with the disabled code in ZapImage::OutputCodeInfo - if (pMethod->m_pFixupList != NULL) - pMethod->m_pFixupInfo = m_pImage->GetImportTable()->PlaceFixups(pMethod->m_pFixupList); -#endif pMethod->m_pDebugInfo = EmitDebugInfo(); pMethod->m_pGCInfo = EmitGCInfo(); @@ -813,7 +801,6 @@ void ZapInfo::PublishCompiledMethod() #endif // WIN64EXCEPTIONS -#ifndef BINDER #ifndef FEATURE_FULL_NGEN // // Method code deduplication @@ -831,7 +818,6 @@ void ZapInfo::PublishCompiledMethod() m_pImage->m_CodeDeduplicator.Add(pMethod); } -#endif #endif // Remember the gc info for IL stubs associated with hot methods so they can be packed well. @@ -1241,7 +1227,7 @@ int ZapInfo::doAssert(const char* szFile, int iLine, const char* szExpr) ThrowHR(COR_E_INVALIDPROGRAM); #else -#if defined(_DEBUG) && !defined(BINDER) +#if defined(_DEBUG) return(_DbgBreakCheck(szFile, iLine, szExpr)); #else return(true); // break into debugger @@ -1500,11 +1486,7 @@ CORINFO_CLASS_HANDLE ZapInfo::embedClassHandle(CORINFO_CLASS_HANDLE handle, // embed it after its resolved. So use a deferred reloc *ppIndirection = NULL; -#ifdef BINDER - return m_pEEJitInfo->embedClassHandle(handle, ppIndirection); -#else return CORINFO_CLASS_HANDLE(m_pImage->GetWrappers()->GetClassHandle(handle)); -#endif } *ppIndirection = m_pImage->GetImportTable()->GetClassHandleImport(handle); @@ -1802,7 +1784,7 @@ void * ZapInfo::getHelperFtn (CorInfoHelpFunc ftnNum, void **ppIndirection) { pHelperThunk = new (m_pImage->GetHeap()) ZapHelperThunk(dwHelper); } -#if defined(_TARGET_ARM_) && !defined(BINDER) +#if defined(_TARGET_ARM_) if ((dwHelper & CORCOMPILE_HELPER_PTR) == 0) pHelperThunk = m_pImage->GetInnerPtr(pHelperThunk, THUMB_CODE); #endif @@ -2405,11 +2387,9 @@ void ZapInfo::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODU // No need to add dependency fixup since we will have an unconditional dependency // already } -#ifndef BINDER else if (!GetCompileInfo()->IsInCurrentVersionBubble(moduleTo)) { } -#endif else { ZapImport * pImport = m_pImage->GetImportTable()->GetActiveDependencyImport(moduleFrom, moduleTo); diff --git a/src/zap/zapinfo.h b/src/zap/zapinfo.h index bb1c1103d2..83528e9e7b 100644 --- a/src/zap/zapinfo.h +++ b/src/zap/zapinfo.h @@ -250,16 +250,6 @@ class ZapInfo BOOL fAllowThunk); public: -#ifdef BINDER - void PublishCompiledMethod(mdToken methodDefToken, CORINFO_METHOD_HANDLE methodHandle) - { - m_currentMethodToken = methodDefToken; - m_currentMethodHandle = methodHandle; - - PublishCompiledMethod(); - } -#endif - ZapInfo(ZapImage * pImage, mdMethodDef md, CORINFO_METHOD_HANDLE handle, CORINFO_MODULE_HANDLE module, unsigned methodProfilingDataFlags); ~ZapInfo(); diff --git a/src/zap/zapinnerptr.h b/src/zap/zapinnerptr.h index eab1585b8f..1f80bd6838 100644 --- a/src/zap/zapinnerptr.h +++ b/src/zap/zapinnerptr.h @@ -33,11 +33,7 @@ public: void Resolve() { - if ( -#ifdef BINDER - !IsPlaced() && -#endif - m_pBase->IsPlaced()) + if (m_pBase->IsPlaced()) { SetRVA(m_pBase->GetRVA() + GetOffset()); } @@ -47,14 +43,6 @@ public: { return ZapNodeType_InnerPtr; } - -#if defined(TARGET_THUMB2) && defined(BINDER) - virtual BOOL IsThumb2Code() - { - return m_pBase->IsThumb2Code(); - } -#endif - }; class ZapInnerPtrTable diff --git a/src/zap/zapmetadata.cpp b/src/zap/zapmetadata.cpp index cffec0cb63..e77dbb837f 100644 --- a/src/zap/zapmetadata.cpp +++ b/src/zap/zapmetadata.cpp @@ -18,481 +18,20 @@ // // ZapMetaData is the barebone ZapNode to save metadata scope // -#ifdef CLR_STANDALONE_BINDER -static BYTE metadataStart [] = -{ - 0x42, 0x53, 0x4a, 0x42, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x76, 0x34, 0x2e, 0x30, 0x2e, 0x33, 0x30, 0x32, 0x31, 0x35, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, - 0x6c, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0x23, 0x7e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, - 0x2c, 0x00, 0x00, 0x00, 0x23, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x73, 0x00, 0x00, 0x00, 0x00, - 0x24, 0x01, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x23, 0x55, 0x53, 0x00, 0x2c, 0x01, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x23, 0x47, 0x55, 0x49, 0x44, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, - 0xc0, 0x00, 0x00, 0x00, 0x23, 0x42, 0x6c, 0x6f, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x01, 0x05, 0x40, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x01, 0x33, - 0x00, 0x16, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, - 0x0b, 0x00, 0x06, 0x00, 0x01, 0x00, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, -}; - -#define TableHeaderIndex 0x20 -#define StringHeaderIndex 0x2C -#define UStringHeaderIndex 0x40 -#define GUIDHeaderIndex 0x4C -#define BlobHeaderIndex 0x5C -#define TableStartIndex 0x6C -#define AssemblyRefRowsIndex 0x94 -#define ModuleMvidIndex 0x9C -//#define DeclSecPermissionSetIndex 0xB4 -#define AssemblyVersionIndex 0xBA -#define AssemblyFlagsIndex 0xC2 -#define AssemblyPublicKeyIndex 0xC6 -#define AssemblyShortNameIndex 0xC8 -#define AssemblyCultureIndex 0xCA -#define AssemblyRefStartIndex 0xCC - -#define AssemblyRefSize 0x14 -#define AssemblyRefVersionOffset 0x0 -#define AssemblyRefFlagsOffset 0x8 -#define AssemblyRefTokenOffset 0xC -#define AssemblyRefShortNameOffset 0xE -#define AssemblyRefCultureOffset 0x10 -#define AssemblyRefHashOffset 0x12 - - - -static BYTE stringStart [] = -{ - 0x00, 0x3C, 0x4D, 0x6F, 0x64, 0x75, 0x6C, 0x65, 0x3E, 0x00, -}; - -#define StringHeapStartOffset 0xA - -#define GuidSize 0x10 -#define MaxGuidCount 20 -#define GuidStartOffset 0x8 - -static BYTE guidStart [GuidStartOffset] = -{ - 0x03, 0x20 -}; - - -static BYTE blobStart[] = -{ - 0x00, - // PermissionSet, starts at 1, length 182 (0xB6) bytes - 0x80, 0xb4, 0x3c, 0x00, 0x50, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x73, 0x00, - 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x20, 0x00, - 0x63, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x73, 0x00, 0x73, 0x00, 0x3d, 0x00, 0x22, 0x00, 0x53, 0x00, - 0x79, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x2e, 0x00, 0x53, 0x00, 0x65, 0x00, - 0x63, 0x00, 0x75, 0x00, 0x72, 0x00, 0x69, 0x00, 0x74, 0x00, 0x79, 0x00, 0x2e, 0x00, 0x50, 0x00, - 0x65, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x73, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, - 0x6e, 0x00, 0x53, 0x00, 0x65, 0x00, 0x74, 0x00, 0x22, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x76, 0x00, - 0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x3d, 0x00, 0x22, 0x00, - 0x31, 0x00, 0x22, 0x00, 0x0d, 0x00, 0x0a, 0x00, 0x55, 0x00, 0x6e, 0x00, 0x72, 0x00, 0x65, 0x00, - 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x63, 0x00, 0x74, 0x00, 0x65, 0x00, 0x64, 0x00, - 0x3d, 0x00, 0x22, 0x00, 0x74, 0x00, 0x72, 0x00, 0x75, 0x00, 0x65, 0x00, 0x22, 0x00, 0x2f, 0x00, - 0x3e, 0x00, 0x0d, 0x00, 0x0a, 0x00 - -}; - - -#define BlobHeapStartOffset 0xB7 - -#define AssemblyNameStartIndex 0x10B -#define MaxAssemblyNameLength 0x14 -#define MethodImplFlagsFromPRva(pRva) (*(USHORT*)((DWORD*)(pRva) + 1)) - -#define FieldRidPRvaSixByteFieldRVARecord(pRva) ((DWORD)(*(USHORT*)((DWORD*)(pRva) + 1))) -#define FieldRidPRvaEightByteFieldRVARecord(pRva) ((DWORD)(*(DWORD*)((DWORD*)(pRva) + 1))) -#endif void ZapMetaData::SetMetaData(IUnknown * pEmit) { -#ifndef CLR_STANDALONE_BINDER // TritonTBD: Commented out while we use a pre-defined copy of metadata. _ASSERTE(m_pEmit == NULL); _ASSERTE(pEmit != NULL); IfFailThrow(pEmit->QueryInterface(IID_IMetaDataEmit, (void **)&m_pEmit)); -#endif -} - -#ifdef CLR_STANDALONE_BINDER -void ZapMetaData::FixupMetaData() -{ - ULONG curSize; - // fixup header information - *((ULONG*)(&m_metadataHeap[TableHeaderIndex+4])) = m_metadataHeap.GetCount() - TableStartIndex; - - *((ULONG*)(&m_metadataHeap[StringHeaderIndex ])) = m_metadataHeap.GetCount(); - *((ULONG*)(&m_metadataHeap[StringHeaderIndex+4])) = m_stringHeap.GetCount(); - curSize = m_metadataHeap.GetCount() + m_stringHeap.GetCount(); - - *((ULONG*)(&m_metadataHeap[UStringHeaderIndex ])) = curSize; - *((ULONG*)(&m_metadataHeap[UStringHeaderIndex+4])) = GuidStartOffset; - - *((ULONG*)(&m_metadataHeap[GUIDHeaderIndex ])) = curSize + GuidStartOffset; - *((ULONG*)(&m_metadataHeap[GUIDHeaderIndex+4])) = m_guidHeap.GetCount() - GuidStartOffset; - curSize += m_guidHeap.GetCount(); - - *((ULONG*)(&m_metadataHeap[BlobHeaderIndex ])) = curSize; - *((ULONG*)(&m_metadataHeap[BlobHeaderIndex+4])) = m_blobHeap.GetCount(); - curSize += m_blobHeap.GetCount(); - - m_bFixedUp = TRUE; - - _ASSERTE(curSize == m_dwSize); -} - - -// adds a string (defined in UTF-16) to the "string heap" -// - converts the string to UTF-8 -// - length is either string length in WCHAR or -1 (assumes zero terminated string) -// - (tries to avoid duplicate strings) -// - returns the starting offset of the string -// (0 for all errors, including "empty string" -// - updates m_cbString (if not a duplicate) - -ULONG ZapMetaData::AddString(__in_z LPWSTR pName, __in int length) -{ - - if (pName == NULL || *pName == (WCHAR) 0 || length < -1) - return 0; - - int cbUtf8Len; - - //determine the length - cbUtf8Len = WideCharToMultiByte(CP_UTF8, 0, //to UTF-8, no flags - pName, length, // incoming argument, zero terminated - NULL, // target - 0, - NULL, - NULL); - - if (cbUtf8Len == 0) - return 0; - - COUNT_T cbString = m_stringHeap.GetCount(); - m_stringHeap.SetCount(cbString + cbUtf8Len + 1); - - cbUtf8Len = WideCharToMultiByte(CP_UTF8, 0, //to UTF-8, no flags - pName, length, // incoming argument, zero terminated - (LPSTR) &m_stringHeap[cbString], // target - cbUtf8Len, // target buffer size - NULL, - NULL); - - // check for duplicates - BYTE * pCur = &m_stringHeap[1]; - BYTE * pEnd = &m_stringHeap[cbString]; - while (pCur + cbUtf8Len < pEnd) { - if (!memcmp(pCur, pEnd, cbUtf8Len) && *(pCur+cbUtf8Len) == 0) { - // same string, return startindex of existing string - m_stringHeap.SetCount(cbString); - return (ULONG) (pCur - &m_stringHeap[0]); - } - // not the same string, skip to next string - while (pCur < pEnd && *pCur++ != 0) - ; - } - - // this is a "new" string - // zero terminate string heap entry - m_stringHeap[cbString + cbUtf8Len] = 0; - - return cbString; -} - -ULONG ZapMetaData::AddString(LPCSTR pName, int length) -{ - - if (pName == NULL || *pName == 0 || length < -1) - return 0; - - unsigned cbUtf8Len = 0; - - if (length == -1) { - CHAR * p = (CHAR*) pName; - while (*p++ != 0) { - cbUtf8Len++; - } - } - else - cbUtf8Len = (unsigned)length; - - if (cbUtf8Len == 0) - return 0; - - COUNT_T cbString = m_stringHeap.GetCount(); - - // check for duplicates - BYTE * pCur = &m_stringHeap[1]; - BYTE * pEnd = &m_stringHeap[cbString]; - while (pCur + cbUtf8Len < pEnd) { - if (!memcmp(pCur, pName, cbUtf8Len) && *(pCur+cbUtf8Len) == 0) { - // same string, return startindex of existing string - return (ULONG) (pCur - &m_stringHeap[0]); - } - // not the same string, skip to next string - while (pCur < pEnd && *pCur++ != 0) - ; - } - - m_stringHeap.SetCount(cbString + cbUtf8Len + 1); - - // this is a "new" string - memcpy (&m_stringHeap[cbString], pName, cbUtf8Len); - m_stringHeap[cbString + cbUtf8Len] = 0; - - return cbString; -} - - -#if 0 // turns out, an assembly name can end with .exe or .dll and we shouldn't strip it... - // for now I leave in the StripExtension functions just in case we will need it again. -int ZapMetaData::StripExtension(LPWSTR pName) -{ - WCHAR *pCur = pName; - int cChar = 0; - - // strip last file extension - - // move to the end of string - while (*pCur != (WCHAR) 0) - { - pCur++; cChar++; - } - - if (cChar > 4 && pName[cChar-4] == W('.')) { - if ((pName[cChar-3] == W('e') && pName[cChar-2] == W('x') && pName[cChar-1] == W('e')) || - (pName[cChar-3] == W('d') && pName[cChar-2] == W('l') && pName[cChar-1] == W('l'))) - { - cChar -= 4; - } - } - return cChar; -} - -int ZapMetaData::StripExtension(LPCSTR pName) -{ - CHAR *pCur = (CHAR*)pName; - int cChar = 0; - - // strip last file extension - - // move to the end of string - while (*pCur != (CHAR) 0) - { - pCur++; cChar++; - } - - if (cChar > 4 && pName[cChar-4] == '.') { - if ((pName[cChar-3] == 'e' && pName[cChar-2] == 'x' && pName[cChar-1] == 'e') || - (pName[cChar-3] == 'd' && pName[cChar-2] == 'l' && pName[cChar-1] == 'l')) - { - cChar -= 4; - } - } - return cChar; } -#endif - -ULONG ZapMetaData::AddBlob(LPCVOID blob, COUNT_T cbBlob) -{ - _ASSERTE(blob != NULL); - _ASSERTE(cbBlob > 0); - COUNT_T startValue = m_blobHeap.GetCount(); - _ASSERTE(startValue > 0); - ULONG cbSize = 1; - - if (cbBlob <= 0x7F) - { - m_blobHeap.SetCount(startValue + 1 + cbBlob); - m_blobHeap[startValue] = (BYTE) cbBlob; - memcpy(&m_blobHeap[startValue+1], blob, cbBlob); - } - else if (cbBlob < 0x3FFF) - { - m_blobHeap.SetCount(startValue + 2 + cbBlob); - m_blobHeap[startValue ] = (BYTE) (((cbBlob >> 8) & 0x3F) | 0x80); - m_blobHeap[startValue+1] = (BYTE) (cbBlob & 0xFF); - memcpy(&m_blobHeap[startValue+2], blob, cbBlob); - } - else - { - _ASSERTE(!"NYI - large blob heaps"); - } - - return startValue; -} - -void ZapMetaData::SetAssembly( - __in_z LPWSTR name, - __in_z LPWSTR culture, - NativeAssemblyData *pNad) -{ - if (name == NULL || *name == (WCHAR) 0) - return; - - ULONG nameStart = AddString(name, -1); - - ULONG cultureStart = 0; - if (culture != NULL) - cultureStart = AddString(culture, -1); - - CorAssemblyFlags flags = pNad->m_flags; - - if (pNad->m_cbPublicKey > 0 && pNad->m_publicKey != NULL) - { - ULONG blobStart = AddBlob(pNad->m_publicKey, pNad->m_cbPublicKey); - if (blobStart > 0) - { - flags = (CorAssemblyFlags)(flags | afPublicKey); - *((USHORT*) (&m_metadataHeap[AssemblyPublicKeyIndex])) = (USHORT) blobStart; - } - } - - *((CorAssemblyFlags *) (&m_metadataHeap[AssemblyFlagsIndex])) = flags; - - *((USHORT*) (&m_metadataHeap[AssemblyVersionIndex ])) = pNad->m_majorVersion; - *((USHORT*) (&m_metadataHeap[AssemblyVersionIndex+2])) = pNad->m_minorVersion; - *((USHORT*) (&m_metadataHeap[AssemblyVersionIndex+4])) = pNad->m_buildNumber; - *((USHORT*) (&m_metadataHeap[AssemblyVersionIndex+6])) = pNad->m_revisionNumber; - *((USHORT*) (&m_metadataHeap[AssemblyShortNameIndex])) = (USHORT) nameStart; - *((USHORT*) (&m_metadataHeap[AssemblyCultureIndex ])) = (USHORT) cultureStart; - - SetMVIDOfModule(&NGEN_IMAGE_MVID); -} - -void ZapMetaData::SetMVIDOfModule(LPCVOID mvid) -{ -#define cbMVID 16 - //copy MVID to the GUIDHeap and fix up the Module entry - if (mvid != NULL) - { - COUNT_T cbGuid = m_guidHeap.GetCount(); - m_guidHeap.SetCount(cbGuid + cbMVID); - BYTE * dst = &m_guidHeap[cbGuid]; - memcpy(dst, mvid, cbMVID); - // fix up module entry (1-based index into GUID heap) - // NOTE: this version has just one buffer for US and GUID heap !! - - *((USHORT *)(&m_metadataHeap[ModuleMvidIndex])) = - (USHORT) ((cbGuid - GuidStartOffset)/cbMVID) + 1; - } -} - -void ZapMetaData::SetAssemblyReference( - __in_z LPWSTR name, - __in_z LPWSTR culture, - NativeAssemblyData *pNad) -{ - int strongNameLevel = 0; // 0: no strong name, 1: publicKeyToken, 2: publicKey (very unusual) - BYTE *pKey = NULL; - ULONG cbKey = 0; - - if (name == NULL || *name == (WCHAR) 0) - return; - - if (pNad->m_cbPublicKeyToken > 0 && pNad->m_publicKeyToken != NULL) { - strongNameLevel = 1; - cbKey = pNad->m_cbPublicKeyToken; - pKey = pNad->m_publicKeyToken; - } - else if (pNad->m_cbPublicKey > 0 && pNad->m_publicKey != NULL) { - strongNameLevel = 2; - cbKey = pNad->m_cbPublicKey; - pKey = pNad->m_publicKey; - } - - _ASSERTE(pKey == NULL || strongNameLevel == 1 || cbKey > 8); - - COUNT_T cbTable = m_metadataHeap.GetCount(); - m_metadataHeap.SetCount(cbTable + AssemblyRefSize); - - USHORT * pAssemblyRef = (USHORT*) (&m_metadataHeap[cbTable]); - memset(pAssemblyRef, 0, AssemblyRefSize); - - ULONG nameStart = AddString(name, -1); - - ULONG cultureStart = 0; - if (culture != NULL) - cultureStart = AddString(culture, -1); - - pAssemblyRef[AssemblyRefVersionOffset ] = pNad->m_majorVersion; - pAssemblyRef[AssemblyRefVersionOffset+1] = pNad->m_minorVersion; - pAssemblyRef[AssemblyRefVersionOffset+2] = pNad->m_buildNumber; - pAssemblyRef[AssemblyRefVersionOffset+3] = pNad->m_revisionNumber; - - // all offset constants are byte offsets, convert them into "short offsets" - if (cbKey > 0) - { - pAssemblyRef[AssemblyRefTokenOffset/2] = (USHORT) AddBlob(pKey, cbKey); - } - - CorAssemblyFlags flags = pNad->m_flags; - - if (strongNameLevel == 2) - { - flags = (CorAssemblyFlags)(flags | afPublicKey); - } - - *((CorAssemblyFlags *) (&pAssemblyRef[AssemblyRefFlagsOffset/2])) = flags; - - pAssemblyRef[AssemblyRefShortNameOffset/2] = (USHORT)nameStart; - pAssemblyRef[AssemblyRefCultureOffset/2] = (USHORT)cultureStart; - pAssemblyRef[AssemblyRefHashOffset/2] = 0; - - (*((USHORT*)&m_metadataHeap[AssemblyRefRowsIndex]))++; -} - -ZapMetaData::ZapMetaData() -{ - m_bFixedUp = FALSE; - - _ASSERTE(AssemblyRefStartIndex == sizeof(metadataStart)); - m_metadataHeap.SetCount(sizeof(metadataStart)); - memcpy(&m_metadataHeap[0], metadataStart, sizeof(metadataStart)); - - _ASSERTE(StringHeapStartOffset == sizeof(stringStart)); - m_stringHeap.SetCount(sizeof(stringStart)); - memcpy(&m_stringHeap[0], stringStart, sizeof(stringStart)); - - _ASSERTE(GuidStartOffset == sizeof(guidStart)); - m_guidHeap.SetCount(sizeof(guidStart)); - memcpy(&m_guidHeap[0], guidStart, sizeof(guidStart)); - - _ASSERTE(BlobHeapStartOffset == sizeof(blobStart)); - m_blobHeap.SetCount(sizeof(blobStart)); - memcpy(&m_blobHeap[0], blobStart, sizeof(blobStart)); -} -#endif DWORD ZapMetaData::GetSize() { if (m_dwSize == 0) { -#ifdef CLR_STANDALONE_BINDER - // round up tables (divisible by 4) - // for reproducibility pad with 0 bytes - while (m_metadataHeap.GetCount() & 3) - m_metadataHeap.Append(0); - - while (m_stringHeap.GetCount() & 3) - m_stringHeap.Append(0); - - while (m_guidHeap.GetCount() & 3) - m_guidHeap.Append(0); - - while (m_blobHeap.GetCount() & 3) - m_blobHeap.Append(0); - - m_dwSize = m_metadataHeap.GetCount() + m_stringHeap.GetCount() + m_guidHeap.GetCount() + m_blobHeap.GetCount(); -#else IfFailThrow(m_pEmit->GetSaveSize(cssAccurate, &m_dwSize)); -#endif _ASSERTE(m_dwSize != 0); } return m_dwSize; @@ -500,24 +39,7 @@ DWORD ZapMetaData::GetSize() void ZapMetaData::Save(ZapWriter * pZapWriter) { -#ifdef CLR_STANDALONE_BINDER // TritonTBD - ULONG cbWritten; - FixupMetaData(); - - ((IStream*)pZapWriter)->Write(&m_metadataHeap[0], m_metadataHeap.GetCount(), &cbWritten); - _ASSERTE(cbWritten == m_metadataHeap.GetCount()); - - ((IStream*)pZapWriter)->Write(&m_stringHeap[0], m_stringHeap.GetCount(), &cbWritten); - _ASSERTE(cbWritten == m_stringHeap.GetCount()); - - ((IStream*)pZapWriter)->Write(&m_guidHeap[0], m_guidHeap.GetCount(), &cbWritten); - _ASSERTE(cbWritten == m_guidHeap.GetCount()); - - ((IStream*)pZapWriter)->Write(&m_blobHeap[0], m_blobHeap.GetCount(), &cbWritten); - _ASSERTE(cbWritten == m_blobHeap.GetCount()); -#else IfFailThrow(m_pEmit->SaveToStream(pZapWriter, 0)); -#endif } //----------------------------------------------------------------------------- @@ -527,77 +49,6 @@ void ZapMetaData::Save(ZapWriter * pZapWriter) void ZapILMetaData::Save(ZapWriter * pZapWriter) { -#ifdef CLR_STANDALONE_BINDER - // Make a copy IL metadata, so we can fixup RVAs. - LPVOID metaDataCopy = new BYTE[m_metaDataSize]; - memcpy(metaDataCopy, m_metaDataStart, m_metaDataSize); - - // Fixup RVA of MethodDef records in metadata - ULONG *pRva = (ULONG *)((LPBYTE)metaDataCopy + m_firstMethodRvaOffset); - for (DWORD rid = 1; rid <= m_methodDefCount; rid++, pRva = (ULONG *)((LPBYTE)pRva + m_methodDefRecordSize)) - { - _ASSERTE((LPBYTE)pRva > (LPBYTE)metaDataCopy && (LPBYTE)pRva + m_methodDefRecordSize <= (LPBYTE)metaDataCopy + m_metaDataSize); - ULONG rva = *pRva; - USHORT flags = MethodImplFlagsFromPRva(pRva); - - if (!IsMiIL(flags) || (rva == 0)) - continue; - - // Set the actual RVA of the method - const ILMethod * pILMethod = m_ILMethods.LookupPtr(TokenFromRid(rid, mdtMethodDef)); - - *pRva = (pILMethod != NULL) ? pILMethod->m_pIL->GetRVA() : 0; - } - - // Fixup RVA of FieldRVA records in metadata - pRva = (ULONG *)((LPBYTE)metaDataCopy + m_firstFieldRvaOffset); - for (DWORD rid = 1; rid <= m_fieldRvaCount; rid++, pRva = (ULONG *)((LPBYTE)pRva + m_fieldRvaRecordSize)) - { - _ASSERTE((LPBYTE)pRva > (LPBYTE)metaDataCopy && (LPBYTE)pRva + m_fieldRvaRecordSize <= (LPBYTE)metaDataCopy + m_metaDataSize); - - // field rid associated with this FieldRVA field. - DWORD ridField; - if (m_fieldRvaRecordSize == 6) - { - ridField = FieldRidPRvaSixByteFieldRVARecord(pRva); - } - else if (m_fieldRvaRecordSize == 8) - { - ridField = FieldRidPRvaEightByteFieldRVARecord(pRva); - } - else - { - ridField = 0; - _ASSERTE(!"FieldRVA row of invalid size."); - } - - mdToken tkField = TokenFromRid(ridField, mdtFieldDef); - - ULONG rva; - if (this->m_fieldToRVAMapping.Lookup(tkField, &rva)) - { - *pRva = rva; - } - else - { - // Invalid RVA. This should cause reliable runtime exceptions instead of anything more unpredictable. - // This can happen for fields on types for which could not be loaded in the binder for any reason - // In most cases, this shouldn't be a problem due to the cases where existing compilers will generate - // field rvas in the triton scenario, but we there could be problems if the set of types loadable at - // runtime is greater than the set of types loadable by the CTL binder, and those types have RVA static - // fields. - // We should be falling back to using the IL image if this happens. - IfFailThrow(COR_E_TYPELOAD); - *pRva = 0xFFFFFFFF; - } - } - - ULONG cbWritten; - ((IStream*)pZapWriter)->Write(metaDataCopy, m_metaDataSize, &cbWritten); - _ASSERTE(cbWritten == m_metaDataSize); - - delete[] metaDataCopy; -#else // CLR_STANDALONGE_BINDER IMDInternalImport * pMDImport = m_pImage->m_pMDImport; HENUMInternalHolder hEnum(pMDImport); @@ -647,7 +98,6 @@ void ZapILMetaData::Save(ZapWriter * pZapWriter) } ZapMetaData::Save(pZapWriter); -#endif // CLR_STANDALONGE_BINDER } ZapRVADataNode * ZapILMetaData::GetRVAField(void * pData) @@ -736,12 +186,10 @@ void ZapILMetaData::CopyIL() SArray priorityLists[CORCOMPILE_ILREGION_COUNT]; -#ifndef CLR_STANDALONE_BINDER IMDInternalImport * pMDImport = m_pImage->m_pMDImport; HENUMInternalHolder hEnum(pMDImport); hEnum.EnumAllInit(mdtMethodDef); -#endif // // Build the list for each priority in first pass, and then place @@ -749,13 +197,8 @@ void ZapILMetaData::CopyIL() // interning of IL blobs (one IL blob can be on multiple lists). // -#ifndef CLR_STANDALONE_BINDER mdMethodDef md; while (pMDImport->EnumNext(&hEnum, &md)) -#else - mdMethodDef mdMax = TokenFromRid(m_methodDefCount, mdtMethodDef); - for (mdMethodDef md = TokenFromRid(1, mdtMethodDef); md <= mdMax; md++) -#endif { const ILMethod * pILMethod = m_ILMethods.LookupPtr(md); @@ -793,9 +236,6 @@ void ZapILMetaData::CopyIL() void ZapILMetaData::CopyMetaData() { -#if defined(CLR_STANDALONE_BINDER) - // Triton TBD -#else // // // Copy metadata from IL image and open it so we can update IL rva's // @@ -876,30 +316,20 @@ void ZapILMetaData::CopyMetaData() (void**)&pIMDInternalMetadataReorderingOptions)); IfFailThrow(pIMDInternalMetadataReorderingOptions->SetMetaDataReorderingOptions(ReArrangeStringPool)); } -#endif // CLR_STANDALONE_BINDER } // Emit IL for a method def into the ngen image void ZapILMetaData::EmitMethodIL(mdMethodDef md) { -#ifdef CLR_STANDALONE_BINDER - const ULONG *pRva = (ULONG *)((LPBYTE)m_metaDataStart + m_firstMethodRvaOffset + (RidFromToken(md) - 1) * m_methodDefRecordSize); - _ASSERTE((LPBYTE)pRva > (LPBYTE)m_metaDataStart && (LPBYTE)pRva + m_methodDefRecordSize <= (LPBYTE)m_metaDataStart + m_metaDataSize); - DWORD flags = MethodImplFlagsFromPRva(pRva); - ULONG rva = *pRva; -#else DWORD flags; ULONG rva; IfFailThrow(m_pImage->m_pMDImport->GetMethodImplProps(md, &rva, &flags)); -#endif if (!IsMiIL(flags) || (rva == 0)) return; -#ifndef BINDER if (!m_pImage->m_ModuleDecoder.CheckILMethod(rva)) IfFailThrow(COR_E_BADIMAGEFORMAT); // BFA_BAD_IL_RANGE -#endif PVOID pMethod = (PVOID)m_pImage->m_ModuleDecoder.GetRvaData(rva); @@ -922,15 +352,3 @@ void ZapILMetaData::EmitMethodIL(mdMethodDef md) ilMethod.m_pIL = pIL; m_ILMethods.Add(ilMethod); } - -#ifdef CLR_STANDALONE_BINDER -DWORD ZapILMetaData::GetSize() -{ - return m_metaDataSize; -} - -void ZapILMetaData::EmitFieldRVA(mdToken fieldDefToken, RVA fieldRVA) -{ - this->m_fieldToRVAMapping.Add(fieldDefToken, fieldRVA); -} -#endif diff --git a/src/zap/zapmetadata.h b/src/zap/zapmetadata.h index 18b8bc055a..3788138897 100644 --- a/src/zap/zapmetadata.h +++ b/src/zap/zapmetadata.h @@ -13,10 +13,6 @@ #ifndef __ZAPMETADATA_H__ #define __ZAPMETADATA_H__ -#ifdef CLR_STANDALONE_BINDER -#include "nativedata.h" -#endif - //----------------------------------------------------------------------------- // // ZapMetaData is the barebone ZapNode to save metadata scope @@ -30,13 +26,9 @@ protected: IMetaDataEmit * m_pEmit; public: -#ifdef CLR_STANDALONE_BINDER - ZapMetaData(); -#else ZapMetaData() { } -#endif ~ZapMetaData() { @@ -45,16 +37,6 @@ public: void SetMetaData(IUnknown * pEmit); -#ifdef CLR_STANDALONE_BINDER - void SetAssembly(__in_z LPWSTR name, - __in_z LPWSTR culture, - NativeAssemblyData * nad); - - void SetAssemblyReference(__in_z LPWSTR name, - __in_z LPWSTR culture, - NativeAssemblyData *nad); -#endif - virtual DWORD GetSize(); virtual UINT GetAlignment() @@ -68,24 +50,6 @@ public: } virtual void Save(ZapWriter * pZapWriter); -#ifdef CLR_STANDALONE_BINDER -protected: - - - void FixupMetaData(); - ULONG AddString(__in_z LPWSTR pName, __in int length); - int StripExtension(__in_z LPWSTR pName); - ULONG AddString(LPCSTR pName, int length); - int StripExtension(LPCSTR pName); - ULONG AddBlob(LPCVOID blob, COUNT_T cbBlob); - void SetMVIDOfModule(LPCVOID mvid); - - BOOL m_bFixedUp; - SArray m_metadataHeap; - SArray m_stringHeap; - SArray m_guidHeap; - SArray m_blobHeap; -#endif }; //----------------------------------------------------------------------------- @@ -208,11 +172,6 @@ public: ZapILMetaData(ZapImage * pImage) : m_pImage(pImage) { -#ifdef CLR_STANDALONE_BINDER - m_metaDataStart = pImage->m_ModuleDecoder.GetMetadata(&m_metaDataSize); - pImage->GetCompileInfo()->GetMetadataRvaInfo(&m_firstMethodRvaOffset, - &m_methodDefRecordSize, &m_methodDefCount, &m_firstFieldRvaOffset, &m_fieldRvaRecordSize, &m_fieldRvaCount); -#endif } void Preallocate(COUNT_T cbILImage) @@ -227,10 +186,6 @@ public: void CopyMetaData(); void CopyRVAFields(); -#ifdef CLR_STANDALONE_BINDER - virtual DWORD GetSize(); -#endif - virtual void Save(ZapWriter * pZapWriter); ZapRVADataNode * GetRVAField(void * pData); @@ -262,24 +217,6 @@ private: }; SHash< RVADataTraits > m_rvaData; - -#ifdef CLR_STANDALONE_BINDER -public: - void EmitFieldRVA(mdToken fieldDefToken, RVA fieldRVA); - -private: - LPCVOID m_metaDataStart; - COUNT_T m_metaDataSize; - - DWORD m_firstMethodRvaOffset; - DWORD m_methodDefRecordSize; - DWORD m_methodDefCount; - DWORD m_firstFieldRvaOffset; - DWORD m_fieldRvaRecordSize; - DWORD m_fieldRvaCount; - - MapSHash m_fieldToRVAMapping; -#endif }; #endif // __ZAPMETADATA_H__ diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp index 626e1a0f1e..d6d03d65b1 100644 --- a/src/zap/zapper.cpp +++ b/src/zap/zapper.cpp @@ -53,12 +53,8 @@ extern "C" HRESULT STDMETHODCALLTYPE InitializeFusion(); #include "shlwapi.h" #pragma warning(pop) -#ifndef CLR_STANDALONE_BINDER extern const WCHAR g_pwBaseLibrary[]; extern bool g_fAllowNativeImages; -#ifdef MDIL -bool g_fIsNGenEmbedILProcess; -#endif #if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) bool g_fNGenMissingDependenciesOk; #endif @@ -66,7 +62,6 @@ bool g_fNGenWinMDResilient; #if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR) extern int g_ningenState; #endif -#endif #ifdef FEATURE_READYTORUN_COMPILER bool g_fReadyToRunCompilation; @@ -88,7 +83,6 @@ void Zapper::ReportEventNGEN(WORD wType, DWORD dwEventID, LPCWSTR format, ...) SString message; message.Printf(W(".NET Runtime Optimization Service (%s) - %s"), VER_FILEVERSION_STR_L, s.GetUnicode()); -#ifndef BINDER // Note: We are using the same event log source as the ngen service. This may become problem // if we ever want to split the ngen service from the rest of the .NET Framework. ClrReportEvent(W(".NET Runtime Optimization Service"), @@ -97,8 +91,7 @@ void Zapper::ReportEventNGEN(WORD wType, DWORD dwEventID, LPCWSTR format, ...) dwEventID, // event identifier NULL, // no user security identifier message.GetUnicode()); -#endif - + // Output the message to the logger as well. if (wType == EVENTLOG_WARNING_TYPE) Warning(W("%s\n"), s.GetUnicode()); @@ -147,7 +140,6 @@ static HRESULT GetAssemblyName( // For side by side issues, it's best to use the exported API calls to generate a // Zapper Object instead of creating one on your own. -#ifndef CLR_STANDALONE_BINDER #if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzOutputFilename=NULL, LPCWSTR pwzPlatformWinmdPaths=NULL, ICorSvcLogger *pLogger = NULL) @@ -217,20 +209,6 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl if (pwzPlatformWinmdPaths != nullptr) zap->SetPlatformWinmdPaths(pwzPlatformWinmdPaths); -#ifdef MDIL - if (dwFlags & NGENWORKER_FLAGS_CREATEMDIL) - zap->SetCompilerFlag(CORJIT_FLG_MDIL); - - if (dwFlags & NGENWORKER_FLAGS_MINIMAL_MDIL) - zap->SetCompilerFlag(CORJIT_FLG_MINIMAL_MDIL); - - if (dwFlags & NGENWORKER_FLAGS_NOMDIL) - zap->SetCompilerFlag(CORJIT_FLG_NO_MDIL); - - g_fIsNGenEmbedILProcess = !!(dwFlags & NGENWORKER_FLAGS_EMBEDMDIL); - zap->SetEmbedMDIL(!!(dwFlags & NGENWORKER_FLAGS_EMBEDMDIL)); -#endif - zap->SetForceFullTrust(!!(dwFlags & NGENWORKER_FLAGS_FULLTRUSTDOMAIN)); #ifdef FEATURE_LEGACYNETCF @@ -416,7 +394,6 @@ STDAPI_(BOOL) LegacyNGenCompile(HANDLE hZapper, LPCWSTR path) }// NGenCompile #endif // FEATURE_CORECLR || CROSSGEN_COMPILE -#endif // CLR_STANDALONE_BINDER /* --------------------------------------------------------------------------- * * Options class @@ -565,11 +542,7 @@ Zapper::Zapper(NGenOptions *pOptions, bool fromDllHost) } else { -#ifdef CLR_STANDALONE_BINDER - zo->m_repositoryFlags = RepositoryDefault; -#else zo->m_repositoryFlags = (RepositoryFlags)REGUTIL::GetConfigDWORD_DontUse_(CLRConfig::EXTERNAL_RepositoryFlags, RepositoryDefault); -#endif // CLR_STANDALONE_BINDER } // The default location of the repository is "repository" folder under framework version directory @@ -703,10 +676,6 @@ void Zapper::Init(ZapperOptions *pOptions, bool fFreeZapperOptions) #endif m_fForceFullTrust = false; - -#ifdef MDIL - m_fEmbedMDIL = false; -#endif } // LoadAndInitializeJITForNgen: load the JIT dll into the process, and initialize it (call the UtilCode initialization function, @@ -720,7 +689,6 @@ void Zapper::Init(ZapperOptions *pOptions, bool fFreeZapperOptions) // It is NULL if the JIT returns a NULL interface pointer, or if the JIT-EE interface GUID is mismatched. // // Note that both *phJit and *ppICorJitCompiler will be non-NULL on success. On failure, an exception is thrown. -#ifndef BINDER void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT ICorJitCompiler** ppICorJitCompiler) { _ASSERTE(phJit != NULL); @@ -813,18 +781,13 @@ void Zapper::LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJi // The JIT has loaded and passed the version identifier test, so publish the JIT interface to the caller. *ppICorJitCompiler = pICorJitCompiler; } -#endif // !BINDER -#ifdef BINDER -void Zapper::InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument, ICorCompileInfo *compileInfo, ICorDynamicInfo *dynamicInfo) -#else void Zapper::InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument) -#endif { if (m_pEECompileInfo != NULL) return; -#if defined(FEATURE_COMINTEROP) && !defined(BINDER) +#if defined(FEATURE_COMINTEROP) // // Initialize COM // @@ -840,12 +803,7 @@ void Zapper::InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument) // Get EE compiler interface and initialize the EE // -#ifdef BINDER - _ASSERTE(dynamicInfo != NULL && compileInfo != NULL); - m_pEECompileInfo = compileInfo; -#else m_pEECompileInfo = GetCompileInfo(); -#endif if (m_pOpt->m_statOptions) IfFailThrow(m_pEECompileInfo->SetVerboseLevel (CORCOMPILE_STATS)); @@ -879,13 +837,8 @@ void Zapper::InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument) } #endif // ALLOW_LOCAL_WORKER -#ifdef BINDER - m_pEEJitInfo = dynamicInfo; -#else m_pEEJitInfo = GetZapJitInfo(); -#endif -#ifndef BINDER // // Get JIT interface // @@ -963,7 +916,6 @@ void Zapper::InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument) LoadAndInitializeJITForNgen(altName, &m_hAltJITCompiler, &m_alternateJit); } #endif // ALLOW_SXS_JIT_NGEN -#endif // BINDER } Zapper::~Zapper() @@ -2031,10 +1983,6 @@ void ZapperSetAppCompatWP8(ICorCompilationDomain *pDomain); void Zapper::CreateCompilationDomain() { -#ifdef BINDER - _ASSERTE(!"not reachable"); -#else - #if defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR) // Platform assemblies paths have to be set before appdomain is setup so that // mscorlib.dll can be loaded from them. @@ -2054,32 +2002,12 @@ void Zapper::CreateCompilationDomain() // collect the assembly dependencies for use in the version info, as // well as isolating the compilation code. -#ifdef MDIL - MDILCompilationFlags mdilFlags = MDILCompilationFlags_None; - if (m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) - mdilFlags = (MDILCompilationFlags)(mdilFlags | MDILCompilationFlags_CreateMDIL); - - if (m_pOpt->m_compilerFlags & CORJIT_FLG_MINIMAL_MDIL) - mdilFlags = (MDILCompilationFlags)(mdilFlags | MDILCompilationFlags_MinimalMDIL); - - if (m_pOpt->m_compilerFlags & CORJIT_FLG_NO_MDIL) - mdilFlags = (MDILCompilationFlags)(mdilFlags | MDILCompilationFlags_NoMDIL); - - IfFailThrow(m_pEECompileInfo->CreateDomain(&m_pDomain, - CreateAssemblyEmitter(), - fForceDebug, - fForceProfile, - fForceInstrument, - m_fForceFullTrust, - mdilFlags)); -#else IfFailThrow(m_pEECompileInfo->CreateDomain(&m_pDomain, CreateAssemblyEmitter(), fForceDebug, fForceProfile, fForceInstrument, m_fForceFullTrust)); -#endif #ifdef CROSSGEN_COMPILE IfFailThrow(m_pDomain->SetPlatformWinmdPaths(m_platformWinmdPaths)); @@ -2102,8 +2030,6 @@ void Zapper::CreateCompilationDomain() ZapperSetAppCompatWP8(m_pDomain); } #endif - -#endif // BINDER } void Zapper::CreateDependenciesLookupDomain() @@ -2338,7 +2264,7 @@ void Zapper::ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyString, CORCOMP } else { -#if defined(FEATURE_HOSTED_BINDER) && defined(FEATURE_APPX) && !defined(CLR_STANDALONE_BINDER) && !defined(FEATURE_CORECLR) +#if defined(FEATURE_HOSTED_BINDER) && defined(FEATURE_APPX) && !defined(FEATURE_CORECLR) if (m_pOpt->m_fAutoNGen) { // Make sure we're not been spoofed into loading an assembly that might be unsafe to load. @@ -2380,7 +2306,6 @@ void Zapper::ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyString, CORCOMP IfFailThrow(hr); } -#ifndef BINDER #ifndef FEATURE_CORECLR if (m_pOpt->m_fAutoNGen && !m_pEECompileInfo->SupportsAutoNGen(hAssembly)) { @@ -2388,7 +2313,6 @@ void Zapper::ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyString, CORCOMP ThrowHR(E_FAIL); } #endif // FEATURE_CORECLR -#endif // BINDER // // Check if we have a native image already, and if so get its GUID @@ -2616,9 +2540,6 @@ HRESULT Zapper::Compile(LPCWSTR string, CORCOMPILE_NGEN_SIGNATURE * pNativeImage HRESULT hr = S_OK; - -#if !defined(CLR_STANDALONE_BINDER) - bool fMscorlib = false; LPCWSTR fileName = PathFindFileName(string); if (fileName != NULL && SString::_wcsicmp(fileName, g_pwBaseLibrary) == 0) @@ -2653,22 +2574,6 @@ HRESULT Zapper::Compile(LPCWSTR string, CORCOMPILE_NGEN_SIGNATURE * pNativeImage } #endif -#if defined (MDIL) - if (fMscorlib) - { - if ((m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) != 0) // we are generating MDIL - { - // - // Disallow use of native images to force MDIL generation for mscorlib - // - g_fAllowNativeImages = false; - } - } -#endif - -#endif // !CLR_STANDALONE_BINDER - - // the errors in CreateCompilationDomain are fatal - propogate them up CreateCompilationDomain(); @@ -2810,14 +2715,6 @@ void Zapper::CompileInCurrentDomain(__in LPCWSTR string, CORCOMPILE_NGEN_SIGNATU // CompileAssembly(pNativeImageSig); -#ifdef MDIL - if (!m_pOpt->m_silent && (m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)) - { - GetSvcLogger()->Printf(W("MDIL image %s generated successfully.\n"), GetOutputFileName().GetUnicode()); - goto Exit; - } -#endif - goto Exit; // Avoid warning about unreferenced label Exit: @@ -3623,11 +3520,6 @@ void Zapper::CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig) CompileNonManifestModules(hashAlgId, hFiles); #endif // FEATURE_MULTIMODULE_ASSEMBLIES -#ifdef MDIL - if (m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) - return; -#endif - // // Record the version info // @@ -3811,9 +3703,6 @@ void Zapper::CompileNonManifestModules(ULONG hashAlgId, SArray &hFiles) NewHolder pModule; pModule = CompileModule(hModule, NULL); -#ifdef MDIL - if (!(m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)) -#endif { SString strFileNameWithoutExt(strFileName); SString::CIterator fileNameIterator = strFileNameWithoutExt.End(); @@ -3830,9 +3719,6 @@ void Zapper::CompileNonManifestModules(ULONG hashAlgId, SArray &hFiles) } } -#ifdef MDIL - if (!(m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)) -#endif { NewArrayHolder pbHashValue; DWORD cbHashValue; @@ -3900,13 +3786,6 @@ ZapImage * Zapper::CompileModule(CORINFO_MODULE_HANDLE hModule, module->Compile(); -#ifdef MDIL - if (m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) - { - return NULL; - } -#endif - if (IsReadyToRunCompilation()) { return module.Extract(); @@ -4186,18 +4065,6 @@ void Zapper::SetAppCompatWP8(bool val) } #endif -#ifdef MDIL -void Zapper::SetEmbedMDIL(bool val) -{ - m_fEmbedMDIL = val; -} - -void Zapper::SetCompilerFlag(DWORD val) -{ - m_pOpt->m_compilerFlags |= val; -} -#endif - void Zapper::SetForceFullTrust(bool val) { m_fForceFullTrust = val; diff --git a/src/zap/zaprelocs.cpp b/src/zap/zaprelocs.cpp index 41fbd9df2d..14f913ae15 100644 --- a/src/zap/zaprelocs.cpp +++ b/src/zap/zaprelocs.cpp @@ -33,15 +33,6 @@ void ZapBaseRelocs::WriteReloc(PVOID pSrc, int offset, ZapNode * pTarget, int ta switch (type) { case IMAGE_REL_BASED_ABSOLUTE: -#ifdef TARGET_THUMB2 - if (pTarget->IsThumb2Code()) - { - // code rvas to thumb2 code need to have the low bit set so that - // the cpu knows to use the thumb2 instruction set as opposed to the arm instruction set - _ASSERTE((targetOffset & THUMB_CODE) == 0); - targetOffset |= THUMB_CODE; - } -#endif //TARGET_THUMB2 *(UNALIGNED DWORD *)pLocation = pTarget->GetRVA() + targetOffset; // IMAGE_REL_BASED_ABSOLUTE does not need base reloc entry return; @@ -57,29 +48,10 @@ void ZapBaseRelocs::WriteReloc(PVOID pSrc, int offset, ZapNode * pTarget, int ta // Misaligned relocs disable ASLR on ARM. We should never ever emit them. _ASSERTE(IS_ALIGNED(rva, sizeof(TADDR))); #endif -#ifdef TARGET_THUMB2 - if (pTarget->IsThumb2Code()) - { - // code rvas to thumb2 code need to have the low bit set so that - // the cpu knows to use the thumb2 instruction set as opposed to the arm instruction set - pActualTarget |= THUMB_CODE; - } -#endif //TARGET_THUMB2 *(UNALIGNED TADDR *)pLocation = pActualTarget; break; case IMAGE_REL_BASED_RELPTR: -#ifdef TARGET_THUMB2 - if (pTarget->IsThumb2Code()) - { - pActualTarget |= THUMB_CODE; - } -#endif //TARGET_THUMB2 -#ifdef BINDER - // fall through - - case IMAGE_REL_BASED_MD_METHODENTRY: -#endif // BINDER { TADDR pSite = (TADDR)m_pImage->GetBaseAddress() + rva; *(UNALIGNED TADDR *)pLocation = (INT32)(pActualTarget - pSite); @@ -90,12 +62,6 @@ void ZapBaseRelocs::WriteReloc(PVOID pSrc, int offset, ZapNode * pTarget, int ta case IMAGE_REL_BASED_RELPTR32: { TADDR pSite = (TADDR)m_pImage->GetBaseAddress() + rva; -#ifdef TARGET_THUMB2 - if (pTarget->IsThumb2Code()) - { - pActualTarget |= THUMB_CODE; - } -#endif //TARGET_THUMB2 *(UNALIGNED INT32 *)pLocation = (INT32)(pActualTarget - pSite); } // IMAGE_REL_BASED_RELPTR32 does not need base reloc entry @@ -114,21 +80,12 @@ void ZapBaseRelocs::WriteReloc(PVOID pSrc, int offset, ZapNode * pTarget, int ta #if defined(_TARGET_ARM_) case IMAGE_REL_BASED_THUMB_MOV32: { - if (pTarget->IsThumb2Code()) - { - // code pointers to thumb2 code need to have the low bit set so that - // the cpu knows to use the thumb2 instruction set as opposed to the arm instruction set - pActualTarget |= THUMB_CODE; - } PutThumb2Mov32((UINT16 *)pLocation, (UINT32)pActualTarget); break; } case IMAGE_REL_BASED_THUMB_BRANCH24: { -#ifdef BINDER - _ASSERTE(pTarget->IsThumb2Code()); -#endif TADDR pSite = (TADDR)m_pImage->GetBaseAddress() + rva; // Kind of a workaround: make this reloc work both for calls (which have the thumb bit set), @@ -277,9 +234,6 @@ void ZapBlobWithRelocs::Save(ZapWriter * pZapWriter) case IMAGE_REL_BASED_PTR: targetOffset = (int)*(UNALIGNED TADDR *)pLocation; break; -#ifdef BINDER - case IMAGE_REL_BASED_MD_METHODENTRY: -#endif case IMAGE_REL_BASED_RELPTR: targetOffset = (int)*(UNALIGNED TADDR *)pLocation; break; @@ -408,23 +362,3 @@ ZapBlobWithRelocs * ZapBlobWithRelocs::NewAlignedBlob(ZapWriter * pWriter, PVOID return NULL; } } - -#ifdef BINDER -void ZapBlobWithRelocs::SqueezeRelocs(DWORD entryCount) -{ - ZapReloc *pRelocs = GetRelocs(); - - DWORD nonEmptyCount = 0; - for (DWORD index = 0; index < entryCount; index++) - { - if (pRelocs[index].m_pTargetNode != NULL) - { - pRelocs[nonEmptyCount] = pRelocs[index]; - nonEmptyCount++; - } - } - // Set sentinel - C_ASSERT(offsetof(ZapReloc, m_type) == 0); - pRelocs[nonEmptyCount].m_type = IMAGE_REL_INVALID; -} -#endif diff --git a/src/zap/zaprelocs.h b/src/zap/zaprelocs.h index d43273da3e..3d8033d989 100644 --- a/src/zap/zaprelocs.h +++ b/src/zap/zaprelocs.h @@ -15,13 +15,6 @@ typedef BYTE ZapRelocationType; // IMAGE_REL_XXX enum -#ifdef BINDER -// Special binder specific relocation (on ARM): -// bit0 in NativeCodeEntry in MethodDesc is used to signify "no fixup list" (not THUMB2 code) -// otherwise should be treated exactly like IMAGE_REL_BASED_PTR -#define IMAGE_REL_BASED_MD_METHODENTRY 0x7F -#endif // BINDER - // Special NGEN-specific relocation type for fixups (absolute RVA in the middle 30 bits) #define IMAGE_REL_BASED_ABSOLUTE_TAGGED 0x7E @@ -131,71 +124,6 @@ public: // Create new aligned zap blob node. static ZapBlobWithRelocs * NewAlignedBlob(ZapWriter * pWriter, PVOID pData, SIZE_T cbSize, SIZE_T cbAlignment); - -#ifdef BINDER - // Compress a reloc blob that was pessimistically sized (removes entries with a NULL target node). - void SqueezeRelocs(DWORD entryCount); - - // Helper to set a reloc target to a specific offset. - void SetPointerToOffset(size_t offset, size_t setOffs) - { - assert(offset < GetSize() && offset + sizeof(SIZE_T) <= GetSize()); - *(SIZE_T *)(GetData() + offset) = setOffs; - } - - // Helper to zero a reloc target. - void ZeroPointer(size_t offset) - { - SetPointerToOffset(offset, 0); - } - -#ifdef CLR_STANDALONE_BINDER // REDHAWK doesn't use the low-bit trick (yet?) - // Helper to set reloc target to 1, which indicates a double indirection in the CLR. - void SetPointerToIndirect(size_t offset) - { - SetPointerToOffset(offset, 1); - } -#endif -#endif }; -#if defined(TARGET_THUMB2) && defined(BINDER) -class ZapThumb2CodeBlob : public ZapBlobWithRelocs -{ -protected: - ZapThumb2CodeBlob(SIZE_T cbSize) - : ZapBlobWithRelocs(cbSize) - { - } - -public: - virtual UINT GetAlignment() - { - return 4; - } - - static ZapThumb2CodeBlob * NewThumb2CodeBlob(ZapWriter * pWriter, PVOID pData, SIZE_T cbSize) - { - S_SIZE_T cbAllocSize = S_SIZE_T(sizeof(ZapThumb2CodeBlob)) + S_SIZE_T(cbSize); - if(cbAllocSize.IsOverflow()) - ThrowHR(COR_E_OVERFLOW); - - void * pMemory = new (pWriter->GetHeap()) BYTE[cbAllocSize.Value()]; - - ZapThumb2CodeBlob * pZapBlob = new (pMemory) ZapThumb2CodeBlob(cbSize); - - if (pData != NULL) - memcpy(pZapBlob + 1, pData, cbSize); - - return pZapBlob; - } - - virtual BOOL IsThumb2Code() - { - return TRUE; - } -}; -#endif // TARGET_THUMB2 && BINDER - - #endif // __ZAPRELOCS_H__ diff --git a/src/zap/zapwriter.h b/src/zap/zapwriter.h index 4a2b313c3b..e31af2a5f1 100644 --- a/src/zap/zapwriter.h +++ b/src/zap/zapwriter.h @@ -124,14 +124,6 @@ public: { return m_RVA != 0; } -#if defined(TARGET_THUMB2) && defined(BINDER) - virtual BOOL IsThumb2Code() - { - return FALSE; - } -#else - __forceinline BOOL IsThumb2Code() { return false;} -#endif }; //--------------------------------------------------------------------------------------- -- cgit v1.2.3