1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
12 (defoptimizer ir2-convert-reffer ((object) node block name offset lowtag)
13 (let* ((lvar (node-lvar node))
14 (locs (lvar-result-tns lvar
15 (list *backend-t-primitive-type*)))
17 (vop slot node block (lvar-tn node block object)
18 name offset lowtag res)
19 (move-lvar-result node block locs lvar)))
21 (defoptimizer ir2-convert-setter ((object value) node block name offset lowtag)
22 (let ((value-tn (lvar-tn node block value)))
23 (vop set-slot node block (lvar-tn node block object) value-tn
25 (move-lvar-result node block (list value-tn) (node-lvar node))))
27 ;;; FIXME: Isn't there a name for this which looks less like a typo?
28 ;;; (The name IR2-CONVERT-SETTER is used for something else, just above.)
29 (defoptimizer ir2-convert-setfer ((value object) node block name offset lowtag)
30 (let ((value-tn (lvar-tn node block value)))
31 (vop set-slot node block (lvar-tn node block object) value-tn
33 (move-lvar-result node block (list value-tn) (node-lvar node))))
35 (defun emit-inits (node block name result lowtag inits args)
36 (let ((unbound-marker-tn nil)
37 (funcallable-instance-tramp-tn nil))
39 (let ((kind (car init))
41 (vop set-slot node block result
45 (lvar-tn node block (pop args)))
48 (setf unbound-marker-tn
49 (let ((tn (make-restricted-tn
51 (sc-number-or-lose 'sb!vm::any-reg))))
52 (vop make-unbound-marker node block tn)
56 (:funcallable-instance-tramp
57 (or funcallable-instance-tramp-tn
58 (setf funcallable-instance-tramp-tn
59 (let ((tn (make-restricted-tn
61 (sc-number-or-lose 'sb!vm::any-reg))))
62 (vop make-funcallable-instance-tramp node block tn)
67 (defun emit-fixed-alloc (node block name words type lowtag result)
68 (vop fixed-alloc node block name words type lowtag result))
70 (defoptimizer ir2-convert-fixed-allocation
71 ((&rest args) node block name words type lowtag inits)
72 (let* ((lvar (node-lvar node))
73 (locs (lvar-result-tns lvar (list *backend-t-primitive-type*)))
74 (result (first locs)))
75 (emit-fixed-alloc node block name words type lowtag result)
76 (emit-inits node block name result lowtag inits args)
77 (move-lvar-result node block locs lvar)))
79 (defoptimizer ir2-convert-variable-allocation
80 ((extra &rest args) node block name words type lowtag inits)
81 (let* ((lvar (node-lvar node))
82 (locs (lvar-result-tns lvar (list *backend-t-primitive-type*)))
83 (result (first locs)))
84 (if (constant-lvar-p extra)
85 (let ((words (+ (lvar-value extra) words)))
86 (emit-fixed-alloc node block name words type lowtag result))
87 (vop var-alloc node block (lvar-tn node block extra) name words
89 (emit-inits node block name result lowtag inits args)
90 (move-lvar-result node block locs lvar)))
92 ;;; :SET-TRANS (in objdef.lisp DEFINE-PRIMITIVE-OBJECT) doesn't quite
93 ;;; cut it for symbols, where under certain compilation options
94 ;;; (e.g. #!+SB-THREAD) we have to do something complicated, rather
95 ;;; than simply set the slot. So we build the IR2 converting function
96 ;;; by hand. -- CSR, 2003-05-08
97 (let ((fun-info (fun-info-or-lose '%set-symbol-value)))
98 (setf (fun-info-ir2-convert fun-info)
100 (let ((args (basic-combination-args node)))
101 (destructuring-bind (symbol value) args
102 (let ((value-tn (lvar-tn node block value)))
104 (lvar-tn node block symbol) value-tn)
106 node block (list value-tn) (node-lvar node))))))))