(in-package "SB-COLD")
-;;; FIXME: This is embarassing -- SBCL violates SBCL style-package
-;;; locks on the host lisp. Rather then find and fix all the cases
-;;; right now, let's just remain self-hosting. The problems at least
-;;; involve a few defvars and local macros with names in the CL
-;;; package.
-#+sbcl
-(let ((plp (find-symbol PACKAGE-LOCKED-P :sb-ext)))
- (when (and plp (fboundp plp))
- (dolist (p (list-all-packages))
- (sb-ext::unlock-package p))))
-
;;; prefixes for filename stems when cross-compiling. These are quite arbitrary
;;; (although of course they shouldn't collide with anything we don't want to
;;; write over). In particular, they can be either relative path names (e.g.
(src-prefix "")
(src-suffix ".lisp")
(compile-file #'compile-file)
+ trace-file
ignore-failure-p)
(declare (type function compile-file))
(setf tmp-obj
;; (Note that this idiom is taken from the ANSI
;; documentation for TRUENAME.)
- (with-open-file (stream tmp-obj :direction :output)
+ (with-open-file (stream tmp-obj
+ :direction :output
+ ;; Compilation would overwrite the
+ ;; temporary object anyway and overly
+ ;; strict implementations default
+ ;; to :ERROR.
+ :if-exists :supersede)
(close stream)
(truename stream)))
;; and some compilers (e.g. OpenMCL) will complain if they're
;; recognizeably a fasl file), so
(when (probe-file tmp-obj)
(delete-file tmp-obj))
-
+
;; Try to use the compiler to generate a new temporary object file.
(flet ((report-recompile-restart (stream)
(format stream "Recompile file ~S" src))
(tagbody
retry-compile-file
(multiple-value-bind (output-truename warnings-p failure-p)
- (funcall compile-file src :output-file tmp-obj)
+ (if trace-file
+ (funcall compile-file src :output-file tmp-obj
+ :trace-file t)
+ (funcall compile-file src :output-file tmp-obj ))
(declare (ignore warnings-p))
(cond ((not output-truename)
(error "couldn't compile ~S" src))
;; SBCL. ("not target code" -- but still presumably host code,
;; used to support the cross-compilation process)
:not-target
+ ;; meaning: The #'COMPILE-STEM argument :TRACE-FILE should be T.
+ ;; When the compiler is SBCL's COMPILE-FILE or something like it,
+ ;; compiling "foo.lisp" will generate "foo.trace" which contains lots
+ ;; of exciting low-level information about representation selection,
+ ;; VOPs used by the compiler, and bits of assembly.
+ :trace-file
;; meaning: This file is to be processed with the SBCL assembler,
;; not COMPILE-FILE. (Note that this doesn't make sense unless
;; :NOT-HOST is also set, since the SBCL assembler doesn't exist
;;; Run the cross-compiler on a file in the source directory tree to
;;; produce a corresponding file in the target object directory tree.
-(defun target-compile-stem (stem &key assem-p ignore-failure-p)
+(defun target-compile-stem (stem &key assem-p ignore-failure-p trace-file)
(funcall *in-target-compilation-mode-fn*
(lambda ()
(compile-stem stem
:obj-prefix *target-obj-prefix*
:obj-suffix *target-obj-suffix*
+ :trace-file trace-file
:ignore-failure-p ignore-failure-p
:compile-file (if assem-p
*target-assemble-file*