Commit 3c67abd3 authored by cwang's avatar cwang
Browse files

Since linkage table will trash r11, make sure it's used as the temp register for allocation

parent b96d74be
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/amd64/arith.lisp,v 1.1 2004/05/21 22:46:43 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/amd64/arith.lisp,v 1.2 2004/07/14 20:51:49 cwang Rel $")
;;;
;;; **********************************************************************
;;;
......@@ -39,7 +39,8 @@
(:temp rax unsigned-reg rax-offset)
(:temp rbx unsigned-reg rbx-offset)
(:temp rcx unsigned-reg rcx-offset))
(:temp rcx unsigned-reg rcx-offset)
(:temp r11 unsigned-reg r11-offset))
(inst test x 3) ; fixnum?
(inst jmp :nz DO-STATIC-FUN) ; no - do generic
......@@ -72,7 +73,7 @@
(move rcx res)
(with-fixed-allocation (res bignum-type (1+ bignum-digits-offset) rax)
(with-fixed-allocation (res bignum-type (1+ bignum-digits-offset) r11)
(storew rcx res bignum-digits-offset other-pointer-type))
OKAY)
......@@ -93,7 +94,7 @@
(move rcx res)
(with-fixed-allocation (res bignum-type (1+ bignum-digits-offset) rax)
(with-fixed-allocation (res bignum-type (1+ bignum-digits-offset) r11)
(storew rcx res bignum-digits-offset other-pointer-type))
OKAY)
......@@ -114,14 +115,14 @@
(inst cmp x rcx)
(inst jmp :e SINGLE-WORD-BIGNUM)
(with-fixed-allocation (res bignum-type (+ bignum-digits-offset 2) rbx)
(with-fixed-allocation (res bignum-type (+ bignum-digits-offset 2) r11)
(storew rax res bignum-digits-offset other-pointer-type)
(storew rcx res (1+ bignum-digits-offset) other-pointer-type))
(inst jmp DONE)
SINGLE-WORD-BIGNUM
(with-fixed-allocation (res bignum-type (1+ bignum-digits-offset) rbx)
(with-fixed-allocation (res bignum-type (1+ bignum-digits-offset) r11)
(storew rax res bignum-digits-offset other-pointer-type))
(inst jmp DONE)
......@@ -139,7 +140,8 @@
(:res res (descriptor-reg any-reg) rdx-offset)
(:temp rax unsigned-reg rax-offset)
(:temp rcx unsigned-reg rcx-offset))
(:temp rcx unsigned-reg rcx-offset)
(:temp r11 unsigned-reg r11-offset))
(inst test x 3)
(inst jmp :z FIXNUM)
......@@ -159,7 +161,7 @@
(inst shr res 2) ; sign bit is data - remove type bits
(move rcx res)
(with-fixed-allocation (res bignum-type (1+ bignum-digits-offset) rax)
(with-fixed-allocation (res bignum-type (1+ bignum-digits-offset) r11)
(storew rcx res bignum-digits-offset other-pointer-type))
OKAY)
......
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/amd64/array.lisp,v 1.1 2004/05/21 22:46:43 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/assembly/amd64/array.lisp,v 1.2 2004/07/14 20:51:49 cwang Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -32,7 +32,7 @@
((:arg type unsigned-reg rax-offset)
(:arg length any-reg rbx-offset)
(:arg words any-reg rcx-offset)
(:temp temp any-reg rdi-offset)
(:temp temp any-reg r11-offset)
(:res result descriptor-reg rdx-offset))
;; compute the number of bytes
;; words is a fixnum
......
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/alloc.lisp,v 1.3 2004/07/06 20:09:05 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/alloc.lisp,v 1.4 2004/07/14 20:56:24 cwang Rel $")
;;;
;;; **********************************************************************
;;;
......@@ -45,7 +45,8 @@
(define-vop (list-or-list*)
(:args (things :more t))
(:temporary (:sc unsigned-reg) ptr temp)
(:temporary (:sc unsigned-reg) ptr)
(:temporary (:sc unsigned-reg :offset r11-offset) temp)
(:temporary (:sc unsigned-reg :to (:result 0) :target result) res)
(:info num dynamic-extent)
(:results (result :scs (descriptor-reg)))
......@@ -139,7 +140,7 @@
(:results (result :scs (descriptor-reg) :from :eval))
(:temporary (:sc unsigned-reg :from (:argument 0)) boxed)
(:temporary (:sc unsigned-reg :from (:argument 1)) unboxed)
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:generator 100
(move boxed boxed-arg)
......@@ -170,7 +171,7 @@
(:translate make-fdefn)
(:args (name :scs (descriptor-reg) :to :eval))
(:results (result :scs (descriptor-reg) :from :argument))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:generator 37
(with-fixed-allocation (result fdefn-type fdefn-size temp node)
......@@ -184,7 +185,7 @@
(define-vop (make-closure)
(:args (function :to :save :scs (descriptor-reg)))
(:info length dynamic-extent)
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:results (result :scs (descriptor-reg)))
(:node-var node)
(:generator 10
......@@ -205,7 +206,7 @@
(define-vop (make-value-cell)
(:args (value :scs (descriptor-reg any-reg) :to :result))
(:results (result :scs (descriptor-reg) :from :eval))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:generator 10
(with-fixed-allocation
......@@ -227,7 +228,7 @@
(:info name words type lowtag dynamic-extent)
(:ignore name)
(:results (result :scs (descriptor-reg)))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:generator 50
(let ((*enable-pseudo-atomic* (unless dynamic-extent
......@@ -246,7 +247,7 @@
(:results (result :scs (descriptor-reg) :from (:eval 1)))
(:temporary (:sc any-reg :from :eval :to (:eval 1)) bytes)
(:temporary (:sc any-reg :from :eval :to :result) header)
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:generator 50
(inst lea bytes
......
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/array.lisp,v 1.1 2004/05/24 22:34:59 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/array.lisp,v 1.2 2004/07/14 20:56:24 cwang Rel $")
;;;
;;; **********************************************************************
;;;
......@@ -32,7 +32,7 @@
(:arg-types positive-fixnum positive-fixnum)
(:temporary (:sc any-reg :to :eval) bytes)
(:temporary (:sc any-reg :to :result) header)
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:results (result :scs (descriptor-reg) :from :eval))
(:node-var node)
(:generator 13
......
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/call.lisp,v 1.3 2004/07/08 17:32:30 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/call.lisp,v 1.4 2004/07/14 20:56:24 cwang Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -1369,6 +1369,7 @@
(:temporary (:sc unsigned-reg :offset rsi-offset :from (:argument 0)) src)
(:temporary (:sc unsigned-reg :offset rcx-offset :from (:argument 1)) rcx)
(:temporary (:sc unsigned-reg :offset rax-offset) rax)
(:temporary (:sc unsigned-reg :offset r11-offset) r11)
(:temporary (:sc unsigned-reg) dst)
(:results (result :scs (descriptor-reg)))
(:node-var node)
......@@ -1385,7 +1386,7 @@
(let ((*enable-pseudo-atomic* (unless dynamic-extent
*enable-pseudo-atomic*)))
(pseudo-atomic
(allocation dst dst rax node dynamic-extent)
(allocation dst dst r11 node dynamic-extent)
(inst lea dst (make-ea :byte :base dst :disp list-pointer-type))
;; Convert the count into a raw value, so we can use the LOOP inst.
(inst shr rcx 2)
......
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/float.lisp,v 1.1 2004/05/24 22:34:59 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/float.lisp,v 1.2 2004/07/14 20:57:31 cwang Rel $")
;;;
;;; **********************************************************************
;;;
......@@ -404,7 +404,7 @@
(define-vop (move-from-single)
(:args (x :scs (single-reg) :to :save))
(:results (y :scs (descriptor-reg)))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:note "float to pointer coercion")
(:generator 13
......@@ -417,7 +417,7 @@
(define-vop (move-from-double)
(:args (x :scs (double-reg) :to :save))
(:results (y :scs (descriptor-reg)))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:note "float to pointer coercion")
(:generator 13
......@@ -509,7 +509,7 @@
(define-vop (move-from-complex-single)
(:args (x :scs (complex-single-reg) :to :save))
(:results (y :scs (descriptor-reg)))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:note "complex float to pointer coercion")
(:generator 13
......@@ -527,7 +527,7 @@
(define-vop (move-from-complex-double)
(:args (x :scs (complex-double-reg) :to :save))
(:results (y :scs (descriptor-reg)))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:node-var node)
(:note "complex float to pointer coercion")
(:generator 13
......
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/macros.lisp,v 1.3 2004/07/06 20:18:42 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/macros.lisp,v 1.4 2004/07/14 20:58:45 cwang Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -168,6 +168,8 @@
(inst mov dst-tn size)))
(defun inline-allocation (alloc-tn size temp-tn)
;; Since linkage table will trash r11, the easiest solution is to make sure temp-tn is r11
(assert (= (tn-offset temp-tn) #.r11-offset))
(let ((ok (gen-label)))
;;
;; Load the size first so that the size can be in the same
......@@ -194,7 +196,7 @@
(#.r8-offset "alloc_overflow_r8")
(#.r9-offset "alloc_overflow_r9")
(#.r10-offset "alloc_overflow_r10")
(#.r11-offset "alloc_overflow_r11")
;; no r11
(#.r12-offset "alloc_overflow_r12")
(#.r13-offset "alloc_overflow_r13")
(#.r14-offset "alloc_overflow_r14")
......
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/move.lisp,v 1.3 2004/07/06 20:19:58 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/move.lisp,v 1.4 2004/07/14 20:59:48 cwang Rel $")
;;;
;;; **********************************************************************
;;;
......@@ -289,28 +289,11 @@
;;; Result may be a bignum, so we have to check. Use a worst-case cost to make
;;; sure people know they may be number consing.
;;;
#+nil
(define-vop (move-from-signed)
(:args (x :scs (signed-reg unsigned-reg) :target rax))
(:temporary (:sc unsigned-reg :offset rax-offset :from (:argument 0)) rax)
(:temporary (:sc unsigned-reg :offset rbx-offset :to (:result 0) :target y)
rbx)
(:temporary (:sc unsigned-reg :offset rcx-offset
:from (:argument 0) :to (:result 0)) rcx)
(:ignore rcx)
(:results (y :scs (any-reg descriptor-reg)))
(:note "signed word to integer coercion")
(:generator 20
(move rax x)
(inst call (make-fixup 'move-from-signed :assembly-routine))
(move y rbx)))
;;;
;;; Faster inline version,
(define-vop (move-from-signed)
(:args (x :scs (signed-reg unsigned-reg) :to :result))
(:results (y :scs (any-reg descriptor-reg) :from :argument))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:note "signed word to integer coercion")
(:node-var node)
(:generator 20
......@@ -337,27 +320,11 @@
;;; Check for fixnum, and possibly allocate one or two word bignum result. Use
;;; a worst-case cost to make sure people know they may be number consing.
;;;
#+nil
(define-vop (move-from-unsigned)
(:args (x :scs (signed-reg unsigned-reg) :target rax))
(:temporary (:sc unsigned-reg :offset rax-offset :from (:argument 0)) rax)
(:temporary (:sc unsigned-reg :offset rbx-offset :to (:result 0) :target y)
rbx)
(:temporary (:sc unsigned-reg :offset rcx-offset
:from (:argument 0) :to (:result 0)) rcx)
(:ignore rcx)
(:results (y :scs (any-reg descriptor-reg)))
(:note "unsigned word to integer coercion")
(:generator 20
(move rax x)
(inst call (make-fixup 'move-from-unsigned :assembly-routine))
(move y rbx)))
;;;
;;; Faster inline version.
(define-vop (move-from-unsigned)
(:args (x :scs (signed-reg unsigned-reg) :to :save))
(:temporary (:sc unsigned-reg) alloc)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:results (y :scs (any-reg descriptor-reg)))
(:node-var node)
(:note "unsigned word to integer coercion")
......@@ -391,11 +358,7 @@
bignum-type))
(emit-label l1)
(pseudo-atomic
;; We don't have enough registers. So I'm using y here
;; We can fix it when we use r8-r15
(inst push y)
(allocation alloc (pad-data-block (+ bignum-digits-offset 2)) y node)
(inst pop y)
(allocation alloc (pad-data-block (+ bignum-digits-offset 2)) temp node)
(storew y alloc)
(inst lea y (make-ea :byte :base alloc :disp other-pointer-type))
(storew x y bignum-digits-offset other-pointer-type))
......
......@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/sap.lisp,v 1.2 2004/06/10 01:45:39 cwang Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/amd64/sap.lisp,v 1.3 2004/07/14 21:00:17 cwang Rel $")
;;;
;;; **********************************************************************
;;;
......@@ -41,7 +41,7 @@
(define-vop (move-from-sap)
(:args (sap :scs (sap-reg) :to :result))
(:results (res :scs (descriptor-reg) :from :argument))
(:temporary (:sc any-reg) temp)
(:temporary (:sc any-reg :offset r11-offset) temp)
(:note "SAP to pointer coercion")
(:node-var node)
(:generator 20
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment