4 ;;;; Return-multiple with other than one value
6 #+sb-assembling
;; we don't want a vop for this one.
7 (define-assembly-routine
11 ;; These four are really arguments.
12 ((:temp nvals any-reg nargs-offset
)
13 (:temp vals any-reg nl0-offset
)
14 (:temp ocfp any-reg nl1-offset
)
15 (:temp lra descriptor-reg lra-offset
)
17 ;; These are just needed to facilitate the transfer
18 (:temp lip interior-reg lip-offset
)
19 (:temp count any-reg nl2-offset
)
20 (:temp src any-reg nl3-offset
)
21 (:temp dst any-reg cfunc-offset
)
22 (:temp temp descriptor-reg l0-offset
)
25 ;; These are needed so we can get at the register args.
26 (:temp a0 descriptor-reg a0-offset
)
27 (:temp a1 descriptor-reg a1-offset
)
28 (:temp a2 descriptor-reg a2-offset
)
29 (:temp a3 descriptor-reg a3-offset
))
31 ;; Note, because of the way the return-multiple vop is written, we can
32 ;; assume that we are never called with nvals == 1 and that a0 has already
35 (inst ble default-a0-and-on
)
36 (inst cmpwi nvals
(fixnumize 2))
37 (inst lwz a1 vals
(* 1 n-word-bytes
))
38 (inst ble default-a2-and-on
)
39 (inst cmpwi nvals
(fixnumize 3))
40 (inst lwz a2 vals
(* 2 n-word-bytes
))
41 (inst ble default-a3-and-on
)
42 (inst cmpwi nvals
(fixnumize 4))
43 (inst lwz a3 vals
(* 3 n-word-bytes
))
46 ;; Copy the remaining args to the top of the stack.
47 (inst addi src vals
(* 4 n-word-bytes
))
48 (inst addi dst cfp-tn
(* 4 n-word-bytes
))
49 (inst addic. count nvals
(- (fixnumize 4)))
52 (inst subic. count count
(fixnumize 1))
54 (inst addi src src n-word-bytes
)
56 (inst addi dst dst n-word-bytes
)
73 (inst add csp-tn ocfp-tn nvals
)
76 (lisp-return lra lip
))
80 ;;;; tail-call-variable.
82 #+sb-assembling
;; no vop for this one either.
83 (define-assembly-routine
85 (:return-style
:none
))
87 ;; These are really args.
88 ((:temp args any-reg nl0-offset
)
89 (:temp lexenv descriptor-reg lexenv-offset
)
91 ;; We need to compute this
92 (:temp nargs any-reg nargs-offset
)
94 ;; These are needed by the blitting code.
95 (:temp src any-reg nl1-offset
)
96 (:temp dst any-reg nl2-offset
)
97 (:temp count any-reg nl3-offset
)
98 (:temp temp descriptor-reg l0-offset
)
99 (:temp lip interior-reg lip-offset
)
101 ;; These are needed so we can get at the register args.
102 (:temp a0 descriptor-reg a0-offset
)
103 (:temp a1 descriptor-reg a1-offset
)
104 (:temp a2 descriptor-reg a2-offset
)
105 (:temp a3 descriptor-reg a3-offset
))
108 ;; Calculate NARGS (as a fixnum)
109 (inst sub nargs csp-tn args
)
111 ;; Load the argument regs (must do this now, 'cause the blt might
112 ;; trash these locations)
113 (inst lwz a0 args
(* 0 n-word-bytes
))
114 (inst lwz a1 args
(* 1 n-word-bytes
))
115 (inst lwz a2 args
(* 2 n-word-bytes
))
116 (inst lwz a3 args
(* 3 n-word-bytes
))
118 ;; Calc SRC, DST, and COUNT
119 (inst addic. count nargs
(fixnumize (- register-arg-count
)))
120 (inst addi src args
(* n-word-bytes register-arg-count
))
122 (inst addi dst cfp-tn
(* n-word-bytes register-arg-count
))
126 (inst lwz temp src
0)
127 (inst addi src src n-word-bytes
)
128 (inst stw temp dst
0)
129 (inst addic. count count
(fixnumize -
1))
130 (inst addi dst dst n-word-bytes
)
134 ;; We are done. Do the jump.
135 (loadw temp lexenv closure-fun-slot fun-pointer-lowtag
)
136 (lisp-jump temp lip
))
140 ;;;; Non-local exit noise.
142 (define-assembly-routine (unwind
143 (:return-style
:none
)
144 (:translate %continue-unwind
)
145 (:policy
:fast-safe
))
146 ((:arg block
(any-reg descriptor-reg
) a0-offset
)
147 (:arg start
(any-reg descriptor-reg
) ocfp-offset
)
148 (:arg count
(any-reg descriptor-reg
) nargs-offset
)
149 (:temp lra descriptor-reg lra-offset
)
150 (:temp lip interior-reg lip-offset
)
151 (:temp cur-uwp any-reg nl0-offset
)
152 (:temp next-uwp any-reg nl1-offset
)
153 (:temp target-uwp any-reg nl2-offset
))
154 (declare (ignore start count
))
156 (let ((error (generate-error-code nil
'invalid-unwind-error
)))
160 (load-tl-symbol-value cur-uwp
*current-unwind-protect-block
*)
161 (loadw target-uwp block unwind-block-current-uwp-slot
)
162 (inst cmpw cur-uwp target-uwp
)
169 (loadw cfp-tn cur-uwp unwind-block-current-cont-slot
)
170 (loadw code-tn cur-uwp unwind-block-current-code-slot
)
171 (loadw lra cur-uwp unwind-block-entry-pc-slot
)
172 (lisp-return lra lip
)
176 (loadw next-uwp cur-uwp unwind-block-current-uwp-slot
)
177 (store-tl-symbol-value next-uwp
*current-unwind-protect-block
* cfp-tn
)
180 (define-assembly-routine (throw
181 (:return-style
:none
))
182 ((:arg target descriptor-reg a0-offset
)
183 (:arg start any-reg ocfp-offset
)
184 (:arg count any-reg nargs-offset
)
185 (:temp catch any-reg a1-offset
)
186 (:temp tag descriptor-reg a2-offset
))
188 (declare (ignore start count
))
190 (load-tl-symbol-value catch
*current-catch-block
*)
194 (let ((error (generate-error-code nil
'unseen-throw-tag-error target
)))
198 (loadw tag catch catch-block-tag-slot
)
199 (inst cmpw tag target
)
201 (loadw catch catch catch-block-previous-catch-slot
)
208 (inst lr catch
(make-fixup 'unwind
:assembly-routine
))