MemoryAddress object changes once put into memory
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Tue Jan 14 18:35:24 UTC 2020
On 14/01/2020 18:31, Ty Young wrote:
>
>>>>
>>>> Or is there any other "safe" way of implementing multi-dimensional
>>>> arrays that I'm not aware of?
>>>
>>> It largely depends on how your implementation works - but if your
>>> mutidimensional array is just a sparse collection of pointers to
>>> other arrays with given size, which can live anywhere in memory, I
>>> don't think there's much you can do safely (at least not on top of
>>> my head).
>>>
>>> If you implement a more dense representation (e.g. like a tensor -
>>> where elements are stored in a N1 * N2 * ... NM matrix) then you
>>> know by construction that rows, columns, elements will always be
>>> bound by the toplevel segment which contains the entire tensor. But
>>> a dense representation doesn't need pointers, so the code would be
>>> very different from the one you have.
>>
>>
>> Alright, thanks.
>
>
> Quick question: in the eyes of the Memory Access API how are
> multi-dimensional arrays coming from C implemented? Tensor? Something
> else?
A multidimensional array in C is just a big dense matrix. So you can
model it as a single segment (and then use a multi-dimensional var
handle to access it, so that you have one index for each dimension).
Maurizio
>
>
>>
>>
>>>
>>> Maurizio
>>>
>>>>
>>>>
>>>>>
>>>>> Maurizio
More information about the panama-dev
mailing list