;;;; Symbol hacking VOPs:
;;; The compiler likes to be able to directly SET symbols.
-(define-vop (set cell-set)
+(define-vop (%set-symbol-global-value cell-set)
(:variant symbol-value-slot other-pointer-lowtag))
;;; Do a cell ref with an error check for being unbound.
;;; With SYMBOL-VALUE, we check that the value isn't the trap object.
;;; So SYMBOL-VALUE of NIL is NIL.
-(define-vop (symbol-value checked-cell-ref)
- (:translate symbol-value)
+(define-vop (symbol-global-value checked-cell-ref)
+ (:translate symbol-global-value)
(:generator 9
(move obj-temp object)
(loadw value obj-temp symbol-value-slot other-pointer-lowtag)
(inst cmpwi value unbound-marker-widetag)
(inst beq err-lab))))
+(define-vop (fast-symbol-global-value cell-ref)
+ (:variant symbol-value-slot other-pointer-lowtag)
+ (:policy :fast)
+ (:translate symbol-global-value))
+
+#!+sb-thread
+(progn
+ (define-vop (set)
+ (:args (symbol :scs (descriptor-reg))
+ (value :scs (descriptor-reg any-reg)))
+ (:temporary (:sc any-reg) tls-slot temp)
+ (:generator 4
+ (loadw tls-slot symbol symbol-tls-index-slot other-pointer-lowtag)
+ (inst lwzx temp thread-base-tn tls-slot)
+ (inst cmpwi temp no-tls-value-marker-widetag)
+ (inst beq GLOBAL-VALUE)
+ (inst stwx value thread-base-tn tls-slot)
+ (inst b DONE)
+ GLOBAL-VALUE
+ (storew value symbol symbol-value-slot other-pointer-lowtag)
+ DONE))
+
+ ;; With Symbol-Value, we check that the value isn't the trap object. So
+ ;; Symbol-Value of NIL is NIL.
+ (define-vop (symbol-value)
+ (:translate symbol-value)
+ (:policy :fast-safe)
+ (:args (object :scs (descriptor-reg) :to (:result 1)))
+ (:results (value :scs (descriptor-reg any-reg)))
+ (:vop-var vop)
+ (:save-p :compute-only)
+ (:generator 9
+ (loadw value object symbol-tls-index-slot other-pointer-lowtag)
+ (inst lwzx value thread-base-tn value)
+ (inst cmpwi value no-tls-value-marker-widetag)
+ (inst bne CHECK-UNBOUND)
+ (loadw value object symbol-value-slot other-pointer-lowtag)
+ CHECK-UNBOUND
+ (inst cmpwi value unbound-marker-widetag)
+ (inst beq (generate-error-code vop 'unbound-symbol-error object))))
+
+ (define-vop (fast-symbol-value symbol-value)
+ ;; KLUDGE: not really fast, in fact, because we're going to have to
+ ;; do a full lookup of the thread-local area anyway. But half of
+ ;; the meaning of FAST-SYMBOL-VALUE is "do not signal an error if
+ ;; unbound", which is used in the implementation of COPY-SYMBOL. --
+ ;; CSR, 2003-04-22
+ (:policy :fast)
+ (:translate symbol-value)
+ (:generator 8
+ (loadw value object symbol-tls-index-slot other-pointer-lowtag)
+ (inst lwzx value thread-base-tn value)
+ (inst cmpwi value no-tls-value-marker-widetag)
+ (inst bne DONE)
+ (loadw value object symbol-value-slot other-pointer-lowtag)
+ DONE)))
+
+;;; On unithreaded builds these are just copies of the global versions.
+#!-sb-thread
+(progn
+ (define-vop (symbol-value symbol-global-value)
+ (:translate symbol-value))
+ (define-vop (fast-symbol-value fast-symbol-global-value)
+ (:translate symbol-value))
+ (define-vop (set %set-symbol-global-value)))
+
;;; Like CHECKED-CELL-REF, only we are a predicate to see if the cell
;;; is bound.
(define-vop (boundp-frob)
(:policy :fast-safe)
(:temporary (:scs (descriptor-reg)) value))
+#!+sb-thread
(define-vop (boundp boundp-frob)
(:translate boundp)
(:generator 9
+ (loadw value object symbol-tls-index-slot other-pointer-lowtag)
+ (inst lwzx value thread-base-tn value)
+ (inst cmpwi value no-tls-value-marker-widetag)
+ (inst bne CHECK-UNBOUND)
(loadw value object symbol-value-slot other-pointer-lowtag)
+ CHECK-UNBOUND
(inst cmpwi value unbound-marker-widetag)
(inst b? (if not-p :eq :ne) target)))
-(define-vop (fast-symbol-value cell-ref)
- (:variant symbol-value-slot other-pointer-lowtag)
- (:policy :fast)
- (:translate symbol-value))
+#!-sb-thread
+(define-vop (boundp boundp-frob)
+ (:translate boundp)
+ (:generator 9
+ (loadw value object symbol-value-slot other-pointer-lowtag)
+ (inst cmpwi value unbound-marker-widetag)
+ (inst b? (if not-p :eq :ne) target)))
(define-vop (symbol-hash)
(:policy :fast-safe)
;; ensure this is explained in the comment in objdef.lisp
(loadw res symbol symbol-hash-slot other-pointer-lowtag)
(inst clrrwi res res n-fixnum-tag-bits)))
-
-;;; On unithreaded builds these are just copies of the non-global versions.
-(define-vop (%set-symbol-global-value set))
-(define-vop (symbol-global-value symbol-value)
- (:translate symbol-global-value))
-(define-vop (fast-symbol-global-value fast-symbol-value)
- (:translate symbol-global-value))
\f
;;;; Fdefinition (fdefn) objects.