caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Till Varoquaux" <till.varoquaux@gmail.com>
To: "Jon Harrop" <jon@ffconsultancy.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] [ANN] OCaml-Java project: 1.0 release
Date: Tue, 27 May 2008 08:57:08 +0100	[thread overview]
Message-ID: <9d3ec8300805270057n46b5ea9fp4c3172e9d7f5efcd@mail.gmail.com> (raw)
In-Reply-To: <200805270801.39081.jon@ffconsultancy.com>

On Tue, May 27, 2008 at 8:01 AM, Jon Harrop <jon@ffconsultancy.com> wrote:
> On Tuesday 27 May 2008 07:37:40 Till Varoquaux wrote:
>> On Tue, May 27, 2008 at 7:06 AM, Jon Harrop <jon@ffconsultancy.com> wrote:
>> > 4. Are tail calls fully implemented and, if not, when exactly do they
>> > work?
>>
>> One cannot fully implement tail calls on the JVM: there's no such
>> thing as a goto or a tail call instruction.
>> Tail recursion can usually be done for cheap. The general requires
>> some expensive machinery (usually trampolines)
>
> What characteristics of tail calls cannot be implemented using trampolines?
>
Speed.

I am sure you are aware of this but trampolining is very expensive
[1]. A common trick to avoid using to much trampolining is to compile
the whole program in cps form (therefor all calls are tail calls) and
unwind the whole stack when we are about to overflow [2]

Till

[1] Tail call elimination on the Java Virtual Machine
[2] CONS Should Not CONS Its Arguments, Part II: Cheney on the M.T.A.
> --
> Dr Jon D Harrop, Flying Frog Consultancy Ltd.
> http://www.ffconsultancy.com/products/?e
>
Tail call elimination on the Java Virtual Machine


-- 
http://till-varoquaux.blogspot.com/


  reply	other threads:[~2008-05-27  7:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-27  5:46 forum
2008-05-27  6:06 ` [Caml-list] " Jon Harrop
2008-05-27  6:37   ` Till Varoquaux
2008-05-27  7:01     ` Jon Harrop
2008-05-27  7:57       ` Till Varoquaux [this message]
2008-05-27  7:26     ` forum
2008-05-27  8:36       ` Till Varoquaux
2008-05-27 17:59         ` Florian Weimer
2008-05-27 18:57           ` forum
2008-05-27  7:23   ` forum
2008-05-27  9:12     ` Richard Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9d3ec8300805270057n46b5ea9fp4c3172e9d7f5efcd@mail.gmail.com \
    --to=till.varoquaux@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=jon@ffconsultancy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).