@@ -5953,38 +5953,26 @@ static void GetFuncletStartOffsetsHelper(PCODE pCodeStart, SIZE_T size, SIZE_T o
59535953// pRtf: The target function table entry to be located
59545954// pNativeLayout: A pointer to the loaded native layout for the module containing pRtf
59555955//
5956- static void EnumRuntimeFunctionEntriesToFindEntry (PTR_RUNTIME_FUNCTION pRtf, PTR_PEImageLayout pNativeLayout )
5956+ static void EnumRuntimeFunctionEntriesToFindEntry (PTR_RUNTIME_FUNCTION pRtf, PTR_RUNTIME_FUNCTION pFirstFunctionEntry, UINT32 numFunctionEntries )
59575957{
59585958 pRtf.EnumMem ();
59595959
5960- if (pNativeLayout == NULL )
5960+ if (pFirstFunctionEntry == NULL || numFunctionEntries == 0 )
59615961 {
59625962 return ;
59635963 }
59645964
5965- IMAGE_DATA_DIRECTORY * pProgramExceptionsDirectory = pNativeLayout->GetDirectoryEntry (IMAGE_DIRECTORY_ENTRY_EXCEPTION);
5966- if (!pProgramExceptionsDirectory ||
5967- (pProgramExceptionsDirectory->Size == 0 ) ||
5968- (pProgramExceptionsDirectory->Size % sizeof (T_RUNTIME_FUNCTION) != 0 ))
5965+ if (pRtf < pFirstFunctionEntry ||
5966+ ((dac_cast<TADDR>(pRtf) - dac_cast<TADDR>(pFirstFunctionEntry)) % sizeof (T_RUNTIME_FUNCTION) != 0 ))
59695967 {
5970- // Program exceptions directory malformatted
5968+ // Runtime function table is malformed.
59715969 return ;
59725970 }
59735971
5974- PTR_BYTE moduleBase (pNativeLayout->GetBase ());
5975- PTR_RUNTIME_FUNCTION firstFunctionEntry (moduleBase + pProgramExceptionsDirectory->VirtualAddress );
5976-
5977- if (pRtf < firstFunctionEntry ||
5978- ((dac_cast<TADDR>(pRtf) - dac_cast<TADDR>(firstFunctionEntry)) % sizeof (T_RUNTIME_FUNCTION) != 0 ))
5979- {
5980- // Program exceptions directory malformatted
5981- return ;
5982- }
5983-
5984- UINT_PTR indexToLocate = pRtf - firstFunctionEntry;
5972+ UINT_PTR indexToLocate = pRtf - pFirstFunctionEntry;
59855973
59865974 UINT_PTR low = 0 ; // index in the function entry table of low end of search range
5987- UINT_PTR high = (pProgramExceptionsDirectory-> Size ) / sizeof (T_RUNTIME_FUNCTION) - 1 ; // index of high end of search range
5975+ UINT_PTR high = numFunctionEntries - 1 ; // index of high end of search range
59885976 UINT_PTR mid = (low + high) / 2 ; // index of entry to be compared
59895977
59905978 if (indexToLocate > high)
@@ -5994,7 +5982,7 @@ static void EnumRuntimeFunctionEntriesToFindEntry(PTR_RUNTIME_FUNCTION pRtf, PTR
59945982
59955983 while (indexToLocate != mid)
59965984 {
5997- PTR_RUNTIME_FUNCTION functionEntry = firstFunctionEntry + mid;
5985+ PTR_RUNTIME_FUNCTION functionEntry = pFirstFunctionEntry + mid;
59985986 functionEntry.EnumMem ();
59995987 if (indexToLocate > mid)
60005988 {
@@ -6220,7 +6208,7 @@ ReadyToRunJitManager::ReadyToRunJitManager()
62206208
62216209#endif // #ifndef DACCESS_COMPILE
62226210
6223- ReadyToRunInfo * ReadyToRunJitManager::JitTokenToReadyToRunInfo (const METHODTOKEN& MethodToken)
6211+ PTR_ReadyToRunInfo ReadyToRunJitManager::JitTokenToReadyToRunInfo (const METHODTOKEN& MethodToken)
62246212{
62256213 CONTRACTL {
62266214 NOTHROW;
@@ -6873,8 +6861,8 @@ void ReadyToRunJitManager::EnumMemoryRegionsForMethodUnwindInfo(CLRDataEnumMemor
68736861 }
68746862
68756863 // Enumerate the function entry and other entries needed to locate it in the program exceptions directory
6876- ReadyToRunInfo * pReadyToRunInfo = JitTokenToReadyToRunInfo (pCodeInfo->GetMethodToken ());
6877- EnumRuntimeFunctionEntriesToFindEntry (pRtf, pReadyToRunInfo->GetImage () );
6864+ PTR_ReadyToRunInfo pReadyToRunInfo = JitTokenToReadyToRunInfo (pCodeInfo->GetMethodToken ());
6865+ EnumRuntimeFunctionEntriesToFindEntry (pRtf, pReadyToRunInfo->m_pRuntimeFunctions , pReadyToRunInfo-> m_nRuntimeFunctions );
68786866
68796867 SIZE_T size;
68806868 PTR_VOID pUnwindData = GetUnwindDataBlob (pCodeInfo->GetModuleBase (), pRtf, &size);
0 commit comments