cmp: remove obsolete function push-vars

The function push-vars initialized a slot var-index and called
cmp-env-register-var however var-index is never read so there is no need for
that. Remove both function and the unused slot.
This commit is contained in:
Daniel Kochmański 2023-02-17 11:09:04 +01:00
parent 81a671dea7
commit 76f0ac2399
5 changed files with 14 additions and 15 deletions

View file

@ -181,7 +181,7 @@
;; environment in which the function was defined to get
;; inlining of closures right.
(let ((*cmp-env* (cmp-env-copy (fun-cmp-env fun))))
(mapc #'push-vars let-vars)
(mapc #'cmp-env-register-var let-vars)
(process-let-body 'LET* let-vars let-inits specials other-decls body setjmps))))))
(defun c1call-local (fname fun args)

View file

@ -248,7 +248,7 @@
(var (c1make-var name ss is ts)))
(push var type-checks)
(setf (first specs) var)
(push-vars var)))
(cmp-env-register-var var)))
(do ((specs (setq optionals (cdr optionals)) (cdddr specs)))
((endp specs))
@ -261,15 +261,17 @@
:safe "In (LAMBDA ~a...)" function-name)
(default-init var)))
(push var type-checks)
(push-vars var)
(cmp-env-register-var var)
(when flag
(push-vars (setq flag (c1make-var flag ss is ts))))
(setq flag (c1make-var flag ss is ts))
(cmp-env-register-var flag))
(setf (first specs) var
(second specs) init
(third specs) flag)))
(when rest
(push-vars (setq rest (c1make-var rest ss is ts))))
(setq rest (c1make-var rest ss is ts))
(cmp-env-register-var rest))
(do ((specs (setq keywords (cdr keywords)) (cddddr specs)))
((endp specs))
@ -284,9 +286,10 @@
:safe "In (LAMBDA ~a...)" function-name)
(default-init var)))
(push var type-checks)
(push-vars var)
(cmp-env-register-var var)
(when flag
(push-vars (setq flag (c1make-var flag ss is ts))))
(setq flag (c1make-var flag ss is ts))
(cmp-env-register-var flag))
(setf (second specs) var
(third specs) init
(fourth specs) flag)))

View file

@ -111,11 +111,12 @@
(when var
(push var vars)
(push init forms)
(when (eq let/let* 'LET*) (push-vars var)))))
(when (eq let/let* 'LET*)
(cmp-env-register-var var)))))
(setf vars (nreverse vars)
forms (nreverse forms))
(when (eq let/let* 'LET)
(mapc #'push-vars vars))
(mapc #'cmp-env-register-var vars))
(check-vdecl (mapcar #'var-name vars) types ignoreds)
(values vars forms specials other-decls body))))
@ -361,7 +362,7 @@
(let* ((vars (loop for name in variables
collect (c1make-var name ss is ts))))
(setq init-form (c1expr init-form))
(mapc #'push-vars vars)
(mapc #'cmp-env-register-var vars)
(check-vdecl variables ts is)
(setq body (c1decl-body other-decls body))
(mapc #'check-vref vars)

View file

@ -73,7 +73,6 @@
;;; lex-ndx is the index within the array for this env.
;;; For SPECIAL and GLOBAL: the vv-index for variable name.
(type t) ;;; Type of the variable.
(index -1) ;;; position in *vars*. Used by similar.
(ignorable nil) ;;; Whether there was an IGNORABLE/IGNORE declaration
)

View file

@ -239,7 +239,3 @@
(defun useful-var-p (var)
(or (plusp (var-ref var))
(global-var-p var)))
(defun push-vars (v)
(setf (var-index v) (length (cmp-env-variables)))
(cmp-env-register-var v))