Changeset 5959


Ignore:
Timestamp:
Feb 23, 2007, 9:06:11 AM (18 years ago)
Author:
Gary Byers
Message:

Some extra fields in objc-message-info/objc-method-info structures.

When calculating overall alignment of a structure, treat bitfields
as if they were :unsigned-int (since there's a "containing" unsigned
int that affects alignment. N.B: this should be imposed for anything that
has an alignment of 1, not just a size of 1.)

When loading integer types, try to use the precomputed types rather
than consing a new one. This (a) reduces consing a little (b) is
more likely to get the alignment correct. For (b), we really need
to distinguish between bitfields and addressable integers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/db-io.lisp

    r5855 r5959  
    828828                                       nil))))))
    829829
    830 ;;; For backward compatibility: the implementation really shouldn't define
    831 ;;; #?.  Nuke this in a future release.
    832 ;;; Now, for instance.
    833 #+no
    834 (set-dispatch-macro-character #\# #\? (get-dispatch-macro-character #\# #\&))
     830
    835831             
    836832
     
    841837  req-args
    842838  flags
    843   protocol-methods)
    844 
     839  protocol-methods
     840  lisp-name
     841  selector)
     842
     843
     844
     845   
    845846(defstruct objc-method-info
    846847  message-info
     
    851852  flags
    852853  signature
     854  signature-info
    853855  )
    854856
     
    15091511      (#.encoded-type-signed-16 (values (svref *signed-integer-types* 16) q))
    15101512      (#.encoded-type-unsigned-16 (values (svref *unsigned-integer-types* 16) q))
    1511       (#.encoded-type-signed-n (values (make-foreign-integer-type
    1512                                           :signed t
    1513                                           :bits (%get-unsigned-byte buf q))
     1513      (#.encoded-type-signed-n (values (let* ((bits (%get-unsigned-byte buf q)))
     1514                                         (if (<= bits 32)
     1515                                           (svref *signed-integer-types* bits)
     1516                                           (make-foreign-integer-type
     1517                                            :signed t
     1518                                            :bits bits)))
    15141519                                         (1+ q)))
    1515       (#.encoded-type-unsigned-n (values (make-foreign-integer-type
     1520      (#.encoded-type-unsigned-n (values (let* ((bits (%get-unsigned-byte buf q)))
     1521                                         (if (<= bits 32)
     1522                                           (svref *unsigned-integer-types* bits)
     1523                                           (make-foreign-integer-type
    15161524                                            :signed nil
    1517                                             :bits (%get-unsigned-byte buf q))
     1525                                            :bits bits)))
    15181526                                           (1+ q)))
    15191527      (#.encoded-type-single-float (values (parse-foreign-type :float) q))
     
    16381646          (error "Unknown alignment: ~S"
    16391647                 (unparse-foreign-type field-type)))
    1640         (setq overall-alignment (max overall-alignment alignment))
     1648        (setq overall-alignment (max overall-alignment (if (= alignment 1) 32 alignment)))
    16411649        (ecase kind
    16421650          (:struct (let* ((imported-offset (foreign-record-field-offset field))
Note: See TracChangeset for help on using the changeset viewer.