Skip to content

Commit

Permalink
Rename EnC related defines (#91146)
Browse files Browse the repository at this point in the history
* Rename FEATURE_ENC_SUPPORTED and EnC_SUPPORTED
  • Loading branch information
AaronRobinsonMSFT committed Aug 26, 2023
1 parent b09764f commit 93552a3
Show file tree
Hide file tree
Showing 41 changed files with 168 additions and 168 deletions.
4 changes: 2 additions & 2 deletions src/coreclr/clrdefinitions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ if(CLR_CMAKE_HOST_WIN32)
endif(CLR_CMAKE_HOST_WIN32)

if (NOT (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_UNIX))
add_compile_definitions(EnC_SUPPORTED)
add_compile_definitions(FEATURE_METADATA_UPDATER)
endif()
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_WIN32))
add_compile_definitions(FEATURE_ENC_SUPPORTED)
add_compile_definitions(FEATURE_REMAP_FUNCTION)
endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR (CLR_CMAKE_TARGET_ARCH_I386 AND CLR_CMAKE_TARGET_WIN32))

if(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_AMD64)
Expand Down
22 changes: 11 additions & 11 deletions src/coreclr/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ void DacDbiInterfaceImpl::GetCompilerFlags (
bool DacDbiInterfaceImpl::CanSetEnCBits(Module * pModule)
{
_ASSERTE(pModule != NULL);
#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
// If we're using explicit sequence points (from the PDB), then we can't do EnC
// because EnC won't get updated pdbs and so the sequence points will be wrong.
bool fIgnorePdbs = ((pModule->GetDebuggerInfoBits() & DACF_IGNORE_PDBS) != 0);
Expand All @@ -736,7 +736,7 @@ bool DacDbiInterfaceImpl::CanSetEnCBits(Module * pModule)
!CORProfilerPresent() && // this queries target
#endif
fIgnorePdbs;
#else // ! EnC_SUPPORTED
#else // ! FEATURE_METADATA_UPDATER
// Enc not supported on any other platforms.
bool fAllowEnc = false;
#endif
Expand Down Expand Up @@ -1517,7 +1517,7 @@ unsigned int DacDbiInterfaceImpl::GetTotalFieldCount(TypeHandle thApprox)
unsigned int IFCount = pMT->GetNumIntroducedInstanceFields();
unsigned int SFCount = pMT->GetNumStaticFields();

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
PTR_Module pModule = pMT->GetModule();

// Stats above don't include EnC fields. So add them now.
Expand Down Expand Up @@ -1612,7 +1612,7 @@ void DacDbiInterfaceImpl::ComputeFieldData(PTR_FieldDesc pFD,
{
pCurrentFieldData->Initialize(pFD->IsStatic(), pFD->IsPrimitive(), pFD->GetMemberDef());

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
// If the field was newly introduced via EnC, and hasn't yet
// been fixed up, then we'll send back a marker indicating
// that it isn't yet available.
Expand All @@ -1627,7 +1627,7 @@ void DacDbiInterfaceImpl::ComputeFieldData(PTR_FieldDesc pFD,
pCurrentFieldData->m_fFldIsCollectibleStatic = FALSE;
}
else
#endif // EnC_SUPPORTED
#endif // FEATURE_METADATA_UPDATER
{
// Otherwise, we'll compute the info & send it back.
pCurrentFieldData->m_fFldStorageAvailable = TRUE;
Expand Down Expand Up @@ -3934,7 +3934,7 @@ FieldDesc * DacDbiInterfaceImpl::GetEnCFieldDesc(const EnCHangingFieldInfo * pEn
//-----------------------------------------------------------------------------
PTR_CBYTE DacDbiInterfaceImpl::GetPtrToEnCField(FieldDesc * pFD, const EnCHangingFieldInfo * pEnCFieldInfo)
{
#ifndef EnC_SUPPORTED
#ifndef FEATURE_METADATA_UPDATER
_ASSERTE(!"Trying to get the address of an EnC field where EnC is not supported! ");
return NULL;
#else
Expand Down Expand Up @@ -3971,7 +3971,7 @@ PTR_CBYTE DacDbiInterfaceImpl::GetPtrToEnCField(FieldDesc * pFD, const EnCHangin
ThrowHR(CORDBG_E_ENC_HANGING_FIELD);
}
return pORField;
#endif // EnC_SUPPORTED
#endif // FEATURE_METADATA_UPDATER
} // DacDbiInterfaceImpl::GetPtrToEnCField

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -4047,11 +4047,11 @@ void DacDbiInterfaceImpl::GetEnCHangingFieldInfo(const EnCHangingFieldInfo * pEn
_ASSERTE(pFD->IsEnCNew()); // We shouldn't be here if it wasn't added to an
// already loaded class.

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
pORField = GetPtrToEnCField(pFD, pEnCFieldInfo);
#else
_ASSERTE(!"We shouldn't be here: EnC not supported");
#endif // EnC_SUPPORTED
#endif // FEATURE_METADATA_UPDATER

InitFieldData(pFD, pORField, pEnCFieldInfo, pFieldData);
*pfStatic = (pFD->IsStatic() != 0);
Expand Down Expand Up @@ -4237,7 +4237,7 @@ HRESULT DacDbiInterfaceImpl::IsModuleMapped(VMPTR_Module pModule, OUT BOOL *isMo
bool DacDbiInterfaceImpl::MetadataUpdatesApplied()
{
DD_ENTER_MAY_THROW;
#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
return g_metadataUpdatesApplied;
#else
return false;
Expand Down Expand Up @@ -7424,7 +7424,7 @@ HRESULT DacDbiInterfaceImpl::AreOptimizationsDisabled(VMPTR_Module vmModule, mdM
#else
pOptimizationsDisabled->SetDacTargetPtr(0);
#endif

return S_OK;
}

Expand Down
20 changes: 10 additions & 10 deletions src/coreclr/debug/di/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ CordbFunction * CordbModule::CreateFunction(mdMethodDef funcMetaDataToken, SIZE_
return pCopy;
}

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
//---------------------------------------------------------------------------------------
//
// Creates a new CordbFunction object to represent this new version of a function and
Expand Down Expand Up @@ -1929,7 +1929,7 @@ HRESULT CordbModule::UpdateFunction(mdMethodDef funcMetaDataToken,

return hr;
}
#endif // EnC_SUPPORTED
#endif // FEATURE_METADATA_UPDATER


HRESULT CordbModule::LookupOrCreateClass(mdTypeDef classMetaDataToken,CordbClass** ppClass)
Expand Down Expand Up @@ -2158,7 +2158,7 @@ HRESULT CordbModule::ApplyChanges(ULONG cbMetaData,
FAIL_IF_NEUTERED(this);
ATT_REQUIRE_STOPPED_MAY_FAIL(GetProcess());

#ifdef FEATURE_ENC_SUPPORTED
#ifdef FEATURE_REMAP_FUNCTION
// We enable EnC back in code:CordbModule::SetJITCompilerFlags.
// If EnC isn't enabled, then we'll fail in the LS when we try to ApplyChanges.
// We'd expect a well-behaved debugger to never actually land here.
Expand Down Expand Up @@ -2274,7 +2274,7 @@ HRESULT CordbModule::ApplyChangesInternal(ULONG cbMetaData,
if (m_vmDomainAssembly.IsNull())
return E_UNEXPECTED;

#ifdef FEATURE_ENC_SUPPORTED
#ifdef FEATURE_REMAP_FUNCTION
HRESULT hr;

void * pRemoteBuf = NULL;
Expand Down Expand Up @@ -2394,9 +2394,9 @@ HRESULT CordbModule::ApplyChangesInternal(ULONG cbMetaData,
TESTANDRETURNHR(hr2);
}
return hr;
#else // FEATURE_ENC_SUPPORTED
#else // FEATURE_REMAP_FUNCTION
return E_NOTIMPL;
#endif // FEATURE_ENC_SUPPORTED
#endif // FEATURE_REMAP_FUNCTION

}

Expand Down Expand Up @@ -3078,9 +3078,9 @@ HRESULT CordbCode::GetVersionNumber( ULONG32 *nVersion)

*nVersion = (ULONG32)m_nVersion;

#ifndef EnC_SUPPORTED
#ifndef FEATURE_METADATA_UPDATER
_ASSERTE(*nVersion == 1);
#endif // EnC_SUPPORTED
#endif // FEATURE_METADATA_UPDATER

return S_OK;
}
Expand Down Expand Up @@ -3114,7 +3114,7 @@ CordbILCode::CordbILCode(CordbFunction * pFunction,
mdSignature localVarSigToken,
UINT_PTR id)
: CordbCode(pFunction, id, nVersion, TRUE),
#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
m_fIsOld(FALSE),
#endif
m_codeRegionInfo(codeRegionInfo),
Expand All @@ -3123,7 +3123,7 @@ CordbILCode::CordbILCode(CordbFunction * pFunction,
} // CordbILCode::CordbILCode


#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
//-----------------------------------------------------------------------------
// CordbILCode::MakeOld
// Internal method to perform any cleanup necessary when a code blob is no longer
Expand Down
10 changes: 5 additions & 5 deletions src/coreclr/debug/di/rsfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ HRESULT CordbFunction::CreateBreakpoint(ICorDebugFunctionBreakpoint **ppBreakpoi
return hr;
}

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
//-----------------------------------------------------------------------------
// CordbFunction::MakeOld
// Internal method to do any cleanup necessary when a Function is no longer
Expand Down Expand Up @@ -501,7 +501,7 @@ HRESULT CordbFunction::GetCurrentVersionNumber(ULONG32 *pnCurrentVersion)

*pnCurrentVersion = (ULONG32)(curFunc->m_dwEnCVersionNumber);

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
_ASSERTE( *pnCurrentVersion >= this->m_dwEnCVersionNumber );
#else
_ASSERTE(*pnCurrentVersion == CorDB_DEFAULT_ENC_FUNCTION_VERSION);
Expand Down Expand Up @@ -536,7 +536,7 @@ HRESULT CordbFunction::GetVersionNumber(ULONG32 *pnVersion)

*pnVersion = (ULONG32)m_dwEnCVersionNumber;

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
_ASSERTE(*pnVersion >= CorDB_DEFAULT_ENC_FUNCTION_VERSION);
#else
_ASSERTE(*pnVersion == CorDB_DEFAULT_ENC_FUNCTION_VERSION);
Expand Down Expand Up @@ -616,7 +616,7 @@ HRESULT CordbFunction::CreateNativeBreakpoint(ICorDebugFunctionBreakpoint **ppBr
// Triggers a new JIT so the next time the function is called, it will be unoptimized.
//
// Parameters
//
//
//
// Returns:
// S_OK on success.
Expand Down Expand Up @@ -656,7 +656,7 @@ HRESULT CordbFunction::DisableOptimizations()
//
// Parameters:
// BOOL *pOptimizationsDisabled
//
//
//
// Returns:
// S_OK on success.
Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/debug/di/rspriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -5120,13 +5120,13 @@ class CordbClass : public CordbBase, public ICorDebugClass, public ICorDebugClas
mdFieldDef fieldDef);
mdTypeDef GetTypeDef() { return (mdTypeDef)m_id; }

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
// when we get an added field or method, mark the class to force re-init when we access it
void MakeOld()
{
m_loadLevel = Constructed;
}
#endif // EnC_SUPPORTED
#endif // FEATURE_METADATA_UPDATER

//-----------------------------------------------------------
// Data members
Expand Down Expand Up @@ -5458,7 +5458,7 @@ class CordbFunction : public CordbBase,
CordbReJitILCode** ppILCode);


#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
void MakeOld();
#endif

Expand Down Expand Up @@ -5755,9 +5755,9 @@ class CordbILCode : public CordbCode
// get total size of the IL code
ULONG32 GetSize() { return m_codeRegionInfo.cbSize; }

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
void MakeOld();
#endif // EnC_SUPPORTED
#endif // FEATURE_METADATA_UPDATER

HRESULT GetLocalVarSig(SigParser *pLocalsSigParser, ULONG *pLocalVarCount);
HRESULT GetLocalVariableType(DWORD dwIndex, const Instantiation * pInst, CordbType ** ppResultType);
Expand All @@ -5775,7 +5775,7 @@ class CordbILCode : public CordbCode
//-----------------------------------------------------------

private:
#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
UINT m_fIsOld : 1; // marks this instance as an old EnC version
bool m_encBreakpointsApplied;
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/debug/di/rsthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8575,10 +8575,10 @@ HRESULT CordbJITILFrame::RemapFunction(ULONG32 nOffset)
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
{
#if !defined(FEATURE_ENC_SUPPORTED)
#if !defined(FEATURE_REMAP_FUNCTION)
ThrowHR(E_NOTIMPL);

#else // FEATURE_ENC_SUPPORTED
#else // FEATURE_REMAP_FUNCTION
// Can only be called on leaf frame.
if (!m_nativeFrame->IsLeafFrame())
{
Expand All @@ -8595,7 +8595,7 @@ HRESULT CordbJITILFrame::RemapFunction(ULONG32 nOffset)
// Tell the left-side to do the remap
hr = m_nativeFrame->m_pThread->SetRemapIP(nOffset);

#endif // FEATURE_ENC_SUPPORTED
#endif // FEATURE_REMAP_FUNCTION
}
PUBLIC_API_END(hr);

Expand Down
20 changes: 10 additions & 10 deletions src/coreclr/debug/ee/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2773,7 +2773,7 @@ DPOSS_ACTION DebuggerController::ScanForTriggers(CORDB_ADDRESS_TYPE *address,
return used;
}

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
// This function will check for an EnC patch at the given address and return
// it if one is there, otherwise it will return NULL.
DebuggerControllerPatch *DebuggerController::GetEnCPatch(const BYTE *address)
Expand Down Expand Up @@ -2822,7 +2822,7 @@ DPOSS_ACTION DebuggerController::ScanForTriggers(CORDB_ADDRESS_TYPE *address,

return NULL;
}
#endif //EnC_SUPPORTED
#endif //FEATURE_METADATA_UPDATER

// DebuggerController::DispatchPatchOrSingleStep - Ask any patches that are active at a given
// address if they want to do anything about the exception that's occurred there. How: For the given
Expand Down Expand Up @@ -2871,7 +2871,7 @@ DPOSS_ACTION DebuggerController::DispatchPatchOrSingleStep(Thread *thread, CONTE

TADDR originalAddress = 0;

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
DebuggerControllerPatch *dcpEnCOriginal = NULL;

// If this sequence point has an EnC patch, we want to process it ahead of any others. If the
Expand Down Expand Up @@ -2912,7 +2912,7 @@ DPOSS_ACTION DebuggerController::DispatchPatchOrSingleStep(Thread *thread, CONTE
LOG((LF_CORDB|LF_ENC,LL_INFO10000, "DC::DPOSS done EnC short-circuit, ignoring\n"));
// if we got here, then the EnC remap opportunity was not taken, so just continue on.
}
#endif // EnC_SUPPORTED
#endif // FEATURE_METADATA_UPDATER

TP_RESULT tpr;

Expand Down Expand Up @@ -3000,7 +3000,7 @@ DPOSS_ACTION DebuggerController::DispatchPatchOrSingleStep(Thread *thread, CONTE
}
}

#if defined EnC_SUPPORTED
#if defined FEATURE_METADATA_UPDATER
Exit:
#endif

Expand All @@ -3009,7 +3009,7 @@ DPOSS_ACTION DebuggerController::DispatchPatchOrSingleStep(Thread *thread, CONTE
// @todo - do we need to get the context again here?
CONTEXT *pCtx = GetManagedLiveCtx(thread);

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
DebuggerControllerPatch *dcpEnCCurrent = GetEnCPatch(dac_cast<PTR_CBYTE>((GetIP(context))));

// we have a new patch if the original was null and the current is non-null. Otherwise we have an old
Expand Down Expand Up @@ -3094,7 +3094,7 @@ void DebuggerController::EnableSingleStep()
m_singleStep = true;
}

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER
// Note that this doesn't tell us if Single Stepping is currently enabled
// at the hardware level (ie, for x86, if (context->EFlags & 0x100), but
// rather, if we WANT single stepping enabled (pThread->m_State &Thread::TS_DebuggerIsStepping)
Expand All @@ -3119,7 +3119,7 @@ BOOL DebuggerController::IsSingleStepEnabled(Thread *pThread)
else
return FALSE;
}
#endif //EnC_SUPPORTED
#endif //FEATURE_METADATA_UPDATER

void DebuggerController::EnableSingleStep(Thread *pThread)
{
Expand Down Expand Up @@ -8627,7 +8627,7 @@ bool DebuggerFuncEvalComplete::SendEvent(Thread *thread, bool fIpChanged)
return true;
}

#ifdef EnC_SUPPORTED
#ifdef FEATURE_METADATA_UPDATER

// * ------------------------------------------------------------------------ *
// * DebuggerEnCBreakpoint routines
Expand Down Expand Up @@ -8895,7 +8895,7 @@ TP_RESULT DebuggerEnCBreakpoint::HandleRemapComplete(DebuggerControllerPatch *pa

return TPR_IGNORE_AND_STOP;
}
#endif //EnC_SUPPORTED
#endif //FEATURE_METADATA_UPDATER

// continuable-exceptions
// * ------------------------------------------------------------------------ *
Expand Down
Loading

0 comments on commit 93552a3

Please sign in to comment.