chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-hackers] [PATCH] Flow-analysis enhancement for assigned var


From: Felix
Subject: Re: [Chicken-hackers] [PATCH] Flow-analysis enhancement for assigned variables
Date: Mon, 30 Jan 2012 08:35:22 +0100 (CET)

>> 1) Variables that are assigned now retain that type-information unless
>>    they are not captured (previously all assigned variables where
>>    assumed to be of unknown type), this is still control-flow
>>    sensitive, so it /should/ do the right thing with respect to
>>    conditionals
> 
> I'm a bit unsure about this first change because I still don't totally
> understand the scrutinizer, but with your explanation of why my other
> patch was incorrect, I'm now more confident that this is correct.

Since the scrutinizer tracks program-flow, assignment can theoretically
be used to update the currently known type-information for a variable
(that's the "blist", a list of updated type-information of variables,
kept separate from the "env", and keyed by varname + flow tag). But when
a variable is captured, then assignment may occur at all possible 
places. Previously assignments where generally not tracked, due to this
fact. Now we check explicitly whether the variable is captured and keep
the type-information (in the blist) if we know it is not.

Note: there is a certain class of variable manipulation that we can not
track: assignments from other threads and side-effects caused by
finalizers. I see no way to handle this without being excessively
conservative (and thus reducing the analysis to a minimum, which would
make it mostly useless).

The scrutinizer is not *that* complicated - the difficult part is the
flow-tracking and the quite elaborate type-matching stuff. And it is
exceedingly easy to make mistakes, unfortunately. The amount of work
that went into it is massive (and is likely not to be finished). If I
had known how complex and error-prone it would become, it would not
exist.


cheers,
felix



reply via email to

[Prev in Thread] Current Thread [Next in Thread]