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
Assembly labels overflow
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-05-05 (09:21)
From: Dmitry Bely <dmitry.bely@g...>
Subject: Re: [Caml-list] Assembly labels overflow
On Sat, May 2, 2009 at 3:59 PM, Geoffroy <c.geoffroy@gmail.com> wrote:

> I am currently working on a tool which is generating a lot of ocaml code.
> The problem comes during compilation : due to the amount of source code or
> the length of function, i got some "already define symbol" error when the
> camlasm is build. Basically assembly labels appear more than one time.

Probably label_counter exceeds 100000 and local labels overlap L1xxxxx
and L2xxxxxx labels that ocamlopt uses for some internal purposes.
Does your module really need more that 100000 labels? What does your
code do?

> To avoid this i decided to split my generated ocaml code in several small
> pack (down to 5 functions by .ml files) and to use the "-compact" option.
> With this the problem was push back a little.
> But now i am once again facing this problem and i didn't have any more idea
> for it.

In theory you can hack ocamlopt, making internally used labels to
start from 1000000 and 2000000 or more. See files asmcomp/<your
architecture>/emit.mlp and asmcomp/emitaux.ml.

> So i wanted to know if someone got enough knowledge in ocaml internal to
> explain me the perfect form for function to minimise the label production
> during assembly generation.

No, I think it's not possible. If you need to do some action
conditionally, how can you manage without jumps and labels?

- Dmitry Bely