Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocaml inlining
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xleroy@p...>
Subject: Re: ocaml inlining
> In the recent versions of Ocaml, are functions inlined
> across modules? Across files?

Yes to both. (Remember: this applies only to the native-code compiler.)
The body of an inlinable function is stored in the .cmx file for its
defining module, thus it can be inlined from other modules.

> If so, what is the effect of
> compiling several files with different levels of inlining?

The inlining level (-inline n) is taken into account when compiling a
function definition, but not when compiling a call to this function.
If the function is small enough (w.r.t. the inlining level at that
time), it is marked inlinable, and all uses of this function will
inline its body, regardless of the value of -inline at the time of use.

- Xavier Leroy