Changeset 12886
- Timestamp:
- 08/11/10 22:09:55 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generic-class-file/abcl/src/org/armedbear/lisp/jvm-class-file.lisp
r12885 r12886 534 534 "Returns all methods which have `name'." 535 535 (remove name (class-file-methods class) 536 :test-not #'string= :key #' method-name))536 :test-not #'string= :key #'!method-name)) 537 537 538 538 (defun class-method (class name return &rest args) … … 540 540 (let ((return-and-args (cons return args))) 541 541 (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))) 544 544 (class-file-methods class)))) 545 545 … … 832 832 833 833 834 (defstruct (method (:constructor %!make-method)) 834 (defstruct (method (:constructor %!make-method) 835 (:conc-name !method-)) 835 836 "Holds information on the properties of methods in the class(-file)." 836 837 access-flags … … 863 864 "Add `attribute' to the list of attributes of `method', 864 865 returning `attribute'." 865 (push attribute ( method-attributes method))866 (push attribute (!method-attributes method)) 866 867 attribute) 867 868 … … 871 872 (method-add-attribute 872 873 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)) 875 876 0 1))))) ;; 1 == implicit 'this' 876 877 … … 885 886 (defun method-attribute (method name) 886 887 "Returns the first attribute of `method' with `name'." 887 (find name ( method-attributes method)888 (find name (!method-attributes method) 888 889 :test #'string= :key #'attribute-name)) 889 890 … … 892 893 "Prepares `method' for serialization." 893 894 (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)) 901 902 902 903 903 904 (defun !write-method (method stream) 904 905 "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)) 910 911 911 912 (defstruct attribute … … 984 985 "Prepares the `code' attribute for serialization, within method `parent'." 985 986 (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))) 988 996 (multiple-value-bind 989 997 (c labels) … … 1009 1017 (defun !write-code (code stream) 1010 1018 "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)) 1012 1020 (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)) 1014 1022 (write-u2 (code-max-locals code) stream) 1015 1023 (let ((code-array (code-code code))) 1016 (sys::%format t "length: ~a~%" (length code-array))1024 ;;(sys::%format t "length: ~a~%" (length code-array)) 1017 1025 (write-u4 (length code-array) stream) 1018 1026 (dotimes (i (length code-array)) … … 1021 1029 (write-u2 (length (code-exception-handlers code)) stream) 1022 1030 (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)) 1024 1032 (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)) 1026 1034 (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)) 1028 1036 (write-u2 (exception-handler-pc exception) stream) 1029 1037 (write-u2 (exception-catch-type exception) stream))
Note: See TracChangeset
for help on using the changeset viewer.