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 RAA20729; Wed, 31 Jul 2002 17:18:51 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA20881 for ; Wed, 31 Jul 2002 17:18:50 +0200 (MET DST) Received: from d12lmsgate-2.de.ibm.com (d12lmsgate-2.de.ibm.com [195.212.91.200]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g6VFInv03024 for ; Wed, 31 Jul 2002 17:18:50 +0200 (MET DST) Received: from d12relay01.de.ibm.com (d12relay01.de.ibm.com [9.165.215.22]) by d12lmsgate-2.de.ibm.com (8.12.3/8.12.3) with ESMTP id g6VFIlPV032522; Wed, 31 Jul 2002 17:18:47 +0200 Received: from d10hubm1.telaviv.ibm.com (d10ml001.telaviv.ibm.com [9.148.216.55]) by d12relay01.de.ibm.com (8.12.3/NCO/VER6.3) with ESMTP id g6VFIlwa104942; Wed, 31 Jul 2002 17:18:48 +0200 Subject: Re: [Caml-list] direct marshaling C<-->ML works in 3.05 To: caml-list@inria.fr, Brian Naylor X-Mailer: Lotus Notes Release 5.0.7 March 21, 2001 Message-ID: From: "Ohad Rodeh" Date: Wed, 31 Jul 2002 18:18:44 +0300 X-MIMETrack: Serialize by Router on D10ML001/10/M/IBM(Release 5.0.9a |January 7, 2002) at 31/07/2002 18:18:47 MIME-Version: 1.0 Content-type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Right, In Ensemble that code was commented out, because the feature did not entirely work in ocaml-3.04. I've just committed the change to CVS, so you can take a look at it there. The idea is to take an ML memory-object and marshal it directly to C malloced buffers, instead of first converting it into a string using Marshal, and then making a copy of it to a C buffer. The reverse works the same way, except that you can get from the network an array of C-iovecs, and you'd like to unmarshal that, at low cost, into an ML memory object. The basic code is in socket/s/mm.c, look for mm_input_val, and mm_output_val. These functions are used from socket/s/socket.ml. In ocaml terms, the basic supporting functions are (intext.h): CAMLextern long output_value_to_block(value v, value flags, char * data, long len); /* Output [v] with flags [flags] to a user-provided memory buffer. [data] points to the start of this buffer, and [len] is its size in bytes. Return the number of bytes actually written in buffer. Raise [Failure] if buffer is too short. */ CAMLextern value input_value_from_block(char * data, long len); /* Read a structured value from a user-provided buffer. [data] points to the beginning of the externed data in this buffer, and [len] is the length in bytes of valid data in this buffer. The buffer is never deallocated by this routine. */ By now I've interfaced the C-Ensemble interface, with JNI, and I can tell you that this feature is not supported in Java. Ohad. ----------------------------------------------------------------------------------- Ohad Rodeh tel: +972-3-6401641 IBM Haifa, storage research Brian Naylor cc: Subject: Re: [Caml-list] direct marshaling C<-->ML works in 3.05 31/07/2002 17:53 Hi. Can you give me a reference for what you mean by 'direct marshalling'? Does this somehow bypass the Marshal library? I have the Ensemble code base (there's a lot of it!) so I can follow a specific pointer if you have one. Thanks! --- Ohad Rodeh wrote: > Direct marshaling between ML memory-objects and C io-vectors works great > with the new release (3.05). __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners