On Wed, Oct 31, 2001 at 05:08:50PM +1100, Brian Spilsbury wrote:
> This is the first segment is offending code in src/code/target-random.lisp
> (defvar *random-state*)
> (defun !random-cold-init ()
> (/show0 "entering !RANDOM-COLD-INIT")
> ;(setf *random-state* (%make-random-state))
> (setf *random-state* t)
> (/show0 "test")
> (/show #'%make-random-state)
> (/show0 "returning from !RANDOM-COLD-INIT"))
> I've butchered it somewhat, but it gets up to the (%make-random-state)
> /entering !COLD-INIT
> /entering !RANDOM-COLD-INIT
> /(can't /SHOW, unbound vars)
> /VALUES-SPECIFIER-TYPE too early in cold init, uncached
> is what prints out.
> So, it doesn't think that #'%make-random-state is bound to anything...
> unless I've misread it.
> Which might explain why it doesn't get into the debugging messages I've
> embedded in the structure constructors.
> However, if that function is unbound (and it claims to have been
> compiled), then something is fundamentally broken.
> Am I missing some obvious stupidity on my part?
You are missing something, but it's not so much stupidity on your part
as a misleading error message from /SHOW. From show.lisp:
;; For /SHOW to work, we need *TRACE-OUTPUT* of course, but
;; also *READTABLE* (used by the printer to decide what
;; case convention to use when outputting symbols).
(if (every #'boundp '(*trace-output* *readtable*))
#+ansi-cl (list ,@format-rest)
#-ansi-cl ,@format-rest)) ; for CLISP (CLTL1-ish)
#+sb-xc-host (error "can't /SHOW, unbound vars")
;; We end up in this situation when we execute /SHOW
;; too early in cold init. That happens often enough
;; that it's really annoying for it to cause a hard
;; failure -- which at that point is hard to recover
;; from -- instead of just diagnostic output.
"/(can't /SHOW, unbound vars)"))
The "unbound vars" doesn't have anything to do with the binding of
%MAKE-RANDOM-STATE, it's a complaint that you're trying to use
full-blown /SHOW too early in cold init for it to work, because things
like *TRACE-OUTPUT* and *READTABLE* aren't set up yet.
I'm sorry about the the confusing error reporting, I'll try to make it
/SHOW is implemented in terms of FORMAT, so you can't use it very
early in cold init. That's what /SHOW0 is for, and you can use it
(IF (FBOUNDP #'%MAKE-RANDOM-STATE)
(/SHOW0 "%MAKE-RANDOM-STATE is fbound, happy happy joy joy.")
(/SHOW0 "%MAKE-RANDOM-STATE not fbound, ouch."))
or if you're comfortable working with sbcl.h, cold-sbcl.map, gdb/ldb,
etc., like this
William Harold Newman <william.newman@...>
God grant me serenity to accept the code I cannot change,
courage to change the code I can, and wisdom to know the difference.
-- Erik Naggum
PGP key fingerprint 85 CE 1C BA 79 8D 51 8C B9 25 FB EE E0 C3 E5 7C