From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id D0E9BBC68 for ; Mon, 13 Nov 2006 12:34:29 +0100 (CET) Received: from pilet.ens-lyon.fr (pilet.ens-lyon.fr [140.77.167.16]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id kADBYTOv027177 for ; Mon, 13 Nov 2006 12:34:29 +0100 Received: from localhost (localhost [127.0.0.1]) by pilet.ens-lyon.fr (Postfix) with ESMTP id 104BF15BBDC; Mon, 13 Nov 2006 12:34:29 +0100 (CET) Received: from pilet.ens-lyon.fr ([127.0.0.1]) by localhost (pilet [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06844-44; Mon, 13 Nov 2006 12:34:21 +0100 (CET) Received: from [140.77.129.35] (unknown [140.77.129.35]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client did not present a certificate) by pilet.ens-lyon.fr (Postfix) with ESMTP id 20C0D15BB87; Mon, 13 Nov 2006 12:34:21 +0100 (CET) From: Pierre-Etienne Meunier To: Xavier Clerc Subject: Re: [Caml-list] Bytecode object files structure Date: Mon, 13 Nov 2006 12:36:29 +0100 User-Agent: KMail/1.7.2 Cc: caml-list@yquem.inria.fr References: <200611121542.30370.pierreetienne.meunier@ens-lyon.fr> <968382EE-B8CB-452C-A86F-684879E33798@free.fr> In-Reply-To: <968382EE-B8CB-452C-A86F-684879E33798@free.fr> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200611131236.30129.pierreetienne.meunier@ens-lyon.fr> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ens-lyon.fr X-Miltered: at discorde with ID 45585845.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ens-lyon:01 bytecode:01 compiler:01 bytecode:01 compilation:01 ocaml:01 cmo:01 cmi:01 cmo:01 ocaml:01 vaguely:01 ens-lyon:01 beginner's:01 bug:01 cordially:98 Hello, I'd like to write an assembler, to be able to understand how the vm really= =20 works. I've to work on this for a school project (a compiler, I want it to= =20 output caml bytecode object files). I've understood that the data part, after the code itself, was generated us= ing=20 output_value (I didn't know this function before). What I don't get now ar= e=20 the cu_reloc, cu_primitives and cu_imports fields of the compilation_unit=20 type. If you can help on this, Thanks P.E. Meunier On Monday 13 November 2006 11:53, Xavier Clerc wrote: > Hello, > > As I read a substancial part of the ocaml source code, I may help you > understanding file formats. > Could you be more precise about what you are particularly interested > in : > - file type : bytecode file, cmo file, cmi file ? > - code or data section of these files ? > > May I also ask you what you are trying to do using these elements ? > > > Cordially, > > Xavier Clerc > > Le 12 nov. 06 =E0 15:42, Pierre-Etienne Meunier a =E9crit : > > Hi, > > > > I'm trying to decrypt .cmo files produced by simple programs, such as > > 1+1;; > > or > > print_string "string";; > > or > > List.length [1;2;3;4;5];; > > > > According to the source of Ocaml, there's something called the > > "cmo_magic_number", systematically written at the beginning of > > all .cmo > > files. Does it have a real function for executing the programs, or > > is it just > > a way to make sure the file contains ocaml bytecode ? > > > > Then, there's the address of what seems to be the last bytecode > > instruction. > > Then, the bytecode instructions, as documented in opcodes.ml. > > > > After that, I can't understand anything : there vaguely seems to be > > some > > information related to linking or so... What is the precise > > structure of this > > part ? Is there some kind of a bytecode assembler ? > > > > Thanks, > > P.E. Meunier (pierreetienne.meunier@ens-lyon.fr) > > > > _______________________________________________ > > Caml-list mailing list. Subscription management: > > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > > Archives: http://caml.inria.fr > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs