1 ;;;; unknown-values VOPs for the ARM VM
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.
14 (define-vop (reset-stack-pointer)
15 (:args
(ptr :scs
(any-reg)))
19 ;;; Push some values onto the stack, returning the start and number of values
20 ;;; pushed as results. It is assumed that the Vals are wired to the standard
21 ;;; argument locations. Nvals is the number of values to push.
23 ;;; The generator cost is pseudo-random. We could get it right by defining a
24 ;;; bogus SC that reflects the costs of the memory-to-memory moves for each
25 ;;; operand, but this seems unworthwhile.
27 (define-vop (push-values)
28 (:args
(vals :more t
))
29 (:results
(start :scs
(any-reg) :from
:load
)
30 (count :scs
(any-reg)))
32 (:temporary
(:scs
(descriptor-reg)) temp
)
34 (inst mov start csp-tn
)
35 (inst add csp-tn csp-tn
(* nvals n-word-bytes
))
36 (do ((val vals
(tn-ref-across val
))
39 (let ((tn (tn-ref-tn val
)))
44 (load-stack-tn temp tn
)
45 (storew temp start i
)))))
46 (inst mov count
(fixnumize nvals
))))
48 ;;; Push a list of values on the stack, returning Start and Count as used in
49 ;;; unknown values continuations.
51 (define-vop (values-list)
52 (:args
(arg :scs
(descriptor-reg) :target list
))
55 (:results
(start :scs
(any-reg))
56 (count :scs
(any-reg)))
57 (:temporary
(:scs
(descriptor-reg) :type list
:from
(:argument
0)) list
)
58 (:temporary
(:scs
(descriptor-reg)) temp
)
59 (:temporary
(:scs
(non-descriptor-reg)) ndescr
)
61 (:save-p
:compute-only
)
67 (inst cmp list null-tn
)
68 (loadw temp list cons-car-slot list-pointer-lowtag
)
70 (loadw list list cons-cdr-slot list-pointer-lowtag
)
71 (inst add csp-tn csp-tn n-word-bytes
)
72 (storew temp csp-tn -
1)
73 (test-type list LOOP nil
(list-pointer-lowtag) :temp ndescr
)
74 (error-call vop
'bogus-arg-to-values-list-error list
)
77 (inst sub count csp-tn start
)))
80 ;;; Copy the more arg block to the top of the stack so we can use them
81 ;;; as function arguments.
83 (define-vop (%more-arg-values
)
84 (:args
(context :scs
(descriptor-reg any-reg
) :target src
)
85 (skip :scs
(any-reg immediate
))
86 (num :scs
(any-reg) :target count
))
87 (:arg-types
* positive-fixnum positive-fixnum
)
88 (:temporary
(:sc any-reg
:from
(:argument
0)) src
)
89 (:temporary
(:sc any-reg
:from
(:argument
2)) dst
)
90 (:temporary
(:sc descriptor-reg
:from
(:argument
1)) temp
)
91 (:temporary
(:sc any-reg
) i
)
92 (:results
(start :scs
(any-reg))
93 (count :scs
(any-reg)))
97 (inst add src context
(* (tn-value skip
) n-word-bytes
)))
99 (inst add src context skip
)))
100 (inst adds count num
0)
101 (inst mov start csp-tn
)
103 (inst mov dst csp-tn
)
104 (inst add csp-tn csp-tn count
)
109 (inst ldr temp
(@ src i
))
110 (inst str temp
(@ dst i
))