Commit graph

2 commits

Author SHA1 Message Date
Douglas Katzman f600e2a2e4 Fix some random irrelevant complaints from tests 2023-12-26 22:32:13 -05:00
Christophe Rhodes ab340f240b Fix change-class / (setf slot-value-using-class) interaction
As reported by Shinmera on #lisp, in CHANGE-CLASS, slots with
:INSTANCE allocation were being read correctly in the presence of
applicable non-standard SLOT-VALUE-USING-CLASS methods, but were being
written with a direct access to the slot vector even if the new class
had (SETF SLOT-VALUE-USING-CLASS) methods applicable.

The fix is to short-circuit the slot-value-using-class methods, rather
than execute them.  The reason is not directly related to
CHANGE-CLASS, but rather the protocol for updating obsolete instances:
in order to fulfil that case, we must read and write an object's slots
at a lower-level than going through SLOT-VALUE-USING-CLASS, because
SLOT-VALUE-USING-CLASS will cause another obsolete instance trap.  The
protocol is specified to support only :INSTANCE and :CLASS slots, so
if we impose a rule that the same methods must be applicable to the
old and new slots of the same name, our direct reads and writes will
have the same effect on the slot vectors as full protocol reads and
writes, preserving the illusion that an object is mutated in-place to
the new or updated class.
2020-02-08 14:19:31 +00:00