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 12:31:50 +0100 (CET)

From: Peter Bex <address@hidden>
Subject: Re: [Chicken-hackers] [PATCH] Flow-analysis enhancement for assigned 
variables
Date: Mon, 30 Jan 2012 10:40:18 +0100

> On Mon, Jan 30, 2012 at 10:28:18AM +0100, Felix wrote:
>> >> 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).
>> > 
>> > How is this taken care of?
>> 
>> It isn't. Otherwise using specialization or scrutiny would make no sense.
> 
> If they're not tracked, could this cause the scrutinizer to make invalid
> type inferences and code replacements?  

Yes.

> Is there a way to tell the
> scrutinizer to stay away from certain variables?  (like "volatile" etc in C)

No, with the exception of using type-declarations for global variables.

But there is an even more subtle problem: performing side-effects on
mutable data. That is the reason why, for example, list and vector
types are "smashed" after every procedure call (that is not a known
primitive internally marked as clean), which /may/ modify a
pair or vector and change the types of nested data:

  (let ((foo (vector (+ a b))))
    (bar foo)               ; foo : (vector number)
    (baz foo)               ; foo : (vector *)
    ...

I just mention this to show that there are quite a few ways to "work
around" the assumptions made by the type system, both applying to
variables and data. Concurrently performing side effects makes all
analysis moot. In the absolute worst case, one has to disable
specialization and ignore warnings produced by the scrutinizer.


cheers,
felix



reply via email to

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