+(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)))
+