From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id B7482BB9C for ; Thu, 17 Nov 2005 22:13:02 +0100 (CET) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.205]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAHLD1S5016016 for ; Thu, 17 Nov 2005 22:13:02 +0100 Received: by xproxy.gmail.com with SMTP id t10so25927wxc for ; Thu, 17 Nov 2005 13:13:01 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=OIx5UDUsBvuZJYeq+JCO+L8rtKWFuFuc5yh8sH/sOK/JqrlRVtLaf9+blK5lyWGuzT8jiKcwa/My1btFh/ypoTHYOd/drHYwSDoi4rKLZ7HyjjXMpfUVdcN2F1M3tgsUjekf5n0meKXw/PS8ZVuxusfgK8DsyWDOMa4CYyQp2rs= Received: by 10.65.22.6 with SMTP id z6mr3221398qbi; Thu, 17 Nov 2005 13:13:00 -0800 (PST) Received: by 10.64.10.5 with HTTP; Thu, 17 Nov 2005 13:13:00 -0800 (PST) Message-ID: Date: Fri, 18 Nov 2005 10:13:00 +1300 From: Jonathan Roewen To: caml-list@yquem.inria.fr Subject: [Caml-list] doing MMX through ocaml MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Miltered: at nez-perce with ID 437CF25D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 ocaml:01 wrappers:01 ffi:01 o'caml:01 ffi:01 stack:01 integers:01 val:01 val:01 compiler:01 interp:01 parser:01 defining:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 Hi, I've received a lot of feedback on an mpeg2 decoder in ocaml, and about performance woes ;-) So... the next step: building an MMX library =3D) I presume it is possible, though, would lose a lot of benefits having to use C wrappers everywhere.... The FFI just requires that the external symbol exists, right? Soooo, I could theoretically define pure ASM routines that O'Caml could call. The question begs: does OCaml expect the FFI function to have a particular layout? Obviously, args have to be retrieved from the stack, right? And there's no way around this? And since MMX deals solely with integers, the Val_long/Long_val macros could be implemented by a simple extra MMX instruction or two, right? Maybe I could mod the compiler: create a 'naked' version of external, and define registers to put values in, retrieve from? I've had a look at the interp.c sources, and they don't look that complicated... just a matter of defining a new instruction type for a C_CALL, and altering the code generator and parser... though, that part in itself might be quite tricky. Basically, the idea is to create either a generic Math, or a special MMX module built into the kernel, that apps can utilise if so wanted. Of course, for the packed data types in MMX, might need some custom types, but that shouldn't be too much of a problem. Jonathan