X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fhppa%2Fcell.lisp;h=c5e21b22f3607594c7994d50bff3991339fe8884;hb=9c510b74eca61bbcc2014dc2b1d02049dff50508;hp=7334e4e9f99c81a663be3b191404b5f5dbd26676;hpb=edcaad65452eee6bff2017941ef6c33b26a5a2b0;p=sbcl.git diff --git a/src/compiler/hppa/cell.lisp b/src/compiler/hppa/cell.lisp index 7334e4e..c5e21b2 100644 --- a/src/compiler/hppa/cell.lisp +++ b/src/compiler/hppa/cell.lisp @@ -24,12 +24,14 @@ (define-vop (set-slot) (:args (object :scs (descriptor-reg)) - (value :scs (descriptor-reg any-reg))) + (value :scs (descriptor-reg any-reg null zero))) (:info name offset lowtag) (:ignore name) (:results) (:generator 1 (storew value object offset lowtag))) + +(define-vop (init-slot set-slot)) ;;;; Symbol hacking VOPs: @@ -44,7 +46,7 @@ (:policy :fast-safe) (:vop-var vop) (:save-p :compute-only) - (:temporary (:type random :scs (non-descriptor-reg)) temp) + (:temporary (:scs (non-descriptor-reg)) temp) (:temporary (:scs (descriptor-reg) :from (:argument 0)) obj-temp)) ;;; With Symbol-Value, we check that the value isn't the trap object. So @@ -65,7 +67,7 @@ (:info target not-p) (:policy :fast-safe) (:temporary (:scs (descriptor-reg)) value) - (:temporary (:type random :scs (non-descriptor-reg)) temp)) + (:temporary (:scs (non-descriptor-reg)) temp)) (define-vop (boundp boundp-frob) (:translate boundp) @@ -83,15 +85,21 @@ (:policy :fast-safe) (:translate symbol-hash) (:args (symbol :scs (descriptor-reg))) + (:temporary (:scs (non-descriptor-reg)) temp) (:results (res :scs (any-reg))) (:result-types positive-fixnum) (:generator 2 - ;; The symbol-hash slot of NIL holds NIL because it is also the - ;; cdr slot, so we have to strip off the two low bits to make sure - ;; it is a fixnum. The lowtag selection magic that is required to - ;; ensure this is explained in the comment in objdef.lisp - (loadw res symbol symbol-hash-slot other-pointer-lowtag) - (inst andcm res #b11 res))) + (loadw temp symbol symbol-hash-slot other-pointer-lowtag) + (inst dep 0 31 n-fixnum-tag-bits temp) + ;; we must go through an temporary to avoid gc + (move temp res))) + +;;; 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. @@ -119,16 +127,17 @@ (:temporary (:scs (non-descriptor-reg)) type) (:results (result :scs (descriptor-reg))) (:generator 38 - (load-type type function (- fun-pointer-lowtag)) - (inst addi (- simple-fun-header-widetag) type type) - (inst comb := type zero-tn normal-fn) - (inst addi (- (ash simple-fun-code-offset word-shift) fun-pointer-lowtag) - function lip) - (inst li (make-fixup "closure_tramp" :foreign) lip) - NORMAL-FN - (storew function fdefn fdefn-fun-slot other-pointer-lowtag) - (storew lip fdefn fdefn-raw-addr-slot other-pointer-lowtag) - (move function result))) + (let ((normal-fn (gen-label))) + (load-type type function (- fun-pointer-lowtag)) + (inst addi (- simple-fun-header-widetag) type type) + (inst comb := type zero-tn normal-fn) + (inst addi (- (ash simple-fun-code-offset word-shift) fun-pointer-lowtag) + function lip) + (inst li (make-fixup 'closure-tramp :assembly-routine) lip) + (emit-label normal-fn) + (storew function fdefn fdefn-fun-slot other-pointer-lowtag) + (storew lip fdefn fdefn-raw-addr-slot other-pointer-lowtag) + (move function result)))) (define-vop (fdefn-makunbound) (:policy :fast-safe) @@ -142,7 +151,6 @@ (storew temp fdefn fdefn-raw-addr-slot other-pointer-lowtag) (move fdefn result))) - ;;;; Binding and Unbinding. @@ -156,7 +164,7 @@ (:temporary (:scs (descriptor-reg)) temp) (:generator 5 (loadw temp symbol symbol-value-slot other-pointer-lowtag) - (inst addi (* binding-size n-word-bytes) bsp-tn bsp-tn) + (inst addi (* 2 n-word-bytes) bsp-tn bsp-tn) (storew temp bsp-tn (- binding-value-slot binding-size)) (storew symbol bsp-tn (- binding-symbol-slot binding-size)) (storew val symbol symbol-value-slot other-pointer-lowtag))) @@ -169,29 +177,32 @@ (storew value symbol symbol-value-slot other-pointer-lowtag) (storew zero-tn bsp-tn (- binding-symbol-slot binding-size)) (storew zero-tn bsp-tn (- binding-value-slot binding-size)) - (inst addi (- (* binding-size n-word-bytes)) bsp-tn bsp-tn))) + (inst addi (- (* 2 n-word-bytes)) bsp-tn bsp-tn))) (define-vop (unbind-to-here) - (:args (where :scs (descriptor-reg any-reg))) + (:args (arg :scs (descriptor-reg any-reg) :target where)) + (:temporary (:scs (any-reg) :from (:argument 0)) where) (:temporary (:scs (descriptor-reg)) symbol value) (:generator 0 - (inst comb := where bsp-tn done :nullify t) - (loadw symbol bsp-tn (- binding-symbol-slot binding-size)) - - LOOP - (inst comb := symbol zero-tn skip) - (loadw value bsp-tn (- binding-value-slot binding-size)) - (storew value symbol symbol-value-slot other-pointer-lowtag) - (storew zero-tn bsp-tn (- binding-symbol-slot binding-size)) - - SKIP - (storew zero-tn bsp-tn (- binding-value-slot binding-size)) - (inst addi (* -2 n-word-bytes) bsp-tn bsp-tn) - (inst comb :<> where bsp-tn loop :nullify t) - (loadw symbol bsp-tn (- binding-symbol-slot binding-size)) - - DONE)) - + (let ((loop (gen-label)) + (skip (gen-label)) + (done (gen-label))) + (move arg where) + (inst comb := where bsp-tn done :nullify t) + + (emit-label loop) + (loadw symbol bsp-tn (- binding-symbol-slot binding-size)) + (inst comb := symbol zero-tn skip) + (loadw value bsp-tn (- binding-value-slot binding-size)) + (storew value symbol symbol-value-slot other-pointer-lowtag) + (storew zero-tn bsp-tn (- binding-symbol-slot binding-size)) + + (emit-label skip) + (storew zero-tn bsp-tn (- binding-value-slot binding-size)) + (inst addi (* -2 n-word-bytes) bsp-tn bsp-tn) + (inst comb :<> where bsp-tn loop) + (inst nop) + (emit-label done)))) ;;;; Closure indexing. @@ -202,7 +213,7 @@ (define-full-setter set-funcallable-instance-info * funcallable-instance-info-offset fun-pointer-lowtag - (descriptor-reg any-reg) * %set-funcallable-instance-info) + (descriptor-reg any-reg null zero) * %set-funcallable-instance-info) (define-full-reffer funcallable-instance-info * funcallable-instance-info-offset fun-pointer-lowtag @@ -213,6 +224,12 @@ (define-vop (closure-init slot-set) (:variant closure-info-offset fun-pointer-lowtag)) + +(define-vop (closure-init-from-fp) + (:args (object :scs (descriptor-reg))) + (:info offset) + (:generator 4 + (storew cfp-tn object (+ closure-info-offset offset) fun-pointer-lowtag))) ;;;; Value Cell hackery. @@ -240,7 +257,7 @@ instance-pointer-lowtag (descriptor-reg any-reg) * %instance-ref) (define-full-setter instance-index-set * instance-slots-offset - instance-pointer-lowtag (descriptor-reg any-reg) * %instance-set) + instance-pointer-lowtag (descriptor-reg any-reg null zero) * %instance-set) @@ -250,18 +267,32 @@ (descriptor-reg any-reg) * code-header-ref) (define-full-setter code-header-set * 0 other-pointer-lowtag - (descriptor-reg any-reg) * code-header-set) + (descriptor-reg any-reg null zero) * code-header-set) + ;;;; raw instance slot accessors - -(macrolet ((fix-storage (inc-offset-by) - `(progn - (loadw offset object 0 instance-pointer-lowtag) - (inst srl offset n-widetag-bits offset) - (inst sll offset 2 offset) - (inst sub offset index offset) - (inst addi ,inc-offset-by offset offset) - (inst add offset object lip))) +(macrolet ((lfloat (imm base dst &key side) + `(cond + ((< ,imm (ash 1 4)) + (inst flds ,imm ,base ,dst :side ,side)) + ((and (< ,imm (ash 1 13)) + (> ,imm 0)) + (progn + (inst li ,imm offset) + (inst fldx offset ,base ,dst :side ,side))) + (t + (error "inst fldx cant handle offset-register loaded with immediate ~s" ,imm)))) + (sfloat (src imm base &key side) + `(cond + ((< ,imm (ash 1 4)) + (inst fsts ,src ,imm ,base :side ,side)) + ((and (< ,imm (ash 1 13)) + (> ,imm 0)) + (progn + (inst ldo ,imm zero-tn offset) + (inst fstx ,src offset ,base :side ,side))) + (t + (error "inst fstx cant handle offset-register loaded with immediate ~s" ,imm)))) (raw-instance ((type inc-offset-by set &optional complex) &body body) (let ((name (symbolicate "RAW-INSTANCE-" @@ -309,92 +340,89 @@ (move value result)) (raw-instance (single -1 nil) - (inst li (- (* instance-slots-offset n-word-bytes) - instance-pointer-lowtag) offset) - (inst fldx offset lip value)) + (let ((io (- (* instance-slots-offset n-word-bytes) + instance-pointer-lowtag))) + (lfloat io lip value))) (raw-instance (single -1 t) - (inst li (- (* instance-slots-offset n-word-bytes) - instance-pointer-lowtag) offset) - (inst fstx value offset lip) + (let ((io (- (* instance-slots-offset n-word-bytes) + instance-pointer-lowtag))) + (sfloat value io lip)) (unless (location= result value) (inst funop :copy value result))) (raw-instance (double -2 nil) - (inst fldx object index value) - (inst fldx offset lip value)) + (let ((io (- (* instance-slots-offset n-word-bytes) + instance-pointer-lowtag))) + (lfloat io lip value))) (raw-instance (double -2 t) - (inst fldx offset lip value) - (inst fldx index object value) - (inst funop :copy value result)) + (let ((io (- (* instance-slots-offset n-word-bytes) + instance-pointer-lowtag))) + (sfloat value io lip :side 0)) + (let ((io (- (* (1+ instance-slots-offset) n-word-bytes) + instance-pointer-lowtag))) + (sfloat value io lip :side 1)) + (unless (location= result value) + (inst funop :copy value result))) (raw-instance (single -2 nil complex-single) - (inst li (- (* instance-slots-offset n-word-bytes) - instance-pointer-lowtag) offset) - (inst fldx offset lip (complex-single-reg-real-tn value)) - (inst li (- (* (1+ instance-slots-offset) n-word-bytes) - instance-pointer-lowtag) offset) - (inst fldx offset lip (complex-single-reg-imag-tn value))) + (let ((io (- (* instance-slots-offset n-word-bytes) + instance-pointer-lowtag))) + (lfloat io lip (complex-single-reg-real-tn value))) + (let ((io (- (* (1+ instance-slots-offset) n-word-bytes) + instance-pointer-lowtag))) + (lfloat io lip (complex-single-reg-imag-tn value)))) (raw-instance (single -2 t complex-single) (let ((value-real (complex-single-reg-real-tn value)) - (result-real (complex-single-reg-real-tn result))) - (inst li (- (* instance-slots-offset n-word-bytes) - instance-pointer-lowtag) offset) - (inst fstx value-real offset lip) + (result-real (complex-single-reg-real-tn result)) + (io (- (* instance-slots-offset n-word-bytes) + instance-pointer-lowtag))) + + (sfloat value-real io lip) (unless (location= result-real value-real) (inst funop :copy value-real result-real))) (let ((value-imag (complex-single-reg-imag-tn value)) - (result-imag (complex-single-reg-imag-tn result))) - (inst li (- (* (1+ instance-slots-offset) n-word-bytes) - instance-pointer-lowtag) offset) - (inst fstx value-imag offset lip) + (result-imag (complex-single-reg-imag-tn result)) + (io (- (* (1+ instance-slots-offset) n-word-bytes) + instance-pointer-lowtag))) + (sfloat value-imag io lip) (unless (location= result-imag value-imag) (inst funop :copy value-imag result-imag)))) (raw-instance (double -4 nil complex-double) - (let ((immediate-offset (- (* instance-slots-offset n-word-bytes) - instance-pointer-lowtag))) - (inst li immediate-offset offset) - (inst fldx offset lip (complex-double-reg-real-tn value))) - (let ((immediate-offset (+ 4 (- (* (1+ instance-slots-offset) - n-word-bytes) instance-pointer-lowtag)))) - (inst li immediate-offset offset) - (inst fldx offset lip (complex-double-reg-real-tn value))) - (let ((immediate-offset (- (* (+ instance-slots-offset 2) n-word-bytes) - instance-pointer-lowtag))) - (inst li immediate-offset offset) - (inst fldx offset lip (complex-double-reg-imag-tn value))) - (let ((immediate-offset (+ 4 (- (* (+ instance-slots-offset 3) - n-word-bytes) instance-pointer-lowtag)))) - (inst li immediate-offset offset) - (inst fldx offset lip (complex-double-reg-imag-tn value)))) + (let ((r0 (- (* instance-slots-offset n-word-bytes) + instance-pointer-lowtag)) + (r1 (- (* (+ instance-slots-offset 1) n-word-bytes) + instance-pointer-lowtag)) + (i0 (- (* (+ instance-slots-offset 2) n-word-bytes) + instance-pointer-lowtag)) + (i1 (- (* (+ instance-slots-offset 3) n-word-bytes) + instance-pointer-lowtag))) + (lfloat r0 lip (complex-double-reg-real-tn value) :side 0) + (lfloat r1 lip (complex-double-reg-real-tn value) :side 1) + (lfloat i0 lip (complex-double-reg-imag-tn value) :side 0) + (lfloat i1 lip (complex-double-reg-imag-tn value) :side 1))) (raw-instance (double -4 t complex-double) - (let ((value-real (complex-double-reg-real-tn value)) - (result-real (complex-double-reg-real-tn result))) - (let ((immediate-offset (- (* instance-slots-offset n-word-bytes) - instance-pointer-lowtag))) - (inst li immediate-offset offset) - (inst fldx offset lip value-real)) - (let ((immediate-offset (+ 4 (- (* (1+ instance-slots-offset) - n-word-bytes) instance-pointer-lowtag)))) - (inst li immediate-offset offset) - (inst fldx offset lip value-real)) - + (let ((value-real (complex-double-reg-real-tn value)) + (result-real (complex-double-reg-real-tn result)) + (value-imag (complex-double-reg-imag-tn value)) + (result-imag (complex-double-reg-imag-tn result)) + (r0 (- (* instance-slots-offset n-word-bytes) + instance-pointer-lowtag)) + (r1 (- (* (+ instance-slots-offset 1) n-word-bytes) + instance-pointer-lowtag)) + (i0 (- (* (+ instance-slots-offset 2) n-word-bytes) + instance-pointer-lowtag)) + (i1 (- (* (+ instance-slots-offset 3) n-word-bytes) + instance-pointer-lowtag))) + (sfloat value-real r0 lip :side 0) + (sfloat value-real r1 lip :side 1) + (sfloat value-imag i0 lip :side 0) + (sfloat value-imag i1 lip :side 1) (unless (location= result-real value-real) - (inst funop :copy value-real result-real))) - (let ((value-imag (complex-double-reg-imag-tn value)) - (result-imag (complex-double-reg-imag-tn result))) - (let ((immediate-offset (- (* (+ instance-slots-offset 2) n-word-bytes) - instance-pointer-lowtag))) - (inst li immediate-offset offset) - (inst fldx offset lip value-imag)) - - (let ((immediate-offset (+ 4 (- (* (+ instance-slots-offset 3) - n-word-bytes) instance-pointer-lowtag)))) - (inst li immediate-offset offset) - (inst fldx offset lip value-imag)) + (inst funop :copy value-real result-real)) (unless (location= result-imag value-imag) (inst funop :copy value-imag result-imag)))))