Just Launched: You can now import projects and releases from Google Code onto SourceForge
We are excited to release new functionality to enable a 1-click import from Google Code onto the Allura platform on SourceForge. You can import tickets, wikis, source, releases, and more with a few simple steps. Read More
From: Tamas K Papp <tkpapp@gm...> - 2010-02-02 20:42:17
I am trying to mmap an array of double-floats. In particular, my
ideal workflow would be the following:
1. create a 2d array, eg with
(make-array '(10000 100000) :element-type 'double-float)
and fill that array with elements.
2. Dump the array into a file.
3. Load it using mmap, so that it ends up as a Lisp object, and
analyze the contents.
I think I pieced together something that does 3. by slightly modifying
code from a blog post of Juho Snellman:
(defun mmap-lisp-object (map-file)
"Return a lisp object, corresponding to data dumped into a file."
(with-open-file (file map-file)
(let* ((sap (sb-posix:mmap nil
(addr (logior (sb-sys:sap-int sap)
But I don't know how to do the dumping. I know I can get a pointer to
the contents of the lisp array with sb-sys:vector-sap, but that is
only the elements, not the header. Ideally, I am looking for the
function that returns the pointer at the start of the object
(including the header) and the total length in bytes. Then I could
just pin the array, query the pointer & length, and write out stuff in
a loop. Does this make sense, or are there better ways?
I would appreciate any help on which SBCL functions I could use to
actually do this.