Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Use bucket size metric and fix typos
  • Loading branch information
davidwrighton committed Jul 29, 2020
commit 9c68487303060be9b120a5cc559cb92df7b9c428
1 change: 1 addition & 0 deletions src/coreclr/src/jit/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6365,6 +6365,7 @@ class Compiler

static const size_t s_optCSEhashSize;
static const size_t s_optCSEhashGrowthFactor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be renamed to indicate that it is the initial hash table size

s_optCSEhashSize => s_optCSEhashSizeInitial

static const size_t s_optCSEhashBucketSize;
size_t optCSEhashSize; // Size of hashtable
size_t optCSEhashCount; // Number of entries in hashtable
size_t optCSEhashMaxCountBeforeResize; // Number of entries before resize
Expand Down
7 changes: 4 additions & 3 deletions src/coreclr/src/jit/optcse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/* static */
const size_t Compiler::s_optCSEhashSize = EXPSET_SZ * 2;
const size_t Compiler::s_optCSEhashGrowthFactor = 2;
const size_t Compiler::s_optCSEhashBucketSize = 4;

/*****************************************************************************
*
Expand Down Expand Up @@ -377,8 +378,8 @@ void Compiler::optValnumCSE_Init()
optCSEhash = new (this, CMK_CSE) CSEdsc*[s_optCSEhashSize]();

optCSEhashSize = s_optCSEhashSize;
optCSEhashMaxCountBeforeResize = optCSEhashSize * s_optCSEhashGrowthFactor;
optCSEhashCount = 0
optCSEhashMaxCountBeforeResize = optCSEhashSize * s_optCSEhashBucketSize;
optCSEhashCount = 0;

optCSECandidateCount = 0;
optDoCSE = false; // Stays false until we find duplicate CSE tree
Expand Down Expand Up @@ -641,7 +642,7 @@ unsigned Compiler::optValnumCSE_Index(GenTree* tree, Statement* stmt)
if (optCSEhashCount == optCSEhashMaxCountBeforeResize)
{
size_t newOptCSEhashSize = optCSEhashSize * s_optCSEhashGrowthFactor;
CSEdsc** newOptCSEhash = new (this, CMK_CSE) CSEdsc*[new_optCSEhashSize]();
CSEdsc** newOptCSEhash = new (this, CMK_CSE) CSEdsc*[newOptCSEhashSize]();

// Iterate through each existing entry, moving to the new table
CSEdsc** ptr;
Expand Down