Commit 97c5462a authored by Robert P. Goldman's avatar Robert P. Goldman
Browse files

New fix for reuse of COMPONENTS based on REINITIALIZE-INSTANCE mehtods.

Thanks to Christophe Rhodes for suggestions.  We use
REINITIALIZE-INSTANCE to clear out-of-date information out of the slots
of COMPONENT objects while they are reused.

Two complications presented themselves:

1.  Previously, I believe for orthogonality, we would either get an old
(reused) COMPONENT or make a new one, but in either case, the handling
of initargs was done by REINITIALIZE-INSTANCE.  This made it impossible
for the REINITIALIZE-INSTANCE methods to "know" that they were in a real
sense RE-initializing.  At the expense of some code duplication, I broke
this sharing, so that now REINITIALIZE-INSTANCE should only be called
when we are reusing a COMPONENT, with an exception below...

2.  We always need to have a SYSTEM object active for the defsystem we
are currently processing.  Accordingly,  SYSTEM objects will *ALWAYS*
be RE-initialized.  So the REINITIALIZE-INSTANCE method required a
little care (in particular, the SOURCE-FILE slot needed delicate
handling.
parent 9c74bac8
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
;;; -*- mode: common-lisp; Base: 10 ; Syntax: ANSI-Common-Lisp -*-
;; -*- mode: common-lisp; Base: 10 ; Syntax: ANSI-Common-Lisp -*-
;;; This is ASDF 2.017: Another System Definition Facility.
;;;
;;; Feedback, bug reports, and patches are all welcome:
@@ -1205,7 +1205,8 @@ make sure we clear them thoroughly."
  (unless long-description-suppliedp
    (slot-makunbound obj 'long-description))
  ;; replicate the logic of the initforms...
  (unless ld-suppliedp (setf load-dependencies nil))
  (unless ld-suppliedp
    (setf (component-load-dependencies obj) nil))
  (setf (component-in-order-to obj) in-order-to
        (component-do-first obj) do-first
        (component-inline-methods obj) inline-methods
@@ -1351,13 +1352,16 @@ make sure we clear them thoroughly."
;;; [2011/09/02:rpg]
(defmethod reinitialize-instance :after ((obj system) &rest initargs &key)
  "Clear SYSTEM's slots so it can be reused."
  ;; this may be a more elegant approach than in the
  ;; COMPONENT method [2011/09/02:rpg]
  ;; note that SYSTEM-SOURCE-FILE is very specially handled,
  ;; by DO-DEFSYSTEM, so we need to *PRESERVE* its value and
  ;; not squash it.  SYSTEM COMPONENTS are handled very specially,
  ;; because they are always, effectively, reused, since the system component
  ;; is made early in DO-DEFSYSTEM, instead of being made later, in
  ;; PARSE-COMPONENT-FORM [2011/09/02:rpg]
  (loop :for (initarg slot-name) :in
        `((:author author)
          (:maintainer maintainer)
          (:licence licence)
          (:source-file source-file)
          (:defsystem-depends-on defsystem-depends-on))
        :unless (member initarg initargs)
        :do (slot-makunbound obj slot-name)))