caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Walid Taha <taha@cs.rice.edu>
To: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
Cc: <caml-list@inria.fr>
Subject: Re: [Caml-list] native code toplevel
Date: Sun, 17 Nov 2002 18:31:18 -0600 (CST)	[thread overview]
Message-ID: <Pine.GSO.4.33.0211171823060.28956-100000@frosty.cs.rice.edu> (raw)
In-Reply-To: <20021118085958W.garrigue@kurims.kyoto-u.ac.jp>


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
|bytecode.
|
|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.

Walid.

-------------------
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


  reply	other threads:[~2002-11-18  0:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-16 14:32 Oleg
2002-11-16 23:16 ` malc
2002-11-17  2:24   ` Oleg
2002-11-17  7:41     ` Sven Luther
2002-11-17 14:00       ` Oleg
2002-11-17 11:21     ` malc
2002-11-17 10:20   ` Stefano Zacchiroli
2002-11-17 23:59     ` Jacques Garrigue
2002-11-18  0:31       ` Walid Taha [this message]
     [not found]       ` <Pine.GSO.4.33.0211171823060.28956-100000@frosty.cs.rice.ed u>
2002-11-18  1:00         ` Chris Hecker
2002-11-18  1:04       ` Oliver Bandel
2002-11-17  8:16 ` Basile STARYNKEVITCH
2002-11-17  8:35   ` Sven Luther

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=Pine.GSO.4.33.0211171823060.28956-100000@frosty.cs.rice.edu \
    --to=taha@cs.rice.edu \
    --cc=caml-list@inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    /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).