Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change debug info default variable tracking system #2107

Merged
merged 5 commits into from
Feb 26, 2020
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
6 changes: 3 additions & 3 deletions src/coreclr/src/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2412,11 +2412,11 @@ void CodeGen::genRegCopy(GenTree* treeNode)

#ifdef USING_VARIABLE_LIVE_RANGE
// Report the home change for this variable
varLiveKeeper->siUpdateVariableLiveRange(varDsc, lcl->GetLclNum())
varLiveKeeper->siUpdateVariableLiveRange(varDsc, lcl->GetLclNum());
#endif // USING_VARIABLE_LIVE_RANGE

// The new location is going live
genUpdateRegLife(varDsc, /*isBorn*/ true, /*isDying*/ false DEBUGARG(treeNode));
// The new location is going live
genUpdateRegLife(varDsc, /*isBorn*/ true, /*isDying*/ false DEBUGARG(treeNode));
}
}
}
Expand Down
16 changes: 13 additions & 3 deletions src/coreclr/src/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11466,9 +11466,19 @@ void CodeGenInterface::VariableLiveKeeper::VariableLiveDescriptor::startLiveRang
// Is the first "VariableLiveRange" or the previous one has been closed so its "m_EndEmitLocation" is valid
noway_assert(m_VariableLiveRanges->empty() || m_VariableLiveRanges->back().m_EndEmitLocation.Valid());

// Creates new live range with invalid end
m_VariableLiveRanges->emplace_back(varLocation, emitLocation(), emitLocation());
m_VariableLiveRanges->back().m_StartEmitLocation.CaptureLocation(emit);
if (!m_VariableLiveRanges->empty() && m_VariableLiveRanges->back().m_EndEmitLocation.IsPreviousInsNum(emit) &&
siVarLoc::Equals(&varLocation, &(m_VariableLiveRanges->back().m_VarLocation)))
{
// The variable is being born just after the instruction at which it died.
// In this case, i.e. an update of the variable's value, we coalesce the live ranges.
m_VariableLiveRanges->back().m_EndEmitLocation.Init();
}
else
{
// Creates new live range with invalid end
m_VariableLiveRanges->emplace_back(varLocation, emitLocation(), emitLocation());
m_VariableLiveRanges->back().m_StartEmitLocation.CaptureLocation(emit);
}

#ifdef DEBUG
if (!m_VariableLifeBarrier->hasLiveRangesToDump())
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/src/jit/codegeninterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
#include "treelifeupdater.h"
#include "emit.h"

#if 1
#if 0
// Enable USING_SCOPE_INFO flag to use psiScope/siScope info to report variables' locations.
#define USING_SCOPE_INFO
#endif
#if 0
#if 1
// Enable USING_VARIABLE_LIVE_RANGE flag to use VariableLiveRange info to report variables' locations.
// Note: if both USING_SCOPE_INFO and USING_VARIABLE_LIVE_RANGE are defined, then USING_SCOPE_INFO
// information is reported to the debugger.
Expand Down
15 changes: 15 additions & 0 deletions src/coreclr/src/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ UNATIVE_OFFSET emitLocation::GetFuncletPrologOffset(emitter* emit) const
return emit->emitCurIGsize;
}

//------------------------------------------------------------------------
// IsPreviousInsNum: Returns true if the emitter is on the next instruction
// of the same group as this emitLocation.
//
// Arguments:
// emit - an emitter* instance
//
bool emitLocation::IsPreviousInsNum(const emitter* emit) const
{
assert(Valid());
bool isSameGroup = (ig == emit->emitCurIG);
bool isSameInsNum = (emitGetInsNumFromCodePos(codePos) == emitGetInsNumFromCodePos(emit->emitCurOffset()) - 1);
return isSameGroup && isSameInsNum;
}

#ifdef DEBUG
void emitLocation::Print() const
{
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/src/jit/emit.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ class emitLocation

UNATIVE_OFFSET GetFuncletPrologOffset(emitter* emit) const;

bool emitLocation::IsPreviousInsNum(const emitter* emit) const;

#ifdef DEBUG
void Print() const;
#endif // DEBUG
Expand Down Expand Up @@ -2389,7 +2391,7 @@ inline unsigned emitGetInsOfsFromCodePos(unsigned codePos)
return (codePos >> 16);
}

inline unsigned emitter::emitCurOffset()
inline unsigned emitter::emitCurOffset() const
{
unsigned codePos = emitCurIGinsCnt + (emitCurIGsize << 16);

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/jit/emitpub.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void emitFinishPrologEpilogGeneration();
/************************************************************************/

void* emitCurBlock();
unsigned emitCurOffset();
unsigned emitCurOffset() const;

UNATIVE_OFFSET emitCodeOffset(void* blockPtr, unsigned codeOffs);

Expand Down