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
[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: 2002-11-18 (00:32)
From: Walid Taha <taha@c...>
Subject: Re: [Caml-list] native code toplevel

On Mon, 18 Nov 2002, Jacques Garrigue wrote:

|From: Stefano Zacchiroli <zack@cs.unibo.it>
|> On Sun, Nov 17, 2002 at 02:16:57AM +0300, malc wrote:
|> > b) Ocaml has no way to dynamically load .cmx or .cmxa
|> We have lived for a long time with ocamlmktop, we can also live with
|> building of native code toplevels.
|I have a strong feeling that what people are really asking for is the
|ability to mix bytecode and native code.
|The real difficulty with a native code toplevel is not to build the
|toplevel itself, but the fact that every line you input to the
|toplevel is a small program which must be dynamically compiled, linked
|and run. With bytecode this is easy (a bit of meta glue), but with
|pure native code this would be complicated and slow.  The ideal would
|be to use native code libraries inside a toplevel compiling to
|IIRC Fabrice le Feissant had some way to do it, by writing a bytecode
|interpreter in ocaml itself, but I don't know how hard it would be to
|adapt the toplevel to this approach (knowing that there is a fair bit
|of magic in the way the toplevel links with itself).

I don't quite see how that could solve this problem, unless (native code
compiled) OCaml had multi-stage constructs like those of MetaOCaml.  But
MetaOCaml is currently only available in the bytecode form, because we
can't quite figure out how to call the compiler at runtime on a piece of
code that we've generated dynamicaly (which is the core problem you point
to in the paragraph above) *and* then load into the parent runtime.
Sure, calling the native code compiler at runtime expensive, but the
generated (native) code is also faster than the byte code.  It's a
tradeoff that I'd like the programmer to have access to.  If someone has
insights/experience calling the compiler at runtime and then loading the
generated code into the same runtime system, I would would be very
interested in hearing from them.


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