Merge branch 'fix-550' into 'develop'

Fix 550

Closes #550

See merge request embeddable-common-lisp/ecl!178
This commit is contained in:
Marius Gerbershagen 2020-01-13 18:55:52 +00:00
commit fdbfb8b81b
2 changed files with 28 additions and 3 deletions

View file

@ -18,10 +18,12 @@
(in-package "COMPILER")
(defun unoptimized-long-call (fun arguments)
(let ((frame (gensym)))
(let ((frame (gensym))
(f-arg (gensym)))
`(with-stack ,frame
,@(loop for i in arguments collect `(stack-push ,frame ,i))
(si::apply-from-stack-frame ,frame ,fun))))
(let ((,f-arg ,fun))
,@(loop for i in arguments collect `(stack-push ,frame ,i))
(si::apply-from-stack-frame ,frame ,f-arg)))))
(defun unoptimized-funcall (fun arguments)
(let ((l (length arguments)))

View file

@ -1583,3 +1583,26 @@
(finishes (run-1))
(finishes (run-2))
(finishes (run-3)))
;;; Date 2020-01-12
;;; URL: https://gitlab.com/embeddable-common-lisp/ecl/issues/550
;;; Description
;;;
;;; When we invoke an unopitmized long call (that is we apply from
;;; a stack frame), function argument is evaluated after the
;;; arguments what is wrong for operators where function is the
;;; first argument (and should be evaluated first).
(test cmp.0074.c-arguments-limit.evaluation-rule
(flet ((make-fn (n)
`(lambda ()
(let ((se-var '()))
(funcall (prog1 #'list (push :fun se-var))
,@(list* `(push :arg se-var)
(make-list (1- n))))
(nreverse se-var))))
(check-fn (form)
(is (equal '(:fun :arg) (funcall (compile nil form))))))
(check-fn (make-fn 10))
(check-fn (make-fn (1+ si::c-arguments-limit)))
(check-fn (make-fn (1- si::c-arguments-limit)))
(check-fn (make-fn si::c-arguments-limit))))