English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
JIT VM in OCaml: Impossible?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-16 (17:42)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] JIT VM in OCaml: Impossible?
On Thu, 2007-08-16 at 12:24 -0400, Gordon Henriksen wrote:
> On 2007-08-16, at 10:10, Joel Reymont wrote:
> > Is it possible to write a JIT VM in OCaml?
> > 
> > 
> > It seems that this should not be possible as OCaml does not allow
> > for code generation at runtime. Am I mistaken?
> Sure. You could write a compiler and assembler in ocaml.
>  But you'd need to write glue code in C or assembly to 
> convert the ocaml representation to machine data structures,

Why? Ocaml is just as capable of generating binary data as C ..
if not more capable. You would need some glue to actually
*execute* this code, but that is also true in C. For Unix,
mmap() would probably be used.

The question is: why would you do this? Why not just generate
C (or C++ as Felix does) and compile it to a shared library,
then link and execute it? 

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net