From e32c4479d9c1eff0d94fd95b41db58dad7a346a7 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Sun, 15 Oct 2017 10:04:15 -0700
Subject: [PATCH] Release 21c

Use `-B boot-21c` to bootstrap the release from 21b to 21c.

- 21b/boot-21c.lisp:
 - Add boot-21c.lisp to update the version number
- compiler/byte-comp.lisp
 - Update the actual version number
---
 src/bootfiles/21b/boot-21c.lisp | 68 +++++++++++++++++++++++++++++++++
 src/compiler/byte-comp.lisp     |  2 +-
 2 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 src/bootfiles/21b/boot-21c.lisp

diff --git a/src/bootfiles/21b/boot-21c.lisp b/src/bootfiles/21b/boot-21c.lisp
new file mode 100644
index 000000000..589aec399
--- /dev/null
+++ b/src/bootfiles/21b/boot-21c.lisp
@@ -0,0 +1,68 @@
+;;;;
+;;;; Boot file for changing the fasl file version numbers to 21a.
+;;;;
+
+(in-package :c)
+
+(setf lisp::*enable-package-locked-errors* nil)
+
+;;;
+;;; Note that BYTE-FASL-FILE-VERSION is a constant.
+;;;
+;;; (Be sure to change BYTE-FASL-FILE-VERSION in
+;;; compiler/byte-comp.lisp to the correct value too!)
+;;;
+#-cmu21c
+(setf (symbol-value 'byte-fasl-file-version)       #x21c)
+#-cmu21c
+(setf (backend-fasl-file-version *target-backend*) #x21c)
+
+;;;
+;;; Don't check fasl versions in the compiling Lisp because we'll
+;;; load files compiled with the new version numbers.
+;;;
+#-cmu21c
+(setq lisp::*skip-fasl-file-version-check* t)
+
+;;;
+;;; This is here because BYTE-FASL-FILE-VERSION is constant-folded in
+;;; OPEN-FASL-FILE.  To make the new version number take effect, we
+;;; have to redefine the function.
+;;;
+#-cmu21c
+(defun open-fasl-file (name where &optional byte-p)
+  (declare (type pathname name))
+  (let* ((stream (open name :direction :output
+			    :if-exists :new-version
+			    :element-type '(unsigned-byte 8)
+			    :class 'binary-text-stream))
+	 (res (make-fasl-file :stream stream)))
+    (multiple-value-bind
+	(version f-vers f-imp)
+	(if byte-p
+	    (values "Byte code"
+		    byte-fasl-file-version
+		    (backend-byte-fasl-file-implementation *backend*))
+	    (values (backend-version *backend*)
+		    (backend-fasl-file-version *backend*)
+		    (backend-fasl-file-implementation *backend*)))
+      (format stream
+	      "FASL FILE output from ~A.~@
+	       Compiled ~A on ~A~@
+	       Compiler ~A, Lisp ~A~@
+	       Targeted for ~A, FASL version ~X~%"
+	      where
+	      (ext:format-universal-time nil (get-universal-time))
+	      (machine-instance) compiler-version
+	      (lisp-implementation-version)
+	      version f-vers)
+      ;;
+      ;; Terminate header.
+      (dump-byte 255 res)
+      ;;
+      ;; Specify code format.
+      (dump-fop 'lisp::fop-long-code-format res)
+      (dump-byte f-imp res)
+      (dump-unsigned-32 f-vers res))
+    res))
+
diff --git a/src/compiler/byte-comp.lisp b/src/compiler/byte-comp.lisp
index ea728d96b..96c574b62 100644
--- a/src/compiler/byte-comp.lisp
+++ b/src/compiler/byte-comp.lisp
@@ -38,7 +38,7 @@
 ;; 0-9 followed by a single hex digit in the range a-f.  Then the
 ;; version looks like a decimal number followed by a minor release
 ;; letter of a to f.
-(defconstant byte-fasl-file-version #x21b)
+(defconstant byte-fasl-file-version #x21c)
 
 (let* ((version-string (format nil "~X" byte-fasl-file-version)))
   ;; Add :cmu<n> to *features*
-- 
GitLab