diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 0fa75ad43cf054..ba645532c83a5d 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -1141,7 +1141,8 @@ void DacDbiInterfaceImpl::GetMethodRegionInfo(MethodDesc * pMethodDe codeInfo.GetMethodRegionInfo(&methodRegionInfo); // now get the rest of the region information - pCodeInfo->m_rgCodeRegions[kHot].cbSize = (ULONG)methodRegionInfo.hotSize; + pCodeInfo->m_rgCodeRegions[kHot].Init(PCODEToPINSTR(methodRegionInfo.hotStartAddress), + (ULONG)methodRegionInfo.hotSize); pCodeInfo->m_rgCodeRegions[kCold].Init(PCODEToPINSTR(methodRegionInfo.coldStartAddress), (ULONG)methodRegionInfo.coldSize); _ASSERTE(pCodeInfo->IsValid()); diff --git a/src/coreclr/debug/daccess/task.cpp b/src/coreclr/debug/daccess/task.cpp index edbb360a988c36..2dae6a9b2cf16c 100644 --- a/src/coreclr/debug/daccess/task.cpp +++ b/src/coreclr/debug/daccess/task.cpp @@ -4341,9 +4341,10 @@ ClrDataMethodInstance::GetRepresentativeEntryAddress( EX_TRY { - if (m_methodDesc->HasNativeCode()) + PCODE codeAddr = m_methodDesc->GetNativeCode(); + if (codeAddr != NULL) { - *addr = TO_CDADDR(m_methodDesc->GetNativeCode()); + *addr = TO_CDADDR(codeAddr); status = S_OK; } else diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index 2ab23dfad1bbbf..ae0e9556e45610 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -4415,20 +4415,6 @@ TADDR MethodAndStartAddressToEECodeInfoPointer(MethodDesc *pMethodDesc, PCODE pN return 0; } -#ifdef FEATURE_INTERPRETER - RangeSection * pRS = ExecutionManager::FindCodeRange(PINSTRToPCODE(start), ExecutionManager::GetScanFlags()); - if (pRS != NULL && pRS->_flags & RangeSection::RANGE_SECTION_RANGELIST) - { - if (pRS->_pRangeList->GetCodeBlockKind() == STUB_CODE_BLOCK_STUBPRECODE) - { - if (((StubPrecode*)start)->GetType() == PRECODE_INTERPRETER) - { - start = ((InterpreterPrecode*)start)->GetData()->ByteCodeAddr; - } - } - } -#endif // FEATURE_INTERPRETER - return start; } diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index 03a3fa0662fc7c..299d1273742fa8 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -15019,6 +15019,23 @@ void EECodeInfo::Init(PCODE codeAddress, ExecutionManager::ScanFlag scanFlag) if (pRS == NULL) goto Invalid; +#ifdef FEATURE_INTERPRETER + if (pRS != NULL && pRS->_flags & RangeSection::RANGE_SECTION_RANGELIST) + { + if (pRS->_pRangeList->GetCodeBlockKind() == STUB_CODE_BLOCK_STUBPRECODE) + { + PTR_StubPrecode pStubPrecode = dac_cast(PCODEToPINSTR(codeAddress)); + if (pStubPrecode->GetType() == PRECODE_INTERPRETER) + { + codeAddress = dac_cast(pStubPrecode)->GetData()->ByteCodeAddr; + pRS = ExecutionManager::FindCodeRange(codeAddress, scanFlag); + if (pRS == NULL) + goto Invalid; + } + } + } +#endif // FEATURE_INTERPRETER + if (!pRS->_pjit->JitCodeToMethodInfo(pRS, codeAddress, &m_pMD, this)) goto Invalid; diff --git a/src/coreclr/vm/method.cpp b/src/coreclr/vm/method.cpp index 349a05ec3c5396..4e4305c6b7eeb1 100644 --- a/src/coreclr/vm/method.cpp +++ b/src/coreclr/vm/method.cpp @@ -2207,7 +2207,8 @@ MethodDesc* NonVirtualEntry2MethodDesc(PCODE entryPoint) } CONTRACTL_END - RangeSection* pRS = ExecutionManager::FindCodeRange(entryPoint, ExecutionManager::GetScanFlags()); + ExecutionManager::ScanFlag scanFlag = ExecutionManager::GetScanFlags(); + RangeSection* pRS = ExecutionManager::FindCodeRange(entryPoint, scanFlag); if (pRS == NULL) { return NULL; @@ -2222,7 +2223,18 @@ MethodDesc* NonVirtualEntry2MethodDesc(PCODE entryPoint) } if (pRS->_pRangeList->GetCodeBlockKind() == STUB_CODE_BLOCK_STUBPRECODE) { - return (MethodDesc*)((StubPrecode*)PCODEToPINSTR(entryPoint))->GetMethodDesc(); + StubPrecode *stubPrecode = (StubPrecode*)PCODEToPINSTR(entryPoint); +#ifdef FEATURE_INTERPRETER + if (stubPrecode->GetType() == PRECODE_INTERPRETER) + { + entryPoint = dac_cast(stubPrecode)->GetData()->ByteCodeAddr; + pRS = ExecutionManager::FindCodeRange(entryPoint, scanFlag); + } + else +#endif // FEATURE_INTERPRETER + { + return (MethodDesc*)(stubPrecode)->GetMethodDesc(); + } } } diff --git a/src/coreclr/vm/multicorejitplayer.cpp b/src/coreclr/vm/multicorejitplayer.cpp index 78d7a53bda3aa5..d315fee1f348ad 100644 --- a/src/coreclr/vm/multicorejitplayer.cpp +++ b/src/coreclr/vm/multicorejitplayer.cpp @@ -967,7 +967,7 @@ void MulticoreJitProfilePlayer::CompileMethodInfoRecord(Module *pModule, MethodD } } - if (pMethod->GetNativeCode() == (PCODE)NULL && !GetAppDomain()->GetMulticoreJitManager().GetMulticoreJitCodeStorage().LookupMethodCode(pMethod)) + if (!pMethod->HasNativeCode() && !GetAppDomain()->GetMulticoreJitManager().GetMulticoreJitCodeStorage().LookupMethodCode(pMethod)) { if (CompileMethodDesc(pModule, pMethod)) {