Ignore:
Timestamp:
05/06/09 20:39:51 (13 years ago)
Author:
ehuelsmann
Message:

Fix ticket #21 finally: JVM stack inconsistency error on
inlining unwind-protect.

The issue in the earlier attempts was that p1 outcomes can only
be compiled once (first try) and that one cannot p1 the same form
twice (one needs to create a copy; second try).

File:
1 edited

Legend:

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

    r11833 r11837  
    300300  (if (= (length form) 2)
    301301      (p1 (second form)) ; No cleanup forms: (unwind-protect (...)) => (...)
     302
     303      ;; in order to compile the cleanup forms twice (see
     304      ;; p2-unwind-protect-node), we need to p1 them twice; p1 outcomes
     305      ;; can be compiled (in the same compiland?) only once.
     306      ;;
     307      ;; However, p1 transforms the forms being processed, so, we
     308      ;; need to copy the forms to create a second copy.
    302309      (let* ((block (make-block-node '(UNWIND-PROTECT)))
    303310             ;; a bit of jumping through hoops...
     311             (unwinding-forms (p1-body (copy-tree (cddr form))))
    304312             (unprotected-forms (p1-body (cddr form)))
    305313             ;; ... because only the protected form is
     
    309317        (setf (block-form block)
    310318              `(unwind-protect ,protected-form
     319                 (progn ,@unwinding-forms)
    311320                 ,@unprotected-forms))
    312321        block)))
Note: See TracChangeset for help on using the changeset viewer.