4 ;;;; This software is part of the SBCL system. See the README file for
7 ;;;; This software is derived from the CMU CL system, which was
8 ;;;; written at Carnegie Mellon University and released into the
9 ;;;; public domain. The software is in the public domain and is
10 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
11 ;;;; files for more information.
13 ;;; This is a linear ordering of system sources which works both to
14 ;;; compile/load the cross-compiler under the host Common Lisp and to
15 ;;; cross-compile the compiler into the under-construction target
18 ;;; Of course, it'd be very nice to have this be a dependency DAG
19 ;;; instead, so that we could do automated incremental recompilation.
20 ;;; But the dependencies are varied and subtle, and it'd be extremely
21 ;;; difficult to extract them automatically, and it'd be extremely
22 ;;; tedious and error-prone to extract them manually, so we don't
23 ;;; extract them. (It would be nice to fix this someday. The most
24 ;;; feasible approach that I can think of would be to make the
25 ;;; dependencies work on a package level, not an individual file
26 ;;; level. Doing it at the package level would make the granularity
27 ;;; coarse enough that it would probably be pretty easy to maintain
28 ;;; the dependency information manually, and the brittleness of the
29 ;;; package system would help make most violations of the declared
30 ;;; dependencies obvious at build time. -- WHN 20000803
32 ;;; FIXME: Perhaps now that a significant number of files are built
33 ;;; in warm load instead of cold load, this file should now be called
34 ;;; cold-stems-and-flags.lisp-expr? Also, perhaps this file should move
35 ;;; into the src/cold directory?
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
40 ;; This comes early because it's useful for debugging everywhere.
43 ;; This comes early because the cross-compilation host's backquote logic
44 ;; expand into something which can't be executed on the target Lisp (e.g.
45 ;; in CMU CL where it expands into internal functions like BACKQ-LIST), and
46 ;; by replacing the host backquote logic with our own as early as possible,
47 ;; we minimize the chance of any forms referring to host Lisp internal
48 ;; functions leaking into target Lisp code.
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
52 ;; various DEFSETFs and/or other DEFMACROish things, defined as early as
53 ;; possible so we don't need to fiddle with any subtleties of defining them
54 ;; before any possible use
56 ;; KLUDGE: It would be nice to reimplement most or all of these as
57 ;; functions (possibly inlined functions) so that we wouldn't need to
58 ;; worry so much about forcing them all to be defined before any possible
59 ;; use. It might be pretty tedious, though, working through any
60 ;; transforms and translators and optimizers and so forth to make sure
61 ;; that they can handle the change. -- WHN 19990919
64 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
65 ;;; cross-compiler-only replacements for stuff which in target Lisp would be
66 ;;; supplied by basic machinery
68 ("code/cross-misc" :not-target)
69 ("code/cross-float" :not-target)
70 ("code/cross-io" :not-target)
71 ("code/cross-sap" :not-target)
73 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
74 ;;; stuff needed early both in cross-compilation host and in target Lisp
77 ("code/early-defbangmethod")
82 ("code/primordial-extensions")
84 ;; for various constants e.g. SB!VM:*TARGET-MOST-POSITIVE-FIXNUM* and
85 ;; SB!VM:LOWTAG-BITS, needed by "early-objdef" and others
86 ("compiler/generic/early-vm")
87 ("compiler/generic/early-objdef")
88 ("compiler/target/parms")
89 ("code/early-array") ; needs "early-vm" numbers
91 ("code/parse-body") ; on host for PARSE-BODY
92 ("code/parse-defmacro") ; on host for PARSE-DEFMACRO
93 ("code/extensions") ; on host for COLLECT, SYMBOLICATE, etc.
94 ("compiler/deftype") ; on host for SB!XC:DEFTYPE
95 ("code/early-alieneval") ; for vars needed both at build time and at runtime
97 ("code/specializable-array")
102 ;; mostly needed by stuff from comcom, but also used by "x86-vm"
103 ("code/debug-var-io")
105 ("code/cold-init-helper-macros")
107 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
108 ;;; basic machinery for the target Lisp. Note that although most of these
109 ;;; files are flagged :NOT-HOST, a few might not be.
111 ("code/target-defbangmethod" :not-host)
113 ("code/early-print" :not-host)
114 ("code/early-pprint" :not-host)
115 ("code/early-impl" :not-host)
117 ("code/target-extensions" :not-host)
119 ("code/early-defstructs" :not-host) ; gotta-be-first DEFSTRUCTs
121 ("code/defbangstruct")
123 ;; This needs DEF!STRUCT, and is itself needed early so that structure
124 ;; accessors and inline functions defined here can be compiled inline
125 ;; later. (Avoiding full calls not only increases efficiency, but also
126 ;; avoids some cold init issues involving full calls to structure
130 ("code/lisp-stream" :not-host)
132 ("code/sysmacs" :not-host)
134 ;; "assembly/assemfile" was here in the sequence inherited from
135 ;; CMU CL worldcom.lisp, but also appears later in the sequence
136 ;; inherited from CMU CL comcom.lisp. We shouldn't need two versions,
137 ;; so I've deleted the one here. -- WHN 19990620
139 ;; FIXME: There are lots of "maybe" notes in this file, e.g.
140 ;; "maybe should be :BYTE-COMPILE T". Once the system is stable,
143 ("code/early-target-error" :not-host) ; maybe should be :BYTE-COMPILE T
144 ;; FIXME: maybe should be called "target-error", with "late-target-error"
145 ;; called "condition"
147 ;; a comment from classic CMU CL:
148 ;; "These guys can supposedly come in any order, but not really.
149 ;; Some are put at the end so that macros don't run interpreted
151 ;; Dunno exactly what this meant or whether it still holds. -- WHN 19990803
152 ;; FIXME: more informative and up-to-date comment?
153 ("code/globals" :not-host)
154 ("code/kernel" :not-host)
155 ("code/toplevel" :not-host)
156 ("code/cold-error" :not-host)
157 ("code/fdefinition" :not-host)
158 ;; FIXME: Figure out some way to make the compiler macro for INFO
159 ;; available for compilation of "code/fdefinition".
161 ;; In classic CMU CL, code/type was here. I've since split that into
162 ;; lots of smaller pieces, some of which are here and some of which
163 ;; are handled later in the sequence, when the cross-compiler is
164 ;; built. -- WHN 19990620
165 ("code/target-type" :not-host)
167 ("code/pred" :not-host)
169 ("code/target-alieneval" :not-host)
170 ("code/target-c-call" :not-host)
171 ("code/target-allocate" :not-host)
173 ("code/misc-aliens" :not-host) ; needs DEF-ALIEN-ROUTINE from target-alieneval
175 ("code/array" :not-host)
176 ("code/target-sxhash" :not-host)
178 ("code/list" :not-host)
179 ("code/seq" :not-host) ; "code/seq" should come after "code/list".
180 ("code/coerce" :not-host)
182 ("code/string" :not-host)
183 ("code/mipsstrops" :not-host)
185 ("code/target-os-types" :not-host) ; symlinked in make-config.sh
186 ("code/unix" :not-host)
188 #!+mach ("code/mach" :not-host)
189 #!+mach ("code/mach-os" :not-host)
190 #!+sunos ("code/sunos-os" :not-host)
191 #!+hpux ("code/hpux-os" :not-host)
192 #!+osf1 ("code/osf1-os" :not-host)
193 #!+irix ("code/irix-os" :not-host)
194 #!+bsd ("code/bsd-os" :not-host)
195 #!+linux ("code/linux-os" :not-host)
197 ;; KLUDGE: I'd prefer to have this done with a "code/target" softlink
198 ;; instead of a bunch of reader macros. -- WHN 19990308
199 #!+pmax ("code/pmax-vm" :not-host)
200 #!+(and sparc svr4) ("code/sparc-svr4-vm" :not-host)
201 #!+(and sparc (not svr4)) ("code/sparc-vm" :not-host)
202 #!+rt ("code/rt-vm" :not-host)
203 #!+hppa ("code/hppa-vm" :not-host)
204 #!+x86 ("code/x86-vm" :not-host)
205 #!+alpha ("code/alpha-vm" :not-host)
206 #!+sgi ("code/sgi-vm" :not-host)
208 ("code/target-signal" :not-host) ; needs OS-CONTEXT-T from x86-vm
210 ("code/symbol" :not-host)
211 ("code/bignum" :not-host)
212 ("code/target-numbers" :not-host)
213 ("code/float-trap" :not-host)
214 ("code/float" :not-host)
215 ("code/irrat" :not-host)
218 ("code/target-char" :not-host)
219 ("code/target-misc" :not-host)
222 #!-gengc ("code/room" :not-host)
223 #!-gengc ("code/gc" :not-host)
224 #!-gengc ("code/purify" :not-host)
226 #!+gengc ("code/gengc" :not-host)
228 ("code/stream" :not-host)
229 ("code/print" :not-host)
230 ("code/pprint" :not-host) ; maybe should be :BYTE-COMPILE T
231 ("code/early-format")
232 ("code/target-format" :not-host) ; maybe should be :BYTE-COMPILE T
233 ("code/defpackage" :not-host)
234 ("code/pp-backq" :not-host) ; maybe should be :BYTE-COMPILE T
236 ("code/error-error" :not-host) ; needs WITH-STANDARD-IO-SYNTAX macro
238 ("code/serve-event" :not-host)
239 ("code/fd-stream" :not-host)
241 ("code/module" :not-host) ; maybe should be :BYTE-COMPILE T
246 ("code/target-eval" :not-host) ; FIXME: uses INFO, wants compiler macro
248 ("code/interr" :not-host)
250 ("code/query" :not-host) ; maybe should be :BYTE-COMPILE T
252 ("code/sort" :not-host)
253 ("code/time" :not-host)
254 ("code/weak" :not-host)
255 ("code/final" :not-host)
257 #!+mp ("code/multi-proc" :not-host)
259 ("code/setf-funs" :not-host)
261 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
262 ;;; compiler (and a few miscellaneous files whose dependencies make it
263 ;;; convenient to stick them here)
271 ;; ("code/defbangmacro" was here until sbcl-0.6.7.3.)
274 ("compiler/generic/vm-macs")
276 ;; needed by "compiler/vop"
279 ;; for e.g. BLOCK-ANNOTATION, needed by "compiler/vop"
282 ;; for e.g. PRIMITIVE-TYPE, needed by "vmdef"
285 ;; needed by "vm" and "primtype"
288 ;; for e.g. MAX-VOP-TN-REFS, needed by "meta-vmdef"
292 ("compiler/target/backend-parms")
294 ;; for INFO and SB!XC:MACRO-FUNCTION, needed by defmacro.lisp
295 ("compiler/globaldb")
296 ("compiler/info-functions")
299 ("code/force-delayed-defbangmacros")
301 ("compiler/late-macros")
303 ;; for e.g. !DEF-PRIMITIVE-TYPE, needed by primtype.lisp, and
304 ;; DEFINE-STORAGE-CLASS, needed by target/vm.lisp
305 ("compiler/meta-vmdef")
307 ;; for e.g. DESCRIPTOR-REG, needed by primtype.lisp
308 ("compiler/target/vm")
310 ;; for e.g. SPECIFIER-TYPE, needed by primtype.lisp
313 ;; FIXME: Classic CMU CL had SAFETY 2 DEBUG 2 set around the compilation
314 ;; of "code/class". Why?
317 ;; The definitions for CONDITION and CONDITION-CLASS depend on
318 ;; SLOT-CLASS, defined in classes.lisp.
319 ("code/late-target-error" :not-host) ; FIXME: maybe should be :BYTE-COMPILE T
321 ("compiler/generic/primtype")
323 ;; the implementation of the compiler-affecting part of forms like
324 ;; DEFMACRO and DEFTYPE; must be loaded before we can start
326 ("compiler/parse-lambda-list")
328 ;; for DEFSTRUCT ALIEN-TYPE, needed by host-type.lisp
329 ("code/host-alieneval")
331 ;; can't be done until definition of e.g. DEF-ALIEN-TYPE-CLASS in
332 ;; host-alieneval.lisp
335 ;; SB!XC:DEFTYPE is needed in order to compile late-type
336 ;; in the host Common Lisp, and in order to run, it needs
337 ;; %COMPILER-DEFTYPE.
338 ("compiler/compiler-deftype")
340 ;; These appear here in the build sequence because they require
341 ;; * the macro INFO, defined in globaldb.lisp, and
342 ;; * the function PARSE-DEFMACRO, defined in parse-defmacro.lisp,
343 ;; and because they define
344 ;; * the function SPECIFIER-TYPE, which is used in fndb.lisp.
346 ("code/deftypes-for-target")
348 ;; The inline definition of TYPEP-TO-LAYOUT here needs inline
349 ;; functions defined in classes.lisp, and is needed in turn by
350 ;; the target version of "code/defstruct".
351 ("code/target-defstruct" :not-host)
353 ;; stuff needed by "code/defstruct"
354 ("code/cross-type" :not-target)
355 ("compiler/generic/vm-type")
357 ;; The DEFSTRUCT machinery needs SB!XC:SUBTYPEP, defined in
358 ;; "code/late-type", and SB!XC:TYPEP, defined in "code/cross-type",
359 ;; and SPECIALIZE-ARRAY-TYPE, defined in "compiler/generic/vm-type".
362 ;; ALIEN-VALUE has to be defined as a class (done by DEFSTRUCT
363 ;; machinery) before we can set its superclasses here.
366 ("compiler/knownfun")
368 ;; needs IR1-ATTRIBUTES macro, defined in knownfun.lisp
369 ("compiler/proclaim")
371 ;; This needs not just the SB!XC:DEFSTRUCT machinery, but also
372 ;; the TYPE= stuff defined in late-type.lisp, and the
373 ;; CHECK-FUNCTION-NAME defined in proclaim.lisp.
374 ("code/force-delayed-defbangstructs")
378 ("compiler/compiler-error")
382 ;; These define target types needed by fndb.lisp.
390 ;; KLUDGE: Much stuff above here is the type system and/or the INFO
391 ;; system, not really the compiler proper. It might be easier to
392 ;; understand the system if those things were split off into packages
393 ;; SB-TYPE and SB-INFO and built in their own sections. -- WHN 20000124
395 ;; In classic CMU CL (re)build order, these were done later, but
396 ;; in building from scratch, these must be loaded before
397 ;; "compiler/generic/objdef" in order to allow forms like
398 ;; (DEFINE-PRIMITIVE-OBJECT (..) (CAR ..) ..) to work.
400 ("compiler/generic/vm-fndb")
402 ("compiler/generic/objdef")
404 ("compiler/generic/interr")
406 ("compiler/bit-util")
408 ("compiler/early-assem") ; has ASSEMBLY-UNIT-related stuff needed by core.lisp
410 ;; core.lisp contains DEFSTRUCT CORE-OBJECT, and "compiler/main.lisp"
411 ;; does lots of (TYPEP FOO 'CORE-OBJECT), so it's nice to compile this
412 ;; before "compiler/main.lisp" so that those can be coded efficiently
413 ;; (and so that they don't cause lots of annoying compiler warnings
414 ;; about undefined types).
415 ("compiler/generic/core")
419 ("code/fop") ; needs macros from code/host-load.lisp
422 ("compiler/disassem")
425 ("compiler/trace-table") ; needs EMIT-LABEL macro from compiler/assem.lisp
427 ;; Compiling this file requires fop definitions from code/fop.lisp
428 ;; and trace table definitions from compiler/trace-table.lisp.
431 ("compiler/main") ; needs DEFSTRUCT FASL-FILE from compiler/dump.lisp
432 ("compiler/target-main" :not-host)
437 ;; Compiling this file requires the macros SB!ASSEM:EMIT-LABEL and
438 ;; SB!ASSEM:EMIT-POST-IT, defined in assem.lisp.
439 ("compiler/late-vmdef")
441 ("compiler/ir1final")
442 ("compiler/array-tran")
444 ("compiler/typetran")
445 ("compiler/generic/vm-typetran")
446 ("compiler/float-tran")
451 ("compiler/checkgen")
452 ("compiler/constraint")
460 ("compiler/debug-dump")
461 ("compiler/generic/utils")
462 ("assembly/assemfile")
464 ("compiler/fixup") ; for DEFSTRUCT FIXUP, used by insts.lisp
466 ("compiler/target/insts")
467 ("compiler/target/macros")
469 ("assembly/target/support")
471 ("compiler/target/move")
472 ("compiler/target/float")
473 ("compiler/target/sap")
474 ("compiler/target/system")
475 ("compiler/target/char")
476 ("compiler/target/memory")
477 ("compiler/target/static-fn")
478 ("compiler/target/arith")
479 ("compiler/target/subprim")
481 ("compiler/target/debug")
482 ("compiler/target/c-call")
483 ("compiler/target/cell")
484 ("compiler/target/values")
485 ("compiler/target/alloc")
486 ("compiler/target/call")
487 ("compiler/target/nlx")
488 ("compiler/target/show")
489 ("compiler/target/array"
490 ;; KLUDGE: Compiling this file raises alarming warnings of the form
491 ;; Argument FOO to VOP CHECK-BOUND has SC restriction
492 ;; DESCRIPTOR-REG which is not allowed by the operand type:
493 ;; (:OR POSITIVE-FIXNUM)
494 ;; This seems not to be something that I broke, but rather a "feature"
495 ;; inherited from classic CMU CL. (Debian cmucl_2.4.8.deb compiling
496 ;; Debian cmucl_2.4.8.tar.gz raises the same warning). Thus, even though
497 ;; these warnings are severe enough that they would ordinarily abort
498 ;; compilation, for now we blithely ignore them and press on to more
499 ;; pressing problems. Someday, though, it would be nice to figure out
500 ;; what the problem is and fix it.. -- WHN 19990323
502 ("compiler/target/pred")
503 ("compiler/target/type-vops")
505 ("assembly/target/assem-rtns" :assem)
506 ("assembly/target/array" :assem)
507 ("assembly/target/arith" :assem)
508 ("assembly/target/alloc" :assem)
510 ("compiler/pseudo-vops")
512 ("compiler/aliencomp")
522 ;; KLUDGE: This has #!+GENGC things in it which are intended to
523 ;; overwrite code in ir2tran.lisp, so it has to come after ir2tran.lisp.
525 ;; FIXME: Those things should probably be ir2tran.lisp instead, and the
526 ;; things they now overwrite should instead be #!-GENGC so they're never
527 ;; generated in the first place.
528 ("compiler/generic/vm-ir2tran")
530 ("compiler/copyprop")
531 ("compiler/represent")
532 ("compiler/generic/vm-tran")
537 #!+sb-dyncount ("compiler/dyncount")
538 #!+sb-dyncount ("code/dyncount")
540 ;; needed by OPEN-FASL-FILE, which is called by COMPILE-FILE
543 ;; needed by various unhappy-path cases in the cross-compiler
546 ;; This wasn't in classic CMU CL "comcom.lisp", but it has some stuff
547 ;; that Python-as-cross-compiler has turned out to need.
550 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
551 ;; files which are only needed in the target system, and/or which are
552 ;; only possible in the target system, and which depend in some way
553 ;; (directly or indirectly) on stuff compiled as part of the compiler
555 ("compiler/generic/target-core" :not-host) ; uses stuff from
556 ; "compiler/generic/core"
558 ("code/target-sap" :not-host) ; uses SAP-INT-TYPE
559 ("code/target-package" :not-host) ; needs "code/package"
560 ("code/target-random" :not-host) ; needs "code/random"
561 ("code/target-hash-table" :not-host) ; needs "code/hash-table"
562 ("code/reader" :not-host) ; needs "code/readtable"
563 ("code/target-pathname" :not-host) ; needs "code/pathname", maybe
564 ; should be :BYTE-COMPILE T
565 ("code/filesys" :not-host) ; needs HOST from "code/pathname",
566 ; maybe should be :BYTE-COMPILE T
567 ("code/save" :not-host) ; uses the definition of PATHNAME
568 ; from "code/pathname"
569 ("code/sharpm" :not-host) ; uses stuff from "code/reader"
571 ;; stuff for byte compilation. Note that although byte code is
572 ;; "portable", it'd be hard to make it work on the cross-compilation
573 ;; host, because fundamental BYTE-FUNCTION-OR-CLOSURE types are
574 ;; implemented as FUNCALLABLE-INSTANCEs, and it's not obvious
575 ;; how to emulate those in a vanilla ANSI Common Lisp.
576 ("code/byte-types" :not-host)
577 ("compiler/byte-comp")
578 ("compiler/target-byte-comp" :not-host)
579 ("code/byte-interp" :not-host) ; needs *SYSTEM-CONSTANT-CODES* from byte-comp
581 ;; defines SB!DI:DO-DEBUG-FUNCTION-BLOCKS, needed by target-disassem.lisp
582 ("code/debug-int" :not-host)
584 ;; target-only assemblerish stuff
585 ("compiler/target-disassem" :not-host)
586 ("compiler/target/target-insts" :not-host)
588 ;; the IR1 interpreter (as opposed to the byte code interpreter)
589 #!+sb-interpreter ("compiler/eval-comp" :not-host)
590 #!+sb-interpreter ("compiler/eval" :not-host)
592 ("code/debug" :not-host) ; maybe should be :BYTE-COMPILE T
594 ;; These can't be compiled until CONDITION and DEFINE-CONDITION
595 ;; are defined, and they also use SB-DEBUG:*STACK-TOP-HINT*.
596 ("code/parse-defmacro-errors" :not-host)
598 ("code/bit-bash" :not-host) ; needs %NEGATE from assembly/target/arith
600 ("code/target-load" :not-host) ; needs specials from code/load.lisp
602 ;; FIXME: Does this really need stuff from compiler/dump.lisp?
603 ("compiler/target-dump" :not-host) ; needs stuff from compiler/dump.lisp
605 ("code/cold-init" :not-host) ; needs (SETF EXTERN-ALIEN) macroexpansion
607 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
608 ;; target macros and DECLAIMs installed at build-the-cross-compiler time
610 ;; Declare all target special variables defined by ANSI now, so that
611 ;; we don't have to worry about any of them being bound incorrectly
612 ;; when the compiler processes code which appears before the appropriate
613 ;; DEFVAR or DEFPARAMETER.
616 ;; fundamental target macros (e.g. CL:DO and CL:DEFUN) and support
619 ;; FIXME: Since a lot of this code is just macros, perhaps it should be
622 ("code/destructuring-bind")
628 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
630 ;; other target-code-building stuff which can't be processed until
631 ;; machinery like SB!XC:DEFMACRO exists
633 ("code/late-format") ; needs SB!XC:DEFMACRO
634 ("code/sxhash") ; needs SB!XC:DEFINE-MODIFY-MACRO
636 ("code/late-defbangmethod"))