Skip to content

Commit

Permalink
JIT: Prefer block copies for unenregisterable locals even with GC poi…
Browse files Browse the repository at this point in the history
…nters (#85620)

This comment seems outdated/wrong, the backend's block copy strategy
when GC pointers are involved is highly tuned and often no helper is
necessary at all.
  • Loading branch information
jakobbotsch authored May 2, 2023
1 parent 18e3bbf commit dc796f7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/coreclr/jit/morphblock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,14 +917,11 @@ void MorphCopyBlockHelper::MorphStructCases()
// A struct with 8 bool fields will require 8 moves instead of one if we do this transformation.
// A simple heuristic when field by field copy is preferred:
// - if fields can be enregistered;
// - if the struct has GCPtrs (block copy would be done via helper that is expensive);
// - if the struct has only one field.
bool dstFldIsProfitable =
((m_dstVarDsc != nullptr) &&
(!m_dstVarDsc->lvDoNotEnregister || m_dstVarDsc->HasGCPtr() || (m_dstVarDsc->lvFieldCnt == 1)));
((m_dstVarDsc != nullptr) && (!m_dstVarDsc->lvDoNotEnregister || (m_dstVarDsc->lvFieldCnt == 1)));
bool srcFldIsProfitable =
((m_srcVarDsc != nullptr) &&
(!m_srcVarDsc->lvDoNotEnregister || m_srcVarDsc->HasGCPtr() || (m_srcVarDsc->lvFieldCnt == 1)));
((m_srcVarDsc != nullptr) && (!m_srcVarDsc->lvDoNotEnregister || (m_srcVarDsc->lvFieldCnt == 1)));
// Are both dest and src promoted structs?
if (m_dstDoFldAsg && m_srcDoFldAsg && (dstFldIsProfitable || srcFldIsProfitable))
{
Expand Down

0 comments on commit dc796f7

Please sign in to comment.