cmp: make sure that setf functions are found in the vv in the second pass

Only applies for COMPILE calls where the name of a setf function
definition will not be equal under the EQ test to the name of the same
function at a later call. Thus, we have to use EQUAL to find those
names in the vv array.
This commit is contained in:
Marius Gerbershagen 2024-03-16 20:00:04 +01:00
parent 3c75b5b4d8
commit da4c49cd2f
4 changed files with 9 additions and 9 deletions

View file

@ -267,4 +267,4 @@
;;; This version is correct but unnecessarily slow - it goes through
;;; ecl_function_dispatch. wt-fdefinition handles all proper names.
(defun call-unknown-global-fun (fname args)
`(CALL-INDIRECT ,(get-object fname) ,(coerce-args args) ,fname nil))
`(CALL-INDIRECT ,(get-object fname :test #'equal) ,(coerce-args args) ,fname nil))

View file

@ -325,8 +325,8 @@
(setf (vv-location vv) ndx)
vv))
(defun search-vv (object &key permanent (errorp t))
(let* ((test (if si:*compiler-constants* 'eq 'equal-with-circularity))
(defun search-vv (object &key permanent (errorp t) test)
(let* ((test (or test (if si:*compiler-constants* 'eq 'equal-with-circularity)))
(item (if permanent
(find object *permanent-objects* :test test :key #'vv-value)
(or (find object *permanent-objects* :test test :key #'vv-value)
@ -335,8 +335,8 @@
(cmperr "Unable to find object ~s." object))
item))
(defun get-object (object &key (permanent t) (errorp t))
(or (search-vv object :permanent permanent :errorp nil)
(defun get-object (object &key (permanent t) (errorp t) test)
(or (search-vv object :permanent permanent :errorp nil :test test)
(try-inline-core-sym object)
(and errorp
(cmperr "Unable to find object ~s." object))))

View file

@ -196,7 +196,7 @@
(mapc #'bind required-lcls requireds)
(when fname-in-ihs-p
(let ((fname (get-object (or description fname))))
(let ((fname (get-object (or description fname) :test #'equal)))
(open-inline-block)
(setf *ihs-used-p* t)
(push 'IHS *unwind-exit*)
@ -306,7 +306,7 @@
(when (and (policy-check-nargs) use-narg)
(flet ((wrong-num-arguments ()
(if fname
(wt " FEwrong_num_arguments(" (get-object fname) ");")
(wt " FEwrong_num_arguments(" (get-object fname :test #'equal) ");")
(wt " FEwrong_num_arguments_anonym();"))))
(if (and minarg maxarg (= minarg maxarg))
(progn (wt-nl "if (ecl_unlikely(narg!=" minarg "))")

View file

@ -156,7 +156,7 @@
(functionp (fdefinition fun-name))))))
(cond
((not safe)
(let ((vv (get-object fun-name)))
(let ((vv (get-object fun-name :test #'equal)))
(wt "ecl_fdefinition(" vv ")")))
((eq name fun-name)
;; #'symbol
@ -167,7 +167,7 @@
(let ((setf-loc (assoc name *setf-definitions*)))
(unless setf-loc
(let* ((setf-vv (data-empty-loc*))
(name-vv (get-object name)))
(name-vv (get-object name :test #'equal)))
(setf setf-loc (list name setf-vv name-vv))
(push setf-loc *setf-definitions*)))
(wt "ECL_CONS_CAR(" (second setf-loc) ")"))))))