Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/coreclr/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5425,7 +5425,7 @@ ClrDataAccess::RawGetMethodName(
MethodDesc* methodDesc = NULL;

{
EECodeInfo codeInfo(GetInterpreterCodeFromInterpreterPrecodeIfPresent(TO_TADDR(address)));
EECodeInfo codeInfo(GetInterpreterCodeFromEntryPointIfPresent(TO_TADDR(address)));
if (codeInfo.IsValid())
{
if (displacement)
Expand Down Expand Up @@ -5605,11 +5605,11 @@ ClrDataAccess::GetMethodVarInfo(MethodDesc* methodDesc,
{
return E_INVALIDARG;
}
nativeCodeStartAddr = PCODEToPINSTR(GetInterpreterCodeFromInterpreterPrecodeIfPresent(requestedNativeCodeVersion.GetNativeCode()));
nativeCodeStartAddr = PCODEToPINSTR(GetInterpreterCodeFromEntryPointIfPresent(requestedNativeCodeVersion.GetNativeCode()));
}
else
{
nativeCodeStartAddr = PCODEToPINSTR(GetInterpreterCodeFromInterpreterPrecodeIfPresent(methodDesc->GetNativeCode()));
nativeCodeStartAddr = PCODEToPINSTR(GetInterpreterCodeFromEntryPointIfPresent(methodDesc->GetNativeCode()));
}

DebugInfoRequest request;
Expand Down Expand Up @@ -5664,11 +5664,11 @@ ClrDataAccess::GetMethodNativeMap(MethodDesc* methodDesc,
{
return E_INVALIDARG;
}
nativeCodeStartAddr = PCODEToPINSTR(GetInterpreterCodeFromInterpreterPrecodeIfPresent(requestedNativeCodeVersion.GetNativeCode()));
nativeCodeStartAddr = PCODEToPINSTR(GetInterpreterCodeFromEntryPointIfPresent(requestedNativeCodeVersion.GetNativeCode()));
}
else
{
nativeCodeStartAddr = PCODEToPINSTR(GetInterpreterCodeFromInterpreterPrecodeIfPresent(methodDesc->GetNativeCode()));
nativeCodeStartAddr = PCODEToPINSTR(GetInterpreterCodeFromEntryPointIfPresent(methodDesc->GetNativeCode()));
}

DebugInfoRequest request;
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ HRESULT STDMETHODCALLTYPE DacDbiInterfaceImpl::GetNativeCodeInfoForAddr(CORDB_AD

EX_TRY_ALLOW_DATATARGET_MISSING_MEMORY
{
codeAddr = GetInterpreterCodeFromInterpreterPrecodeIfPresent(codeAddr);
codeAddr = GetInterpreterCodeFromEntryPointIfPresent(codeAddr);
}
EX_END_CATCH_ALLOW_DATATARGET_MISSING_MEMORY;

Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ HRESULT ClrDataAccess::GetThreadData(CLRDATA_ADDRESS threadAddr, struct DacpThre
void CopyNativeCodeVersionToReJitData(NativeCodeVersion nativeCodeVersion, NativeCodeVersion activeCodeVersion, DacpReJitData * pReJitData)
{
pReJitData->rejitID = nativeCodeVersion.GetILCodeVersion().GetVersionId();
pReJitData->NativeCodeAddr = GetInterpreterCodeFromInterpreterPrecodeIfPresent(nativeCodeVersion.GetNativeCode());
pReJitData->NativeCodeAddr = GetInterpreterCodeFromEntryPointIfPresent(nativeCodeVersion.GetNativeCode());

if (nativeCodeVersion != activeCodeVersion)
{
Expand Down Expand Up @@ -1021,7 +1021,7 @@ HRESULT ClrDataAccess::GetMethodDescData(
if (!requestedNativeCodeVersion.IsNull() && requestedNativeCodeVersion.GetNativeCode() != (PCODE)NULL)
{
methodDescData->bHasNativeCode = TRUE;
methodDescData->NativeCodeAddr = TO_CDADDR(PCODEToPINSTR(GetInterpreterCodeFromInterpreterPrecodeIfPresent(requestedNativeCodeVersion.GetNativeCode())));
methodDescData->NativeCodeAddr = TO_CDADDR(PCODEToPINSTR(GetInterpreterCodeFromEntryPointIfPresent(requestedNativeCodeVersion.GetNativeCode())));
}
else
{
Expand Down Expand Up @@ -1245,7 +1245,7 @@ HRESULT ClrDataAccess::GetTieredVersions(
int count = 0;
for (NativeCodeVersionIterator iter = nativeCodeVersions.Begin(); iter != nativeCodeVersions.End(); iter++)
{
TADDR pNativeCode = PCODEToPINSTR(GetInterpreterCodeFromInterpreterPrecodeIfPresent((*iter).GetNativeCode()));
TADDR pNativeCode = PCODEToPINSTR(GetInterpreterCodeFromEntryPointIfPresent((*iter).GetNativeCode()));
nativeCodeAddrs[count].NativeCodeAddr = pNativeCode;
PTR_NativeCodeVersionNode pNode = (*iter).AsNode();
nativeCodeAddrs[count].NativeCodeVersionNodePtr = PTR_CDADDR(pNode);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/debug/ee/functioninfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ void DebuggerMethodInfo::CreateDJIsForMethodDesc(MethodDesc * pMethodDesc)
{
// Some versions may not be compiled yet - skip those for now
// if they compile later the JitCompiled callback will add a DJI to our cache at that time
PCODE codeAddr = GetInterpreterCodeFromInterpreterPrecodeIfPresent(itr->GetNativeCode());
PCODE codeAddr = GetInterpreterCodeFromEntryPointIfPresent(itr->GetNativeCode());
LOG((LF_CORDB, LL_INFO10000, "DMI::CDJIFMD (%d) Native code for DJI - %p\n", ++count, codeAddr));
if (codeAddr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/eventtrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4417,7 +4417,7 @@ TADDR MethodAndStartAddressToEECodeInfoPointer(MethodDesc *pMethodDesc, PCODE pN
return 0;
}

return GetInterpreterCodeFromInterpreterPrecodeIfPresent(start);
return GetInterpreterCodeFromEntryPointIfPresent(start);
}

/****************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/method.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,7 @@ class MethodDesc
PCODE GetCodeForInterpreterOrJitted()
{
WRAPPER_NO_CONTRACT;
return GetInterpreterCodeFromInterpreterPrecodeIfPresent(GetNativeCode());
return GetInterpreterCodeFromEntryPointIfPresent(GetNativeCode());
}

// Returns GetNativeCode() if it exists, but also checks to see if there
Expand Down
32 changes: 23 additions & 9 deletions src/coreclr/vm/precode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -959,32 +959,46 @@ BOOL StubPrecode::IsStubPrecodeByASM(PCODE addr)

#endif // !FEATURE_PORTABLE_ENTRYPOINTS

TADDR GetInterpreterCodeFromInterpreterPrecodeIfPresent(TADDR codePointerMaybeInterpreterStub)
TADDR GetInterpreterCodeFromEntryPointIfPresent(TADDR entryPoint)
{
CONTRACTL {
NOTHROW;
GC_NOTRIGGER;
SUPPORTS_DAC;
} CONTRACTL_END;
#if defined(FEATURE_INTERPRETER) && !defined(FEATURE_PORTABLE_ENTRYPOINTS)
if (codePointerMaybeInterpreterStub == (TADDR)NULL)

Comment thread
pavelsavara marked this conversation as resolved.
#ifdef FEATURE_INTERPRETER
if (entryPoint == (TADDR)NULL)
{
return (TADDR)NULL;
}

RangeSection * pRS = ExecutionManager::FindCodeRange(codePointerMaybeInterpreterStub, ExecutionManager::GetScanFlags());
RangeSection * pRS = ExecutionManager::FindCodeRange(entryPoint, ExecutionManager::GetScanFlags());

#ifdef FEATURE_PORTABLE_ENTRYPOINTS
if (pRS == NULL)
{
// Address not in any code range - this is a portable entry point.
Comment thread
jkotas marked this conversation as resolved.
MethodDesc* pMD = PortableEntryPoint::GetMethodDesc((PCODE)entryPoint);
PTR_InterpByteCodeStart pInterpCode = pMD->GetInterpreterCode();
if (pInterpCode != NULL)
{
entryPoint = dac_cast<TADDR>(pInterpCode);
}
}
Comment thread
pavelsavara marked this conversation as resolved.
#else // !FEATURE_PORTABLE_ENTRYPOINTS
if (pRS != NULL && pRS->_flags & RangeSection::RANGE_SECTION_RANGELIST)
Comment thread
jkotas marked this conversation as resolved.
{
if (pRS->_pRangeList->GetCodeBlockKind() == STUB_CODE_BLOCK_STUBPRECODE)
{
if (dac_cast<PTR_StubPrecode>(PCODEToPINSTR(codePointerMaybeInterpreterStub))->GetType() == PRECODE_INTERPRETER)
if (dac_cast<PTR_StubPrecode>(PCODEToPINSTR(entryPoint))->GetType() == PRECODE_INTERPRETER)
{
codePointerMaybeInterpreterStub = (dac_cast<PTR_InterpreterPrecode>(PCODEToPINSTR(codePointerMaybeInterpreterStub)))->GetData()->ByteCodeAddr;
entryPoint = (dac_cast<PTR_InterpreterPrecode>(PCODEToPINSTR(entryPoint)))->GetData()->ByteCodeAddr;
}
}
}
#endif
#endif // FEATURE_PORTABLE_ENTRYPOINTS
#endif // FEATURE_INTERPRETER

return codePointerMaybeInterpreterStub;
return entryPoint;
}
2 changes: 1 addition & 1 deletion src/coreclr/vm/precode.h
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,6 @@ extern InterleavedLoaderHeapConfig s_fixupStubPrecodeHeapConfig;

#endif // FEATURE_PORTABLE_ENTRYPOINTS

TADDR GetInterpreterCodeFromInterpreterPrecodeIfPresent(TADDR codePointerMaybeInterpreterStub);
TADDR GetInterpreterCodeFromEntryPointIfPresent(TADDR entryPoint);

Comment thread
pavelsavara marked this conversation as resolved.
#endif // __PRECODE_H__
10 changes: 8 additions & 2 deletions src/coreclr/vm/prestub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,9 +809,15 @@ PCODE MethodDesc::JitCompileCodeLockedEventWrapper(PrepareCodeConfig* pConfig, J
#ifdef FEATURE_INTERPRETER
if (isInterpreterCode)
{
// If this is interpreter code, we need to get the native code start address from the interpreter Precode
// If this is interpreter code, get the native code start address from the
// interpreter entrypoint data: PortableEntryPoint interpreter data when
// FEATURE_PORTABLE_ENTRYPOINTS is enabled, otherwise the interpreter Precode.
#ifdef FEATURE_PORTABLE_ENTRYPOINTS
InterpByteCodeStart* interpreterCode = (InterpByteCodeStart*)PortableEntryPoint::GetInterpreterData(pCode);
#else // !FEATURE_PORTABLE_ENTRYPOINTS
InterpreterPrecode* pPrecode = InterpreterPrecode::FromEntryPoint(pCode);
InterpByteCodeStart* interpreterCode = dac_cast<InterpByteCodeStart*>(pPrecode->GetData()->ByteCodeAddr);
#endif // FEATURE_PORTABLE_ENTRYPOINTS
pNativeCodeStartAddress = PINSTRToPCODE(dac_cast<TADDR>(interpreterCode));
}
#endif // FEATURE_INTERPRETER
Expand Down Expand Up @@ -2540,7 +2546,7 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT, CallerGCMode callerGCMo
// Check to see if the entrypoint is into the interpreter. If so, grab the interpreter codes from the stub and put that directly
// into the MethodDesc
TADDR functionAddress = GetOrCreatePrecode()->GetTarget();
TADDR byteCodeStartOrFunctionAddress = GetInterpreterCodeFromInterpreterPrecodeIfPresent(functionAddress);
TADDR byteCodeStartOrFunctionAddress = GetInterpreterCodeFromEntryPointIfPresent(functionAddress);
if (byteCodeStartOrFunctionAddress != functionAddress)
{
// Then we must have an InterpByteCodeStart
Expand Down
Loading