From 5627d1ca14f2b9a02277b81c52f25c3d5e440e49 Mon Sep 17 00:00:00 2001 From: Mike Danes Date: Sat, 16 Jun 2018 22:21:40 +0300 Subject: [PATCH] Cleanup hashBvGlobalData Each compiler object contains a hashBvGlobalData that's 80 bytes in size. Only 16 bytes are actually used - the hash and node free lists. * hbvFreeVectorList is supposed to be used by hashBv::freeVector but nothing calls that and getNewVector does not attempt to use the free list * hbvHashSizeLog2 is always 0 * hashBvNextIterator is used only in HbvNext and that function is never used Commit migrated from https://github.com/dotnet/coreclr/commit/235bc725acdf8a66b19f1c51cfe83f573562f80d --- src/coreclr/src/jit/hashbv.cpp | 27 +-------------------------- src/coreclr/src/jit/hashbv.h | 26 ++------------------------ 2 files changed, 3 insertions(+), 50 deletions(-) diff --git a/src/coreclr/src/jit/hashbv.cpp b/src/coreclr/src/jit/hashbv.cpp index db8dda1..6aee93e 100644 --- a/src/coreclr/src/jit/hashbv.cpp +++ b/src/coreclr/src/jit/hashbv.cpp @@ -358,7 +358,7 @@ bool hashBvNode::sameAs(hashBvNode* other) hashBv::hashBv(Compiler* comp) { this->compiler = comp; - this->log2_hashSize = globalData()->hbvHashSizeLog2; + this->log2_hashSize = 0; int hts = hashtable_size(); nodeArr = getNewVector(hts); @@ -424,20 +424,6 @@ hashBv*& hashBv::hbvFreeList(hashBvGlobalData* data) return data->hbvFreeList; } -void hashBv::freeVector(hashBvNode* vect, int vectorLength) -{ - // not enough space to do anything with it - if (vectorLength < 2) - { - return; - } - - hbvFreeListNode* f = (hbvFreeListNode*)vect; - f->next = globalData()->hbvFreeVectorList; - globalData()->hbvFreeVectorList = f; - f->size = vectorLength; -} - void hashBv::hbvFree() { Compiler* comp = this->compiler; @@ -547,7 +533,6 @@ void hashBv::Resize(int newSize) return; } - int oldSizeLog2 = log2_hashSize; int log2_newSize = genLog2((unsigned)newSize); hashBvNode** newNodes = this->getNewVector(newSize); @@ -1297,7 +1282,6 @@ bool hashBv::MultiTraverseLHSBigger(hashBv* other) // this is larger hashBvNode*** cursors; - int shiftFactor = this->log2_hashSize - other->log2_hashSize; int expansionFactor = hts / ots; cursors = (hashBvNode***)alloca(expansionFactor * sizeof(void*)); @@ -2016,12 +2000,3 @@ more_data: goto more_data; } } - -indexType HbvNext(hashBv* bv, Compiler* comp) -{ - if (bv) - { - bv->globalData()->hashBvNextIterator.initFrom(bv); - } - return bv->globalData()->hashBvNextIterator.nextBit(); -} diff --git a/src/coreclr/src/jit/hashbv.h b/src/coreclr/src/jit/hashbv.h index cadb182..b07b3d8 100644 --- a/src/coreclr/src/jit/hashbv.h +++ b/src/coreclr/src/jit/hashbv.h @@ -186,8 +186,6 @@ public: public: hashBv(Compiler* comp); - hashBv(hashBv* other); - // hashBv() {} static hashBv* Create(Compiler* comp); static void Init(Compiler* comp); static hashBv* CreateFrom(hashBv* other, Compiler* comp); @@ -215,11 +213,8 @@ private: // maintain free lists for vectors hashBvNode** getNewVector(int vectorLength); - void freeVector(hashBvNode* vect, int vectorLength); int getNodeCount(); - hashBvNode* getFreeList(); - public: inline hashBvNode* getOrAddNodeForIndex(indexType index) { @@ -281,16 +276,6 @@ public: // -------------------------------------------------------------------- // -------------------------------------------------------------------- -class hbvFreeListNode -{ -public: - hbvFreeListNode* next; - int size; -}; - -// -------------------------------------------------------------------- -// -------------------------------------------------------------------- - class hashBvIterator { public: @@ -318,17 +303,10 @@ class hashBvGlobalData friend class hashBv; friend class hashBvNode; - hashBvNode* hbvNodeFreeList; - hashBv* hbvFreeList; - unsigned short hbvHashSizeLog2; - hbvFreeListNode* hbvFreeVectorList; - -public: - hashBvIterator hashBvNextIterator; + hashBvNode* hbvNodeFreeList; + hashBv* hbvFreeList; }; -indexType HbvNext(hashBv* bv, Compiler* comp); - // clang-format off #define FOREACH_HBV_BIT_SET(index, bv) \ { \ -- 2.7.4