Skip to content

Commit fdaaa61

Browse files
BrianBoheBrian Bohejakobbotsch
authored
Avoid reporting empty debug info ranges to the vm (#77289)
* Removing empty variable live ranges The debugger is not using empty variable live ranges. We are reporting them because they can get extended later if the variable becomes alive in the immediately next emitted instruction. If an empty live range is not getting extended, which we can realize after emitting all the code or creating a new live range for the same variable, we can remove it. * Extending variable live ranges in more cases When the emitter moved to the next group but has not emitted any instruction, and the variable died and becomes alive again, we would like to extend its range. * Avoiding creating a new debug range when previous is empty * Updating check for empty debug ranges * Updating print * Avoiding printing twice variable live range * Avoiding reporting empty variable ranges to the vm * Revert "Avoiding printing twice variable live range" This reverts commit 4e1cf47. * Revert "Updating print" This reverts commit 7b79b0d. * Revert "Updating check for empty debug ranges" This reverts commit e8b102d. * Revert "Avoiding creating a new debug range when previous is empty" This reverts commit a11fd5d. * Revert "Extending variable live ranges in more cases" This reverts commit 609605a. * Revert "Removing empty variable live ranges" This reverts commit 66d18e0. * Freeing vm memory when there is no debug info * Persisting JIT-EE contract on empty debug info * Update src/coreclr/jit/ee_il_dll.cpp Co-authored-by: Jakob Botsch Nielsen <[email protected]> Co-authored-by: Brian Bohe <[email protected]> Co-authored-by: Jakob Botsch Nielsen <[email protected]>
1 parent 13d4e6d commit fdaaa61

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/coreclr/jit/codegencommon.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6952,8 +6952,11 @@ void CodeGen::genSetScopeInfoUsingVariableRanges()
69526952
end++;
69536953
}
69546954

6955-
genSetScopeInfo(liveRangeIndex, start, end - start, varNum, varNum, true, loc);
6956-
liveRangeIndex++;
6955+
if (start < end)
6956+
{
6957+
genSetScopeInfo(liveRangeIndex, start, end - start, varNum, varNum, true, loc);
6958+
liveRangeIndex++;
6959+
}
69576960
};
69586961

69596962
siVarLoc* curLoc = nullptr;

src/coreclr/jit/ee_il_dll.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,15 @@ void Compiler::eeSetLVdone()
693693
eeDispVars(info.compMethodHnd, eeVarsCount, (ICorDebugInfo::NativeVarInfo*)eeVars);
694694
}
695695
#endif // DEBUG
696+
if ((eeVarsCount == 0) && (eeVars != nullptr))
697+
{
698+
// We still call setVars with nullptr when eeVarsCount is 0 as part of the contract.
699+
// We also need to free the nonused memory.
700+
info.compCompHnd->freeArray(eeVars);
701+
eeVars = nullptr;
702+
}
696703

697704
info.compCompHnd->setVars(info.compMethodHnd, eeVarsCount, (ICorDebugInfo::NativeVarInfo*)eeVars);
698-
699705
eeVars = nullptr; // We give up ownership after setVars()
700706
}
701707

0 commit comments

Comments
 (0)