On Aug 7, 2006, at 11:49 AM, Mars Saxman wrote:

On Aug 7, 2006, at 10:52 AM, Jan Erik Moström wrote:

Curious, why is there a limit? Is it because relative addressing or something
else?

The PowerPC load and store instructions use a 16-bit immediate offset, which yields a range of 32k above or below the base address. Stack data is always located above the stack pointer, so one instruction can reach no more than 32k of the stack at a time.

There are, of course, ways to work around this, but doing it in such a way that normal methods are not penalized would be a fair bit of work. Since the only methods which reach the limit are the ones so large they ought to be refactored anyway, this has not been a priority.

Mars Saxman

This makes perfect sense. However, what has surprised me is that in RB2005, the particular method that is now giving me trouble compiled just fine. The method in question simply does something like this 1024 times:

Variable(i, increment(j)) = constant

"Variable" is a 2D array of integers,"i" and "j" are integers, "increment" is a method that adds one to its byref argument and returns the value, and "constant" is a numerical constant value specified in the method (which is different for each of the 1024 times this line is repeated in the method).

Now I can understand that the compiler would put the 1024 constants defined in the method on the stack, but that should only take up 4K of space. So there must have been a change somewhere (between 2006r1 and 2006r2?) where the compiler now puts much more information on the stack, (32 bytes per iteration instead of the expected 4 bytes). Mars, is that correct? Since it is not really logical to "refactor" this particular method, is there a way that I can reduce the overhead in the method so that it does not use up so much stack space per iteration?

This is not a show-stopper, as I can easily (if illogically) break up the method into two lists of 512 constants instead of one list of 1024. I am mostly just curious.

Tom Moore
-------------------------------------------------------------
This message has been scanned by Postini anti-virus software.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to