Changeset 635


Ignore:
Timestamp:
Mar 7, 2004, 12:03:30 AM (21 years ago)
Author:
Gary Byers
Message:

Don't use dynamic block/go tags. Forget about event-polling, etc.

Location:
trunk/ccl/compiler
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/compiler/nx0.lisp

    r292 r635  
    4444(defvar *nx-cur-func-name* nil)
    4545(defvar *nx-form-type* t)
    46 (defvar *nx-nlexit-count* 0)
    47 (defvar *nx-event-checking-call-count* 0)
    4846;(defvar *nx-proclaimed-inline* nil)
    4947;(defvar *nx-proclaimed-inline* (make-hash-table :size 400 :test #'eq))
     
    10681066         (*nx1-fcells* nil)
    10691067         (*nx1-vcells* nil)
    1070          (*nx-nlexit-count* 0)
    10711068         (*nx-inline-expansions* nil)
    1072          (*nx-event-checking-call-count* 0)
    10731069         (*nx-parsing-lambda-decls* nil)
    10741070         (*nx-next-method-var* (if q *nx-next-method-var*))
     
    16681664                     `(,(if (eql spread-p 0) 'applyv 'apply) ,sym ,args)
    16691665                     `(funcall ,sym ,@args))))
    1670                 (let* ((nlexits *nx-nlexit-count*)
    1671                        (val (nx1-call-form sym afunc args spread-p)))
     1666                (let* ((val (nx1-call-form sym afunc args spread-p)))
    16721667                    (when afunc
    16731668                      (let ((callers (afunc-callers afunc))
     
    16751670                        (unless (or (eq self afunc) (memq self callers))
    16761671                          (setf (afunc-callers afunc) (cons self callers)))))
    1677                     (unless (neq nlexits *nx-nlexit-count*)
    1678                       (setq *nx-event-checking-call-count* (%i+ *nx-event-checking-call-count* 1)))
    16791672                    (if (and (null afunc) (memq sym *nx-never-tail-call*))
    16801673                      (make-acode (%nx1-operator values) (list val))
     
    16961689  (let* ((stkforms nil)
    16971690         (regforms nil)
    1698          (nstkargs (%i- (length args) nregargs))
    1699          called
    1700          exited
    1701          calls
    1702          exits)
     1691         (nstkargs (%i- (length args) nregargs)))
    17031692    (declare (fixnum nstkargs))
    1704     (let* ((*nx-event-checking-call-count* *nx-event-checking-call-count*)
    1705            (*nx-nlexit-count* *nx-nlexit-count*))
    17061693      (list
    1707        (dotimes (i nstkargs stkforms)
     1694       (dotimes (i nstkargs (nreverse stkforms))
    17081695         (declare (fixnum i))
    1709          (setq calls *nx-event-checking-call-count*
    1710                exits *nx-nlexit-count*)
    17111696         (push (nx1-form (%car args)) stkforms)
    1712         (unless called
    1713           (unless (eq exits (setq exits *nx-nlexit-count*))
    1714             (setq exited exits)))
    1715         (unless exited
    1716           (unless (eq calls (setq calls *nx-event-checking-call-count*))
    1717             (setq called calls)))
    17181697         (setq args (%cdr args)))
    17191698       (dolist (arg args regforms)
    1720          (push (nx1-form arg) regforms)
    1721         (unless called
    1722           (unless (eq exits (setq exits *nx-nlexit-count*))
    1723             (setq exited exits)))
    1724         (unless exited
    1725           (unless (eq calls (setq calls *nx-event-checking-call-count*))
    1726             (setq called calls))))))
    1727     (list (nreverse stkforms) regforms)))
    1728 
    1729 ; Bind "event-checking-call" and "non-local-exit" counts, setq at most
    1730 ; one of them to an incremented value (depending on which happened first.)
    1731 (defun nx1-formlist (args &aux a exited called)
    1732   (let* ((*nx-event-checking-call-count* *nx-event-checking-call-count*)
    1733          (*nx-nlexit-count* *nx-nlexit-count*))
     1699         (push (nx1-form arg) regforms)))))
     1700
     1701(defun nx1-formlist (args)
     1702  (let* ((a nil))
    17341703    (dolist (arg args)
    1735       (let ((calls *nx-event-checking-call-count*)
    1736             (exits *nx-nlexit-count*))
    1737         (push (nx1-form arg) a)
    1738         (unless called
    1739           (unless (eq exits (setq exits *nx-nlexit-count*))
    1740             (setq exited exits)))
    1741         (unless exited
    1742           (unless (eq calls (setq calls *nx-event-checking-call-count*))
    1743             (setq called calls))))))
    1744   (if called
    1745     (setq *nx-event-checking-call-count* called)
    1746     (if exited
    1747       (setq *nx-nlexit-count* exited)))
    1748   (nreverse a))
     1704      (push (nx1-form arg) a))
     1705    (nreverse a)))
    17491706
    17501707(defun nx1-verify-length (forms min max &aux (len (list-length forms)))
  • trunk/ccl/compiler/nx1.lisp

    r356 r635  
    401401
    402402(defnx1 nx1-throw (throw) (tag valuesform)
    403   (setq *nx-nlexit-count* (%i+ *nx-nlexit-count* 1))
    404403  (make-acode (%nx1-operator throw) (nx1-form tag) (nx1-form valuesform)))
    405404
     
    850849      (return-from nx1-if (nx1-form `(progn ,test nil)))
    851850      (psetq test `(not ,test) true false false true)))
    852   (let ((testform nil)
    853         (trueform nil)
    854         (falseform nil)
    855         (called-in-test nil)
    856         (called-in-true)
    857         (called-in-false)
    858         (exited nil))
    859     (let* ((*nx-event-checking-call-count* *nx-event-checking-call-count*)
    860            (*nx-nlexit-count* *nx-nlexit-count*)
    861            (calls *nx-event-checking-call-count*)
    862            (exits *nx-nlexit-count*))
    863       (setq testform (nx1-form test))
    864       (if (neq calls (setq calls *nx-event-checking-call-count*))
    865         (setq called-in-test calls)
    866         (if (neq exits (setq exits *nx-nlexit-count*))
    867           (setq exited exits)))
    868       (setq trueform (nx1-form true))
    869       (unless (or called-in-test exited)
    870         (if (neq calls (setq calls *nx-event-checking-call-count*))
    871           (setq called-in-true calls)
    872           (if (neq exits (setq exits *nx-nlexit-count*))
    873             (setq exited exits))))
    874       (setq falseform (nx1-form false))
    875       (unless (or called-in-test exited)
    876         (if (neq calls (setq calls *nx-event-checking-call-count*))
    877           (setq called-in-false calls)
    878           (if (neq exits (setq exits *nx-nlexit-count*))
    879             (setq exited exits)))))
    880     (if exited
    881       (setq *nx-nlexit-count* exited)
    882       (if (setq called-in-test (or called-in-test (and called-in-true called-in-false)))
    883         (setq *nx-event-checking-call-count* called-in-test))) 
    884     (make-acode (%nx1-operator if) testform trueform falseform)))
     851  (make-acode (%nx1-operator if)  (nx1-form test) (nx1-form true) (nx1-form false)))
    885852
    886853(defnx1 nx1-%debug-trap dbg (&optional arg)
     
    11451112    (dolist (tag (setq newtags (nreverse newtags)))
    11461113      (push tag *nx-tags*))
    1147     (let* ((body nil)
    1148            (nlexit-count *nx-nlexit-count*)
    1149            (call-count *nx-event-checking-call-count*))
     1114    (let* ((body nil))
    11501115      (dolist (form args (setq body (nreverse body)))
    11511116        (push
     
    11541119             (%rplaca (%cdr (%cdr (%cdr (%cdr info)))) t)
    11551120             (cons (%nx1-operator tag-label) info))
    1156            (progn
    1157              (setq form (nx1-form form))
    1158              ; These are supposed to just be hints - pass 2 can (theoretically)
    1159              ; walk the acode itself ...
    1160              (if (neq call-count (setq call-count *nx-event-checking-call-count*))
    1161                (setq form (make-acode (%nx1-operator embedded-call) form)))
    1162              (if (neq nlexit-count (setq nlexit-count *nx-nlexit-count*))
    1163                (setq form (make-acode (%nx1-operator embedded-nlexit) form)))
    1164              form))
     1121           (nx1-form form))
    11651122         body))
    11661123      (if (eq 0 (%car counter))
    11671124        (make-acode (%nx1-operator local-tagbody) newtags body)
    11681125        (progn
     1126          (nx-set-var-bits catchvar (logior (nx-var-bits catchvar)
     1127                                            (%ilsl $vbitdynamicextent 1)))
    11691128          (nx-inhibit-register-allocation)   ; There are alternatives ...
    11701129          (dolist (tag (reverse newtags))
     
    11761135           (%nx1-operator let*)
    11771136           (list catchvar indexvar)
    1178            (list *nx-nil* *nx-nil*)
     1137           (list (make-acode (%nx1-operator cons) *nx-nil* *nx-nil*) *nx-nil*)
    11791138           (make-acode
    11801139            (%nx1-operator local-tagbody)
     
    11891148               (make-acode
    11901149                (%nx1-operator catch)
    1191                 (nx1-form `(setq ,(var-name catchvar) (%newgotag)))  ;(make-acode (%nx1-operator newgotag))
     1150                (nx1-form (var-name catchvar))
    11921151                (make-acode
    11931152                 (%nx1-operator local-tagbody)
     
    12081167      (let ((defnbackref (cdr (cdr (cdr (cdr info))))))
    12091168        (if (car defnbackref)
    1210           (rplaca (cdr defnbackref) t)
    1211           (setq *nx-nlexit-count* (%i+ *nx-nlexit-count* 1)))
     1169          (rplaca (cdr defnbackref) t))
    12121170        (make-acode (%nx1-operator local-go) info))
    12131171      (progn
    1214         (setq *nx-nlexit-count* (%i+ *nx-nlexit-count* 1))
     1172
    12151173        (make-acode
    12161174         (%nx1-operator throw) (nx1-symbol (var-name (cadddr info))) (nx1-form closed))))))
     
    12981256          body)
    12991257        (progn
     1258          (nx-set-var-bits tagvar (%ilogior (%ilsl $vbitdynamicextent 1) tagbits))
    13001259          (nx-inhibit-register-allocation)   ; Could also set $vbitnoreg in all setqed vars, or keep track better
    13011260          (make-acode
     
    13051264            (%nx1-operator let)
    13061265            (list tagvar)
    1307             (list (make-acode (%nx1-operator newblocktag)))
     1266            (list (make-acode (%nx1-operator cons) (nx1-form nil) (nx1-form nil)))
    13081267            (make-acode
    13091268             (%nx1-operator catch)
    1310              (list (%nx1-operator lexical-reference) tagvar)
     1269             (make-acode (%nx1-operator lexical-reference) tagvar)
    13111270             body)
    13121271            0)))))))
     
    13171276    (unless info (nx-error "Can't RETURN-FROM block : ~S." blockname))
    13181277    (unless closed (nx-adjust-ref-count (cdr info)))
    1319     (setq *nx-nlexit-count* (%i+ *nx-nlexit-count* 1))
    13201278    (make-acode
    13211279     (if closed
Note: See TracChangeset for help on using the changeset viewer.