Better calls to static functions on x86-64.
[sbcl.git] / src / compiler / x86-64 / macros.lisp
1 ;;;; a bunch of handy macros for x86-64
2
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.
11
12 (in-package "SB!VM")
13
14 ;;;; instruction-like macros
15
16 ;;; This used to be a macro (and still is on the other platforms) but
17 ;;; the support for SC-dependent move instructions needed here makes
18 ;;; that expand into so large an expression that the resulting code
19 ;;; bloat is not justifiable.
20 (defun move (dst src)
21   #!+sb-doc
22   "Move SRC into DST unless they are location=."
23   (unless (location= dst src)
24     (sc-case dst
25       ((single-reg complex-single-reg)
26        (aver (xmm-register-p src))
27        (inst movaps dst src))
28       ((double-reg complex-double-reg)
29        (aver (xmm-register-p src))
30        (inst movapd dst src))
31       #!+sb-simd-pack
32       ((int-sse-reg sse-reg)
33        (aver (xmm-register-p src))
34        (inst movdqa dst src))
35       #!+sb-simd-pack
36       ((single-sse-reg double-sse-reg)
37        (aver (xmm-register-p src))
38        (inst movaps dst src))
39       (t
40        (inst mov dst src)))))
41
42 (defmacro make-ea-for-object-slot (ptr slot lowtag)
43   `(make-ea :qword :base ,ptr :disp (- (* ,slot n-word-bytes) ,lowtag)))
44 (defmacro make-ea-for-object-slot-half (ptr slot lowtag)
45   `(make-ea :dword :base ,ptr :disp (- (* ,slot n-word-bytes) ,lowtag)))
46
47 (defmacro loadw (value ptr &optional (slot 0) (lowtag 0))
48   `(inst mov ,value (make-ea-for-object-slot ,ptr ,slot ,lowtag)))
49
50 (defmacro storew (value ptr &optional (slot 0) (lowtag 0))
51   (once-only ((value value))
52     `(cond ((and (integerp ,value)
53                  (not (typep ,value '(signed-byte 32))))
54             (inst mov temp-reg-tn ,value)
55             (inst mov (make-ea-for-object-slot ,ptr ,slot ,lowtag) temp-reg-tn))
56            (t
57             (inst mov (make-ea-for-object-slot ,ptr ,slot ,lowtag) ,value)))))
58
59 (defmacro pushw (ptr &optional (slot 0) (lowtag 0))
60   `(inst push (make-ea-for-object-slot ,ptr ,slot ,lowtag)))
61
62 (defmacro popw (ptr &optional (slot 0) (lowtag 0))
63   `(inst pop (make-ea-for-object-slot ,ptr ,slot ,lowtag)))
64
65 (defun call-indirect (offset)
66   (let ((ea (make-ea :qword :disp offset)))
67    (cond ((immediate32-p offset)
68           (inst call ea))
69          (t
70           (inst mov temp-reg-tn ea)
71           (inst call temp-reg-tn)))))
72 \f
73 ;;;; macros to generate useful values
74
75 (defmacro load-symbol (reg symbol)
76   `(inst mov ,reg (+ nil-value (static-symbol-offset ,symbol))))
77
78 (defmacro make-ea-for-symbol-value (symbol)
79   `(make-ea :qword
80     :disp (+ nil-value
81            (static-symbol-offset ',symbol)
82            (ash symbol-value-slot word-shift)
83            (- other-pointer-lowtag))))
84
85 (defmacro load-symbol-value (reg symbol)
86   `(inst mov ,reg (make-ea-for-symbol-value ,symbol)))
87
88 (defmacro store-symbol-value (reg symbol)
89   `(inst mov (make-ea-for-symbol-value ,symbol) ,reg))
90
91 #!+sb-thread
92 (defmacro make-ea-for-symbol-tls-index (symbol)
93   `(make-ea :qword
94     :disp (+ nil-value
95            (static-symbol-offset ',symbol)
96            (ash symbol-tls-index-slot word-shift)
97            (- other-pointer-lowtag))))
98
99 #!+sb-thread
100 (defmacro load-tl-symbol-value (reg symbol)
101   `(progn
102     (inst mov ,reg (make-ea-for-symbol-tls-index ,symbol))
103     (inst mov ,reg (make-ea :qword :base thread-base-tn :scale 1 :index ,reg))))
104 #!-sb-thread
105 (defmacro load-tl-symbol-value (reg symbol) `(load-symbol-value ,reg ,symbol))
106
107 #!+sb-thread
108 (defmacro store-tl-symbol-value (reg symbol temp)
109   `(progn
110     (inst mov ,temp (make-ea-for-symbol-tls-index ,symbol))
111     (inst mov (make-ea :qword :base thread-base-tn :scale 1 :index ,temp) ,reg)))
112 #!-sb-thread
113 (defmacro store-tl-symbol-value (reg symbol temp)
114   (declare (ignore temp))
115   `(store-symbol-value ,reg ,symbol))
116
117 (defmacro load-binding-stack-pointer (reg)
118   #!+sb-thread
119   `(inst mov ,reg (make-ea :qword :base thread-base-tn
120                    :disp (* n-word-bytes thread-binding-stack-pointer-slot)))
121   #!-sb-thread
122   `(load-symbol-value ,reg *binding-stack-pointer*))
123
124 (defmacro store-binding-stack-pointer (reg)
125   #!+sb-thread
126   `(inst mov (make-ea :qword :base thread-base-tn
127               :disp (* n-word-bytes thread-binding-stack-pointer-slot))
128     ,reg)
129   #!-sb-thread
130   `(store-symbol-value ,reg *binding-stack-pointer*))
131
132 (defmacro load-type (target source &optional (offset 0))
133   #!+sb-doc
134   "Loads the type bits of a pointer into target independent of
135    byte-ordering issues."
136   (once-only ((n-target target)
137               (n-source source)
138               (n-offset offset))
139     (ecase *backend-byte-order*
140       (:little-endian
141        `(inst movzx ,n-target
142               (make-ea :byte :base ,n-source :disp ,n-offset)))
143       (:big-endian
144        `(inst movzx ,n-target
145               (make-ea :byte :base ,n-source
146                              :disp (+ ,n-offset (1- n-word-bytes))))))))
147 \f
148 ;;;; allocation helpers
149
150 ;;; All allocation is done by calls to assembler routines that
151 ;;; eventually invoke the C alloc() function.
152
153 ;;; Emit code to allocate an object with a size in bytes given by
154 ;;; Size. The size may be an integer of a TN. If Inline is a VOP
155 ;;; node-var then it is used to make an appropriate speed vs size
156 ;;; decision.
157
158 (defun allocation-dynamic-extent (alloc-tn size lowtag)
159   (inst sub rsp-tn size)
160   ;; see comment in x86/macros.lisp implementation of this
161   (inst and rsp-tn #.(lognot lowtag-mask))
162   (aver (not (location= alloc-tn rsp-tn)))
163   (inst lea alloc-tn (make-ea :byte :base rsp-tn :disp lowtag))
164   (values))
165
166 ;;; This macro should only be used inside a pseudo-atomic section,
167 ;;; which should also cover subsequent initialization of the
168 ;;; object.
169 (defun allocation-tramp (alloc-tn size lowtag)
170   (inst push size)
171   (inst lea temp-reg-tn (make-ea :qword
172                             :disp (make-fixup "alloc_tramp" :foreign)))
173   (inst call temp-reg-tn)
174   (inst pop alloc-tn)
175   (when lowtag
176     (inst lea alloc-tn (make-ea :byte :base alloc-tn :disp lowtag)))
177   (values))
178
179 (defun allocation (alloc-tn size &optional ignored dynamic-extent lowtag)
180   (declare (ignore ignored))
181   (when dynamic-extent
182     (allocation-dynamic-extent alloc-tn size lowtag)
183     (return-from allocation (values)))
184   (let ((NOT-INLINE (gen-label))
185         (DONE (gen-label))
186         ;; Yuck.
187         (in-elsewhere (eq *elsewhere* sb!assem::**current-segment**))
188         ;; thread->alloc_region.free_pointer
189         (free-pointer
190          #!+sb-thread
191          (make-ea :qword
192                   :base thread-base-tn :scale 1
193                   :disp (* n-word-bytes thread-alloc-region-slot))
194          #!-sb-thread
195          (make-ea :qword
196                   :scale 1 :disp
197                   (make-fixup "boxed_region" :foreign)))
198         ;; thread->alloc_region.end_addr
199         (end-addr
200          #!+sb-thread
201          (make-ea :qword
202                   :base thread-base-tn :scale 1
203                   :disp (* n-word-bytes (1+ thread-alloc-region-slot)))
204          #!-sb-thread
205          (make-ea :qword
206                   :scale 1 :disp
207                   (make-fixup "boxed_region" :foreign 8))))
208     (cond (in-elsewhere
209            (allocation-tramp alloc-tn size lowtag))
210           (t
211            (inst mov temp-reg-tn free-pointer)
212            (if (tn-p size)
213                (if (location= alloc-tn size)
214                    (inst add alloc-tn temp-reg-tn)
215                    (inst lea alloc-tn
216                          (make-ea :qword :base temp-reg-tn :index size)))
217                (inst lea alloc-tn
218                      (make-ea :qword :base temp-reg-tn :disp size)))
219            (inst cmp end-addr alloc-tn)
220            (inst jmp :be NOT-INLINE)
221            (inst mov free-pointer alloc-tn)
222            (if lowtag
223                (inst lea alloc-tn (make-ea :byte :base temp-reg-tn :disp lowtag))
224                (inst mov alloc-tn temp-reg-tn))
225            (emit-label DONE)
226            (assemble (*elsewhere*)
227              (emit-label NOT-INLINE)
228              (cond ((numberp size)
229                     (allocation-tramp alloc-tn size lowtag))
230                    (t
231                     (inst sub alloc-tn free-pointer)
232                     (allocation-tramp alloc-tn alloc-tn lowtag)))
233              (inst jmp DONE))))
234     (values)))
235
236 ;;; Allocate an other-pointer object of fixed SIZE with a single word
237 ;;; header having the specified WIDETAG value. The result is placed in
238 ;;; RESULT-TN.
239 (defmacro with-fixed-allocation ((result-tn widetag size &optional inline stack-allocate-p)
240                                  &body forms)
241   (unless forms
242     (bug "empty &body in WITH-FIXED-ALLOCATION"))
243   (once-only ((result-tn result-tn) (size size) (stack-allocate-p stack-allocate-p))
244     `(maybe-pseudo-atomic ,stack-allocate-p
245       (allocation ,result-tn (pad-data-block ,size) ,inline ,stack-allocate-p
246                   other-pointer-lowtag)
247       (storew (logior (ash (1- ,size) n-widetag-bits) ,widetag)
248               ,result-tn 0 other-pointer-lowtag)
249       ,@forms)))
250 \f
251 ;;;; error code
252 (defun emit-error-break (vop kind code values)
253   (assemble ()
254     #!-ud2-breakpoints
255     (inst int 3)                  ; i386 breakpoint instruction
256     ;; On Darwin, we need to use #x0b0f instead of int3 in order
257     ;; to generate a SIGILL instead of a SIGTRAP as darwin/x86
258     ;; doesn't seem to be reliably firing SIGTRAP
259     ;; handlers. Hopefully this will be fixed by Apple at a
260     ;; later date. Do the same on x86-64 as we do on x86 until this gets
261     ;; sorted out.
262     #!+ud2-breakpoints
263     (inst word #x0b0f)
264     ;; The return PC points here; note the location for the debugger.
265     (when vop
266       (note-this-location vop :internal-error))
267     (inst byte kind)                       ; eg trap_Xyyy
268     (with-adjustable-vector (vector)       ; interr arguments
269       (write-var-integer code vector)
270       (dolist (tn values)
271         ;; classic CMU CL comment:
272         ;;   zzzzz jrd here. tn-offset is zero for constant
273         ;;   tns.
274         (write-var-integer (make-sc-offset (sc-number (tn-sc tn))
275                                            (or (tn-offset tn) 0))
276                            vector))
277       (inst byte (length vector))
278       (dotimes (i (length vector))
279         (inst byte (aref vector i))))))
280
281 (defun error-call (vop error-code &rest values)
282   #!+sb-doc
283   "Cause an error. ERROR-CODE is the error to cause."
284   (emit-error-break vop error-trap (error-number-or-lose error-code) values))
285
286 (defun generate-error-code (vop error-code &rest values)
287   #!+sb-doc
288   "Generate-Error-Code Error-code Value*
289   Emit code for an error with the specified Error-Code and context Values."
290   (assemble (*elsewhere*)
291     (let ((start-lab (gen-label)))
292       (emit-label start-lab)
293       (emit-error-break vop error-trap (error-number-or-lose error-code) values)
294        start-lab)))
295
296 \f
297 ;;;; PSEUDO-ATOMIC
298
299 ;;; This is used to wrap operations which leave untagged memory lying
300 ;;; around.  It's an operation which the AOP weenies would describe as
301 ;;; having "cross-cutting concerns", meaning it appears all over the
302 ;;; place and there's no logical single place to attach documentation.
303 ;;; grep (mostly in src/runtime) is your friend
304
305 (defmacro maybe-pseudo-atomic (not-really-p &body body)
306   `(if ,not-really-p
307        (progn ,@body)
308        (pseudo-atomic ,@body)))
309
310 ;;; Unsafely clear pa flags so that the image can properly lose in a
311 ;;; pa section.
312 #!+sb-thread
313 (defmacro %clear-pseudo-atomic ()
314   '(inst mov (make-ea :qword :base thread-base-tn
315               :disp (* n-word-bytes thread-pseudo-atomic-bits-slot))
316     0))
317
318 #!+sb-safepoint
319 (defun emit-safepoint ()
320   (inst test al-tn (make-ea :byte :disp sb!vm::gc-safepoint-page-addr)))
321
322 #!+sb-thread
323 (defmacro pseudo-atomic (&rest forms)
324   #!+sb-safepoint-strictly
325   `(progn ,@forms (emit-safepoint))
326   #!-sb-safepoint-strictly
327   (with-unique-names (label)
328     `(let ((,label (gen-label)))
329        (inst mov (make-ea :qword
330                           :base thread-base-tn
331                           :disp (* n-word-bytes thread-pseudo-atomic-bits-slot))
332              rbp-tn)
333        ,@forms
334        (inst xor (make-ea :qword
335                           :base thread-base-tn
336                           :disp (* n-word-bytes thread-pseudo-atomic-bits-slot))
337              rbp-tn)
338        (inst jmp :z ,label)
339        ;; if PAI was set, interrupts were disabled at the same time
340        ;; using the process signal mask.
341        (inst break pending-interrupt-trap)
342        (emit-label ,label)
343        #!+sb-safepoint
344        ;; In this case, when allocation thinks a GC should be done, it
345        ;; does not mark PA as interrupted, but schedules a safepoint
346        ;; trap instead.  Let's take the opportunity to trigger that
347        ;; safepoint right now.
348        (emit-safepoint))))
349
350
351 #!-sb-thread
352 (defmacro pseudo-atomic (&rest forms)
353   (with-unique-names (label)
354     `(let ((,label (gen-label)))
355        ;; FIXME: The MAKE-EA noise should become a MACROLET macro or
356        ;; something. (perhaps SVLB, for static variable low byte)
357        (inst mov (make-ea :qword :disp (+ nil-value
358                                           (static-symbol-offset
359                                            '*pseudo-atomic-bits*)
360                                           (ash symbol-value-slot word-shift)
361                                           (- other-pointer-lowtag)))
362              rbp-tn)
363        ,@forms
364        (inst xor (make-ea :qword :disp (+ nil-value
365                                           (static-symbol-offset
366                                            '*pseudo-atomic-bits*)
367                                           (ash symbol-value-slot word-shift)
368                                           (- other-pointer-lowtag)))
369              rbp-tn)
370        (inst jmp :z ,label)
371        ;; if PAI was set, interrupts were disabled at the same time
372        ;; using the process signal mask.
373        (inst break pending-interrupt-trap)
374        (emit-label ,label))))
375 \f
376 ;;;; indexed references
377
378 (defmacro define-full-compare-and-swap
379     (name type offset lowtag scs el-type &optional translate)
380   `(progn
381      (define-vop (,name)
382          ,@(when translate `((:translate ,translate)))
383        (:policy :fast-safe)
384        (:args (object :scs (descriptor-reg) :to :eval)
385               (index :scs (any-reg) :to :result)
386               (old-value :scs ,scs :target rax)
387               (new-value :scs ,scs))
388        (:arg-types ,type tagged-num ,el-type ,el-type)
389        (:temporary (:sc descriptor-reg :offset rax-offset
390                         :from (:argument 2) :to :result :target value)  rax)
391        (:results (value :scs ,scs))
392        (:result-types ,el-type)
393        (:generator 5
394          (move rax old-value)
395          (inst cmpxchg (make-ea :qword :base object :index index
396                                 :scale (ash 1 (- word-shift n-fixnum-tag-bits))
397                                 :disp (- (* ,offset n-word-bytes) ,lowtag))
398                new-value :lock)
399          (move value rax)))))
400
401 (defmacro define-full-reffer (name type offset lowtag scs el-type &optional translate)
402   `(progn
403      (define-vop (,name)
404        ,@(when translate
405            `((:translate ,translate)))
406        (:policy :fast-safe)
407        (:args (object :scs (descriptor-reg))
408               (index :scs (any-reg)))
409        (:arg-types ,type tagged-num)
410        (:results (value :scs ,scs))
411        (:result-types ,el-type)
412        (:generator 3                    ; pw was 5
413          (inst mov value (make-ea :qword :base object :index index
414                                   :scale (ash 1 (- word-shift n-fixnum-tag-bits))
415                                   :disp (- (* ,offset n-word-bytes)
416                                            ,lowtag)))))
417      (define-vop (,(symbolicate name "-C"))
418        ,@(when translate
419            `((:translate ,translate)))
420        (:policy :fast-safe)
421        (:args (object :scs (descriptor-reg)))
422        (:info index)
423        (:arg-types ,type
424                    (:constant (load/store-index ,n-word-bytes ,(eval lowtag)
425                                                 ,(eval offset))))
426        (:results (value :scs ,scs))
427        (:result-types ,el-type)
428        (:generator 2                    ; pw was 5
429          (inst mov value (make-ea :qword :base object
430                                   :disp (- (* (+ ,offset index) n-word-bytes)
431                                            ,lowtag)))))))
432
433 (defmacro define-full-reffer+offset (name type offset lowtag scs el-type &optional translate)
434   `(progn
435      (define-vop (,name)
436        ,@(when translate
437            `((:translate ,translate)))
438        (:policy :fast-safe)
439        (:args (object :scs (descriptor-reg))
440               (index :scs (any-reg)))
441        (:info offset)
442        (:arg-types ,type tagged-num
443                    (:constant (constant-displacement other-pointer-lowtag
444                                                      n-word-bytes vector-data-offset)))
445        (:results (value :scs ,scs))
446        (:result-types ,el-type)
447        (:generator 3                    ; pw was 5
448          (inst mov value (make-ea :qword :base object :index index
449                                   :scale (ash 1 (- word-shift n-fixnum-tag-bits))
450                                   :disp (- (* (+ ,offset offset) n-word-bytes)
451                                            ,lowtag)))))
452      (define-vop (,(symbolicate name "-C"))
453        ,@(when translate
454            `((:translate ,translate)))
455        (:policy :fast-safe)
456        (:args (object :scs (descriptor-reg)))
457        (:info index offset)
458        (:arg-types ,type
459                    (:constant (load/store-index ,n-word-bytes ,(eval lowtag)
460                                                 ,(eval offset)))
461                    (:constant (constant-displacement other-pointer-lowtag
462                                                      n-word-bytes vector-data-offset)))
463        (:results (value :scs ,scs))
464        (:result-types ,el-type)
465        (:generator 2                    ; pw was 5
466          (inst mov value (make-ea :qword :base object
467                                   :disp (- (* (+ ,offset index offset) n-word-bytes)
468                                            ,lowtag)))))))
469
470 (defmacro define-full-setter (name type offset lowtag scs el-type &optional translate)
471   `(progn
472      (define-vop (,name)
473        ,@(when translate
474            `((:translate ,translate)))
475        (:policy :fast-safe)
476        (:args (object :scs (descriptor-reg))
477               (index :scs (any-reg))
478               (value :scs ,scs :target result))
479        (:arg-types ,type tagged-num ,el-type)
480        (:results (result :scs ,scs))
481        (:result-types ,el-type)
482        (:generator 4                    ; was 5
483          (inst mov (make-ea :qword :base object :index index
484                             :scale (ash 1 (- word-shift n-fixnum-tag-bits))
485                             :disp (- (* ,offset n-word-bytes) ,lowtag))
486                value)
487          (move result value)))
488      (define-vop (,(symbolicate name "-C"))
489        ,@(when translate
490            `((:translate ,translate)))
491        (:policy :fast-safe)
492        (:args (object :scs (descriptor-reg))
493               (value :scs ,scs :target result))
494        (:info index)
495        (:arg-types ,type
496                    (:constant (load/store-index ,n-word-bytes ,(eval lowtag)
497                                                 ,(eval offset)))
498                    ,el-type)
499        (:results (result :scs ,scs))
500        (:result-types ,el-type)
501        (:generator 3                    ; was 5
502          (inst mov (make-ea :qword :base object
503                             :disp (- (* (+ ,offset index) n-word-bytes)
504                                      ,lowtag))
505                value)
506          (move result value)))))
507
508 (defmacro define-full-setter+offset (name type offset lowtag scs el-type &optional translate)
509   `(progn
510      (define-vop (,name)
511        ,@(when translate
512            `((:translate ,translate)))
513        (:policy :fast-safe)
514        (:args (object :scs (descriptor-reg))
515               (index :scs (any-reg))
516               (value :scs ,scs :target result))
517        (:info offset)
518        (:arg-types ,type tagged-num
519                    (:constant (constant-displacement other-pointer-lowtag
520                                                      n-word-bytes
521                                                      vector-data-offset))
522                    ,el-type)
523        (:results (result :scs ,scs))
524        (:result-types ,el-type)
525        (:generator 4                    ; was 5
526          (inst mov (make-ea :qword :base object :index index
527                             :scale (ash 1 (- word-shift n-fixnum-tag-bits))
528                             :disp (- (* (+ ,offset offset) n-word-bytes) ,lowtag))
529                value)
530          (move result value)))
531      (define-vop (,(symbolicate name "-C"))
532        ,@(when translate
533            `((:translate ,translate)))
534        (:policy :fast-safe)
535        (:args (object :scs (descriptor-reg))
536               (value :scs ,scs :target result))
537        (:info index offset)
538        (:arg-types ,type
539                    (:constant (load/store-index ,n-word-bytes ,(eval lowtag)
540                                                 ,(eval offset)))
541                    (:constant (constant-displacement other-pointer-lowtag
542                                                      n-word-bytes
543                                                      vector-data-offset))
544                    ,el-type)
545        (:results (result :scs ,scs))
546        (:result-types ,el-type)
547        (:generator 3                    ; was 5
548          (inst mov (make-ea :qword :base object
549                             :disp (- (* (+ ,offset index offset) n-word-bytes)
550                                      ,lowtag))
551                value)
552          (move result value)))))
553
554 ;;; helper for alien stuff.
555
556 (def!macro with-pinned-objects ((&rest objects) &body body)
557   "Arrange with the garbage collector that the pages occupied by
558 OBJECTS will not be moved in memory for the duration of BODY.
559 Useful for e.g. foreign calls where another thread may trigger
560 collection."
561   (if objects
562       (let ((pins (make-gensym-list (length objects)))
563             (wpo (sb!xc:gensym "WITH-PINNED-OBJECTS-THUNK")))
564         ;; BODY is stuffed in a function to preserve the lexical
565         ;; environment.
566         `(flet ((,wpo () (progn ,@body)))
567            (declare (muffle-conditions compiler-note))
568            ;; PINS are dx-allocated in case the compiler for some
569            ;; unfathomable reason decides to allocate value-cells
570            ;; for them -- since we have DX value-cells on x86oid
571            ;; platforms this still forces them on the stack.
572            (dx-let ,(mapcar #'list pins objects)
573              (multiple-value-prog1 (,wpo)
574                ;; TOUCH-OBJECT has a VOP with an empty body: compiler
575                ;; thinks we're using the argument and doesn't flush
576                ;; the variable, but we don't have to pay any extra
577                ;; beyond that -- and MULTIPLE-VALUE-PROG1 keeps them
578                ;; live till the body has finished. *whew*
579                ,@(mapcar (lambda (pin)
580                            `(touch-object ,pin))
581                          pins)))))
582       `(progn ,@body)))