How to increase the size of GCL's 'bind stack' ?



I found an obscure small Cygwin command-line utility called 'peflags' that can be used to change the amount of stack for _any_ Windows executable -- not just Cygwin exectables.

Thus, I was able to change the stack size for SBCL Lisp with the following command in the appropriate directory under 'Program Files':

   Query the current stack-reserve setting

peflags --stack-reserve sbcl.exe
sbcl.exe: stack reserve size    : 2097152 (0x200000) bytes

   Provide a new stack-reserve setting

peflags --stack-reserve=0x1000000 sbcl.exe
sbcl.exe: stack reserve size    : 16777216 (0x1000000) bytes

After doing increasing the stack size on SBCL, my program ran just fine (and considerably faster than GCL, as well).

Note that sbcl.exe is a relatively small program which loads the main sbcl.core image.  Nevertheless, sbcl.exe sets the amount of stack for the whole program.

'peflags' can also adjust other settings, as well, including heap size, etc.

I have no idea if 'peflags' will work correctly on 64-bit applications, though.

Unfortunately, using peflags on GCL doesn't help, because GCL doesn't use the standard stack for its 'bind stack'.

But at least we now know how to increase the stack size on SBCL !

At 10:28 AM 8/7/2013, Richard Fateman wrote:
>Hi Henry --
>I can't help with GCL. But here's what I've sometimes done.
>
>Say I start with something that might be thought of schematically as
>
>x[n]:= f(x[n-1],...)
>x[0]:  initialvalue
>
>x[2000]    -->     bind stack overflow.    { because x[2000] requires computation of x[1999] etc etc.
>
>to fix this. just do
>
>for i:1 thru 2000 do x[i]
>
>then x[2000]  is easy.    (note that we are using the 'memoization' feature of    :=  }
>
>As for other lisps:
>I use the GCL version on windows because I know it works and others seem to have
>shown it is somewhat faster, and I am suspicious of SBCL which starts up on windows with a
>message
>      This is experimental prerelease support for the Windows platform: use
>       at your own risk.  "Your Kitten of Death awaits!"
>or at least used to..
>..
>
>I also use a version I compile for Allegro Common Lisp  ( the free trial can do it)
>so I can use foreign functions and better debugging;  I'm not sure that ACL allows
>run-time stack expansion, but it has a notion of a soft-stack-cushion for recoverable
>errors.