From b0ee911b78b3eb62f18b2d4808b8a295028d81f5 Mon Sep 17 00:00:00 2001 From: Bruce Forstall Date: Thu, 15 Jun 2017 19:20:14 -0700 Subject: [PATCH] Convert size measurements for nodes to unsigned __int64 I found these numbers overflowing a size_t on x86 with a long SuperPMI run. Commit migrated from https://github.com/dotnet/coreclr/commit/b11d827dcddaff312293b0d21def4c7da5d2c7fc --- src/coreclr/src/jit/compiler.cpp | 4 ++-- src/coreclr/src/jit/compiler.h | 17 +++++++++++------ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/coreclr/src/jit/compiler.cpp b/src/coreclr/src/jit/compiler.cpp index 8db750b..07b5f16 100644 --- a/src/coreclr/src/jit/compiler.cpp +++ b/src/coreclr/src/jit/compiler.cpp @@ -1615,11 +1615,11 @@ void Compiler::compShutdown() fprintf(fout, "GenTree node allocation stats\n"); fprintf(fout, "---------------------------------------------------\n"); - fprintf(fout, "Allocated %6u tree nodes (%7u bytes total, avg %4u bytes per method)\n", + fprintf(fout, "Allocated %6I64u tree nodes (%7I64u bytes total, avg %4I64u bytes per method)\n", genNodeSizeStats.genTreeNodeCnt, genNodeSizeStats.genTreeNodeSize, genNodeSizeStats.genTreeNodeSize / genMethodCnt); - fprintf(fout, "Allocated %7u bytes of unused tree node space (%3.2f%%)\n", + fprintf(fout, "Allocated %7I64u bytes of unused tree node space (%3.2f%%)\n", genNodeSizeStats.genTreeNodeSize - genNodeSizeStats.genTreeNodeActualSize, (float)(100 * (genNodeSizeStats.genTreeNodeSize - genNodeSizeStats.genTreeNodeActualSize)) / genNodeSizeStats.genTreeNodeSize); diff --git a/src/coreclr/src/jit/compiler.h b/src/coreclr/src/jit/compiler.h index fbdbaf4..7e57405 100644 --- a/src/coreclr/src/jit/compiler.h +++ b/src/coreclr/src/jit/compiler.h @@ -9436,12 +9436,17 @@ struct NodeSizeStats genTreeNodeActualSize = 0; } - size_t genTreeNodeCnt; - size_t genTreeNodeSize; // The size we allocate - size_t genTreeNodeActualSize; // The actual size of the node. Note that the actual size will likely be smaller - // than the allocated size, but we sometimes use SetOper()/ChangeOper() to change - // a smaller node to a larger one. TODO-Cleanup: add stats on - // SetOper()/ChangeOper() usage to quanitfy this. + // Count of tree nodes allocated. + unsigned __int64 genTreeNodeCnt; + + // The size we allocate. + unsigned __int64 genTreeNodeSize; + + // The actual size of the node. Note that the actual size will likely be smaller + // than the allocated size, but we sometimes use SetOper()/ChangeOper() to change + // a smaller node to a larger one. TODO-Cleanup: add stats on + // SetOper()/ChangeOper() usage to quantify this. + unsigned __int64 genTreeNodeActualSize; }; extern NodeSizeStats genNodeSizeStats; // Total node size stats extern NodeSizeStats genNodeSizeStatsPerFunc; // Per-function node size stats -- 2.7.4