Commit 0abe27af authored by Juan Jose Garcia Ripoll's avatar Juan Jose Garcia Ripoll
Browse files

The object associated to the VV location is now stored in it

parent 4d71ab1b
......@@ -68,12 +68,13 @@
(single-float 'single-float-value)
(double-float 'double-float-value)
(long-float 'long-float-value)))
(location (make-vv :location c-value)))
(location (make-vv :location c-value :value value)))
(cons value (make-c1form* 'LOCATION :type type
:args (list loc-type value location)))))
(t
(cons name (make-c1form* 'LOCATION :type (type-of name)
:args (make-vv :location c-value)))))
:args (make-vv :location c-value
:value name)))))
+optimizable-constants+)))
(reverse
`((MOST-POSITIVE-SHORT-FLOAT "FLT_MAX")
......
......@@ -214,6 +214,7 @@
(defun loc-type (loc)
(cond ((eq loc NIL) 'NULL)
((var-p loc) (var-type loc))
((vv-p loc) (vv-type loc))
((si::fixnump loc) 'fixnum)
((atom loc) 'T)
(t
......@@ -234,6 +235,7 @@
(defun loc-representation-type (loc)
(cond ((member loc '(NIL T)) :object)
((var-p loc) (var-rep-type loc))
((vv-p loc) :object)
((si::fixnump loc) :fixnum)
((eq loc 'TRASH) :void)
((atom loc) :object)
......
......@@ -106,7 +106,7 @@
((ext:fixnump loc)
(values t loc))
((vv-p loc)
(let ((value (vt-loc-value loc)))
(let ((value (vv-value loc)))
(if (or (null value) (ext:fixnump value))
(values nil nil)
(values t value))))
......
......@@ -252,4 +252,5 @@
(defstruct vv
(location nil)
(used-p nil)
(permanent-p t))
(permanent-p t)
(value nil))
......@@ -134,7 +134,8 @@
(cond ((add-static-constant object))
((and x duplicate)
(setq x (make-vv :location next-ndx :used-p forced
:permanent-p permanent))
:permanent-p permanent
:value object))
(vector-push-extend (list object x next-ndx) array)
x)
(x
......@@ -145,7 +146,8 @@
x)
(t
(setq x (make-vv :location next-ndx :used-p forced
:permanent-p permanent))
:permanent-p permanent
:value object))
(vector-push-extend (list object x next-ndx) array)
(unless *compiler-constants*
(add-load-form object x))
......@@ -262,23 +264,7 @@
(when builder
(let* ((c-name (format nil "_ecl_static_~D" (length *static-constants*))))
(push (list object c-name builder) *static-constants*)
(make-vv :location c-name))))))))
(defun vt-loc-value (loc)
(flet ((static-constant-value (index)
(first (find index *static-constants* :key #'second
:test #'string=))))
(if (not (vv-permanent-p loc))
(aref *temporary-objects* (vv-location index))
(if (vv-p loc)
(let ((index (vv-location loc)))
(if (stringp index)
(static-constant-value index)
(aref *permanent-objects* index)))
nil
#+nil
(baboon :format-control "VT-LOC-VALUE got an invalid location ~A"
:format-arguments (list loc))))))
(make-vv :location c-name :value object))))))))
(defun wt-vv-index (index permanent-p)
(cond ((not (numberp index))
......@@ -300,3 +286,9 @@
(defun set-vv (loc vv-loc)
(setf (vv-used-p vv-loc) t)
(set-vv-index loc (vv-location vv-loc) (vv-permanent-p vv-loc)))
(defun vv-type (loc)
(let ((value (vv-value loc)))
(if (and value (not (si::fixnump value)))
(type-of value)
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