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-22 (13:28)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Inline assembly?
> Is it possible to use inline assembly in ocaml?

Currently, no.  A gcc-style inline asm facility could be useful to
express some canned instruction sequences that are currently hardcoded
into each native-code generator, but that's also quite a lot of work
to implement properly.

> If not, what is the lowest overhead way to approximate
> it? Using a C function which includes the asm?

Yes.  Since the C function will not heap-allocate nor raise
exceptions, you can tell the compiler about it using the "noalloc"

        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.


- Xavier Leroy
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr