<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Mar 20, 2012, at 4:51 PM, Jordan Rose <<a href="mailto:jediknil@belkadan.com">jediknil@belkadan.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><blockquote type="cite" style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">This seems to implement the first suggestion by Ted, where we attempt to regenerate a single PathDiagnosticPiece, not the whole path, which would not work for state-full visitors. Am I missing something?<br></blockquote><br style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; ">Oh, I wasn't sure that was the final decision. It makes things a little easier on the checker writer to worry about visiting the same nodes twice, but MallocChecker is certainly still stateful.</span></div></blockquote><div><br></div><div>I think it is fine to keep it stateful.  It's actually a great feature.  If we can clone all the *initial* BugReporterVisitors at the very beginning, before we generate the PathDiagnostic, we always have something to roll back to if we decide to start over and generate the path again with a set of new interesting symbols.</div><div><br></div><div>For example, we could make a BugReporterVisitorsImpl class, which is a template, which has a "clone()" virtual method, e.g.:</div><div><br></div><div>  BugReporterVisitor *clone() {</div><div>     return new DERIVED(this);</div><div>  }</div><div><br></div><div>then specific visitors derive from this class, e.g.:</div><div><br></div><div>  class MyVisitor : public BugReporterVisitorImpl<MyVisitor> { ... };</div><div><br></div><div>We could clone all the visitors up front when generating a path, and always roll back to the original ones when generating a PathDiagnostic on the second, third, fourth passes, etc.</div><br><blockquote type="cite"><div><span style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; display: inline !important; float: none; "> Still, if we really don't care about performance during diagnostic generation...</span></div></blockquote></div><br><div>In all likelihood, we will only regenerate an entire path a handful of times.  This is dwarfed by the amount of work to do the analysis in the first place to find the bug.  We also aren't repeating the logic to find the shortest path; just the logic to generate the events and control-flow arrows.</div></body></html>