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
Alignment of data
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-01-27 (21:20)
From: Goswin von Brederlow <goswin-v-b@w...>
Subject: Re: [Caml-list] Alignment of data
Pascal Cuoq <Pascal.Cuoq@cea.fr> writes:

> Goswin von Brederlow <goswin-v-b@web.de> wrote:
>     You need to write a new function
>     CAMLextern value caml_alloc_double_array (mlsize_t),
>     or similar that ensures alignment on 8 byte for double even for 32bit
>     systems.
>     You should also check the CAMLextern value caml_copy_double (double);
>     that it does the same.
> If you decide to go this route, which this message
> neither endorses not condemns, you also need to
> A1/ allocate the doubles directly in the major heap, and
> A2/ deactivate compactions
> or
> B/ modify the garbage-collector.
> Pascal

Doubles are tagged with Double_tag and arrays of doubles with
Double_array_tag. So the GCC knows where doubles are.

Would it be hard to patch the allocation to leave a 4 byte gap in the
minor heap when needed to align doubles and patch the compation to do
the same?

The 4 bytes would mean inserting an Atom(0) during allocation and
compaction. Not the nicest way to do this but should be simple to patch