chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] add special case in specialization for lis


From: Felix
Subject: Re: [Chicken-hackers] [PATCH] add special case in specialization for list-ref/list-tail
Date: Sun, 18 Dec 2011 14:02:55 +0100 (CET)

From: Peter Bex <address@hidden>
Subject: Re: [Chicken-hackers] [PATCH] add special case in specialization for 
list-ref/list-tail
Date: Thu, 15 Dec 2011 21:13:35 +0100

> On Thu, Dec 15, 2011 at 02:50:16AM -0500, Felix wrote:
>> The attached patch adds special cases for list-ref and list-tail
>> to the scrutinizer to obtain more precise result-type information
>> when the index argument is a constant (and the list argument
>> is of a known fixed-length list type).
> 
> Does this happen often enough to warrant this much special-casing?
> I don't see any fixed (list X Y Z ...) returntypes in a quick glance
> over types.db

Any call to "(list ...)" will result in such a return-type, as will
using "cons", in certain cases (complex "pair" types will match
"list" types of equivalent structure).

> 
> And if this is done, shouldn't (##sys#)c[ad]*r have the same kind of
> specialization for fixed-length lists?

They are already specialized for "pair" types, which can match fixed
size list types, so special casing is not needed. The reason why
"list-ref" and "list-tail" are special is that if the index argument
is constant, we can directly access the component type.

> 
> Speaking of c[ad]*r, what about known fixed-length (pair (pair ...)) types?
> It looks like this patch for list-ref/list-tail doesn't deal with those.

These should be equivalent. What is possibly not handled is non-proper
lists. This could be added, but would be slightly tedious to
implement.

> 
> (sorry for being obnoxious)
> 

You aren't. Questions like these are important to be cleared up.


cheers,
felix



reply via email to

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