unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Stefan Israelsson Tampe <stefan.itampe@gmail.com>
To: Chapi Chapo <rixed@happyleptic.org>
Cc: 13088@debbugs.gnu.org
Subject: bug#13088: stack overflow while compiling
Date: Sat, 8 Dec 2012 22:44:15 +0100	[thread overview]
Message-ID: <CAGua6m0C5LGuQ4OQ6Ox5VcH_RiLDuCfv8L214dnLAyumJ6pcng@mail.gmail.com> (raw)
In-Reply-To: <CAGua6m1VwNda8+hyot_oX3yMnndXsi7Jhc0910MJOtWOHcQr6g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2645 bytes --]

Some further findings,

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.

For the second bug above, it's not a bug, it's my-cond syntax not being
recognized and it tries
to tail-call 2000+ argument function which is not supported in guile :-)

In view of this I suggest that we close this bug or perhaps add a feature
request for growing stacks.
An alternate feature request is to have some way to tell guile the size of
the stack at start up.

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.

WDYT
/Stefan

On Thu, Dec 6, 2012 at 5:01 PM, Stefan Israelsson Tampe <
stefan.itampe@gmail.com> wrote:

> Some findings!
>
> 1. The problems probably originates in the translation to tree-il.
> 2. Using something like
> (define-syntax my-cond
>    (syntax-rule ()
>       ((_ (p x ...)    )  (if p (begin x ...)))
>       ((_ (p x ...) . l)  (if p (begin x ...) (my-cond . l))))
>
> Makes the compilation to progress further but fails at a later with,
> scheme@(guile-user)> (compile program #:to 'value)
> language/assembly/compile-bytecode.scm:150:39: In procedure #<procedure
> 2be2a20 at language/assembly/compile-bytecode.scm:150:27 (x)>:
> language/assembly/compile-bytecode.scm:150:39: In procedure
> bytevector-u8-set!: Value out of range: 2070
>
> I quick look at the cond clause in boot.scm does not show any evidence
> that it will blow the stack. In my view the
> suspect is any code in psyntax.scm that does a tree walk of the finished
> code the cond clause is a really deep tree!
> because that cond clause produces a already expanded large codeblock that
> psyntax has to chew on while  the my-cond
> clause above produces the tree-il incrementally in smaller steps.
>
> /Stefan
>
>
>
> On Wed, Dec 5, 2012 at 5:31 PM, <rixed@happyleptic.org> wrote:
>
>> This program tries to compile a long cond expression and fails quickly
>> with
>> a stack overflow.
>>
>> Of course this procedure was generated and a user is unlikely to write
>> such a
>> long cond, but considering the simplicity of the expression I'm surprised
>> that
>> the stack is so solicited.
>>
>> Note that I tested with guile 2.0.6 and not the fresh new 2.0.7 but I
>> haven't
>> noticed anything in the changelog regarding memory consumption.
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 3417 bytes --]

  reply	other threads:[~2012-12-08 21:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-05 16:31 bug#13088: stack overflow while compiling rixed
2012-12-06 16:01 ` Stefan Israelsson Tampe
2012-12-08 21:44   ` Stefan Israelsson Tampe [this message]
2012-12-10 12:16     ` rixed
2012-12-11 22:29       ` Stefan Israelsson Tampe
2012-12-12  8:33         ` rixed
2012-12-12 17:13           ` Stefan Israelsson Tampe
2012-12-14 12:46             ` rixed
2013-03-07 13:27             ` Andy Wingo
2013-03-07 13:26     ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGua6m0C5LGuQ4OQ6Ox5VcH_RiLDuCfv8L214dnLAyumJ6pcng@mail.gmail.com \
    --to=stefan.itampe@gmail.com \
    --cc=13088@debbugs.gnu.org \
    --cc=rixed@happyleptic.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).