From: Christophe R. <cs...@ca...> - 2010-08-28 18:54:47
|
Red Daly <re...@gm...> writes: > The immediate problem is that braid.lisp, which is traditionally > compiled by the target machine, invokes COMPILE while executing a > top-level form: > > (!bootstrap-meta-braid) > (!bootstrap-accessor-definitions t) > (!bootstrap-class-predicates t) ;; <-- the offending form > (!bootstrap-accessor-definitions nil) > (!bootstrap-class-predicates nil) > (!bootstrap-built-in-classes) > > > This is not a problem in warm init when the compiler is available, but > when braid.lisp is cross-compiled and these top-level forms are > executed, the compiler is not yet available. And since the point of > getting PCL into cold is to use CLOS in the compiler, we wish to only > invoke the cross-compiler while bootstrapping PCL. I realise this is going to sound demotivating, but I got about as far as you have done in 2003, before deciding that it was fundamentally the wrong way of going about things... > Option 2 is more ambitious and even its benefits are unclear to me as > a relative newcomer to serous SBCL hacking. My idea is to try to > perform the bootstrapping on the host, so that !bootstrap-meta-braid > et al. occur on the host machine and generate pre-bootstrapped code on > the target. This approach is hard enough to make my head hurt. ... and that this is the right way. (I agree with "head hurt", by the way -- you will note that I never actually got round to trying this.) > 3. Is "Option 2" practical or will it necessarily require doing > something as drastic as making PCL portable to all CL implementations > again? I don't think the whole of PCL needs to be made portable, but I think there does need to be enough of a cross-compiler version of CLOS that instances that correspond to eventual target classes can be built and introspected -- somewhat similar to the cross-compiler version of defstruct. This is slightly complicated by the fact that while we can assume CLOS on the host lisp, we can't assume the MOP. I think that the first milestone in going down this route would be the ability to dump the class hierarchy from genesis, similarly to how wrappers for important types (notably, the wrapper of WRAPPER itself) are dumped. This would then break I think most of the circularities involved in the PCL bootstrap, and permit much more of it to be straightforwardly compiled. (There are still lurking circularities such as MAKE-METHOD-LAMBDA, but I think they're much more straightforward). It might be as simple as something like (defclass sb-object () ()) (defclass sb!xc:t (sb-object) ()) (defclass sb!xc:standard-object (sb!xc:t) ()) (defclass sb!xc:standard-class (sb!xc:standard-object) ()) and then code in genesis that walks the sb-object hierarchy and dumps out enough to make (find-class 'standard-class) work after cold-init. I hope all this gives you some ideas, anyway. Best, Christophe |