Hello Everyone,

I am working on an architecture with multiple types of memory and I am
wondering about memory allocation. For the purpose of this explaination,
we'll assume I am working with an embedded processor that has both 32 bit
(named X) and 64 bit memory (named Y), 64 bit longs, and uses word
addressing for both. Now given the following code

int main ()
{
      long array [5] = {1,2,3,4,5};
      return 0;
}

the compiler should determine increment based on the length of a long,
however, if the data is in Y memory this is one, while if the data is in X
memory the increment is two. The same problem holds for the offset of local
variables and parameters that are longs etc.

Given that I spent the last little while implementing a prototype that
dealt with the named address space branch, I was able to quickly hack in
some language hooks that allowed me to perform corrections to the increment
for arrays based on their address space, and I may be able to extend this
for other types as well. However, I think a correct & general
implementation may change BITS_PER_UNIT and BITS_PER_WORD in order to
generalize it for each address space (or at the very least introduce new
macros that extend the behavior).

I am just wondering about any other similar work, the feasibilty of either
extension(my work is mainly a proof of concept), any input on how I should
continue or comments on the mistakes of my assumptions.

- Gobi


Reply via email to