chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH][5] Minor lfa2 improvements wrt ffi argumen


From: lemonboy
Subject: Re: [Chicken-hackers] [PATCH][5] Minor lfa2 improvements wrt ffi arguments
Date: Fri, 14 Jul 2017 14:03:23 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On 14 Jul, Peter Bex wrote:
> The basic idea of the patch is very good.  I think there's one small
> mistake: if the node isn't replaced by the object, you still return
> the derived type r1, on the grounds that the check is enforcing.
> 
> However, if the derived type is, say (or char fixnum), and we find that
> the predicate C_i_foreign_fixnum_argumentp is used, the final type will
> most definitely _not_ be (or char fixnum), but fixnum (or an error occurs).
> 
That's intentional. The lfa2 scrutinizer is intentionally dumb as a brick and
understands only a limited subset of the types that the scrutinizer supports
and, please correct me if I'm wrong, there's no way for the analyzer to produce
an or clause since there's also no code that's able to simplify those.

The idea was to remove the check if possible and to treat the whole expression
as a glorified identity function otherwise.
> Attached is a signed off copy of your patch with three changes:
> - I also added C_i_foreign_integer_argumentp
Good catch!
> - I've clarified in the commit message why we can't replace the ranged
>    integer FFI checks.
We could do so for integer literals only but I think that's not worth the
effort.
> 
> Ideally we'd add some tests for the LFA2 pass, but I think that's very
> tricky to do, and the number of cases is too large.
As a testing technique I'm dumping the AST right before the codegen phase using
the -debug switch and then pattern-match the interested area. It's not that
elegant but it works :)



reply via email to

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