X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fx86-64%2Fsystem.lisp;h=5d8ab1c9e186922adabcecbe9ac9ab3ee0ef34a1;hb=e0a4fab15834525fd043e6ef5adfd74a13af1450;hp=c9f111db533eb430b546e274ae3166c63e959fa3;hpb=4ebdc81b1a9c6dbed6e98b112afc8dd32b17a2dd;p=sbcl.git diff --git a/src/compiler/x86-64/system.lisp b/src/compiler/x86-64/system.lisp index c9f111d..5d8ab1c 100644 --- a/src/compiler/x86-64/system.lisp +++ b/src/compiler/x86-64/system.lisp @@ -17,7 +17,7 @@ (:translate lowtag-of) (:policy :fast-safe) (:args (object :scs (any-reg descriptor-reg control-stack) - :target result)) + :target result)) (:results (result :scs (unsigned-reg))) (:result-types positive-fixnum) (:generator 1 @@ -35,25 +35,25 @@ (inst mov rax object) (inst and al-tn lowtag-mask) (inst cmp al-tn other-pointer-lowtag) - (inst jmp :e other-ptr) + (inst jmp :e OTHER-PTR) (inst cmp al-tn fun-pointer-lowtag) - (inst jmp :e function-ptr) + (inst jmp :e FUNCTION-PTR) ;; Pick off structures and list pointers. (inst test al-tn 1) - (inst jmp :ne done) + (inst jmp :ne DONE) ;; Pick off fixnums. (inst and al-tn 7) - (inst jmp :e done) + (inst jmp :e DONE) ;; must be an other immediate (inst mov rax object) - (inst jmp done) + (inst jmp DONE) FUNCTION-PTR (load-type al-tn object (- fun-pointer-lowtag)) - (inst jmp done) + (inst jmp DONE) OTHER-PTR (load-type al-tn object (- other-pointer-lowtag)) @@ -76,18 +76,18 @@ (:translate (setf fun-subtype)) (:policy :fast-safe) (:args (type :scs (unsigned-reg) :target eax) - (function :scs (descriptor-reg))) + (function :scs (descriptor-reg))) (:arg-types positive-fixnum *) (:temporary (:sc unsigned-reg :offset rax-offset :from (:argument 0) - :to (:result 0) :target result) - eax) + :to (:result 0) :target result) + eax) (:results (result :scs (unsigned-reg))) (:result-types positive-fixnum) (:generator 6 (move eax type) (inst mov - (make-ea :byte :base function :disp (- fun-pointer-lowtag)) - al-tn) + (make-ea :byte :base function :disp (- fun-pointer-lowtag)) + al-tn) (move result eax))) (define-vop (get-header-data) @@ -114,14 +114,14 @@ (:translate set-header-data) (:policy :fast-safe) (:args (x :scs (descriptor-reg) :target res :to (:result 0)) - (data :scs (any-reg) :target eax)) + (data :scs (any-reg) :target eax)) (:arg-types * positive-fixnum) (:results (res :scs (descriptor-reg))) (:temporary (:sc unsigned-reg :offset eax-offset - :from (:argument 1) :to (:result 0)) eax) + :from (:argument 1) :to (:result 0)) eax) (:generator 6 (move eax data) - (inst shl eax (- n-widetag-bits 2)) + (inst shl eax (- n-widetag-bits n-fixnum-tag-bits)) (inst mov al-tn (make-ea :byte :base x :disp (- other-pointer-lowtag))) (storew eax x 0 other-pointer-lowtag) (move res x))) @@ -138,14 +138,14 @@ (define-vop (make-other-immediate-type) (:args (val :scs (any-reg descriptor-reg) :target res) - (type :scs (unsigned-reg immediate))) + (type :scs (unsigned-reg immediate))) (:results (res :scs (any-reg descriptor-reg) :from (:argument 0))) (:generator 2 (move res val) - (inst shl res (- n-widetag-bits 2)) + (inst shl res (- n-widetag-bits n-fixnum-tag-bits)) (inst or res (sc-case type - (unsigned-reg type) - (immediate (tn-value type)))))) + (unsigned-reg type) + (immediate (tn-value type)))))) ;;;; allocation @@ -163,7 +163,7 @@ (:translate binding-stack-pointer-sap) (:policy :fast-safe) (:generator 1 - (load-tl-symbol-value int *binding-stack-pointer*))) + (load-binding-stack-pointer int))) (defknown (setf binding-stack-pointer-sap) (system-area-pointer) system-area-pointer ()) @@ -173,11 +173,10 @@ (:arg-types system-area-pointer) (:results (int :scs (sap-reg))) (:result-types system-area-pointer) - #!+sb-thread (:temporary (:sc any-reg) temp) (:translate (setf binding-stack-pointer-sap)) (:policy :fast-safe) (:generator 1 - (store-tl-symbol-value new-value *binding-stack-pointer* temp) + (store-binding-stack-pointer new-value) (move int new-value))) (define-vop (control-stack-pointer-sap) @@ -199,22 +198,22 @@ (:generator 10 (loadw sap code 0 other-pointer-lowtag) (inst shr sap n-widetag-bits) - (inst lea sap (make-ea :byte :base code :index sap - :scale n-word-bytes - :disp (- other-pointer-lowtag))))) + (inst lea sap (make-ea :byte :base code :index sap + :scale n-word-bytes + :disp (- other-pointer-lowtag))))) (define-vop (compute-fun) (:args (code :scs (descriptor-reg) :to (:result 0)) - (offset :scs (signed-reg unsigned-reg) :to (:result 0))) + (offset :scs (signed-reg unsigned-reg) :to (:result 0))) (:arg-types * positive-fixnum) (:results (func :scs (descriptor-reg) :from (:argument 0))) (:generator 10 (loadw func code 0 other-pointer-lowtag) (inst shr func n-widetag-bits) (inst lea func - (make-ea :byte :base offset :index func - :scale n-word-bytes - :disp (- fun-pointer-lowtag other-pointer-lowtag))) + (make-ea :byte :base offset :index func + :scale n-word-bytes + :disp (- fun-pointer-lowtag other-pointer-lowtag))) (inst add func code))) (define-vop (%simple-fun-self) @@ -225,9 +224,9 @@ (:generator 3 (loadw result function simple-fun-self-slot fun-pointer-lowtag) (inst lea result - (make-ea :byte :base result - :disp (- fun-pointer-lowtag - (* simple-fun-code-offset n-word-bytes)))))) + (make-ea :byte :base result + :disp (- fun-pointer-lowtag + (* simple-fun-code-offset n-word-bytes)))))) ;;; The closure function slot is a pointer to raw code on X86 instead ;;; of a pointer to the code function object itself. This VOP is used @@ -235,37 +234,20 @@ (define-source-transform %closure-fun (closure) `(%simple-fun-self ,closure)) -(define-source-transform %funcallable-instance-fun (fin) - `(%simple-fun-self ,fin)) - (define-vop (%set-fun-self) (:policy :fast-safe) (:translate (setf %simple-fun-self)) (:args (new-self :scs (descriptor-reg) :target result :to :result) - (function :scs (descriptor-reg) :to :result)) + (function :scs (descriptor-reg) :to :result)) (:temporary (:sc any-reg :from (:argument 0) :to :result) temp) (:results (result :scs (descriptor-reg))) (:generator 3 (inst lea temp - (make-ea :byte :base new-self - :disp (- (ash simple-fun-code-offset word-shift) - fun-pointer-lowtag))) + (make-ea :byte :base new-self + :disp (- (ash simple-fun-code-offset word-shift) + fun-pointer-lowtag))) (storew temp function simple-fun-self-slot fun-pointer-lowtag) (move result new-self))) - -;;; KLUDGE: This seems to be some kind of weird override of the way -;;; that the objdef.lisp code would ordinarily set up the slot -;;; accessor. It's inherited from CMU CL, and it works, and naively -;;; deleting it seemed to cause problems, but it's not obvious why -;;; it's done this way. Any ideas? -- WHN 2001-08-02 -(defknown ((setf %funcallable-instance-fun)) (function function) function - (unsafe)) -;;; CMU CL comment: -;;; We would have really liked to use a source-transform for this, but -;;; they don't work with SETF functions. -;;; FIXME: Can't we just use DEFSETF or something? -(deftransform (setf %funcallable-instance-fun) ((value fin)) - '(setf (%simple-fun-self fin) value)) ;;;; other miscellaneous VOPs @@ -277,7 +259,7 @@ (inst break pending-interrupt-trap))) #!+sb-thread -(defknown current-thread-offset-sap ((unsigned-byte 32)) +(defknown current-thread-offset-sap ((unsigned-byte 64)) system-area-pointer (flushable)) #!+sb-thread @@ -289,8 +271,8 @@ (:arg-types unsigned-num) (:policy :fast-safe) (:generator 2 - (inst fs-segment-prefix) - (inst mov sap (make-ea :dword :disp 0 :index n :scale 4)))) + (inst mov sap + (make-ea :qword :base thread-base-tn :disp 0 :index n :scale 8)))) (define-vop (halt) (:generator 1 @@ -314,5 +296,5 @@ (:info index) (:generator 0 (inst inc (make-ea :qword :base count-vector - :disp (- (* (+ vector-data-offset index) n-word-bytes) - other-pointer-lowtag))))) + :disp (- (* (+ vector-data-offset index) n-word-bytes) + other-pointer-lowtag)))))