3 (define-vop (reset-stack-pointer)
4 (:args (ptr :scs (any-reg)))
9 ;;; Push some values onto the stack, returning the start and number of values
10 ;;; pushed as results. It is assumed that the Vals are wired to the standard
11 ;;; argument locations. Nvals is the number of values to push.
13 ;;; The generator cost is pseudo-random. We could get it right by defining a
14 ;;; bogus SC that reflects the costs of the memory-to-memory moves for each
15 ;;; operand, but this seems unworthwhile.
17 (define-vop (push-values)
20 (:results (start :scs (any-reg) :from :load)
21 (count :scs (any-reg)))
23 (:temporary (:scs (descriptor-reg)) temp)
26 (inst addi (* nvals n-word-bytes) csp-tn csp-tn)
27 (do ((val vals (tn-ref-across val))
30 (let ((tn (tn-ref-tn val)))
35 (load-stack-tn temp tn)
36 (storew temp start i)))))
37 (inst li (fixnumize nvals) count)))
40 ;;; Push a list of values on the stack, returning Start and Count as used in
41 ;;; unknown values continuations.
43 (define-vop (values-list)
44 (:args (arg :scs (descriptor-reg) :target list))
47 (:results (start :scs (any-reg))
48 (count :scs (any-reg)))
49 (:temporary (:scs (descriptor-reg) :type list :from (:argument 0)) list)
50 (:temporary (:scs (descriptor-reg)) temp)
51 (:temporary (:scs (non-descriptor-reg) :type random) ndescr)
53 (:save-p :compute-only)
56 (inst comb := list null-tn done)
60 (loadw temp list cons-car-slot list-pointer-lowtag)
61 (loadw list list cons-cdr-slot list-pointer-lowtag)
62 (inst addi n-word-bytes csp-tn csp-tn)
63 (storew temp csp-tn -1)
64 (inst extru list 31 n-lowtag-bits ndescr)
65 (inst comib := list-pointer-lowtag ndescr loop)
66 (inst comb := list null-tn done :nullify t)
67 (error-call vop bogus-arg-to-values-list-error list)
70 (inst sub csp-tn start count)))
73 ;;; Copy the more arg block to the top of the stack so we can use them
74 ;;; as function arguments.
76 (define-vop (%more-arg-values)
77 (:args (context :scs (descriptor-reg any-reg) :target src)
78 (skip :scs (any-reg zero immediate))
79 (num :scs (any-reg) :target count))
80 (:temporary (:sc any-reg :from (:argument 0)) src)
81 (:temporary (:sc any-reg :from (:argument 1)) dst end)
82 (:temporary (:sc descriptor-reg :from (:argument 1)) temp)
83 (:results (start :scs (any-reg))
84 (count :scs (any-reg)))
90 (inst addi (* (tn-value skip) n-word-bytes) context src))
92 (inst add skip context src)))
94 (inst comb := num zero-tn done)
95 (inst move csp-tn start)
96 (inst move csp-tn dst)
97 (inst add csp-tn count csp-tn)
98 (inst addi (- n-word-bytes) csp-tn end)
100 (inst ldwm 4 src temp)
101 (inst comb :< dst end loop)
102 (inst stwm temp 4 dst)