1 ;;;; miscellaneous kernel-level definitions
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; This software is derived from the CMU CL system, which was
7 ;;;; written at Carnegie Mellon University and released into the
8 ;;;; public domain. The software is in the public domain and is
9 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
10 ;;;; files for more information.
12 (in-package "SB!KERNEL")
14 (defun get-header-data (x)
16 "Return the 24 bits of data in the header of object X, which must be an
17 other-pointer object."
20 (defun set-header-data (x val)
22 "Sets the 24 bits of data in the header of object X (which must be an
23 other-pointer object) to VAL."
24 (set-header-data x val))
26 (defun get-closure-length (x)
28 "Returns the length of the closure X. This is one more than the number
29 of variables closed over."
30 (get-closure-length x))
34 "Returns the three-bit lowtag for the object X."
39 "Returns the 8-bit header type for the object X."
44 "Return a System-Area-Pointer pointing to the data for the vector X, which
46 (declare (type (simple-unboxed-array (*)) x))
49 (defun sb!c::binding-stack-pointer-sap ()
51 "Return a System-Area-Pointer pointing to the end of the binding stack."
52 (sb!c::binding-stack-pointer-sap))
54 (defun sb!c::dynamic-space-free-pointer ()
56 "Returns a System-Area-Pointer pointing to the next free work of the current
58 (sb!c::dynamic-space-free-pointer))
60 (defun sb!c::control-stack-pointer-sap ()
62 "Return a System-Area-Pointer pointing to the end of the control stack."
63 (sb!c::control-stack-pointer-sap))
65 (defun function-subtype (function)
67 "Return the header typecode for FUNCTION. Can be set with SETF."
68 (function-subtype function))
70 (defun (setf function-subtype) (type function)
71 (setf (function-subtype function) type))
73 (defun %function-arglist (func)
75 "Extracts the arglist from the function header FUNC."
76 (%function-arglist func))
78 (defun %function-name (func)
80 "Extracts the name from the function header FUNC."
81 (%function-name func))
83 (defun %function-type (func)
85 "Extracts the type from the function header FUNC."
86 (%function-type func))
88 (defun %closure-function (closure)
90 "Extracts the function from CLOSURE."
91 (%closure-function closure))
93 (defun sb!c::vector-length (vector)
95 "Return the length of VECTOR. There is no reason to use this, 'cause
96 (length (the vector foo)) is the same."
97 (sb!c::vector-length vector))
99 (defun %closure-index-ref (closure index)
101 "Extract the INDEXth slot from CLOSURE."
102 (%closure-index-ref closure index))
104 (defun allocate-vector (type length words)
106 "Allocate a unboxed, simple vector with type code TYPE, length LENGTH, and
107 WORDS words long. Note: it is your responsibility to ensure that the
108 relation between LENGTH and WORDS is correct."
109 (allocate-vector type length words))
111 (defun make-array-header (type rank)
113 "Allocate an array header with type code TYPE and rank RANK."
114 (make-array-header type rank))
116 (defun code-instructions (code-obj)
118 "Return a SAP pointing to the instructions part of CODE-OBJ."
119 (code-instructions code-obj))
121 (defun code-header-ref (code-obj index)
123 "Extract the INDEXth element from the header of CODE-OBJ. Can be set with
125 (code-header-ref code-obj index))
127 (defun code-header-set (code-obj index new)
128 (code-header-set code-obj index new))
130 (defun %raw-bits (object offset)
131 (declare (type index offset))
132 (sb!kernel:%raw-bits object offset))
134 (defun %set-raw-bits (object offset value)
135 (declare (type index offset) (type (unsigned-byte #.sb!vm:word-bits) value))
136 (setf (sb!kernel:%raw-bits object offset) value))
138 (defun make-single-float (x) (make-single-float x))
139 (defun make-double-float (hi lo) (make-double-float hi lo))
141 (defun make-long-float (exp hi #!+sparc mid lo)
142 (make-long-float exp hi #!+sparc mid lo))
143 (defun single-float-bits (x) (single-float-bits x))
144 (defun double-float-high-bits (x) (double-float-high-bits x))
145 (defun double-float-low-bits (x) (double-float-low-bits x))
147 (defun long-float-exp-bits (x) (long-float-exp-bits x))
149 (defun long-float-high-bits (x) (long-float-high-bits x))
150 #!+(and long-float sparc)
151 (defun long-float-mid-bits (x) (long-float-mid-bits x))
153 (defun long-float-low-bits (x) (long-float-low-bits x))