Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 >
let x = 3;;
# ocamlc -c -dinstr
        const 3
        acc 0
        makeblock 1, 0
        pop 1
        setglobal Test!

where the last 6 lines are the instructions generated for 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/


- Fabrice