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
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: 2005-11-11 (15:28)
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

val f1: ...
val f2: ...

let f1 = ...
let f2 = ...

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

val f1: ...

val f2: ...

open Foo_f1
open Foo_f2

let f1 = ...

let f2 = ...

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

- Dmitry Bely