inlining
On Fri, Sep 15, 2006 at 02:05:07AM +0200, Sylvain Le Gall wrote:
> Do you know how to activate inlining ? (maybe i really miss something
> about all this).
It's always on, AFAICT. For example:
test.ml:
let id x = x
let plus1 x = x + 1
foo.ml:
let () =
let n = Test.id (Test.plus1 (int_of_string Sys.argv.(1))) in
print_int n;
print_newline ()
Try doing
$ ocamlopt -c test.ml
$ ocamlopt -c -dcmm foo.ml
The -dcmm will dump the "C--" intermediate code. You can see that
the "id" and "plus1" functions have been inlined.
Now, if you do
$ rm test.cmx
$ ocamlopt -c -dcmm foo.ml
you will see that the code makes calls through the Test module
instead, since the .cmx file is unavailable.
--
Eric Cooper e c c @ c m u . e d u
Reply to: