X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fppc%2Fcell.lisp;h=7a2eb8d91542aba220a049b09ed98c29ca40add1;hb=f5c5f4ebb0486cddc6cdba2a0687b1d6c52baf2f;hp=8ac94b3f62c2810f9966785f3c2d21161f77fc7b;hpb=d5e1f093b8ca643ce4f39554232e0a1688e85b7c;p=sbcl.git diff --git a/src/compiler/ppc/cell.lisp b/src/compiler/ppc/cell.lisp index 8ac94b3..7a2eb8d 100644 --- a/src/compiler/ppc/cell.lisp +++ b/src/compiler/ppc/cell.lisp @@ -35,7 +35,7 @@ ;;;; 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. @@ -49,8 +49,8 @@ ;;; 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) @@ -58,6 +58,72 @@ (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) @@ -67,17 +133,26 @@ (: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) @@ -92,13 +167,6 @@ ;; 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)) ;;;; Fdefinition (fdefn) objects.