Version française
Home     About     Download     Resources     Contact us    
Browse thread
No unused code linking?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dbely@m...>
Subject: Re: [Caml-list] No unused code linking?
malc <malc@pulsesoft.com> writes:

>> IMHO, each header item can be placed into the separate DATA section, so
>> it's not the real problem (the frame table is).
>
> No it can not. The moduler header must be contiguous and not rearranged by
> linker. In absence of .cmx (and name -> mangled name table) OCaml uses the
> header to call functions by position. Thus, as it is now, no part of
> header can be eliminated, which in reality means that almost everything,
> from linkers perspective, is reachable and can not be removed by
> --gc-functions.

>>> All in all this would require quite an effort in restructuring almost
>>> everything. I wouldn't count on it.
>>
>> Probably you are right, but I still hope for a miracle :-)
>>
> Right rigth, that's exactly what's required

As the Ocaml team people remain silent I am afraid your analysis is
correct. OK, we cannot easily do the job during the code generation but
maybe we can rearrange the source files? Say, if we have

[foo.mli]
val f1: ...
val f2: ...

[foo.ml]
let f1 = ...
let f2 = ...

could we transform them (with some camlp4-based source-level tool) to

[foo_f1.mli]
val f1: ...

[foo_f2.mli]
val f2: ...

[foo.mli]
open Foo_f1
open Foo_f2

[foo_f1.ml]
let f1 = ...

[foo_f2.ml]
let f2 = ...

Isn't it equivalent to the initial version but can be linked separately?

- Dmitry Bely