X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fsparc%2Fnlx.lisp;h=0f76a3358d022da8eca8fe75bbc436e5f5d4a1cd;hb=f6b2e375747a54a1bfa34ead9f9af2d4e8b5aa38;hp=4553b66bf25106f039ade178d2720d791838081f;hpb=db0691b05cc99ce010ecae78bb532b594aea1859;p=sbcl.git diff --git a/src/compiler/sparc/nlx.lisp b/src/compiler/sparc/nlx.lisp index 4553b66..0f76a33 100644 --- a/src/compiler/sparc/nlx.lisp +++ b/src/compiler/sparc/nlx.lisp @@ -1,5 +1,5 @@ -;;;; the definitions of VOPs used for non-local exit (throw, lexical -;;;; exit, etc.) +;;;; the SPARC definitions of VOPs used for non-local exit (throw, +;;;; lexical exit, etc.) ;;;; This software is part of the SBCL system. See the README file for ;;;; more information. @@ -13,14 +13,14 @@ (in-package "SB!VM") ;;; Make an environment-live stack TN for saving the SP for NLX entry. -(!def-vm-support-routine make-nlx-sp-tn (env) +(defun make-nlx-sp-tn (env) (physenv-live-tn (make-representation-tn *fixnum-primitive-type* immediate-arg-scn) env)) ;;; Make a TN for the argument count passing location for a non-local ;;; entry. -(!def-vm-support-routine make-nlx-entry-arg-start-location () +(defun make-nlx-entry-arg-start-location () (make-wired-tn *fixnum-primitive-type* immediate-arg-scn ocfp-offset)) ;;; save and restore dynamic environment. @@ -33,45 +33,39 @@ ;;; additional stacks, then this would be the place to restore the top ;;; pointers. - -;;; Return a list of TNs that can be used to snapshot the dynamic -;;; state for use with the Save/Restore-Dynamic-Environment VOPs. -(!def-vm-support-routine make-dynamic-state-tns () - (make-n-tns 4 *backend-t-primitive-type*)) - (define-vop (save-dynamic-state) (:results (catch :scs (descriptor-reg)) - (nfp :scs (descriptor-reg)) - (nsp :scs (descriptor-reg))) + (nfp :scs (descriptor-reg)) + (nsp :scs (descriptor-reg))) (:vop-var vop) (:generator 13 - (load-symbol-value catch *current-catch-block*) - (let ((cur-nfp (current-nfp-tn vop))) - (when cur-nfp - (move nfp cur-nfp))) - (move nsp nsp-tn))) + (load-symbol-value catch *current-catch-block*) + (let ((cur-nfp (current-nfp-tn vop))) + (when cur-nfp + (move nfp cur-nfp))) + (move nsp nsp-tn))) (define-vop (restore-dynamic-state) (:args (catch :scs (descriptor-reg)) - (nfp :scs (descriptor-reg)) - (nsp :scs (descriptor-reg))) + (nfp :scs (descriptor-reg)) + (nsp :scs (descriptor-reg))) (:vop-var vop) (:generator 10 - (store-symbol-value catch *current-catch-block*) - (let ((cur-nfp (current-nfp-tn vop))) - (when cur-nfp - (move cur-nfp nfp))) - (move nsp-tn nsp))) + (store-symbol-value catch *current-catch-block*) + (let ((cur-nfp (current-nfp-tn vop))) + (when cur-nfp + (move cur-nfp nfp))) + (move nsp-tn nsp))) (define-vop (current-stack-pointer) (:results (res :scs (any-reg descriptor-reg))) (:generator 1 - (move res csp-tn))) + (move res csp-tn))) (define-vop (current-binding-pointer) (:results (res :scs (any-reg descriptor-reg))) (:generator 1 - (move res bsp-tn))) + (move res bsp-tn))) ;;;; unwind block hackery: @@ -99,7 +93,7 @@ ;;; link the block into the Current-Catch list. (define-vop (make-catch-block) (:args (tn) - (tag :scs (any-reg descriptor-reg))) + (tag :scs (any-reg descriptor-reg))) (:info entry-label) (:results (block :scs (any-reg))) (:temporary (:scs (descriptor-reg)) temp) @@ -156,9 +150,9 @@ (define-vop (nlx-entry) (:args (sp) ; Note: we can't list an sc-restriction, 'cause any load vops - ; would be inserted before the LRA. - (start) - (count)) + ; would be inserted before the LRA. + (start) + (count)) (:results (values :more t)) (:temporary (:scs (descriptor-reg)) move-temp) (:info label nvals) @@ -168,47 +162,47 @@ (emit-return-pc label) (note-this-location vop :non-local-entry) (cond ((zerop nvals)) - ((= nvals 1) - (let ((no-values (gen-label))) - (inst cmp count) - (inst b :eq no-values) - (move (tn-ref-tn values) null-tn) - (loadw (tn-ref-tn values) start) - (emit-label no-values))) - (t - (collect ((defaults)) - (inst subcc count (fixnumize 1)) - (do ((i 0 (1+ i)) - (tn-ref values (tn-ref-across tn-ref))) - ((null tn-ref)) - (let ((default-lab (gen-label)) - (tn (tn-ref-tn tn-ref))) - (defaults (cons default-lab tn)) - - (inst b :lt default-lab) - (inst subcc count (fixnumize 1)) - (sc-case tn - ((descriptor-reg any-reg) - (loadw tn start i)) - (control-stack - (loadw move-temp start i) - (store-stack-tn tn move-temp))))) - - (let ((defaulting-done (gen-label))) - - (emit-label defaulting-done) - - (assemble (*elsewhere*) - (dolist (def (defaults)) - (emit-label (car def)) - (let ((tn (cdr def))) - (sc-case tn - ((descriptor-reg any-reg) - (move tn null-tn)) - (control-stack - (store-stack-tn tn null-tn))))) - (inst b defaulting-done) - (inst nop)))))) + ((= nvals 1) + (let ((no-values (gen-label))) + (inst cmp count) + (inst b :eq no-values) + (move (tn-ref-tn values) null-tn) + (loadw (tn-ref-tn values) start) + (emit-label no-values))) + (t + (collect ((defaults)) + (inst subcc count (fixnumize 1)) + (do ((i 0 (1+ i)) + (tn-ref values (tn-ref-across tn-ref))) + ((null tn-ref)) + (let ((default-lab (gen-label)) + (tn (tn-ref-tn tn-ref))) + (defaults (cons default-lab tn)) + + (inst b :lt default-lab) + (inst subcc count (fixnumize 1)) + (sc-case tn + ((descriptor-reg any-reg) + (loadw tn start i)) + (control-stack + (loadw move-temp start i) + (store-stack-tn tn move-temp))))) + + (let ((defaulting-done (gen-label))) + + (emit-label defaulting-done) + + (assemble (*elsewhere*) + (dolist (def (defaults)) + (emit-label (car def)) + (let ((tn (cdr def))) + (sc-case tn + ((descriptor-reg any-reg) + (move tn null-tn)) + (control-stack + (store-stack-tn tn null-tn))))) + (inst b defaulting-done) + (inst nop)))))) (load-stack-tn csp-tn sp))) @@ -220,14 +214,14 @@ (:temporary (:scs (any-reg)) dst) (:temporary (:scs (descriptor-reg)) temp) (:results (result :scs (any-reg) :from (:argument 0)) - (num :scs (any-reg) :from (:argument 0))) + (num :scs (any-reg) :from (:argument 0))) (:save-p :force-to-stack) (:vop-var vop) (:generator 30 (emit-return-pc label) (note-this-location vop :non-local-entry) (let ((loop (gen-label)) - (done (gen-label))) + (done (gen-label))) ;; Setup results, and test for the zero value case. (load-stack-tn result top)