diff --git a/src/coreclr/vm/precode.cpp b/src/coreclr/vm/precode.cpp index bafa39a9a9104a..12de5e49105349 100644 --- a/src/coreclr/vm/precode.cpp +++ b/src/coreclr/vm/precode.cpp @@ -10,6 +10,7 @@ #include "common.h" #include "dllimportcallback.h" +#include "../interpreter/interpretershared.h" #ifdef FEATURE_PERFMAP #include "perfmap.h" @@ -158,7 +159,7 @@ MethodDesc* Precode::GetMethodDesc(BOOL fSpeculative /*= FALSE*/) break; #ifdef FEATURE_INTERPRETER case PRECODE_INTERPRETER: - return NULL; + pMD = AsInterpreterPrecode()->GetMethodDesc(); break; #endif // FEATURE_INTERPRETER @@ -180,6 +181,16 @@ MethodDesc* Precode::GetMethodDesc(BOOL fSpeculative /*= FALSE*/) return (PTR_MethodDesc)pMD; } +#ifdef FEATURE_INTERPRETER +TADDR InterpreterPrecode::GetMethodDesc() +{ + LIMITED_METHOD_DAC_CONTRACT; + + InterpByteCodeStart* pInterpreterCode = dac_cast(GetData()->ByteCodeAddr); + return (TADDR)pInterpreterCode->Method->methodHnd; +} +#endif // FEATURE_INTERPRETER + BOOL Precode::IsPointingToPrestub(PCODE target) { CONTRACTL diff --git a/src/coreclr/vm/precode.h b/src/coreclr/vm/precode.h index 6a5abf0e099de6..8e96b3064c4ecc 100644 --- a/src/coreclr/vm/precode.h +++ b/src/coreclr/vm/precode.h @@ -335,7 +335,12 @@ struct InterpreterPrecode LIMITED_METHOD_CONTRACT; return (InterpreterPrecode*)PCODEToPINSTR(entryPoint); } + + TADDR GetMethodDesc(); }; + +typedef DPTR(InterpreterPrecode) PTR_InterpreterPrecode; + #endif // FEATURE_INTERPRETER #ifdef HAS_FIXUP_PRECODE @@ -593,6 +598,16 @@ class Precode { } #endif // HAS_THISPTR_RETBUF_PRECODE +#ifdef FEATURE_INTERPRETER + InterpreterPrecode* AsInterpreterPrecode() + { + LIMITED_METHOD_CONTRACT; + SUPPORTS_DAC; + + return dac_cast(this); + } +#endif // FEATURE_INTERPRETER + TADDR GetStart() { SUPPORTS_DAC;