cmp: inl: tighter type bounds for inlined arguments

Also improve PRECISE-LOC-LISP-TYPE to AND both types instead of picking the "new
type".
This commit is contained in:
Daniel Kochmański 2023-12-08 20:43:29 +01:00
parent e97d3c6219
commit 2690dde0d3
2 changed files with 13 additions and 16 deletions

View file

@ -132,19 +132,15 @@
(defun emit-inline-form (form forms)
(with-c1form-env (form form)
(case (c1form-name form)
(LOCATION
(precise-loc-lisp-type (c1form-arg 0 form) (c1form-primary-type form)))
(VARIABLE
(emit-inlined-variable form forms))
(SETQ
(emit-inlined-setq form forms))
(PROGN
(emit-inlined-progn form forms))
(VALUES
(emit-inlined-values form forms))
(t
(emit-inlined-temp-var form (c1form-primary-type form) :object)))))
(precise-loc-lisp-type
(case (c1form-name form)
(LOCATION (c1form-arg 0 form) )
(VARIABLE (emit-inlined-variable form forms))
(SETQ (emit-inlined-setq form forms))
(PROGN (emit-inlined-progn form forms))
(VALUES (emit-inlined-values form forms))
(t (emit-inlined-temp-var form t :object)))
(c1form-primary-type form))))
;;;
;;; inline-args:

View file

@ -155,9 +155,10 @@
;;; CL-VA-ARG
(defun precise-loc-lisp-type (loc new-type)
(if (subtypep (loc-lisp-type loc) new-type)
loc
`(the ,new-type ,loc)))
(let ((loc-type (loc-lisp-type loc)))
(if (subtypep loc-type new-type)
loc
`(the ,(type-and loc-type new-type) ,loc))))
(defun loc-in-c1form-movable-p (loc)
"A location that is in a C1FORM and can be moved"