Changeset 12692


Ignore:
Timestamp:
05/16/10 19:45:41 (13 years ago)
Author:
ehuelsmann
Message:

Replace lookup-or-declare-symbol - which was used to load a
symbol in all cases - with the easier paradigm EMIT-LOAD-SYMBOL.

File:
1 edited

Legend:

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

    r12691 r12692  
    751751
    752752(defun emit-push-variable-name (variable)
    753   (multiple-value-bind
    754         (name class)
    755       (lookup-or-declare-symbol (variable-name variable))
    756   (emit 'getstatic class name +lisp-symbol+)))
     753  (emit-load-symbol (variable-name variable)))
    757754
    758755(defknown generate-instanceof-type-check-for-variable (t t) t)
     
    22352232    (t (externalize-object symbol))))
    22362233
    2237 (defun lookup-or-declare-symbol (symbol)
    2238   "Returns the value-pair (VALUES field class) from which
    2239 the Java object representing SYMBOL can be retrieved."
     2234(defun emit-load-symbol (symbol)
     2235  "Loads a symbol, optionally after externalizing it."
    22402236  (multiple-value-bind
    22412237        (name class)
    22422238      (lookup-known-symbol symbol)
    22432239    (if name
    2244         (values name class)
    2245         (values (declare-symbol symbol) *this-class*))))
     2240        (emit 'getstatic class name +lisp-symbol+)
     2241        (emit 'getstatic *this-class* (declare-symbol symbol) +lisp-symbol+))))
    22462242
    22472243(defknown declare-function (symbol &optional setf) string)
     
    22572253   (multiple-value-bind
    22582254         (name class)
    2259        (lookup-or-declare-symbol symbol)
     2255       (lookup-known-symbol symbol)
     2256     ;; This is a work-around for the fact that
     2257     ;; EMIT-LOAD-SYMBOL can't be used due to the fact that
     2258     ;; here we won't know where to send the code yet (the LET
     2259     ;; selects between *code* and *static-code*, while
     2260     ;; EMIT-LOAD-SYMBOL wants to modify those specials too
     2261     (unless name
     2262        (setf name (declare-symbol symbol)
     2263              class *this-class*))
    22602264     (let (saved-code)
    22612265       (let ((*code* (if *declare-inline* *code* *static-code*)))
     
    30313035      (cond ((eq op (compiland-name *current-compiland*)) ; recursive call
    30323036             (if (notinline-p op)
    3033                  (multiple-value-bind
    3034                        (name class)
    3035                      (lookup-or-declare-symbol op)
    3036                    (emit 'getstatic class name +lisp-symbol+))
     3037                 (emit-load-symbol op)
    30373038                 (aload 0)))
    30383039            (t
    3039              (multiple-value-bind
    3040                    (name class)
    3041                  (lookup-or-declare-symbol op)
    3042                (emit 'getstatic class name +lisp-symbol+))))
     3040             (emit-load-symbol op)))
    30433041      (process-args args)
    30443042      (if (or (<= *speed* *debug*) *require-stack-frame*)
     
    50255023           (emit-move-from-stack target representation))
    50265024          ((symbolp obj)
    5027            (multiple-value-bind
    5028                  (name class)
    5029                (lookup-or-declare-symbol obj)
    5030              (emit 'getstatic class name +lisp-symbol+))
     5025           (emit-load-symbol obj)
    50315026           (emit-move-from-stack target representation))
    50325027          ((listp obj)
     
    52685263          (emit-move-from-stack target))
    52695264         (t
    5270           (multiple-value-bind
    5271                 (name class)
    5272               (lookup-or-declare-symbol name)
    5273             (emit 'getstatic class name +lisp-symbol+))
     5265          (emit-load-symbol name)
    52745266          (emit-invokevirtual +lisp-object-class+ "getSymbolFunctionOrDie"
    52755267                              nil +lisp-object+)
     
    53105302          (emit-move-from-stack target))
    53115303         (t
    5312           (multiple-value-bind
    5313                 (name class)
    5314               (lookup-or-declare-symbol (cadr name))
    5315             (emit 'getstatic class name +lisp-symbol+))
     5304          (emit-load-symbol (cadr name))
    53165305          (emit-invokevirtual +lisp-symbol-class+
    53175306                              "getSymbolSetfFunctionOrDie"
     
    75267515                 (not (enclosed-by-runtime-bindings-creating-block-p
    75277516                       (variable-block variable))))
    7528       (multiple-value-bind
    7529             (name class)
    7530           (lookup-or-declare-symbol name)
    7531         (emit 'getstatic class name +lisp-symbol+)))
     7517      (emit-load-symbol name))
    75327518    (cond ((constantp name)
    75337519           ;; "... a reference to a symbol declared with DEFCONSTANT always
     
    76327618;;              (format t "compiling pushSpecial~%")
    76337619             (emit-push-current-thread)
    7634              (multiple-value-bind
    7635                    (name class)
    7636                  (lookup-or-declare-symbol name)
    7637                (emit 'getstatic class name +lisp-symbol+))
     7620             (emit-load-symbol name)
    76387621       (compile-forms-and-maybe-emit-clear-values (second value-form) 'stack nil)
    76397622             (emit-invokevirtual +lisp-thread-class+ "pushSpecial"
     
    76417624            (t
    76427625             (emit-push-current-thread)
    7643              (multiple-value-bind
    7644                    (name class)
    7645                  (lookup-or-declare-symbol name)
    7646                (emit 'getstatic class name +lisp-symbol+))
     7626             (emit-load-symbol name)
    76477627       (compile-forms-and-maybe-emit-clear-values value-form 'stack nil)
    76487628             (emit-invokevirtual +lisp-thread-class+ "setSpecialVariable"
     
    81298109                   (emit 'iconst_1))
    81308110                  ((nil)
    8131                    (multiple-value-bind
    8132                          (name class)
    8133                        (lookup-or-declare-symbol form)
    8134                      (emit 'getstatic class name +lisp-symbol+))))
     8111                   (emit-load-symbol form)))
    81358112                (emit-move-from-stack target representation))
    81368113               (t
Note: See TracChangeset for help on using the changeset viewer.