X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fppc%2Fcell.lisp;h=7a2eb8d91542aba220a049b09ed98c29ca40add1;hb=f5c5f4ebb0486cddc6cdba2a0687b1d6c52baf2f;hp=c3a3fbd3013e5dddc91afa49b71a2b01e3dad2be;hpb=f33fdd489e9012e5064d35ca7edc7d4bc3c4a0c2;p=sbcl.git diff --git a/src/compiler/ppc/cell.lisp b/src/compiler/ppc/cell.lisp index c3a3fbd..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. @@ -288,6 +356,19 @@ ;;;; raw instance slot accessors +(defun offset-for-raw-slot (instance-length index n-words) + (+ (* (- instance-length instance-slots-offset index (1- n-words)) + n-word-bytes) + (- instance-pointer-lowtag))) + +(define-vop (raw-instance-init/word) + (:args (object :scs (descriptor-reg)) + (value :scs (unsigned-reg))) + (:arg-types * unsigned-num) + (:info instance-length index) + (:generator 4 + (inst stw value object (offset-for-raw-slot instance-length index 1)))) + (define-vop (raw-instance-ref/word) (:translate %raw-instance-ref/word) (:policy :fast-safe) @@ -332,6 +413,14 @@ (inst stwx value object offset) (move result value))) +(define-vop (raw-instance-init/single) + (:args (object :scs (descriptor-reg)) + (value :scs (single-reg))) + (:arg-types * single-float) + (:info instance-length index) + (:generator 4 + (inst stfs value object (offset-for-raw-slot instance-length index 1)))) + (define-vop (raw-instance-ref/single) (:translate %raw-instance-ref/single) (:policy :fast-safe) @@ -377,6 +466,14 @@ (unless (location= result value) (inst frsp result value)))) +(define-vop (raw-instance-init/double) + (:args (object :scs (descriptor-reg)) + (value :scs (double-reg))) + (:arg-types * double-float) + (:info instance-length index) + (:generator 4 + (inst stfd value object (offset-for-raw-slot instance-length index 2)))) + (define-vop (raw-instance-ref/double) (:translate %raw-instance-ref/double) (:policy :fast-safe) @@ -422,6 +519,17 @@ (unless (location= result value) (inst fmr result value)))) +(define-vop (raw-instance-init/complex-single) + (:args (object :scs (descriptor-reg)) + (value :scs (complex-single-reg))) + (:arg-types * complex-single-float) + (:info instance-length index) + (:generator 4 + (inst stfs (complex-single-reg-real-tn value) + object (offset-for-raw-slot instance-length index 2)) + (inst stfs (complex-single-reg-imag-tn value) + object (offset-for-raw-slot instance-length index 1)))) + (define-vop (raw-instance-ref/complex-single) (:translate %raw-instance-ref/complex-single) (:policy :fast-safe) @@ -477,6 +585,17 @@ (unless (location= result-imag value-imag) (inst frsp result-imag value-imag))))) +(define-vop (raw-instance-init/complex-double) + (:args (object :scs (descriptor-reg)) + (value :scs (complex-double-reg))) + (:arg-types * complex-double-float) + (:info instance-length index) + (:generator 4 + (inst stfd (complex-single-reg-real-tn value) + object (offset-for-raw-slot instance-length index 4)) + (inst stfd (complex-double-reg-imag-tn value) + object (offset-for-raw-slot instance-length index 2)))) + (define-vop (raw-instance-ref/complex-double) (:translate %raw-instance-ref/complex-double) (:policy :fast-safe)