Changeset 10255


Ignore:
Timestamp:
Jul 30, 2008, 11:01:22 PM (11 years ago)
Author:
gb
Message:

In CLEAR-IOBLOCK-STREAMS, be careful about the use of TYPEP: we may
have just cleared foreign classes from data structurs that map
from their (per-session) addresses to metainformation about them,
and calling TYPEP (and class-cell-typep ...) on them may cause
their addresses to be reentered in those data structures. Those
pointers will become DEAD-MACPTRs in the saved image, and we'll
wind up with a tree full of DEAD-MACPTRs and will possibly choke
on them in the startup code (e.g., REVIVE-OBJC-CLASSES).

This seems to close ticket:320.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lib/dumplisp.lisp

    r9883 r10255  
    4141(defun clear-ioblock-streams ()
    4242  (%map-areas (lambda (o)
    43                 (if (typep o 'basic-stream)
    44                   (let ((s (basic-stream.state o)))
    45                     (when (and (typep s 'ioblock)
    46                                (ioblock-device s)
    47                                (>= (ioblock-device s) 0))
    48                       (setf (basic-stream.state o) nil)))
    49                   (if (typep o 'buffered-stream-mixin)
    50                     (let ((s (slot-value o 'ioblock)))
    51                       (when (and (typep s 'ioblock)
     43                  (if (typep o 'basic-stream)
     44                    (let ((s (basic-stream.state o)))
     45                      (when (and (typep s 'ioblock)
    5246                                 (ioblock-device s)
    5347                                 (>= (ioblock-device s) 0))
    54                         (setf (slot-value o 'ioblock) nil))))))))
     48                        (setf (basic-stream.state o) nil)))
     49                    ;; Have to be careful with use of TYPEP here (and
     50                    ;; in the little bit of Lisp code that runs before
     51                    ;; the image is saved.)  We may have just done
     52                    ;; things to forget about (per-session) foreign
     53                    ;; class addresses, and calling TYPEP on a pointer
     54                    ;; to such a class might cause us to remember
     55                    ;; those per-session addresses and confuse the
     56                    ;; startup code.
     57                    (if (and (eql (tyepcode o) target::subtag-instance)
     58                             (typep o 'buffered-stream-mixin))
     59                      (let ((s (slot-value o 'ioblock)))
     60                        (when (and (typep s 'ioblock)
     61                                   (ioblock-device s)
     62                                   (>= (ioblock-device s) 0))
     63                          (setf (slot-value o 'ioblock) nil))))))))
    5564
    5665(defun save-application (filename
     
    131140                           (funcall f))
    132141                         (kill-lisp-pointers)
    133                          #-ppc-target
    134142                         (clear-ioblock-streams)
    135143                         (%set-toplevel
Note: See TracChangeset for help on using the changeset viewer.