<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 19, 2012, at 12:38 AM, Jordan Rose wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Mar 18, 2012, at 15:14, Anna Zaks wrote:<br><br><blockquote type="cite">On Mar 18, 2012, at 11:33 AM, Jordan Rose wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Possibilities:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- Store the generic visitors (added by BugReporter) separately from the visitors added by the checkers, and run them second.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- Add the generic visitors unconditionally when BugReports are created. Since ConditionBRVisitor and NilReceiverVisitor don't have state, we could just have a cached instance of each, saving allocation costs.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">- Change the visitor data structure to not be an ImmutableList, and require that visitors not add other visitors once the report has started. NilReceiverBRVisitor relies on this, though.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I'm leaning towards the second one right now. Thoughts?<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I also like the idea of visitors adding to the list of interesting symbols. Further, you could have a bunch of generic visitors and allow the checkers to choose which (of the generic ones) to use. You can also have a default list which gets generated with each BugReport by default.<br></blockquote><br>Right now this is done by the bug reporter simply adding ConditionBRVisitor and NilReceiverVisitor to every report just before emitting path diagnostics. (Presumably this is so that if we /don't/ emit path diagnostics, we don't incur the hit of constructing two heap-allocated visitors. Even though they're empty objects.)<br><br>As for choosing which generic visitors to use, wouldn't this just mean taking away the generic ones entirely, or only adding them if there were no custom-specified reports? I feel like that's just perpetuating the hack I committed.<br><br></div></blockquote><div><br></div><div>I don't think setting which generic visitors should be used when creating a BugReport is a hack. (I don't suggest that we add a generic visitor <b>while</b> visiting the path with a custom visitor.) Anyway, this probably goes into the future work category. For example, we could add another generic visitor that adds a note whenever underflow or overflow occurs or another one that shows the ranges of interesting symbols. These additional diagnostics would be valuable for buffer overflow checking but not for null dereference.</div><br><blockquote type="cite"><div><blockquote type="cite">Before you go down the road of changing the order, try to experiment with it (using the simplest solution) to see if there are any unknown issues that reordering might lead to in terms of desired output. For example, what happens if you have default and custom visitors generating a note for the same pair of nodes? The order might change the quality of output. <br></blockquote><br>Good point. But it seems right now there are NO custom visits besides reallocation that generate notes on the same nodes as the default visitors, at least not in any of our plist checks. (Or in retain-release.m, which I checked as well because there aren't many plist tests.) Looking at the existing custom visitors, none of them seem like they would fire on the same nodes.<br><br>So, with the hack in place:<br><br>Assuming 'tmp' is NULL<br>Reallocation failed<br>Taking true branch<br><br>And changed:<br><br>Reallocation failed (perhaps "Testing reallocation"?)<br></div></blockquote><blockquote type="cite"><div>Assuming 'tmp' is NULL<br>Taking true branch<br><br></div></blockquote><div>(The first sequence is what we have now, and the second one is what will happen after reordering?)</div><div><br></div><div>I think it's important to say "Reallocation failed". The error only occurs when reallocation failed, not if we just test for failure. And it's best to have temporal order here. We assume 'tmp' is NULL, which implies that reallocation failed. (On the other hand, "Reallocation failed" is a more important message to display, but we could use other means to specify that.)</div><div><br></div><blockquote type="cite"></blockquote><blockquote type="cite"><div>That is, letting custom visitors emit messages first means that the messages themselves come second. ("Taking X branch" will always come last, cause it's part of the BugReporter itself.) In this case, it makes sense, because once you decide the reallocation failed, 'tmp' being NULL is no longer a choice.<br><br>Since we don't have any existing behavior here, we can decide what standard to set. I think saying "custom notes will follow standard notes" is okay -- notes that come /before/ standard notes would describe what we're /about/ to do, but the convention of all the standalone notes is that they describe results. ("Object allocated here", "Taking true branch", etc.)<br><br>Of course, if we decide we want /flexibility/ here...then the problem gets a lot harder.<br><br>Thoughts?<br>Jordy</div></blockquote></div><br></body></html>