Commit b90e144d authored by Carl Shapiro's avatar Carl Shapiro
Browse files

Use movxz in load-type to avoid byte-register restrictions.

parent 19aa444c
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
(:args (function :scs (descriptor-reg) :target result) (:args (function :scs (descriptor-reg) :target result)
(fdefn :scs (descriptor-reg))) (fdefn :scs (descriptor-reg)))
(:temporary (:sc unsigned-reg) raw) (:temporary (:sc unsigned-reg) raw)
(:temporary (:sc byte-reg) type) (:temporary (:sc unsigned-reg) type)
(:results (result :scs (descriptor-reg))) (:results (result :scs (descriptor-reg)))
(:generator 38 (:generator 38
(load-type type function (- function-pointer-type)) (load-type type function (- function-pointer-type))
......
...@@ -110,10 +110,10 @@ ...@@ -110,10 +110,10 @@
(n-offset offset)) (n-offset offset))
(ecase (backend-byte-order *target-backend*) (ecase (backend-byte-order *target-backend*)
(:little-endian (:little-endian
`(inst mov ,n-target `(inst movzx ,n-target
(make-ea :byte :base ,n-source :disp ,n-offset))) (make-ea :byte :base ,n-source :disp ,n-offset)))
(:big-endian (:big-endian
`(inst mov ,n-target `(inst movzx ,n-target
(make-ea :byte :base ,n-source :disp (+ ,n-offset 3))))))) (make-ea :byte :base ,n-source :disp (+ ,n-offset 3)))))))
(defmacro load-foreign-data-symbol (reg name ) (defmacro load-foreign-data-symbol (reg name )
......
...@@ -39,50 +39,48 @@ ...@@ -39,50 +39,48 @@
(define-vop (get-type) (define-vop (get-type)
(:translate get-type) (:translate get-type)
(:policy :fast-safe) (:policy :fast-safe)
(:args (object :scs (descriptor-reg))) (:args (object :scs (descriptor-reg) :to (:eval 1)))
(:temporary (:sc unsigned-reg :offset eax-offset :to (:result 0)) eax) (:results (result :scs (unsigned-reg) :from (:eval 0)))
(:results (result :scs (unsigned-reg)))
(:result-types positive-fixnum) (:result-types positive-fixnum)
(:generator 6 (:generator 6
(inst mov eax object) ;; Pick off objects with headers.
(inst and al-tn lowtag-mask) (inst mov result object)
(inst cmp al-tn other-pointer-type) (inst and result lowtag-mask)
(inst cmp result other-pointer-type)
(inst jmp :e other-ptr) (inst jmp :e other-ptr)
(inst cmp al-tn function-pointer-type) (inst cmp result function-pointer-type)
(inst jmp :e function-ptr) (inst jmp :e function-ptr)
;; pick off structures and list pointers ;; Pick off structure and list pointers.
(inst test al-tn 1) (inst test result 1)
(inst jmp :ne done) (inst jmp :nz done)
;; pick off fixnums ;; Pick off fixnums.
(inst and al-tn 3) (inst and result 3)
(inst jmp :e done) (inst jmp :z done)
;; must be an other immediate ;; Must be an other immediate.
(inst mov eax object) (inst mov result object)
(inst and result type-mask)
(inst jmp done) (inst jmp done)
FUNCTION-PTR FUNCTION-PTR
(load-type al-tn object (- vm:function-pointer-type)) (load-type result object (- vm:function-pointer-type))
(inst jmp done) (inst jmp done)
OTHER-PTR OTHER-PTR
(load-type al-tn object (- vm:other-pointer-type)) (load-type result object (- vm:other-pointer-type))
DONE DONE))
(inst movzx result al-tn)))
(define-vop (function-subtype) (define-vop (function-subtype)
(:translate function-subtype) (:translate function-subtype)
(:policy :fast-safe) (:policy :fast-safe)
(:args (function :scs (descriptor-reg))) (:args (function :scs (descriptor-reg)))
(:temporary (:sc byte-reg :from (:eval 0) :to (:eval 1)) temp)
(:results (result :scs (unsigned-reg))) (:results (result :scs (unsigned-reg)))
(:result-types positive-fixnum) (:result-types positive-fixnum)
(:generator 6 (:generator 6
(load-type temp function (- vm:function-pointer-type)) (load-type result function (- vm:function-pointer-type))))
(inst movzx result temp)))
(define-vop (set-function-subtype) (define-vop (set-function-subtype)
(:translate (setf function-subtype)) (:translate (setf function-subtype))
......
...@@ -58,23 +58,21 @@ ...@@ -58,23 +58,21 @@
(:results (start :scs (any-reg)) (:results (start :scs (any-reg))
(count :scs (any-reg))) (count :scs (any-reg)))
(:temporary (:sc descriptor-reg :from (:argument 0) :to (:result 1)) list) (:temporary (:sc descriptor-reg :from (:argument 0) :to (:result 1)) list)
(:temporary (:sc descriptor-reg :to (:result 1)) nil-temp) (:temporary (:sc unsigned-reg :to (:result 1)) temp)
(:temporary (:sc unsigned-reg :offset eax-offset :to (:result 1)) eax)
(:vop-var vop) (:vop-var vop)
(:save-p :compute-only) (:save-p :compute-only)
(:generator 0 (:generator 0
(move list arg) (move list arg)
(move start esp-tn) ; WARN pointing 1 below (move start esp-tn) ; WARN pointing 1 below
(inst mov nil-temp nil-value)
LOOP LOOP
(inst cmp list nil-temp) (inst cmp list nil-value)
(inst jmp :e done) (inst jmp :e done)
(pushw list cons-car-slot list-pointer-type) (pushw list cons-car-slot list-pointer-type)
(loadw list list cons-cdr-slot list-pointer-type) (loadw list list cons-cdr-slot list-pointer-type)
(inst mov eax list) (inst mov temp list)
(inst and al-tn lowtag-mask) (inst and temp lowtag-mask)
(inst cmp al-tn list-pointer-type) (inst cmp temp list-pointer-type)
(inst jmp :e loop) (inst jmp :e loop)
(error-call vop bogus-argument-to-values-list-error list) (error-call vop bogus-argument-to-values-list-error list)
......
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