[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Native Code Again
From: |
Andy Wingo |
Subject: |
Re: Native Code Again |
Date: |
Fri, 28 Jan 2011 15:55:09 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi,
On Fri 28 Jan 2011 15:33, Noah Lavine <address@hidden> writes:
>> And also... why not rely on gcc's tail-call optimization, in the case
>> where it works? You can check for it at configure-time. I just ran
>> some small tests for tail-calls between functions in separate
>> compilation units and it shows that indeed, gcc does the right thing.
>
> I don't think you want to rely on that, because then programs might
> break at -O0 that would work fine at higher optimization levels.
You can always test that the compiler supports
-foptimize-sibling-calls, and add it to CFLAGS as necessary. In any
case you know at configure time whether it is supported or not, and can
compile accordingly.
> However, if GCC added a special intrinsic function that would always
> do a tail call, then that could work. And they might very well add it
> if we asked them to.
Even if they did, we'd have to check for it anyway. Besides, the idiom
already exists: return foo (...);.
> Well, the JIT library can already tail-call C code.
Great.
Cool. The plans coalesce :)
A
--
http://wingolog.org/