Delete TRANSLATE_PDB. (dotnet/coreclr#26036)
authorSergey Andreenko <seandree@microsoft.com>
Wed, 7 Aug 2019 05:37:37 +0000 (22:37 -0700)
committerJan Kotas <jkotas@microsoft.com>
Wed, 7 Aug 2019 05:37:37 +0000 (07:37 +0200)
Does anybody know what it was for and if it is still used?
I have not found any references in desktop sources.
When you enable it there are many compile errors.

Commit migrated from https://github.com/dotnet/coreclr/commit/45851dffd1f6dd1550a9be691247326090dca8c9

src/coreclr/src/jit/emit.cpp
src/coreclr/src/jit/emit.h
src/coreclr/src/jit/emitxarch.cpp

index 6bad19d..17b576a 100644 (file)
@@ -101,150 +101,6 @@ const char* emitter::emitIfName(unsigned f)
 
 #endif
 
-#ifdef TRANSLATE_PDB
-
-/* these are protected */
-
-AddrMap*  emitter::emitPDBOffsetTable = 0;
-LocalMap* emitter::emitPDBLocalTable  = 0;
-bool      emitter::emitIsPDBEnabled   = true;
-BYTE*     emitter::emitILBaseOfCode   = 0;
-BYTE*     emitter::emitILMethodBase   = 0;
-BYTE*     emitter::emitILMethodStart  = 0;
-BYTE*     emitter::emitImgBaseOfCode  = 0;
-
-void emitter::MapCode(int ilOffset, BYTE* imgDest)
-{
-    if (emitIsPDBEnabled)
-    {
-        emitPDBOffsetTable->MapSrcToDest(ilOffset, (int)(imgDest - emitImgBaseOfCode));
-    }
-}
-
-void emitter::MapFunc(int                imgOff,
-                      int                procLen,
-                      int                dbgStart,
-                      int                dbgEnd,
-                      short              frameReg,
-                      int                stkAdjust,
-                      int                lvaCount,
-                      OptJit::LclVarDsc* lvaTable,
-                      bool               framePtr)
-{
-    if (emitIsPDBEnabled)
-    {
-        // this code stores information about local symbols for the PDB translation
-
-        assert(lvaCount >= 0); // don't allow a negative count
-
-        LvaDesc* rgLvaDesc = 0;
-
-        if (lvaCount > 0)
-        {
-            rgLvaDesc = new LvaDesc[lvaCount];
-
-            if (!rgLvaDesc)
-            {
-                NOMEM();
-            }
-
-            LvaDesc*           pDst = rgLvaDesc;
-            OptJit::LclVarDsc* pSrc = lvaTable;
-            for (int i = 0; i < lvaCount; ++i, ++pDst, ++pSrc)
-            {
-                pDst->slotNum = pSrc->lvSlotNum;
-                pDst->isReg   = pSrc->lvRegister;
-                pDst->reg     = (pSrc->lvRegister ? pSrc->lvRegNum : frameReg);
-                pDst->off     = pSrc->lvStkOffs + stkAdjust;
-            }
-        }
-
-        emitPDBLocalTable->AddFunc((int)(emitILMethodBase - emitILBaseOfCode), imgOff - (int)emitImgBaseOfCode, procLen,
-                                   dbgStart - imgOff, dbgEnd - imgOff, lvaCount, rgLvaDesc, framePtr);
-        // do not delete rgLvaDesc here -- responsibility is now on emitPDBLocalTable destructor
-    }
-}
-
-/* these are public */
-
-void emitter::SetILBaseOfCode(BYTE* pTextBase)
-{
-    emitILBaseOfCode = pTextBase;
-}
-
-void emitter::SetILMethodBase(BYTE* pMethodEntry)
-{
-    emitILMethodBase = pMethodEntry;
-}
-
-void emitter::SetILMethodStart(BYTE* pMethodCode)
-{
-    emitILMethodStart = pMethodCode;
-}
-
-void emitter::SetImgBaseOfCode(BYTE* pTextBase)
-{
-    emitImgBaseOfCode = pTextBase;
-}
-
-void emitter::SetIDBaseToProlog()
-{
-    emitInstrDescILBase = (int)(emitILMethodBase - emitILBaseOfCode);
-}
-
-void emitter::SetIDBaseToOffset(int methodOffset)
-{
-    emitInstrDescILBase = methodOffset + (int)(emitILMethodStart - emitILBaseOfCode);
-}
-
-void emitter::DisablePDBTranslation()
-{
-    // this function should disable PDB translation code
-    emitIsPDBEnabled = false;
-}
-
-bool emitter::IsPDBEnabled()
-{
-    return emitIsPDBEnabled;
-}
-
-void emitter::InitTranslationMaps(int ilCodeSize)
-{
-    if (emitIsPDBEnabled)
-    {
-        emitPDBOffsetTable = AddrMap::Create(ilCodeSize);
-        emitPDBLocalTable  = LocalMap::Create();
-    }
-}
-
-void emitter::DeleteTranslationMaps()
-{
-    if (emitPDBOffsetTable)
-    {
-        delete emitPDBOffsetTable;
-        emitPDBOffsetTable = 0;
-    }
-    if (emitPDBLocalTable)
-    {
-        delete emitPDBLocalTable;
-        emitPDBLocalTable = 0;
-    }
-}
-
-void emitter::InitTranslator(PDBRewriter* pPDB, int* rgSecMap, IMAGE_SECTION_HEADER** rgpHeader, int numSections)
-{
-    if (emitIsPDBEnabled)
-    {
-        pPDB->InitMaps(rgSecMap,           // new PE section header order
-                       rgpHeader,          // array of section headers
-                       numSections,        // number of sections
-                       emitPDBOffsetTable, // code offset translation table
-                       emitPDBLocalTable); // slot variable translation table
-    }
-}
-
-#endif // TRANSLATE_PDB
-
 /*****************************************************************************/
 
 #if EMITTER_STATS
@@ -1401,13 +1257,10 @@ void* emitter::emitAllocAnyInstr(size_t sz, emitAttr opsz)
 
     instrDescDebugInfo* info = (instrDescDebugInfo*)emitGetMem(sizeof(*info));
 
-    info->idNum        = emitInsCount;
-    info->idSize       = sz;
-    info->idVarRefOffs = 0;
-    info->idMemCookie  = 0;
-#ifdef TRANSLATE_PDB
-    info->idilStart = emitInstrDescILBase;
-#endif
+    info->idNum         = emitInsCount;
+    info->idSize        = sz;
+    info->idVarRefOffs  = 0;
+    info->idMemCookie   = 0;
     info->idFinallyCall = false;
     info->idCatchRet    = false;
     info->idCallSig     = nullptr;
index 63d1c7c..d105769 100644 (file)
 #include "jitgcinfo.h"
 
 /*****************************************************************************/
-#ifdef TRANSLATE_PDB
-#ifndef _ADDRMAP_INCLUDED_
-#include "addrmap.h"
-#endif
-#ifndef _LOCALMAP_INCLUDED_
-#include "localmap.h"
-#endif
-#ifndef _PDBREWRITE_H_
-#include "pdbrewrite.h"
-#endif
-#endif // TRANSLATE_PDB
-
-/*****************************************************************************/
 #ifdef _MSC_VER
 #pragma warning(disable : 4200) // allow arrays of 0 size inside structs
 #endif
@@ -542,13 +529,10 @@ protected:
 
     struct instrDescDebugInfo
     {
-        unsigned idNum;
-        size_t   idSize;       // size of the instruction descriptor
-        unsigned idVarRefOffs; // IL offset for LclVar reference
-        size_t   idMemCookie;  // for display of method name  (also used by switch table)
-#ifdef TRANSLATE_PDB
-        unsigned int idilStart; // instruction descriptor source information for PDB translation
-#endif
+        unsigned          idNum;
+        size_t            idSize;        // size of the instruction descriptor
+        unsigned          idVarRefOffs;  // IL offset for LclVar reference
+        size_t            idMemCookie;   // for display of method name  (also used by switch table)
         bool              idFinallyCall; // Branch instruction is a call to finally
         bool              idCatchRet;    // Instruction is for a catch 'return'
         CORINFO_SIG_INFO* idCallSig;     // Used to report native call site signatures to the EE
@@ -1454,36 +1438,6 @@ public:
 
 #endif // FEATURE_EH_FUNCLETS
 
-/************************************************************************/
-/*           Members and methods used in PDB translation                */
-/************************************************************************/
-
-#ifdef TRANSLATE_PDB
-
-    void MapCode(int ilOffset, BYTE* imgDest);
-    void MapFunc(int                imgOff,
-                 int                procLen,
-                 int                dbgStart,
-                 int                dbgEnd,
-                 short              frameReg,
-                 int                stkAdjust,
-                 int                lvaCount,
-                 OptJit::LclVarDsc* lvaTable,
-                 bool               framePtr);
-
-private:
-    int              emitInstrDescILBase; // code offset of IL that produced this instruction desctriptor
-    int              emitInstrDescILBase; // code offset of IL that produced this instruction desctriptor
-    static AddrMap*  emitPDBOffsetTable;  // translation table for mapping IL addresses to native addresses
-    static LocalMap* emitPDBLocalTable;   // local symbol translation table
-    static bool      emitIsPDBEnabled;    // flag to disable PDB translation code when a PDB is not found
-    static BYTE*     emitILBaseOfCode;    // start of IL .text section
-    static BYTE*     emitILMethodBase;    // beginning of IL method (start of header)
-    static BYTE*     emitILMethodStart;   // beginning of IL method code (right after the header)
-    static BYTE*     emitImgBaseOfCode;   // start of the image .text section
-
-#endif
-
     /************************************************************************/
     /*    Methods to record a code position and later convert to offset     */
     /************************************************************************/
index 8a6b34b..7cd33e4 100644 (file)
@@ -13636,14 +13636,6 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp)
     }
 #endif
 
-#ifdef TRANSLATE_PDB
-    if (*dp != dst)
-    {
-        // only map instruction groups to instruction groups
-        MapCode(id->idDebugOnlyInfo()->idilStart, *dp);
-    }
-#endif
-
     *dp = dst;
 
 #ifdef DEBUG