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
// 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
{
// 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
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;
#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,
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)
};
#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;
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)
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))
{
}
}
}
-#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);
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)
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,
#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,
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
/* 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,
/* 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
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)
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,
#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
{
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__
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,
#ifndef __GC_H
#define __GC_H
-#ifndef BINDER
-
#ifdef PROFILING_SUPPORTED
#define GC_PROFILING //Turn on profiling
#endif // PROFILING_SUPPORTED
-#endif
-
/*
* Promotion Function Prototypes
*/
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)
}
#endif // DACCESS_COMPILE
-#endif // !CLR_STANDALONE_BINDER
-
private:
typedef enum
{
{
// 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);
}
unsigned m_curBase;
};
-
-#ifdef MDIL
-#define MUST_CALL_JITALLOCATOR_FREE 1
-#endif
-
class LiveStateFuncs
{
public:
#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)
#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;
}
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)
{
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);
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
//
#endif // _DEBUG
-#ifndef CLR_STANDALONE_BINDER
IExecutionEngine *GetExecutionEngine();
-#endif
IEEMemoryManager *GetEEMemoryManager();
LPVOID ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
typedef LPVOID* (*CLRFLSGETBLOCK)();
extern CLRFLSGETBLOCK __ClrFlsGetBlock;
-#ifndef CLR_STANDALONE_BINDER
// Combining getter/setter into a single call
inline void ClrFlsIncrementValue(DWORD slot, int increment)
{
END_PRESERVE_LAST_ERROR;
}
}
-#endif //!CLR_STANDALONE_BINDER
typedef LPVOID (*FastAllocInProcessHeapFunc)(DWORD dwFlags, SIZE_T dwBytes);
extern FastAllocInProcessHeapFunc __ClrAllocInProcessHeap;
// 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;
}
// 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"
#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
}
//=====================================================================================================================
-#ifndef CLR_STANDALONE_BINDER
#ifdef FEATURE_FUSION
class CLRPrivAssemblyBindResultWrapper :
public IUnknownCommon<
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
}; // class HSTRINGArrayHolder
#endif // FEATURE_COMINTEROP
-#ifndef CLR_STANDALONE_BINDER
////////////////////////////////////////////////////////////////////////////////////////////////////
///// ----------------------------- Questionable stuff -------------------------------------------
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__
// 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 <UINT_PTR VIOLATION_MASK>
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 )
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.
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:
BOOL fForceProfiling,
BOOL fForceInstrument,
BOOL fForceFulltrustDomain
-#ifdef MDIL
- , MDILCompilationFlags mdilCompilationFlags
-#endif
) = 0;
// calls pfnCallback in the specified domain
CORINFO_MODULE_HANDLE *pHandle
) = 0;
-#ifndef BINDER
#ifndef FEATURE_CORECLR
// Check if the assembly supports automatic NGen
virtual BOOL SupportsAutoNGen(
COUNT_T nModules
) = 0;
#endif
-#endif
// Checks to see if an up to date zap exists for the
// assembly
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,
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
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,
// 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;
// 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
VLT_COUNT,
VLT_INVALID,
-#ifdef MDIL
- VLT_MDIL_SYMBOLIC = 0x20
-#endif
-
};
struct VarLoc
#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
<Comment> The operation was cancelled.</Comment>
</HRESULT>
-<HRESULT NumericValue="0x8013153c">
- <SymbolicName>COR_E_UNSUPPORTEDMDIL</SymbolicName>
- <Message>"Valid IL which cannot be compiled into MDIL."</Message>
- <Comment> Valid IL which cannot be compiled into MDIL. We will skip MDIL compilation and fall back to JIT.</Comment>
-</HRESULT>
-
<HRESULT NumericValue="0x8013153d">
<SymbolicName>COR_E_INSUFFICIENTMEMORY</SymbolicName>
<Comment> Not enough memory was available for an operation.</Comment>
#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"
#define _DEBUG_IMPL 1
#endif
-#endif //!CLR_STANDALONE_BINDER
-
//===========================================================================================
// These abstractions hide the difference between legacy desktop CLR's (that don't support
virtual BOOL IsPreallocatedException() { return bIsPreallocated; }
};
-#ifndef CLR_STANDALONE_BINDER
-
template <typename STATETYPE>
class CAutoTryCleanup
{
// 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_
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
#include <pshpack1.h>
-#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]
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
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
};
#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
#ifndef _METADATA_H_
#define _METADATA_H_
-#ifndef BINDER
#include "../md/inc/metamodelro.h"
#include "../md/inc/liteweightstgdb.h"
-#endif
class UTSemReadWrite;
// 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
// should we just check proper inclusion?
#include <winwrap.h>
-#ifndef CLR_STANDALONE_BINDER
#include "staticcontract.h"
-#endif
inline VOID UnsafeEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
{
#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 ()
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;
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:
PVOID m_PreviousValue;
PredefinedTlsSlots m_slot;
};
-#endif // !CLR_STANDALONE_BINDER
//*********************************************************************************
#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
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
// 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);
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
<!-- This might be useful, to help make sure JIT devs build all configurations of the JIT (including crossgen), but
it appears to cause problems with the build system, and it slows down normal JIT developer productivity by adding a seldom-useful build.
- <ProjectFile Condition="'$(MDILGenerator)' != 'true'" Include="crossgen\jit_crossgen.nativeproj" />
+ <ProjectFile Include="crossgen\jit_crossgen.nativeproj" />
-->
<ProjectFile Condition="'$(BuildArchitecture)' == 'arm'" Include="protojit\protojit.nativeproj" />
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
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."
#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)
#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);
Output(W("\n"));
W(" /partialtrust - Assembly will be run in a partial trust domain.\n")
#endif
W(" /in <file> - Specifies input filename (optional)\n")
-#ifdef MDIL
- W(" /out <file> - Specifies output filename (optional with native images,\n")
- W(" required with MDIL)\n")
-#else
W(" /out <file> - Specifies output filename (optional)\n")
-#endif
#ifdef FEATURE_CORECLR
W(" /Trusted_Platform_Assemblies <path[;path]>\n")
W(" - List of assemblies treated as trusted platform\n")
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")
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;
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")))
{
exit(INVALID_ARGUMENTS);
}
-#ifdef MDIL
- if (pwzOutputFilename == NULL)
- {
- if (dwFlags & NGENWORKER_FLAGS_CREATEMDIL)
- {
- Output(W("You must specify an output filename (/out <file>)\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 <file>)\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"));
#ifndef _APPDOMAIN_H
#define _APPDOMAIN_H
-#ifndef CLR_STANDALONE_BINDER
#include "eventtrace.h"
#include "assembly.hpp"
#include "clsload.hpp"
#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;
return &m_pGCStatics;
}
-#ifndef CLR_STANDALONE_BINDER
// Returns bytes so we can add offsets
inline PTR_BYTE GetGCStaticsBasePointer(MethodTable * pMT)
{
return dac_cast<PTR_BYTE>(this);
}
}
-#endif // !CLR_STANDALONE_BINDER
inline DynamicClassInfo* GetDynamicClassInfo(DWORD n)
{
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)
return retval;
}
-#endif // CLR_STANDALONE_BINDER
FORCEINLINE PTR_DynamicClassInfo GetDynamicClassInfoIfInitialized(DWORD n)
{
return offsetof(DomainLocalModule, m_pDataBlob);
}
-#ifndef CLR_STANDALONE_BINDER
FORCEINLINE MethodTable * GetMethodTableFromClassDomainID(DWORD dwClassDomainID)
{
DWORD rid = (DWORD)(dwClassDomainID) + 1;
PREFIX_ASSUME(pMT != NULL);
return pMT;
}
-#endif // CLR_STANDALONE_BINDER
-
+
private:
friend void EmitFastGetSharedStaticBase(CPUSTUBLINKER *psl, CodeLabel *init, bool bCCtorCheck);
}; // struct DomainLocalModule
-#ifndef CLR_STANDALONE_BINDER
-
typedef DPTR(class DomainLocalBlock) PTR_DomainLocalBlock;
class DomainLocalBlock
{
return dac_cast<PTR_CompilationDomain>(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;
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
};
#endif // !DACCESS_COMPILE && !CROSSGEN_COMPILE
-
-#endif // !CLR_STANDALONE_BINDER
-
#endif
#ifndef _APPDOMAIN_I
#define _APPDOMAIN_I
-#ifndef BINDER
-
#ifndef DACCESS_COMPILE
#include "appdomain.hpp"
return PTR_LoaderAllocator(PTR_HOST_MEMBER_TADDR(AppDomain,this,m_LoaderAllocator));
}
-#endif // !BINDER
-
/* static */
inline DWORD DomainLocalModule::DynamicEntry::GetOffsetOfDataBlob()
{
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();
// 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;
_ASSERTE(!FORBIDGC_LOADER_USE_ENABLED());
CONTRACT_VIOLATION(ThrowsViolation);
#endif
-#ifdef BINDER
- IfFailThrow(COR_E_NOTSUPPORTED);
-#else
COMPlusThrow(kNotSupportedException);
-#endif
}
#endif
}
int endOfs = ofs + stackElemSize;
if (endOfs > maxOffset)
{
-#if !defined(DACCESS_COMPILE) && !defined(BINDER)
+#if !defined(DACCESS_COMPILE)
if (endOfs > MAX_ARG_SIZE)
{
#ifdef _DEBUG
// 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
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
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;
m_pBinder->BindAll();
}
-#ifdef MDIL
- if (pCompactLayoutWriter)
- {
- pCompactLayoutWriter->Flush();
- }
-#endif // MDIL
} // Module::ExpandAll
/* static */
#ifndef CEELOAD_H_
#define CEELOAD_H_
-#ifndef CLR_STANDALONE_BINDER
-
#include "common.h"
#ifdef FEATURE_FUSION
#include <fusion.h>
#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<typename PTR_TYPE> class FixupPointer;
-
-class EEPtrHashTable;
-class ISymUnmanagedReader;
-class NgenStats;
-
-#endif // CLR_STANDALONE_BINDER
-
-
class PELoader;
class Stub;
class MethodDesc;
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
// 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)
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
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,
return hashVal;
};
-#ifndef CLR_STANDALONE_BINDER
ArrayDPTR(FixupPointer<PTR_MethodTable>) GetGCStaticMTs(DWORD index);
#ifdef FEATURE_PREJIT
}
};
#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
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
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;
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
{
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<ILOffsetMappingTraits> ILOffsetMappingTable;
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;
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;
#endif
public:
-
-#ifndef CLR_STANDALONE_BINDER
LookupMap<PTR_MethodTable>::Iterator EnumerateTypeDefs()
{
LIMITED_METHOD_CONTRACT;
return LookupMap<PTR_MethodTable>::Iterator(&m_TypeDefToMethodTableMap);
}
-#endif
// Hash of available types by name
PTR_EEClassHashTable m_pAvailableClasses;
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
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
#ifdef FEATURE_PREJIT
struct TokenProfileData
{
-#ifndef CLR_STANDALONE_BINDER
-
static TokenProfileData *CreateNoThrow(void);
TokenProfileData()
RidBitmap tokenBitmaps[CORBBTPROF_TOKEN_MAX_NUM_FLAGS];
} m_formats[SectionFormatCount];
-#endif // CLR_STANDALONE_BINDER
} *m_tokenProfileData;
// Stats for prejit log
// Domain that the IJW fixups were applied in
ADID m_DomainIdOfIJWFixups;
-#ifndef CLR_STANDALONE_BINDER
-
public:
ADID GetDomainIdOfIJWFixups()
{
m_DomainIdOfIJWFixups = id;
}
-#endif // CLR_STANDALONE_BINDER
#endif // FEATURE_MIXEDMODE
-#ifndef CLR_STANDALONE_BINDER
-
protected:
void CreateDomainThunks();
#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
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); }
// 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);
// 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
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.
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);
LIMITED_METHOD_CONTRACT;
return (SIZE_T*) &m_ModuleID;
}
-#endif // !CLR_STANDALONE_BINDER
static SIZE_T GetOffsetOfModuleID()
{
return offsetof(Module, m_ModuleID);
}
-#ifndef CLR_STANDALONE_BINDER
PTR_DomainLocalModule GetDomainLocalModule(AppDomain *pDomain);
#ifndef DACCESS_COMPILE
#endif // FEATURE_PREJIT
void EnumRegularStaticGCRefs (AppDomain* pAppDomain, promote_func* fn, ScanContext* sc);
-
-#endif // CLR_STANDALONE_BINDER
protected:
// 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);
}
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
//
bool IsSingleAppDomain();
-#endif // CLR_STANDALONE_BINDER
-
#endif // !CEELOAD_H_
#include "runtimecallablewrapper.h"
#endif // FEATURE_COMINTEROP
-#ifdef MDIL
-#include "security.h"
-#endif
-
//#define DEBUG_LAYOUT
#define SORT_BY_RID
_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<T> 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<SortFieldRid> 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<SortField> 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<TADDR>(m_methodDesc) + m_methodDesc->SizeOf();
- TADDR pEnd = dac_cast<TADDR>(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
/*
* Include Files
*/
-#ifndef BINDER
#include "eecontract.h"
#include "argslot.h"
#include "vars.hpp"
#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);
#endif
};
-#ifdef BINDER
-class InterfaceImplEnum;
-#else
//*******************************************************************************
// Enumerator to traverse the interface declarations of a type, automatically building
// a substitution chain on the stack.
const Substitution *CurrentSubst() const { LIMITED_METHOD_CONTRACT; return &m_CurrSubst; }
mdTypeDef CurrentToken() const { LIMITED_METHOD_CONTRACT; return m_CurrTok; }
};
-#endif // BINDER
#ifdef FEATURE_COMINTEROP
//
#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.
friend class NativeImageDumper;
#endif
-#ifdef BINDER
- friend class MdilModule;
- friend class CompactTypeBuilder;
-#endif
-
//
// GENERICS RELATED FIELDS.
//
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
#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
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
Module * pModule,
SigPointer sp,
CorGenericParamAttr position);
-#endif
-
#if defined(CHECK_APP_DOMAIN_LEAKS) || defined(_DEBUG)
public:
typedef DPTR(ArrayClass) PTR_ArrayClass;
-#ifdef BINDER
-class MdilModule;
-#endif
// Dynamically generated array class structure
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
#ifdef DACCESS_COMPILE
friend class NativeImageDumper;
#endif
-#ifdef BINDER
- friend class MdilModule;
-#endif
#ifdef _DEBUG
PTR_CUTF8 DebugKey[2]; // Name of the type
//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);
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);
};
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);
namespace CLRPrivBinderUtil
{
-#ifndef CLR_STANDALONE_BINDER
#ifdef FEATURE_FUSION
//-----------------------------------------------------------------------------------------------------------------
CLRPrivAssemblyBindResultWrapper::CLRPrivAssemblyBindResultWrapper(
return E_UNEXPECTED;
}
#endif //FEATURE_FUSION
-#endif //!CLR_STANDALONE_BINDER
//-----------------------------------------------------------------------------------------------------------------
HRESULT VerifyBind(
}
#ifdef FEATURE_FUSION
-#ifndef CLR_STANDALONE_BINDER
//=====================================================================================================================
HRESULT AssemblyIdentity::Initialize(
AssemblySpec * pSpec)
return hr;
}
-#endif //!CLR_STANDALONE_BINDER
#endif
////////////////////////////////////////////////////////////////////////////////////////////////////
///// ----------------------------- 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*)
WRAPPER_NO_CONTRACT;
return a1->CompareEx(a2, AssemblySpec::ASC_Default);
}
-#endif //!CLR_STANDALONE_BINDER && FEATURE_APPX
+#endif // FEATURE_APPX
} // namespace CLRPrivBinderUtil
//=============================================================================================
#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"
#include "../binder/inc/fusionassemblyname.hpp"
#endif
-#ifdef CLR_STANDALONE_BINDER
-#include "fakepeimage.h"
-#include "coreclr/corebindresult.inl"
-#endif
using namespace CLRPrivBinderUtil;
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(
| 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);
{
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);
}
_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;
{
// 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)
{
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);
}
}
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)
{
}
else
{
-#if !defined(CLR_STANDALONE_BINDER)
// This code is desktop specific.
_ASSERTE(m_fNamespaceResolutionKind == NamespaceResolutionKind_DesignerResolveEvent);
EX_RETHROW;
}
EX_END_CATCH_UNREACHABLE
-#endif // !defined(CLR_STANDALONE_BINDER)
}
#else //CROSSGEN_COMPILE
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;
{
// 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)
{
//=====================================================================================================================
// Finds assembly with WinRT type if it is already loaded.
//
-#ifndef CLR_STANDALONE_BINDER
PTR_Assembly
CLRPrivBinderWinRT::FindAssemblyForTypeIfLoaded(
PTR_AppDomain pAppDomain,
ForbidSuspendThreadHolder suspend;
{
CrstHolder lock(&m_MapsLock);
-
+
pNamespaceEntry = m_NamespaceToFileNameListMap.LookupPtr(wszNamespace);
if ((pNamespaceEntry == nullptr) || (pNamespaceEntry->m_pFileNameList == nullptr))
{
return NULL;
} // CLRPrivBinderWinRT::FindAssemblyForTypeIfLoaded
-#endif // !CLR_STANDALONE_BINDER
#ifndef DACCESS_COMPILE
// 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)
{
// 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
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;
#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<IUnknown>
-{
- ReleaseHolder<IUnknown> 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<IUnknown>
static CLRPrivTypeCacheWinRT * s_pSingleton;
}; // class CLRPrivTypeCaheWinRT
-#endif
+
typedef DPTR(CLRPrivTypeCacheWinRT) PTR_CLRPrivTypeCacheWinRT;
#endif // FEATURE_HOSTED_BINDER
SUPPORTS_DAC;
}
-#ifndef BINDER
NameHandle(Module* pModule, mdToken token) :
m_nameSpace(NULL),
m_name(NULL),
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
}
-#endif // !BINDER
NameHandle(const NameHandle & p)
{
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,
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,
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)
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);
IMDInternalImport *pTDImport,
mdTypeDef *mtd);
-#ifndef BINDER
class AvailableClasses_LockHolder : public CrstHolder
{
public:
WRAPPER_NO_CONTRACT;
}
};
-#endif // !BINDER
friend class AvailableClasses_LockHolder;
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
#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
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_
BOOL fForceDebug,
BOOL fForceProfiling,
BOOL fForceInstrument,
- BOOL fForceFulltrustDomain
-#ifdef MDIL
- , MDILCompilationFlags mdilCompilationFlags
-#endif
- )
+ BOOL fForceFulltrustDomain)
{
STANDARD_VM_CONTRACT;
{
SystemDomain::LockHolder lh;
- pCompilationDomain->Init(
-#ifdef MDIL
- mdilCompilationFlags
-#endif
- );
+ pCompilationDomain->Init();
}
if (pEmitter)
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
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.
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)
{
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,
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;
#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<DWORD>::multiply(sizeof(TypeHandle), nGenericClassArgs, dwAllocSize))
- ThrowHR(COR_E_OVERFLOW);
-
- CQuickBytes qbGenericClassArgs;
- TypeHandle* pGenericClassArgs = reinterpret_cast<TypeHandle*>(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<DWORD>::multiply(sizeof(TypeHandle), nGenericMethodArgs, dwAllocSize))
- ThrowHR(COR_E_OVERFLOW);
-
- genericMethodArgs = reinterpret_cast<TypeHandle*>(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;
{
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())
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;
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())
}
-void CompilationDomain::Init(
-#ifdef MDIL
- MDILCompilationFlags mdilCompilationFlags
-#endif
- )
+void CompilationDomain::Init()
{
STANDARD_VM_CONTRACT;
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.
BOOL fForceDebug,
BOOL fForceProfiling,
BOOL fForceInstrument,
- BOOL fForceFulltrustDomain
-#ifdef MDIL
- , MDILCompilationFlags mdilCompilationFlags
-#endif
- );
+ BOOL fForceFulltrustDomain);
HRESULT MakeCrossDomainCallback(
ICorCompilationDomain* pDomain,
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);
ICorCompileDataStore *pData,
CorProfileData *profileData);
-#if MDIL
- HRESULT ShouldCompile(CORINFO_METHOD_HANDLE methodHandle);
-#endif // MDIL
-
#ifdef FEATURE_FUSION
HRESULT GetAssemblyName(
CORINFO_ASSEMBLY_HANDLE hAssembly,
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);
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);
~CompilationDomain();
#endif
- void Init(
-#ifdef MDIL
- MDILCompilationFlags mdilCompilationFlags
-#endif
- );
+ void Init();
HRESULT AddDependency(AssemblySpec *pRefSpec, PEAssembly *pFile);
// 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);
#endif
};
-#endif // CLR_STANDALONE_BINDER
-
#endif
BOOL m_fUseFatIdsForUniqueness;
UINT32 m_entryCount;
-#ifndef BINDER
//------------------------------------------------------------------------
// Returns the next available ID
inline UINT32 GetNextID()
CONSISTENCY_CHECK(id != TYPE_ID_THIS_CLASS);
return id;
}
-#endif
public:
// Starting values for shared and unshared domains
//------------------------------------------------------------------------
// Ctor
-#ifndef BINDER
TypeIDMap()
: m_lock(CrstTypeIDMap, CrstFlags(CRST_REENTRANCY))
{
WRAPPER_NO_CONTRACT;
static_assert_no_msg(TypeIDProvider::INVALID_TYPE_ID == static_cast<UINT32>(INVALIDENTRY));
}
-#endif
//------------------------------------------------------------------------
// Dtor
typedef DPTR(class DispatchMap) PTR_DispatchMap;
// ===========================================================================
-#ifndef BINDER
class DispatchMap
{
protected:
}; // class Iterator
}; // class DispatchMap
-#endif // BINDER
-
#ifdef LOGGING
struct StubDispatchStats
{
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<CLRPrivBinderAssemblyLoadContext *>(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<CLRPrivBinderCoreCLR *>(pIUnknownBinder))->GetAppContext();
}
#include "common.h"
-#ifdef CLR_STANDALONE_BINDER
-#include "coreclr\corebindresult.h"
-#endif // CLR_STANDALONE_BINDER
-
#include "../binder/inc/assembly.hpp"
#ifndef FEATURE_FUSION
_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();
return &(m_rmi[0]);
}
};
-#ifndef BINDER
+
class CrossDomainTypeMap
{
class MTMapEntry
};
#endif
-#endif // !BINDER
+
// 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:
void DebugDestroy();
#endif
-#endif // CLR_STANDALONE_BINDER
-
union {
CRITICAL_SECTION m_criticalsection;
#ifdef FEATURE_INCLUDE_ALL_INTERFACES
void PreLeave ();
#endif //_DEBUG
-#ifndef CLR_STANDALONE_BINDER
-
private:
void SetOSCritSec ()
// 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<CrstBase *, CrstBase::ReleaseLock, CrstBase::AcquireLock, 0, CompareDefault, HSV_ValidateMinimumStackReq> 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)
{
Crst() {
LIMITED_METHOD_CONTRACT;
}
-
-#endif // CLR_STANDALONE_BINDER
};
typedef DPTR(Crst) PTR_Crst;
initialized memory */
class CrstStatic : public CrstBase
{
-#ifndef CLR_STANDALONE_BINDER
public:
VOID Init(CrstType crstType, CrstFlags flags = CRST_DEFAULT)
{
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;
Destroy();
#endif
}
-#endif // CLR_STANDALONE_BINDER
};
-#ifndef CLR_STANDALONE_BINDER
__inline BOOL IsOwnerOfCrst(LPVOID lock)
{
WRAPPER_NO_CONTRACT;
#endif
}
-#endif // CLR_STANDALONE_BINDER
-
#ifdef TEST_DATA_CONSISTENCY
// used for test purposes. Determines if a crst is held.
void DebugTryCrst(CrstBase * pLock);
#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
//
// 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))
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();
#endif
}
-#ifndef BINDER
DWORD DataImage::GetMethodProfilingFlags(MethodDesc * pMD)
{
STANDARD_VM_CONTRACT;
const MethodProfilingData * pData = m_methodProfilingData.LookupPtr(pMD);
return (pData != NULL) ? pData->flags : 0;
}
-#endif
void DataImage::SetMethodProfilingFlags(MethodDesc * pMD, DWORD flags)
{
{
STANDARD_VM_CONTRACT;
-#ifndef BINDER
// TODO: Move to ZapImage
PEDecoder pe((void *)m_module->GetFile()->GetManagedFileContents());
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()
// 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;
// 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;
}
}
-#ifndef BINDER
// Save the info of an RVA into m_rvaInfoVector.
void DataImage::StoreRvaInfo(FieldDesc * pFD,
DWORD rva,
m_rvaInfoVector.Append(rvaInfo);
}
-#endif
// qsort compare function.
// Primary key: rva (ascending order). Secondary key: size (descending order).
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()
previousRvaInfo = rvaInfo;
}
}
-#endif // !BINDER
void DataImage::RegisterSurrogate(PVOID ptr, PVOID surrogate)
{
STANDARD_VM_CONTRACT;
FixupModuleRVAs();
-#ifndef BINDER
FixupRvaStructure();
if (m_module->m_pCerNgenRootTable != NULL)
// 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
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; i<m_rvaInfoVector.GetCount(); i++) {
pEmit->SetRVA(rvaInfo->pFD->GetMemberDef(), dwOffset);
}
}
-#endif // !BINDER
void ZapStoredStructure::Save(ZapWriter * pWriter)
{
FixupFieldToNode(m_module->m_pNGenLayoutInfo, offsetof(NGenLayoutInfo, m_rvaFilterPersonalityRoutine), pFilterPersonalityRoutine, 0, IMAGE_REL_BASED_ABSOLUTE);
}
-#ifndef BINDER
-
void DataImage::FixupRvaStructure()
{
STANDARD_VM_CONTRACT;
AddStructureInOrder(pNode);
}
-#endif // !BINDER
#endif // FEATURE_PREJIT
InlineTrackingMap *m_inlineTrackingMap;
public:
-#ifndef CLR_STANDALONE_BINDER
DataImage(Module *module, CEEPreloader *preloader);
-#else
- DataImage(Module *module, ZapImage *pZapImage);
-#endif
~DataImage();
void Preallocate();
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<PTR_Module> * ppModule);
-#else
- void FixupModulePointer(PVOID p, FixupPointer<PTR_ClrModule> * ppModule);
-#endif
void FixupMethodTablePointer(PVOID p, FixupPointer<PTR_MethodTable> * ppMT);
void FixupTypeHandlePointer(PVOID p, FixupPointer<TypeHandle> * pth);
void FixupMethodDescPointer(PVOID p, FixupPointer<PTR_MethodDesc> * ppMD);
void FixupFieldDescPointer(PVOID p, FixupPointer<PTR_FieldDesc> * ppFD);
-#ifndef CLR_STANDALONE_BINDER
void FixupModulePointer(PVOID p, RelativeFixupPointer<PTR_Module> * ppModule);
-#else
- void FixupModulePointer(PVOID p, RelativeFixupPointer<PTR_ClrModule> * ppModule);
-#endif
void FixupMethodTablePointer(PVOID p, RelativeFixupPointer<PTR_MethodTable> * ppMT);
void FixupTypeHandlePointer(PVOID p, RelativeFixupPointer<TypeHandle> * pth);
void FixupMethodDescPointer(PVOID p, RelativeFixupPointer<PTR_MethodDesc> * ppMD);
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);
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;
}
#endif // DACCESS_COMPILE
-#ifndef BINDER
// Init given a starting address from the start of code.
void DebugInfoRequest::InitFromStartingAddr(MethodDesc * pMD, PCODE addrCode)
{
pJitMan->EnumMemoryRegionsForMethodDebugInfo(flags, pMD);
}
#endif
-
-#endif // BINDER
// --------------------------------------------------------
// This is used to encode a bitstream encoding
-#ifndef BINDER
class Encoder
{
public:
BOOL signedNumbers;
unsigned index;
};
-#endif // !BINDER
#endif // __DECODEMD_H__
#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);
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)
}
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)
}
};
-#ifndef BINDER
typedef EEHashTable<PTR_VOID, EEPtrHashTableHelper<PTR_VOID>, FALSE> EEPtrHashTable;
typedef DPTR(EEPtrHashTable) PTR_EEPtrHashTable;
-#endif // !BINDER
// Define a hash of generic instantiations (represented by a SigTypeContext).
class EEInstantiationHashTableHelper
#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
//
-#if !defined(__FCall_h__) && !defined(CLR_STANDALONE_BINDER)
+#ifndef __FCall_h__
#define __FCall_h__
#include "gms.h"
#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
class FieldDesc
{
friend class MethodTableBuilder;
-#ifdef BINDER
- friend class MdilModule;
-#endif // BINDER
#ifdef DACCESS_COMPILE
friend class NativeImageDumper;
#endif
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()
{
// 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()
{
DWORD rva;
-#ifndef BINDER
// <NICE>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.
HRESULT hr;
hr = GetMDImport()->GetFieldRVA(GetMemberDef(), &rva);
_ASSERTE(SUCCEEDED(hr));
-#else // BINDER
- BOOL fSucceeded = GetRVAOffsetForFieldDesc(this, &rva);
- assert(fSucceeded);
-#endif // BINDER
return rva;
}
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
{
BOOL IsSharedByGenericInstantiations()
{
LIMITED_METHOD_DAC_CONTRACT;
-#ifndef BINDER
return (!IsStatic()) && GetApproxEnclosingMethodTable()->IsSharedByGenericInstantiations();
-#else // BINDER
- return FALSE;
-#endif // BINDER
}
BOOL IsFieldOfValueType()
return GetApproxEnclosingMethodTable()->GetNumGenericArgs();
}
-
-#ifndef BINDER
-
PTR_BYTE GetBaseInDomainLocalModule(DomainLocalModule * pLocalModule)
{
WRAPPER_NO_CONTRACT;
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;
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
#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_
#ifndef __FieldMarshaler_h__
#define __FieldMarshaler_h__
-#ifdef BINDER
-
-//TritonToDo: why don't we use the value from vm\<cpu>\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;
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;
}
CONTRACTL_END;
-#ifndef BINDER
#ifdef FEATURE_PREJIT
Module::RestoreFieldDescPointer(&m_pFD);
#endif // FEATURE_PREJIT
-#endif // BINDER
}
void SetFieldDesc(FieldDesc* pFD)
}
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
//=======================================================================
class FieldMarshaler_Nullable : public FieldMarshaler
{
-#ifdef BINDER
- friend class CompactTypeBuilder;
- friend class MdilModule;
-#endif
-
public:
FieldMarshaler_Nullable(MethodTable* pMT)
//=======================================================================
class FieldMarshaler_NestedLayoutClass : public FieldMarshaler
{
-#ifdef BINDER
- friend class CompactTypeBuilder;
- friend class MdilModule;
-#endif
public:
FieldMarshaler_NestedLayoutClass(MethodTable *pMT)
{
//=======================================================================
class FieldMarshaler_NestedValueClass : public FieldMarshaler
{
-#ifdef BINDER
- friend class CompactTypeBuilder;
- friend class MdilModule;
-#endif
public:
FieldMarshaler_NestedValueClass(MethodTable *pMT)
{
//=======================================================================
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)
//=======================================================================
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;
//=======================================================================
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)
//=======================================================================
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)
//=======================================================================
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);
{
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
}
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();
}
//=======================================================================
class FieldMarshaler_SafeArray : public FieldMarshaler
{
-#ifdef BINDER
- friend class CompactTypeBuilder;
- friend class MdilModule;
-#endif
public:
VOID UpdateNativeImpl(OBJECTREF* pCLRValue, LPVOID pNativeValue, OBJECTREF *ppCleanupWorkListOnStack) const;
//=======================================================================
class FieldMarshaler_Delegate : public FieldMarshaler
{
-#ifdef BINDER
- friend class CompactTypeBuilder;
- friend class MdilModule;
-#endif
public:
FieldMarshaler_Delegate(MethodTable* pMT)
{
//=======================================================================
class FieldMarshaler_Interface : public FieldMarshaler
{
-#ifdef BINDER
- friend class CompactTypeBuilder;
- friend class MdilModule;
-#endif
public:
VOID UpdateNativeImpl(OBJECTREF* pCLRValue, LPVOID pNativeValue, OBJECTREF *ppCleanupWorkListOnStack) const;
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)
SCALAR_MARSHALER_IMPL(sizeof(CHAR), sizeof(CHAR))
-#ifndef BINDER
VOID ScalarUpdateNativeImpl(LPVOID pCLR, LPVOID pNative) const
{
CONTRACTL
*((char*)pNative) = c;
}
-#endif
VOID ScalarUpdateCLRImpl(const VOID *pNative, LPVOID pCLR) const
{
DeclaringTypeHandleSlot = 7,
};
-#ifndef BINDER
class DictionaryEntryLayout
{
public:
#endif // FEATURE_PREJIT
};
-#endif // BINDER
// The type of dictionaries. This is just an abstraction around an open-ended array
public:
-#ifndef BINDER
#ifdef FEATURE_PREJIT
// Fixup the dictionary entries, including the type arguments
DWORD numGenericArgs);
void Restore(DWORD numGenericArgs, ClassLoadLevel level);
#endif // FEATURE_PREJIT
-#endif // BINDER
};
#endif
#ifdef FEATURE_COMINTEROP
WORD wNumInterfaces = static_cast<WORD>(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;
{
// 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)))
{
return (INT32)(target - baseAddr);
}
-#ifndef CLR_STANDALONE_BINDER
-
#ifdef FEATURE_COMINTEROP
inline void emitCOMStubCall (ComCallMethodDesc *pCOMMethod, PCODE target)
{
};
};
-#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
#ifndef STUBLINKERX86_H_
#define STUBLINKERX86_H_
-#ifndef CLR_STANDALONE_BINDER
#include "stublink.h"
-#endif // !CLR_STANDALONE_BINDER
struct ArrayOpScript;
class MetaSig;
//----------------------------------------------------------------------
// StubLinker with extensions for generating X86 code.
//----------------------------------------------------------------------
-#ifndef CLR_STANDALONE_BINDER
class StubLinkerCPU : public StubLinker
{
public:
static void Init();
};
-#endif // !CLR_STANDALONE_BINDER
inline TADDR rel32Decode(/*PTR_INT32*/ TADDR pRel32)
{
*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,
RETURN pStubMD;
}
-#endif
// static
MethodDesc* ILStubCache::CreateNewMethodDesc(LoaderHeap* pCreationHeap, MethodTable* pMT, DWORD dwStubFlags,
#include "util.hpp"
#include "crst.h"
#include "ngenhash.h"
-#ifndef CLR_STANDALONE_BINDER
#include "stubgen.h"
-#endif
class ILStubHashBlobBase
{
void AddMethodDescChunkWithLockTaken(MethodDesc *pMD);
-#ifndef CLR_STANDALONE_BINDER
static MethodDesc* CreateAndLinkNewILStubMethodDesc(
LoaderAllocator* pAllocator,
MethodTable* pMT,
DWORD cbSig,
SigTypeContext *pTypeContext,
ILStubLinker* pStubLinker);
-#endif
+
MethodTable * GetStubMethodTable()
{
LIMITED_METHOD_CONTRACT;
PTR_MethodDesc pMD;
PTR_MethodDesc pStubMD;
-#ifdef BINDER
- friend class MdilModule;
-#endif
} StubMethodHashEntry_t;
friend class NativeImageDumper;
#endif
-#ifdef BINDER
- friend class MdilModule;
-#endif
-
PTR_MethodDesc data;
} InstMethodHashEntry_t;
#ifndef _METHOD_H
#define _METHOD_H
-#ifndef BINDER
-
#include "cor.h"
#include "util.hpp"
#include "clsload.hpp"
#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;
// 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
// 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
return (m_bFlags2 & enum_flag2_HasPrecode) != 0;
}
-#ifndef BINDER
inline Precode* GetPrecode()
{
LIMITED_METHOD_DAC_CONTRACT;
PREFIX_ASSUME(pPrecode != NULL);
return pPrecode;
}
-#endif // !BINDER
inline BOOL MayHavePrecode()
{
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();
void PrecomputeNameHash();
BOOL MightHaveName(ULONG nameHashValue);
-#ifndef BINDER
FORCEINLINE LPCUTF8 GetNameOnNonArrayClass()
{
WRAPPER_NO_CONTRACT;
}
return szName;
}
-#endif // !BINDER
COUNT_T GetStableHash();
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()
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();
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.
PREFIX_ASSUME(pModule != NULL);
return pModule->IsEditAndContinueEnabled();
}
-#endif // !BINDER
inline BOOL IsNotInline()
{
BOOL MayBeRemotingIntercepted();
-#ifndef BINDER
//================================================================
// Does it represent a one way method call with no out/return parameters?
#ifdef FEATURE_REMOTING
}
#endif // FEATURE_REMOTING
-#endif
//================================================================
// FCalls.
MethodDesc *GetWrappedMethodDesc();
MethodDesc *GetExistingWrappedMethodDesc();
-#ifndef BINDER
-
//==================================================================
// Access the underlying metadata
}
COR_ILMETHOD* GetILHeader(BOOL fAllowOverrides = FALSE);
-#endif // !BINDER
BOOL HasStoredSig()
{
void GetSig(PCCOR_SIGNATURE *ppSig, DWORD *pcSig);
SigParser GetSigParser();
-#ifndef BINDER
-
// Convenience methods for common signature wrapper types.
SigPointer GetSigPointer();
return pModule->GetRWImporter();
}
#endif // !DACCESS_COMPILE
-#endif // !BINDER
#ifdef FEATURE_COMINTEROP
WORD GetComSlot();
// class.
inline MethodTable* GetCanonicalMethodTable();
-#ifdef BINDER
- MdilModule *GetModule();
-#else
Module *GetModule() const;
Module *GetModule_NoLogging() const;
PREFIX_ASSUME(pModule != NULL);
return pModule->GetAssembly();
}
-#endif // !BINDER
//==================================================================
// The slot number of this method in the corresponding method table.
{
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())
m_wFlags |= mdcRequiresFullSlotNumber;
}
-#ifdef CLR_STANDALONE_BINDER
- inline void ClearRequiresFullSlotNumber()
- {
-
- LIMITED_METHOD_CONTRACT;
- m_wFlags &= ~mdcRequiresFullSlotNumber;
- }
-#endif
-
inline DWORD RequiresFullSlotNumber()
{
LIMITED_METHOD_DAC_CONTRACT;
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;
LIMITED_METHOD_CONTRACT;
return m_wFlags & mdcParentRequiresInheritanceCheck;
}
-#endif
void SetRequiresLinktimeCheck()
{
m_wFlags |= mdcRequiresLinktimeCheck;
}
-#ifndef BINDER
void SetRequiresInheritanceCheck()
{
LIMITED_METHOD_CONTRACT;
LIMITED_METHOD_CONTRACT;
m_wFlags |= mdcParentRequiresInheritanceCheck;
}
-#endif
mdMethodDef GetMemberDef() const;
mdMethodDef GetMemberDef_NoLogging() const;
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
#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);
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);
}
{
friend class MethodDesc;
friend class CheckAsmOffsets;
-#ifdef BINDER
- friend class MdilModule;
-#endif
#if defined(FEATURE_PREJIT) && !defined(DACCESS_COMPILE)
friend class MethodDesc::SaveChunk;
#endif
}
#endif // !DACCESS_COMPILE
-#ifndef BINDER
#ifdef FEATURE_PREJIT
#ifndef DACCESS_COMPILE
inline void RestoreMTPointer(ClassLoadLevel level = CLASS_LOADED)
}
#endif // !DACCESS_COMPILE
#endif // FEATURE_PREJIT
-#endif // !BINDER
#ifndef DACCESS_COMPILE
void SetNextChunk(MethodDescChunk *chunk)
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
}
#ifdef DACCESS_COMPILE
friend class NativeImageDumper;
#endif
-#ifdef MDIL
- friend class CompactTypeBuilder;
- friend class MdilModule;
-#endif
protected:
PTR_CUTF8 m_pszMethodName;
// 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();
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
#ifndef FEATURE_CORECLR
-#ifndef BINDER
BOOL HasSuppressUnmanagedCodeAccessAttr()
{
LIMITED_METHOD_CONTRACT;
NULL,
NULL) == S_OK);
}
-#endif // !BINDER
void SetSuppressUnmanagedCodeAccessAttr(BOOL value)
{
friend class NativeImageDumper;
#endif
-#ifdef BINDER
- friend class CompactTypeBuilder;
- friend class MdilModule;
-#endif
public:
// All varities of InstantiatedMethodDesc's support this method.
// 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()
{
return NULL;
}
-#ifdef BINDER
- void IMD_SetDictionaryLayout(DictionaryLayout *dictionaryLayout)
- {
-
- LIMITED_METHOD_CONTRACT;
-
- m_pDictLayout = dictionaryLayout;
- }
-#endif
-
MethodDesc* IMD_GetWrappedMethodDesc()
{
LIMITED_METHOD_CONTRACT;
return GetMethodTable_NoLogging();
}
-#ifndef BINDER
inline DPTR(RelativeFixupPointer<PTR_MethodTable>) MethodDesc::GetMethodTablePtr() const
{
LIMITED_METHOD_DAC_CONTRACT;
return GetMethodTable()->GetCanonicalMethodTable();
}
-#endif // !BINDER
inline mdMethodDef MethodDesc::GetMemberDef_NoLogging() const
{
#ifdef _DEBUG
-#ifndef BINDER
inline BOOL MethodDesc::SanityCheck()
{
CONTRACTL
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()
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
return dac_cast<PTR_InstantiatedMethodDesc>(this);
}
-#ifndef BINDER
inline BOOL MethodDesc::IsDomainNeutral()
{
WRAPPER_NO_CONTRACT;
return !IsLCGMethod() && GetDomain()->IsSharedDomain();
}
-#endif // !BINDER
inline BOOL MethodDesc::IsZapped()
{
return SigParser(pSig, cSig);
}
-#ifndef BINDER
inline SigPointer MethodDesc::GetSigPointer()
{
WRAPPER_NO_CONTRACT;
return SigPointer(pSig, cSig);
}
-#endif // !BINDER
inline PTR_LCGMethodResolver DynamicMethodDesc::GetLCGMethodResolver()
{
}
#endif // FEATURE_TYPEEQUIVALENCE
-#ifndef BINDER
inline ReJitManager * MethodDesc::GetReJitManager()
{
LIMITED_METHOD_CONTRACT;
return GetModule()->GetReJitManager();
}
-#endif // !BINDER
#endif // _METHOD_INL_
#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;
// 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
}
//==========================================================================================
/*
* Include Files
*/
-#ifndef BINDER
#include "vars.hpp"
#include "cor.h"
#include "hash.h"
#include "contractimpl.h"
#include "generics.h"
#include "fixuppointer.h"
-#else
-#include "classloadlevel.h"
-#endif // !BINDER
/*
* Forward Declarations
// 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;
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
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;
}
void SetSlot(UINT32 slotNum, PCODE slotVal);
-#endif
//-------------------------------------------------------------------
// The VTABLE
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
// Used for generics and reflection emit in memory
DWORD GetModuleDynamicEntryID();
-#ifndef BINDER
Module* GetModuleForStatics();
-#else // BINDER
- MdilModule* GetModuleForStatics();
-#endif
+
//-------------------------------------------------------------------
// GENERICS DICT INFO
//
// Number of generic arguments, whether this is a method table for
// a generic type instantiation, e.g. List<string> or the "generic" MethodTable
// e.g. for List.
-#ifdef BINDER
- DWORD GetNumGenericArgs();
-#else
inline DWORD GetNumGenericArgs()
{
LIMITED_METHOD_DAC_CONTRACT;
else
return 0;
}
-#endif
inline DWORD GetNumDicts()
{
_ASSERTE(g_pObjectClass);
return (this == g_pObjectClass);
}
-#ifndef BINDER
+
// Is this System.ValueType?
inline DWORD IsValueTypeClass()
{
_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();
return dac_cast<DPTR(RelativeFixupPointer<PTR_Module>)>(GetMultipurposeSlotPtr(enum_flag_HasModuleOverride, c_ModuleOverrideOffsets));
}
-#ifdef BINDER
- void SetModule(PTR_Module pModule);
-#else
void SetModule(Module * pModule);
-#endif
/************************************
//
}
}
-#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.
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 &&
static const UINT16 INVALID_SLOT_INDEX = static_cast<UINT16>(-1);
static const UINT16 MAX_SLOT_INDEX = static_cast<UINT16>(-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
DWORD dwR8Fields,
DWORD dwTotalFields);
-#endif // !BINDER
-
MethodTable * AllocateNewMT(Module *pLoaderModule,
DWORD dwVtableSlots,
DWORD dwVirtuals,
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,
}; // class MethodTableBuilder
-#ifndef BINDER
#include "methodtablebuilder.inl"
-#endif // !BINDER
#endif // !METHODTABLEBUILDER_H
// Nidump knows how to walk this data structure.
friend class NativeImageDumper;
#endif
-#ifdef BINDER
- template<class HashEntry, class HashTableType> friend class NGenHashTableBuilder;
- friend class MdilModule;
-#endif
protected:
// This opaque structure provides enumeration context when walking the set of entries which share a common
#ifdef DACCESS_COMPILE
friend class NativeImageDumper;
#endif
-#ifdef BINDER
- template<class HashEntry, class HashTableType> 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
return GetHeader()->GetSyncBlockIndex();
}
-#ifndef BINDER
ADIndex GetAppDomainIndex();
// Get app domain of object, or NULL if it is agile
// 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
{
WRAPPER_NO_CONTRACT;
-#ifndef BINDER
DEBUG_SetAppDomain(::GetAppDomain());
-#endif
}
#endif //!DACCESS_COMPILE
#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
}
};
-#endif // BINDER
// This is the Method version of the Reflection object.
// A Method has adddition information.
#endif
-#ifndef CLR_STANDALONE_BINDER
#ifdef FEATURE_COMINTEROP
//-------------------------------------------------------------
#endif
#endif // FEATURE_COMINTEROP
-#endif // CLR_STANDALONE_BINDER
class StringBufferObject;
#ifdef USE_CHECKED_OBJECTREFS
return GetHeader()->m_thread;
}
-#ifndef BINDER
void SetObjectThread()
{
WRAPPER_NO_CONTRACT;
GetHeader()->m_thread = GetThread();
}
-#endif //!BINDER
StackTraceElement const * GetData() const
{
#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;
#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;
SUPPORTS_DAC;
return m_NumComponents;
}
-#endif //!BINDER
inline /* static */ unsigned ArrayBase::GetDataPtrOffset(MethodTable* pMT)
{
dac_cast<PTR_ArrayClass>(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
return TypeHandle(pMT);
}
-#endif //!BINDER
-
#endif // _OBJECT_INL_
}
#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
void AddRef();
ULONG Release();
const SString& GetPath();
-#ifdef MDIL
- BOOL GetILSizeFromMDILCLRCtlData(DWORD* pdwActualILSize);
-#endif // MDIL
#ifdef FEATURE_PREJIT
void ApplyBaseRelocations();
#ifndef _SimpleRWLock_hpp_
#define _SimpleRWLock_hpp_
-#ifndef BINDER
#include "threads.h"
-#endif
class SimpleRWLock;
} 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
// 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()
{
DECTHREADLOCKCOUNT();
EE_LOCK_RELEASED(this);
}
-#endif // !BINDER
#endif // DACCESS_COMPILE
//
//
-// 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
// 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;
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;
}
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;
}
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;
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;
// 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; // <TODO> this is an empty type context: is this right? Should we be explicitly excluding all generic types from this iteration? </TODO>
MetaSig fsig(pMemberSignature, cMemberSignature, pModule, &typeContext, MetaSig::sigField);
CorElementType ElementType = fsig.NextArg();
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;
// 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);
#endif
};
-#ifndef BINDER
VOID UnregisterUnwindInfoInLoaderHeap (UnlockedLoaderHeap *pHeap);
-#endif //!BINDER
#endif // STUBLINKER_GENERATES_UNWIND_INFO
{
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();
#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)
{
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
}
};
friend class LockHolder;
-#endif
#if CHECK_APP_DOMAIN_LEAKS
void CheckForUnloadedInstances(ADIndex unloadingIndex);
// 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
}
}
}
-#endif // !BINDER
// Used only during shutdown
void ResetIndex()
// 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();
#ifndef __threadstatics_h__
#define __threadstatics_h__
-#ifndef BINDER
#include "vars.hpp"
#include "util.hpp"
#include "field.h"
#include "methodtable.h"
#include "threads.h"
-#endif
// Defines ObjectHandeList type
#include "specialstatics.h"
SIZE_T m_padding;
#endif
BYTE m_pDataBlob[0];
-#ifndef BINDER
+
inline PTR_BYTE GetGCStaticsBasePointer()
{
CONTRACTL
return dac_cast<PTR_BYTE>((PTR_OBJECTREF)((PTRARRAYREF)ObjectFromHandle(m_pGCStatics))->GetDataPtr());
}
-#endif
inline PTR_BYTE GetGCStaticsBaseHandle()
{
LIMITED_METHOD_CONTRACT;
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
return (PTR_OBJECTREF)((PTRARRAYREF)ObjectFromHandle(m_pGCStatics))->GetDataPtr();
}
-#endif
inline OBJECTHANDLE GetPrecomputedGCStaticsBaseHandle()
{
return &m_pGCStatics;
}
-#ifndef BINDER
// Returns bytes so we can add offsets
inline PTR_BYTE GetGCStaticsBasePointer(MethodTable * pMT)
{
return dac_cast<PTR_BYTE>(GetPrecomputedGCStaticsBasePointer());
}
}
-#endif
inline PTR_BYTE GetNonGCStaticsBasePointer(MethodTable * pMT)
{
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)
return pEntry->GetGCStaticsBasePointer();
}
-#endif
inline PTR_BYTE GetDynamicEntryNonGCStaticsBasePointer(DWORD n)
{
return pEntry->GetNonGCStaticsBasePointer();
}
-#ifndef BINDER
+
FORCEINLINE PTR_DynamicClassInfo GetDynamicClassInfoIfInitialized(DWORD n)
{
WRAPPER_NO_CONTRACT;
#ifdef DACCESS_COMPILE
void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
#endif
-#endif
+
static DWORD OffsetOfDataBlob()
{
LIMITED_METHOD_CONTRACT;
// Non GC Statics
public:
-#ifndef BINDER
inline PTR_BYTE GetPrecomputedStaticsClassData()
{
LIMITED_METHOD_CONTRACT
}
#endif
-#endif
}; // struct ThreadLocalModule
-#ifndef BINDER
-
typedef DPTR(struct TLMTableEntry) PTR_TLMTableEntry;
struct TLMTableEntry
#endif
};
-#endif
#endif
PTR_BaseDomain GetDomain();
BOOL IsDomainNeutral();
-#ifndef BINDER
PTR_LoaderAllocator GetLoaderAllocator()
{
SUPPORTS_DAC;
}
protected:
-#endif // !BINDER
// See methodtable.h for details of the flags with the same name there
enum
{
#ifdef DACCESS_COMPILE
friend class NativeImageDumper;
#endif
-#ifdef BINDER
- friend class MdilModule;
-#endif
public:
#ifndef DACCESS_COMPILE
INDEBUGIMPL(BOOL Verify();)
OBJECTREF GetManagedClassObject();
-#ifndef BINDER
+
OBJECTREF GetManagedClassObjectIfExists()
{
CONTRACTL
LoaderAllocator::GetHandleValueFast(m_hExposedClassObject, &objRet);
return objRet;
}
-#endif
TypeHandle GetModifiedType()
{
{
STATIC_CONTRACT_SO_TOLERANT;
WRAPPER_NO_CONTRACT;
-#ifndef BINDER
INDEBUG(Verify());
-#endif
}
//private: TypeHandle m_Arg; // The type that is being modified
return GetTypeParam();
}
-#ifndef CLR_STANDALONE_BINDER
unsigned GetRank() {
WRAPPER_NO_CONTRACT;
SUPPORTS_DAC;
else
return dac_cast<PTR_ArrayClass>(GetMethodTable()->GetClass())->GetRank();
}
-#else
- unsigned GetRank();
-#endif
MethodTable* GetParent()
{
-#ifndef BINDER
WRAPPER_NO_CONTRACT;
_ASSERTE(!m_TemplateMT.IsNull());
_ASSERTE(m_TemplateMT.GetValue()->ParentEquals(g_pArrayClass));
return g_pArrayClass;
-#else
- _ASSERTE(0);
-#endif
}
#ifdef FEATURE_COMINTEROP
#ifdef DACCESS_COMPILE
friend class NativeImageDumper;
#endif
-#ifdef BINDER
- friend class MdilModule;
-#endif
public:
#ifndef DACCESS_COMPILE
}
OBJECTREF GetManagedClassObject();
-#ifndef BINDER
OBJECTREF GetManagedClassObjectIfExists()
{
CONTRACTL
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();
// 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;
// Prevent the use of UtilMessageBox and WszMessageBox from inside the EE.
-#ifndef CLR_STANDALONE_BINDER
#undef UtilMessageBoxCatastrophic
#undef UtilMessageBoxCatastrophicNonLocalized
#undef UtilMessageBoxCatastrophic
#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.
#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()
return (GetCantStopCount() > 0);
}
#endif // _DEBUG
-#endif // !CLR_STANDALONE_BINDER
// PAL does not support per-thread locales. The holder is no-op for FEATURE_PALs
#define _WCHAR_T_DEFINED
#endif
-#ifndef CLR_STANDALONE_BINDER
#include "util.hpp"
#include <corpriv.h>
#include <cordbpriv.h>
#include "certificatecache.h"
#endif
-#endif //CLR_STANDALONE_BINDER
-
#include "profilepriv.h"
class ClassLoader;
class Module;
class ArrayTypeDesc;
-#ifndef BINDER
-
#define EXTERN extern
// For [<I1, etc. up to and including [Object
// We use this object to return a preallocated System.Exception instance when we have nothing
// better to return.
EXTERN OBJECTHANDLE g_pPreallocatedBaseException;
-#endif // !BINDER
GPTR_DECL(Thread,g_pFinalizerThread);
GPTR_DECL(Thread,g_pSuspensionThread);
typedef DPTR(SyncTableEntry) PTR_SyncTableEntry;
GPTR_DECL(SyncTableEntry, g_pSyncTable);
-#if !defined(BINDER)
-
#ifdef FEATURE_COMINTEROP
// Global RCW cleanup list
typedef DPTR(RCWCleanupList) PTR_RCWCleanupList;
GVAL_DECL(SIZE_T, g_runtimeVirtualSize);
#endif // !FEATURE_PAL
-#endif /* !BINDER */
#ifndef MAXULONG
#define MAXULONG 0xffffffff
typedef DPTR(GSCookie) PTR_GSCookie;
-#ifndef CLR_STANDALONE_BINDER
#ifndef DACCESS_COMPILE
// const is so that it gets placed in the .text section (which is read-only)
// volatile is so that accesses to it do not get optimized away because of the const
};
#endif /* _VARS_HPP */
-#endif /* !CLR_STANDALONE_BINDER */
class WinRTInterfaceRedirector
{
public:
-#ifndef CLR_STANDALONE_BINDER
// Returns a MethodDesc to be used as an interop stub for the given redirected interface/slot/direction.
static MethodDesc *GetStubMethodForRedirectedInterface(
WinMDAdapter::RedirectedTypeIndex interfaceIndex, // redirected interface index
}
return BaseType_None;
}
-#endif // !CLR_STANDALONE_BINDER
// Returns the redirection index if the MethodTable* is a redirected interface.
static inline bool ResolveRedirectedInterface(MethodTable *pMT, WinMDAdapter::RedirectedTypeIndex * pIndex);
-#ifndef CLR_STANDALONE_BINDER
-
#ifdef _DEBUG
static void VerifyRedirectedInterfaceStubs();
#endif // _DEBUG
const static NonMscorlibRedirectedInterfaceInfo s_rNonMscorlibInterfaceInfos[3];
const static int NON_MSCORLIB_MARKER = 0x80000000;
-#endif // !CLR_STANDALONE_BINDER
};
#ifdef FEATURE_PREJIT
#include "zapsig.h"
#include "typedesc.h"
-#ifndef BINDER
#include "compile.h"
-#else
-#include "mdilmodule.h"
-#endif
#include "sigbuilder.h"
#ifndef DACCESS_COMPILE
case ELEMENT_TYPE_VAR_ZAPSIG:
{
TypeVarTypeDesc * pTypeVarDesc = dac_cast<PTR_TypeVarTypeDesc>(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);
// 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())
{
token = pTypeHandleModule->LookupTypeRefByMethodTable(pMT);
}
#endif
-#endif
if (pTypeHandleModule != this->context.pInfoModule)
{
// During IBC profiling this calls
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
// 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)
{
//
// 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();
#endif // DACCESS_COMPILE
-#endif // !BINDER
-
#endif // FEATURE_PREJIT
#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,
//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
{
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.
Module * GetZapSigModule() const { return (Module*) pModuleContext; }
Context(
-#ifdef BINDER
- MdilModule* _pInfoModule,
-#else
Module* _pInfoModule,
-#endif
void* _pModuleContext, ExternalTokens _externalTokens)
: pInfoModule(_pInfoModule),
pModuleContext(_pModuleContext),
{ LIMITED_METHOD_CONTRACT; _ASSERTE(externalTokens != IllegalValue); }
Context(
-#ifdef BINDER
- MdilModule* _pInfoModule,
-#else
Module* _pInfoModule,
-#endif
Module* _pZapSigModule)
: pInfoModule(_pInfoModule),
pModuleContext((void*) _pZapSigModule),
public:
ZapSig(
-#ifdef BINDER
- MdilModule * _pInfoModule,
-#else
Module * _pInfoModule,
-#endif
void * _pModuleContext,
ExternalTokens _externalTokens,
EncodeModuleCallback _pfnEncodeModule,
// 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);
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);
}
}
}
#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);
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);
}
}
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
pZapWriter->WritePad(dwPad);
ULONG personalityRoutine = GetPersonalityRoutine(pImage)->GetRVA();
-#ifdef BINDER
- _ASSERTE((personalityRoutine & THUMB_CODE) == 0);
- personalityRoutine |= THUMB_CODE;
-#endif
pZapWriter->Write(&personalityRoutine, sizeof(personalityRoutine));
}
pZapWriter->Write(&entry, sizeof(entry));
}
-#ifdef MDIL
-const MdilDebugInfoTable::DebugInfo *MdilDebugInfoTable::GetDebugInfo(COUNT_T offset, COUNT_T cbBlob, const SArray<BYTE> *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
//
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
return m_methodIndex;
}
-#ifdef MDIL
- mdMethodDef GetToken()
- {
- return m_token;
- }
-#endif
-
ZapBlobWithRelocs * GetCode()
{
return m_pCode;
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
{
}
-#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);
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)
}
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
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;
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<BYTE> *m_pBuf;
-
- public:
- DebugInfo(COUNT_T offset, COUNT_T cbSize, const SArray<BYTE> *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<BYTE> *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<BYTE> *pBuf);
-
-private:
- class SHashTraits : public DefaultSHashTraits<DebugInfo*>
- {
- 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
}
virtual void Save(ZapWriter * pZapWriter);
-
-#if defined(TARGET_THUMB2) && defined(BINDER)
- virtual BOOL IsThumb2Code()
- {
- return TRUE;
- }
-#endif
-
};
class ZapLazyHelperThunk : public ZapNode
}
virtual void Save(ZapWriter * pZapWriter);
-
-#if defined(TARGET_THUMB2) && defined(BINDER)
- virtual BOOL IsThumb2Code()
- {
- return TRUE;
- }
-#endif
};
#endif // __ZAPCODE_H__
//
// Needed for RT_VERSION.
-//#ifndef BINDER
#define MAKEINTRESOURCE(v) MAKEINTRESOURCEW(v)
-//#endif
void ZapVersionResource::Save(ZapWriter * pZapWriter)
{
#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)) )
if (m_pDebugInfoTable != NULL)
m_pDebugInfoTable->~ZapDebugInfoTable();
-#ifdef MDIL
- if (m_pMdilDebugInfoTable != NULL)
- m_pMdilDebugInfoTable->~MdilDebugInfoTable();
-#endif
-
if (m_pVirtualSectionsTable != NULL)
m_pVirtualSectionsTable->~ZapVirtualSectionsTable();
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
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);
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
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);
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);
if (!IsReadyToRunCompilation())
{
m_pPreloader->FixupRVAs();
-
-#ifdef CLR_STANDALONE_BINDER
- m_pDataImage->FixupRVAs();
-#endif
}
HANDLE hFile = GenerateFile(wszOutputFileName, pNativeImageSig);
SIZE_T baseAddress = 0;
-#ifndef BINDER // TritonTBD
{
// Read the actual preferred base address from the disk
}
#endif
#endif
-#endif // TritonTBD
// Apply the calculated base address.
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<BYTE*>(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)
{
//
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,
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.
(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);
}
}
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)
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<IMAGE_SECTION_HEADER> 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<BYTE> 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);
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);
}
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;
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;
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;
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())
}
EX_CATCH
{
-#ifndef BINDER
// Continue unwinding if fatal error was hit.
if (FAILED(g_hrFatalError))
ThrowHR(g_hrFatalError);
HRESULT hrException = ex->GetHR();
StackSString message;
- if (hrException != COR_E_UNSUPPORTEDMDIL)
- ex->GetMessage(message);
+ ex->GetMessage(message);
CorZapLogLevel level;
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;
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;
}
// 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;
return this;
}
-#ifndef BINDER
void ZapImage::FileNotFoundError(LPCWSTR pszMessage)
{
SString message(pszMessage);
fileNotFoundErrorsTable.Append(message);
}
-#endif
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
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;
}
#ifndef __ZAPIMAGE_H__
#define __ZAPIMAGE_H__
-
-#ifdef CLR_STANDALONE_BINDER
-#include "nativedata.h"
-#endif
-
class ZapMetaData;
class ZapILMetaData;
class ZapCorHeader;
#include "zapinfo.h"
#include "zapcode.h"
-#ifdef MDIL
-class ICompactLayoutWriter;
-#endif
-
class ZapImage
: public ZapWriter
, public ICorCompileDataStore
ZapVirtualSection * m_pColdUnwindDataSection;
#endif // defined(WIN64EXCEPTIONS)
-#ifdef MDIL
- ZapVirtualSection * m_pMDILSection;
-#endif
// Preloader sections
ZapVirtualSection * m_pPreloadSections[CORCOMPILE_SECTION_COUNT];
private:
IMetaDataAssemblyEmit *m_pAssemblyEmit; // native image manifest
ZapMetaData * m_pAssemblyMetaData;
-#ifdef CLR_STANDALONE_BINDER
- SArray<NativeManifestData> 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;
ZapVirtualSectionsTable * m_pVirtualSectionsTable;
ZapDebugInfoTable * m_pDebugInfoTable;
-#ifdef MDIL
- MdilDebugInfoTable * m_pMdilDebugInfoTable;
-#endif
ZapILMetaData * m_pILMetaData;
ProfileDataHashTable profileDataHashTable;
-#ifndef BINDER
SArray<SString, FALSE> fileNotFoundErrorsTable;
void FileNotFoundError(LPCWSTR pszMessage);
-#endif // BINDER
public:
struct ProfileDataSection
__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<BYTE> 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<ULONG> 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<ZapInfo::MDILGenericMethodDesc *> m_mapGenericMethodToDesc; // maps a method rid to a list of instances
-
- SArray<BYTE> 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<ModuleZapImage> m_mdilImages;
-
- int CheckForUnmerged(ZapInfo::MDILGenericMethodDesc tab[], int last, ZapInfo::FlavorSet flavorsToMatch, __in_z WCHAR *message);
-
- ICompactLayoutWriter *m_pICLW;
-
- SArray<BYTE> m_stubBuffer; // the buffer holding all IL stub descriptions
- SArray<BYTE> m_stubAssocBuffer; // the buffer with method -> IL stub associations
-
- SArray<BYTE> 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<ULONG> 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<ExtModRef> m_extModRef;
-
- SArray<char> 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<ExtTypeRef> 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<ExtTypeRefExtend> 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<ExtMemberRef> m_extMemberRef;
-
-#ifndef BINDER
- struct ExtMemberRefExtend
- {
- ULONG name; // offset of name in name pool
- ULONG signature; // offset of signature.
- };
-
- SArray<ExtMemberRefExtend> m_extMemberRefExtend;
-#endif // !BINDER
-
- SArray<ULONG> m_typeSpecToOffs;
- SArray<ULONG> m_methodSpecToOffs;
- SArray<ULONG> m_signatureToOffs;
- SArray<BYTE> 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<ULONG> 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<BYTE> m_userStringPool; // this is the user string pool exactly like it is in meta data
- SArray<DWORD> m_wellKnownTypesTable; // this is an array of type def tokens for the well known types
-#endif
-
public:
ZapImage(Zapper *zapper);
virtual ~ZapImage();
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
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
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();
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
ZapNode * ZapImportTable::GetIndirectHelperThunk(ReadyToRunHelper helperNum, PVOID pArg)
{
ZapNode * pImport = GetImport<ZapIndirectHelperThunk, ZapNodeType_IndirectHelperThunk>((void *)helperNum, pArg);
-#if defined(_TARGET_ARM_) && !defined(BINDER)
+#if defined(_TARGET_ARM_)
pImport = m_pImage->GetInnerPtr(pImport, THUMB_CODE);
#endif
return pImport;
}
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;
void ZapInfo::CompileMethod()
{
-#ifdef BINDER
- _ASSERTE(!"intentionally unreachable");
-#else
PRECONDITION(m_zapper->m_pJitCompiler != NULL);
InitMethodName();
#endif
PublishCompiledMethod();
-#endif // BINDER
}
-#ifndef BINDER
#ifndef FEATURE_FULL_NGEN
class MethodCodeComparer
{
return hash;
}
#endif
-#endif
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();
#endif // WIN64EXCEPTIONS
-#ifndef BINDER
#ifndef FEATURE_FULL_NGEN
//
// Method code deduplication
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.
// Stubs that have no metadata token cannot be tracked by IBC data.
ThrowHR(COR_E_INVALIDPROGRAM);
#else
-#if defined(_DEBUG) && !defined(BINDER)
+#if defined(_DEBUG)
return(_DbgBreakCheck(szFile, iLine, szExpr));
#else
return(true); // break into debugger
// 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);
{
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
// 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);
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();
void Resolve()
{
- if (
-#ifdef BINDER
- !IsPlaced() &&
-#endif
- m_pBase->IsPlaced())
+ if (m_pBase->IsPlaced())
{
SetRVA(m_pBase->GetRVA() + GetOffset());
}
{
return ZapNodeType_InnerPtr;
}
-
-#if defined(TARGET_THUMB2) && defined(BINDER)
- virtual BOOL IsThumb2Code()
- {
- return m_pBase->IsThumb2Code();
- }
-#endif
-
};
class ZapInnerPtrTable
//
// 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;
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
}
//-----------------------------------------------------------------------------
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);
}
ZapMetaData::Save(pZapWriter);
-#endif // CLR_STANDALONGE_BINDER
}
ZapRVADataNode * ZapILMetaData::GetRVAField(void * pData)
SArray<ZapBlob *> 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
// 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);
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
//
(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);
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
#ifndef __ZAPMETADATA_H__
#define __ZAPMETADATA_H__
-#ifdef CLR_STANDALONE_BINDER
-#include "nativedata.h"
-#endif
-
//-----------------------------------------------------------------------------
//
// ZapMetaData is the barebone ZapNode to save metadata scope
IMetaDataEmit * m_pEmit;
public:
-#ifdef CLR_STANDALONE_BINDER
- ZapMetaData();
-#else
ZapMetaData()
{
}
-#endif
~ZapMetaData()
{
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()
}
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<BYTE> m_metadataHeap;
- SArray<BYTE> m_stringHeap;
- SArray<BYTE> m_guidHeap;
- SArray<BYTE> m_blobHeap;
-#endif
};
//-----------------------------------------------------------------------------
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)
void CopyMetaData();
void CopyRVAFields();
-#ifdef CLR_STANDALONE_BINDER
- virtual DWORD GetSize();
-#endif
-
virtual void Save(ZapWriter * pZapWriter);
ZapRVADataNode * GetRVAField(void * pData);
};
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<mdToken, DWORD> m_fieldToRVAMapping;
-#endif
};
#endif // __ZAPMETADATA_H__
#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
#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
extern int g_ningenState;
#endif
-#endif
#ifdef FEATURE_READYTORUN_COMPILER
bool g_fReadyToRunCompilation;
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"),
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());
// 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)
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
}// NGenCompile
#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
-#endif // CLR_STANDALONE_BINDER
/* --------------------------------------------------------------------------- *
* Options class
}
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
#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,
// 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);
// 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
//
// 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));
}
#endif // ALLOW_LOCAL_WORKER
-#ifdef BINDER
- m_pEEJitInfo = dynamicInfo;
-#else
m_pEEJitInfo = GetZapJitInfo();
-#endif
-#ifndef BINDER
//
// Get JIT interface
//
LoadAndInitializeJITForNgen(altName, &m_hAltJITCompiler, &m_alternateJit);
}
#endif // ALLOW_SXS_JIT_NGEN
-#endif // BINDER
}
Zapper::~Zapper()
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.
// 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));
ZapperSetAppCompatWP8(m_pDomain);
}
#endif
-
-#endif // BINDER
}
void Zapper::CreateDependenciesLookupDomain()
}
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.
IfFailThrow(hr);
}
-#ifndef BINDER
#ifndef FEATURE_CORECLR
if (m_pOpt->m_fAutoNGen && !m_pEECompileInfo->SupportsAutoNGen(hAssembly))
{
ThrowHR(E_FAIL);
}
#endif // FEATURE_CORECLR
-#endif // BINDER
//
// Check if we have a native image already, and if so get its GUID
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)
}
#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();
//
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:
CompileNonManifestModules(hashAlgId, hFiles);
#endif // FEATURE_MULTIMODULE_ASSEMBLIES
-#ifdef MDIL
- if (m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- return;
-#endif
-
//
// Record the version info
//
NewHolder<ZapImage> pModule;
pModule = CompileModule(hModule, NULL);
-#ifdef MDIL
- if (!(m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL))
-#endif
{
SString strFileNameWithoutExt(strFileName);
SString::CIterator fileNameIterator = strFileNameWithoutExt.End();
}
}
-#ifdef MDIL
- if (!(m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL))
-#endif
{
NewArrayHolder<BYTE> pbHashValue;
DWORD cbHashValue;
module->Compile();
-#ifdef MDIL
- if (m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- return NULL;
- }
-#endif
-
if (IsReadyToRunCompilation())
{
return module.Extract();
}
#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;
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;
// 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);
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
#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),
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;
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
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
// 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__
{
return m_RVA != 0;
}
-#if defined(TARGET_THUMB2) && defined(BINDER)
- virtual BOOL IsThumb2Code()
- {
- return FALSE;
- }
-#else
- __forceinline BOOL IsThumb2Code() { return false;}
-#endif
};
//---------------------------------------------------------------------------------------