From cc5df16d722aa9ffed9f8e4f236a5077753f8ca0 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Tue, 20 Nov 2018 10:56:12 -0800 Subject: [PATCH] Delete CORCOMPILE_IMPORT_TABLE_ENTRY (#21109) --- src/debug/daccess/nidump.cpp | 89 ++++++++++---------------------------------- src/debug/daccess/nidump.h | 2 +- src/inc/corcompile.h | 15 ++------ src/inc/pedecoder.h | 4 -- src/utilcode/pedecoder.cpp | 50 ------------------------- src/vm/ceeload.cpp | 9 +---- src/vm/compile.cpp | 21 +++-------- src/vm/compile.h | 9 ++--- src/vm/zapsig.cpp | 44 +++++++++------------- src/vm/zapsig.h | 10 ++--- src/zap/zapheaders.cpp | 1 - src/zap/zapimage.cpp | 4 -- src/zap/zapimport.cpp | 29 +-------------- src/zap/zapimport.h | 23 +----------- src/zap/zapperstats.cpp | 4 +- src/zap/zapperstats.h | 1 - 16 files changed, 61 insertions(+), 254 deletions(-) diff --git a/src/debug/daccess/nidump.cpp b/src/debug/daccess/nidump.cpp index 3eb0edd..0cd2dfd 100644 --- a/src/debug/daccess/nidump.cpp +++ b/src/debug/daccess/nidump.cpp @@ -1122,13 +1122,6 @@ NativeImageDumper::DumpNativeImage() DisplayEndArray( "Total Dependencies", COR_INFO ); DisplayEndStructure(COR_INFO); //CORCOMPILE_VERSION_INFO - //Now load all dependencies and imports. There may be more - //dependencies than imports, so make sure to get them all. - for( COUNT_T i = 0; i < m_decoder.GetNativeImportTableCount(); ++i ) - { - NativeImageDumper::Import * import = OpenImport(i); - TraceDumpImport( i, import ); - } NativeImageDumper::Dependency * traceDependency = OpenDependency(0); TraceDumpDependency( 0, traceDependency ); @@ -1266,16 +1259,6 @@ void NativeImageDumper::DumpNative() DumpTypes( module ); } -void NativeImageDumper::TraceDumpImport(int idx, NativeImageDumper::Import * import) -{ - IF_OPT(DEBUG_TRACE) - { - m_display->ErrorPrintF("Import: %d\n", idx); - m_display->ErrorPrintF("\tDependency: %p\n", import->dependency); - m_display->ErrorPrintF("\twAssemblyRid: %d\n", import->entry->wAssemblyRid); - m_display->ErrorPrintF("\twModuleRid %d\n", import->entry->wModuleRid); - } -} void NativeImageDumper::TraceDumpDependency(int idx, NativeImageDumper::Dependency * dependency) { IF_OPT(DEBUG_TRACE) @@ -1942,21 +1925,12 @@ void NativeImageDumper::FixupBlobToString(RVA rva, SString& buf) // print assembly/module info - PTR_CORCOMPILE_IMPORT_TABLE_ENTRY entry = import->entry; - if (entry->wAssemblyRid != 0) - { - mdToken realRef = - MapAssemblyRefToManifest(TokenFromRid(entry->wAssemblyRid, - mdtAssemblyRef), - m_assemblyImport); - AppendToken(realRef, buf, m_manifestImport); - buf.Append( W(" ") ); - } - if (entry->wModuleRid != 0) - { - AppendToken(TokenFromRid(entry->wModuleRid, mdtFile), buf, pImport); - buf.Append( W(" ") ); - } + mdToken realRef = + MapAssemblyRefToManifest(TokenFromRid(import->index, + mdtAssemblyRef), + m_assemblyImport); + AppendToken(realRef, buf, m_manifestImport); + buf.Append( W(" ") ); } // print further info @@ -2231,21 +2205,12 @@ DataToTokenCore: int targetModuleIndex = DacSigUncompressData(sig); Import *targetImport = OpenImport(targetModuleIndex); - CORCOMPILE_IMPORT_TABLE_ENTRY *entry = targetImport->entry; - if (entry->wAssemblyRid != 0) - { - mdToken realRef = - MapAssemblyRefToManifest(TokenFromRid(entry->wAssemblyRid, - mdtAssemblyRef), - m_assemblyImport); - AppendToken(realRef, buf, m_manifestImport); - buf.Append( W(" ") ); - } - if (entry->wModuleRid != 0) - { - AppendToken(TokenFromRid(entry->wModuleRid, mdtFile), buf, - targetImport->dependency->pImport); - } + mdToken realRef = + MapAssemblyRefToManifest(TokenFromRid(targetImport->index, + mdtAssemblyRef), + m_assemblyImport); + AppendToken(realRef, buf, m_manifestImport); + buf.Append( W(" ") ); } break; @@ -2464,23 +2429,23 @@ NativeImageDumper::Import * NativeImageDumper::OpenImport(int i) { if (m_imports == NULL) { - COUNT_T count = m_decoder.GetNativeImportTableCount(); + COUNT_T count; + m_decoder.GetNativeDependencies(&count); m_numImports = count; m_imports = new Import [count]; ZeroMemory(m_imports, count * sizeof(m_imports[0])); } - if (m_imports[i].entry == NULL) + if (m_imports[i].index == 0) { //GetNativeImportFromIndex returns a host pointer. - CORCOMPILE_IMPORT_TABLE_ENTRY * entry = m_decoder.GetNativeImportFromIndex(i); - m_imports[i].entry = (PTR_CORCOMPILE_IMPORT_TABLE_ENTRY)(TADDR)entry; + m_imports[i].index = i; /* - mdToken tok = TokenFromRid(entry->wAssemblyRid, mdtAssemblyRef); + mdToken tok = TokenFromRid(entry->index, mdtAssemblyRef); Dependency * dependency = GetDependency( MapAssemblyRefToManifest(tok, */ - Dependency *dependency = GetDependency(TokenFromRid(entry->wAssemblyRid, mdtAssemblyRef)); + Dependency *dependency = GetDependency(TokenFromRid(i, mdtAssemblyRef)); m_imports[i].dependency = dependency; _ASSERTE(dependency); //Why can this be null? @@ -2497,7 +2462,7 @@ const NativeImageDumper::Dependency *NativeImageDumper::GetDependencyForFixup(RV { unsigned idx = DacSigUncompressData(sig); - _ASSERTE(idx >= 0 && idx < (int)m_decoder.GetNativeImportTableCount()); + _ASSERTE(idx >= 0 && idx < (int)m_numImports); return OpenImport(idx)->dependency; } @@ -5329,22 +5294,6 @@ void NativeImageDumper::DumpNativeHeader() } DisplayEndArray( NULL, ALWAYS ); //delayLoads - WRITE_NATIVE_FIELD(ImportTable); - DisplayStartArray( "imports", NULL, ALWAYS ); - PTR_CORCOMPILE_IMPORT_TABLE_ENTRY ent( nativeHeader->ImportTable.VirtualAddress + PTR_TO_TADDR(m_decoder.GetBase()) ); - for( COUNT_T i = 0; i < nativeHeader->ImportTable.Size / sizeof(*ent); ++i ) - { - DisplayStartStructure( "CORCOMPILE_IMPORT_TABLE_ENTRY", - DPtrToPreferredAddr(ent + i), - sizeof(ent[i]), ALWAYS ); - DisplayWriteFieldUInt( wAssemblyRid, ent[i].wAssemblyRid, - CORCOMPILE_IMPORT_TABLE_ENTRY, ALWAYS ); - DisplayWriteFieldUInt( wModuleRid, ent[i].wModuleRid, - CORCOMPILE_IMPORT_TABLE_ENTRY, ALWAYS ); - DisplayEndStructure( ALWAYS ); //CORCOMPILE_IMPORT_TABLE_ENTRY - } - DisplayEndArray( NULL, ALWAYS ); //imports - WRITE_NATIVE_FIELD(VersionInfo); WRITE_NATIVE_FIELD(DebugMap); WRITE_NATIVE_FIELD(ModuleImage); diff --git a/src/debug/daccess/nidump.h b/src/debug/daccess/nidump.h index db6d8e4..a19f61a 100644 --- a/src/debug/daccess/nidump.h +++ b/src/debug/daccess/nidump.h @@ -322,7 +322,7 @@ public: */ struct Import { - PTR_CORCOMPILE_IMPORT_TABLE_ENTRY entry; + DWORD index; Dependency *dependency; }; private: diff --git a/src/inc/corcompile.h b/src/inc/corcompile.h index bc78c33..e04da79 100644 --- a/src/inc/corcompile.h +++ b/src/inc/corcompile.h @@ -45,8 +45,6 @@ typedef DPTR(struct CORCOMPILE_EE_INFO_TABLE) PTR_CORCOMPILE_EE_INFO_TABLE; typedef DPTR(struct CORCOMPILE_HEADER) PTR_CORCOMPILE_HEADER; -typedef DPTR(struct CORCOMPILE_IMPORT_TABLE_ENTRY) - PTR_CORCOMPILE_IMPORT_TABLE_ENTRY; typedef DPTR(struct CORCOMPILE_COLD_METHOD_ENTRY) PTR_CORCOMPILE_COLD_METHOD_ENTRY; typedef DPTR(struct CORCOMPILE_EXCEPTION_LOOKUP_TABLE) @@ -238,7 +236,7 @@ struct CORCOMPILE_HEADER IMAGE_DATA_DIRECTORY HelperTable; // Table of function pointers to JIT helpers indexed by helper number IMAGE_DATA_DIRECTORY ImportSections; // points to array of code:CORCOMPILE_IMPORT_SECTION - IMAGE_DATA_DIRECTORY ImportTable; // points to table CORCOMPILE_IMPORT_TABLE_ENTRY + IMAGE_DATA_DIRECTORY Dummy0; IMAGE_DATA_DIRECTORY StubsData; // contains the value to register with the stub manager for the delegate stubs & AMD64 tail call stubs IMAGE_DATA_DIRECTORY VersionInfo; // points to a code:CORCOMPILE_VERSION_INFO IMAGE_DATA_DIRECTORY Dependencies; // points to an array of code:CORCOMPILE_DEPENDENCY @@ -451,12 +449,6 @@ public : } }; -struct CORCOMPILE_IMPORT_TABLE_ENTRY -{ - USHORT wAssemblyRid; - USHORT wModuleRid; -}; - struct CORCOMPILE_EE_INFO_TABLE { TADDR inlinedCallFrameVptr; @@ -1636,11 +1628,10 @@ class ICorCompileInfo ) = 0; // Encode a module for the imports table - virtual void EncodeModuleAsIndexes( + virtual void EncodeModuleAsIndex( CORINFO_MODULE_HANDLE fromHandle, CORINFO_MODULE_HANDLE handle, - DWORD *pAssemblyIndex, - DWORD *pModuleIndex, + DWORD *pIndex, IMetaDataAssemblyEmit *pAssemblyEmit) = 0; diff --git a/src/inc/pedecoder.h b/src/inc/pedecoder.h index 8163fff..2d6c5f5 100644 --- a/src/inc/pedecoder.h +++ b/src/inc/pedecoder.h @@ -329,10 +329,6 @@ class PEDecoder void GetNativeILPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine) const; CORCOMPILE_DEPENDENCY * GetNativeDependencies(COUNT_T *pCount = NULL) const; - COUNT_T GetNativeImportTableCount() const; - CORCOMPILE_IMPORT_TABLE_ENTRY *GetNativeImportFromIndex(COUNT_T index) const; - CHECK CheckNativeImportFromIndex(COUNT_T index) const; - PTR_CORCOMPILE_IMPORT_SECTION GetNativeImportSections(COUNT_T *pCount = NULL) const; PTR_CORCOMPILE_IMPORT_SECTION GetNativeImportSectionFromIndex(COUNT_T index) const; PTR_CORCOMPILE_IMPORT_SECTION GetNativeImportSectionForRVA(RVA rva) const; diff --git a/src/utilcode/pedecoder.cpp b/src/utilcode/pedecoder.cpp index e5e8ddc..bd0451d 100644 --- a/src/utilcode/pedecoder.cpp +++ b/src/utilcode/pedecoder.cpp @@ -2496,56 +2496,6 @@ PTR_CVOID PEDecoder::GetNativeManifestMetadata(COUNT_T *pSize) const RETURN dac_cast(GetDirectoryData(pDir)); } -CHECK PEDecoder::CheckNativeImportFromIndex(COUNT_T index) const -{ - CONTRACT_CHECK - { - PRECONDITION(CheckNativeHeader()); - NOTHROW; - GC_NOTRIGGER; - } - CONTRACT_CHECK_END; - - CHECK_MSG(index >= 0 && index < GetNativeImportTableCount(), "Bad Native Import Index"); - - CHECK_OK; -} - -COUNT_T PEDecoder::GetNativeImportTableCount() const -{ - CONTRACT(COUNT_T) - { - PRECONDITION(CheckNativeHeader()); - NOTHROW; - GC_NOTRIGGER; - } - CONTRACT_END; - - IMAGE_DATA_DIRECTORY *pDir = &GetNativeHeader()->ImportTable; - - RETURN (VAL32(pDir->Size) / sizeof(CORCOMPILE_IMPORT_TABLE_ENTRY)); -} - -CORCOMPILE_IMPORT_TABLE_ENTRY *PEDecoder::GetNativeImportFromIndex(COUNT_T index) const -{ - CONTRACT(CORCOMPILE_IMPORT_TABLE_ENTRY *) - { - PRECONDITION(CheckNativeHeader()); - PRECONDITION(CheckNativeImportFromIndex(index)); - POSTCONDITION(CheckPointer(RETVAL)); - NOTHROW; - GC_NOTRIGGER; - } - CONTRACT_END; - - IMAGE_DATA_DIRECTORY *pDir = &GetNativeHeader()->ImportTable; - - CORCOMPILE_IMPORT_TABLE_ENTRY *pEntry - = (CORCOMPILE_IMPORT_TABLE_ENTRY *) GetDirectoryData(pDir); - - RETURN pEntry + index; -} - PTR_CORCOMPILE_IMPORT_SECTION PEDecoder::GetNativeImportSections(COUNT_T *pCount) const { CONTRACT(PTR_CORCOMPILE_IMPORT_SECTION) diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 7e943ed..9c272e9 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -10279,9 +10279,7 @@ Module *Module::GetModuleFromIndex(DWORD ix) if (HasNativeImage()) { - PRECONDITION(GetNativeImage()->CheckNativeImportFromIndex(ix)); - CORCOMPILE_IMPORT_TABLE_ENTRY *p = GetNativeImage()->GetNativeImportFromIndex(ix); - RETURN ZapSig::DecodeModuleFromIndexes(this, p->wAssemblyRid, p->wModuleRid); + RETURN ZapSig::DecodeModuleFromIndex(this, ix); } else { @@ -10313,15 +10311,12 @@ Module *Module::GetModuleFromIndexIfLoaded(DWORD ix) GC_NOTRIGGER; MODE_ANY; PRECONDITION(HasNativeImage()); - PRECONDITION(GetNativeImage()->CheckNativeImportFromIndex(ix)); POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); } CONTRACT_END; #ifndef DACCESS_COMPILE - CORCOMPILE_IMPORT_TABLE_ENTRY *p = GetNativeImage()->GetNativeImportFromIndex(ix); - - RETURN ZapSig::DecodeModuleFromIndexesIfLoaded(this, p->wAssemblyRid, p->wModuleRid); + RETURN ZapSig::DecodeModuleFromIndexIfLoaded(this, ix); #else // DACCESS_COMPILE DacNotImpl(); RETURN NULL; diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index 1c461b9..491aecc 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -1471,11 +1471,10 @@ HRESULT CEECompileInfo::GetFieldDef(CORINFO_FIELD_HANDLE fieldHandle, return S_OK; } -void CEECompileInfo::EncodeModuleAsIndexes(CORINFO_MODULE_HANDLE fromHandle, - CORINFO_MODULE_HANDLE handle, - DWORD* pAssemblyIndex, - DWORD* pModuleIndex, - IMetaDataAssemblyEmit* pAssemblyEmit) +void CEECompileInfo::EncodeModuleAsIndex(CORINFO_MODULE_HANDLE fromHandle, + CORINFO_MODULE_HANDLE handle, + DWORD* pIndex, + IMetaDataAssemblyEmit* pAssemblyEmit) { STANDARD_VM_CONTRACT; @@ -1488,7 +1487,7 @@ void CEECompileInfo::EncodeModuleAsIndexes(CORINFO_MODULE_HANDLE fromHandle, Assembly *assembly = module->GetAssembly(); if (assembly == fromAssembly) - *pAssemblyIndex = 0; + *pIndex = 0; else { UPTR result; @@ -1534,19 +1533,11 @@ void CEECompileInfo::EncodeModuleAsIndexes(CORINFO_MODULE_HANDLE fromHandle, } } - *pAssemblyIndex = RidFromToken(token); + *pIndex = RidFromToken(token); pRefCache->m_sAssemblyRefMap.InsertValue((UPTR) assembly, (UPTR)token); } - if (module == assembly->GetManifestModule()) - *pModuleIndex = 0; - else - { - _ASSERTE(module->GetModuleRef() != mdFileNil); - *pModuleIndex = RidFromToken(module->GetModuleRef()); - } - COOPERATIVE_TRANSITION_END(); } diff --git a/src/vm/compile.h b/src/vm/compile.h index 6ab3d6c..4307d97 100644 --- a/src/vm/compile.h +++ b/src/vm/compile.h @@ -247,11 +247,10 @@ class CEECompileInfo : public ICorCompileInfo void GetModuleFileName(CORINFO_MODULE_HANDLE module, SString &result); - void EncodeModuleAsIndexes( CORINFO_MODULE_HANDLE fromHandle, - CORINFO_MODULE_HANDLE handle, - DWORD *pAssemblyIndex, - DWORD *pModuleIndex, - IMetaDataAssemblyEmit *pAssemblyEmit); + void EncodeModuleAsIndex( CORINFO_MODULE_HANDLE fromHandle, + CORINFO_MODULE_HANDLE handle, + DWORD *pIndex, + IMetaDataAssemblyEmit *pAssemblyEmit); void EncodeClass( CORINFO_MODULE_HANDLE referencingModule, CORINFO_CLASS_HANDLE classHandle, diff --git a/src/vm/zapsig.cpp b/src/vm/zapsig.cpp index 32ddd7a..b883eaf 100644 --- a/src/vm/zapsig.cpp +++ b/src/vm/zapsig.cpp @@ -628,9 +628,8 @@ BOOL ZapSig::CompareTypeHandleFieldToTypeHandle(TypeHandle *pTypeHnd, TypeHandle } #ifndef DACCESS_COMPILE -Module *ZapSig::DecodeModuleFromIndexes(Module *fromModule, - DWORD assemblyIndex, - DWORD moduleIndex) +Module *ZapSig::DecodeModuleFromIndex(Module *fromModule, + DWORD index) { CONTRACTL { @@ -642,45 +641,41 @@ Module *ZapSig::DecodeModuleFromIndexes(Module *fromModule, Assembly *pAssembly = NULL; - if (assemblyIndex == 0) + if (index == 0) { pAssembly = fromModule->GetAssembly(); } else { - if (assemblyIndex < fromModule->GetAssemblyRefMax()) + if (index < fromModule->GetAssemblyRefMax()) { - pAssembly = fromModule->LoadAssembly(GetAppDomain(), RidToToken(assemblyIndex, mdtAssemblyRef))->GetAssembly(); + pAssembly = fromModule->LoadAssembly(GetAppDomain(), RidToToken(index, mdtAssemblyRef))->GetAssembly(); } else { - assemblyIndex -= fromModule->GetAssemblyRefMax(); + index -= fromModule->GetAssemblyRefMax(); - pAssembly = fromModule->GetNativeMetadataAssemblyRefFromCache(assemblyIndex); + pAssembly = fromModule->GetNativeMetadataAssemblyRefFromCache(index); if(pAssembly == NULL) { AssemblySpec spec; - spec.InitializeSpec(TokenFromRid(assemblyIndex, mdtAssemblyRef), + spec.InitializeSpec(TokenFromRid(index, mdtAssemblyRef), fromModule->GetNativeAssemblyImport(), NULL); pAssembly = spec.LoadAssembly(FILE_LOADED); - fromModule->SetNativeMetadataAssemblyRefInCache(assemblyIndex, pAssembly); + fromModule->SetNativeMetadataAssemblyRefInCache(index, pAssembly); } } } - if (moduleIndex == 0) - return pAssembly->GetManifestModule(); - else - return pAssembly->GetManifestModule()->LoadModule(GetAppDomain(), RidToToken(moduleIndex, mdtFile))->GetModule(); + return pAssembly->GetManifestModule(); } -Module *ZapSig::DecodeModuleFromIndexesIfLoaded(Module *fromModule, - DWORD assemblyIndex, - DWORD moduleIndex) +Module *ZapSig::DecodeModuleFromIndexIfLoaded(Module *fromModule, + DWORD index) { CONTRACTL { @@ -694,19 +689,19 @@ Module *ZapSig::DecodeModuleFromIndexesIfLoaded(Module *fromModule, Assembly *pAssembly = NULL; mdAssemblyRef tkAssemblyRef; - if (assemblyIndex == 0) + if (index == 0) pAssembly = fromModule->GetAssembly(); else { - if (assemblyIndex < fromModule->GetAssemblyRefMax()) + if (index < fromModule->GetAssemblyRefMax()) { - tkAssemblyRef = RidToToken(assemblyIndex, mdtAssemblyRef); + tkAssemblyRef = RidToToken(index, mdtAssemblyRef); pAssembly = fromModule->GetAssemblyIfLoaded(tkAssemblyRef); } else { - assemblyIndex -= fromModule->GetAssemblyRefMax(); - tkAssemblyRef = RidToToken(assemblyIndex, mdtAssemblyRef); + index -= fromModule->GetAssemblyRefMax(); + tkAssemblyRef = RidToToken(index, mdtAssemblyRef); IMDInternalImport * pMDImportOverride = fromModule->GetNativeAssemblyImport(FALSE); if (pMDImportOverride != NULL) { @@ -781,10 +776,7 @@ Module *ZapSig::DecodeModuleFromIndexesIfLoaded(Module *fromModule, if (pAssembly == NULL) return NULL; - if (moduleIndex == 0) - return pAssembly->GetManifestModule(); - else - return pAssembly->GetManifestModule()->GetModuleIfLoaded(RidToToken(moduleIndex, mdtFile), TRUE, TRUE); + return pAssembly->GetManifestModule(); } diff --git a/src/vm/zapsig.h b/src/vm/zapsig.h index 69be660..d09290c 100644 --- a/src/vm/zapsig.h +++ b/src/vm/zapsig.h @@ -140,13 +140,11 @@ public: //-------------------------------------------------------------------- // Static helper encode/decode helper methods - static Module *DecodeModuleFromIndexes(Module *fromModule, - DWORD assemblyIndex, - DWORD moduleIndex); + static Module *DecodeModuleFromIndex(Module *fromModule, + DWORD index); - static Module *DecodeModuleFromIndexesIfLoaded(Module *fromModule, - DWORD assemblyIndex, - DWORD moduleIndex); + static Module *DecodeModuleFromIndexIfLoaded(Module *fromModule, + DWORD index); // referencingModule is the module that references the type. // fromModule is the module in which the type is defined. diff --git a/src/zap/zapheaders.cpp b/src/zap/zapheaders.cpp index f3dab63..8ca00d7 100644 --- a/src/zap/zapheaders.cpp +++ b/src/zap/zapheaders.cpp @@ -116,7 +116,6 @@ void ZapImage::SaveNativeHeader() SetDirectoryData(&nativeHeader.EEInfoTable, m_pEEInfoTable); SetDirectoryData(&nativeHeader.HelperTable, m_pHelperTableSection); SetDirectoryData(&nativeHeader.ImportSections, m_pImportSectionsTable); - SetDirectoryData(&nativeHeader.ImportTable, m_pImportTable); SetDirectoryData(&nativeHeader.StubsData, m_pStubsSection); SetDirectoryData(&nativeHeader.VersionInfo, m_pVersionInfo); SetDirectoryData(&nativeHeader.Dependencies, m_pDependencies); diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index 073367d..7dce3af 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -149,7 +149,6 @@ void ZapImage::InitializeSections() m_pStubDispatchDataSection->Place(m_pStubDispatchDataTable); m_pImportTable = new (GetHeap()) ZapImportTable(this); - m_pImportTableSection->Place(m_pImportTable); m_pGCInfoTable = new (GetHeap()) ZapGCInfoTable(this); m_pExceptionInfoLookupTable = new (GetHeap()) ZapExceptionInfoLookupTable(this); @@ -229,7 +228,6 @@ void ZapImage::InitializeSectionsForReadyToRun() } m_pImportTable = new (GetHeap()) ZapImportTable(this); - m_pImportTableSection->Place(m_pImportTable); for (int i=0; im_dynamicInfoDelayListSize, m_pDelayLoadInfoDelayListSectionHot); ACCUM_SIZE(m_stats->m_dynamicInfoDelayListSize, m_pDelayLoadInfoDelayListSectionCold); - ACCUM_SIZE(m_stats->m_importTableSize, m_pImportTable); - ACCUM_SIZE(m_stats->m_debuggingTableSize, m_pDebugSection); ACCUM_SIZE(m_stats->m_headerSectionSize, m_pGCSection); ACCUM_SIZE(m_stats->m_codeSectionSize, m_pHotCodeSection); diff --git a/src/zap/zapimport.cpp b/src/zap/zapimport.cpp index e35d0b9..7b847e9 100644 --- a/src/zap/zapimport.cpp +++ b/src/zap/zapimport.cpp @@ -26,22 +26,6 @@ const DWORD READYTORUN_HELPER_FLAG_VSD = 0x10000000; // ZapImportTable // -void ZapImportTable::Save(ZapWriter * pZapWriter) -{ - for (COUNT_T i = 0; i < m_modules.GetCount(); i++) - { - ModuleReferenceEntry * pModuleReference = m_modules[i]; - _ASSERTE(pModuleReference != NULL); - - CORCOMPILE_IMPORT_TABLE_ENTRY entry; - - entry.wAssemblyRid = pModuleReference->m_wAssemblyRid; - entry.wModuleRid = pModuleReference->m_wModuleRid; - - pZapWriter->Write(&entry, sizeof(entry)); - } -} - ZapImportTable::ModuleReferenceEntry * ZapImportTable::GetModuleReference(CORINFO_MODULE_HANDLE handle) { ModuleReferenceEntry * pEntry = m_moduleReferences.Lookup(handle); @@ -59,18 +43,9 @@ ZapImportTable::ModuleReferenceEntry * ZapImportTable::GetModuleReference(CORINF pEntry = new (m_pImage->GetHeap()) ModuleReferenceEntry(); pEntry->m_module = handle; - DWORD assemblyIndex = 0; - DWORD moduleIndex = 0; - GetCompileInfo()->EncodeModuleAsIndexes(m_pImage->GetModuleHandle(), handle, - &assemblyIndex, &moduleIndex, + GetCompileInfo()->EncodeModuleAsIndex(m_pImage->GetModuleHandle(), handle, + &pEntry->m_index, m_pImage->GetAssemblyEmit()); - _ASSERTE(assemblyIndex <= USHRT_MAX); - _ASSERTE(moduleIndex <= USHRT_MAX); - pEntry->m_wAssemblyRid = (USHORT) assemblyIndex; - pEntry->m_wModuleRid = (USHORT) moduleIndex; - - pEntry->m_index = m_modules.GetCount(); - m_modules.Append(pEntry); m_moduleReferences.Add(pEntry); diff --git a/src/zap/zapimport.h b/src/zap/zapimport.h index 811e0a7..058cb0b 100644 --- a/src/zap/zapimport.h +++ b/src/zap/zapimport.h @@ -143,7 +143,7 @@ public: // // There is a single instance of it per image. // -class ZapImportTable : public ZapNode +class ZapImportTable { // // Hashtable key of the import @@ -203,9 +203,6 @@ class ZapImportTable : public ZapNode { CORINFO_MODULE_HANDLE m_module; DWORD m_index; - - USHORT m_wAssemblyRid; - USHORT m_wModuleRid; }; class ModuleReferenceTraits : public NoRemoveSHashTraits< DefaultSHashTraits > @@ -307,7 +304,6 @@ class ZapImportTable : public ZapNode SHash< NoRemoveSHashTraits < ZapBlob::SHashTraits > > m_blobs; // Interned ZapBlos for signatures and fixups ModuleReferenceTable m_moduleReferences; - SArray m_modules; // Secondary table of ModuleReferences to allow fast index based lookup SHash< NoRemoveSHashTraits < ZapBlob::SHashTraits > > m_genericSignatures; @@ -446,23 +442,6 @@ public: ZapImport * GetPlacedHelperImport(ReadyToRunHelper helperNum); ZapImport * GetHelperImport(ReadyToRunHelper helperNum); #endif - - virtual DWORD GetSize() - { - return m_modules.GetCount() * sizeof(CORCOMPILE_IMPORT_TABLE_ENTRY); - } - - virtual UINT GetAlignment() - { - return sizeof(DWORD); - } - - virtual ZapNodeType GetType() - { - return ZapNodeType_ImportTable; - } - - virtual void Save(ZapWriter * pZapWriter); }; // diff --git a/src/zap/zapperstats.cpp b/src/zap/zapperstats.cpp index 40c03dd..9add33c 100644 --- a/src/zap/zapperstats.cpp +++ b/src/zap/zapperstats.cpp @@ -107,7 +107,6 @@ ZapperStats::ZapperStats() , m_helperTableSize( 0 ) , m_dynamicInfoTableSize( 0 ) , m_dynamicInfoDelayListSize( 0 ) - , m_importTableSize( 0 ) , m_debuggingTableSize( 0 ) , m_headerSectionSize( 0 ) , m_codeSectionSize( 0 ) @@ -156,8 +155,7 @@ void ZapperStats::PrintStats() m_dynamicInfoDelayListSize + m_eeInfoTableSize + m_helperTableSize + - m_dynamicInfoTableSize + - m_importTableSize; + m_dynamicInfoTableSize; GetSvcLogger()->Printf( "Indirections: %8d\t%8.2f%%\n", totalIndirections, (double)totalIndirections/m_outputFileSize*100); diff --git a/src/zap/zapperstats.h b/src/zap/zapperstats.h index 2de4ca3..0d13724 100644 --- a/src/zap/zapperstats.h +++ b/src/zap/zapperstats.h @@ -66,7 +66,6 @@ class ZapperStats unsigned m_helperTableSize; unsigned m_dynamicInfoTableSize; unsigned m_dynamicInfoDelayListSize; - unsigned m_importTableSize; unsigned m_debuggingTableSize; unsigned m_headerSectionSize; unsigned m_codeSectionSize; -- 2.7.4