[cfe-dev] Allowing checkers to mark symbols as live

Ted Kremenek kremenek at apple.com
Mon Aug 9 20:43:31 PDT 2010


On Aug 9, 2010, at 7:17 PM, Zhongxing Xu wrote:

> I'm inclined to Jordy's original proposal that Checkers should be able
> to control some symbols that only they know what the symbol means,
> when the symbol dies.

My point was that the checker shouldn't have to do anything special to extend the lifetime of a symbol.  For symbols that annotate MemRegions, the lifetime of the symbol is inherently bound to the lifetime of the MemRegion.  It seems far more natural to me, more efficient, and far less error prone to have SymbolManager::isLive() understand that the lifetime of one symbol is tied to another (declaratively) then having the checker doing something ad hoc on the side.

> 
> The benefit is that symbols still remains what it is: a representation
> of a value generated somewhere, and immutable. The checker could
> generate a symbol to represent what it thinks representing the length
> of the string, and next time when it change its mind, it can generate
> a new symbol, and mark the old one dead. This seems very natural to
> me. And it won't pollute the state with unnecessary symbols, because
> it knows exactly when the symbol is live and dead.
> 
> On Tue, Aug 10, 2010 at 1:15 AM, Ted Kremenek <kremenek at apple.com> wrote:
>> Hi Jordy,
>> 
>> I have mixed feelings about adding this, and I think this needs strong justification. Why is it needed?  What symbols do we need to keep around that aren't related to live regions, or the values bound to live regions?  Right now symbols can indicate that they are derived from other symbols (or are related to regions), and their liveness is extended if they thing they derive from is also live.  If a symbol is no longer live, why do we need to continue tracking state?
>> 
>> My concern about adding this is that it artificially will extend the lifetime of symbols, causing the GRState to accumulate extra state that defeats state caching.  The current set of checkers already do a bad job of removing stale data from the GDM for dead symbols.
> 
> Why? Checkers get informed by callback EvalDeadSymbols().

That requires Checkers being good citizens and implement that callback.  The only Checkers that should need to implement that callback are ones that do something special (e.g., leak detection checkers) when a symbol is no longer live.  The more we can move to a place where the management of symbols is more declarative than imperative then the performance problems involved with artificially keeping track of a symbol longer than necessary just get defined away.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100809/a719d5ba/attachment.html>


More information about the cfe-dev mailing list