caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "David McClain" <dmcclain1@mindspring.com>
To: "Brandon J. Van Every" <vanevery@indiegamedesign.com>,
	"caml" <caml-list@inria.fr>
Subject: Re: [Caml-list] Bigarray is a pig
Date: Fri, 23 Jul 2004 15:01:54 -0700	[thread overview]
Message-ID: <004601c47100$ae9f9850$0201a8c0@dylan> (raw)
In-Reply-To: <OOEALCJCKEBJBIJHCNJDIEIOHFAB.vanevery@indiegamedesign.com>

Sorry for letting my mind run ahead of my typing...

What I meant to say previously about danger, is that despite the foreign
arrays being safe from GC disruption, in order to access the arena of these
arrays you have to trick OCaml into believing that it is seeing one of its
own kind of array.

That arena address is a foreign pointer address, but this is potentially
unsafe in the face of GC because the foreign array does not actually have
the require structure to pass as an OCaml array of float. So you have to
take care never to allocate anything in the heap during arena accessing.

That is also why the only permitted access to the array arena is by means of
unsafe_get and unsafe_put. You have to be unsafe to be safe... er, yeah...
But it is very fast! It compile to direct memory reference inside the loops.

David McClain
Senior Corporate Scientist
Avisere, Inc.

+1.520.390.7738 (USA)
david.mcclain@avisere.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


      parent reply	other threads:[~2004-07-23 22:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-23 20:36 Brandon J. Van Every
2004-07-23 21:05 ` Brian Hurt
2004-07-24  9:49   ` Brandon J. Van Every
2004-07-23 21:05 ` Olivier Andrieu
2004-07-24  9:07   ` Brandon J. Van Every
2004-07-24  9:59     ` Marcin 'Qrczak' Kowalczyk
2004-07-25  9:09       ` David McClain
2004-07-24 10:39     ` Markus Mottl
2004-07-23 21:45 ` David McClain
2004-07-23 22:01 ` David McClain [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='004601c47100$ae9f9850$0201a8c0@dylan' \
    --to=dmcclain1@mindspring.com \
    --cc=caml-list@inria.fr \
    --cc=vanevery@indiegamedesign.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).