- (loop
- with offset = (let ((size-of-super-classes
- (proxy-instance-size
- (most-specific-proxy-superclass class))))
- (+ size-of-super-classes
- (mod size-of-super-classes +struct-alignmen+)))
- with size = offset
- for slotd in (class-direct-slots class)
- when (eq (slot-definition-allocation slotd) :alien)
- do (if (not (slot-boundp slotd 'offset))
- (setf (slot-value slotd 'offset) offset)
- (setq offset (slot-value slotd 'offset)))
-
- (incf offset (size-of (slot-definition-type slotd)))
- (incf offset (mod offset +struct-alignmen+))
- (setq size (max size offset))
-
- finally (unless (slot-boundp class 'size)
- (setf (slot-value class 'size) size)))
+ (let ((alien-slots
+ (remove-if-not
+ #'(lambda (slotd)
+ (eq (slot-definition-allocation slotd) :alien))
+ (class-direct-slots class))))
+ (when alien-slots
+ (loop
+ as offset = (align-offset (foreign-size
+ (most-specific-proxy-superclass class)))
+ then (align-offset
+ (+
+ (slot-definition-offset slotd)
+ (size-of (slot-definition-type slotd))))
+ for slotd in alien-slots
+ unless (slot-boundp slotd 'offset)
+ do (setf (slot-value slotd 'offset) offset))))