From: Douglas K. <sn...@us...> - 2014-10-19 04:55:23
|
The branch "master" has been updated in SBCL: via c82cc623c8af54cb309de7b77da9519950947298 (commit) from c857378f7efb569018843ac505fdead1fe53701f (commit) - Log ----------------------------------------------------------------- commit c82cc623c8af54cb309de7b77da9519950947298 Author: Douglas Katzman <do...@go...> Date: Sun Oct 19 00:50:20 2014 -0400 Better commentary for %INSTANCE-LENGTH in the cross compiler. --- src/code/defbangstruct.lisp | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/code/defbangstruct.lisp b/src/code/defbangstruct.lisp index c3ac50b..2f5ee3f 100644 --- a/src/code/defbangstruct.lisp +++ b/src/code/defbangstruct.lisp @@ -186,10 +186,17 @@ (defun %instance-length (instance) (aver (or (typep instance 'structure!object) (xc-dumpable-structure-instance-p instance))) - ;; This seems strangely incompatible- INSTANCE-LENGTH should return an odd number - ;; so that including the header word (not counted), it comes out even. - ;; Except that on the xc host you can't access a slot beyond the layout-length, - ;; whereas on the target you can if there is a slack word - it reads as NIL. + ;; INSTANCE-LENGTH tells you how many data words the backend is able to + ;; physically access in this structure. Since every structure occupies + ;; an even number of words, the storage slots comprise an odd number + ;; of words after subtracting 1 for the header. + ;; And in fact the fasl dumper / loader do write and read potentially + ;; one cell beyond the instance's LAYOUT-LENGTH if it was not odd. + ;; I'm not sure whether that is a good or bad thing. + ;; But be that as it may, in the cross-compiler you must not access + ;; more cells than there are in the declared structure because there + ;; is no lower level storage that you can peek at. + ;; So INSTANCE-LENGTH is exactly the same as LAYOUT-LENGTH on the host. (layout-length (classoid-layout (find-classoid (type-of instance))))) (defun %instance-ref (instance index) (aver (or (typep instance 'structure!object) ----------------------------------------------------------------------- hooks/post-receive -- SBCL |