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: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH][5] Minor lfa2 improvements wrt ffi arguments
Date: Fri, 14 Jul 2017 13:02:45 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Wed, Jul 05, 2017 at 01:50:58PM +0200, lemonboy wrote:
> Hello hackers,
> here's a small patch that instructs the lfa2 pass how to get rid of some type
> checks on the arguments passed to the ffi stubs when we can safely recover the
> argument types at compile time.

Hi Lemonboy,

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).

Attached is a signed off copy of your patch with three changes:
- I also added C_i_foreign_integer_argumentp
- The returned type is r1 if we performed the rewrite, otherwise it will
   be (or ...) where the ... is all the types that the predicate checks.
- I've clarified in the commit message why we can't replace the ranged
   integer FFI checks.

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.

Cheers,
Peter

Attachment: 0001-Elide-pointless-type-checks-in-the-lfa2-pass.patch
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

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