clos: allocate-instance: add a comment in allocate-instance

As pointed out by Dr. Robert Strandth initargs argument may be passed
to allocate-instance only after the class has been already finalized,
and indeed we finalize it in make-instance. To be on a safe side,
unlike CLASP, we still check whether the class is already finalized in
case of someone calling allocate-instance outside the make-instance
method.
This commit is contained in:
Daniel Kochmański 2020-04-13 09:55:59 +02:00
parent 3ec02d6daf
commit 681caade84

View file

@ -98,8 +98,12 @@
(defmethod allocate-instance ((class class) &rest initargs)
(declare (ignore initargs))
;; FIXME! Inefficient! We should keep a list of dependent classes.
;; As pointed out in the CLASP source code (after Dr. Strandh), the
;; class is already finalized, because initargs can't be computed
;; without finalizing the class. We keep the next form to be on a
;; safe side, but under normal circumstances it is never executed.
(unless (class-finalized-p class)
;; FIXME! Inefficient! We should keep a list of dependent classes.
(finalize-inheritance class))
(let ((x (si::allocate-raw-instance nil class (class-size class))))
(si::instance-sig-set x)