unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
To: Andy Wingo <wingo@pobox.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: stack calibration
Date: Mon, 30 Mar 2009 21:43:36 +0100	[thread overview]
Message-ID: <87d4bypwqv.fsf@arudy.ossau.uklinux.net> (raw)
In-Reply-To: <m3ljqqsly7.fsf@pobox.com> (Andy Wingo's message of "Fri\, 27 Mar 2009 14\:19\:28 -0700")

Andy Wingo <wingo@pobox.com> writes:

> Hey Guilers,

Hi Andy,

In summary, I'm not sure I'm following the logic here...

> The recent commit to compile with the stack calibration file,
> 7ca96180f00800414a9cf855e5ca4dceb9baca07, breaks compilation because the
> compile scripts have hash-bang lines like this:
>
> #!/bin/sh
> # -*- scheme -*-
> exec ${GUILE-guile} -e '(@ (scripts compile) compile)' -s $0 "$@"
> !#

FWIW, I think this kind of incantation is really horrible.  Ditto for
usage of "guile-tools ...".  What kind of a scripting language is it
that needs to be bootstrapped by a different language?

Anyway, I see the breakage...  (Probably almost any change would break
something so fragile.)

> Also, it is a bit irritating to have to load a file just so Guile won't
> be broken (exaggerated wording, but I think that's what it is.)

I think you may be misunderstanding.  stack-limit-calibration.scm
should make precisely 0 difference on the "canonical build platform" -
which in practice means ia32 GNU/Linux.

As Guile stands (and notwithstanding your idea that we could use
getrlimit instead), we do hardcode _some_ stack depth limit.  Once
that was 20k, then 40k, and you're now suggesting 60k.  Those are
supposed to be values that will work on the canonical platform.

stack-limit-calibration.scm is all about scaling down/up the hardcoded
value for a non-canonical platform that might use more or less stack
on average than the canonical platform - e.g. because it has fewer
registers, because its pointers are twice the size (ia64) etc.

The primary purpose of stack-limit-calibration.scm is to allow "make
check" to succeed on those platforms, and it now makes sense to
generalize that to any other guile-using operations that we run during
the build - such as compiling.

It would probably also make sense to install
stack-limit-calibration.scm, so that 3rd party programs could also use
it; but we don't currently do that.

> So I have a proposal. We should set the stack limit to 60k words.

If we need 60k on the canonical build platform, we should have 60k.
No issue there.

>   Pros: 1) This way Guile will just work.

(For you.  Other platforms may still need stack-limit-calibration.scm.)

>         2) It's simple.
>         3) We avoid the evaluator this way.
>
>   Cons: 1) A stack-consuming process will take longer to catch.

Not a problem.  Any individual program can set the stack limit
differently, if they so choose.

> I cannot think of any other cons. GC just marks between the stack base
> and the stack pointer anyway. This would be 500 kB on x86-64, but a
> normal program would never use that, and last time I looked processes
> had 2 MB of stack by default anyway. It would be 250 kB on Linux.
>
> If we were really concerned about processes actually consuming all of
> their stack, we should use a value from getrlimit(2) instead.

I don't think that is the concern.  I think the idea is to catch
incorrectly written (i.e. usually non-tail-recursive) programs before
they crash.

Regards,
        Neil




  parent reply	other threads:[~2009-03-30 20:43 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 21:19 stack calibration Andy Wingo
2009-03-27 22:04 ` Mike Gran
2009-03-27 22:29   ` Julian Graham
2009-03-30 20:43 ` Neil Jerram [this message]
2009-03-31  3:39   ` Andy Wingo
2009-03-31 22:47     ` Neil Jerram
2009-04-03 17:44       ` Andy Wingo
2009-03-31 17:45   ` Greg Troxel
2009-04-17  9:35   ` Andy Wingo
2009-03-31 16:20 ` Ludovic Courtès
     [not found] <47B2A8DF.9070004@tammer.net>
     [not found] ` <87tzkd8bvz.fsf@gnu.org>
     [not found]   ` <87ejbh8ben.fsf@gnu.org>
     [not found]     ` <47B2D88F.1040505@tammer.net>
     [not found]       ` <87ir0tvx6e.fsf@inria.fr>
2008-02-13 20:40         ` stack overflow Neil Jerram
2008-02-14  8:48           ` Ludovic Courtès
2008-02-14 10:26             ` Mikael Djurfeldt
2008-02-14 11:25               ` Ludovic Courtès
2008-02-14 11:39                 ` Mikael Djurfeldt
2008-02-25 21:52                   ` Neil Jerram
2008-09-12 20:47                     ` Stack calibration Ludovic Courtès
2008-09-27 18:20                       ` Neil Jerram
2008-09-28 20:05                         ` Ludovic Courtès
2008-09-30 22:10                           ` Neil Jerram
2008-10-02  8:25                             ` Andy Wingo
2008-10-02  8:38                               ` Neil Jerram
2008-10-02 22:30                             ` Neil Jerram
2008-10-06 22:32                               ` Ludovic Courtès
2008-10-06 23:11                                 ` Neil Jerram
2008-10-09 22:53                                   ` Neil Jerram
2008-10-10 13:22                                     ` Greg Troxel
2008-10-10 18:04                                       ` Neil Jerram
2008-10-10 18:28                                         ` Greg Troxel
2008-10-10 18:41                                           ` Neil Jerram
2008-10-11 17:22                                     ` Ludovic Courtès
2008-10-12 15:59                                       ` Neil Jerram
2008-10-12 21:16                                         ` Neil Jerram
2008-10-13 21:37                                           ` Neil Jerram
2008-10-14  7:25                                           ` Ludovic Courtès
2008-10-17 20:49                                             ` Neil Jerram
2008-10-14  7:19                                         ` Ludovic Courtès
2008-09-28 20:07                         ` Ludovic Courtès
2008-09-30 22:11                           ` Neil Jerram

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=87d4bypwqv.fsf@arudy.ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-devel@gnu.org \
    --cc=wingo@pobox.com \
    /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).