[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sbcl-devel
Subject:    Re: [Sbcl-devel] Introspection bug
From:       "Tobias C. Rittweiler" <tcr () freebits ! de>
Date:       2009-10-22 16:11:23
Message-ID: 87ws2ntnmc.fsf () freebits ! de
[Download RAW message or body]

Levente Mészáros <levente.meszaros@gmail.com> writes:

> The following form errors in SBCL 1.0.31.29 x86-64.
>
> (sb-introspect:find-definition-sources-by-name
> 'common-lisp:structure-object :structure)

The error is because

  (sb-kernel::layout-source-location 
    (sb-impl::classoid-layout
      (sb-impl::find-classoid FOO)))

for the following symbols

  FILE-STREAM
  SB-EVAL:INTERPRETED-FUNCTION
  STRUCTURE-OBJECT
  STREAM
  STRING-STREAM
  SEQUENCE
  T
  FUNCTION
  CONDITION

returns 0 rather than NIL.

The reason for that (this insight came from Xof) is that the LAYOUT
classoid is also actually initialized by genesis and in MAKE-COLD-LAYOUT
a

  (cold-set-layout-slot result 'source-location *nil-descriptor*)

is missing.

A comment in code/class.lisp just above the defstruct definition of
LAYOUT says that this initialization should probably be automated, and I
agree. But that's somewhat outside my capabilities now because I'm
drowning in related KLUDGEs and FIXMEs.

For example the FIXME in %INIT-OR-CHECK-LAYOUT (class.lisp) seems also
apropos to be fixed in one go.

All I can provide is a test case which checks that each class/structure
has a non-bogus source-location. This test could be extended to cover
not only class/structures but everything in the infodb.

Say if you want me to do that. I'll decline to provide a patch for the
actual issue, though.

  -T.

PS.

  (dolist (env sb-c::*info-environment*)
    (sb-c::do-info (env :class class :type type :name info-name :value value)
      (when (and (symbolp info-name) 
                 (eql class :type)
                 (eql type :kind))
        (let* ((classoid (sb-kernel:find-classoid info-name nil))
               (layout   (and classoid (sb-kernel:classoid-layout classoid)))
               (srcloc   (and layout (sb-kernel::layout-source-location layout))))
          (when (and layout)
            (assert (or (sb-c::definition-source-location-p srcloc)
                        (null srcloc))))))))


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Sbcl-devel mailing list
Sbcl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic