Changeset 12840


Ignore:
Timestamp:
07/31/10 21:33:24 (12 years ago)
Author:
ehuelsmann
Message:

Introduce "dual mode" operation for emit-invoke* and emit-*static,
in order to allow test-writing.

Location:
branches/generic-class-file/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r12839 r12840  
    464464         (stack-effect (cdr info))
    465465         (class-name (!class-name class-name))
    466          (index (pool-method class-name method-name descriptor))
     466         (index (if (null *current-code-attribute*)
     467                    (pool-method class-name method-name descriptor)
     468                    (pool-add-method-ref *pool* class-name
     469                                         method-name descriptor)))
    467470         (instruction (apply #'%emit 'invokestatic (u2 index))))
    468471    (setf (instruction-stack instruction) stack-effect)))
     
    487490         (stack-effect (cdr info))
    488491         (class-name (!class-name class-name))
    489          (index (pool-method class-name method-name descriptor))
     492         (index (if (null *current-code-attribute*)
     493                    (pool-method class-name method-name descriptor)
     494                    (pool-add-method-ref *pool* class-name
     495                                         method-name descriptor)))
    490496         (instruction (apply #'%emit 'invokevirtual (u2 index))))
    491497    (declare (type (signed-byte 8) stack-effect))
     
    506512         (stack-effect (cdr info))
    507513         (class-name (!class-name class-name))
    508          (index (pool-method class-name "<init>" descriptor))
     514         (index (if (null *current-code-attribute*)
     515                    (pool-method class-name "<init>" descriptor)
     516                    (pool-add-method-ref *pool* class-name
     517                                         "<init>" descriptor)))
    509518         (instruction (apply #'%emit 'invokespecial (u2 index))))
    510519    (declare (type (signed-byte 8) stack-effect))
     
    545554(defknown emit-getstatic (t t t) t)
    546555(defun emit-getstatic (class-name field-name type)
    547   (let ((index (pool-field (!class-name class-name)
    548                            field-name (!class-ref type))))
     556  (let ((index (if (null *current-code-attribute*)
     557                   (pool-field (!class-name class-name)
     558                           field-name (!class-ref type))
     559                   (pool-add-field-ref *pool* class-name field-name type))))
    549560    (apply #'%emit 'getstatic (u2 index))))
    550561
    551562(defknown emit-putstatic (t t t) t)
    552563(defun emit-putstatic (class-name field-name type)
    553   (let ((index (pool-field (!class-name class-name)
    554                            field-name (!class-ref type))))
     564  (let ((index (if (null *current-code-attribute*)
     565                   (pool-field (!class-name class-name)
     566                           field-name (!class-ref type))
     567                   (pool-add-field-ref *pool* class-name field-name type))))
    555568    (apply #'%emit 'putstatic (u2 index))))
    556569
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/jvm-class-file.lisp

    r12832 r12840  
    876876
    877877
    878 (defvar *current-code-attribute*)
     878(defvar *current-code-attribute* nil)
    879879
    880880(defun save-code-specials (code)
     
    890890        *register* (code-current-local code)))
    891891
    892 (defmacro with-code-to-method ((method &key safe-nesting) &body body)
     892(defmacro with-code-to-method ((class-file method &key safe-nesting) &body body)
    893893  (let ((m (gensym))
    894894        (c (gensym)))
     
    899899       (let* ((,m ,method)
    900900              (,c (method-ensure-code method))
     901              (*pool* (class-file-constants ,class-file))
    901902              (*code* (code-code ,c))
    902903              (*registers-allocated* (code-max-locals ,c))
Note: See TracChangeset for help on using the changeset viewer.