This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: z


[I'm moving this discussion to the guile list]

Ken Pizzini <ken@halcyon.com> writes:

> I am bothered by the warnings that gcc emits about some variables
> in libguile/eval.c potentially being harmed by setjmp() because
> they are not being declared as volatile.
> [...]
> I would be willing to do the work of finishing the changes
> if you feel that my approach to the problem is reasonable,
> but I don't want to waste my time if you think that this
> approach is way off base.  Let me know.

I'd prefer to ignore this problem as long as possible, i.e. until
continuations doesn't work on some machine out there!

This is because making x and env volatile in the evaluator could have
very bad effects on performance.  (Maybe you could measure the effect
with some suitable benchmark, e.g. Aubrey Jaffer's Pi calculation?)

The risk we take is that the variables are stored in a register
instead of on the stack so that they aren't restored after the setjmp
at eval.c:1944, right? (and at some less important places as well...)

BTW, I have some problems understanding your suggested changes.
Wouldn't it be better to declare the arguments as volatile, e.g.:

SCM_CEVAL (volatile SCM arg_x, ...)
{
  [register] SCM x = arg_x;

and use this unqualified/register x in the code?
One should then restore x from arg_x after each setjmp.

/mdj