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
R: Ocaml VM and bytecode
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-01-31 (10:54)
From: Fabrice Le Fessant <fabrice.le_fessant@i...>
Subject: Re: R: Ocaml VM and bytecode

The -dinstr instruction causes the ocamlc compiler to output
(pretty-print) the list of bytecode instructions used to compile a
module. For example,

# cat > test.ml
let x = 3;;
# ocamlc -c -dinstr test.ml
        const 3
        acc 0
        makeblock 1, 0
        pop 1
        setglobal Test!

where the last 6 lines are the instructions generated for test.ml in
test.cmo. My patch allows to give such a file (in .ocb) to ocamlc to 
directly generate the .cmo file. By compiling to these instructions,
you will be able to generate .cmo files for any languages (the problem
of interfaces is not solved yet however).

For more information on the bytecode, you should have a look to the
ZINC paper of Xavier Leroy, and to sources of ocaml (such as
byterun/interp.c and bytecomp/printinstr.ml).


- Fabrice