bug-kawa
[Top][All Lists]
Advanced

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

[Bug-kawa] [bug #39606] tail calls not performed for top-level functions


From: Per Bothner
Subject: [Bug-kawa] [bug #39606] tail calls not performed for top-level functions
Date: Tue, 10 Sep 2013 08:03:39 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36

Update of bug #39606 (project kawa):

                  Status:                    None => Wont Fix               
             Assigned to:                    None => bothner                

    _______________________________________________________

Follow-up Comment #1:

If works if you use the --full-tails option when starting up Kawa:
bash$ java -jar kawa-1.13.jar --full-tailcalls

See http://www.gnu.org/software/kawa/Compatibility.html and
http://www.gnu.org/software/kawa/Options.html#Options-for-compiling-and-optimizing

Otherwise when using the default calling convention we're limited by JVM (for
now at least).  The Kawa compiler will optimize away the most common kinds of
tail-calls, including (self-)tail-recursion, and some kinds of mutual
tail-recursion.  For example:

bash$ bin/kawa --debug-dump-zip
#|kawa:1|# (define e? (let () (define (e? x) (if (zero? x) #t (o? (- x 1)))) 
(define (o? x) (if (zero? x) #f (e? (- x 1)))) e?))
#|kawa:2|# (e?  10000)
#t

We can do better when the JVM gets native tail-call optimization.  Maybe Java
9 - if we're lucky - or enough people demand it.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?39606>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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