summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-09-07 15:22:40 -0700
committerGitHub <noreply@github.com>2018-09-07 15:22:40 -0700
commit41db7d9af54a0a7d9fc365849e7c0fc1dad3a4b9 (patch)
tree759aeca8c69087f63bc0cf70fd418ff4794dfbd2
parent8f6db6188d8ab4f05709a4e8c8de54b18f639ec7 (diff)
downloadcoreclr-41db7d9af54a0a7d9fc365849e7c0fc1dad3a4b9.tar.gz
coreclr-41db7d9af54a0a7d9fc365849e7c0fc1dad3a4b9.tar.bz2
coreclr-41db7d9af54a0a7d9fc365849e7c0fc1dad3a4b9.zip
Fixes towards making the runtime compiled without FEATURE_PREJIT defined (#19864)
-rw-r--r--src/debug/daccess/daccess.cpp4
-rw-r--r--src/debug/daccess/dacdbiimpl.cpp2
-rw-r--r--src/inc/corpriv.h66
-rw-r--r--src/inc/fixuppointer.h34
-rw-r--r--src/md/runtime/mdinternalro.h2
-rw-r--r--src/md/winmd/winmdimport.cpp2
-rw-r--r--src/vm/ceeload.h56
-rw-r--r--src/vm/ceeload.inl2
-rw-r--r--src/vm/codeman.h3
-rw-r--r--src/vm/domainfile.cpp3
-rw-r--r--src/vm/exceptionhandling.h6
-rw-r--r--src/vm/inlinetracking.h2
-rw-r--r--src/vm/interoputil.cpp2
-rw-r--r--src/vm/method.hpp1
-rw-r--r--src/vm/methodtablebuilder.cpp2
-rw-r--r--src/vm/pefile.cpp127
-rw-r--r--src/vm/pefile.h40
-rw-r--r--src/vm/peimage.inl4
-rw-r--r--src/vm/readytoruninfo.h4
-rw-r--r--src/vm/stubmgr.cpp2
-rw-r--r--src/vm/zapsig.h6
21 files changed, 152 insertions, 218 deletions
diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp
index e7bef87c0c..685f23f62e 100644
--- a/src/debug/daccess/daccess.cpp
+++ b/src/debug/daccess/daccess.cpp
@@ -5844,7 +5844,9 @@ ClrDataAccess::RawGetMethodName(
#endif
if (pStubManager == PrecodeStubManager::g_pManager)
{
+#ifdef FEATURE_PREJIT
PrecodeStub:
+#endif
PCODE alignedAddress = AlignDown(TO_TADDR(address), PRECODE_ALIGNMENT);
#ifdef _TARGET_ARM_
@@ -5892,7 +5894,9 @@ ClrDataAccess::RawGetMethodName(
else
if (pStubManager == JumpStubStubManager::g_pManager)
{
+#ifdef FEATURE_PREJIT
JumpStub:
+#endif
PCODE pTarget = decodeBackToBackJump(TO_TADDR(address));
HRESULT hr = GetRuntimeNameByAddress(pTarget, flags, bufLen, symbolLen, symbolBuf, NULL);
diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp
index 07fd438734..bed03ad6c9 100644
--- a/src/debug/daccess/dacdbiimpl.cpp
+++ b/src/debug/daccess/dacdbiimpl.cpp
@@ -4056,9 +4056,9 @@ BOOL DacDbiInterfaceImpl::GetModuleNGenPath(VMPTR_Module vmModule,
return TRUE;
}
}
+NoFileName:
#endif // FEATURE_PREJIT
-NoFileName:
// no ngen filename
IfFailThrow(pStrFilename->AssignCopy(W("")));
return FALSE;
diff --git a/src/inc/corpriv.h b/src/inc/corpriv.h
index 9641b05644..81143e6019 100644
--- a/src/inc/corpriv.h
+++ b/src/inc/corpriv.h
@@ -383,17 +383,6 @@ DECLARE_INTERFACE_(ICeeGenInternal, IUnknown)
STDMETHOD (SetInitialGrowth) (DWORD growth) PURE;
};
-// ===========================================================================
-#ifdef FEATURE_PREJIT
-// ===========================================================================
-
-
-// Use the default JIT compiler
-#define DEFAULT_NGEN_COMPILER_DLL_NAME W("clrjit.dll")
-
-
-struct CORCOMPILE_ASSEMBLY_SIGNATURE;
-
//
// IGetIMDInternalImport
//
@@ -403,7 +392,7 @@ struct CORCOMPILE_ASSEMBLY_SIGNATURE;
// RegMeta, WinMDImport - supports the internal GetMetaDataInternalInterfaceFromPublic() "api".
//
// {92B2FEF9-F7F5-420d-AD42-AECEEE10A1EF}
-EXTERN_GUID(IID_IGetIMDInternalImport, 0x92b2fef9, 0xf7f5, 0x420d, 0xad, 0x42, 0xae, 0xce, 0xee, 0x10, 0xa1, 0xef);
+EXTERN_GUID(IID_IGetIMDInternalImport, 0x92b2fef9, 0xf7f5, 0x420d, 0xad, 0x42, 0xae, 0xce, 0xee, 0x10, 0xa1, 0xef);
#undef INTERFACE
#define INTERFACE IGetIMDInternalImport
DECLARE_INTERFACE_(IGetIMDInternalImport, IUnknown)
@@ -413,7 +402,12 @@ DECLARE_INTERFACE_(IGetIMDInternalImport, IUnknown)
) PURE;
};
+// ===========================================================================
+#ifdef FEATURE_PREJIT
+// ===========================================================================
+// Use the default JIT compiler
+#define DEFAULT_NGEN_COMPILER_DLL_NAME W("clrjit.dll")
#ifndef DACCESS_COMPILE
@@ -484,54 +478,6 @@ STDAPI GetCORVersionInternal(
DWORD cchBuffer,
__out DWORD *pdwLength);
-
-#ifdef FEATURE_PREJIT
-
-//**********************************************************************
-// Access to native image validation logic in the runtime.
-//
-// An interface only a mother could live as this logic should really be encapsulated in
-// the native binder. But for historical reasons, it lives in the VM directory
-// and is shared by the desktop and coreclr's which have separate native binders.
-// Hence, this interface inherits a lot of "baggage."
-
-
-
-// A small shim around PEAssemblies/IBindResult that allow us to write Fusion/CLR-agnostic code
-// for logging native bind failures to the Fusion log/CLR log.
-//
-// These objects are stack-based and non-thread-safe. They are created for the duration of a single RuntimeVerify call.
-// The methods are expected to compute their data lazily as they are only used in bind failures or in checked builds.
-//
-// This class also exposes the IFusionBindLog pointer. This isn't really the appropriate place to expose that but
-// it serves to avoid compiling references to IFUsionBindLog into code that doesn't define FEATURE_FUSION.
-class LoggableAssembly
-{
- public:
- virtual SString DisplayString() = 0; // Returns an unspecified representation suitable for injecting into log messages.
-};
-
-
-// Validates that an NI matches the running CLR, OS, CPU, etc.
-BOOL RuntimeVerifyNativeImageVersion(const CORCOMPILE_VERSION_INFO *pVerInfo, LoggableAssembly *pLogAsm);
-
-// Validates that an NI matches the required flavor (debug, instrumented, etc.)
-BOOL RuntimeVerifyNativeImageFlavor(const CORCOMPILE_VERSION_INFO *pVerInfo, LoggableAssembly *pLogAsm);
-
-// Validates that a hard-dep matches the a parent NI's compile-time hard-dep.
-BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_NGEN_SIGNATURE &ngenSigExpected,
- const CORCOMPILE_VERSION_INFO *pActual,
- LoggableAssembly *pLogAsm);
-
-BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_DEPENDENCY *pExpected,
- const CORCOMPILE_VERSION_INFO *pActual,
- LoggableAssembly *pLogAsm);
-
-#endif // FEATURE_PREJIT
-
-
-
-
#endif // _CORPRIV_H_
// EOF =======================================================================
diff --git a/src/inc/fixuppointer.h b/src/inc/fixuppointer.h
index abed1f96a8..18886c0f54 100644
--- a/src/inc/fixuppointer.h
+++ b/src/inc/fixuppointer.h
@@ -588,16 +588,13 @@ public:
BOOL IsTagged(TADDR base) const
{
LIMITED_METHOD_DAC_CONTRACT;
- return IsTagged();
+ return FALSE;
}
// Returns whether the indirection cell contain fixup that has not been converted to real pointer yet.
BOOL IsTagged() const
{
LIMITED_METHOD_DAC_CONTRACT;
- TADDR addr = m_ptr;
- if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
- return (*PTR_TADDR(addr - FIXUP_POINTER_INDIRECTION) & 1) != 0;
return FALSE;
}
@@ -613,9 +610,6 @@ public:
PTR_TYPE * GetValuePtr() const
{
LIMITED_METHOD_CONTRACT;
- TADDR addr = m_ptr;
- if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
- return (PTR_TYPE *)(addr - FIXUP_POINTER_INDIRECTION);
return (PTR_TYPE *)&m_ptr;
}
#endif // !DACCESS_COMPILE
@@ -655,12 +649,27 @@ public:
return dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->GetValueMaybeNull(base);
}
+ // Returns value of the encoded pointer.
+ // Allows the value to be tagged.
+ FORCEINLINE TADDR GetValueMaybeTagged() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return m_ptr;
+ }
+
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ // Allows the value to be tagged.
+ FORCEINLINE TADDR GetValueMaybeTagged(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return m_ptr;
+ }
+
// Returns whether pointer is indirect. Assumes that the value is not NULL.
bool IsIndirectPtr(TADDR base) const
{
LIMITED_METHOD_DAC_CONTRACT;
-
- return (m_ptr & FIXUP_POINTER_INDIRECTION) != 0;
+ return FALSE;
}
#ifndef DACCESS_COMPILE
@@ -669,7 +678,7 @@ public:
bool IsIndirectPtr() const
{
LIMITED_METHOD_CONTRACT;
- return IsIndirectPtr((TADDR)this);
+ return FALSE;
}
#endif
@@ -677,8 +686,7 @@ public:
bool IsIndirectPtrMaybeNull(TADDR base) const
{
LIMITED_METHOD_DAC_CONTRACT;
-
- return IsIndirectPtr(base);
+ return FALSE;
}
#ifndef DACCESS_COMPILE
@@ -687,7 +695,7 @@ public:
bool IsIndirectPtrMaybeNull() const
{
LIMITED_METHOD_CONTRACT;
- return IsIndirectPtrMaybeNull((TADDR)this);
+ return FALSE;
}
#endif
diff --git a/src/md/runtime/mdinternalro.h b/src/md/runtime/mdinternalro.h
index 92e5393ffa..83f9d9ac8e 100644
--- a/src/md/runtime/mdinternalro.h
+++ b/src/md/runtime/mdinternalro.h
@@ -71,12 +71,14 @@ public:
STDMETHODIMP SetOptimizeAccessForSpeed(
BOOL fOptSpeed)
{
+#ifdef FEATURE_PREJIT
// The metadata cache of hot items is an optional working-set optimization
// that has a large speed cost relative to direct table lookup
if (fOptSpeed)
{ // We want to disable usage of hot data (e.g. in ngen compilation process)
m_LiteWeightStgdb.m_MiniMd.DisableHotDataUsage();
}
+#endif
return S_OK;
}
diff --git a/src/md/winmd/winmdimport.cpp b/src/md/winmd/winmdimport.cpp
index cc983d2bfc..9090ba49c4 100644
--- a/src/md/winmd/winmdimport.cpp
+++ b/src/md/winmd/winmdimport.cpp
@@ -185,10 +185,12 @@ class WinMDImport : public IMetaDataImport2
_ASSERTE(!"WinMDImport::QueryInterface(IID_IMDInternalEmit) returning E_NOINTERFACE");
else if (riid == IID_IMetaDataEmitHelper)
_ASSERTE(!"WinMDImport::QueryInterface(IID_IMetaDataEmitHelper) returning E_NOINTERFACE");
+#ifdef FEATURE_PREJIT
else if (riid == IID_IMetaDataCorProfileData)
_ASSERTE(!"WinMDImport::QueryInterface(IID_IMetaDataCorProfileData) returning E_NOINTERFACE");
else if (riid == IID_IMDInternalMetadataReorderingOptions)
_ASSERTE(!"WinMDImport::QueryInterface(IID_IMDInternalMetadataReorderingOptions) returning E_NOINTERFACE");
+#endif
else
_ASSERTE(!"WinMDImport::QueryInterface() returning E_NOINTERFACE");
}
diff --git a/src/vm/ceeload.h b/src/vm/ceeload.h
index d8a278e544..91da7b35ae 100644
--- a/src/vm/ceeload.h
+++ b/src/vm/ceeload.h
@@ -73,15 +73,14 @@ class Pending;
class MethodTable;
class AppDomain;
class DynamicMethodTable;
-struct CerPrepInfo;
+class CodeVersionManager;
+class CallCounter;
+class TieredCompilationManager;
#ifdef FEATURE_PREJIT
class CerNgenRootTable;
struct MethodContextElement;
class TypeHandleList;
class ProfileEmitter;
-class CodeVersionManager;
-class CallCounter;
-class TieredCompilationManager;
class TrackingMap;
struct MethodInModule;
class PersistentInlineTrackingMapNGen;
@@ -508,6 +507,7 @@ typedef DPTR(class MemberRef) PTR_MemberRef;
#define IS_FIELD_MEMBER_REF ((TADDR)0x00000002)
+#ifdef FEATURE_PREJIT
//
// NGen image layout information that we need to quickly access at runtime
//
@@ -557,6 +557,8 @@ struct NGenLayoutInfo
PCODE m_pExternalMethodFixupJumpStub;
DWORD m_rvaFilterPersonalityRoutine;
};
+#endif // FEATURE_PREJIT
+
//
// VASigCookies are allocated to encapsulate a varargs call signature.
@@ -1622,13 +1624,15 @@ public:
return (m_dwPersistedFlags & COLLECTIBLE_MODULE) != 0;
}
+#ifdef FEATURE_READYTORUN
+private:
+ PTR_ReadyToRunInfo m_pReadyToRunInfo;
+#endif
+
#ifdef FEATURE_PREJIT
private:
PTR_NGenLayoutInfo m_pNGenLayoutInfo;
-#ifdef FEATURE_READYTORUN
- PTR_ReadyToRunInfo m_pReadyToRunInfo;
-#endif
PTR_ProfilingBlobTable m_pProfilingBlobTable; // While performing IBC instrumenting this hashtable is populated with the External defs
CorProfileData * m_pProfileData; // While ngen-ing with IBC optimizations this contains a link to the IBC data for the assembly
@@ -2946,25 +2950,6 @@ public:
return m_pNGenLayoutInfo->m_VirtualMethodThunks.IsInRange(code);
}
- BOOL IsReadyToRun()
- {
- LIMITED_METHOD_DAC_CONTRACT;
-
-#ifdef FEATURE_READYTORUN
- return m_pReadyToRunInfo != NULL;
-#else
- return FALSE;
-#endif
- }
-
-#ifdef FEATURE_READYTORUN
- PTR_ReadyToRunInfo GetReadyToRunInfo()
- {
- LIMITED_METHOD_DAC_CONTRACT;
- return m_pReadyToRunInfo;
- }
-#endif
-
ICorJitInfo::ProfileBuffer * AllocateProfileBuffer(mdToken _token, DWORD _size, DWORD _ILSize);
HANDLE OpenMethodProfileDataLogFile(GUID mvid);
static void ProfileDataAllocateTokenLists(ProfileEmitter * pEmitter, TokenProfileData* pTokenProfileData);
@@ -3005,6 +2990,25 @@ public:
#endif // FEATURE_PREJIT
+ BOOL IsReadyToRun()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+#ifdef FEATURE_READYTORUN
+ return m_pReadyToRunInfo != NULL;
+#else
+ return FALSE;
+#endif
+ }
+
+#ifdef FEATURE_READYTORUN
+ PTR_ReadyToRunInfo GetReadyToRunInfo()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return m_pReadyToRunInfo;
+ }
+#endif
+
#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.
diff --git a/src/vm/ceeload.inl b/src/vm/ceeload.inl
index 3afef732cc..2c48265dde 100644
--- a/src/vm/ceeload.inl
+++ b/src/vm/ceeload.inl
@@ -269,10 +269,12 @@ void LookupMap<TYPE>::EnsureElementCanBeStored(Module * pModule, DWORD rid)
}
CONTRACTL_END;
+#ifdef FEATURE_PREJIT
// don't attempt to call GetElementPtr for rids inside the compressed portion of
// a multi-node map
if (MapIsCompressed() && rid < dwCount)
return;
+#endif
PTR_TADDR pElement = GetElementPtr(rid);
if (pElement == NULL)
GrowMap(pModule, rid);
diff --git a/src/vm/codeman.h b/src/vm/codeman.h
index e30b6332ac..ebf92e48be 100644
--- a/src/vm/codeman.h
+++ b/src/vm/codeman.h
@@ -68,6 +68,7 @@ Abstract:
#include "shash.h"
#include "pedecoder.h"
#include "gcinfo.h"
+#include "eexcp.h"
#if defined(WIN64EXCEPTIONS) && !defined(USE_INDIRECT_CODEHEADER)
#error "WIN64EXCEPTIONS requires USE_INDIRECT_CODEHEADER"
@@ -1742,7 +1743,9 @@ public:
class EECodeInfo
{
friend BOOL EEJitManager::JitCodeToMethodInfo(RangeSection * pRangeSection, PCODE currentPC, MethodDesc** ppMethodDesc, EECodeInfo * pCodeInfo);
+#ifdef FEATURE_PREJIT
friend BOOL NativeImageJitManager::JitCodeToMethodInfo(RangeSection * pRangeSection, PCODE currentPC, MethodDesc** ppMethodDesc, EECodeInfo * pCodeInfo);
+#endif
#ifdef FEATURE_READYTORUN
friend BOOL ReadyToRunJitManager::JitCodeToMethodInfo(RangeSection * pRangeSection, PCODE currentPC, MethodDesc** ppMethodDesc, EECodeInfo * pCodeInfo);
#endif
diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp
index 12d3f3c579..ded1e5715b 100644
--- a/src/vm/domainfile.cpp
+++ b/src/vm/domainfile.cpp
@@ -748,8 +748,7 @@ void DomainFile::VerifyNativeImageDependencies(bool verifyOnly)
CORCOMPILE_VERSION_INFO * pDependencyNativeVersion =
pDependencyNativeLayout->GetNativeVersionInfo();
- LoggablePEAssembly logAsm(pDependencyFile);
- if (!RuntimeVerifyNativeImageDependency(pDependency, pDependencyNativeVersion, &logAsm))
+ if (!RuntimeVerifyNativeImageDependency(pDependency, pDependencyNativeVersion, pDependencyFile))
goto NativeImageRejected;
}
LOG((LF_ZAP, LL_INFO100, "ZAP: Native image dependencies for %S OK.\n",
diff --git a/src/vm/exceptionhandling.h b/src/vm/exceptionhandling.h
index 27981e6c32..b678387ad4 100644
--- a/src/vm/exceptionhandling.h
+++ b/src/vm/exceptionhandling.h
@@ -10,17 +10,17 @@
#ifdef WIN64EXCEPTIONS
+#include "eexcp.h"
+#include "exstatecommon.h"
+
#if defined(_TARGET_ARM_) || defined(_TARGET_X86_)
#define USE_PER_FRAME_PINVOKE_INIT
#endif // _TARGET_ARM_ || _TARGET_X86_
-
// This address lies in the NULL pointer partition of the process memory.
// Accessing it will result in AV.
#define INVALID_RESUME_ADDRESS 0x000000000000bad0
-#include "exstatecommon.h"
-
EXTERN_C EXCEPTION_DISPOSITION
ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
WIN64_ARG(IN ULONG64 MemoryStackFp)
diff --git a/src/vm/inlinetracking.h b/src/vm/inlinetracking.h
index 2cfb35bd50..976a0e72db 100644
--- a/src/vm/inlinetracking.h
+++ b/src/vm/inlinetracking.h
@@ -37,6 +37,8 @@
class MethodDesc;
typedef DPTR(class MethodDesc) PTR_MethodDesc;
+class ZapHeap;
+
struct MethodInModule
{
Module *m_module;
diff --git a/src/vm/interoputil.cpp b/src/vm/interoputil.cpp
index 24afdf73fa..8bf5842acd 100644
--- a/src/vm/interoputil.cpp
+++ b/src/vm/interoputil.cpp
@@ -3907,6 +3907,7 @@ BOOL MethodNeedsForwardComStub(MethodDesc *pMD, DataImage *pImage)
return FALSE;
}
+#ifdef FEATURE_PREJIT
//---------------------------------------------------------------------------
// Determines if a method is visible from COM in a way that requires a marshaling
// stub, i.e. it allows early binding.
@@ -3992,6 +3993,7 @@ BOOL MethodNeedsReverseComStub(MethodDesc *pMD)
return IsMethodVisibleFromCom(pMD);
}
+#endif // FEATURE_PREJIT
#ifndef CROSSGEN_COMPILE
diff --git a/src/vm/method.hpp b/src/vm/method.hpp
index 7674f5e2f9..5ed6869222 100644
--- a/src/vm/method.hpp
+++ b/src/vm/method.hpp
@@ -45,6 +45,7 @@ class DynamicMethodDesc;
class ReJitManager;
class CodeVersionManager;
class PrepareCodeConfig;
+class CallCounter;
typedef DPTR(FCallMethodDesc) PTR_FCallMethodDesc;
typedef DPTR(ArrayMethodDesc) PTR_ArrayMethodDesc;
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index 5739831727..56397ca267 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -6516,6 +6516,7 @@ VOID MethodTableBuilder::PlaceInterfaceDeclarationOnClass(
pDecl->GetSlotIndex(),
pImpl);
+#ifdef FEATURE_PREJIT
if (IsCompilationProcess())
{
//
@@ -6527,6 +6528,7 @@ VOID MethodTableBuilder::PlaceInterfaceDeclarationOnClass(
pDeclMT->GetWriteableDataForWrite()->SetIsOverridingInterface();
}
}
+#endif
#ifdef _DEBUG
if (bmtInterface->dbg_fShouldInjectInterfaceDuplicates)
diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp
index d417545287..69dd4d067d 100644
--- a/src/vm/pefile.cpp
+++ b/src/vm/pefile.cpp
@@ -1034,7 +1034,7 @@ extern DWORD g_dwLogLevel;
//===========================================================================================================
// Encapsulates CLR and Fusion logging for runtime verification of native images.
//===========================================================================================================
-static void RuntimeVerifyVLog(DWORD level, LoggableAssembly *pLogAsm, const WCHAR *fmt, va_list args)
+static void RuntimeVerifyVLog(DWORD level, PEAssembly *pLogAsm, const WCHAR *fmt, va_list args)
{
STANDARD_VM_CONTRACT;
@@ -1046,7 +1046,7 @@ static void RuntimeVerifyVLog(DWORD level, LoggableAssembly *pLogAsm, const WCHA
if (fOutputToLogging)
{
- SString displayString = pLogAsm->DisplayString();
+ SString displayString = pLogAsm->GetPath();
LOG((LF_ZAP, level, "%s: \"%S\"\n", "ZAP", displayString.GetUnicode()));
LOG((LF_ZAP, level, "%S", message.GetUnicode()));
LOG((LF_ZAP, level, "\n"));
@@ -1054,7 +1054,7 @@ static void RuntimeVerifyVLog(DWORD level, LoggableAssembly *pLogAsm, const WCHA
if (fOutputToDebugger)
{
- SString displayString = pLogAsm->DisplayString();
+ SString displayString = pLogAsm->GetPath();
WszOutputDebugString(W("CLR:("));
WszOutputDebugString(displayString.GetUnicode());
WszOutputDebugString(W(") "));
@@ -1068,7 +1068,7 @@ static void RuntimeVerifyVLog(DWORD level, LoggableAssembly *pLogAsm, const WCHA
//===========================================================================================================
// Encapsulates CLR and Fusion logging for runtime verification of native images.
//===========================================================================================================
-static void RuntimeVerifyLog(DWORD level, LoggableAssembly *pLogAsm, const WCHAR *fmt, ...)
+static void RuntimeVerifyLog(DWORD level, PEAssembly *pLogAsm, const WCHAR *fmt, ...)
{
STANDARD_VM_CONTRACT;
@@ -1156,67 +1156,6 @@ extern HMODULE CorCompileGetRuntimeDll(CorCompileRuntimeDlls id)
#endif // CROSSGEN_COMPILE
//===========================================================================================================
-// Helper for RuntimeVerifyNativeImageVersion(). Compares the loaded clr.dll and clrjit.dll's against
-// the ones the native image was compiled against.
-//===========================================================================================================
-static BOOL RuntimeVerifyNativeImageTimestamps(const CORCOMPILE_VERSION_INFO *info, LoggableAssembly *pLogAsm)
-{
- STANDARD_VM_CONTRACT;
-
-
- return TRUE;
-}
-
-//===========================================================================================================
-// Validates that an NI matches the running CLR, OS, CPU, etc. This is the entrypoint used by the CLR loader.
-//
-//===========================================================================================================
-BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
-{
- STANDARD_VM_CONTRACT;
-
- //
- // Get the zap version header. Note that modules will not have version
- // headers - they add no additional versioning constraints from their
- // assemblies.
- //
- PEImageLayoutHolder image=peimage->GetLayout(PEImageLayout::LAYOUT_ANY,PEImage::LAYOUT_CREATEIFNEEDED);
-
- if (!image->HasNativeHeader())
- return FALSE;
-
- if (!image->CheckNativeHeaderVersion())
- {
- // Wrong native image version is fatal error on CoreCLR
- ThrowHR(COR_E_NI_AND_RUNTIME_VERSION_MISMATCH);
- }
-
- CORCOMPILE_VERSION_INFO *info = image->GetNativeVersionInfo();
- if (info == NULL)
- return FALSE;
-
- LoggablePEAssembly logAsm(this);
- if (!RuntimeVerifyNativeImageVersion(info, &logAsm))
- {
- // Wrong native image version is fatal error on CoreCLR
- ThrowHR(COR_E_NI_AND_RUNTIME_VERSION_MISMATCH);
- }
-
- CorCompileConfigFlags configFlags = PEFile::GetNativeImageConfigFlagsWithOverrides();
-
- // Otherwise, match regardless of the instrumentation flags
- configFlags = (CorCompileConfigFlags) (configFlags & ~(CORCOMPILE_CONFIG_INSTRUMENTATION_NONE | CORCOMPILE_CONFIG_INSTRUMENTATION));
-
- if ((info->wConfigFlags & configFlags) != configFlags)
- {
- return FALSE;
- }
-
- return TRUE;
-}
-
-
-//===========================================================================================================
// Validates that an NI matches the running CLR, OS, CPU, etc.
//
// For historial reasons, some versions of the runtime perform this check at native bind time (preferrred),
@@ -1225,13 +1164,10 @@ BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
// This is the common funnel for both versions and is agnostic to whether the "assembly" is represented
// by a CLR object or Fusion object.
//===========================================================================================================
-BOOL RuntimeVerifyNativeImageVersion(const CORCOMPILE_VERSION_INFO *info, LoggableAssembly *pLogAsm)
+BOOL RuntimeVerifyNativeImageVersion(const CORCOMPILE_VERSION_INFO *info, PEAssembly *pLogAsm)
{
STANDARD_VM_CONTRACT;
- if (!RuntimeVerifyNativeImageTimestamps(info, pLogAsm))
- return FALSE;
-
//
// Check that the EE version numbers are the same.
//
@@ -1295,6 +1231,53 @@ BOOL RuntimeVerifyNativeImageVersion(const CORCOMPILE_VERSION_INFO *info, Loggab
return TRUE;
}
+//===========================================================================================================
+// Validates that an NI matches the running CLR, OS, CPU, etc. This is the entrypoint used by the CLR loader.
+//
+//===========================================================================================================
+BOOL PEAssembly::CheckNativeImageVersion(PEImage *peimage)
+{
+ STANDARD_VM_CONTRACT;
+
+ //
+ // Get the zap version header. Note that modules will not have version
+ // headers - they add no additional versioning constraints from their
+ // assemblies.
+ //
+ PEImageLayoutHolder image = peimage->GetLayout(PEImageLayout::LAYOUT_ANY, PEImage::LAYOUT_CREATEIFNEEDED);
+
+ if (!image->HasNativeHeader())
+ return FALSE;
+
+ if (!image->CheckNativeHeaderVersion())
+ {
+ // Wrong native image version is fatal error on CoreCLR
+ ThrowHR(COR_E_NI_AND_RUNTIME_VERSION_MISMATCH);
+ }
+
+ CORCOMPILE_VERSION_INFO *info = image->GetNativeVersionInfo();
+ if (info == NULL)
+ return FALSE;
+
+ if (!RuntimeVerifyNativeImageVersion(info, this))
+ {
+ // Wrong native image version is fatal error on CoreCLR
+ ThrowHR(COR_E_NI_AND_RUNTIME_VERSION_MISMATCH);
+ }
+
+ CorCompileConfigFlags configFlags = PEFile::GetNativeImageConfigFlagsWithOverrides();
+
+ // Otherwise, match regardless of the instrumentation flags
+ configFlags = (CorCompileConfigFlags)(configFlags & ~(CORCOMPILE_CONFIG_INSTRUMENTATION_NONE | CORCOMPILE_CONFIG_INSTRUMENTATION));
+
+ if ((info->wConfigFlags & configFlags) != configFlags)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
#endif // !DACCESS_COMPILE
/* static */
@@ -1401,14 +1384,14 @@ CorCompileConfigFlags PEFile::GetNativeImageConfigFlagsWithOverrides()
//===========================================================================================================
BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_NGEN_SIGNATURE &ngenSigExpected,
const CORCOMPILE_VERSION_INFO *pActual,
- LoggableAssembly *pLogAsm)
+ PEAssembly *pLogAsm)
{
STANDARD_VM_CONTRACT;
if (ngenSigExpected != pActual->signature)
{
// Signature did not match
- SString displayString = pLogAsm->DisplayString();
+ SString displayString = pLogAsm->GetPath();
RuntimeVerifyLog(LL_ERROR,
pLogAsm,
W("Rejecting native image because native image dependency %s ")
@@ -1422,7 +1405,7 @@ BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_NGEN_SIGNATURE &ngenSig
// Wrapper function for use by parts of the runtime that actually have a CORCOMPILE_DEPENDENCY to work with.
BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_DEPENDENCY *pExpected,
const CORCOMPILE_VERSION_INFO *pActual,
- LoggableAssembly *pLogAsm)
+ PEAssembly *pLogAsm)
{
WRAPPER_NO_CONTRACT;
diff --git a/src/vm/pefile.h b/src/vm/pefile.h
index e79c94c954..699b4e44d3 100644
--- a/src/vm/pefile.h
+++ b/src/vm/pefile.h
@@ -814,43 +814,9 @@ typedef ReleaseHolder<PEFile> PEFileHolder;
typedef ReleaseHolder<PEAssembly> PEAssemblyHolder;
-
-
-// A small shim around PEAssemblies/IBindResult that allow us to write Fusion/CLR-agnostic
-// for logging native bind failures to the Fusion log/CLR log.
-//
-// These structures are stack-based, non-thread-safe and created for the duration of a single RuntimeVerify call.
-// The methods are expected to compute their data lazily as they are only used in bind failures or in checked builds.
-class LoggablePEAssembly : public LoggableAssembly
-{
- public:
- virtual SString DisplayString()
- {
- STANDARD_VM_CONTRACT;
-
- return m_peAssembly->GetPath();
- }
-
-
- LoggablePEAssembly(PEAssembly *peAssembly)
- {
- LIMITED_METHOD_CONTRACT;
-
- m_peAssembly = peAssembly;
- peAssembly->AddRef();
- }
-
- ~LoggablePEAssembly()
- {
- LIMITED_METHOD_CONTRACT;
-
- m_peAssembly->Release();
- }
-
- private:
- PEAssembly *m_peAssembly;
-};
-
+BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_DEPENDENCY *pExpected,
+ const CORCOMPILE_VERSION_INFO *pActual,
+ PEAssembly *pLogAsm);
// ================================================================================
// Inline definitions
diff --git a/src/vm/peimage.inl b/src/vm/peimage.inl
index 57f5400855..8a9c96c77f 100644
--- a/src/vm/peimage.inl
+++ b/src/vm/peimage.inl
@@ -376,6 +376,7 @@ inline const BOOL PEImage::HasStrongNameSignature()
inline BOOL PEImage::IsIbcOptimized()
{
+#ifdef FEATURE_PREJIT
WRAPPER_NO_CONTRACT;
if (HasLoadedLayout())
return GetLoadedLayout()->GetNativeILIsIbcOptimized();
@@ -384,6 +385,9 @@ inline BOOL PEImage::IsIbcOptimized()
PEImageLayoutHolder pLayout(GetLayout(PEImageLayout::LAYOUT_ANY,LAYOUT_CREATEIFNEEDED));
return pLayout->GetNativeILIsIbcOptimized();
}
+#else
+ return false;
+#endif
}
#ifdef FEATURE_PREJIT
diff --git a/src/vm/readytoruninfo.h b/src/vm/readytoruninfo.h
index 210399f81e..fea5b33c14 100644
--- a/src/vm/readytoruninfo.h
+++ b/src/vm/readytoruninfo.h
@@ -17,6 +17,10 @@
typedef DPTR(struct READYTORUN_SECTION) PTR_READYTORUN_SECTION;
+#ifndef FEATURE_PREJIT
+typedef DPTR(struct READYTORUN_IMPORT_SECTION) PTR_CORCOMPILE_IMPORT_SECTION;
+#endif
+
class PrepareCodeConfig;
typedef DPTR(class ReadyToRunInfo) PTR_ReadyToRunInfo;
diff --git a/src/vm/stubmgr.cpp b/src/vm/stubmgr.cpp
index 2a36908d3f..58c0fa34f5 100644
--- a/src/vm/stubmgr.cpp
+++ b/src/vm/stubmgr.cpp
@@ -1522,6 +1522,7 @@ BOOL RangeSectionStubManager::DoTraceStub(PCODE stubStartAddress, TraceDestinati
case STUB_CODE_BLOCK_STUBLINK:
return StubLinkStubManager::g_pManager->DoTraceStub(stubStartAddress, trace);
+#ifdef FEATURE_PREJIT
case STUB_CODE_BLOCK_VIRTUAL_METHOD_THUNK:
{
PCODE pTarget = GetMethodThunkTarget(stubStartAddress);
@@ -1540,6 +1541,7 @@ BOOL RangeSectionStubManager::DoTraceStub(PCODE stubStartAddress, TraceDestinati
}
return TRUE;
}
+#endif
case STUB_CODE_BLOCK_EXTERNAL_METHOD_THUNK:
{
diff --git a/src/vm/zapsig.h b/src/vm/zapsig.h
index 258e821aa8..69be660ee6 100644
--- a/src/vm/zapsig.h
+++ b/src/vm/zapsig.h
@@ -18,16 +18,14 @@
#include "common.h"
-//define function pointer type: EncodeModuleCallback
-//
+typedef DWORD(*ENCODEMODULE_CALLBACK)(LPVOID pModuleContext, CORINFO_MODULE_HANDLE moduleHandle);
typedef DWORD (*EncodeModuleCallback)(void* pModuleContext, Module *pReferencedModule);
enum {
// return value when EncodeModule fails
ENCODE_MODULE_FAILED = 0xffffffff,
};
-//define function pointer type: TokenDefinitionCallback
-//
+typedef void(*DEFINETOKEN_CALLBACK)(LPVOID pModuleContext, CORINFO_MODULE_HANDLE moduleHandle, DWORD index, mdTypeRef* token);
typedef void (*TokenDefinitionCallback)(void* pModuleContext, Module *pReferencedModule, DWORD index, mdToken* refToken);
class ZapSig