Repository: dotnet/runtime
File: src/coreclr/vm/method.cpp (C++)

Code before:
        {
            methodEntryPoint = GetMethodEntryPointIfExists();
            return methodEntryPoint == (PCODE)NULL
                || methodEntryPoint == GetTemporaryEntryPointIfExists();
        }
        return TRUE;
    }

#ifdef FEATURE_PORTABLE_ENTRYPOINTS
    methodEntryPoint = GetStableEntryPoint();
    return methodEntryPoint == (PCODE)NULL
        || (!PortableEntryPoint::HasInterpreterData(methodEntryPoint)
            && !PortableEntryPoint::HasNativeEntryPoint(methodEntryPoint));

#else // !FEATURE_PORTABLE_ENTRYPOINTS
    if (!HasPrecode())
        return FALSE;

    return GetPrecode()->IsPointingToPrestub();
#endif // FEATURE_PORTABLE_ENTRYPOINTS
}

#ifdef FEATURE_PORTABLE_ENTRYPOINTS
void MethodDesc::ResetPortableEntryPoint()
{
    PCODE tempEntry = GetTemporaryEntryPointIfExists();
    if (tempEntry != (PCODE)NULL)
    {
        PortableEntryPoint* pep = PortableEntryPoint::ToPortableEntryPoint(tempEntry);
        pep->Init(this);  // Re-initializes: clears _pActualCode, _pInterpreterData, _flags
    }
}
#endif // FEATURE_PORTABLE_ENTRYPOINTS

//*******************************************************************************
void MethodDesc::Reset()
{
    WRAPPER_NO_CONTRACT;

    // This method is not thread-safe since we are updating
    // different pieces of data non-atomically.
    // Use this only if you can guarantee thread-safety somehow.

    _ASSERTE(InEnCEnabledModule() || // The process is frozen by the debugger
             IsDynamicMethod() || // These are used in a very restricted way
             GetLoaderModule()->IsReflectionEmit()); // Rental methods

    // Reset any flags relevant to the old code
    ClearFlagsOnUpdate();

#ifdef FEATURE_PORTABLE_ENTRYPOINTS

Review comment (suggestion):
If this is needed, please create a `GetPortableEntryPointIfExists()`. All these methods should be in the same block/area. Ideally this would be define after the `GetPortableEntryPoint()` in how it was defined in the header. Keeping the functions in the same order is a big benefit for searching for things in general.

Code after:
        {
            methodEntryPoint = GetMethodEntryPointIfExists();
            return methodEntryPoint == (PCODE)NULL
                || methodEntryPoint == GetTemporaryEntryPointIfExists();
        }
        return TRUE;
    }

#ifdef FEATURE_PORTABLE_ENTRYPOINTS
    methodEntryPoint = GetStableEntryPoint();
    return methodEntryPoint == (PCODE)NULL
        || (!PortableEntryPoint::HasInterpreterData(methodEntryPoint)
            && !PortableEntryPoint::HasNativeEntryPoint(methodEntryPoint));

#else // !FEATURE_PORTABLE_ENTRYPOINTS
    if (!HasPrecode())
        return FALSE;

    return GetPrecode()->IsPointingToPrestub();
#endif // FEATURE_PORTABLE_ENTRYPOINTS
}

//*******************************************************************************
void MethodDesc::Reset()
{
    WRAPPER_NO_CONTRACT;

    // This method is not thread-safe since we are updating
    // different pieces of data non-atomically.
    // Use this only if you can guarantee thread-safety somehow.

    _ASSERTE(InEnCEnabledModule() || // The process is frozen by the debugger
             IsDynamicMethod() || // These are used in a very restricted way
             GetLoaderModule()->IsReflectionEmit()); // Rental methods

    // Reset any flags relevant to the old code
    ClearFlagsOnUpdate();

#ifdef FEATURE_PORTABLE_ENTRYPOINTS
    ResetPortableEntryPoint();
#else // !FEATURE_PORTABLE_ENTRYPOINTS
    _ASSERTE(HasPrecode());
    GetPrecode()->Reset();
#endif // FEATURE_PORTABLE_ENTRYPOINTS

    if (HasNativeCodeSlot())
    {
        *GetAddrOfNativeCodeSlot() = (PCODE)NULL;
    }

#ifdef FEATURE_INTERPRETER