X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompiler%2Fppc%2Fcell.lisp;h=ddb3c2fd88c1c9a8183dd73c8825003bb614efd4;hb=8902b8b6bd2e9285749dd39d313b33b6c69c5213;hp=3d5fb374d5cb2034fadbe878984ac8fd6b1da50a;hpb=cab2c71bb1bb8a575d9eebdae335e731daa64183;p=sbcl.git diff --git a/src/compiler/ppc/cell.lisp b/src/compiler/ppc/cell.lisp index 3d5fb37..ddb3c2f 100644 --- a/src/compiler/ppc/cell.lisp +++ b/src/compiler/ppc/cell.lisp @@ -1,12 +1,16 @@ -;;; VOPs for the PPC. -;;; -;;; Written by Rob MacLachlan -;;; -;;; Converted by William Lott. -;;; +;;;; the VM definition of various primitive memory access VOPs for the +;;;; PPC + +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; This software is derived from the CMU CL system, which was +;;;; written at Carnegie Mellon University and released into the +;;;; public domain. The software is in the public domain and is +;;;; provided with absolutely no warranty. See the COPYING and CREDITS +;;;; files for more information. (in-package "SB!VM") - ;;;; Data object ref/set stuff. @@ -27,17 +31,14 @@ (:generator 1 (storew value object offset lowtag))) - ;;;; Symbol hacking VOPs: ;;; The compiler likes to be able to directly SET symbols. -;;; (define-vop (set cell-set) (:variant symbol-value-slot other-pointer-lowtag)) ;;; Do a cell ref with an error check for being unbound. -;;; (define-vop (checked-cell-ref) (:args (object :scs (descriptor-reg) :target obj-temp)) (:results (value :scs (descriptor-reg any-reg))) @@ -46,19 +47,19 @@ (:save-p :compute-only) (:temporary (:scs (descriptor-reg) :from (:argument 0)) obj-temp)) -;;; With Symbol-Value, we check that the value isn't the trap object. So -;;; Symbol-Value of NIL is NIL. -;;; +;;; 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) (:generator 9 (move obj-temp object) - (loadw value obj-temp sb!vm:symbol-value-slot sb!vm:other-pointer-lowtag) + (loadw value obj-temp symbol-value-slot other-pointer-lowtag) (let ((err-lab (generate-error-code vop unbound-symbol-error obj-temp))) - (inst cmpwi value sb!vm:unbound-marker-widetag) + (inst cmpwi value unbound-marker-widetag) (inst beq err-lab)))) -;;; Like CHECKED-CELL-REF, only we are a predicate to see if the cell is bound. +;;; Like CHECKED-CELL-REF, only we are a predicate to see if the cell +;;; is bound. (define-vop (boundp-frob) (:args (object :scs (descriptor-reg))) (:conditional) @@ -69,15 +70,28 @@ (define-vop (boundp boundp-frob) (:translate boundp) (:generator 9 - (loadw value object sb!vm:symbol-value-slot sb!vm:other-pointer-lowtag) - (inst cmpwi value sb!vm:unbound-marker-widetag) + (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 (fast-symbol-value cell-ref) - (:variant sb!vm:symbol-value-slot sb!vm:other-pointer-lowtag) + (:variant symbol-value-slot other-pointer-lowtag) (:policy :fast) (:translate symbol-value)) +(define-vop (symbol-hash) + (:policy :fast-safe) + (:translate symbol-hash) + (:args (symbol :scs (descriptor-reg))) + (: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 clrrwi res res (1- n-lowtag-bits)))) ;;;; Fdefinition (fdefn) objects. @@ -113,7 +127,7 @@ (inst addi lip function (- (ash simple-fun-code-offset word-shift) fun-pointer-lowtag)) (inst beq normal-fn) - (inst lr lip (make-fixup "closure_tramp" :foreign)) + (inst lr lip (make-fixup (extern-alien-name "closure_tramp") :foreign)) (emit-label normal-fn) (storew lip fdefn fdefn-raw-addr-slot other-pointer-lowtag) (storew function fdefn fdefn-fun-slot other-pointer-lowtag) @@ -127,7 +141,7 @@ (:results (result :scs (descriptor-reg))) (:generator 38 (storew null-tn fdefn fdefn-fun-slot other-pointer-lowtag) - (inst lr temp (make-fixup "undefined_tramp" :foreign)) + (inst lr temp (make-fixup (extern-alien-name "undefined_tramp") :foreign)) (storew temp fdefn fdefn-raw-addr-slot other-pointer-lowtag) (move result fdefn))) @@ -144,21 +158,21 @@ (symbol :scs (descriptor-reg))) (:temporary (:scs (descriptor-reg)) temp) (:generator 5 - (loadw temp symbol sb!vm:symbol-value-slot sb!vm:other-pointer-lowtag) - (inst addi bsp-tn bsp-tn (* 2 sb!vm:n-word-bytes)) - (storew temp bsp-tn (- sb!vm:binding-value-slot sb!vm:binding-size)) - (storew symbol bsp-tn (- sb!vm:binding-symbol-slot sb!vm:binding-size)) - (storew val symbol sb!vm:symbol-value-slot sb!vm:other-pointer-lowtag))) + (loadw temp symbol symbol-value-slot other-pointer-lowtag) + (inst addi bsp-tn bsp-tn (* 2 n-word-bytes)) + (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))) (define-vop (unbind) (:temporary (:scs (descriptor-reg)) symbol value) (:generator 0 - (loadw symbol bsp-tn (- sb!vm:binding-symbol-slot sb!vm:binding-size)) - (loadw value bsp-tn (- sb!vm:binding-value-slot sb!vm:binding-size)) - (storew value symbol sb!vm:symbol-value-slot sb!vm:other-pointer-lowtag) - (storew zero-tn bsp-tn (- sb!vm:binding-symbol-slot sb!vm:binding-size)) - (inst subi bsp-tn bsp-tn (* 2 sb!vm:n-word-bytes)))) + (loadw symbol bsp-tn (- binding-symbol-slot binding-size)) + (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)) + (inst subi bsp-tn bsp-tn (* 2 n-word-bytes)))) (define-vop (unbind-to-here) @@ -174,15 +188,15 @@ (inst beq done) (emit-label loop) - (loadw symbol bsp-tn (- sb!vm:binding-symbol-slot sb!vm:binding-size)) + (loadw symbol bsp-tn (- binding-symbol-slot binding-size)) (inst cmpwi symbol 0) (inst beq skip) - (loadw value bsp-tn (- sb!vm:binding-value-slot sb!vm:binding-size)) - (storew value symbol sb!vm:symbol-value-slot sb!vm:other-pointer-lowtag) - (storew zero-tn bsp-tn (- sb!vm:binding-symbol-slot sb!vm:binding-size)) + (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) - (inst subi bsp-tn bsp-tn (* 2 sb!vm:n-word-bytes)) + (inst subi bsp-tn bsp-tn (* 2 n-word-bytes)) (inst cmpw where bsp-tn) (inst bne loop) @@ -193,11 +207,11 @@ ;;;; Closure indexing. (define-vop (closure-index-ref word-index-ref) - (:variant sb!vm:closure-info-offset sb!vm:fun-pointer-lowtag) + (:variant closure-info-offset fun-pointer-lowtag) (:translate %closure-index-ref)) (define-vop (funcallable-instance-info word-index-ref) - (:variant funcallable-instance-info-offset sb!vm:fun-pointer-lowtag) + (:variant funcallable-instance-info-offset fun-pointer-lowtag) (:translate %funcallable-instance-info)) (define-vop (set-funcallable-instance-info word-index-set) @@ -236,7 +250,7 @@ (:result-types positive-fixnum) (:generator 4 (loadw temp struct 0 instance-pointer-lowtag) - (inst srwi res temp sb!vm:n-widetag-bits))) + (inst srwi res temp n-widetag-bits))) (define-vop (instance-ref slot-ref) (:variant instance-slots-offset instance-pointer-lowtag)