From d5e2081e0e20836073129b98fd456dfc492d3a21 Mon Sep 17 00:00:00 2001 From: Carol Eidt Date: Tue, 7 Jan 2020 07:43:01 -0800 Subject: [PATCH] Fix LSRA dump of GC Kills (#1288) --- src/coreclr/src/jit/lsra.cpp | 19 ++++++++++++++----- src/coreclr/src/jit/lsra.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/coreclr/src/jit/lsra.cpp b/src/coreclr/src/jit/lsra.cpp index 71ca1fd..b793bc2 100644 --- a/src/coreclr/src/jit/lsra.cpp +++ b/src/coreclr/src/jit/lsra.cpp @@ -4443,6 +4443,7 @@ void LinearScan::spillGCRefs(RefPosition* killRefPosition) // For each physical register that can hold a GC type, // if it is occupied by an interval of a GC type, spill that interval. regMaskTP candidateRegs = killRefPosition->registerAssignment; + INDEBUG(bool killedRegs = false); while (candidateRegs != RBM_NONE) { regMaskTP nextRegBit = genFindLowestBit(candidateRegs); @@ -4470,11 +4471,12 @@ void LinearScan::spillGCRefs(RefPosition* killRefPosition) } if (needsKill) { - INDEBUG(dumpLsraAllocationEvent(LSRA_EVENT_KILL_GC_REF, nullptr, nextReg, nullptr)); + INDEBUG(killedRegs = true); unassignPhysReg(regRecord, assignedInterval->recentRefPosition); } } - INDEBUG(dumpLsraAllocationEvent(LSRA_EVENT_DONE_KILL_GC_REFS, nullptr, REG_NA, nullptr)); + INDEBUG(dumpLsraAllocationEvent(killedRegs ? LSRA_EVENT_DONE_KILL_GC_REFS : LSRA_EVENT_NO_GC_KILLS, nullptr, REG_NA, + nullptr)); } //------------------------------------------------------------------------ @@ -9716,9 +9718,14 @@ void LinearScan::dumpLsraAllocationEvent(LsraDumpEvent event, dumpRegRecords(); break; - // Done with GC Kills case LSRA_EVENT_DONE_KILL_GC_REFS: - printf(indentFormat, " DoneKillGC "); + dumpRefPositionShort(activeRefPosition, currentBlock); + printf("Done "); + break; + + case LSRA_EVENT_NO_GC_KILLS: + dumpRefPositionShort(activeRefPosition, currentBlock); + printf("None "); break; // Block boundaries @@ -9831,7 +9838,9 @@ void LinearScan::dumpLsraAllocationEvent(LsraDumpEvent event, break; default: - unreached(); + printf("????? %-4s ", getRegName(reg)); + dumpRegRecords(); + break; } } diff --git a/src/coreclr/src/jit/lsra.h b/src/coreclr/src/jit/lsra.h index 3ea2fd4..c5eacf3 100644 --- a/src/coreclr/src/jit/lsra.h +++ b/src/coreclr/src/jit/lsra.h @@ -1290,7 +1290,7 @@ private: // Spilling LSRA_EVENT_SPILL, LSRA_EVENT_SPILL_EXTENDED_LIFETIME, LSRA_EVENT_RESTORE_PREVIOUS_INTERVAL, - LSRA_EVENT_RESTORE_PREVIOUS_INTERVAL_AFTER_SPILL, LSRA_EVENT_KILL_GC_REF, LSRA_EVENT_DONE_KILL_GC_REFS, + LSRA_EVENT_RESTORE_PREVIOUS_INTERVAL_AFTER_SPILL, LSRA_EVENT_DONE_KILL_GC_REFS, LSRA_EVENT_NO_GC_KILLS, // Block boundaries LSRA_EVENT_START_BB, LSRA_EVENT_END_BB, -- 2.7.4