Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] native code toplevel
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <basile@s...>
Subject: [Caml-list] native code toplevel
>>>>> "Oleg" == Oleg  <oleg_inconnu@myrealbox.com> writes:

    Oleg> Hi I found the same question in the archives, but with no
    Oleg> answers: why isn't there a native code toplevel? Sometimes I
    Oleg> need high performance and interactivity (CMUCL can do it,
    Oleg> why not O'Caml?)

I also share the same wishes. And actually, the toplevel might
(suboptimally) dynamically translate the bytecode to machine code
(i.e. do Just In Time compilation).


There are tools, in particular Ian Piumarta's CCG (Ian Piumarta is
also at Inria but on another project) or GNU lightning tools that
could help.

CCG is a set of clever C macros to generate x86 (or Sparc) machine
code. Basically, with CCG you code in some kind of assembler syntax
which produces C code generating it. CCG is plateform specific.

Lightning uses CCG to abstract a RISC machine with few registers. You
code in this RISC machine and get a C code generating code for several
plateform.

The only tricky point is to get tail recursive calls compiled
properly.

Perhaps in a not-too-remote future Ocaml might generate C-- code (see
www.cminusminus.org) and the QuickC-- (coded in Ocaml) compiler might
generate machine code either in memory or in shared objects (.so
files) which could be opened with dlopen/dlclose/dlsym at runtime.

For information, the TCC compiler generate code in memory (on x86).

Of course there are several plateforms (ie Linux/s390 or Linux/HPPA)
which might not have these tools available.

References:

C-- = http://www.cminusminus.org/

Lightning = http://www.gnu.org/software/lightning/

TCC = http://fabrice.bellard.free.fr/tcc/

As a selfish x86 coder, I would be delighted with a JIT OCaml, and
even more with a library able to dynamically load code at runtime.


Regards.
-- 

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
alias: basile<at>tunes<dot>org 
8, rue de la Faïencerie, 92340 Bourg La Reine, France
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners