Re: Accession already allocated arrays
Ron Garret <[email protected]>
| Newsgroups | gmane.lisp.openmcl.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm also a little unclear about exactly what it is you are trying to accomplish, but there is an %address-of function that does more or less what the name implies. But I'm guessing that what you really want is make-heap-ivector/dispose-heap-ivector. rg > On Feb 3, 2023, at 5:32 AM, Tim McNerney <[email protected]> wrote: > > Greg, > > If I understand your question, the answer is contained in the sources for AREF and its specialized helper functions (try disassembling compiler output to see details of what is called). > > There are several different array formats. I don’t know if you care about only one format or if you use the full generality if Lisp arrays. If you are not concerned about maximal performance, there might be > a C version of AREF you can call from your code. Otherwise study the sources and this will tell you how arrays are organized. There is certainly a header with the array type and dimensions followed by the array data itself. > > The garbage collector (GC) needs to understand this format too, unless it is an array that cannot contain pointers. If you are mutating an array with pointers, I recommend you use pre-written (official CCL) accessors, so bugs in C don’t accidentally crash the Lisp v GC. > > --Tim > >> On Feb 3, 2023, at 06:59, Grégory Vanuxem <[email protected]> wrote: >> >> >> “Accessing already allocated arrays data” >> >> Le ven. 3 févr. 2023 à 12:56, Grégory Vanuxem <[email protected] <mailto:[email protected]>> a écrit : >> Hello, >> >> My question is simple, how can I obtain a MACPTR to array data? For usual data type it's easy from the documentation but for arrays I do not know how. >> >> I’m adding code to FriCAS (0), a fork of Axiom (1), and the creation of arrays I’ll use is already implemented. I just need to have direct access to memory, so, in C, an address to the data stored in Clozure CL arrays. >> >> I insist, FriCAS arrays are already implemented, I do not want to use (make-heap-ivector …) for example. >> >> Regards, >> >> Greg >> >> (0): https://fricas.github.io/ <https://fricas.github.io/> >> (1): http ://axiom-developer.org/ <http://axiom-developer.org/>