Don't require an OCFP register to emit breakpoint traps.
[sbcl/nyef.git] / src / compiler / arm / values.lisp
blobf5b3dda7b51cdda29cca9f4f06e1eda0873aa355
1 ;;;; unknown-values VOPs for the ARM VM
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
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.
12 (in-package "SB!VM")
14 (define-vop (reset-stack-pointer)
15 (:args (ptr :scs (any-reg)))
16 (:generator 1
17 (move csp-tn ptr)))
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.
22 ;;;
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.
26 ;;;
27 (define-vop (push-values)
28 (:args (vals :more t))
29 (:results (start :scs (any-reg) :from :load)
30 (count :scs (any-reg)))
31 (:info nvals)
32 (:temporary (:scs (descriptor-reg)) temp)
33 (:generator 20
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))
37 (i 0 (1+ i)))
38 ((null val))
39 (let ((tn (tn-ref-tn val)))
40 (sc-case tn
41 (descriptor-reg
42 (storew tn start i))
43 (control-stack
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.
50 ;;;
51 (define-vop (values-list)
52 (:args (arg :scs (descriptor-reg) :target list))
53 (:arg-types list)
54 (:policy :fast-safe)
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)
60 (:vop-var vop)
61 (:save-p :compute-only)
62 (:generator 0
63 (move list arg)
64 (move start csp-tn)
66 LOOP
67 (inst cmp list null-tn)
68 (loadw temp list cons-car-slot list-pointer-lowtag)
69 (inst b :eq DONE)
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)
76 DONE
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.
82 ;;;
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)))
94 (:generator 20
95 (sc-case skip
96 (immediate
97 (inst add src context (* (tn-value skip) n-word-bytes)))
98 (any-reg
99 (inst add src context skip)))
100 (inst adds count num 0)
101 (inst mov start csp-tn)
102 (inst b :eq DONE)
103 (inst mov dst csp-tn)
104 (inst add csp-tn csp-tn count)
105 (inst mov i count)
106 LOOP
107 (inst cmp i 4)
108 (inst sub i i 4)
109 (inst ldr temp (@ src i))
110 (inst str temp (@ dst i))
111 (inst b :ne LOOP)
112 DONE))