From a01e56cf836844dffdee8123208814c2528afcfe Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Tue, 18 May 2010 11:08:37 +0200 Subject: [PATCH] VT-LOC-VALUE, used to retrieve the constant value of C locations, did not handle statically allocated constants --- src/cmp/cmpwt.lsp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/cmp/cmpwt.lsp b/src/cmp/cmpwt.lsp index f6eeb39a6..e0b8e2fd2 100644 --- a/src/cmp/cmpwt.lsp +++ b/src/cmp/cmpwt.lsp @@ -138,11 +138,6 @@ (add-load-form object x)) x)))) -(defun vt-loc-value (loc) - (case (car loc) - (VV (aref *permanent-objects* (second loc))) - (VV-TEMP (aref *temporary-objects* (second loc))))) - (defun add-symbol (symbol) (add-object symbol :duplicate nil :permanent t)) @@ -208,3 +203,15 @@ (let* ((c-name (format nil "_ecl_static_~D" (length *static-constants*)))) (push (list object c-name builder) *static-constants*) `(VV ,c-name)))))))) + +(defun vt-loc-value (loc) + (flet ((static-constant-value (index) + (first (find loc *static-constants* :key #'second + :test #'string=)))) + (let ((index (second loc))) + (cond ((stringp index) + (static-constant-value index)) + ((eq (car loc) 'VV) + (aref *permanent-objects* index)) + (t + (VV-TEMP (aref *temporary-objects* index)))))))