Changeset 12139


Ignore:
Timestamp:
09/06/09 20:22:41 (12 years ago)
Author:
ehuelsmann
Message:

Make it possible to have non-private fields.

File:
1 edited

Legend:

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

    r12136 r12139  
    19051905  (write-u2 0 stream)) ; attributes count
    19061906
    1907 (defknown declare-field (t t) t)
    1908 (defun declare-field (name descriptor)
     1907(defconst +field-access-protected+ #x4) ;; subclass accessible
     1908(defconst +field-access-private+   #x2) ;; class-only accessible
     1909(defconst +field-access-public+    #x1) ;; generally accessible
     1910(defconst +field-access-default+   #x0) ;; package accessible, used for LABELS
     1911
     1912(defknown declare-field (t t t) t)
     1913(defun declare-field (name descriptor access-flags)
    19091914  (let ((field (make-field name descriptor)))
    1910     ;; final private static
    1911     (setf (field-access-flags field) (logior #x10 #x8 #x2))
     1915    ;; final static <access-flags>
     1916    (setf (field-access-flags field) (logior #x10 #x8 access-flags))
    19121917    (setf (field-name-index field) (pool-name (field-name field)))
    19131918    (setf (field-descriptor-index field) (pool-name (field-descriptor field)))
     
    19591964      (when s
    19601965        (setf g (concatenate 'string g "_" s)))
    1961       (declare-field g +lisp-symbol+)
     1966      (declare-field g +lisp-symbol+ +field-access-private+)
    19621967      (emit 'ldc (pool-string (symbol-name symbol)))
    19631968      (emit 'ldc (pool-string (package-name (symbol-package symbol))))
     
    19851990   (let ((*code* *static-code*))
    19861991     (setf g (symbol-name (gensym "KEY")))
    1987      (declare-field g +lisp-symbol+)
     1992     (declare-field g +lisp-symbol+ +field-access-private+)
    19881993     (emit 'ldc (pool-string (symbol-name symbol)))
    19891994     (emit-invokestatic +lisp-class+ "internKeyword"
     
    20022007     (when s
    20032008       (setf f (concatenate 'string f "_" s))))
    2004    (declare-field f +lisp-object+)
     2009   (declare-field f +lisp-object+ +field-access-private+)
    20052010   (multiple-value-bind
    20062011         (name class)
     
    20292034   (let* ((pathname (class-file-pathname (local-function-class-file local-function)))
    20302035    (*code* *static-code*))
    2031      (declare-field g +lisp-object+)
     2036     (declare-field g +lisp-object+ +field-access-default+)
    20322037     (emit 'ldc (pool-string (file-namestring pathname)))
    20332038     (emit-invokestatic +lisp-class+ "loadCompiledFunction"
     
    20462051         (if (minusp n) "MINUS_" "")
    20472052         (abs n)))
    2048      (declare-field g +lisp-integer+)
     2053     (declare-field g +lisp-integer+ +field-access-private+)
    20492054     (cond ((<= 0 n 255)
    20502055      (emit 'getstatic +lisp-fixnum-class+ "constants" +lisp-fixnum-array+)
     
    20642069   (setf g (concatenate 'string "BIGNUM_" (symbol-name (gensym))))
    20652070   (let ((*code* *static-code*))
    2066      (declare-field g +lisp-integer+)
     2071     (declare-field g +lisp-integer+ +field-access-private+)
    20672072     (cond ((<= most-negative-java-long n most-positive-java-long)
    20682073;;      (setf g (format nil "BIGNUM_~A~D"
     
    20892094   (let* ((*code* *static-code*))
    20902095     (setf g (concatenate 'string "FLOAT_" (symbol-name (gensym))))
    2091      (declare-field g +lisp-single-float+)
     2096     (declare-field g +lisp-single-float+ +field-access-private+)
    20922097     (emit 'new +lisp-single-float-class+)
    20932098     (emit 'dup)
     
    21042109   (let ((*code* *static-code*))
    21052110     (setf g (concatenate 'string "DOUBLE_" (symbol-name (gensym))))
    2106      (declare-field g +lisp-double-float+)
     2111     (declare-field g +lisp-double-float+ +field-access-private+)
    21072112     (emit 'new +lisp-double-float-class+)
    21082113     (emit 'dup)
     
    21182123        (n (char-code c))
    21192124        (*code* *static-code*))
    2120     (declare-field g +lisp-character+)
     2125    (declare-field g +lisp-character+ +field-access-private+)
    21212126    (cond ((<= 0 n 255)
    21222127           (emit 'getstatic +lisp-character-class+ "constants" +lisp-character-array+)
     
    21382143         (s (with-output-to-string (stream) (dump-form obj stream)))
    21392144         (*code* *static-code*))
    2140     (declare-field g obj-ref)
     2145    (declare-field g obj-ref +field-access-private+)
    21412146    (emit 'ldc (pool-string s))
    21422147    (emit-invokestatic +lisp-class+ "readObjectFromString"
     
    21522157         (s (with-output-to-string (stream) (dump-form obj stream)))
    21532158         (*code* *static-code*))
    2154     (declare-field g +lisp-object+)
     2159    (declare-field g +lisp-object+ +field-access-private+)
    21552160    (emit 'ldc (pool-string s))
    21562161    (emit-invokestatic +lisp-class+ "readObjectFromString"
     
    21702175         (s (with-output-to-string (stream) (dump-form obj stream)))
    21712176         (*code* *static-code*))
    2172     (declare-field g +lisp-object+)
     2177    (declare-field g +lisp-object+ +field-access-private+)
    21732178    (emit 'ldc (pool-string s))
    21742179    (emit-invokestatic +lisp-class+ "readObjectFromString"
     
    21862191         (s (format nil "#.(FIND-PACKAGE ~S)" (package-name obj)))
    21872192         (*code* *static-code*))
    2188     (declare-field g +lisp-object+)
     2193    (declare-field g +lisp-object+ +field-access-private+)
    21892194    (emit 'ldc (pool-string s))
    21902195    (emit-invokestatic +lisp-class+ "readObjectFromString"
     
    22062211           (g2 (symbol-name (gensym "O2BJ"))))
    22072212      (let* ((*code* *static-code*))
    2208       (declare-field g2 obj-ref)
     2213      (declare-field g2 obj-ref +field-access-private+)
    22092214      (emit 'getstatic *this-class* g1 +lisp-simple-string+)
    22102215      (emit-invokestatic +lisp-class+ "recall"
     
    22222227         (s (format nil "~S" obj))
    22232228         (*code* *static-code*))
    2224     (declare-field g +lisp-object+)
     2229    (declare-field g +lisp-object+ +field-access-private+)
    22252230    (emit 'ldc
    22262231          (pool-string s))
     
    22382243   (let ((*code* *static-code*))
    22392244        (setf g (symbol-name (gensym "STR")))
    2240         (declare-field g +lisp-simple-string+)
     2245        (declare-field g +lisp-simple-string+ +field-access-private+)
    22412246        (emit 'new +lisp-simple-string-class+)
    22422247        (emit 'dup)
Note: See TracChangeset for help on using the changeset viewer.