From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA17952; Thu, 22 Mar 2001 14:28:32 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA18371 for ; Thu, 22 Mar 2001 14:28:31 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f2MDSQb22078; Thu, 22 Mar 2001 14:28:26 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA18472; Thu, 22 Mar 2001 14:28:26 +0100 (MET) Date: Thu, 22 Mar 2001 14:28:26 +0100 From: Xavier Leroy To: Niall Dalton Cc: caml-list@inria.fr Subject: Re: [Caml-list] Inline assembly? Message-ID: <20010322142826.B18008@pauillac.inria.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: ; from ndalton@ics.uci.edu on Wed, Mar 21, 2001 at 12:00:47AM -0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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" 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. Regards, - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr