(in-package "SB!FASL")
+;;; a helper function shared by DUMP-SIMPLE-CHARACTER-STRING and
+;;; DUMP-SYMBOL (in the target compiler: the cross-compiler uses the
+;;; portability knowledge and always dumps BASE-STRINGS).
+#!+sb-unicode
+(defun dump-characters-of-string (s fasl-output)
+ (declare (type string s) (type fasl-output fasl-output))
+ (dovector (c s)
+ (dump-word (char-code c) fasl-output))
+ (values))
+#!+sb-unicode
+(defun dump-simple-character-string (s file)
+ (declare (type (simple-array character (*)) s))
+ (dump-fop* (length s) fop-small-character-string fop-character-string file)
+ (dump-characters-of-string s file)
+ (values))
+
;;; Dump the first N bytes of VEC out to FILE. VEC is some sort of unboxed
;;; vector-like thing that we can BLT from.
(defun dump-raw-bytes (vec n fasl-output)
(sub-dump-object vector file)
(sub-dump-object (subseq vector start end) file)))
(dump-fop 'fop-array file)
- (dump-unsigned-32 rank file)
+ (dump-word rank file)
(eq-save-object array file)))
\f
;;;; various dump-a-number operations
(defun dump-single-float-vector (vec file)
(let ((length (length vec)))
(dump-fop 'fop-single-float-vector file)
- (dump-unsigned-32 length file)
- (dump-raw-bytes vec (* length sb!vm:word-bytes) file)))
+ (dump-word length file)
+ (dump-raw-bytes vec (* length 4) file)))
(defun dump-double-float-vector (vec file)
(let ((length (length vec)))
(dump-fop 'fop-double-float-vector file)
- (dump-unsigned-32 length file)
- (dump-raw-bytes vec (* length sb!vm:word-bytes 2) file)))
+ (dump-word length file)
+ (dump-raw-bytes vec (* length 8) file)))
#!+long-float
(defun dump-long-float-vector (vec file)
(let ((length (length vec)))
(dump-fop 'fop-long-float-vector file)
- (dump-unsigned-32 length file)
- (dump-raw-bytes vec (* length sb!vm:word-bytes #!+x86 3 #!+sparc 4) file)))
+ (dump-word length file)
+ (dump-raw-bytes vec
+ (* length sb!vm:n-word-bytes #!+x86 3 #!+sparc 4)
+ file)))
(defun dump-complex-single-float-vector (vec file)
(let ((length (length vec)))
(dump-fop 'fop-complex-single-float-vector file)
- (dump-unsigned-32 length file)
- (dump-raw-bytes vec (* length sb!vm:word-bytes 2) file)))
+ (dump-word length file)
+ (dump-raw-bytes vec (* length 8) file)))
(defun dump-complex-double-float-vector (vec file)
(let ((length (length vec)))
(dump-fop 'fop-complex-double-float-vector file)
- (dump-unsigned-32 length file)
- (dump-raw-bytes vec (* length sb!vm:word-bytes 2 2) file)))
+ (dump-word length file)
+ (dump-raw-bytes vec (* length 16) file)))
#!+long-float
(defun dump-complex-long-float-vector (vec file)
(let ((length (length vec)))
(dump-fop 'fop-complex-long-float-vector file)
- (dump-unsigned-32 length file)
- (dump-raw-bytes vec (* length sb!vm:word-bytes #!+x86 3 #!+sparc 4 2) file)))
+ (dump-word length file)
+ (dump-raw-bytes vec
+ (* length sb!vm:n-word-bytes #!+x86 3 #!+sparc 4 2)
+ file)))
#!+(and long-float x86)
(defun dump-long-float (float file)
(let ((exp-bits (long-float-exp-bits float))
(high-bits (long-float-high-bits float))
(low-bits (long-float-low-bits float)))
- (dump-unsigned-32 low-bits file)
- (dump-unsigned-32 high-bits file)
+ ;; We could get away with DUMP-WORD here, since the x86 has 4-byte words,
+ ;; but we prefer to make things as explicit as possible.
+ ;; --njf, 2004-08-16
+ (dump-integer-as-n-bytes low-bits 4 file)
+ (dump-integer-as-n-bytes high-bits 4 file)
(dump-integer-as-n-bytes exp-bits 2 file)))
#!+(and long-float sparc)
(high-bits (long-float-high-bits float))
(mid-bits (long-float-mid-bits float))
(low-bits (long-float-low-bits float)))
- (dump-unsigned-32 low-bits file)
- (dump-unsigned-32 mid-bits file)
- (dump-unsigned-32 high-bits file)
+ ;; We could get away with DUMP-WORD here, since the sparc has 4-byte
+ ;; words, but we prefer to make things as explicit as possible.
+ ;; --njf, 2004-08-16
+ (dump-integer-as-n-bytes low-bits 4 file)
+ (dump-integer-as-n-bytes mid-bits 4 file)
+ (dump-integer-as-n-bytes high-bits 4 file)
(dump-integer-as-n-bytes exp-bits 4 file)))
-\f
-;;;; dumping things which don't exist in portable ANSI Common Lisp
-
-;;; FIXME: byte compiler to go away completely
-#|
-;;; Dump a BYTE-FUNCTION object. We dump the layout and
-;;; funcallable-instance info, but rely on the loader setting up the
-;;; correct funcallable-instance-function.
-(defun dump-byte-function (xep code-handle file)
- (let ((nslots (- (get-closure-length xep)
- ;; 1- for header
- (1- sb!vm:funcallable-instance-info-offset))))
- (dotimes (i nslots)
- (if (zerop i)
- (dump-push code-handle file)
- (dump-object (%funcallable-instance-info xep i) file)))
- (dump-object (%funcallable-instance-layout xep) file)
- (dump-fop 'fop-make-byte-compiled-function file)
- (dump-byte nslots file))
- (values))
-|#
\ No newline at end of file