Changeset 12879


Ignore:
Timestamp:
08/08/10 21:24:03 (12 years ago)
Author:
ehuelsmann
Message:

Add 'dual mode' to DECLARE-FIELD.

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

    r12876 r12879  
    12761276
    12771277(defknown declare-field (t t t) t)
    1278 (defun declare-field (name descriptor access-flags)
    1279   (let ((field (make-field name (internal-field-ref descriptor))))
    1280     ;; final static <access-flags>
    1281     (setf (field-access-flags field)
    1282           (logior +field-flag-final+ +field-flag-static+ access-flags))
    1283     (setf (field-name-index field) (pool-name (field-name field)))
    1284     (setf (field-descriptor-index field) (pool-name (field-descriptor field)))
    1285     (push field *fields*)))
     1278(defun declare-field (name descriptor)
     1279  (if *current-code-attribute*
     1280      (let ((field (!make-field name descriptor '(:final :static :private))))
     1281        (class-add-field *class-file* field))
     1282      (let ((field (make-field name (internal-field-ref descriptor))))
     1283        ;; final static <access-flags>
     1284        (setf (field-access-flags field)
     1285              (logior +field-flag-final+ +field-flag-static+
     1286                      +field-access-private+))
     1287        (setf (field-name-index field) (pool-name (field-name field)))
     1288        (setf (field-descriptor-index field)
     1289              (pool-name (field-descriptor field)))
     1290        (push field *fields*))))
    12861291
    12871292(defknown sanitize (symbol) string)
     
    14681473    ;; We need to set up the serialized value
    14691474    (let ((field-name (symbol-name (gensym prefix))))
    1470       (declare-field field-name field-type +field-access-private+)
     1475      (declare-field field-name field-type)
    14711476      (push (cons object field-name) *externalized-objects*)
    14721477
     
    15051510     (when s
    15061511       (setf f (concatenate 'string f "_" s))))
    1507    (declare-field f +lisp-object+ +field-access-private+)
     1512   (declare-field f +lisp-object+)
    15081513   (multiple-value-bind
    15091514         (name class)
     
    15581563          (*code* *static-code*))
    15591564     ;; fixme *declare-inline*
    1560      (declare-field g +lisp-object+ +field-access-private+)
     1565     (declare-field g +lisp-object+)
    15611566     (emit-new class-name)
    15621567     (emit 'dup)
     
    15831588      ;; strings may contain evaluated bits which may depend on
    15841589      ;; previous statements
    1585       (declare-field g +lisp-object+ +field-access-private+)
     1590      (declare-field g +lisp-object+)
    15861591      (emit 'ldc (pool-string s))
    15871592      (emit-invokestatic +lisp+ "readObjectFromString"
     
    16031608      ;; lisp code in the string (think #.() syntax), of which the outcome
    16041609      ;; may depend on something which was declared inline
    1605       (declare-field g +lisp-object+ +field-access-private+)
     1610      (declare-field g +lisp-object+)
    16061611      (emit 'ldc (pool-string s))
    16071612      (emit-invokestatic +lisp+ "readObjectFromString"
     
    16271632    (remember g obj)
    16281633    (let* ((*code* *static-code*))
    1629       (declare-field g +lisp-object+ +field-access-private+)
     1634      (declare-field g +lisp-object+)
    16301635      (emit 'ldc (pool-string g))
    16311636      (emit-invokestatic +lisp+ "recall"
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/jvm.lisp

    r12865 r12879  
    8383(defvar *fields* ())
    8484(defvar *static-code* ())
     85(defvar *class-file* nil)
    8586
    8687(defvar *externalized-objects* nil)
Note: See TracChangeset for help on using the changeset viewer.