From: Andrei Barbu <and...@0xab.com>
Subject: [Chicken-hackers] inliner bug
Date: Sun, 10 Mar 2013 15:09:34 -0400

> Hi,

Hello!

> 
> The chicken inliner runs for a long time before failing with exit code
> 11 on the following code:
> 
> (declare (inline test))
> 
> (define (go a) (a 1))
> (define (test x) (go (lambda (x) (x) (test x))))
> 
> Compile with:
> 
> csc -inline a.scm -emit-inline-file a.inline
> 

Normally procedures are inlined if their size is below a certain limit
(a count of "nodes" in the internal representation of the compiler),
which defaults to 20, I believe. By adding the "inline" declaration,
you are effectively disabling this size test, telling the compiler:

  "Inline this! Always! Now go and do what I command!"

What we can do about this is one of the following:

- keep the current behaviour, since it is what the user wants (depending
  on the point of view, of course)
- disable the declaration after the current optimization pass, once
  a procedure has been inlined at all call-sites in the program (this
  may miss some call-sites in nested calls, but is better than what
  happens now, with the compiler running out of memory and all that...)
- define a "cut off" point, a maximal size that a procedure may have
  after which inlining will be prohibited (this is difficult to determine
  correctly and depends on too many factors, but is easy to implement)


cheers,
felix

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to