[Openmcl-devel] Accession already allocated arrays

Ron Garret ron at flownet.com
Fri Feb 3 08:16:41 PST 2023


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 <mc at media.mit.edu> 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 <g.vanuxem at gmail.com> wrote:
>> 
>> 
>> “Accessing already allocated arrays data”
>> 
>> Le ven. 3 févr. 2023 à 12:56, Grégory Vanuxem <g.vanuxem at gmail.com <mailto:g.vanuxem at gmail.com>> 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/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20230203/f600a0e9/attachment.htm>


More information about the Openmcl-devel mailing list