Improve Verilation performance on trace duplicates, msg2017.

Signed-off-by: Wilson Snyder <wsnyder@wsnyder.org>
This commit is contained in:
Johan Bjork 2016-09-19 17:54:42 -04:00 committed by Wilson Snyder
parent 999f278971
commit 15495bb200
2 changed files with 14 additions and 9 deletions

View File

@ -1,7 +1,6 @@
Revision history for Verilator
The contributors that suggested a given feature are shown in []. [by ...]
indicates the contributor was also the author of the fix; Thanks!
The contributors that suggested a given feature are shown in []. Thanks!
* Verilator 3.887 devel
@ -16,6 +15,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Improve Verilation performance on internal strings, msg1975. [Johan Bjork]
**** Improve Verilation performance on trace duplicates, msg2017. [Johan Bjork]
* Verilator 3.886 2016-07-30

View File

@ -206,8 +206,13 @@ private:
AstTraceInc* nodep = vvertexp->nodep();
if (nodep->valuep()) {
if (nodep->valuep()->backp() != nodep) nodep->v3fatalSrc("Trace duplicate back needs consistency, so we can map duplicates back to TRACEINCs");
hashed.hashAndInsert(nodep->valuep());
hashed.hash(nodep->valuep());
UINFO(8, " Hashed "<<hex<<hashed.nodeHash(nodep->valuep())<<" "<<nodep<<endl);
// Just keep one node in the map and point all duplicates to this node
if (hashed.findDuplicate(nodep->valuep()) == hashed.end()) {
hashed.hashAndInsert(nodep->valuep());
}
}
}
}
@ -223,11 +228,8 @@ private:
TraceTraceVertex* dupvertexp = dynamic_cast<TraceTraceVertex*>(dupincp->user1p()->castGraphVertex());
UINFO(8," Orig "<<nodep<<endl);
UINFO(8," dup "<<dupincp<<endl);
// Mark the found node as a duplicate of the first node
// (Not vice-versa as we get the iterator for the found node)
dupvertexp->duplicatep(vvertexp);
// Remove node from comparison so don't hit it again
hashed.erase(dupit);
// Mark the hashed node as the original and our iterating node as duplicated
vvertexp->duplicatep(dupvertexp);
}
}
}
@ -493,11 +495,13 @@ private:
//if (debug()>=9) nodep->dumpTree(cout,"- assnnode: ");
// Find non-duplicated node; note some nodep's maybe null, as they were deleted below
TraceTraceVertex* dupvertexp = vvertexp;
while (dupvertexp->duplicatep()) {
if (dupvertexp->duplicatep()) {
dupvertexp = dupvertexp->duplicatep();
UINFO(9," dupOf "<<((void*)dupvertexp)<<" "<<((void*)dupvertexp->nodep())
<<" "<<dupvertexp<<endl);
if (dupvertexp->duplicatep()) dupvertexp->nodep()->v3fatalSrc("Original node was marked as a duplicate");
}
if (dupvertexp != vvertexp) {
// It's an exact copy. We'll assign the code to the master on
// the first one we hit; the later ones will share the code.