unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* alloca, continuations and debug info
@ 2004-08-26 23:15 Neil Jerram
  2004-08-27  0:07 ` Kevin Ryde
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Jerram @ 2004-08-26 23:15 UTC (permalink / raw)


I just traced a crash while displaying a backtrace to a build problem 
whereby the alloca.c in libguile is unnecessarily picked up (on Windows 
2000, which actually has alloca defined as a macro).  And I was 
wondering whether it would be better to remove libguile/alloca.c 
altogether from the distribution.

The problem with the "portable" implementation of alloca in 
libguile/alloca.c is that the memory which it allocates is not on the 
stack.  Therefore, if you capture a continuation while running the debug 
evaluator, then invoke the continuation, then do something to cause a 
backtrace, the scm_t_debug_info's are likely to be garbage because they 
weren't properly saved and restored by the continuation code.

So on any platform which needs libguile/alloca.c - because that platform 
doesn't have a proper alloca - Guile may crash.  I therefore suggest 
maybe removing libguile/alloca.c from the distribution, and considering 
other options for the places where alloca is used:

- On platforms that have GCC but not alloca (if this is possible), Guile 
could use GCC's ability to declare variable sized arrays on the stack 
instead.

- Or if GCC not available, Guile could declare a constant sized array 
for the scm_t_debug_info's.

- As a last resort, you could just say: no proper alloca, no Guile!

Regards,
       Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: alloca, continuations and debug info
  2004-08-26 23:15 alloca, continuations and debug info Neil Jerram
@ 2004-08-27  0:07 ` Kevin Ryde
  2004-09-08 15:12   ` Marius Vollmer
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2004-08-27  0:07 UTC (permalink / raw)
  Cc: guile-devel

Neil Jerram <neil@ossau.uklinux.net> writes:
>
> - On platforms that have GCC but not alloca (if this is possible),

I think gcc always provides __builtin_alloca.

> - As a last resort, you could just say: no proper alloca, no Guile!

That's probably not too terrible.

I've got an idea cray vector systems don't have alloca, but that they
do have variable sized automatics (which obviously gives nearly the
same effect if used right).  These are probably not platforms where
guile works at all now though. :)


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: alloca, continuations and debug info
  2004-08-27  0:07 ` Kevin Ryde
@ 2004-09-08 15:12   ` Marius Vollmer
  0 siblings, 0 replies; 3+ messages in thread
From: Marius Vollmer @ 2004-09-08 15:12 UTC (permalink / raw)
  Cc: guile-devel

Kevin Ryde <user42@zip.com.au> writes:

>> - As a last resort, you could just say: no proper alloca, no Guile!
>
> That's probably not too terrible.

Yes, I think this is acceptable, too.  It is in any case better than
using alloca incorrectly.

I will remove alloca.c from libguile, etc.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-08 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-26 23:15 alloca, continuations and debug info Neil Jerram
2004-08-27  0:07 ` Kevin Ryde
2004-09-08 15:12   ` Marius Vollmer

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).