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

The UNWIND-PROTECT/*FUNCTION bug



I've edited a 1-line correction for this one, and patched XLISP on
the ITS systems (as well as LISP on MC -- but ML and AI are sort of
down now so can't :INSTALL).

    Date: 20 August 1981 06:50-EDT
    From: Kent M. Pitman <KMP at MIT-MC>
    (SETQ X 3)
    (LET ((X (*FUNCTION (LAMBDA () X))))
      (UNWIND-PROTECT () (FUNCALL X)))
    PURPG; AL5AB+3>>HRROM AR1,(A)  AR1/ 0 IN777/ 0
    I believe that *FUNCTION is trying to restore th binding context of
    the previous binding of X and has to restore +INTERNAL-WITHOUT-INTERRUPTS
    along the way and is dying. . .  it should be careful when it 
    restores that binding. . . . I believe that 
     (WITHOUT-INTERRUPTS (WITH-INTERRUPTS ...))
    is an ill-formed notion.

    Date: 21 August 1981 02:16-EDT
    From: Kent M. Pitman <KMP at MIT-MC>
    This bug is not really in *FUNCTION. The 2-arg case of EVAL and the 3-arg
    case of APPLY lose similarly when there is a WITHOUT-INTERRUPTS or 
    UNWIND-PROTECT type thing on the stack in between the execution of the
    EVAL/APPLY and the context being re-instantiated.

I rather agree with you in that relative evaluations should not try
to alter the state of the +INTERNAL-WITHOUT-INTERRUPTS variable -- in
fact as you pointed out, UNWIND-PROTECT explicity binds it to non-()
when running the clean-up code, so as to lock out interrupts therein.
Another way of saying this is the the stupid "variable" 
+INTERNAL-WITHOUT-INTERRUPTS is not enclosed by *FUNCTION.