Slot access failure in interpreted mode
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
When using the interpreter, accessing a slot fails in some situations. After evaluating this:
(setq *evaluator-mode* :interpret)
(defclass foo () ((x :initform 123)))
(defun foo-x-0 (foo)
(slot-value foo 'x))
(defmethod foo-x-1 ((foo foo))
(slot-value foo 'x))
(defmethod foo-x-2 ((foo foo))
(let ((%foo foo))
(slot-value %foo 'x)))
(defmethod foo-x-3 ((foo t))
(slot-value foo 'x))
I get the following results:
(foo-x-0 (make-instance 'foo)) => ERROR
(foo-x-1 (make-instance 'foo)) => 123
(foo-x-2 (make-instance 'foo)) => ERROR
(foo-x-3 (make-instance 'foo)) => ERROR
The error is:
The function
(SB-PCL:
undefined.
There is no such problem when *EVALUATOR-MODE* is :COMPILE.
Looking at the FUNCTION-
For foo-x-0: SLOT-VALUE
For foo-x-1: SB-PCL:
For foo-x-2: SB-PCL:
For foo-x-3: SB-PCL:
(Presumably because FOO-X-1 knows the type of the first argument to SLOT-VALUE but the other functions don't.)
It looks like the compiler defines the function (SB-PCL:
(compile 'foo-x-0)
(foo-x-3 (make-instance 'foo)) => 123
(foo-x-2 (make-instance 'foo)) => 123
(foo-x-1 (make-instance 'foo)) => 123
(foo-x-0 (make-instance 'foo)) => 123
The problem persists in version 2.3.2.8-63bafe1ba.
uname -a: Linux io 6.1.12-arch1-1 #1 SMP PREEMPT_DYNAMIC Tue, 14 Feb 2023 22:08:08 +0000 x86_64 GNU/Linux
*FEATURES*:
(:ARENA-ALLOCATOR :X86-64 :GENCGC :64-BIT :ANSI-CL :COMMON-LISP :ELF
:IEEE-
:SB-PACKAGE-LOCKS :SB-THREAD :SB-UNICODE :SBCL :UNIX)
Changed in sbcl: | |
assignee: | nobody → Christophe Rhodes (csr21-cantab) |
Changed in sbcl: | |
status: | New → Fix Committed |
assignee: | Christophe Rhodes (csr21-cantab) → nobody |
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
Not a problem with sb-fasteval.