From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 90493BB81 for ; Mon, 24 Oct 2005 08:48:01 +0200 (CEST) Received: from qproxy.gmail.com (qproxy.gmail.com [72.14.204.207]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j9O6m01c014845 for ; Mon, 24 Oct 2005 08:48:00 +0200 Received: by qproxy.gmail.com with SMTP id z8so109084qbc for ; Sun, 23 Oct 2005 23:48:00 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=kuOALuKCejhcEst/yL9nn4+dg8AthcRm9Xn3BHBjAg9HjcnsqKportVj9x/plxZHqkvbkOU6bB59wrkbP5Q5ka1GvJLaMi7RZQiCSO/oTBSOqQru08GcdgjZOPcNIXg21r7jBHKJev6abPujCRO/8nr0lStuGQsCYWf2ejR5YwI= Received: by 10.65.44.13 with SMTP id w13mr2678318qbj; Sun, 23 Oct 2005 23:48:00 -0700 (PDT) Received: by 10.65.35.7 with HTTP; Sun, 23 Oct 2005 23:48:00 -0700 (PDT) Message-ID: Date: Mon, 24 Oct 2005 19:48:00 +1300 From: Jonathan Roewen To: Jacques Garrigue Subject: Re: [Caml-list] The Bytecode Interpreter... Cc: caml-list@yquem.inria.fr In-Reply-To: <20051024.151312.52118628.garrigue@math.nagoya-u.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <1130062899.27787.126.camel@localhost.localdomain> <20051024.151312.52118628.garrigue@math.nagoya-u.ac.jp> X-Miltered: at nez-perce with ID 435C83A0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 bytecode:01 bytecode:01 ocamlrun:01 ocamlrun:01 dlopen:01 toplevellib:01 dlopen:01 libc:01 ocamlc:01 doable:01 ocaml:01 ...:98 compile:01 typing:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 Ok, so let me see if I can understand this all correctly. Let's assume a linux-like environment. When I compile a bytecode application, it uses the #! thing to execute ocamlrun, with the app itself (I presume this is bytecode) following. And this action is the exact same as typing: ocamlrun at the commandline instead of just ./, right? Then, the startup code in the bytecode interpreter (ocamlrun) tries to load itself .. and if it turns out to be the interpreter itself, it searches for the app as the command line argument, and opens that, else opens itself (when invoked directly, not via ocamlrun), so that it can access the bytecode in the file. At this stage, we 1) don't need dlopen anywhere, and 2) only need ocamlrun application somewhere for it to be executed. If I were to use the toplevellib.cma, I'd then need dlopen; however, the rest of the application flow is exactly the same, correct? So, to get bytecode running on the bare metal, I'd just need to implement some libc functionality for ocamlrun, possibly try tell ocamlc to generate a different #! path to ocamlrun, and be able to open the bytecode app file using fopen. This is actually starting to sound doable ;-) Thank you all for your valuable input to help me learn the intricacies of the ocaml bytecode interpreter =3D) Kindest Regards, Jonathan Roewen