Fix comment about *code-coverage-info*.
[sbcl.git] / src / compiler / target-dump.lisp
blob73172e9522fb85b5f472b57b449cde82610ff5a9
1 ;;;; dumping functionality which isn't needed in cross-compilation
2 ;;;; (and, typically, which is awkward to implement in the
3 ;;;; cross-compilation host)
5 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; more information.
7 ;;;;
8 ;;;; This software is derived from the CMU CL system, which was
9 ;;;; written at Carnegie Mellon University and released into the
10 ;;;; public domain. The software is in the public domain and is
11 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
12 ;;;; files for more information.
14 (in-package "SB!FASL")
16 ;;; a helper function shared by DUMP-SIMPLE-CHARACTER-STRING and
17 ;;; DUMP-SYMBOL (in the target compiler: the cross-compiler uses the
18 ;;; portability knowledge and always dumps BASE-STRINGS).
19 #!+sb-unicode
20 (defun dump-characters-of-string (s fasl-output)
21 (declare (type string s) (type fasl-output fasl-output))
22 (dovector (c s)
23 (dump-unsigned-byte-32 (char-code c) fasl-output))
24 (values))
25 #!+sb-unicode
26 (defun dump-simple-character-string (s file)
27 (declare (type (simple-array character (*)) s))
28 (dump-fop 'fop-character-string file (length s))
29 (dump-characters-of-string s file)
30 (values))
32 ;;; Dump the first N bytes of VEC out to FILE. VEC is some sort of unboxed
33 ;;; vector-like thing that we can BLT from.
34 (defun dump-raw-bytes (vec n fasl-output)
35 (declare (type index n) (type fasl-output fasl-output))
36 ;; FIXME: Why not WRITE-SEQUENCE?
37 (sb!impl::buffer-output (fasl-output-stream fasl-output) vec 0 n)
38 (values))
40 ;;; Dump a multi-dimensional array. Note: any displacements are folded out.
41 ;;;
42 ;;; This isn't needed at cross-compilation time because SBCL doesn't
43 ;;; use multi-dimensional arrays internally. And it's hard to
44 ;;; implement at cross-compilation time because it uses
45 ;;; WITH-ARRAY-DATA. If it ever becomes necessary to implement it at
46 ;;; cross-compilation time, it might possible to use ROW-MAJOR-AREF
47 ;;; stuff to do it portably.
48 (defun dump-multi-dim-array (array file)
49 (note-potential-circularity array file)
50 (let ((rank (array-rank array)))
51 (dotimes (i rank)
52 (dump-integer (array-dimension array i) file))
53 (with-array-data ((vector array) (start) (end))
54 (if (and (= start 0) (= end (length vector)))
55 (sub-dump-object vector file)
56 (sub-dump-object (subseq vector start end) file)))
57 (dump-fop 'fop-array file)
58 (dump-word rank file)
59 (eq-save-object array file)))
61 #!+(and long-float x86)
62 (defun dump-long-float (float file)
63 (declare (long-float float))
64 (let ((exp-bits (long-float-exp-bits float))
65 (high-bits (long-float-high-bits float))
66 (low-bits (long-float-low-bits float)))
67 ;; We could get away with DUMP-WORD here, since the x86 has 4-byte words,
68 ;; but we prefer to make things as explicit as possible.
69 ;; --njf, 2004-08-16
70 (dump-integer-as-n-bytes low-bits 4 file)
71 (dump-integer-as-n-bytes high-bits 4 file)
72 (dump-integer-as-n-bytes exp-bits 2 file)))
74 #!+(and long-float sparc)
75 (defun dump-long-float (float file)
76 (declare (long-float float))
77 (let ((exp-bits (long-float-exp-bits float))
78 (high-bits (long-float-high-bits float))
79 (mid-bits (long-float-mid-bits float))
80 (low-bits (long-float-low-bits float)))
81 ;; We could get away with DUMP-WORD here, since the sparc has 4-byte
82 ;; words, but we prefer to make things as explicit as possible.
83 ;; --njf, 2004-08-16
84 (dump-integer-as-n-bytes low-bits 4 file)
85 (dump-integer-as-n-bytes mid-bits 4 file)
86 (dump-integer-as-n-bytes high-bits 4 file)
87 (dump-integer-as-n-bytes exp-bits 4 file)))