3 ;;;; Return-multiple with other than one value
5 #+sb-assembling
;; we don't want a vop for this one.
6 (define-assembly-routine
9 ;; These four are really arguments.
10 ((:temp nvals any-reg nargs-offset
)
11 (:temp vals any-reg nl0-offset
)
12 (:temp ocfp any-reg nl1-offset
)
13 (:temp lra descriptor-reg lra-offset
)
14 ;; These are just needed to facilitate the transfer
15 (:temp count any-reg nl2-offset
)
16 (:temp dst any-reg nl3-offset
)
17 (:temp temp descriptor-reg l0-offset
)
18 ;; These are needed so we can get at the register args.
19 (:temp a0 descriptor-reg a0-offset
)
20 (:temp a1 descriptor-reg a1-offset
)
21 (:temp a2 descriptor-reg a2-offset
)
22 (:temp a3 descriptor-reg a3-offset
)
23 (:temp a4 descriptor-reg a4-offset
)
24 (:temp a5 descriptor-reg a5-offset
))
25 ;; Note, because of the way the return-multiple vop is written, we can
26 ;; assume that we are never called with nvals == 1 and that a0 has already
27 ;; been loaded. ;FIX-lav: look at old hppa , replace comb+addi with addib
28 (inst comb
:<= nvals zero-tn DEFAULT-A0-AND-ON
)
29 (inst addi
(- (fixnumize 2)) nvals count
)
30 (inst comb
:<= count zero-tn DEFAULT-A2-AND-ON
)
31 (inst ldw
(* 1 n-word-bytes
) vals a1
)
32 (inst addib
:<= (- (fixnumize 1)) count DEFAULT-A3-AND-ON
)
33 (inst ldw
(* 2 n-word-bytes
) vals a2
)
34 (inst addib
:<= (- (fixnumize 1)) count DEFAULT-A4-AND-ON
)
35 (inst ldw
(* 3 n-word-bytes
) vals a3
)
36 (inst addib
:<= (- (fixnumize 1)) count DEFAULT-A5-AND-ON
)
37 (inst ldw
(* 4 n-word-bytes
) vals a4
)
38 (inst addib
:<= (- (fixnumize 1)) count done
)
39 (inst ldw
(* 5 n-word-bytes
) vals a5
)
40 ;; Copy the remaining args to the top of the stack.
41 (inst addi
(fixnumize register-arg-count
) vals vals
)
42 (inst addi
(fixnumize register-arg-count
) cfp-tn dst
)
44 (inst ldwm n-word-bytes vals temp
)
45 (inst addib
:<> (- (fixnumize 1)) count LOOP
)
46 (inst stwm temp n-word-bytes dst
)
47 (inst b DONE
:nullify t
)
64 (inst add ocfp-tn nvals csp-tn
)
68 ;;;; tail-call-variable.
70 #+sb-assembling
;; no vop for this one either.
71 (define-assembly-routine
73 (:return-style
:none
))
74 ;; These are really args.
75 ((:temp args any-reg nl0-offset
)
76 (:temp lexenv descriptor-reg lexenv-offset
)
77 ;; We need to compute this
78 (:temp nargs any-reg nargs-offset
)
79 ;; These are needed by the blitting code.
80 (:temp src any-reg nl1-offset
)
81 (:temp dst any-reg nl2-offset
)
82 (:temp count any-reg nl3-offset
)
83 (:temp temp descriptor-reg l0-offset
)
84 ;; These are needed so we can get at the register args.
85 (:temp a0 descriptor-reg a0-offset
)
86 (:temp a1 descriptor-reg a1-offset
)
87 (:temp a2 descriptor-reg a2-offset
)
88 (:temp a3 descriptor-reg a3-offset
)
89 (:temp a4 descriptor-reg a4-offset
)
90 (:temp a5 descriptor-reg a5-offset
))
91 ;; Calculate NARGS (as a fixnum)
92 (inst sub csp-tn args nargs
)
93 ;; Load the argument regs (must do this now, 'cause the blt might
94 ;; trash these locations)
101 ;; Calc SRC, DST, and COUNT
102 (inst addi
(- (fixnumize register-arg-count
)) nargs count
)
103 (inst comb
:<= count zero-tn done
)
104 (inst addi
(fixnumize register-arg-count
) args src
)
105 (inst addi
(fixnumize register-arg-count
) cfp-tn dst
)
107 ;; Copy one arg and increase src
108 (inst ldwm n-word-bytes src temp
)
109 (inst addib
:<> (- (fixnumize 1)) count LOOP
)
110 (inst stwm temp n-word-bytes dst
)
112 ;; We are done. Do the jump.
113 (loadw temp lexenv closure-fun-slot fun-pointer-lowtag
)
117 ;;;; Non-local exit noise.
119 (define-assembly-routine
121 (:translate %continue-unwind
)
122 (:return-style
:none
)
123 (:policy
:fast-safe
))
124 ((:arg block
(any-reg descriptor-reg
) a0-offset
)
125 (:arg start
(any-reg descriptor-reg
) ocfp-offset
)
126 (:arg count
(any-reg descriptor-reg
) nargs-offset
)
127 (:temp lra descriptor-reg lra-offset
)
128 (:temp cur-uwp any-reg nl0-offset
)
129 (:temp next-uwp any-reg nl1-offset
)
130 (:temp target-uwp any-reg nl2-offset
))
131 (declare (ignore start count
))
134 (let ((error (generate-error-code nil
'invalid-unwind-error
)))
135 (inst bc
:= nil block zero-tn error
))
137 (load-symbol-value cur-uwp
*current-unwind-protect-block
*)
138 (loadw target-uwp block unwind-block-uwp-slot
)
139 (inst bc
:<> nil cur-uwp target-uwp DO-UWP
)
144 (loadw cfp-tn cur-uwp unwind-block-cfp-slot
)
145 (loadw code-tn cur-uwp unwind-block-code-slot
)
146 (loadw lra cur-uwp unwind-block-entry-pc-slot
)
147 (lisp-return lra
:frob-code nil
)
150 (loadw next-uwp cur-uwp unwind-block-uwp-slot
)
152 (store-symbol-value next-uwp
*current-unwind-protect-block
*))
154 (define-assembly-routine
156 (:return-style
:none
))
157 ((:arg target descriptor-reg a0-offset
)
158 (:arg start any-reg ocfp-offset
)
159 (:arg count any-reg nargs-offset
)
160 (:temp catch any-reg a1-offset
)
161 (:temp tag descriptor-reg a2-offset
)
162 (:temp fix descriptor-reg nl0-offset
))
163 (declare (ignore start count
)) ; We just need them in the registers.
165 (load-symbol-value catch
*current-catch-block
*)
168 (let ((error (generate-error-code nil
'unseen-throw-tag-error target
)))
169 (inst bc
:= nil catch zero-tn error
))
170 (loadw tag catch catch-block-tag-slot
)
171 (inst comb
:= tag target EXIT
:nullify t
)
173 (loadw catch catch catch-block-previous-catch-slot
)
175 (let ((fixup (make-fixup 'unwind
:assembly-routine
)))
176 (inst ldil fixup fix
)
177 (inst ble fixup lisp-heap-space fix
))
178 (move catch target t
))
181 (define-assembly-routine
182 (return-from-lisp-stub (:return-style
:none
))
183 ((:temp lip interior-reg lip-offset
)
184 (:temp nl0 descriptor-reg nl0-offset
)
185 (:temp nl1 descriptor-reg nl1-offset
)
186 (:temp lra descriptor-reg lra-offset
))
187 ; before calling into lisp we must save our return address (reg_LRA)
188 (store-symbol-value lra
*c-lra
*)
189 ; note the lra we calculate next must "simulate" an fixnum,
190 ; because compute-calling-frame will use fixnump on this value.
191 ; either use 16 or 20, finetune it...
192 (inst addi
19 nl0 lra
) ; then setup the new LRA (rest of this routine after branch)
193 (inst bv lip
:nullify t
)
194 (inst word return-pc-widetag
)
195 ; ok, we are back from the lisp-call, lets return to c
196 ; FIX-lav: steal more stuff from call_into_lisp here, ideally the whole thing
197 (inst move ocfp-tn csp-tn
) ; dont think we should ever get here
199 (load-symbol-value nl0
*c-lra
*)
200 (inst addi
1 nl0 nl0
)
201 (inst ble
0 c-text-space nl0
:nullify t
))