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 do-inits (node block name result lowtag inits args)
36 (let ((unbound-marker-tn nil))
38 (let ((kind (car init))
40 (vop set-slot node block result
44 (lvar-tn node block (pop args)))
47 (setf unbound-marker-tn
48 (let ((tn (make-restricted-tn
50 (sc-number-or-lose 'sb!vm::any-reg))))
51 (vop make-unbound-marker node block tn)
58 (defun do-fixed-alloc (node block name words type lowtag result)
59 (vop fixed-alloc node block name words type lowtag result))
61 (defoptimizer ir2-convert-fixed-allocation
62 ((&rest args) node block name words type lowtag inits)
63 (let* ((lvar (node-lvar node))
64 (locs (lvar-result-tns lvar
65 (list *backend-t-primitive-type*)))
66 (result (first locs)))
67 (do-fixed-alloc node block name words type lowtag result)
68 (do-inits node block name result lowtag inits args)
69 (move-lvar-result node block locs lvar)))
71 (defoptimizer ir2-convert-variable-allocation
72 ((extra &rest args) node block name words type lowtag inits)
73 (let* ((lvar (node-lvar node))
74 (locs (lvar-result-tns lvar
75 (list *backend-t-primitive-type*)))
76 (result (first locs)))
77 (if (constant-lvar-p extra)
78 (let ((words (+ (lvar-value extra) words)))
79 (do-fixed-alloc node block name words type lowtag result))
80 (vop var-alloc node block (lvar-tn node block extra) name words
82 (do-inits node block name result lowtag inits args)
83 (move-lvar-result node block locs lvar)))
85 ;;; :SET-TRANS (in objdef.lisp DEFINE-PRIMITIVE-OBJECT) doesn't quite
86 ;;; cut it for symbols, where under certain compilation options
87 ;;; (e.g. #!+SB-THREAD) we have to do something complicated, rather
88 ;;; than simply set the slot. So we build the IR2 converting function
89 ;;; by hand. -- CSR, 2003-05-08
90 (let ((fun-info (fun-info-or-lose '%set-symbol-value)))
91 (setf (fun-info-ir2-convert fun-info)
93 (let ((args (basic-combination-args node)))
94 (destructuring-bind (symbol value) args
95 (let ((value-tn (lvar-tn node block value)))
97 (lvar-tn node block symbol) value-tn)
99 node block (list value-tn) (node-lvar node))))))))