[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stack calibration

From: Ludovic Courtès
Subject: Re: Stack calibration
Date: Sat, 11 Oct 2008 19:22:02 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux)

Hi Neil,

"Neil Jerram" <address@hidden> writes:

> - it uses a much larger amount of executed code to calibrate stack
> usage: specifically, all the code involved in starting up a standard
> debug-mode REPL
> - it focusses on the problem of getting `make check' to pass (when it
> should do so)
> - it does not modify the value or meaning of the default, C-coded stack limit
> - it doesn't require building the whole of Guile twice!


> I'm only looking at this stage for general thoughts; if you think this
> approach looks good, I will still need to

The approach looks good to me.  It's just annoying that
`SCM_CHECK_STACK' (adding a slight overhead) and "threads.h" have to be

Instead of storing the high water mark in threads, could we have
`%get-stack-depth' and call it from somewhere deep in the code (similar
to what was in your previous patch)?

In that case, instead of using a void port for the REPL's output, we
could for instance use a soft port and measure the stack depth from

  (let ((before (%get-stack-depth))
        (after  #f)
        (port   (make-soft-port (vector (lambda (chr)
                                          (set! after (%get-stack-depth)))
                                        (lambda (str)
                                          (set! after (%get-stack-depth)))
                                        (lambda ()
                                          (set! after (%get-stack-depth)))
                                        #f #f #f))))
    (with-output-to-port port
      (lambda ()
        (with-input-from-string "\n" top-repl)))
    (abs (- after before)))

>  BUILT_SOURCES = cpp_err_symbols.c cpp_sig_symbols.c libpath.h \
>      version.h scmconfig.h \
> +    $(DOT_X_FILES) $(EXTRA_DOT_X_FILES) stack-limit-calibration.scm

As Greg suggested, this could be in `check_DATA' or something like that.

> +;; This is the value of top-repl-hwm-measured that we get on a
> +;; `canonical' build platform.  (See text below for what that means.)
> +(define top-repl-hwm-i386-gnu-linux 9184)

I'd tend to use the actual GNU triplet, like `i386-pc-linux-gnu'.

Thanks for working on it!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]