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
[Caml-list] Inline assembly?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-03-23 (15:59)
From: Markus Mottl <mottl@m...>
Subject: Re: [Caml-list] Inline assembly?
On Thu, 22 Mar 2001, Xavier Leroy wrote:
> Yes.  Since the C function will not heap-allocate nor raise
> exceptions, you can tell the compiler about it using the "noalloc"
> annotation:
>         external myfunction : ... = "myfunction" "noalloc"
> and this will select a faster calling convention from Caml to C for
> this function.  If the function operates over floats, there are other
> performance tricks one can play; write me if this is the case.

I have some functions that return floats in the LAPACK-interface. They
could (slightly) benefit from more appropriate calling conventions.

If I am not mistaken, it is not ok to use "noalloc" if the C-function uses
"copy_double", because the latter could trigger the GC. If the function
returns a float, it seems that the additional annotation "float" could
be applied, but it is obviously not always used in the Pervasives library
(e.g. float_of_string; ld_exp).

Is this just an oversight or do these functions have other properties that
prevent the use of this annotation? Are there special rules to follow?

Best regards,
Markus Mottl

Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr