[movitz-devel] Re: defvar and reboots

Frode Vatvedt Fjeld ffjeld at common-lisp.net
Sun May 29 22:15:21 UTC 2005

Shawn Betts <sabetts at vcn.bc.ca> writes:

> I've found that in some cases defvar and defparameter cause movitz
> to reboot upon loading. initializing the variable with nil a number
> seems to work fine, but a cons or a function call causes a
> reboot. The following causes a reboot:
> (defvar *commands* (make-hash-table)
>   "A hash table of commands")

A reboot I would guess means an exception is triggered before
exception-handlers are installed. And that exception I guess would be
triggered by trying to allocate memory (as make-hash-table obviously
does) before dynamic memory allocation is initialized. Verify that
your file with the defvar top-level form comes after at least
lib/malloc-init (but preferrably also the other two, muerte/print and
x86-pc/textmode, and whatever you have that is equivalent to the
genesis function in los0.lisp) in the load-sequence that gets printed
at dump-time.

Just now I tried to add such a defvar to los0.lisp, and it turns out
that make-hash-table also requires CLOS to be bootstrapped, and if
that wasn't already done (explicitly) then the kernel would die,
though slightly more gracefully than just rebooting. I just checked in
a couple of tweaks that fixes this behavior, so that now only some
warnings should be seen (about auto-bootstrapping CLOS) in such cases.

Frode Vatvedt Fjeld

More information about the movitz-devel mailing list