Adriaan van Os wrote:
Frank Heckenbach wrote:
Adriaan van Os wrote:
The failures in nonloc2goto.pas and nonloc4goto.pas go away when increasing the stacksize limit. We might reduce the recursion depth somewhat in these tests, in order to run them in the default Mac OS X stacksize limit of 512 KB.
I'm a bit surprised. Depth 10000 with only one integer parameter shouldn't take much stack -- 16 bytes per recursion on my system. Is the procedure call overhead (WRT stack usage) so big on the Mac?
This is probably due to register preservation, see <http://developer.apple.com/documentation/DeveloperTools/Conceptual/ MachORuntime/2rt_powerpc_abi/chapter_9_section_5.html>. With Mach-O PowerPC calling conventions GPR1, GPR13-31, FPR14-31, VRSAVE and CR2-CR4 are saved, that's 24 registers or 96 bytes ! A waste of stack space, of course, not to mention slow execution due to memory stalls on the stack !
Ouch! Well, I guess with, say, 4 integer parameters and 2048 recursions, you should be on the safe side.
Actually the point is to use up some amount of stack, something like 32-64 KB is more than sufficient.
With 16 bytes per recursion and a depth of 10000 that would be 160 Kbytes. Did you try on Linux (IA-32) ?
Yes. It takes already more than necessary. The minimum (on any platform) is given by the parameter sizes (10000 * 4 for 32 bit integer).
Frank