1 ;;;; the sparc implementation of unknown-values VOPs
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)))
20 ;;; Push some values onto the stack, returning the start and number of
21 ;;; values pushed as results. It is assumed that the Vals are wired
22 ;;; to the standard argument locations. Nvals is the number of values
25 ;;; The generator cost is pseudo-random. We could get it right by
26 ;;; defining a bogus SC that reflects the costs of the
27 ;;; memory-to-memory moves for each operand, but this seems
29 (define-vop (push-values)
30 (:args (vals :more t))
31 (:results (start :scs (any-reg) :from :load)
32 (count :scs (any-reg)))
34 (:temporary (:scs (descriptor-reg)) temp)
36 (inst move start csp-tn)
37 (inst add csp-tn csp-tn (* nvals n-word-bytes))
38 (do ((val vals (tn-ref-across val))
41 (let ((tn (tn-ref-tn val)))
46 (load-stack-tn temp tn)
47 (storew temp start i)))))
48 (inst li count (fixnumize nvals))))
50 ;;; Push a list of values on the stack, returning Start and Count as
51 ;;; used in unknown values continuations.
52 (define-vop (values-list)
53 (:args (arg :scs (descriptor-reg) :target list))
56 (:results (start :scs (any-reg))
57 (count :scs (any-reg)))
58 (:temporary (:scs (descriptor-reg) :type list :from (:argument 0)) list)
59 (:temporary (:scs (descriptor-reg)) temp)
60 (:temporary (:scs (non-descriptor-reg)) ndescr)
62 (:save-p :compute-only)
64 (let ((loop (gen-label))
71 (inst cmp list null-tn)
73 (loadw temp list cons-car-slot list-pointer-lowtag)
74 (loadw list list cons-cdr-slot list-pointer-lowtag)
75 (inst add csp-tn csp-tn n-word-bytes)
76 (storew temp csp-tn -1)
77 (test-type list loop nil (list-pointer-lowtag) :temp ndescr)
78 (error-call vop bogus-arg-to-values-list-error list)
81 (inst sub count csp-tn start))))
85 ;;; Copy the more arg block to the top of the stack so we can use them
86 ;;; as function arguments.
87 (define-vop (%more-arg-values)
88 (:args (context :scs (descriptor-reg any-reg) :target src)
89 (skip :scs (any-reg zero immediate))
90 (num :scs (any-reg) :target count))
91 (:arg-types * positive-fixnum positive-fixnum)
92 (:temporary (:sc any-reg :from (:argument 0)) src)
93 (:temporary (:sc any-reg :from (:argument 2)) dst)
94 (:temporary (:sc descriptor-reg :from (:argument 1)) temp)
95 (:temporary (:sc any-reg) i)
96 (:results (start :scs (any-reg))
97 (count :scs (any-reg)))
103 (inst add src context (* (tn-value skip) n-word-bytes)))
105 (inst add src context skip)))
106 (inst orcc count zero-tn num)
108 (inst move start csp-tn)
109 (inst move dst csp-tn)
110 (inst add csp-tn count)