1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
12 ;;;; Return-multiple with other than one value
14 #+sb-assembling
;; we don't want a vop for this one.
15 (define-assembly-routine
17 (:return-style
:none
))
19 ;; These four are really arguments.
20 ((:temp nvals any-reg nargs-offset
)
21 (:temp vals any-reg nl0-offset
)
22 (:temp ocfp any-reg nl1-offset
)
23 (:temp lra descriptor-reg lra-offset
)
25 ;; These are just needed to facilitate the transfer
26 (:temp count any-reg nl2-offset
)
27 (:temp src any-reg nl3-offset
)
28 (:temp dst any-reg nl4-offset
)
29 (:temp temp descriptor-reg l0-offset
)
31 ;; These are needed so we can get at the register args.
32 (:temp a0 descriptor-reg a0-offset
)
33 (:temp a1 descriptor-reg a1-offset
)
34 (:temp a2 descriptor-reg a2-offset
)
35 (:temp a3 descriptor-reg a3-offset
)
36 (:temp a4 descriptor-reg a4-offset
)
37 (:temp a5 descriptor-reg a5-offset
))
39 ;; Note, because of the way the return-multiple vop is written, we can
40 ;; assume that we are never called with nvals == 1 and that a0 has already
43 (inst b
:le default-a0-and-on
)
44 (inst cmp nvals
(fixnumize 2))
45 (inst b
:le default-a2-and-on
)
46 (inst ld a1 vals
(* 1 n-word-bytes
))
47 (inst cmp nvals
(fixnumize 3))
48 (inst b
:le default-a3-and-on
)
49 (inst ld a2 vals
(* 2 n-word-bytes
))
50 (inst cmp nvals
(fixnumize 4))
51 (inst b
:le default-a4-and-on
)
52 (inst ld a3 vals
(* 3 n-word-bytes
))
53 (inst cmp nvals
(fixnumize 5))
54 (inst b
:le default-a5-and-on
)
55 (inst ld a4 vals
(* 4 n-word-bytes
))
56 (inst cmp nvals
(fixnumize 6))
58 (inst ld a5 vals
(* 5 n-word-bytes
))
60 ;; Copy the remaining args to the top of the stack.
61 (inst add src vals
(* 6 n-word-bytes
))
62 (inst add dst cfp-tn
(* 6 n-word-bytes
))
63 (inst subcc count nvals
(fixnumize 6))
67 (inst add src n-word-bytes
)
69 (inst add dst n-word-bytes
)
71 (inst subcc count
(fixnumize 1))
77 (inst move a0 null-tn
)
78 (inst move a1 null-tn
)
80 (inst move a2 null-tn
)
82 (inst move a3 null-tn
)
84 (inst move a4 null-tn
)
86 (inst move a5 null-tn
)
92 (inst add csp-tn ocfp-tn nvals
)
99 ;;;; tail-call-variable.
101 #+sb-assembling
;; no vop for this one either.
102 (define-assembly-routine
104 (:return-style
:none
))
106 ;; These are really args.
107 ((:temp args any-reg nl0-offset
)
108 (:temp lexenv descriptor-reg lexenv-offset
)
110 ;; We need to compute this
111 (:temp nargs any-reg nargs-offset
)
113 ;; These are needed by the blitting code.
114 (:temp src any-reg nl1-offset
)
115 (:temp dst any-reg nl2-offset
)
116 (:temp count any-reg nl3-offset
)
117 (:temp temp descriptor-reg l0-offset
)
119 ;; These are needed so we can get at the register args.
120 (:temp a0 descriptor-reg a0-offset
)
121 (:temp a1 descriptor-reg a1-offset
)
122 (:temp a2 descriptor-reg a2-offset
)
123 (:temp a3 descriptor-reg a3-offset
)
124 (:temp a4 descriptor-reg a4-offset
)
125 (:temp a5 descriptor-reg a5-offset
))
128 ;; Calculate NARGS (as a fixnum)
129 (inst sub nargs csp-tn args
)
131 ;; Load the argument regs (must do this now, 'cause the blt might
132 ;; trash these locations)
133 (inst ld a0 args
(* 0 n-word-bytes
))
134 (inst ld a1 args
(* 1 n-word-bytes
))
135 (inst ld a2 args
(* 2 n-word-bytes
))
136 (inst ld a3 args
(* 3 n-word-bytes
))
137 (inst ld a4 args
(* 4 n-word-bytes
))
138 (inst ld a5 args
(* 5 n-word-bytes
))
140 ;; Calc SRC, DST, and COUNT
141 (inst addcc count nargs
(fixnumize (- register-arg-count
)))
143 (inst add src args
(* n-word-bytes register-arg-count
))
144 (inst add dst cfp-tn
(* n-word-bytes register-arg-count
))
149 (inst add src src n-word-bytes
)
151 (inst addcc count
(fixnumize -
1))
153 (inst add dst dst n-word-bytes
)
156 ;; We are done. Do the jump.
157 (loadw temp lexenv closure-fun-slot fun-pointer-lowtag
)
162 ;;;; Non-local exit noise.
164 (define-assembly-routine (unwind
165 (:return-style
:none
)
166 (:translate %continue-unwind
)
167 (:policy
:fast-safe
))
168 ((:arg block
(any-reg descriptor-reg
) a0-offset
)
169 (:arg start
(any-reg descriptor-reg
) ocfp-offset
)
170 (:arg count
(any-reg descriptor-reg
) nargs-offset
)
171 (:temp lra descriptor-reg lra-offset
)
172 (:temp cur-uwp any-reg nl0-offset
)
173 (:temp next-uwp any-reg nl1-offset
)
174 (:temp target-uwp any-reg nl2-offset
))
175 (declare (ignore start count
))
177 (let ((error (generate-error-code nil invalid-unwind-error
)))
181 (load-symbol-value cur-uwp
*current-unwind-protect-block
*)
182 (loadw target-uwp block unwind-block-current-uwp-slot
)
183 (inst cmp cur-uwp target-uwp
)
191 (loadw cfp-tn cur-uwp unwind-block-current-cont-slot
)
192 (loadw code-tn cur-uwp unwind-block-current-code-slot
)
193 (loadw lra cur-uwp unwind-block-entry-pc-slot
)
194 (lisp-return lra
:frob-code nil
)
198 (loadw next-uwp cur-uwp unwind-block-current-uwp-slot
)
200 (store-symbol-value next-uwp
*current-unwind-protect-block
*))
203 (define-assembly-routine (throw
204 (:return-style
:none
))
205 ((:arg target descriptor-reg a0-offset
)
206 (:arg start any-reg ocfp-offset
)
207 (:arg count any-reg nargs-offset
)
208 (:temp catch any-reg a1-offset
)
209 (:temp tag descriptor-reg a2-offset
)
210 (:temp temp non-descriptor-reg nl0-offset
))
212 (declare (ignore start count
))
214 (load-symbol-value catch
*current-catch-block
*)
218 (let ((error (generate-error-code nil unseen-throw-tag-error target
)))
223 (loadw tag catch catch-block-tag-slot
)
224 (inst cmp tag target
)
227 (loadw catch catch catch-block-previous-catch-slot
)
234 (inst li temp
(make-fixup 'unwind
:assembly-routine
))