Remove support for tail arrays and self slots
* libguile/struct.c (scm_make_struct): Remove support for tail arrays and self slots. (set_vtable_layout_flags): Always initialize the nfields member. (scm_is_valid_vtable_layout): Remove support for tail arrays and self slots. (scm_i_struct_inherit_vtable_magic): No need to issue deprecation warning for self slots, as they are no longer supported. (scm_struct_init): Remove support for tail arrays and self slots. (scm_c_make_structv): Throw an exception if n_tail is not 0. (scm_allocate_struct): Adapt to scm_struct_init change. (scm_i_make_vtable_vtable): Initialize slots manually, to avoid relying on an already-initialized nfields member. (scm_struct_ref, scm_struct_set_x): Simplify. * module/oop/goops.scm: As we now rely on nfields being valid, when recalculating slots during boot we need to avoid resetting nfields of <class>, even temporarily, as that would prevent any further access to <class>!
This commit is contained in:
parent
2f9ad7d9bc
commit
d354962b68
2 changed files with 82 additions and 204 deletions
|
|
@ -911,6 +911,20 @@ slots as we go."
|
|||
(compute-direct-slot-definition class initargs)))
|
||||
(struct-set! class class-index-direct-slots
|
||||
(map make-direct-slot-definition specs))))
|
||||
;; Boot definition that avoids munging nfields.
|
||||
(define (allocate-slots class slots)
|
||||
(define (make-effective-slot-definition slot index)
|
||||
(let* ((slot (compute-effective-slot-definition class slot)))
|
||||
(struct-set! slot slot-index-slot-ref/raw (standard-get index))
|
||||
(struct-set! slot slot-index-slot-ref
|
||||
(if (slot-definition-init-thunk slot)
|
||||
(struct-ref slot slot-index-slot-ref/raw)
|
||||
(bound-check-get index)))
|
||||
(struct-set! slot slot-index-slot-set! (standard-set index))
|
||||
(struct-set! slot slot-index-index index)
|
||||
(struct-set! slot slot-index-size 1)
|
||||
slot))
|
||||
(map make-effective-slot-definition slots (iota (length slots))))
|
||||
(define (initialize-slots! class)
|
||||
(let ((slots (build-slots-list (class-direct-slots class)
|
||||
(class-precedence-list class))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue