Changeset 12779


Ignore:
Timestamp:
07/03/10 22:15:26 (12 years ago)
Author:
ehuelsmann
Message:

'Code' attribute creation.

File:
1 edited

Legend:

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

    r12778 r12779  
    561561  descriptor
    562562  attributes
    563   arg-count ;; not in the class file,
    564             ;; but required for setting up CODE attribute
    565563  )
    566564
     
    577575  (%make-method :descriptor (cons return args)
    578576                :access-flags flags
    579                 :name name
    580                 :arg-count (if (member :static flags)
    581                                (length args)
    582                                (1+ (length args))))) ;; implicit 'this'
     577                :name name))
    583578
    584579(defun method-add-attribute (method attribute)
    585580  (push attribute (method-attributes method)))
     581
     582(defun method-add-code (method)
     583  "Creates an (empty) 'Code' attribute for the method."
     584  (method-add-attribute
     585   (make-code-attribute (+ (length args)
     586                           (if (member :static (method-access-flags method))
     587                               0 1))))) ;; 1 == implicit 'this'
    586588
    587589(defun method-attribute (method name)
     
    677679  (write-attributes (code-attributes code) stream))
    678680
    679 (defun make-code-attribute (method)
    680   (%make-code-attribute :max-locals (method-arg-count method)))
     681(defun make-code-attribute (arg-count)
     682  "Creates an empty 'Code' attribute for a method which takes
     683`arg-count` parameters, including the implicit `this` parameter."
     684  (%make-code-attribute :max-locals arg-count))
    681685
    682686(defun code-add-attribute (code attribute)
Note: See TracChangeset for help on using the changeset viewer.