[Top][All Lists]

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

Re: please help concerning specpdl

From: Davis Herring
Subject: Re: please help concerning specpdl
Date: Mon, 6 Dec 2010 08:22:30 -0800 (PST)
User-agent: SquirrelMail/1.4.8-5.el5_4.10.lanl3

> count = SPECPDL_INDEX ();
> record_unwind_protect
> val = Fprogn (args);
> return unbind_to (count, val);

> Can you explain me the logic of specpdl please ?

The specpdl contains information needed to remove variable bindings and
provide other services that are guaranteed even in the case of abnormal
exit.  Abnormal exits operate by calling longjmp(3), so there's no
guaranteed chance to perform cleanup in the normal flow of execution.  But
the function that calls longjmp(3) (`unwind_to_catch') first peruses the
specpdl and handles its elements appropriately, so the guaranteed
operations happen.  The actual unwinding is done by `unbind_to', so if the
body exits normally, we just call that to perform the unwinding operations
without longjmp(3).

So: the count identifies how far to unwind in case of normal exit (in case
of abnormal exit, we'll unwind farther anyway, so we don't need `count'). 
The `record_unwind_protect' registers something to do at unwind-time, and
then `unbind_to' performs it unless `unwind_to_catch' does.  `val' is
passed to `unbind_to' for GC reasons, I believe.


This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during

reply via email to

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