Changeset 11825


Ignore:
Timestamp:
05/03/09 19:50:20 (13 years ago)
Author:
ehuelsmann
Message:

Compilation P1:

  • Set up a CATCH block before processing the subforms.
  • Exclude the unwinding forms from the UNWIND-PROTECT block: they are themselves not protected by their own block.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass1.lisp

    r11820 r11825  
    273273  (let* ((tag (p1 (cadr form)))
    274274         (body (cddr form))
     275         (block (make-block-node '(CATCH)))
     276         ;; our subform processors need to know
     277         ;; they're enclosed in a CATCH block
     278         (*blocks* (cons block *blocks*))
    275279         (result '()))
    276280    (dolist (subform body)
     
    286290    (push tag result)
    287291    (push 'CATCH result)
    288     (let ((block (make-block-node '(CATCH))))
    289       (setf (block-form block) result)
    290       block)))
     292    (setf (block-form block) result)
     293    block))
    291294
    292295(defun p1-unwind-protect (form)
     
    294297      (p1 (second form)) ; No cleanup forms: (unwind-protect (...)) => (...)
    295298      (let* ((block (make-block-node '(UNWIND-PROTECT)))
    296              (*blocks* (cons block *blocks*)))
    297         (setf (block-form block) (p1-default form))
     299             ;; a bit of jumping through hoops...
     300             (unprotected-forms (p1-body (cddr form)))
     301             ;; ... because only the protected form is
     302             ;; protected by the UNWIND-PROTECT block
     303             (*blocks* (cons block *blocks*))
     304             (protected-form (p1 (cadr form))))
     305        (setf (block-form block)
     306              `(unwind-protect ,protected-form
     307                 ,@unprotected-forms))
    298308        block)))
    299309
Note: See TracChangeset for help on using the changeset viewer.