summaryrefslogtreecommitdiff
path: root/src/zap
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2016-02-18 09:21:04 -0800
committerJan Kotas <jkotas@microsoft.com>2016-02-18 10:05:14 -0800
commitca5dc52f79b91cd58c52b42927d19ec18c1281db (patch)
tree5babb6c7d0922636b2cf07b485bc9bee55137fdf /src/zap
parentd1cc1cc104e4ad5e32a9f287b717c6ceba33e124 (diff)
downloadcoreclr-ca5dc52f79b91cd58c52b42927d19ec18c1281db.tar.gz
coreclr-ca5dc52f79b91cd58c52b42927d19ec18c1281db.tar.bz2
coreclr-ca5dc52f79b91cd58c52b42927d19ec18c1281db.zip
Delete MDIL generation support from JIT-EE interface
Diffstat (limited to 'src/zap')
-rw-r--r--src/zap/zap.settings.targets1
-rw-r--r--src/zap/zapinfo.cpp947
-rw-r--r--src/zap/zapinfo.h83
3 files changed, 0 insertions, 1031 deletions
diff --git a/src/zap/zap.settings.targets b/src/zap/zap.settings.targets
index b59d8f264c..eb84c3f9fe 100644
--- a/src/zap/zap.settings.targets
+++ b/src/zap/zap.settings.targets
@@ -27,7 +27,6 @@
<PCHCompile>$(ZapSrcDirectory)\common.cpp</PCHCompile>
<PCHObject>common.obj</PCHObject>
<PCHOutput>common.pch</PCHOutput>
- <MDILGenerator Condition="'$(BuildForCoreSystem)' == 'true' and '$(TargetArch)'=='arm'">true</MDILGenerator>
</PropertyGroup>
<!--Leaf Project Items-->
<ItemGroup>
diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp
index d26ecf4cba..d6862f2e9d 100644
--- a/src/zap/zapinfo.cpp
+++ b/src/zap/zapinfo.cpp
@@ -22,16 +22,6 @@
#include "zapreadytorun.h"
#endif
-#if defined(MDIL) && !defined(BINDER)
-class GuidInfo;
-class MethodDesc;
-class MethodTable;
-#include "CompactLayoutWriter.h"
-#endif
-#ifdef MDIL
-#include "TritonStress.h"
-#endif
-
ZapInfo::ZapInfo(ZapImage * pImage, mdMethodDef md, CORINFO_METHOD_HANDLE handle, CORINFO_MODULE_HANDLE module, unsigned methodProfilingDataFlags)
: m_pImage(pImage),
m_currentMethodToken(md),
@@ -174,10 +164,6 @@ int ZapInfo::ComputeJitFlags(CORINFO_METHOD_HANDLE handle)
jitFlags |= CORJIT_FLG_FRAMED;
}
- // Please note that when generating MDIL canSkipMethodVerification currently returns
- // CORINFO_VERIFICATION_DONT_JIT (in case one day the code below checks for more
- // specific return values).
-
if (canSkipMethodVerification(m_currentMethodHandle) == CORINFO_VERIFICATION_CAN_SKIP)
{
jitFlags |= CORJIT_FLG_SKIP_VERIFICATION;
@@ -407,71 +393,6 @@ void ZapInfo::ProcessReferences()
}
}
-#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);
-}
-
-static COUNT_T DecodeHeader(BYTE *p, COUNT_T *codeSize, COUNT_T *xcptnsCount)
-{
- COUNT_T i = 0;
- BYTE firstByte = p[i++];
-
- if (firstByte <= 0xdf)
- {
- *codeSize = firstByte;
- *xcptnsCount = 0;
- }
- else
- {
- BYTE codeSizeBits = firstByte & 0x07;
- switch (codeSizeBits)
- {
- default: *codeSize = codeSizeBits*256 + p[i]; i += 1; break;
- case 6: *codeSize = ReadWord(&p[i]); i += 2; break;
- case 7: *codeSize = ReadDWord(&p[i]); i += 4; break;
- }
-
- BYTE xcptnsCountBits = (firstByte >> 3) & 0x03;
- if (xcptnsCountBits <= 2)
- *xcptnsCount = xcptnsCountBits;
- else
- {
- *xcptnsCount = p[i++];
- if (*xcptnsCount == 0xff)
- {
- *xcptnsCount = ReadDWord(&p[i]);
- i += 4;
- }
- }
- }
- return i;
-}
-
-static unsigned decodeUnsigned(BYTE *& src)
-{
- BYTE byte = *src++;
- unsigned value = byte & 0x7f;
- while (byte & 0x80)
- {
- byte = *src++;
- value <<= 7;
- value += byte & 0x7f;
- }
- return value;
-}
-#endif
-
// Compile a method using the JIT or Module compiler, and emit fixups
void ZapInfo::CompileMethod()
@@ -496,83 +417,10 @@ void ZapInfo::CompileMethod()
return;
}
-#ifdef MDIL
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- if (IsNilToken(m_currentMethodToken) || getMethodAttribs(m_currentMethodHandle) & CORINFO_FLG_SHAREDINST)
- {
- // this is some generic instantiation
- mdMethodDef methodDefToken;
- m_pEECompileInfo->GetMethodDef(m_currentMethodHandle, &methodDefToken);
- unsigned typeParameterCount = m_pEEJitInfo->getNumTypeParameters(m_currentMethodHandle);
-#if 0
- GetSvcLogger()->Printf(W("Compiling method %08x %s<"), methodDefToken, m_currentMethodName.GetUnicode());
- for (unsigned typeParameterIndex = 0; typeParameterIndex < typeParameterCount; typeParameterIndex++)
- {
- CorElementType elType = m_pEECompileInfo->getTypeOfTypeParameter(m_currentMethodHandle, typeParameterIndex);
- if (typeParameterIndex > 0)
- GetSvcLogger()->Printf(W(","));
- GetSvcLogger()->Printf(W("%d"), elType);
- }
- GetSvcLogger()->Printf(W(">"));
-#endif
-
- if (typeParameterCount > MDILGenericMethodDesc::MAX_TYPE_ARGS)
- {
- GetSvcLogger()->Printf(W("%s - too many type arguments (%d) - giving up compiling to MDIL\n"), m_currentMethodName.GetUnicode(), typeParameterCount);
- return;
- }
-
-#if 0
- if (m_currentMethodInfo.args.callConv & CORINFO_CALLCONV_PARAMTYPE)
- {
- GetSvcLogger()->Printf(W(" - param type info argument - giving up compiling to MDIL\n"));
- return;
- }
-
- if ((getMethodAttribs(m_currentMethodHandle) & CORINFO_FLG_SHAREDINST) && IsNilToken(m_currentMethodToken))
- {
- GetSvcLogger()->Printf(W("shared instantiation - giving up compiling to MDIL\n"));
- return;
- }
-#endif
- if (m_currentMethodModule != m_pImage->m_hModule)
- {
-// GetSvcLogger()->Printf(W("%s: generic method from other module - giving up compiling to MDIL\n"), m_currentMethodName.GetUnicode());
- return;
- }
-
-// GetSvcLogger()->Printf(W("\n"));
- }
-#if 0
- if (getMethodAttribs(m_currentMethodHandle) & CORINFO_FLG_SHAREDINST)
- {
- return;
- }
-#endif
- }
-
-#endif // MDIL
-
// Method does not have IL (e.g. an abstract method)
if (m_currentMethodInfo.ILCodeSize == 0)
return;
-#if defined(MDIL) && defined(FEATURE_WINDOWSPHONE)
- // 256 KB is chosen based on a small sampling of memory usage while compiling straight line
- // array initialization methods.
- if ((m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL) && (m_currentMethodInfo.ILCodeSize > 256 * 1024))
- {
- g_hrFatalError = COR_E_MAXMETHODSIZE;
- ThrowHR(COR_E_MAXMETHODSIZE);
- }
-
- // Check to see if compile of method should be skipped.
- HRESULT hr = m_pEECompileInfo->ShouldCompile(m_currentMethodHandle);
- if (hr == S_FALSE)
- return;
-#endif // defined(MDIL) && defined(FEATURE_WINDOWSPHONE)
-
// During ngen we look for a hint attribute on the method that indicates
// the method should be preprocessed for early
// preparation. This normally happens automatically, but for methods that
@@ -584,25 +432,6 @@ void ZapInfo::CompileMethod()
int jitFlags = ComputeJitFlags(m_currentMethodHandle);
-#ifdef MDIL
- //
- // The MDIL compiler has only been minimally tested in the presence of IBC
- // data. To avoid accidentally exercising untested scenarios, ignore all
- // IBC data when compiling MDIL. Although hot-cold spliting has had more
- // extensive testing, it is also similarly suspect, so we are preventing it
- // as well.
- //
- // This block can be removed whenever testing shows that the correctness of
- // IBC-optimized & hot-cold split MDIL is on par with the correctness of
- // MSIL NGen images.
- //
-
- if ((jitFlags & CORJIT_FLG_MDIL) != 0)
- {
- jitFlags &= ~(CORJIT_FLG_PROCSPLIT | CORJIT_FLG_BBINSTR | CORJIT_FLG_BBOPT);
- }
-#endif
-
#ifdef FEATURE_READYTORUN_COMPILER
if (IsReadyToRunCompilation())
{
@@ -684,14 +513,6 @@ void ZapInfo::CompileMethod()
MethodCompileComplete(m_currentMethodInfo.ftn);
-#ifdef MDIL
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- PublishCompiledMethod_MDIL(pCode, cCode);
- return;
- }
-#endif
-
#ifdef _TARGET_X86_
// The x86 JIT over estimates the code size. Trim the blob size down to
// the actual size.
@@ -707,417 +528,6 @@ void ZapInfo::CompileMethod()
#endif // BINDER
}
-#ifdef MDIL
-static COUNT_T OutputByte(BYTE *p, BYTE b)
-{
- if (p)
- {
- *p = b;
- }
- return 1;
-}
-
-static COUNT_T OutputWord(BYTE *p, WORD w)
-{
- if (p)
- {
- p[0] = (BYTE)w;
- p[1] = (BYTE)(w>>8);
- }
- return 2;
-}
-
-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;
-}
-
-static COUNT_T EncodeHeader(BYTE *p, ULONG codeSize, ULONG xcptnsCount)
-{
- // For each method, we have a header that encodes the size of the MDIL code
- // and the number of exception table entries. The encoding tries to minimize
- // the space taken in the frequent cases.
- // The encoding scheme is as follows:
- // first byte = 0x00 .. 0xdf => the size of routine is the first byte, there
- // are no exception table entries
- // first byte = 0xe0 .. 0xff => bits 0 .. 2 encode the size of the routine:
- // 0 .. 5: size = next byte + (bits 0..2)*256
- // 6: size = next word
- // 7: size = next dword
- // bits 3 .. 4 encode the number of exception entries:
- // 0 .. 2: (bits 3..4) exception entries
- // 3: next byte is number of exception entries
- // if nextByte is 0xff, next dword is number of exc entries
-
- COUNT_T i = 0;
- COUNT_T mask = p == 0 ? 0 : ~0;
-
- if (codeSize <= 0xdf && xcptnsCount == 0)
- {
- i += OutputByte(p, (BYTE)codeSize);
- }
- else if (codeSize <= 5*256 + 0xff && xcptnsCount <= 2)
- {
- i += OutputByte(p + (i & mask), (BYTE)(0xe0 + (codeSize >> 8) + (xcptnsCount<<3)));
- i += OutputByte(p + (i & mask), (BYTE)codeSize);
- }
- else
- {
- i += OutputByte(p + (i & mask), 0xe0);
- if (codeSize <= 0xffff)
- {
- if (p)
- *p |= 6;
- i += OutputWord(p + (i & mask), (WORD)codeSize);
- }
- else
- {
- if (p)
- *p |= 7;
- i += OutputDWord(p + (i & mask), codeSize);
- }
- if (xcptnsCount <= 2)
- {
- if (p)
- *p |= xcptnsCount<<3;
- }
- else
- {
- if (p)
- *p |= 3<<3;
- if (xcptnsCount <= 0xfe)
- {
- i += OutputByte(p + (i & mask), (BYTE)xcptnsCount);
- }
- else
- {
- i += OutputByte(p + (i & mask), 0xff);
- i += OutputDWord(p + (i & mask), xcptnsCount);
- }
- }
- }
- return i;
-}
-
-static size_t encodeUnsigned(BYTE *dest, unsigned value)
-{
- size_t size = 1;
- unsigned tmp = value;
- while (tmp > 0x7F)
- {
- tmp >>= 7;
- size++;
- }
- if (dest)
- {
- // write the bytes starting at the end of dest in LSB to MSB order
- BYTE* p = dest + size;
- BYTE cont = 0; // The last byte has no continuation flag
- while (value > 0x7F)
- {
- *--p = cont | (value & 0x7f);
- value >>= 7;
- cont = 0x80; // Non last bytes have a continuation flag
- }
- *--p = cont | value; // Now write the first byte
- assert(p == dest);
- }
- return size;
-}
-
-void ZapInfo::PublishCompiledMethod_MDIL(BYTE *pCode, ULONG cCode)
-{
- ZapImage::CodeKind codeKind = (IsNilToken(m_currentMethodToken) || getMethodAttribs(m_currentMethodHandle) & CORINFO_FLG_SHAREDINST)
- ? ZapImage::GENERIC_CODE
- : ZapImage::NON_GENERIC_CODE;
-
- ULONG codeOffs = m_pImage->m_codeOffs[codeKind];
-
- // the code pointer should be the one we handed out
- _ASSERTE(pCode == &m_pImage->m_codeBuffer[codeKind][(COUNT_T)(codeOffs + m_headerSize)]);
- // the code size not be larger than what was requested
- _ASSERTE(cCode <= m_codeSize);
- // our canary value at the end of the code buffer should be still there
- _ASSERTE(ReadDWord(&m_pImage->m_codeBuffer[codeKind][(COUNT_T)(codeOffs + m_headerSize + m_codeSize)]) == 'oBad');
-
- // the code size may well be smaller than what was requested,
- // in which case we need to re-encode the header.
- if (cCode < m_codeSize)
- {
- COUNT_T headerSize = EncodeHeader(&m_pImage->m_codeBuffer[codeKind][(COUNT_T)codeOffs], cCode, m_xcptnsCount);
- // now we may need a smaller header as well
- _ASSERTE(headerSize <= m_headerSize);
- if (headerSize < m_headerSize)
- {
- memmove(&m_pImage->m_codeBuffer[codeKind][(COUNT_T)(codeOffs+headerSize)], &m_pImage->m_codeBuffer[codeKind][(COUNT_T)(codeOffs+m_headerSize)], cCode);
- m_headerSize = headerSize;
- }
- m_codeSize = cCode;
- }
-
- // encode the exception tables - first pass calculates the
- // size, second pass actually writes the information
- BYTE *dest = 0;
- for (int pass = 1; pass <= 2; pass++)
- {
- SIZE_T size = 0;
- SIZE_T mask = pass == 1 ? 0 : ~0;
- for (COUNT_T i = 0; i < m_xcptnsCount; i++)
- {
- CORINFO_EH_CLAUSE &ehClause = m_exceptionClauses[i];
- size += encodeUnsigned(dest + (size & mask), ehClause.Flags);
- size += encodeUnsigned(dest + (size & mask), ehClause.TryOffset);
- _ASSERTE(ehClause.TryLength >= ehClause.TryOffset);
- size += encodeUnsigned(dest + (size & mask), ehClause.TryLength - ehClause.TryOffset);
- size += encodeUnsigned(dest + (size & mask), ehClause.HandlerOffset);
- _ASSERTE(ehClause.HandlerLength >= ehClause.HandlerOffset);
- size += encodeUnsigned(dest + (size & mask), ehClause.HandlerLength - ehClause.HandlerOffset);
- if (ehClause.Flags & CORINFO_EH_CLAUSE_FILTER)
- size += encodeUnsigned(dest + (size & mask), ehClause.FilterOffset);
- else
- size += encodeUnsigned(dest + (size & mask), ehClause.ClassToken);
- }
- if (dest == NULL)
- {
- COUNT_T desiredSize = (COUNT_T)(codeOffs + m_headerSize + m_codeSize + size);
- while (m_pImage->m_codeBuffer[codeKind].GetCount() < desiredSize)
- m_pImage->m_codeBuffer[codeKind].SetCount(m_pImage->m_codeBuffer[codeKind].GetCount()*2);
- dest = &m_pImage->m_codeBuffer[codeKind][(COUNT_T)(codeOffs + m_headerSize + m_codeSize)];
- m_pImage->m_codeOffs[codeKind] = desiredSize;
- }
- }
-
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB)
- {
- unsigned stubFlags = getStubMethodFlags(m_currentMethodHandle);
-
- mdToken sigToken = mdSignatureNil;
- if (stubFlags & ICompactLayoutWriter::SF_NEEDS_STUB_SIGNATURE)
- {
- CORINFO_SIG_INFO sig;
- getMethodSig(m_currentMethodHandle, &sig, NULL);
- sigToken = m_pImage->GetCompactLayoutWriter()->GetTokenForSignature(sig.pSig);
- }
-
- m_pImage->GetCompactLayoutWriter()->StubMethod(stubFlags, sigToken, m_currentMethodToken);
- }
-
- COUNT_T debugInfoSize = 0;
- COUNT_T debugInfoOffs = 0;
- if (m_iNativeVarInfo != 0 || m_iOffsetMapping != 0)
- {
- StackSBuffer debugInfoBuffer;
- m_pEECompileInfo->CompressDebugInfo(
- m_pOffsetMapping, m_iOffsetMapping,
- m_pNativeVarInfo, m_iNativeVarInfo,
- &debugInfoBuffer);
- debugInfoSize = debugInfoBuffer.GetSize();
-
- // Make sure the debug buffers are initialized
- if (m_pImage->m_debugInfoBuffer[ZapImage::GENERIC_CODE].GetCount() < sizeof(DWORD))
- {
- // we always want to preallocate the buffer
- _ASSERTE(m_pImage->m_debugInfoBuffer[ZapImage::GENERIC_CODE].GetCount() == 0);
- m_pImage->m_debugInfoBuffer[ZapImage::GENERIC_CODE].Preallocate(100*1000);
- // the generic code goes first - it needs a magic DWORD at the very beginning
- m_pImage->m_debugInfoBuffer[ZapImage::GENERIC_CODE].SetCount(sizeof(DWORD));
- OutputDWord(&m_pImage->m_debugInfoBuffer[ZapImage::GENERIC_CODE][0], 'DBUG');
- }
- if (m_pImage->m_debugInfoBuffer[ZapImage::NON_GENERIC_CODE].GetCount() < sizeof(DWORD))
- {
- // we always want to preallocate the buffer
- _ASSERTE(m_pImage->m_debugInfoBuffer[ZapImage::NON_GENERIC_CODE].GetCount() == 0);
- m_pImage->m_debugInfoBuffer[ZapImage::NON_GENERIC_CODE].Preallocate(100*1000);
- }
-
- // Tentatively insert debug info into m_pImage->m_debugInfoBuffer
- debugInfoOffs = m_pImage->m_debugInfoBuffer[codeKind].GetCount();
- COUNT_T desiredSize = debugInfoOffs + debugInfoSize;
- while (m_pImage->m_debugInfoBuffer[codeKind].GetAllocation() < desiredSize)
- m_pImage->m_debugInfoBuffer[codeKind].Preallocate(m_pImage->m_debugInfoBuffer[codeKind].GetAllocation() * 2);
- m_pImage->m_debugInfoBuffer[codeKind].SetCount(desiredSize);
- memcpy(&m_pImage->m_debugInfoBuffer[codeKind][debugInfoOffs], &debugInfoBuffer[0], debugInfoSize);
-
- // See if identical debug info already exists
- const MdilDebugInfoTable::DebugInfo *pInfo = m_pImage->m_pMdilDebugInfoTable->GetDebugInfo(debugInfoOffs, debugInfoSize, &m_pImage->m_debugInfoBuffer[codeKind]);
- _ASSERTE(pInfo->GetBlobSize() == debugInfoSize);
- if (pInfo->GetOffset() != debugInfoOffs)
- {
- // Found an existing identical debug info. Re-use it.
- m_pImage->m_debugInfoBuffer[codeKind].SetCount(debugInfoOffs);
- debugInfoOffs = pInfo->GetOffset();
- }
- }
-
- if (codeKind == ZapImage::GENERIC_CODE)
- {
- // this must be some generic method
- MDILGenericMethodDesc *pMD = new MDILGenericMethodDesc();
-
- // fill out an appropriate descriptor
- SetMDILGenericMethodDesc(m_currentMethodHandle, pMD);
-
- // and the MDIL code offset
- pMD->mdilCodeOffs = codeOffs;
- size_t thisCodeSize = m_pImage->m_codeOffs[ZapImage::GENERIC_CODE] - codeOffs;
- pMD->mdilCodeSize = (ULONG)thisCodeSize;
-
- pMD->debugInfoSize = debugInfoSize;
- pMD->debugInfoOffs = debugInfoOffs;
- _ASSERTE(pMD->debugInfoOffs < m_pImage->m_debugInfoBuffer[ZapImage::GENERIC_CODE].GetCount());
-
- // get the method def token
- mdMethodDef methodDefToken;
- m_pEECompileInfo->GetMethodDef(m_currentMethodHandle, &methodDefToken);
- COUNT_T currentMethodRid = RidFromToken(methodDefToken);
- COUNT_T mappingCount = m_pImage->m_mapGenericMethodToDesc.GetCount();
- if (mappingCount <= currentMethodRid)
- {
- if (mappingCount == 0)
- {
- m_pImage->m_mapGenericMethodToDesc.SetCount(1000);
- }
- while (m_pImage->m_mapGenericMethodToDesc.GetCount() <= currentMethodRid)
- m_pImage->m_mapGenericMethodToDesc.SetCount(m_pImage->m_mapGenericMethodToDesc.GetCount()*2);
- for (COUNT_T i = mappingCount; i < m_pImage->m_mapGenericMethodToDesc.GetCount(); i++)
- m_pImage->m_mapGenericMethodToDesc[i] = 0;
- }
-
- // let's find out whether we already have that exact same method body
- BYTE *thisCodePtr = &m_pImage->m_codeBuffer[ZapImage::GENERIC_CODE][(COUNT_T)codeOffs];
- MDILGenericMethodDesc *insertionPoint = NULL;
- m_pImage->m_unmergedGenericSize += (ULONG)thisCodeSize;
- m_pImage->m_unmergedGenericCount += 1;
- for (MDILGenericMethodDesc *p = m_pImage->m_mapGenericMethodToDesc[currentMethodRid]; p != NULL; p = p->next)
- {
- // the arities better agree
- _ASSERT(p->arity == pMD->arity);
-
- BYTE *thatCodePtr = &m_pImage->m_codeBuffer[ZapImage::GENERIC_CODE][(COUNT_T)p->mdilCodeOffs];
- if (memcmp(thisCodePtr, thatCodePtr, thisCodeSize) == 0)
- {
- // this method body matches - as we compare the mdil method header too, this implies
- // the lengths also match and it's not just that thisCodePtr points to a prefix of thatCodePtr
-
- // replace the new method body offset by the earlier one
- pMD->mdilCodeOffs = p->mdilCodeOffs;
-
- // and reset the code buffer
- m_pImage->m_codeOffs[ZapImage::GENERIC_CODE] = codeOffs;
-
- // now if debug info matches and all arg flavors except the last one match, we can
- // just OR the last arg flavor from pMD into p
- if (pMD->debugInfoOffs == p->debugInfoOffs && ArgFlavorsMatchExcept(p->flavorSet, pMD->flavorSet, p->arity, p->arity-1))
- {
-// GetSvcLogger()->Printf(W("merged generic bodies %08x + %08x\n"), p->flavorSet[p->arity-1], pMD->flavorSet[pMD->arity-1]);
- p->flavorSet[p->arity-1] |= pMD->flavorSet[pMD->arity-1];
- pMD = NULL;
- break;
- }
-
- insertionPoint = p;
- }
- }
-
- if (pMD != NULL)
- {
- if (m_pImage->m_codeOffs[ZapImage::GENERIC_CODE] != codeOffs)
- {
- m_pImage->m_mergedGenericCount += 1;
- m_pImage->m_mergedGenericSize += (ULONG)thisCodeSize;
- }
-
- if (insertionPoint != NULL)
- {
- // if we couldn't merge, but have a matching body, insert after it
- pMD->next = insertionPoint->next;
- insertionPoint->next = pMD;
- }
- else
- {
- // append the descriptor to the list
- pMD->next = m_pImage->m_mapGenericMethodToDesc[currentMethodRid];
- m_pImage->m_mapGenericMethodToDesc[currentMethodRid] = pMD;
- }
- }
- }
- else
- {
- COUNT_T currentMethodRid = RidFromToken(m_currentMethodToken);
- COUNT_T mappingCount = m_pImage->m_mapMethodRidToOffs.GetCount();
- if (mappingCount <= currentMethodRid)
- {
- if (mappingCount == 0)
- {
- m_pImage->m_methodRidCount = 0;
- m_pImage->m_mapMethodRidToOffs.SetCount(1000);
- }
- while (m_pImage->m_mapMethodRidToOffs.GetCount() <= currentMethodRid)
- m_pImage->m_mapMethodRidToOffs.SetCount(m_pImage->m_mapMethodRidToOffs.GetCount()*2);
- for (COUNT_T i = mappingCount; i < m_pImage->m_mapMethodRidToOffs.GetCount(); i++)
- m_pImage->m_mapMethodRidToOffs[i] = 0;
- m_pImage->m_methodRidCount = currentMethodRid+1;
- }
- if (m_pImage->m_methodRidCount < currentMethodRid+1)
- m_pImage->m_methodRidCount = currentMethodRid+1;
-
- m_pImage->m_mapMethodRidToOffs[currentMethodRid] = codeOffs;
-
- if (debugInfoSize != 0)
- {
- if (m_pImage->m_mapMethodRidToDebug.GetAllocation() <= currentMethodRid)
- {
- m_pImage->m_mapMethodRidToDebug.Preallocate(currentMethodRid < 1000 ? 1000 : 2 * currentMethodRid);
- }
- if (m_pImage->m_mapMethodRidToDebug.GetCount() <= currentMethodRid)
- {
- COUNT_T oldCount = m_pImage->m_mapMethodRidToDebug.GetCount();
- m_pImage->m_mapMethodRidToDebug.SetCount(currentMethodRid + 1);
- for (COUNT_T i = oldCount; i < currentMethodRid; i++)
- m_pImage->m_mapMethodRidToDebug[i] = 0xFFFFFFFF;
- }
-
- m_pImage->m_mapMethodRidToDebug[currentMethodRid] = debugInfoOffs;
- }
- }
-
- m_headerSize = 0; // header size of the current method
- m_codeSize = 0; // code size of the current method
- m_xcptnsCount = 0; // exception count of the current method
-
- // add a fake method header to the m_CompiledMethods just so
- // the rest of the logic knows the method has been compiled already
-
- ZapMethodHeader * pMethod = new (m_pImage->GetHeap()) ZapMethodHeader();
- pMethod->m_handle = m_currentMethodHandle;
- pMethod->m_token = m_currentMethodToken;
- m_pImage->m_CompiledMethods.Add(pMethod);
-}
-
-int _cdecl ZapInfo::CmpMDILGenericMethodDesc(const void *pv1, const void *pv2)
-{
- const MDILGenericMethodDesc *p1 = (const MDILGenericMethodDesc *)pv1;
- const MDILGenericMethodDesc *p2 = (const MDILGenericMethodDesc *)pv2;
-
- assert(p1->arity == p2->arity);
- for (int i = 0; i < p1->arity; i++)
- {
- if (p1->flavorSet[i] < p2->flavorSet[i])
- return -1;
- else if (p1->flavorSet[i] > p2->flavorSet[i])
- return 1;
- }
- return 0;
-}
-#endif
-
#ifndef BINDER
#ifndef FEATURE_FULL_NGEN
class MethodCodeComparer
@@ -1634,97 +1044,6 @@ HRESULT ZapInfo::getBBProfileData (
return S_OK;
}
-#ifdef MDIL
-void ZapInfo::SetMDILGenericMethodDesc(CORINFO_METHOD_HANDLE methodHandle, MDILGenericMethodDesc *pGMD)
-{
- // the generic parameters,
- unsigned typeParameterCount = m_pEEJitInfo->getNumTypeParameters(methodHandle);
- _ASSERTE(typeParameterCount <= MDILGenericMethodDesc::MAX_TYPE_ARGS);
- typeParameterCount = min(typeParameterCount, MDILGenericMethodDesc::MAX_TYPE_ARGS);
- pGMD->arity = typeParameterCount;
- for (unsigned typeParameterIndex = 0; typeParameterIndex < typeParameterCount; typeParameterIndex++)
- {
- CorElementType elType = m_pEEJitInfo->getTypeOfTypeParameter(methodHandle, typeParameterIndex);
- pGMD->flavorSet[typeParameterIndex] = 1UL<<elType;
- }
-}
-
-bool ZapInfo::ArgFlavorsMatchExcept(FlavorSet fs1[], FlavorSet fs2[], unsigned arity, unsigned argToIgnore)
-{
- for (unsigned i = 0; i < arity; i++)
- {
- if (i == argToIgnore)
- continue;
- if (fs1[i] != fs2[i])
- return false;
- }
- return true;
-}
-
-// allocate memory for a compile *to* MDIL
-void ZapInfo::allocMem_MDIL(ULONG hotCodeSize, /* IN */
- ULONG coldCodeSize, /* IN */
- ULONG roDataSize, /* IN */
- ULONG xcptnsCount, /* IN */
- CorJitAllocMemFlag flag, /* IN */
- void ** hotCodeBlock, /* OUT */
- void ** coldCodeBlock, /* OUT */
- void ** roDataBlock /* OUT */)
-{
- _ASSERTE(hotCodeSize > 0);
- _ASSERTE(coldCodeSize == 0);
- _ASSERTE(roDataSize == 0);
-
- TritonStress(TritonStress_GenerateMDIL, this->m_currentMethodToken, 0, TritonStressFlag_MainModule);
-
- ZapImage::CodeKind codeKind = (IsNilToken(m_currentMethodToken) || getMethodAttribs(m_currentMethodHandle) & CORINFO_FLG_SHAREDINST)
- ? ZapImage::GENERIC_CODE
- : ZapImage::NON_GENERIC_CODE;
-
- // Make sure there is a magic dword at the beginning of the code buffer
- if (m_pImage->m_codeBuffer[codeKind].GetCount() < sizeof(DWORD))
- {
- _ASSERTE(m_pImage->m_codeBuffer[codeKind].GetCount() == 0);
- m_pImage->m_codeBuffer[codeKind].SetCount(100*1000);
- OutputDWord(&m_pImage->m_codeBuffer[codeKind][0], 'MDCD');
- m_pImage->m_codeOffs[codeKind] = sizeof(DWORD);
- }
- ULONG codeOffs = m_pImage->m_codeOffs[codeKind];
-
- // First, compute the space taken by the header - minimum is 1 byte
- COUNT_T headerSize1 = EncodeHeader(NULL, hotCodeSize, xcptnsCount);
-
- // Allocate space for the header and the routine's code
- COUNT_T desiredSize = codeOffs + headerSize1 + hotCodeSize + sizeof(DWORD);
- while (m_pImage->m_codeBuffer[codeKind].GetCount() < desiredSize)
- m_pImage->m_codeBuffer[codeKind].SetCount(m_pImage->m_codeBuffer[codeKind].GetCount()*2);
-
- // Encode the header
- COUNT_T headerSize2 = EncodeHeader(&m_pImage->m_codeBuffer[codeKind][(COUNT_T)codeOffs], hotCodeSize, xcptnsCount);
- _ASSERTE(headerSize2 == headerSize1);
-
-#if _DEBUG
- // decode the header to make sure we're able to decode correctly
- COUNT_T codeSize2 = 0xdddddddd;
- COUNT_T xcptnsCount2 = 0xdddddddd;
- headerSize2 = DecodeHeader(&m_pImage->m_codeBuffer[codeKind][(COUNT_T)codeOffs], &codeSize2, &xcptnsCount2);
- _ASSERTE(headerSize2 == headerSize1 && codeSize2 == hotCodeSize && xcptnsCount2 == xcptnsCount);
-#endif
-
- m_exceptionClauses.SetCount(xcptnsCount);
-
- *hotCodeBlock = &m_pImage->m_codeBuffer[codeKind][(COUNT_T)(m_pImage->m_codeOffs[codeKind] + headerSize1)];
-#ifdef _DEBUG
- OutputDWord(&m_pImage->m_codeBuffer[codeKind][(COUNT_T)((COUNT_T)codeOffs + headerSize1 + hotCodeSize)], 'oBad');
- memset(*hotCodeBlock, 0, hotCodeSize);
-#endif
-
- m_headerSize = headerSize1;
- m_codeSize = hotCodeSize;
- m_xcptnsCount = xcptnsCount;
-}
-#endif
-
void ZapInfo::allocMem(
ULONG hotCodeSize, /* IN */
ULONG coldCodeSize, /* IN */
@@ -1736,21 +1055,6 @@ void ZapInfo::allocMem(
void ** roDataBlock /* OUT */
)
{
-#ifdef MDIL
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- allocMem_MDIL( hotCodeSize,
- coldCodeSize,
- roDataSize,
- xcptnsCount,
- flag,
- hotCodeBlock,
- coldCodeBlock,
- roDataBlock);
- return;
- }
-#endif
-
bool optForSize = ((m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_SIZE_OPT) == CORJIT_FLG_SIZE_OPT);
UINT align = DEFAULT_CODE_ALIGN;
@@ -1849,14 +1153,6 @@ void ZapInfo::yieldExecution()
void ZapInfo::setEHcount(unsigned cEH)
{
-#ifdef MDIL
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- // we don't need it in this case
- return;
- }
-#endif
-
//
// Must call after header has been allocated
//
@@ -1873,26 +1169,9 @@ void ZapInfo::setEHcount(unsigned cEH)
m_pExceptionInfo = ZapBlob::NewAlignedBlob(m_pImage, NULL, size, sizeof(DWORD));
}
-#ifdef MDIL
-void ZapInfo::setEHinfo_MDIL(unsigned EHnumber, const CORINFO_EH_CLAUSE *clause)
-{
- _ASSERTE(EHnumber < m_exceptionClauses.GetCount());
- _ASSERTE(m_xcptnsCount == m_exceptionClauses.GetCount());
- m_exceptionClauses[(COUNT_T)EHnumber] = *clause;
-}
-#endif
-
void ZapInfo::setEHinfo(unsigned EHnumber,
const CORINFO_EH_CLAUSE *clause)
{
-#ifdef MDIL
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- setEHinfo_MDIL(EHnumber, clause);
- return;
- }
-#endif
-
//
// Must call after EH info has been allocated
//
@@ -2160,17 +1439,6 @@ CORINFO_MODULE_HANDLE ZapInfo::embedModuleHandle(CORINFO_MODULE_HANDLE handle,
{
_ASSERTE(ppIndirection != NULL);
-#if defined(MDIL) && !defined(BINDER)
- // right now (Feb 2012) this isn't called while generating MDIL
- assert(!(m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL));
-
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- *ppIndirection = NULL;
- return handle;
- }
-#endif
-
if (IsReadyToRunCompilation())
{
_ASSERTE(!"embedModuleHandle");
@@ -2212,13 +1480,6 @@ CORINFO_CLASS_HANDLE ZapInfo::embedClassHandle(CORINFO_CLASS_HANDLE handle,
void **ppIndirection)
{
_ASSERTE(ppIndirection != NULL);
-#if defined(MDIL) && !defined(BINDER)
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- *ppIndirection = NULL;
- return handle;
- }
-#endif
if (IsReadyToRunCompilation())
{
@@ -2263,14 +1524,6 @@ CORINFO_FIELD_HANDLE ZapInfo::embedFieldHandle(CORINFO_FIELD_HANDLE handle,
{
_ASSERTE(ppIndirection != NULL);
-#if defined(MDIL) && !defined(BINDER)
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- *ppIndirection = NULL;
- return handle;
- }
-#endif
-
if (IsReadyToRunCompilation())
{
_ASSERTE(!"embedFieldHandle");
@@ -2307,14 +1560,6 @@ CORINFO_METHOD_HANDLE ZapInfo::embedMethodHandle(CORINFO_METHOD_HANDLE handle,
{
_ASSERTE(ppIndirection != NULL);
-#if defined(MDIL) && !defined(BINDER)
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- *ppIndirection = NULL;
- return handle;
- }
-#endif
-
if (IsReadyToRunCompilation())
{
_ASSERTE(!"embedMethodHandle");
@@ -2883,33 +2128,6 @@ void ZapInfo::getCallInfo(CORINFO_RESOLVED_TOKEN * pResolvedToken,
if (flags & CORINFO_CALLINFO_KINDONLY)
return;
-#ifdef MDIL
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- _ASSERTE(pResult->kind == CORINFO_VIRTUALCALL_STUB ||
- pResult->kind == CORINFO_CALL_CODE_POINTER ||
- pResult->kind == CORINFO_CALL ||
- pResult->kind == CORINFO_VIRTUALCALL_VTABLE ||
- pResult->kind == CORINFO_VIRTUALCALL_LDVIRTFTN);
-
-
- // We don't need to generate ZapNodes or any other ni-image related artifacts
- if (pResult->kind == CORINFO_VIRTUALCALL_STUB)
- {
- if (pResult->stubLookup.lookupKind.needsRuntimeLookup)
- {
- // we don't really need this, however I don't want to remove the
- // side-effects of this call
- embedGenericSignature(&pResult->stubLookup);
- return;
- }
- pResult->stubLookup.constLookup.accessType = IAT_PVALUE;
- pResult->stubLookup.constLookup.addr = (void *) (0xDEADF00D);
- }
- return;
- }
-#endif
-
if (IsReadyToRunCompilation())
{
if (pResult->thisTransform == CORINFO_BOX_THIS)
@@ -3799,14 +3017,6 @@ void ZapInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
#endif // FEATURE_READYTORUN_COMPILER
}
-#ifdef MDIL
-DWORD ZapInfo::getFieldOrdinal(CORINFO_MODULE_HANDLE tokenScope,
- unsigned fieldToken)
-{
- return m_pImage->GetCompactLayoutWriter()->GetFieldOrdinal(tokenScope, fieldToken);
-}
-#endif
-
bool ZapInfo::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
{
return m_pEEJitInfo->isFieldStatic(fldHnd);
@@ -3847,17 +3057,6 @@ BOOL ZapInfo::isValueClass(CORINFO_CLASS_HANDLE cls)
BOOL ZapInfo::canInlineTypeCheckWithObjectVTable (CORINFO_CLASS_HANDLE cls)
{
-#ifdef MDIL
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- {
- // The JIT uses this to optimize in a non-version resilient fashion.
- // So always return FALSE. This just means the JIT will generate a
- // virtual call to Type.Equals...
- // NOTE: the JIT still is allowed to optimize typeof(X) == typeof(Y)
- // by directly comparing the CORINFO_CLASS_HANDLEs at JIT time.
- return FALSE;
- }
-#endif // MDIL
return m_pEEJitInfo->canInlineTypeCheckWithObjectVTable(cls);
}
@@ -3899,99 +3098,6 @@ void ZapInfo::methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE meth)
m_MethodLoadTable.Load(meth, FALSE);
}
-#ifdef MDIL
-/*********************************************************************/
-unsigned ZapInfo::getNumTypeParameters(CORINFO_METHOD_HANDLE methHnd)
-{
- return m_pEEJitInfo->getNumTypeParameters(methHnd);
-}
-
-/*********************************************************************/
-CorElementType ZapInfo::getTypeOfTypeParameter(CORINFO_METHOD_HANDLE methHnd, unsigned index)
-{
- return m_pEEJitInfo->getTypeOfTypeParameter(methHnd, index);
-}
-CORINFO_CLASS_HANDLE ZapInfo::getTypeParameter(CORINFO_METHOD_HANDLE methHnd, bool classTypeParameter, unsigned index)
-{
- return m_pEEJitInfo->getTypeParameter(methHnd, classTypeParameter, index);
-}
-unsigned ZapInfo::getStructTypeToken(InlineContext *inlineContext, CORINFO_ARG_LIST_HANDLE argList)
-{
- return m_pImage->GetCompactLayoutWriter()->GetTokenForType(inlineContext, argList);
-}
-unsigned ZapInfo::getEnclosingClassToken(InlineContext *inlineContext, CORINFO_METHOD_HANDLE methHnd)
-{
- return m_pImage->GetCompactLayoutWriter()->GetEnclosingClassToken(inlineContext, methHnd);
-}
-
-CorInfoType ZapInfo::getFieldElementType(unsigned fieldToken, CORINFO_MODULE_HANDLE scope, CORINFO_METHOD_HANDLE methHnd)
-{
- return m_pImage->GetCompactLayoutWriter()->GetFieldElementType(fieldToken, scope, methHnd, this);
-}
-
-InlineContext * ZapInfo::computeInlineContext(InlineContext *outerContext, unsigned inlinedMethodToken, unsigned constraintTypeToken, CORINFO_METHOD_HANDLE methHnd)
-{
- return m_pImage->GetCompactLayoutWriter()->ComputeInlineContext(outerContext, inlinedMethodToken, constraintTypeToken, methHnd);
-}
-
-unsigned ZapInfo::translateToken(InlineContext *inlineContext, CORINFO_MODULE_HANDLE scopeHnd, unsigned token)
-{
-#ifdef BINDER
- _ASSERTE(!"should not be reachable");
- return token;
-#else
- if (m_pImage->GetCompactLayoutWriter()->IsDynamicScope(scopeHnd))
- {
- CORINFO_RESOLVED_TOKEN resolvedToken;
-
- resolvedToken.tokenContext = m_currentMethodHandle;
- resolvedToken.tokenScope = scopeHnd;
- resolvedToken.token = token;
- resolvedToken.tokenType = CORINFO_TOKENKIND_Ldtoken;
-
- resolveToken(&resolvedToken);
-
- switch (TypeFromToken(token))
- {
- case mdtTypeDef:
- {
- token = m_pImage->GetCompactLayoutWriter()->GetTokenForType(resolvedToken.hClass);
- break;
- }
-
- case mdtMethodDef:
- {
- token = m_pImage->GetCompactLayoutWriter()->GetTokenForMethod(resolvedToken.hMethod);
- break;
- }
-
- case mdtFieldDef:
- {
- token = m_pImage->GetCompactLayoutWriter()->GetTokenForField(resolvedToken.hField);
- break;
- }
-
- default:
- {
- UNREACHABLE_MSG("Unexpected token type encountered in IL stub");
- }
- }
- }
-
- return m_pImage->GetCompactLayoutWriter()->TranslateToken(inlineContext, token);
-#endif
-}
-
-unsigned ZapInfo::getCurrentMethodToken(InlineContext *inlineContext, CORINFO_METHOD_HANDLE methHnd)
-{
- return m_pImage->GetCompactLayoutWriter()->GetCurrentMethodToken(inlineContext, methHnd);
-}
-unsigned ZapInfo::getStubMethodFlags(CORINFO_METHOD_HANDLE method)
-{
- return m_pEEJitInfo->getStubMethodFlags(method);
-}
-#endif
-
CORINFO_CLASS_HANDLE ZapInfo::getBuiltinClass(CorInfoClassId classId)
{
return m_pEEJitInfo->getBuiltinClass(classId);
@@ -4026,20 +3132,6 @@ BOOL ZapInfo::shouldEnforceCallvirtRestriction(
return m_zapper->m_pEEJitInfo->shouldEnforceCallvirtRestriction(scopeHnd);
}
-#ifdef MDIL
-unsigned ZapInfo::getTypeTokenForFieldOrMethod(
- unsigned fieldOrMethodToken)
-{
- return m_pImage->GetCompactLayoutWriter()->GetTypeTokenForFieldOrMethod(fieldOrMethodToken);
-}
-
-unsigned ZapInfo::getTokenForType(
- CORINFO_CLASS_HANDLE cls)
-{
- return m_pImage->GetCompactLayoutWriter()->GetTokenForType(cls);
-}
-#endif
-
CORINFO_CLASS_HANDLE ZapInfo::getParentType (
CORINFO_CLASS_HANDLE cls)
{
@@ -4364,33 +3456,6 @@ void ZapInfo::resolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken)
m_pEEJitInfo->resolveToken(pResolvedToken);
}
-#ifdef MDIL
-//-----------------------------------------------------------------------------
-// Given a field or method token metaTOK return its parent token
-// we still need this in MDIL, for example for static field access we need the
-// token of the enclosing type
-unsigned ZapInfo::getMemberParent(CORINFO_MODULE_HANDLE tokenScope, unsigned token)
-{
- if (TypeFromToken(token) == mdtMemberRef)
- {
- ICompactLayoutWriter *pICLW = m_pImage->GetCompactLayoutWriter();
- if (pICLW != NULL)
- return pICLW->GetParentOfMemberRef(tokenScope, token);
- }
- return m_pEEJitInfo->getMemberParent(tokenScope, token);
-}
-
-// given a token representing an MD array of structs, get the element type token
-unsigned ZapInfo::getArrayElementToken(CORINFO_MODULE_HANDLE tokenScope, unsigned arrayTypeToken)
-{
- ICompactLayoutWriter *pICLW = m_pImage->GetCompactLayoutWriter();
- if (pICLW != NULL)
- return pICLW->GetArrayElementToken(tokenScope, arrayTypeToken);
- assert(!"Not reachable: getArrayElementToken");
- return 0;
-}
-#endif
-
//-----------------------------------------------------------------------------
void ZapInfo::findSig(CORINFO_MODULE_HANDLE tokenScope,
unsigned sigTOK,
@@ -4542,18 +3607,6 @@ void ZapInfo::reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd,
CorInfoCanSkipVerificationResult ZapInfo::canSkipMethodVerification (
CORINFO_METHOD_HANDLE ftnHandle)
{
-
-#if defined(MDIL) && !defined(BINDER)
- // The jit calls this API when it is detecting unverifiable code.
- // For MDIL we just give up and fall back to jitting at runtime.
- // This method is also called by ZapInfo::ComputeJitFlags(), as part
- // of the preparation to call the jit to compile a method. The salient
- // point here is to not return CORINFO_VERIFICATION_CAN_SKIP.
-
- if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_MDIL)
- return CORINFO_VERIFICATION_DONT_JIT;
-#endif
-
// ILStubs are generated internally by the CLR. There is no need to
// verify it, or any of its callees.
if (m_zapper->m_pOpt->m_compilerFlags & CORJIT_FLG_IL_STUB)
diff --git a/src/zap/zapinfo.h b/src/zap/zapinfo.h
index b56da9f4bf..dab1b295a2 100644
--- a/src/zap/zapinfo.h
+++ b/src/zap/zapinfo.h
@@ -249,56 +249,6 @@ class ZapInfo
CORINFO_ACCESS_FLAGS accessFlags,
BOOL fAllowThunk);
-
-#ifdef MDIL
- ULONG m_headerSize; // header size of the current method
- SArray<CORINFO_EH_CLAUSE> m_exceptionClauses; // temporary buffer for the exception table of one method
- ULONG m_codeSize; // code size of the current method
- ULONG m_xcptnsCount; // exception count of the current method
-
- void PublishCompiledMethod_MDIL(BYTE *pCode, ULONG cCode);
-
- typedef DWORD FlavorSet;
-
- struct MDILGenericMethodDesc
- {
- static const int MAX_TYPE_ARGS = 20; // we intend to give up compiling to MDIL after that
- BYTE arity;
- FlavorSet flavorSet[MAX_TYPE_ARGS]; // set of CorElementType this inst applies to
- ULONG mdilCodeOffs; // offset into the mdil code buffer
- ULONG mdilCodeSize;
- ULONG debugInfoOffs; // offset into the debug info buffer
- ULONG debugInfoSize;
- MDILGenericMethodDesc *next;
- };
-
- static int __cdecl CmpMDILGenericMethodDesc(const void *p1, const void *p2);
-
- struct MDILInstHeader
- {
- WORD m_instCount; // number of method bodies
- BYTE m_flags; // flags - no flags yet
- BYTE m_arity; // number of type args
- };
-
- void SetMDILGenericMethodDesc(CORINFO_METHOD_HANDLE methodHandle, MDILGenericMethodDesc *pGMD);
-
- static bool ArgFlavorsMatchExcept(FlavorSet fs1[], FlavorSet fs2[], unsigned arity, unsigned argToIgnore);
-
- void allocMem_MDIL( ULONG hotCodeSize, /* IN */
- ULONG coldCodeSize, /* IN */
- ULONG roDataSize, /* IN */
- ULONG xcptnsCount, /* IN */
- CorJitAllocMemFlag flag, /* IN */
- void ** hotCodeBlock, /* OUT */
- void ** coldCodeBlock, /* OUT */
- void ** roDataBlock /* OUT */);
-
- void setEHinfo_MDIL(unsigned EHnumber,
- const CORINFO_EH_CLAUSE *clause);
-
-#endif
-
public:
#ifdef BINDER
void PublishCompiledMethod(mdToken methodDefToken, CORINFO_METHOD_HANDLE methodHandle)
@@ -556,11 +506,6 @@ public:
CORINFO_ACCESS_FLAGS flags,
CORINFO_FIELD_INFO *pResult);
-#ifdef MDIL
- virtual DWORD getFieldOrdinal(CORINFO_MODULE_HANDLE tokenScope,
- unsigned fieldToken);
-#endif
-
bool isFieldStatic(CORINFO_FIELD_HANDLE fldHnd);
// ICorClassInfo
@@ -630,25 +575,7 @@ public:
BOOL areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2);
CORINFO_CLASS_HANDLE mergeClasses(CORINFO_CLASS_HANDLE cls1,
CORINFO_CLASS_HANDLE cls2);
-#ifdef MDIL
- unsigned getNumTypeParameters(CORINFO_METHOD_HANDLE method);
-
- CorElementType getTypeOfTypeParameter(CORINFO_METHOD_HANDLE method, unsigned index);
- CORINFO_CLASS_HANDLE getTypeParameter(CORINFO_METHOD_HANDLE method, bool classTypeParameter, unsigned index);
- unsigned getStructTypeToken(InlineContext *inlineContext, CORINFO_ARG_LIST_HANDLE argList);
- unsigned getEnclosingClassToken(InlineContext *inlineContext, CORINFO_METHOD_HANDLE method);
- InlineContext * computeInlineContext(InlineContext *outerContext, unsigned inlinedMethodToken, unsigned constraintTypeToken, CORINFO_METHOD_HANDLE methHnd);
- unsigned translateToken(InlineContext *inlineContext, CORINFO_MODULE_HANDLE scopeHnd, unsigned token);
- CorInfoType getFieldElementType(unsigned fieldToken, CORINFO_MODULE_HANDLE scope, CORINFO_METHOD_HANDLE methHnd);
- unsigned getCurrentMethodToken(InlineContext *inlineContext, CORINFO_METHOD_HANDLE method);
- unsigned getStubMethodFlags(CORINFO_METHOD_HANDLE method);
-#endif
BOOL shouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope);
-#ifdef MDIL
- virtual unsigned getTypeTokenForFieldOrMethod(
- unsigned fieldOrMethodToken);
- virtual unsigned getTokenForType(CORINFO_CLASS_HANDLE cls);
-#endif
CORINFO_CLASS_HANDLE getParentType(CORINFO_CLASS_HANDLE cls);
CorInfoType getChildType (CORINFO_CLASS_HANDLE clsHnd,
CORINFO_CLASS_HANDLE *clsRet);
@@ -665,16 +592,6 @@ public:
void resolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken);
-#ifdef MDIL
- // Given a field or method token metaTOK return its parent token
- // we still need this in MDIL, for example for static field access we need the
- // token of the enclosing type
- unsigned getMemberParent(CORINFO_MODULE_HANDLE scopeHnd, unsigned metaTOK);
-
- // given a token representing an MD array of structs, get the element type token
- unsigned getArrayElementToken(CORINFO_MODULE_HANDLE scopeHnd, unsigned metaTOK);
-#endif
-
void findSig(CORINFO_MODULE_HANDLE module, unsigned sigTOK,
CORINFO_CONTEXT_HANDLE context,
CORINFO_SIG_INFO *sig);