Fix `NTH` inlining type mismatch

(Olof-Joachim Frahm)

Fixes <http://abcl.org/trac/ticket/316>.

From <https://github.com/Ferada/abcl/commit/4b6cbb1a917fbd33d949da131b57c93641fafbd6>.
parent 52c36ca5
......@@ -5531,16 +5531,18 @@ We need more thought here.
(define-inlined-function compile-nth (form target representation)
((check-arg-count form 2))
(let ((index-form (second form))
(list-form (third form)))
(let* ((index-form (second form))
(list-form (third form))
(index-type (derive-compiler-type index-form)))
(unless (fixnum-type-p index-type)
(compile-function-call form target representation)
(return-from compile-nth))
(with-operand-accumulation
((compile-operand index-form :int)
(compile-operand list-form nil)
(maybe-emit-clear-values index-form list-form))
(emit 'swap)
(emit-invokevirtual +lisp-object+ "NTH" '(:int) +lisp-object+))
(fix-boxing representation nil) ; FIXME use derived result type
(emit-move-from-stack target representation)))
(emit-invokevirtual +lisp-object+ "NTH" '(:int) +lisp-object+))))
(defun p2-times (form target representation)
(case (length form)
......
......@@ -130,3 +130,8 @@
(deftest destructuring-bind.3
(destructuring-bind (a . b) '(1) (list a b))
(1 NIL))
;; this used to fail during byte code verification
(deftest nth.inlined.1
(prog1 T (compile NIL (lambda (list) (nth (lambda ()) list))))
T)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment