diff --git a/Changes b/Changes index 6f7bb82ee..937b7d2f0 100644 --- a/Changes +++ b/Changes @@ -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 diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index c1ffa54cc..7bdf2b1b1 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -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 "<valuep())<<" "<valuep()) == hashed.end()) { + hashed.hashAndInsert(nodep->valuep()); + } } } } @@ -223,11 +228,8 @@ private: TraceTraceVertex* dupvertexp = dynamic_cast(dupincp->user1p()->castGraphVertex()); UINFO(8," Orig "<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()) <<" "<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.