Subject: Re: bug#13088: stack overflow while compiling

From: Stefan Israelsson Tampe <[email-masked]>
Date: Tue, 11 Dec 2012 23:29:31 +0100

Hi,

I did some effort into getting this working. but first you could try to use
an
or-map to get what you want in stead if compiling everything into code. but
it's probably
faster what you are doing.

Anyway in vm.c I changed the
#define VM_DEFAULT_STACK_SIZE (64 * 1024)

to
#define VM_DEFAULT_STACK_SIZE (64 * 1024 * 64)

and recompiled!

Then I can compile to tree-il. Compiling all the way does not work well,
But if you enter
scheme@(guile-user)> (compile program #:to 'value #:opts '(#:partial-eval?
#f #:cse? #f))  ;;NO OPTIMIZATION PASSES

It will compile to.

$7 = #<procedure 3708400 (proto server-port client-zone server-zone
signature-id)>

In all this emphasizes what I said in earlier and I would still ask for a
sane way to change the stack size for guile
and document it well.

Cheers!
/Stefan

On Mon, Dec 10, 2012 at 1:16 PM, <[email-masked]> wrote:

> -[ Sat, Dec 08, 2012 at 10:44:15PM +0100, Stefan Israelsson Tampe ]----
> > The whole macro-expansion to tree-il in psyntax is not done in a tail
> call
> > manner which limits the sizes
> > of code tree's that we can compile. Although it would be interesting to
> > know how to code the
> > psyntax expand algorithm in such a way that we don't risk blowing the
> > stack, I think we
> > will be better served by waiting for better stack algorithm that
> implement
> > growing stacks.
>
> If it was not obvious already I must confess I'm ignorant about the
> internals
> of guile (and of any other scheme compiler), so what I will say is probably
> irrelevant. but I changed the cond into the equivalent if forms, which
> I believe are not macros, but the result is the same (stack overflow).
>
> > An alternate feature request is to have some way to tell guile the size
> of
> > the stack at start up.
>
> If though that was what '(debug-set! stack x)' was for, but this does not
> seams to change anything. I also tried changing stack limits with ulimit
> to no avail.
>
> > For now anyone that need to compile large functions the only option, I
> > believe, is to change the stack size in the code
> > and recompile.
>
> Any hint on how to do that specifically for guile, beyond the above
> ulimit/setrlimit?
>
>