From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA01375; Mon, 18 Nov 2002 01:32:07 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA01371 for ; Mon, 18 Nov 2002 01:32:06 +0100 (MET) Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id gAI0W5120656 for ; Mon, 18 Nov 2002 01:32:05 +0100 (MET) Received: from localhost (localhost [127.0.0.1]) by cs.rice.edu (Postfix) with SMTP id 848D54A9C1; Sun, 17 Nov 2002 18:32:03 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by cs.rice.edu (Postfix) with ESMTP id 43CAD4A9F8; Sun, 17 Nov 2002 18:32:03 -0600 (CST) Received: from frosty.cs.rice.edu (frosty.cs.rice.edu [128.42.1.20]) by cs.rice.edu (Postfix) with ESMTP id 862744A9C1; Sun, 17 Nov 2002 18:32:02 -0600 (CST) Received: from localhost (taha@localhost) by frosty.cs.rice.edu (8.9.3+Sun/8.9.0) with ESMTP id SAA29099; Sun, 17 Nov 2002 18:31:18 -0600 (CST) X-Authentication-Warning: frosty.cs.rice.edu: taha owned process doing -bs Date: Sun, 17 Nov 2002 18:31:18 -0600 (CST) From: Walid Taha To: Jacques Garrigue Cc: Subject: Re: [Caml-list] native code toplevel In-Reply-To: <20021118085958W.garrigue@kurims.kyoto-u.ac.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS snapshot-20020300 X-DCC--Metrics: cs.rice.edu 1067; Body=1 Fuz1=1 Fuz2=1 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 18 Nov 2002, Jacques Garrigue wrote: |From: Stefano Zacchiroli |> 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