Changeset 11621


Ignore:
Timestamp:
02/04/09 20:13:59 (12 years ago)
Author:
ehuelsmann
Message:

Implement P2-COMPILAND-UNBOX-VARIABLE in terms of new primitives.
Replace the last occurrance of (EMIT 'VAR-SET ...) with (EMIT-MOVE-TO-VARIABLE ...);

removes the need to 'RESOLVE-VARIABLES': eliminate it and the VAR-SET artificial opcode.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r11620 r11621  
    14741474      max-stack)))
    14751475
    1476 (defun resolve-variables ()
    1477   (let ((code (nreverse *code*)))
    1478     (setf *code* nil)
    1479     (dolist (instruction code)
    1480       (case (instruction-opcode instruction)
    1481         (207 ; VAR-SET
    1482          (let ((variable (car (instruction-args instruction))))
    1483            (aver (variable-p variable))
    1484            (aver (not (variable-special-p variable)))
    1485            (cond ((variable-register variable)
    1486                   (dformat t "register = ~S~%" (variable-register variable))
    1487                   (astore (variable-register variable)))
    1488                  ((variable-closure-index variable)
    1489                   (dformat t "closure-index = ~S~%" (variable-closure-index variable))
    1490                   (aver (not (null (compiland-closure-register *current-compiland*))))
    1491                   (aload (compiland-closure-register *current-compiland*))
    1492                   (emit 'swap) ; array value
    1493                   (emit-push-constant-int (variable-closure-index variable))
    1494                   (emit 'swap) ; array index value
    1495                   (emit 'aastore))
    1496                  (t
    1497                   (dformat t "var-set fall-through case~%")
    1498                   (aver (not (null (compiland-argument-register *current-compiland*))))
    1499                   (aload (compiland-argument-register *current-compiland*)) ; Stack: value array
    1500                   (emit 'swap) ; array value
    1501                   (emit-push-constant-int (variable-index variable)) ; array value index
    1502                   (emit 'swap) ; array index value
    1503                   (emit 'aastore)))))
    1504         (t
    1505          (push instruction *code*))))))
    15061476
    15071477(defun finalize-code ()
     
    50355005       (list +lisp-object+ +lisp-object-array+)
    50365006       +lisp-object+)))
    5037   (emit 'var-set (local-function-variable local-function)))
     5007  (emit-move-to-variable (local-function-variable local-function)))
    50385008
    50395009(defmacro with-temp-class-file (pathname class-file lambda-list &body body)
     
    83498319               (not (variable-used-non-locally-p variable))
    83508320               (zerop (compiland-children *current-compiland*)))
    8351       (let ((type (variable-declared-type variable)))
    8352         (cond ((fixnum-type-p type)
    8353                (aload register)
    8354                (emit-unbox-fixnum)
    8355                (emit 'istore register)
    8356                (setf (variable-representation variable) :int))
    8357               ((java-long-type-p type)
    8358                (let ((new-register (allocate-register-pair)))
    8359                  (aload register)
    8360                  (emit-invokevirtual +lisp-object-class+ "longValue" nil "J")
    8361                  (emit 'lstore new-register)
    8362                  (setf (variable-register variable) new-register)
    8363                  (setf (variable-representation variable) :long)))
    8364               ((eq type 'CHARACTER)
    8365                (aload register)
    8366                (emit-unbox-character)
    8367                (emit 'istore register)
    8368                (setf (variable-representation variable) :char))))))
     8321      (emit-push-variable variable)
     8322      (derive-variable-representation variable nil) ;; nil == no block
     8323      (when (< 1 (representation-size (variable-representation variable)))
     8324        (allocate-variable-register variable))
     8325      (convert-representation nil (variable-representation variable))
     8326      (emit-move-to-variable variable)))
    83698327  t)
    83708328
     
    86028560
    86038561    (emit 'areturn)
    8604 
    8605     (resolve-variables)
    86068562
    86078563    ;; Warn if any unused args. (Is this the right place?)
  • trunk/abcl/src/org/armedbear/lisp/opcodes.lisp

    r11610 r11621  
    260260(define-opcode clear-values 205 0 0)
    261261;;(define-opcode var-ref 206 0 0)
    262 (define-opcode var-set 207 0 0)
    263 
    264 (defparameter *last-opcode* 207)
     262
     263(defparameter *last-opcode* 206)
    265264
    266265(declaim (ftype (function (t) t) opcode-name))
Note: See TracChangeset for help on using the changeset viewer.