Changeset 12886


Ignore:
Timestamp:
08/11/10 22:09:55 (13 years ago)
Author:
ehuelsmann
Message:

Resolve naming conflict between JAVA-METHOD and METHOD;
also adjust a call to FINALIZE-CODE to the new
number of arguments it takes.

File:
1 edited

Legend:

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

    r12885 r12886  
    534534  "Returns all methods which have `name'."
    535535  (remove name (class-file-methods class)
    536           :test-not #'string= :key #'method-name))
     536          :test-not #'string= :key #'!method-name))
    537537
    538538(defun class-method (class name return &rest args)
     
    540540  (let ((return-and-args (cons return args)))
    541541    (find-if #'(lambda (c)
    542                  (and (string= (method-name c) name)
    543                       (equal (method-descriptor c) return-and-args)))
     542                 (and (string= (!method-name c) name)
     543                      (equal (!method-descriptor c) return-and-args)))
    544544             (class-file-methods class))))
    545545
     
    832832
    833833
    834 (defstruct (method (:constructor %!make-method))
     834(defstruct (method (:constructor %!make-method)
     835                   (:conc-name !method-))
    835836  "Holds information on the properties of methods in the class(-file)."
    836837  access-flags
     
    863864  "Add `attribute' to the list of attributes of `method',
    864865returning `attribute'."
    865   (push attribute (method-attributes method))
     866  (push attribute (!method-attributes method))
    866867  attribute)
    867868
     
    871872  (method-add-attribute
    872873   method
    873    (make-code-attribute (+ (length (cdr (method-descriptor method)))
    874                            (if (member :static (method-access-flags method))
     874   (make-code-attribute (+ (length (cdr (!method-descriptor method)))
     875                           (if (member :static (!method-access-flags method))
    875876                               0 1))))) ;; 1 == implicit 'this'
    876877
     
    885886(defun method-attribute (method name)
    886887  "Returns the first attribute of `method' with `name'."
    887   (find name (method-attributes method)
     888  (find name (!method-attributes method)
    888889        :test #'string= :key #'attribute-name))
    889890
     
    892893  "Prepares `method' for serialization."
    893894  (let ((pool (class-file-constants class)))
    894     (setf (method-access-flags method)
    895           (map-flags (method-access-flags method))
    896           (method-descriptor method)
    897           (pool-add-utf8 pool (apply #'descriptor (method-descriptor method)))
    898           (method-name method)
    899           (pool-add-utf8 pool (map-method-name (method-name method)))))
    900   (finalize-attributes (method-attributes method) nil class))
     895    (setf (!method-access-flags method)
     896          (map-flags (!method-access-flags method))
     897          (!method-descriptor method)
     898          (pool-add-utf8 pool (apply #'descriptor (!method-descriptor method)))
     899          (!method-name method)
     900          (pool-add-utf8 pool (map-method-name (!method-name method)))))
     901  (finalize-attributes (!method-attributes method) nil class))
    901902
    902903
    903904(defun !write-method (method stream)
    904905  "Write class file representation of `method' to `stream'."
    905   (write-u2 (method-access-flags method) stream)
    906   (write-u2 (method-name method) stream)
    907   (sys::%format t "method-name: ~a~%" (method-name method))
    908   (write-u2 (method-descriptor method) stream)
    909   (write-attributes (method-attributes method) stream))
     906  (write-u2 (!method-access-flags method) stream)
     907  (write-u2 (!method-name method) stream)
     908  ;;(sys::%format t "method-name: ~a~%" (!method-name method))
     909  (write-u2 (!method-descriptor method) stream)
     910  (write-attributes (!method-attributes method) stream))
    910911
    911912(defstruct attribute
     
    984985  "Prepares the `code' attribute for serialization, within method `parent'."
    985986  (declare (ignore parent))
    986   (let ((c (resolve-instructions (coerce (reverse (code-code code)) 'vector))))
    987     (setf (code-max-stack code) (analyze-stack c))
     987  (let* ((handlers (code-exception-handlers code))
     988         (c (finalize-code
     989                     (code-code code)
     990                     (nconc (mapcar #'exception-start-pc handlers)
     991                            (mapcar #'exception-end-pc handlers)
     992                            (mapcar #'exception-handler-pc handlers))
     993                     t)))
     994    (setf (code-max-stack code)
     995          (analyze-stack c (mapcar #'exception-handler-pc handlers)))
    988996    (multiple-value-bind
    989997          (c labels)
     
    10091017(defun !write-code (code stream)
    10101018  "Writes the attribute `code' to `stream'."
    1011   (sys::%format t "max-stack: ~a~%" (code-max-stack code))
     1019  ;;(sys::%format t "max-stack: ~a~%" (code-max-stack code))
    10121020  (write-u2 (code-max-stack code) stream)
    1013   (sys::%format t "max-locals: ~a~%" (code-max-locals code))
     1021  ;;(sys::%format t "max-locals: ~a~%" (code-max-locals code))
    10141022  (write-u2 (code-max-locals code) stream)
    10151023  (let ((code-array (code-code code)))
    1016     (sys::%format t "length: ~a~%" (length code-array))
     1024    ;;(sys::%format t "length: ~a~%" (length code-array))
    10171025    (write-u4 (length code-array) stream)
    10181026    (dotimes (i (length code-array))
     
    10211029  (write-u2 (length (code-exception-handlers code)) stream)
    10221030  (dolist (exception (reverse (code-exception-handlers code)))
    1023     (sys::%format t "start-pc: ~a~%" (exception-start-pc exception))
     1031    ;;(sys::%format t "start-pc: ~a~%" (exception-start-pc exception))
    10241032    (write-u2 (exception-start-pc exception) stream)
    1025     (sys::%format t "end-pc: ~a~%" (exception-end-pc exception))
     1033    ;;(sys::%format t "end-pc: ~a~%" (exception-end-pc exception))
    10261034    (write-u2 (exception-end-pc exception) stream)
    1027     (sys::%format t "handler-pc: ~a~%" (exception-handler-pc exception))
     1035    ;;(sys::%format t "handler-pc: ~a~%" (exception-handler-pc exception))
    10281036    (write-u2 (exception-handler-pc exception) stream)
    10291037    (write-u2 (exception-catch-type exception) stream))
Note: See TracChangeset for help on using the changeset viewer.