mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-20 19:42:30 -08:00
cmp: rename c1form VAR to VARIABLE
This is more consistent with LOCATION and is less likely to be confused with arguments named var.
This commit is contained in:
parent
16a6ef5e04
commit
3628a843ab
11 changed files with 23 additions and 23 deletions
|
|
@ -63,7 +63,7 @@
|
|||
(c2expr* form1))
|
||||
(if (eq (c1form-name form1) 'LOCATION)
|
||||
(list (c1form-primary-type form1) (c1form-arg 0 form1))
|
||||
(emit-inlined-variable (make-c1form 'VAR form vref nil) rest-forms))))
|
||||
(emit-inlined-variable (make-c1form 'VARIABLE form vref nil) rest-forms))))
|
||||
|
||||
(defun emit-inlined-call-global (form expected-type)
|
||||
(let* ((fname (c1form-arg 0 form))
|
||||
|
|
@ -129,7 +129,7 @@
|
|||
(case (c1form-name form)
|
||||
(LOCATION
|
||||
(list (c1form-primary-type form) (c1form-arg 0 form)))
|
||||
(VAR
|
||||
(VARIABLE
|
||||
(emit-inlined-variable form forms))
|
||||
(CALL-GLOBAL
|
||||
(emit-inlined-call-global form (c1form-primary-type form)))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
(let ((name (c1form-name value)))
|
||||
(cond ((eq name 'LOCATION)
|
||||
(c1form-arg 0 value))
|
||||
((and (eq name 'VAR)
|
||||
((and (eq name 'VARIABLE)
|
||||
other-forms-flag
|
||||
(not (var-changed-in-form-list (c1form-arg 0 value) other-forms)))
|
||||
(c1form-arg 0 value))
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@
|
|||
(defun c2throw (c1form tag val &aux loc)
|
||||
(declare (ignore c1form))
|
||||
(case (c1form-name tag)
|
||||
((VAR LOCATION) (setq loc (c1form-arg 0 tag)))
|
||||
((VARIABLE LOCATION) (setq loc (c1form-arg 0 tag)))
|
||||
(t (setq loc (make-temp-var))
|
||||
(let ((*destination* loc)) (c2expr* tag))))
|
||||
(let ((*destination* 'VALUES)) (c2expr* val))
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
(in-package #:compiler)
|
||||
|
||||
(defun c2let-replaceable-var-ref-p (var form rest-forms)
|
||||
(when (and (eq (c1form-name form) 'VAR)
|
||||
(when (and (eq (c1form-name form) 'VARIABLE)
|
||||
(null (var-set-nodes var))
|
||||
(local var))
|
||||
(let ((var1 (c1form-arg 0 form)))
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
((LEXICAL CLOSURE SPECIAL GLOBAL)
|
||||
(case (c1form-name form)
|
||||
(LOCATION (bind (c1form-arg 0 form) var))
|
||||
(VAR (bind (c1form-arg 0 form) var))
|
||||
(VARIABLE (bind (c1form-arg 0 form) var))
|
||||
(t (bind-init form var))))
|
||||
(t ; local var
|
||||
(let ((*destination* var)) ; nil (ccb)
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@
|
|||
(defun c1form-movable-p (form)
|
||||
(flet ((abort-on-not-pure (form)
|
||||
(let ((name (c1form-name form)))
|
||||
(cond ((eq name 'VAR)
|
||||
(cond ((eq name 'VARIABLE)
|
||||
(let ((var (c1form-arg 0 form)))
|
||||
(when (or (global-var-p var)
|
||||
(var-set-nodes var))
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
(defun c1form-unmodified-p (form rest-form)
|
||||
(flet ((abort-on-not-pure (form)
|
||||
(let ((name (c1form-name form)))
|
||||
(cond ((eq name 'VAR)
|
||||
(cond ((eq name 'VARIABLE)
|
||||
(let ((var (c1form-arg 0 form)))
|
||||
(when (or (global-var-p var)
|
||||
(var-changed-in-form-list var rest-form))
|
||||
|
|
@ -203,7 +203,7 @@
|
|||
(when (c1form-side-effects new-fields)
|
||||
(baboon :format-control "Attempted to move a form with side-effects"))
|
||||
;; The following protocol is only valid for VAR references.
|
||||
(unless (eq (c1form-name dest) 'VAR)
|
||||
(unless (eq (c1form-name dest) 'VARIABLE)
|
||||
(baboon :format-control "Cannot replace forms other than VARs:~%~4I~A"
|
||||
:format-arguments (list dest)))
|
||||
;; We have to relocate the children nodes of NEW-FIELDS in
|
||||
|
|
@ -212,7 +212,7 @@
|
|||
;; exceptions are forms that can be fully replaced
|
||||
(case (c1form-name new-fields)
|
||||
(LOCATION)
|
||||
(VAR
|
||||
(VARIABLE
|
||||
(let ((var (c1form-arg 0 new-fields)))
|
||||
;; If this is the first time we replace a reference with this one
|
||||
;; then we have to remove it from the read nodes of the variable
|
||||
|
|
@ -242,7 +242,7 @@
|
|||
;; exactly one occurrence of var is present in forms
|
||||
(defun delete-c1forms (form)
|
||||
(flet ((eliminate-references (form)
|
||||
(when (eq (c1form-name form) 'VAR)
|
||||
(when (eq (c1form-name form) 'VARIABLE)
|
||||
(let ((var (c1form-arg 0 form)))
|
||||
(when var
|
||||
(delete-from-read-nodes var form))))))
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
side-effects
|
||||
one-liner)))
|
||||
(loop for form in arguments
|
||||
when (eq (c1form-name form) 'VAR)
|
||||
when (eq (c1form-name form) 'VARIABLE)
|
||||
do (let ((var (c1form-arg 0 form)))
|
||||
(add-to-set-nodes var form)))
|
||||
form)))
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
(add-fname fun)
|
||||
(ext:if-let ((funob (local-function-ref fun t)))
|
||||
(let ((var (fun-var funob)))
|
||||
(add-to-read-nodes var (make-c1form* 'VAR :args var nil)))
|
||||
(add-to-read-nodes var (make-c1form* 'VARIABLE :args var nil)))
|
||||
(make-c1form* 'FUNCTION
|
||||
:type 'FUNCTION
|
||||
:sp-change (not (and (symbolp fun)
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@
|
|||
;; Not closed over anything
|
||||
(every #'global-var-p (fun-referenced-vars fun-object))
|
||||
;; Referencing the function variable
|
||||
(eq (c1form-name form) 'VAR)
|
||||
(eq (c1form-name form) 'VARIABLE)
|
||||
(eq (c1form-arg 0 form)
|
||||
(fun-var fun-object)))
|
||||
(when (fun-no-entry fun-object)
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@
|
|||
;; (let ((v1 e1) (v2 e2) (v3 e3)) (expr e4 v2 e5))
|
||||
;; - v2 is a read only variable
|
||||
;; - the value of e2 is not modified in e3 nor in following expressions
|
||||
(when (eq (c1form-name form) 'VAR)
|
||||
(when (eq (c1form-name form) 'VARIABLE)
|
||||
(let ((other-var (c1form-arg 0 form)))
|
||||
(unless (or (global-var-p other-var)
|
||||
(member other-var rest-vars)
|
||||
|
|
@ -245,7 +245,7 @@
|
|||
;;; When LOC is not NIL then we deal with a constant.
|
||||
(defun c1var (name loc)
|
||||
(let* ((var (c1vref name))
|
||||
(output (make-c1form* 'VAR
|
||||
(output (make-c1form* 'VARIABLE
|
||||
:type (var-type var)
|
||||
:args var loc)))
|
||||
(add-to-read-nodes var output)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
(EXT:COMPILER-LET symbols values body)
|
||||
;; Places, assignment and binding
|
||||
(LOCATION loc :pure :single-valued)
|
||||
(VAR var value :single-valued)
|
||||
(VARIABLE var value :single-valued)
|
||||
(CL:SETQ var value-c1form :side-effects)
|
||||
(CL:PSETQ var-list value-c1form-list :side-effects)
|
||||
(CL:PROGV symbols values form :side-effects)
|
||||
|
|
@ -224,7 +224,7 @@
|
|||
(cl:tagbody . c2tagbody)
|
||||
(cl:go . c2go)
|
||||
|
||||
(var . c2var)
|
||||
(variable . c2var)
|
||||
(location . c2location)
|
||||
(cl:setq . c2setq)
|
||||
(cl:progv . c2progv)
|
||||
|
|
@ -271,7 +271,7 @@
|
|||
(cl:unwind-protect . p1unwind-protect)
|
||||
(ordinary . p1ordinary)
|
||||
(si:fset . p1fset)
|
||||
(var . p1var)
|
||||
(variable . p1var)
|
||||
(cl:values . p1values)
|
||||
(location . p1trivial) ;; Some of these can be improved
|
||||
(ffi:c-inline . p1trivial)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
;; exactly one occurrence of var is present in forms
|
||||
(defun replaceable (var form)
|
||||
(labels ((abort-on-side-effects (form)
|
||||
(if (eq (c1form-name form) 'VAR)
|
||||
(if (eq (c1form-name form) 'VARIABLE)
|
||||
(when (eq var (first (c1form-args form)))
|
||||
(return-from replaceable t))
|
||||
(when (c1form-side-effects form)
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
(last-form (car (last (first args)))))
|
||||
((LET LET* FLET LABELS BLOCK CATCH)
|
||||
(last-form (car (last args))))
|
||||
(VAR (c1form-arg 0 x))
|
||||
(VARIABLE (c1form-arg 0 x))
|
||||
(t x))))
|
||||
(and (not (c1form-side-effects form))
|
||||
(or (< (var-ref var) 1)
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
(when (var-functions-reading var)
|
||||
(baboon :format-control "Cannot replace a variable that forms part of a closure"))
|
||||
(dolist (where (var-read-forms var))
|
||||
(unless (and (eql (c1form-name where) 'VAR)
|
||||
(unless (and (eql (c1form-name where) 'VARIABLE)
|
||||
(eql (c1form-arg 0 where) var))
|
||||
(baboon :format-control "VAR-READ-NODES are only C1FORMS of type VAR"))
|
||||
(delete-from-read-nodes var where)
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
(var-type var)
|
||||
orig-type)
|
||||
(loop for form in (var-read-forms var)
|
||||
when (and (eq (c1form-name form) 'VAR)
|
||||
when (and (eq (c1form-name form) 'VARIABLE)
|
||||
(eq var (c1form-arg 0 form)))
|
||||
do (setf (c1form-type form) (type-and type (c1form-primary-type form)))
|
||||
finally (setf (var-type var) type)))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue